From 4c74ec9fddf7cbc042bf59cb5981f7c1c5bff04b Mon Sep 17 00:00:00 2001 From: Juanfran Date: Wed, 13 Sep 2023 12:10:04 +0200 Subject: [PATCH] chore: remove core lib & migrate to cdk --- javascript/apps/taiga-e2e/tsconfig.json | 2 +- .../apps/taiga/src/app/app.component.ts | 5 +-- javascript/apps/taiga/src/app/app.module.ts | 8 ++-- .../social-login-button.component.spec.ts | 3 +- .../social-login-button.component.ts | 2 +- .../social-login/social-login.component.ts | 2 +- .../modules/auth/guards/verify-email.guard.ts | 2 +- .../app/modules/auth/services/auth.service.ts | 2 +- .../modules/errors/403/error-403.component.ts | 2 +- .../modules/errors/404/error-404.component.ts | 2 +- .../modules/errors/500/error-500.component.ts | 2 +- .../effects/user-settings.effects.spec.ts | 9 +++-- .../+state/effects/user-settings.effects.ts | 7 ++-- .../assign-user/assign-user.component.ts | 2 +- .../guards/project-invitation-cta.guard.ts | 2 +- .../guards/project-invitation.guard.spec.ts | 3 +- .../guards/project-invitation.guard.ts | 2 +- .../project-feature-kanban.component.ts | 2 +- .../remove-member/remove-member.component.ts | 2 +- .../story-detail-title.component.ts | 2 +- .../guards/workspace-invitation-cta.guard.ts | 2 +- .../language/language.service.spec.ts | 12 ++---- .../app/services/language/language.service.ts | 16 ++++++-- .../services/ws/services/ws.service.spec.ts | 2 +- .../app/services/ws/services/ws.service.ts | 5 ++- .../api-rest-interceptor.service.spec.ts | 3 +- .../api-rest-interceptor.service.ts | 18 +-------- .../attachments/attachments.component.ts | 2 +- .../directives/shorcut/shorcut.directive.ts | 2 +- javascript/docs/workflows/api/api.workflow.md | 2 +- .../workflows/feature/effects.workflow.md | 2 - .../workflows/testing/api-testing.workflow.md | 4 +- .../docs/workflows/ui/shortcuts.worflow.md | 8 ++-- .../api/src/lib/auth/auth-api.service.spec.ts | 3 +- .../libs/api/src/lib/auth/auth-api.service.ts | 2 +- .../lib/invitation/invitation-api.service.ts | 2 +- .../lib/project/project-api.service.spec.ts | 3 +- .../src/lib/project/project-api.service.ts | 2 +- .../api/src/lib/system/system-api.service.ts | 2 +- .../api/src/lib/users/users-api.service.ts | 2 +- .../workspace/workspace-api.service.spec.ts | 3 +- .../lib/workspace/workspace-api.service.ts | 2 +- javascript/libs/{core => cdk}/.eslintrc.json | 2 +- javascript/libs/{core => cdk}/README.md | 0 javascript/libs/{core => cdk}/jest.config.ts | 2 +- javascript/libs/{core => cdk}/project.json | 12 +++--- .../services/config/config.service.mock.ts | 0 .../src/lib/services/config/config.service.ts | 0 .../lib/services/config/config.validator.ts | 0 .../libs/cdk/src/lib/services/config/index.ts | 9 +++++ .../cdk/src/lib/services/shortcuts/index.ts | 9 +++++ .../services/shortcuts/shortcut-task.model.ts | 0 .../services/shortcuts/shortcuts.services.ts | 0 .../src/lib/services/shortcuts/shortcuts.ts | 0 .../libs/{core => cdk}/src/test-setup.ts | 0 javascript/libs/{core => cdk}/tsconfig.json | 0 .../libs/{core => cdk}/tsconfig.lib.json | 0 .../libs/{core => cdk}/tsconfig.spec.json | 0 javascript/libs/core/src/index.ts | 15 ------- javascript/libs/core/src/lib/core.actions.ts | 18 --------- javascript/libs/core/src/lib/core.module.ts | 23 ----------- javascript/libs/core/src/lib/core.reducer.ts | 40 ------------------- .../libs/core/src/lib/core.selectors.ts | 24 ----------- .../modal/components/modal/modal.component.ts | 2 +- .../ui/src/lib/tooltip/tooltip.directive.ts | 2 +- .../libs/ui/src/lib/tooltip/tooltip.spec.ts | 2 +- javascript/tsconfig.base.json | 2 +- 67 files changed, 111 insertions(+), 213 deletions(-) rename javascript/libs/{core => cdk}/.eslintrc.json (94%) rename javascript/libs/{core => cdk}/README.md (100%) rename javascript/libs/{core => cdk}/jest.config.ts (94%) rename javascript/libs/{core => cdk}/project.json (56%) rename javascript/libs/{core => cdk}/src/lib/services/config/config.service.mock.ts (100%) rename javascript/libs/{core => cdk}/src/lib/services/config/config.service.ts (100%) rename javascript/libs/{core => cdk}/src/lib/services/config/config.validator.ts (100%) create mode 100644 javascript/libs/cdk/src/lib/services/config/index.ts create mode 100644 javascript/libs/cdk/src/lib/services/shortcuts/index.ts rename javascript/libs/{core => cdk}/src/lib/services/shortcuts/shortcut-task.model.ts (100%) rename javascript/libs/{core => cdk}/src/lib/services/shortcuts/shortcuts.services.ts (100%) rename javascript/libs/{core => cdk}/src/lib/services/shortcuts/shortcuts.ts (100%) rename javascript/libs/{core => cdk}/src/test-setup.ts (100%) rename javascript/libs/{core => cdk}/tsconfig.json (100%) rename javascript/libs/{core => cdk}/tsconfig.lib.json (100%) rename javascript/libs/{core => cdk}/tsconfig.spec.json (100%) delete mode 100644 javascript/libs/core/src/index.ts delete mode 100644 javascript/libs/core/src/lib/core.actions.ts delete mode 100644 javascript/libs/core/src/lib/core.module.ts delete mode 100644 javascript/libs/core/src/lib/core.reducer.ts delete mode 100644 javascript/libs/core/src/lib/core.selectors.ts diff --git a/javascript/apps/taiga-e2e/tsconfig.json b/javascript/apps/taiga-e2e/tsconfig.json index 7374898e3..abfca0a9e 100644 --- a/javascript/apps/taiga-e2e/tsconfig.json +++ b/javascript/apps/taiga-e2e/tsconfig.json @@ -7,7 +7,7 @@ "types": ["cypress", "cypress-axe"], "paths": { "@taiga/api": ["libs/api/src/index.ts"], - "@taiga/core": ["libs/core/src/index.ts"], + "@taiga/cdk/*": ["libs/cdk/src/lib/*"], "@taiga/data": ["libs/data/src/index.ts"], "@taiga/ui/*": ["libs/ui/src/lib/*"], "@test/*": ["apps/taiga-e2e/src/*"], diff --git a/javascript/apps/taiga/src/app/app.component.ts b/javascript/apps/taiga/src/app/app.component.ts index 5a27a3989..dd4a868cc 100644 --- a/javascript/apps/taiga/src/app/app.component.ts +++ b/javascript/apps/taiga/src/app/app.component.ts @@ -11,7 +11,6 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; import { TranslocoService } from '@ngneat/transloco'; import { concatLatestFrom } from '@ngrx/effects'; import { Store } from '@ngrx/store'; -import { selectLanguages } from '@taiga/core'; import { User } from '@taiga/data'; import { Observable, of } from 'rxjs'; import { filter, map, share, switchMap } from 'rxjs/operators'; @@ -23,7 +22,7 @@ import { LocalStorageService } from './shared/local-storage/local-storage.servic import { RouteHistoryService } from './shared/route-history/route-history.service'; import { InputModalityDetector } from '@angular/cdk/a11y'; import { LanguageService } from './services/language/language.service'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @Component({ @@ -127,7 +126,7 @@ export class AppComponent { } return of({ userLang: user.lang, anonymous: false }); }), - concatLatestFrom(() => [this.store.select(selectLanguages)]) + concatLatestFrom(() => [this.languageService.getLanguages()]) ) .subscribe(([user, languages]) => { const lang = languages.find((it) => it.code === user.userLang); diff --git a/javascript/apps/taiga/src/app/app.module.ts b/javascript/apps/taiga/src/app/app.module.ts index 317b3f41b..1666bdefd 100644 --- a/javascript/apps/taiga/src/app/app.module.ts +++ b/javascript/apps/taiga/src/app/app.module.ts @@ -29,7 +29,7 @@ import { import { TUI_LANGUAGE } from '@taiga-ui/i18n'; import { tuiToggleOptionsProvider } from '@taiga-ui/kit'; import { SystemApiService } from '@taiga/api'; -import { ConfigService, CoreModule, coreActions } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { PROMPT_PROVIDER } from '@taiga/ui/modal/services/modal.service'; import { paramCase } from 'change-case'; import { DataAccessAuthModule } from '~/app/modules/auth/data-access/auth.module'; @@ -72,7 +72,6 @@ export function prefersReducedMotion(): boolean { imports: [ DataAccessAuthModule, ErrorsModule, - CoreModule, HttpClientModule, ApiRestInterceptorModule, NavigationModule, @@ -119,6 +118,7 @@ export function prefersReducedMotion(): boolean { EnvironmentService, TranslocoService, SystemApiService, + LanguageService, Store, ], useFactory: ( @@ -126,7 +126,7 @@ export function prefersReducedMotion(): boolean { environmentService: EnvironmentService, translocoService: TranslocoService, systemApiService: SystemApiService, - store: Store + languageService: LanguageService ) => { return () => { return new Promise((resolve) => { @@ -148,7 +148,7 @@ export function prefersReducedMotion(): boolean { } systemApiService.getLanguages().subscribe((langs) => { - store.dispatch(coreActions.setLanguages({ languages: langs })); + languageService.setLanguages(langs); const availableCodes = langs.map((lang) => lang.code); const defaultLang = langs.find((lang) => lang.isDefault); diff --git a/javascript/apps/taiga/src/app/modules/auth/components/social-login-button/social-login-button.component.spec.ts b/javascript/apps/taiga/src/app/modules/auth/components/social-login-button/social-login-button.component.spec.ts index 0d1fa5d07..623c4764b 100644 --- a/javascript/apps/taiga/src/app/modules/auth/components/social-login-button/social-login-button.component.spec.ts +++ b/javascript/apps/taiga/src/app/modules/auth/components/social-login-button/social-login-button.component.spec.ts @@ -10,7 +10,8 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { randBoolean, randUrl, randUuid } from '@ngneat/falso'; import { createComponentFactory, Spectator } from '@ngneat/spectator/jest'; -import { ConfigService, ConfigServiceMock } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; +import { ConfigServiceMock } from '@taiga/cdk/services/config/config.service.mock'; import { getTranslocoModule } from '~/app/transloco/transloco-testing.module'; import { SocialLoginButtonComponent } from './social-login-button.component'; diff --git a/javascript/apps/taiga/src/app/modules/auth/components/social-login-button/social-login-button.component.ts b/javascript/apps/taiga/src/app/modules/auth/components/social-login-button/social-login-button.component.ts index 26935d1d4..38f77ad6a 100644 --- a/javascript/apps/taiga/src/app/modules/auth/components/social-login-button/social-login-button.component.ts +++ b/javascript/apps/taiga/src/app/modules/auth/components/social-login-button/social-login-button.component.ts @@ -14,7 +14,7 @@ import { TranslocoService, TRANSLOCO_SCOPE, } from '@ngneat/transloco'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; interface SocialParams { social: string; diff --git a/javascript/apps/taiga/src/app/modules/auth/components/social-login/social-login.component.ts b/javascript/apps/taiga/src/app/modules/auth/components/social-login/social-login.component.ts index 8cc800349..748c1086f 100644 --- a/javascript/apps/taiga/src/app/modules/auth/components/social-login/social-login.component.ts +++ b/javascript/apps/taiga/src/app/modules/auth/components/social-login/social-login.component.ts @@ -10,7 +10,7 @@ import { CommonModule } from '@angular/common'; import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { TranslocoModule, TRANSLOCO_SCOPE } from '@ngneat/transloco'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { SocialLoginButtonComponent } from '../social-login-button/social-login-button.component'; import { ContextNotificationComponent } from '@taiga/ui/context-notification/context-notification.component'; diff --git a/javascript/apps/taiga/src/app/modules/auth/guards/verify-email.guard.ts b/javascript/apps/taiga/src/app/modules/auth/guards/verify-email.guard.ts index fd95fa260..b4bde001b 100644 --- a/javascript/apps/taiga/src/app/modules/auth/guards/verify-email.guard.ts +++ b/javascript/apps/taiga/src/app/modules/auth/guards/verify-email.guard.ts @@ -12,7 +12,7 @@ import { ActivatedRouteSnapshot, CanActivateFn, Router } from '@angular/router'; import { Store } from '@ngrx/store'; import { TuiNotification } from '@taiga-ui/core'; import { ProjectApiService, UsersApiService } from '@taiga/api'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Auth, ProjectInvitationInfo, diff --git a/javascript/apps/taiga/src/app/modules/auth/services/auth.service.ts b/javascript/apps/taiga/src/app/modules/auth/services/auth.service.ts index c63deee17..2dcec1264 100644 --- a/javascript/apps/taiga/src/app/modules/auth/services/auth.service.ts +++ b/javascript/apps/taiga/src/app/modules/auth/services/auth.service.ts @@ -10,7 +10,7 @@ import { Injectable } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; import { AuthApiService } from '@taiga/api'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Auth, User } from '@taiga/data'; import { WsService } from '~/app/services/ws'; import { LocalStorageService } from '~/app/shared/local-storage/local-storage.service'; diff --git a/javascript/apps/taiga/src/app/modules/errors/403/error-403.component.ts b/javascript/apps/taiga/src/app/modules/errors/403/error-403.component.ts index 13e70b52c..f938f839d 100644 --- a/javascript/apps/taiga/src/app/modules/errors/403/error-403.component.ts +++ b/javascript/apps/taiga/src/app/modules/errors/403/error-403.component.ts @@ -8,7 +8,7 @@ import { Component } from '@angular/core'; import { Router, RouterLink } from '@angular/router'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { TuiButtonModule } from '@taiga-ui/core'; import { TranslocoDirective } from '@ngneat/transloco'; import { CommonModule } from '@angular/common'; diff --git a/javascript/apps/taiga/src/app/modules/errors/404/error-404.component.ts b/javascript/apps/taiga/src/app/modules/errors/404/error-404.component.ts index 37c3cc615..010b83d32 100644 --- a/javascript/apps/taiga/src/app/modules/errors/404/error-404.component.ts +++ b/javascript/apps/taiga/src/app/modules/errors/404/error-404.component.ts @@ -8,7 +8,7 @@ import { Component } from '@angular/core'; import { Router, RouterLink } from '@angular/router'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { TuiButtonModule } from '@taiga-ui/core'; import { TranslocoDirective } from '@ngneat/transloco'; import { CommonModule } from '@angular/common'; diff --git a/javascript/apps/taiga/src/app/modules/errors/500/error-500.component.ts b/javascript/apps/taiga/src/app/modules/errors/500/error-500.component.ts index a33c38096..95ecb2daf 100644 --- a/javascript/apps/taiga/src/app/modules/errors/500/error-500.component.ts +++ b/javascript/apps/taiga/src/app/modules/errors/500/error-500.component.ts @@ -7,7 +7,7 @@ */ import { Component } from '@angular/core'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Router, RouterLink } from '@angular/router'; import { TuiButtonModule } from '@taiga-ui/core'; import { TranslocoDirective } from '@ngneat/transloco'; diff --git a/javascript/apps/taiga/src/app/modules/feature-user-settings/data-access/+state/effects/user-settings.effects.spec.ts b/javascript/apps/taiga/src/app/modules/feature-user-settings/data-access/+state/effects/user-settings.effects.spec.ts index 28e8d40d8..d89eb018c 100644 --- a/javascript/apps/taiga/src/app/modules/feature-user-settings/data-access/+state/effects/user-settings.effects.spec.ts +++ b/javascript/apps/taiga/src/app/modules/feature-user-settings/data-access/+state/effects/user-settings.effects.spec.ts @@ -10,7 +10,7 @@ import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; import { provideMockActions } from '@ngrx/effects/testing'; import { Action } from '@ngrx/store'; import { UsersApiService } from '@taiga/api'; -import { Observable } from 'rxjs'; +import { Observable, of } from 'rxjs'; import { AppService } from '~/app/services/app.service'; import { @@ -27,11 +27,11 @@ import { import { UserSettingsEffects } from './user-settings.effects'; import { MockStore, provideMockStore } from '@ngrx/store/testing'; -import { selectLanguages } from '@taiga/core'; import { selectUser } from '~/app/modules/auth/data-access/+state/selectors/auth.selectors'; import { AuthService } from '~/app/modules/auth/services/auth.service'; import { HttpErrorResponse } from '@angular/common/http'; import { unexpectedError } from '~/app/modules/errors/+state/actions/errors.actions'; +import { LanguageService } from '~/app/services/language/language.service'; describe('UserSettingsEffects', () => { let actions$: Observable; @@ -44,7 +44,7 @@ describe('UserSettingsEffects', () => { provideMockActions(() => actions$), provideMockStore({ initialState: {} }), ], - mocks: [UsersApiService, AppService, AuthService], + mocks: [UsersApiService, AppService, AuthService, LanguageService], }); beforeEach(() => { @@ -55,8 +55,9 @@ describe('UserSettingsEffects', () => { it('load languages', () => { const languages = LanguageListMockFactory(); const effects = spectator.inject(UserSettingsEffects); + const languageService = spectator.inject(LanguageService); - store.overrideSelector(selectLanguages, languages); + languageService.getLanguages.mockReturnValue(of(languages)); actions$ = hot('-a', { a: userSettingsActions.initPreferences() }); diff --git a/javascript/apps/taiga/src/app/modules/feature-user-settings/data-access/+state/effects/user-settings.effects.ts b/javascript/apps/taiga/src/app/modules/feature-user-settings/data-access/+state/effects/user-settings.effects.ts index 444bb47dd..b4043b09b 100644 --- a/javascript/apps/taiga/src/app/modules/feature-user-settings/data-access/+state/effects/user-settings.effects.ts +++ b/javascript/apps/taiga/src/app/modules/feature-user-settings/data-access/+state/effects/user-settings.effects.ts @@ -22,15 +22,15 @@ import { TuiNotification } from '@taiga-ui/core'; import { AuthService } from '~/app/modules/auth/services/auth.service'; import { selectUser } from '~/app/modules/auth/data-access/+state/selectors/auth.selectors'; import { filterNil } from '~/app/shared/utils/operators'; -import { selectLanguages } from '@taiga/core'; import { Router } from '@angular/router'; +import { LanguageService } from '~/app/services/language/language.service'; @Injectable() export class UserSettingsEffects { public loadLanguages$ = createEffect(() => { return this.actions$.pipe( ofType(userSettingsActions.initPreferences), - concatLatestFrom(() => [this.store.select(selectLanguages)]), + concatLatestFrom(() => [this.languageService.getLanguages()]), fetch({ run: (_, languages) => { return userSettingsApiActions.fetchLanguagesSuccess({ @@ -153,6 +153,7 @@ export class UserSettingsEffects { private appService: AppService, private actions$: Actions, private usersApiService: UsersApiService, - private router: Router + private router: Router, + private languageService: LanguageService ) {} } diff --git a/javascript/apps/taiga/src/app/modules/project/components/assign-user/assign-user.component.ts b/javascript/apps/taiga/src/app/modules/project/components/assign-user/assign-user.component.ts index b2de38b14..980d87b04 100644 --- a/javascript/apps/taiga/src/app/modules/project/components/assign-user/assign-user.component.ts +++ b/javascript/apps/taiga/src/app/modules/project/components/assign-user/assign-user.component.ts @@ -38,7 +38,7 @@ import { TuiSvgModule, } from '@taiga-ui/core'; import { TuiToggleModule } from '@taiga-ui/kit'; -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; import { Membership, Permissions, Story, User } from '@taiga/data'; import { InputsModule } from '@taiga/ui/inputs'; import { TooltipDirective } from '@taiga/ui/tooltip'; diff --git a/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation-cta.guard.ts b/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation-cta.guard.ts index 47c069e7d..602fc5642 100644 --- a/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation-cta.guard.ts +++ b/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation-cta.guard.ts @@ -11,7 +11,7 @@ import { inject } from '@angular/core'; import { ActivatedRouteSnapshot, CanActivateFn, Router } from '@angular/router'; import { TuiNotification } from '@taiga-ui/core'; import { ProjectApiService } from '@taiga/api'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { ProjectInvitationInfo, Project } from '@taiga/data'; import { of } from 'rxjs'; import { catchError, map, mergeMap } from 'rxjs/operators'; diff --git a/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation.guard.spec.ts b/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation.guard.spec.ts index 1935d3fd8..06216f6da 100644 --- a/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation.guard.spec.ts +++ b/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation.guard.spec.ts @@ -18,7 +18,8 @@ import { randUuid } from '@ngneat/falso'; import { mockProvider, SpyObject } from '@ngneat/spectator/jest'; import { ProjectApiService } from '@taiga/api'; -import { ConfigService, ConfigServiceMock } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; +import { ConfigServiceMock } from '@taiga/cdk/services/config/config.service.mock'; import { InvitationInfoMockFactory, ProjectMockFactory } from '@taiga/data'; import { of } from 'rxjs'; import { AuthService } from '~/app/modules/auth/services/auth.service'; diff --git a/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation.guard.ts b/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation.guard.ts index 1a4784376..38e64c6d2 100644 --- a/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation.guard.ts +++ b/javascript/apps/taiga/src/app/modules/project/data-access/guards/project-invitation.guard.ts @@ -11,7 +11,7 @@ import { inject } from '@angular/core'; import { ActivatedRouteSnapshot, Router } from '@angular/router'; import { TuiNotification } from '@taiga-ui/core'; import { ProjectApiService } from '@taiga/api'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { ProjectInvitationInfo } from '@taiga/data'; import { EMPTY, of, throwError } from 'rxjs'; import { catchError, mergeMap, tap } from 'rxjs/operators'; diff --git a/javascript/apps/taiga/src/app/modules/project/feature-kanban/project-feature-kanban.component.ts b/javascript/apps/taiga/src/app/modules/project/feature-kanban/project-feature-kanban.component.ts index 8909c4083..8a1779a81 100644 --- a/javascript/apps/taiga/src/app/modules/project/feature-kanban/project-feature-kanban.component.ts +++ b/javascript/apps/taiga/src/app/modules/project/feature-kanban/project-feature-kanban.component.ts @@ -15,7 +15,7 @@ import { concatLatestFrom } from '@ngrx/effects'; import { Store } from '@ngrx/store'; import { RxState } from '@rx-angular/state'; import { TuiNotification } from '@taiga-ui/core'; -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; import { Membership, Permissions, diff --git a/javascript/apps/taiga/src/app/modules/project/settings/feature-members/components/remove-member/remove-member.component.ts b/javascript/apps/taiga/src/app/modules/project/settings/feature-members/components/remove-member/remove-member.component.ts index 14572aa78..cc09a3604 100644 --- a/javascript/apps/taiga/src/app/modules/project/settings/feature-members/components/remove-member/remove-member.component.ts +++ b/javascript/apps/taiga/src/app/modules/project/settings/feature-members/components/remove-member/remove-member.component.ts @@ -17,7 +17,7 @@ import { } from '@angular/core'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { Store } from '@ngrx/store'; -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; import { Membership, Project, Role, User } from '@taiga/data'; import { finalize } from 'rxjs'; import { A11yModule } from '@angular/cdk/a11y'; diff --git a/javascript/apps/taiga/src/app/modules/project/story-detail/components/story-detail-title/story-detail-title.component.ts b/javascript/apps/taiga/src/app/modules/project/story-detail/components/story-detail-title/story-detail-title.component.ts index ad9852c37..ec04d4159 100644 --- a/javascript/apps/taiga/src/app/modules/project/story-detail/components/story-detail-title/story-detail-title.component.ts +++ b/javascript/apps/taiga/src/app/modules/project/story-detail/components/story-detail-title/story-detail-title.component.ts @@ -26,7 +26,7 @@ import { } from '@angular/forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { RxState } from '@rx-angular/state'; -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; import { StoryDetailForm } from '~/app/modules/project/story-detail/story-detail.component'; import { StoryTitleMaxLength, diff --git a/javascript/apps/taiga/src/app/modules/workspace/feature-detail/guards/workspace-invitation-cta.guard.ts b/javascript/apps/taiga/src/app/modules/workspace/feature-detail/guards/workspace-invitation-cta.guard.ts index 283037b7a..ac9e5c458 100644 --- a/javascript/apps/taiga/src/app/modules/workspace/feature-detail/guards/workspace-invitation-cta.guard.ts +++ b/javascript/apps/taiga/src/app/modules/workspace/feature-detail/guards/workspace-invitation-cta.guard.ts @@ -10,7 +10,7 @@ import { HttpClient } from '@angular/common/http'; import { inject } from '@angular/core'; import { ActivatedRouteSnapshot, CanActivateFn, Router } from '@angular/router'; import { TuiNotification } from '@taiga-ui/core'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { WorkspaceInvitationInfo, InvitationWorkspaceMember, diff --git a/javascript/apps/taiga/src/app/services/language/language.service.spec.ts b/javascript/apps/taiga/src/app/services/language/language.service.spec.ts index 2deea8099..7060481fc 100644 --- a/javascript/apps/taiga/src/app/services/language/language.service.spec.ts +++ b/javascript/apps/taiga/src/app/services/language/language.service.spec.ts @@ -7,16 +7,13 @@ */ import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; -import { MockStore, provideMockStore } from '@ngrx/store/testing'; -import { selectLanguages } from '@taiga/core'; +import { provideMockStore } from '@ngrx/store/testing'; import { LanguageListMockFactory } from '@taiga/data'; import { LanguageService } from './language.service'; describe('LanguageService', () => { let spectator: SpectatorService; - let store: MockStore; - const createService = createServiceFactory({ service: LanguageService, providers: [provideMockStore({})], @@ -25,14 +22,13 @@ describe('LanguageService', () => { beforeEach(() => { spectator = createService(); - store = spectator.inject(MockStore); }); describe('get user registration language', () => { it('user language es-ES', (done) => { spectator.service.navigatorLanguage = jest.fn().mockReturnValue('es-ES'); - store.overrideSelector(selectLanguages, LanguageListMockFactory()); + spectator.service.setLanguages(LanguageListMockFactory()); spectator.service.getUserLanguage().subscribe((lang) => { expect(lang.code).toBe('es-ES'); @@ -43,7 +39,7 @@ describe('LanguageService', () => { it('not available language', (done) => { spectator.service.navigatorLanguage = jest.fn().mockReturnValue('xx-XX'); - store.overrideSelector(selectLanguages, LanguageListMockFactory()); + spectator.service.setLanguages(LanguageListMockFactory()); spectator.service.getUserLanguage().subscribe((lang) => { expect(lang.code).toBe('en-US'); @@ -54,7 +50,7 @@ describe('LanguageService', () => { it('skip locale if not available', (done) => { spectator.service.navigatorLanguage = jest.fn().mockReturnValue('es-MX'); - store.overrideSelector(selectLanguages, LanguageListMockFactory()); + spectator.service.setLanguages(LanguageListMockFactory()); spectator.service.getUserLanguage().subscribe((lang) => { expect(lang.code).toBe('es-ES'); diff --git a/javascript/apps/taiga/src/app/services/language/language.service.ts b/javascript/apps/taiga/src/app/services/language/language.service.ts index 99cec75d5..5e5633c6e 100644 --- a/javascript/apps/taiga/src/app/services/language/language.service.ts +++ b/javascript/apps/taiga/src/app/services/language/language.service.ts @@ -8,25 +8,35 @@ import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; -import { selectLanguages } from '@taiga/core'; -import { filter, map, switchMap, take } from 'rxjs'; +import { BehaviorSubject, filter, map, switchMap, take } from 'rxjs'; import { selectUser } from '~/app/modules/auth/data-access/+state/selectors/auth.selectors'; import { TuiLanguage } from '@taiga-ui/i18n'; import { TUI_ENGLISH_LANGUAGE, TUI_SPANISH_LANGUAGE } from '@taiga-ui/i18n'; import editorLanguages from '~/assets/editor/languages.json'; import { LocalStorageService } from '~/app/shared/local-storage/local-storage.service'; +import { Language } from '@taiga/data'; @Injectable({ providedIn: 'root', }) export class LanguageService { + #languages = new BehaviorSubject([]); + constructor(private store: Store) {} public navigatorLanguage() { return navigator.language; } + public setLanguages(languages: Language[]) { + this.#languages.next(languages); + } + + public getLanguages() { + return this.#languages.asObservable(); + } + public getUserLanguage() { - return this.store.select(selectLanguages).pipe( + return this.getLanguages().pipe( filter((langs) => !!langs.length), take(1), switchMap((langs) => { diff --git a/javascript/apps/taiga/src/app/services/ws/services/ws.service.spec.ts b/javascript/apps/taiga/src/app/services/ws/services/ws.service.spec.ts index 2dfeb011a..3a9129e26 100644 --- a/javascript/apps/taiga/src/app/services/ws/services/ws.service.spec.ts +++ b/javascript/apps/taiga/src/app/services/ws/services/ws.service.spec.ts @@ -8,7 +8,7 @@ import { WsService } from '../services/ws.service'; import { wsMessage } from '../ws.actions'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { createServiceFactory, SpectatorService } from '@ngneat/spectator'; import { createEffect } from '@ngrx/effects'; import { provideMockActions } from '@ngrx/effects/testing'; diff --git a/javascript/apps/taiga/src/app/services/ws/services/ws.service.ts b/javascript/apps/taiga/src/app/services/ws/services/ws.service.ts index 6ef4e73ab..a7099aafd 100644 --- a/javascript/apps/taiga/src/app/services/ws/services/ws.service.ts +++ b/javascript/apps/taiga/src/app/services/ws/services/ws.service.ts @@ -9,7 +9,10 @@ import { Injectable } from '@angular/core'; import { Actions, ofType } from '@ngrx/effects'; import { Store } from '@ngrx/store'; -import { ConfigService, CORRELATION_ID } from '@taiga/core'; +import { + ConfigService, + CORRELATION_ID, +} from '@taiga/cdk/services/config/config.service'; import { BehaviorSubject, EMPTY, Observable, Subject } from 'rxjs'; import { concatMap, diff --git a/javascript/apps/taiga/src/app/shared/api-rest-interceptor/api-rest-interceptor.service.spec.ts b/javascript/apps/taiga/src/app/shared/api-rest-interceptor/api-rest-interceptor.service.spec.ts index 18e331eec..9311de7eb 100644 --- a/javascript/apps/taiga/src/app/shared/api-rest-interceptor/api-rest-interceptor.service.spec.ts +++ b/javascript/apps/taiga/src/app/shared/api-rest-interceptor/api-rest-interceptor.service.spec.ts @@ -17,7 +17,8 @@ import { HttpErrorResponse, } from '@angular/common/http'; import { forkJoin, of, throwError } from 'rxjs'; -import { ConfigService, ConfigServiceMock } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; +import { ConfigServiceMock } from '@taiga/cdk/services/config/config.service.mock'; import { MockStore, provideMockStore } from '@ngrx/store/testing'; import { AuthApiService } from '@taiga/api'; import { refreshTokenSuccess } from '~/app/modules/auth/data-access/+state/actions/auth.actions'; diff --git a/javascript/apps/taiga/src/app/shared/api-rest-interceptor/api-rest-interceptor.service.ts b/javascript/apps/taiga/src/app/shared/api-rest-interceptor/api-rest-interceptor.service.ts index 1926ed941..a66949821 100644 --- a/javascript/apps/taiga/src/app/shared/api-rest-interceptor/api-rest-interceptor.service.ts +++ b/javascript/apps/taiga/src/app/shared/api-rest-interceptor/api-rest-interceptor.service.ts @@ -16,10 +16,9 @@ import { } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; -import { concatLatestFrom } from '@ngrx/effects'; import { Store } from '@ngrx/store'; import { AuthApiService } from '@taiga/api'; -import { ConfigService, coreActions, selectGlobalLoading } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Auth } from '@taiga/data'; import { BehaviorSubject, EMPTY, Observable, throwError } from 'rxjs'; import { catchError, filter, switchMap, take, tap } from 'rxjs/operators'; @@ -38,20 +37,7 @@ export class ApiRestInterceptorService implements HttpInterceptor { private readonly store: Store, private readonly authService: AuthService, private readonly router: Router - ) { - this.requests - .pipe(concatLatestFrom(() => this.store.select(selectGlobalLoading))) - .subscribe(([requests, loading]) => { - if (requests.length && !loading) { - this.store.dispatch(coreActions.globalLoading({ loading: true })); - } else if (!requests.length && loading) { - // Is async to run this action after http effect actions - requestAnimationFrame(() => { - this.store.dispatch(coreActions.globalLoading({ loading: false })); - }); - } - }); - } + ) {} public intercept( // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/javascript/apps/taiga/src/app/shared/attachments/attachments.component.ts b/javascript/apps/taiga/src/app/shared/attachments/attachments.component.ts index a6087771e..4de11959c 100644 --- a/javascript/apps/taiga/src/app/shared/attachments/attachments.component.ts +++ b/javascript/apps/taiga/src/app/shared/attachments/attachments.component.ts @@ -24,7 +24,7 @@ import { Attachment, LoadingAttachment } from '@taiga/data'; import { AttachmentsState } from './attachments.state'; import { toSignal } from '@angular/core/rxjs-interop'; import { map } from 'rxjs'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { trackByValue } from '../utils/track-by-value'; import { ContextNotificationComponent } from '@taiga/ui/context-notification/context-notification.component'; diff --git a/javascript/apps/taiga/src/app/shared/directives/shorcut/shorcut.directive.ts b/javascript/apps/taiga/src/app/shared/directives/shorcut/shorcut.directive.ts index 51ac08437..a9b1279aa 100644 --- a/javascript/apps/taiga/src/app/shared/directives/shorcut/shorcut.directive.ts +++ b/javascript/apps/taiga/src/app/shared/directives/shorcut/shorcut.directive.ts @@ -17,7 +17,7 @@ import { SimpleChanges, } from '@angular/core'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; import { filter } from 'rxjs'; @UntilDestroy() diff --git a/javascript/docs/workflows/api/api.workflow.md b/javascript/docs/workflows/api/api.workflow.md index 436b4f79d..c4a8d575c 100644 --- a/javascript/docs/workflows/api/api.workflow.md +++ b/javascript/docs/workflows/api/api.workflow.md @@ -13,7 +13,7 @@ Api service example ```ts import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Example } from './example.model'; @Injectable({ diff --git a/javascript/docs/workflows/feature/effects.workflow.md b/javascript/docs/workflows/feature/effects.workflow.md index 8c8859f3d..ecfe0c041 100644 --- a/javascript/docs/workflows/feature/effects.workflow.md +++ b/javascript/docs/workflows/feature/effects.workflow.md @@ -82,8 +82,6 @@ class TodoEffects { With a pessimistic the effect updates the server data first, when the change is completed then we dispatch an action that changes the app.state ```ts -import { unexpectedError } from '@taiga/core'; - @Injectable({ providedIn: 'root', }) diff --git a/javascript/docs/workflows/testing/api-testing.workflow.md b/javascript/docs/workflows/testing/api-testing.workflow.md index 090ccd5ad..ddcc4d542 100644 --- a/javascript/docs/workflows/testing/api-testing.workflow.md +++ b/javascript/docs/workflows/testing/api-testing.workflow.md @@ -9,8 +9,8 @@ import { SpectatorHttp, } from '@ngneat/spectator'; import { ExampleApiService } from './example-api.service'; -import { ConfigService } from '@taiga/core'; -import { ConfigServiceMock } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; +import { ConfigServiceMock } from '@taiga/cdk/services/config/config.service.mock'; describe('ExampleApiService', () => { let spectator: SpectatorHttp; diff --git a/javascript/docs/workflows/ui/shortcuts.worflow.md b/javascript/docs/workflows/ui/shortcuts.worflow.md index 7c8967d0b..fea089925 100644 --- a/javascript/docs/workflows/ui/shortcuts.worflow.md +++ b/javascript/docs/workflows/ui/shortcuts.worflow.md @@ -2,7 +2,7 @@ Taiga uses [hotkeys](https://www.npmjs.com/package/hotkeys-js) for the shortcuts, check it out for more info. -1. Add the shortcut to `/javascript/libs/core/src/lib/services/shortcuts/shortcuts.ts` +1. Add the shortcut to `/javascript/libs/cdk/src/lib/services/shortcuts/shortcuts.ts` ```ts { @@ -21,7 +21,7 @@ Taiga uses [hotkeys](https://www.npmjs.com/package/hotkeys-js) for the shortcuts 2. Define & subscribe to the shortcut, you can also use it in an effect. ```ts -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; class Test { constructor(private shortcutsService: ShortcutsService) { @@ -82,7 +82,7 @@ class Tooltip { Option 1 ```ts -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; class Test { constructor(private shortcutsService: ShortcutsService) { @@ -100,7 +100,7 @@ class Test { Option 2 ```ts -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; class Test { ngUnsubscribe = new Subject(); diff --git a/javascript/libs/api/src/lib/auth/auth-api.service.spec.ts b/javascript/libs/api/src/lib/auth/auth-api.service.spec.ts index f23d018a0..a41af6428 100644 --- a/javascript/libs/api/src/lib/auth/auth-api.service.spec.ts +++ b/javascript/libs/api/src/lib/auth/auth-api.service.spec.ts @@ -12,7 +12,8 @@ import { SpectatorHttp, } from '@ngneat/spectator'; import { provideMockStore } from '@ngrx/store/testing'; -import { ConfigService, ConfigServiceMock } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; +import { ConfigServiceMock } from '@taiga/cdk/services/config/config.service.mock'; import { randUuid } from '@ngneat/falso'; import { AuthApiService } from './auth-api.service'; diff --git a/javascript/libs/api/src/lib/auth/auth-api.service.ts b/javascript/libs/api/src/lib/auth/auth-api.service.ts index ed5335278..93c58172a 100644 --- a/javascript/libs/api/src/lib/auth/auth-api.service.ts +++ b/javascript/libs/api/src/lib/auth/auth-api.service.ts @@ -8,7 +8,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Auth, Language, LoginInput, SignUpInput } from '@taiga/data'; diff --git a/javascript/libs/api/src/lib/invitation/invitation-api.service.ts b/javascript/libs/api/src/lib/invitation/invitation-api.service.ts index 83ffd4c6c..558f98149 100644 --- a/javascript/libs/api/src/lib/invitation/invitation-api.service.ts +++ b/javascript/libs/api/src/lib/invitation/invitation-api.service.ts @@ -8,7 +8,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Contact, InvitationRequest, diff --git a/javascript/libs/api/src/lib/project/project-api.service.spec.ts b/javascript/libs/api/src/lib/project/project-api.service.spec.ts index cf5a93361..75e573704 100644 --- a/javascript/libs/api/src/lib/project/project-api.service.spec.ts +++ b/javascript/libs/api/src/lib/project/project-api.service.spec.ts @@ -13,7 +13,8 @@ import { SpectatorHttp, } from '@ngneat/spectator'; import { provideMockStore } from '@ngrx/store/testing'; -import { ConfigService, ConfigServiceMock } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; +import { ConfigServiceMock } from '@taiga/cdk/services/config/config.service.mock'; import { ProjectMockFactory, StoryMockFactory, diff --git a/javascript/libs/api/src/lib/project/project-api.service.ts b/javascript/libs/api/src/lib/project/project-api.service.ts index 64e042d34..34404b680 100644 --- a/javascript/libs/api/src/lib/project/project-api.service.ts +++ b/javascript/libs/api/src/lib/project/project-api.service.ts @@ -9,7 +9,7 @@ import { HttpClient, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { ApiUtilsService } from '@taiga/api'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Attachment, Contact, diff --git a/javascript/libs/api/src/lib/system/system-api.service.ts b/javascript/libs/api/src/lib/system/system-api.service.ts index b44e5459f..042b34e56 100644 --- a/javascript/libs/api/src/lib/system/system-api.service.ts +++ b/javascript/libs/api/src/lib/system/system-api.service.ts @@ -8,7 +8,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Language } from '@taiga/data'; import { map } from 'rxjs'; diff --git a/javascript/libs/api/src/lib/users/users-api.service.ts b/javascript/libs/api/src/lib/users/users-api.service.ts index 258314721..242db988d 100644 --- a/javascript/libs/api/src/lib/users/users-api.service.ts +++ b/javascript/libs/api/src/lib/users/users-api.service.ts @@ -8,7 +8,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Auth, DeleteInfo, User } from '@taiga/data'; @Injectable({ diff --git a/javascript/libs/api/src/lib/workspace/workspace-api.service.spec.ts b/javascript/libs/api/src/lib/workspace/workspace-api.service.spec.ts index 52a271747..768a68367 100644 --- a/javascript/libs/api/src/lib/workspace/workspace-api.service.spec.ts +++ b/javascript/libs/api/src/lib/workspace/workspace-api.service.spec.ts @@ -13,7 +13,8 @@ import { SpectatorHttp, } from '@ngneat/spectator'; import { provideMockStore } from '@ngrx/store/testing'; -import { ConfigService, ConfigServiceMock } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; +import { ConfigServiceMock } from '@taiga/cdk/services/config/config.service.mock'; import { WorkspaceApiService } from './workspace-api.service'; describe('WorkspaceApiService', () => { diff --git a/javascript/libs/api/src/lib/workspace/workspace-api.service.ts b/javascript/libs/api/src/lib/workspace/workspace-api.service.ts index 5a8724167..340ab2092 100644 --- a/javascript/libs/api/src/lib/workspace/workspace-api.service.ts +++ b/javascript/libs/api/src/lib/workspace/workspace-api.service.ts @@ -8,7 +8,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ConfigService } from '@taiga/core'; +import { ConfigService } from '@taiga/cdk/services/config'; import { Project, Workspace, diff --git a/javascript/libs/core/.eslintrc.json b/javascript/libs/cdk/.eslintrc.json similarity index 94% rename from javascript/libs/core/.eslintrc.json rename to javascript/libs/cdk/.eslintrc.json index e799adb8f..5519e2c7a 100644 --- a/javascript/libs/core/.eslintrc.json +++ b/javascript/libs/cdk/.eslintrc.json @@ -9,7 +9,7 @@ "plugin:@angular-eslint/template/process-inline-templates" ], "parserOptions": { - "project": ["libs/core/tsconfig.*?.json"] + "project": ["libs/cdk/tsconfig.*?.json"] }, "rules": { "@angular-eslint/directive-selector": [ diff --git a/javascript/libs/core/README.md b/javascript/libs/cdk/README.md similarity index 100% rename from javascript/libs/core/README.md rename to javascript/libs/cdk/README.md diff --git a/javascript/libs/core/jest.config.ts b/javascript/libs/cdk/jest.config.ts similarity index 94% rename from javascript/libs/core/jest.config.ts rename to javascript/libs/cdk/jest.config.ts index a1b23a3e1..3fc7174fa 100644 --- a/javascript/libs/core/jest.config.ts +++ b/javascript/libs/cdk/jest.config.ts @@ -12,7 +12,7 @@ export default { preset: '../../jest.preset.js', setupFilesAfterEnv: ['/src/test-setup.ts'], globals: {}, - coverageDirectory: '../../coverage/libs/core', + coverageDirectory: '../../coverage/libs/cdk', snapshotSerializers: [ 'jest-preset-angular/build/serializers/no-ng-attributes', 'jest-preset-angular/build/serializers/ng-snapshot', diff --git a/javascript/libs/core/project.json b/javascript/libs/cdk/project.json similarity index 56% rename from javascript/libs/core/project.json rename to javascript/libs/cdk/project.json index 8ffed30c8..253f27e70 100644 --- a/javascript/libs/core/project.json +++ b/javascript/libs/cdk/project.json @@ -1,24 +1,24 @@ { - "name": "core", + "name": "cdk", "$schema": "../../node_modules/nx/schemas/project-schema.json", "projectType": "library", - "sourceRoot": "libs/core/src", + "sourceRoot": "libs/cdk/src", "prefix": "tg", "targets": { "test": { "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/libs/core"], + "outputs": ["{workspaceRoot}/coverage/libs/cdk"], "options": { - "jestConfig": "libs/core/jest.config.ts", + "jestConfig": "libs/cdk/jest.config.ts", "passWithNoTests": true } }, "lint": { "executor": "@nx/linter:eslint", "options": { - "lintFilePatterns": ["libs/core/src/**/*.ts", "libs/core/src/**/*.html"] + "lintFilePatterns": ["libs/cdk/src/**/*.ts", "libs/cdk/src/**/*.html"] } } }, - "tags": ["scope:core"] + "tags": ["scope:cdk"] } diff --git a/javascript/libs/core/src/lib/services/config/config.service.mock.ts b/javascript/libs/cdk/src/lib/services/config/config.service.mock.ts similarity index 100% rename from javascript/libs/core/src/lib/services/config/config.service.mock.ts rename to javascript/libs/cdk/src/lib/services/config/config.service.mock.ts diff --git a/javascript/libs/core/src/lib/services/config/config.service.ts b/javascript/libs/cdk/src/lib/services/config/config.service.ts similarity index 100% rename from javascript/libs/core/src/lib/services/config/config.service.ts rename to javascript/libs/cdk/src/lib/services/config/config.service.ts diff --git a/javascript/libs/core/src/lib/services/config/config.validator.ts b/javascript/libs/cdk/src/lib/services/config/config.validator.ts similarity index 100% rename from javascript/libs/core/src/lib/services/config/config.validator.ts rename to javascript/libs/cdk/src/lib/services/config/config.validator.ts diff --git a/javascript/libs/cdk/src/lib/services/config/index.ts b/javascript/libs/cdk/src/lib/services/config/index.ts new file mode 100644 index 000000000..0e85b339a --- /dev/null +++ b/javascript/libs/cdk/src/lib/services/config/index.ts @@ -0,0 +1,9 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright (c) 2023-present Kaleidos INC + */ + +export { ConfigService } from './config.service'; diff --git a/javascript/libs/cdk/src/lib/services/shortcuts/index.ts b/javascript/libs/cdk/src/lib/services/shortcuts/index.ts new file mode 100644 index 000000000..18e91a40e --- /dev/null +++ b/javascript/libs/cdk/src/lib/services/shortcuts/index.ts @@ -0,0 +1,9 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright (c) 2023-present Kaleidos INC + */ + +export { ShortcutsService } from './shortcuts.services'; diff --git a/javascript/libs/core/src/lib/services/shortcuts/shortcut-task.model.ts b/javascript/libs/cdk/src/lib/services/shortcuts/shortcut-task.model.ts similarity index 100% rename from javascript/libs/core/src/lib/services/shortcuts/shortcut-task.model.ts rename to javascript/libs/cdk/src/lib/services/shortcuts/shortcut-task.model.ts diff --git a/javascript/libs/core/src/lib/services/shortcuts/shortcuts.services.ts b/javascript/libs/cdk/src/lib/services/shortcuts/shortcuts.services.ts similarity index 100% rename from javascript/libs/core/src/lib/services/shortcuts/shortcuts.services.ts rename to javascript/libs/cdk/src/lib/services/shortcuts/shortcuts.services.ts diff --git a/javascript/libs/core/src/lib/services/shortcuts/shortcuts.ts b/javascript/libs/cdk/src/lib/services/shortcuts/shortcuts.ts similarity index 100% rename from javascript/libs/core/src/lib/services/shortcuts/shortcuts.ts rename to javascript/libs/cdk/src/lib/services/shortcuts/shortcuts.ts diff --git a/javascript/libs/core/src/test-setup.ts b/javascript/libs/cdk/src/test-setup.ts similarity index 100% rename from javascript/libs/core/src/test-setup.ts rename to javascript/libs/cdk/src/test-setup.ts diff --git a/javascript/libs/core/tsconfig.json b/javascript/libs/cdk/tsconfig.json similarity index 100% rename from javascript/libs/core/tsconfig.json rename to javascript/libs/cdk/tsconfig.json diff --git a/javascript/libs/core/tsconfig.lib.json b/javascript/libs/cdk/tsconfig.lib.json similarity index 100% rename from javascript/libs/core/tsconfig.lib.json rename to javascript/libs/cdk/tsconfig.lib.json diff --git a/javascript/libs/core/tsconfig.spec.json b/javascript/libs/cdk/tsconfig.spec.json similarity index 100% rename from javascript/libs/core/tsconfig.spec.json rename to javascript/libs/cdk/tsconfig.spec.json diff --git a/javascript/libs/core/src/index.ts b/javascript/libs/core/src/index.ts deleted file mode 100644 index 48221bed3..000000000 --- a/javascript/libs/core/src/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright (c) 2023-present Kaleidos INC - */ - -export * from './lib/core.module'; -export * from './lib/core.reducer'; -export * from './lib/core.actions'; -export * from './lib/core.selectors'; -export * from './lib/services/shortcuts/shortcuts.services'; -export * from './lib/services/config/config.service'; -export * from './lib/services/config/config.service.mock'; diff --git a/javascript/libs/core/src/lib/core.actions.ts b/javascript/libs/core/src/lib/core.actions.ts deleted file mode 100644 index 26a8914dd..000000000 --- a/javascript/libs/core/src/lib/core.actions.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright (c) 2023-present Kaleidos INC - */ - -import { createActionGroup, props } from '@ngrx/store'; -import { Language } from '@taiga/data'; - -export const coreActions = createActionGroup({ - source: 'Core', - events: { - 'Global loading': props<{ loading: boolean }>(), - 'Set Languages': props<{ languages: Language[] }>(), - }, -}); diff --git a/javascript/libs/core/src/lib/core.module.ts b/javascript/libs/core/src/lib/core.module.ts deleted file mode 100644 index 329dcfe74..000000000 --- a/javascript/libs/core/src/lib/core.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright (c) 2023-present Kaleidos INC - */ - -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { StoreModule } from '@ngrx/store'; - -import * as fromCore from './core.reducer'; -import { ShortcutsService } from './services/shortcuts/shortcuts.services'; - -@NgModule({ - imports: [ - CommonModule, - StoreModule.forFeature(fromCore.coreFeatureKey, fromCore.reducer), - ], - providers: [ShortcutsService], -}) -export class CoreModule {} diff --git a/javascript/libs/core/src/lib/core.reducer.ts b/javascript/libs/core/src/lib/core.reducer.ts deleted file mode 100644 index 9cc5e734c..000000000 --- a/javascript/libs/core/src/lib/core.reducer.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright (c) 2023-present Kaleidos INC - */ - -import { createReducer, on } from '@ngrx/store'; -import { Language } from '@taiga/data'; -import { coreActions } from './core.actions'; - -export const coreFeatureKey = 'core'; - -export interface CoreState { - loading: boolean; - languages: Language[]; -} - -export const initialState: CoreState = { - loading: false, - languages: [], -}; - -export const reducer = createReducer( - initialState, - - on(coreActions.globalLoading, (state, { loading }): CoreState => { - return { - ...state, - loading, - }; - }), - on(coreActions.setLanguages, (state, { languages }): CoreState => { - return { - ...state, - languages, - }; - }) -); diff --git a/javascript/libs/core/src/lib/core.selectors.ts b/javascript/libs/core/src/lib/core.selectors.ts deleted file mode 100644 index c7dc481dc..000000000 --- a/javascript/libs/core/src/lib/core.selectors.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright (c) 2023-present Kaleidos INC - */ - -import { createFeatureSelector, createSelector } from '@ngrx/store'; -import * as fromCore from './core.reducer'; - -export const selectCoreState = createFeatureSelector( - fromCore.coreFeatureKey -); - -export const selectGlobalLoading = createSelector( - selectCoreState, - (state: fromCore.CoreState) => state.loading -); - -export const selectLanguages = createSelector( - selectCoreState, - (state: fromCore.CoreState) => state.languages -); diff --git a/javascript/libs/ui/src/lib/modal/components/modal/modal.component.ts b/javascript/libs/ui/src/lib/modal/components/modal/modal.component.ts index 1fa1646ef..dcbfb76c0 100644 --- a/javascript/libs/ui/src/lib/modal/components/modal/modal.component.ts +++ b/javascript/libs/ui/src/lib/modal/components/modal/modal.component.ts @@ -20,7 +20,7 @@ import { } from '@angular/core'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { TuiDialogService, TuiButtonModule } from '@taiga-ui/core'; -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; import { ModalService } from '@taiga/ui/modal/services/modal.service'; import { PolymorpheusContent } from '@tinkoff/ng-polymorpheus'; import { BehaviorSubject, Subscription } from 'rxjs'; diff --git a/javascript/libs/ui/src/lib/tooltip/tooltip.directive.ts b/javascript/libs/ui/src/lib/tooltip/tooltip.directive.ts index dff5c439f..77d617363 100644 --- a/javascript/libs/ui/src/lib/tooltip/tooltip.directive.ts +++ b/javascript/libs/ui/src/lib/tooltip/tooltip.directive.ts @@ -28,7 +28,7 @@ import { inject, } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; import { BehaviorSubject, Subject, diff --git a/javascript/libs/ui/src/lib/tooltip/tooltip.spec.ts b/javascript/libs/ui/src/lib/tooltip/tooltip.spec.ts index fd782bd7d..55fa1a1df 100644 --- a/javascript/libs/ui/src/lib/tooltip/tooltip.spec.ts +++ b/javascript/libs/ui/src/lib/tooltip/tooltip.spec.ts @@ -13,7 +13,7 @@ import { SpectatorDirective, createDirectiveFactory, } from '@ngneat/spectator/jest'; -import { ShortcutsService } from '@taiga/core'; +import { ShortcutsService } from '@taiga/cdk/services/shortcuts'; import { Subject } from 'rxjs'; import { calculateTooltipPositionByPreference, diff --git a/javascript/tsconfig.base.json b/javascript/tsconfig.base.json index 575852a3e..7627f2bbe 100644 --- a/javascript/tsconfig.base.json +++ b/javascript/tsconfig.base.json @@ -20,7 +20,7 @@ "paths": { "@storybook-helper": ["libs/ui/stories-helper.ts"], "@taiga/api": ["libs/api/src/index.ts"], - "@taiga/core": ["libs/core/src/index.ts"], + "@taiga/cdk/*": ["libs/cdk/src/lib/*"], "@taiga/data": ["libs/data/src/index.ts"], "@taiga/ui/*": ["libs/ui/src/lib/*"], "~/*": ["apps/taiga/src/*"]