From e617333f001e9b9b8f355de9c24ea73f909d2d92 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Fri, 6 Sep 2024 18:43:33 +0200 Subject: [PATCH] [AAE-20109] Move alfresco js-API and alfrescoapi service out from the core (#9317) * AAE-20109 Remove alfrescoapiservice from core * fix after rebase * [AAe-12502] Post-rebase fix * [AAE-12502] Add unit test fix --------- Co-authored-by: Bartosz Sekula Co-authored-by: MichalKinas --- .github/workflows/release-branch.yml | 11 +- .github/workflows/release.yml | 11 +- .../app-layout/app-layout.component.ts | 3 +- .../process-service.component.ts | 2 +- .../settings/host-settings.component.ts | 3 +- demo-shell/src/testing/automation.service.ts | 3 +- docs/README.md | 2 +- .../breaking-change-6.10.0-7.0.0.md | 24 + .../components/document-list.component.md | 40 +- docs/core/pipes/localized-date.pipe.md | 4 +- docs/core/services/alfresco-api.service.md | 2 +- docs/tutorials/working-with-data-table.md | 70 +-- .../alfresco-api-no-auth.service.ts | 3 +- .../alfresco-api-v2-loader.service.ts | 5 +- .../src/lib/api-factories}/index.ts | 0 .../src/lib/api-factories/public-api.ts | 19 + .../services/aspect-list.service.spec.ts | 2 +- .../services/aspect-list.service.ts | 3 +- .../services/node-aspect.service.spec.ts | 2 +- .../category-tree-datasource.service.spec.ts | 3 +- .../lib/category/services/category.service.ts | 3 +- .../lib/common/services/content.service.ts | 3 +- .../common/services/discovery-api.service.ts | 68 +-- .../common/services/favorites-api.service.ts | 3 +- .../lib/common/services/nodes-api.service.ts | 3 +- .../services/people-content.service.spec.ts | 4 +- .../common/services/people-content.service.ts | 3 +- .../lib/common/services/rendition.service.ts | 3 +- .../services/rendition.services.spec.ts | 5 +- .../src/lib/common/services/sites.service.ts | 2 +- .../common/services/upload.service.spec.ts | 4 +- .../src/lib/common/services/upload.service.ts | 3 +- .../content-metadata-card.component.spec.ts | 4 +- .../content-metadata.component.spec.ts | 12 +- .../services/property-descriptors.service.ts | 2 +- .../content-node-share.directive.ts | 2 +- .../services/shared-links-api.service.ts | 3 +- .../lib/content-type/content-type.service.ts | 3 +- .../src/lib/content.module.ts | 10 + .../download-zip/download-zip.dialog.spec.ts | 4 +- .../download-zip.dialog.stories.ts | 2 +- .../services/download-zip.service.ts | 2 +- .../src/lib/dialogs/library/library.dialog.ts | 3 +- .../lib/dialogs/node-lock/node-lock.dialog.ts | 2 +- .../directives/library-favorite.directive.ts | 2 +- .../library-membership.directive.spec.ts | 3 +- .../library-membership.directive.ts | 2 +- .../lib/directives/node-delete.directive.ts | 3 +- .../node-download.directive.spec.ts | 3 +- .../lib/directives/node-download.directive.ts | 3 +- .../node-favorite.directive.spec.ts | 4 +- .../lib/directives/node-favorite.directive.ts | 2 +- .../lib/directives/node-restore.directive.ts | 3 +- .../components/document-list.component.ts | 2 +- .../services/custom-resources.service.ts | 3 +- .../services/document-list.service.ts | 3 +- .../services/node-actions.service.ts | 3 +- .../lib/group/services/group.service.spec.ts | 50 +- .../src/lib/group/services/group.service.ts | 2 +- .../legal-hold/services/legal-hold.service.ts | 2 +- .../src/lib/mock/alfresco-api.service.mock.ts | 3 +- .../src/lib/mock/public-api.ts | 1 + .../src/lib/mock/search.component.mock.ts | 6 +- .../new-version-uploader.service.ts | 3 +- .../services/node-comments.service.spec.ts | 4 +- .../services/node-comments.service.ts | 3 +- .../components/pop-over.directive.spec.ts | 2 +- .../services/node-permission.service.ts | 3 +- .../prediction/services/prediction.service.ts | 2 +- ...ilter-autocomplete-chips.component.spec.ts | 2 +- .../search-properties.component.spec.ts | 3 +- .../search-sorting-picker.component.spec.ts | 3 +- .../components/search.component.spec.ts | 3 +- .../services/base-query-builder.service.ts | 3 +- .../search-facet-filters.service.spec.ts | 269 ++++++---- ...earch-header-query-builder.service.spec.ts | 3 +- .../search-header-query-builder.service.ts | 3 +- .../search-query-builder.service.spec.ts | 3 +- .../services/search-query-builder.service.ts | 3 +- .../src/lib/search/services/search.service.ts | 2 +- ...-controls-groups-marks-security.service.ts | 3 +- .../lib/services/alfresco-api.interface.ts | 0 .../src/lib/services/alfresco-api.service.ts | 11 +- .../src/lib/services/index.ts | 18 + .../src/lib/services/public-api.ts | 0 .../src/lib/tag/services/tag.service.ts | 3 +- .../src/lib/testing/content.testing.module.ts | 4 +- .../content-version.service.ts | 2 +- .../version-manager/version-list.component.ts | 3 +- .../alfresco-viewer.component.spec.ts | 4 +- .../components/alfresco-viewer.component.ts | 2 +- lib/content-services/src/public-api.ts | 4 + lib/core/index.ts | 1 + lib/core/package.json | 11 +- lib/core/project.json | 12 +- lib/core/schematics/migrations/7_0_0/index.ts | 189 +++++++ .../schematics/migrations/collection.json | 46 ++ .../src/lib/app-config/app-config.service.ts | 39 +- lib/core/src/lib/auth/oidc/auth.module.ts | 3 - .../services/user-preferences.service.spec.ts | 14 +- .../services/user-preferences.service.ts | 17 +- lib/core/src/lib/core.module.ts | 7 - .../location-cell/location-cell.component.ts | 2 +- .../components/mocks/datatable.mock.ts | 2 +- lib/core/src/lib/mock/public-api.ts | 1 - lib/core/src/lib/models/basic-auth.ts | 22 + lib/core/src/lib/models/oauth2.ts | 21 + lib/core/src/lib/models/path.model.ts | 35 ++ lib/core/src/lib/models/public-api.ts | 1 + .../src/lib/testing/core.testing.module.ts | 5 +- .../translation/translation.service.spec.ts | 3 - lib/core/src/public-api.ts | 2 - lib/core/tsconfig.nx.migrations.json | 31 ++ lib/core/tsconfig.schematics.json | 29 ++ lib/insights/ng-package.json | 1 + lib/insights/package.json | 1 + .../services/analytics.service.ts | 2 +- .../lib/diagram/services/diagrams.service.ts | 2 +- .../lib/testing/insights.testing.module.ts | 3 +- lib/insights/tsconfig.lib.json | 1 + .../app-list-cloud.component.spec.ts | 2 +- .../apps-process-cloud.service.spec.ts | 3 +- .../components/form-cloud.component.spec.ts | 3 +- .../attach-file-cloud-widget.component.ts | 2 +- ...ontent-cloud-node-selector.service.spec.ts | 3 +- .../content-cloud-node-selector.service.ts | 4 +- .../services/process-cloud-content.service.ts | 4 +- ...dit-process-filter-cloud.component.spec.ts | 2 +- .../src/lib/services/base-cloud.service.ts | 3 +- .../start-task-cloud.component.spec.ts | 2 +- .../edit-task-filter-cloud.component.spec.ts | 2 +- .../task-header-cloud.component.spec.ts | 3 +- .../testing/task-list.testing.module.ts | 3 +- .../process-service-cloud.testing.module.ts | 3 +- ...reate-process-attachment.component.spec.ts | 2 +- .../services/activiti-alfresco.service.ts | 4 +- .../form/services/ecm-model.service.spec.ts | 4 +- .../lib/form/services/ecm-model.service.ts | 3 +- .../src/lib/form/services/editor.service.ts | 2 +- .../services/external-alfresco-api.service.ts | 2 +- .../src/lib/form/services/model.service.ts | 2 +- .../services/process-content.service.spec.ts | 4 +- .../form/services/process-content.service.ts | 2 +- .../services/process-definition.service.ts | 3 +- .../lib/form/services/task-form.service.ts | 3 +- .../src/lib/form/services/task.service.ts | 2 +- ...ttach-file-widget-dialog.component.spec.ts | 4 +- .../attach-file-widget-dialog.component.ts | 4 +- .../attach-file-widget-dialog.service.ts | 3 +- .../attach-file-widget.component.spec.ts | 1 + .../widgets/document/content.widget.spec.ts | 4 +- .../radio-buttons.widget.spec.ts | 3 +- .../services/comment-process.service.ts | 3 +- .../services/process-filter.service.spec.ts | 4 +- .../services/process-filter.service.ts | 2 +- .../process-list/services/process.service.ts | 3 +- .../src/lib/services/apps-process.service.ts | 2 +- .../services/people-process.service.spec.ts | 4 +- .../lib/services/people-process.service.ts | 3 +- .../src/lib/services/task-comments.service.ts | 3 +- .../task-list/task-list.component.spec.ts | 3 +- .../task-list/services/task-filter.service.ts | 2 +- .../task-list/services/tasklist.service.ts | 2 +- .../src/lib/testing/process.testing.module.ts | 3 +- package-lock.json | 488 ++++++++++++------ package.json | 1 + scripts/github/release/set-migrations.js | 69 +++ 167 files changed, 1430 insertions(+), 589 deletions(-) create mode 100644 docs/breaking-changes/breaking-change-6.10.0-7.0.0.md rename lib/{core => content-services}/src/lib/api-factories/alfresco-api-no-auth.service.ts (91%) rename lib/{core => content-services}/src/lib/api-factories/alfresco-api-v2-loader.service.ts (92%) rename lib/{core/src/lib/services => content-services/src/lib/api-factories}/index.ts (100%) create mode 100644 lib/content-services/src/lib/api-factories/public-api.ts rename lib/{core => content-services}/src/lib/mock/alfresco-api.service.mock.ts (90%) rename lib/{core => content-services}/src/lib/services/alfresco-api.interface.ts (100%) rename lib/{core => content-services}/src/lib/services/alfresco-api.service.ts (91%) create mode 100644 lib/content-services/src/lib/services/index.ts rename lib/{core => content-services}/src/lib/services/public-api.ts (100%) create mode 100644 lib/core/schematics/migrations/7_0_0/index.ts create mode 100644 lib/core/schematics/migrations/collection.json create mode 100644 lib/core/src/lib/models/basic-auth.ts create mode 100644 lib/core/src/lib/models/oauth2.ts create mode 100644 lib/core/src/lib/models/path.model.ts create mode 100644 lib/core/tsconfig.nx.migrations.json create mode 100644 lib/core/tsconfig.schematics.json create mode 100644 scripts/github/release/set-migrations.js diff --git a/.github/workflows/release-branch.yml b/.github/workflows/release-branch.yml index f4be76f60b..26fbcc5300 100644 --- a/.github/workflows/release-branch.yml +++ b/.github/workflows/release-branch.yml @@ -123,12 +123,21 @@ jobs: with: dry-run-flag: ${{ inputs.dry-run-flag }} - uses: ./.github/actions/download-node-modules-and-artifacts - - name: build libraries + - name: Set libraries versions run: | set -u; ./scripts/update-version.sh -gnu || exit 1; + - name: Set migrations + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const setMigrations = require('./scripts/github/release/set-migrations.js'); + setMigrations(); + - name: Build libraries + run: | npx nx affected:build $NX_CALCULATION_FLAGS --prod --exclude="demoshell" --skip-nx-cache npx nx affected $NX_CALCULATION_FLAGS --target=pretheme + npx nx affected $NX_CALCULATION_FLAGS --target=build-schematics - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 name: release libraries GH registry with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 876629e1f4..598f55b1d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -182,12 +182,21 @@ jobs: with: dry-run-flag: ${{ inputs.dry-run-flag }} - uses: ./.github/actions/download-node-modules-and-artifacts - - name: build libraries + - name: Set libraries versions run: | set -u; ./scripts/github/build/bumpversion.sh + - name: Set migrations + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const setMigrations = require('./scripts/github/release/set-migrations.js'); + setMigrations(); + - name: build libraries + run: | npx nx affected:build $NX_CALCULATION_FLAGS --prod --exclude="demoshell" --skip-nx-cache npx nx affected $NX_CALCULATION_FLAGS --target=pretheme + npx nx affected $NX_CALCULATION_FLAGS --target=build-schematics - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 name: release libraries GH registry with: diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.ts b/demo-shell/src/app/components/app-layout/app-layout.component.ts index 71efba4efb..9f498c70a9 100644 --- a/demo-shell/src/app/components/app-layout/app-layout.component.ts +++ b/demo-shell/src/app/components/app-layout/app-layout.component.ts @@ -17,7 +17,6 @@ import { Component, ViewEncapsulation } from '@angular/core'; import { - AlfrescoApiService, AvatarComponent, HeaderLayoutComponent, LogoutDirective, @@ -35,7 +34,7 @@ import { MatIconModule } from '@angular/material/icon'; import { MatLineModule } from '@angular/material/core'; import { CommonModule } from '@angular/common'; import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router'; -import { FileUploadingDialogComponent } from '@alfresco/adf-content-services'; +import { AlfrescoApiService, FileUploadingDialogComponent } from '@alfresco/adf-content-services'; @Component({ standalone: true, diff --git a/demo-shell/src/app/components/process-service/process-service.component.ts b/demo-shell/src/app/components/process-service/process-service.component.ts index f804970576..eb47c6dc11 100644 --- a/demo-shell/src/app/components/process-service/process-service.component.ts +++ b/demo-shell/src/app/components/process-service/process-service.component.ts @@ -18,6 +18,7 @@ // eslint-disable-next-line import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, ViewChild, ViewEncapsulation, EventEmitter, Output } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { Pagination, UserProcessInstanceFilterRepresentation, ScriptFilesApi, UserTaskFilterRepresentation } from '@alfresco/js-api'; import { FORM_FIELD_VALIDATORS, @@ -26,7 +27,6 @@ import { AppConfigService, PaginationComponent, UserPreferenceValues, - AlfrescoApiService, UserPreferencesService, NotificationService, SidebarActionMenuComponent diff --git a/demo-shell/src/app/components/settings/host-settings.component.ts b/demo-shell/src/app/components/settings/host-settings.component.ts index d025c89c4e..877791ec17 100644 --- a/demo-shell/src/app/components/settings/host-settings.component.ts +++ b/demo-shell/src/app/components/settings/host-settings.component.ts @@ -17,7 +17,7 @@ import { Component, EventEmitter, Output, ViewEncapsulation, OnInit, Input } from '@angular/core'; import { Validators, UntypedFormGroup, UntypedFormBuilder, UntypedFormControl, ReactiveFormsModule } from '@angular/forms'; -import { AppConfigService, AppConfigValues, StorageService, AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core'; +import { AppConfigService, AppConfigValues, StorageService, AuthenticationService } from '@alfresco/adf-core'; import { ENTER } from '@angular/cdk/keycodes'; import { MAT_FORM_FIELD_DEFAULT_OPTIONS, MatFormFieldModule } from '@angular/material/form-field'; import { CommonModule } from '@angular/common'; @@ -26,6 +26,7 @@ import { MatRadioModule } from '@angular/material/radio'; import { MatInputModule } from '@angular/material/input'; import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatButtonModule } from '@angular/material/button'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; export const HOST_REGEX = '^(http|https)://.*[^/]$'; diff --git a/demo-shell/src/testing/automation.service.ts b/demo-shell/src/testing/automation.service.ts index b7471b2796..c6bb5597b8 100644 --- a/demo-shell/src/testing/automation.service.ts +++ b/demo-shell/src/testing/automation.service.ts @@ -15,9 +15,10 @@ * limitations under the License. */ +import { AppConfigService, UserPreferencesService, StorageService, AuthenticationService } from '@alfresco/adf-core'; import { Injectable } from '@angular/core'; -import { AppConfigService, AlfrescoApiService, StorageService, UserPreferencesService, AuthenticationService } from '@alfresco/adf-core'; import { DemoForm } from './demo-form.mock'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; @Injectable({ providedIn: 'root' diff --git a/docs/README.md b/docs/README.md index 2bb6e9cf4d..f4bbc360dd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -194,7 +194,7 @@ A collection of Angular components for generic use. | Name | Description | Source link | | ---- | ----------- | -------- | | [APS Alfresco Content Service](core/services/activiti-alfresco.service.md) | Gets Alfresco Repository folder content based on a Repository account configured in Alfresco Process Services (APS). | [Source](../lib/process-services/src/lib/form/services/activiti-alfresco.service.ts) | -| [Alfresco Api Service](core/services/alfresco-api.service.md) | Provides access to an initialized AlfrescoJSApi instance. | [Source](../lib/core/src/lib/services/alfresco-api.service.ts) | +| [Alfresco Api Service](core/services/alfresco-api.service.md) | Provides access to an initialized AlfrescoJSApi instance. | [Source](lib/content-services/src/lib/services/alfresco-api.service.ts) | | [App Config service](core/services/app-config.service.md) | Supports app configuration settings, stored server side. | [Source](../lib/core/src/lib/app-config/app-config.service.ts) | | [Apps Process service](core/services/apps-process.service.md) | Gets details of the Process Services apps that are deployed for the user. | [Source](../lib/process-services/src/lib/services/apps-process.service.ts) | | [Auth Guard Bpm service](core/services/auth-guard-bpm.service.md) | Adds authentication with Process Services to a route within the app. | [Source](../lib/core/src/lib/auth/guard/auth-guard-bpm.service.ts) | diff --git a/docs/breaking-changes/breaking-change-6.10.0-7.0.0.md b/docs/breaking-changes/breaking-change-6.10.0-7.0.0.md new file mode 100644 index 0000000000..c6a40363c6 --- /dev/null +++ b/docs/breaking-changes/breaking-change-6.10.0-7.0.0.md @@ -0,0 +1,24 @@ +--- +Title: Breaking changes, 6.10.0 -> 7.0.0 +--- + +# Breaking changes, 6.10.0 -> 7.0.0 + +This document lists all the deprecated ADF v2.x components that were removed for v3.0.0: + +- [PR-9317](https://github.com/Alfresco/alfresco-ng2-components/pull/9317) Move alfresco js-API and AlfrescoApi service out from the core + + Move `AlfrescoApiServiceMock` and `AlfrescoApiServiceMock` from `core` library to `content-services`, These libraries are content related therefore should not live in `core` + + To mitigate this change, we can run migration: + + ``` + npx nx migrate @alfresco/adf-core@7.0.0 + npx nx migrate --run-migrations + ``` + + Or for pure angular repository: + + ``` + npx ng update @alfresco/adf-core@7.0.0 + ``` diff --git a/docs/content-services/components/document-list.component.md b/docs/content-services/components/document-list.component.md index 83ffaced9c..51d619e2a4 100644 --- a/docs/content-services/components/document-list.component.md +++ b/docs/content-services/components/document-list.component.md @@ -66,7 +66,7 @@ Displays the documents from a repository. | contentActionsPosition | `string` | "right" | Position of the content actions dropdown menu. Can be set to "left" or "right". | | contextMenuActions | `boolean` | false | Toggles context menus for each row | | currentFolderId | `string` | null | The ID of the folder node to display or a reserved string alias for special sources | -| displayCheckboxesOnHover | `boolean` | false | Enables checkboxes in datatable rows being displayed on hover only. | +| displayCheckboxesOnHover | `boolean` | false | Enables checkboxes in datatable rows being displayed on hover only. | | emptyFolderImageUrl | `string` | | Custom image for empty folder. Default value: './assets/images/empty_doc_lib.svg' | | filterValue | `any` | | Initial value for filter. | | headerFilters | `boolean` | false | Toggles the header filters mode. | @@ -152,7 +152,7 @@ the other DOM events that the [Document List component](document-list.component. Below is a basic example of handling DOM events in the parent elements. ```html -
@@ -195,7 +195,7 @@ The Document List by default supports 2 types of pagination: [Pagination compon ```html - @@ -363,7 +363,7 @@ points you should pay attention to: ```ts import { ChangeDetectorRef } from '@angular/core'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; export class FilesComponent implements OnInit { @@ -408,7 +408,7 @@ It is useful for examining other information that you can access if necessary: Typically you will bind Document List properties to your application/component class properties: ```html - ``` @@ -420,7 +420,7 @@ Typically you will bind Document List properties to your application/component c export class MyAppComponent { myStartFolder: string = '-my-'; - + } ``` @@ -432,7 +432,7 @@ section of the Angular docs for more information. Below is an example of getting a reference: ```html - @@ -448,7 +448,7 @@ import { DocumentListComponent } from '@alfresco/adf-content-services'; export class MyAppComponent implements AfterViewInit { myStartFolder: string = '-my-'; - + @ViewChild(DocumentListComponent) documentList: DocumentListComponent; @@ -498,7 +498,7 @@ Here's a short example: @@ -517,21 +517,21 @@ A custom set of columns might look like the following: @@ -692,7 +692,7 @@ may be sometimes be useful. The following example switches navigation to single clicks: ```html - ``` @@ -702,8 +702,8 @@ The following example switches navigation to single clicks: You can enable Header filters in your document list simply setting to true its `headerFilters` input. ```html - ``` @@ -788,11 +788,11 @@ This will give the following output: ### File Auto downloading -In case of files exceeding a predefined file size, the [document list component](../../content-services/components/document-list.component.md) can be configured to automatically download those file when trying to preview them. +In case of files exceeding a predefined file size, the [document list component](../../content-services/components/document-list.component.md) can be configured to automatically download those file when trying to preview them. This can help in reducing server load, and ensuring quick access to such files. After turning this feature on, whenever the user tries to preview a file with a large file size, the [Document List component](../../content-services/components/document-list.component.md) will first preview a dialog, asking for confirmation from the user on whether they want to download the file, or cancel the preview altogether. -In order to configure the Document List to automatically download the files, the following environment variables would need to be set up in app.config.json - +In order to configure the Document List to automatically download the files, the following environment variables would need to be set up in app.config.json - ``` "viewer": { diff --git a/docs/core/pipes/localized-date.pipe.md b/docs/core/pipes/localized-date.pipe.md index 1937b3e485..1399bd9f20 100644 --- a/docs/core/pipes/localized-date.pipe.md +++ b/docs/core/pipes/localized-date.pipe.md @@ -25,7 +25,7 @@ Converts a date to a given format and locale. ## Details -The pipe takes a date and formats it and localizes it so the date is displayed in the proper format for the region. It uses the [Angular Date Pipe](https://angular.io/api/common/DatePipe#custom-format-options) so all the pre-defined and custom formats can be used. +The pipe takes a date and formats it and localizes it so the date is displayed in the proper format for the region. It uses the [Angular Date Pipe](https://angular.io/api/common/DatePipe#custom-format-options) so all the pre-defined and custom formats can be used. To localize the dates in your application, you will need to add the specific locale file for your region in order to use it. Read more about internationalization [here](https://angular.io/guide/i18n#i18n-pipes). @@ -58,4 +58,4 @@ You can overwrite the default values of this pipe by adding these properties to | defaultDateTimeFormat | string | The format to apply to date-time values | | defaultLocale | string | The locale id to apply | -This configuration overwrites the values in the [localized date pipe](../../core/pipes/localized-date.pipe.md) as well as other components to have more consistency across your app. However, you can still overwrite these values any time by using the pipe in your code. +This configuration overwrites the values in the [localized date pipe](../../core/pipes/localized-date.pipe.md) as well as other components to have more consistency across your app. However, you can still overwrite these values any time by using the pipe in your code. diff --git a/docs/core/services/alfresco-api.service.md b/docs/core/services/alfresco-api.service.md index f93d7bd0c0..36f0b26b0e 100644 --- a/docs/core/services/alfresco-api.service.md +++ b/docs/core/services/alfresco-api.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-01-17 --- -# [Alfresco Api Service](../../../lib/core/src/lib/services/alfresco-api.service.ts "Defined in alfresco-api.service.ts") +# [Alfresco Api Service](lib/content-services/src/lib/services/alfresco-api.service.ts "Defined in alfresco-api.service.ts") Provides access to an initialized **AlfrescoJSApi** instance. diff --git a/docs/tutorials/working-with-data-table.md b/docs/tutorials/working-with-data-table.md index 509badb98f..342a61639d 100644 --- a/docs/tutorials/working-with-data-table.md +++ b/docs/tutorials/working-with-data-table.md @@ -111,21 +111,21 @@ the source code below to the `mydatatable` component, just before the constructo data = new ObjectDataTableAdapter( [ { - id: 1, - firstName: 'Name #1', - lastName: 'Lastname #1', + id: 1, + firstName: 'Name #1', + lastName: 'Lastname #1', icon: 'material-icons://folder_open' }, { - id: 2, - firstName: 'Name #2', - lastName: 'Lastname #2', + id: 2, + firstName: 'Name #2', + lastName: 'Lastname #2', icon: 'material-icons://accessibility' }, { - id: 3, - firstName: 'Name #3', - lastName: 'Lastname #3', + id: 3, + firstName: 'Name #3', + lastName: 'Lastname #3', icon: 'material-icons://alarm' } ] @@ -137,21 +137,21 @@ configure the columns. Open the `src/app/mydatatable/mydatatable.component.html` with the following: ```html - - - - @@ -179,7 +179,7 @@ As a simple example, we'll add a `click` event to display an alert when a row is `src/app/mydatatable/mydatatable.component.html` and add the following: ```html - ....... @@ -205,9 +205,9 @@ Let's dig a bit deeper into the different options for rendering columns within t is quite in-depth and has lots of examples. We highly recommend checking it out. From the documentation we can see that the [Data Column component](../core/components/data-column.component.md) has quite a few properties but the -most important ones are `key`, `type`, `sortable`, `title` and `class`. +most important ones are `key`, `type`, `sortable`, `title` and `class`. -- `key` is the name of the corresponding property in the [`ObjectDataTableAdapter`](lib/core/src/lib/datatable/data/object-datatable-adapter.ts) object. +- `key` is the name of the corresponding property in the [`ObjectDataTableAdapter`](lib/core/src/lib/datatable/data/object-datatable-adapter.ts) object. - `type` indicates how to render. By default it will take the `text` from the matching key in the data, but other modes are also available: \- `image` will take a URI for a Material Icon or a URL for any image and display it. @@ -231,24 +231,24 @@ Open `src/app/mydatatable/mydatatable.component.ts` and change the data to the f data = new ObjectDataTableAdapter( [ { - id: 1, - name: 'Name #1', - createdBy: 'User #1', - status: 'green', + id: 1, + name: 'Name #1', + createdBy: 'User #1', + status: 'green', icon: 'material-icons://folder_open' }, { - id: 2, - name: 'Name #2', - createdBy: 'User #2', - status: 'red', + id: 2, + name: 'Name #2', + createdBy: 'User #2', + status: 'red', icon: 'material-icons://accessibility' }, { - id: 3, - name: 'Name #3', - createdBy: 'User #3', - status: 'green', + id: 3, + name: 'Name #3', + createdBy: 'User #3', + status: 'green', icon: 'material-icons://alarm' } ] @@ -286,7 +286,7 @@ file and replace the content with the following: ```ts import { Component, OnInit } from '@angular/core'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { ObjectDataTableAdapter, ObjectDataRow } from '@alfresco/adf-core'; @Component({ @@ -356,7 +356,7 @@ Make the changes shown below to the `src/app/mydatatable/mydatatable.component.h ``` -Also update `src/app/mydatatable/mydatatable.component.ts` as follows: +Also update `src/app/mydatatable/mydatatable.component.ts` as follows: ```ts import { DataCellEvent, DataRowActionEvent } from '@alfresco/adf-core'; diff --git a/lib/core/src/lib/api-factories/alfresco-api-no-auth.service.ts b/lib/content-services/src/lib/api-factories/alfresco-api-no-auth.service.ts similarity index 91% rename from lib/core/src/lib/api-factories/alfresco-api-no-auth.service.ts rename to lib/content-services/src/lib/api-factories/alfresco-api-no-auth.service.ts index 619935c03b..1530ccbd47 100644 --- a/lib/core/src/lib/api-factories/alfresco-api-no-auth.service.ts +++ b/lib/content-services/src/lib/api-factories/alfresco-api-no-auth.service.ts @@ -16,10 +16,9 @@ */ import { AdfHttpClient } from '@alfresco/adf-core/api'; -import { StorageService } from '../common/services/storage.service'; +import { StorageService, AppConfigService } from '@alfresco/adf-core'; import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; -import { AppConfigService } from '../app-config'; import { AlfrescoApiService } from '../services/alfresco-api.service'; @Injectable() diff --git a/lib/core/src/lib/api-factories/alfresco-api-v2-loader.service.ts b/lib/content-services/src/lib/api-factories/alfresco-api-v2-loader.service.ts similarity index 92% rename from lib/core/src/lib/api-factories/alfresco-api-v2-loader.service.ts rename to lib/content-services/src/lib/api-factories/alfresco-api-v2-loader.service.ts index faeca42120..353f62ce80 100644 --- a/lib/core/src/lib/api-factories/alfresco-api-v2-loader.service.ts +++ b/lib/content-services/src/lib/api-factories/alfresco-api-v2-loader.service.ts @@ -17,9 +17,8 @@ import { AlfrescoApiConfig } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; -import { AppConfigService, AppConfigValues } from '../app-config/app-config.service'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; -import { StorageService } from '../common/services/storage.service'; +import { AppConfigService, AppConfigValues, StorageService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; /** * Create a factory to resolve an api service instance diff --git a/lib/core/src/lib/services/index.ts b/lib/content-services/src/lib/api-factories/index.ts similarity index 100% rename from lib/core/src/lib/services/index.ts rename to lib/content-services/src/lib/api-factories/index.ts diff --git a/lib/content-services/src/lib/api-factories/public-api.ts b/lib/content-services/src/lib/api-factories/public-api.ts new file mode 100644 index 0000000000..76a5376de4 --- /dev/null +++ b/lib/content-services/src/lib/api-factories/public-api.ts @@ -0,0 +1,19 @@ +/*! + * @license + * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './alfresco-api-no-auth.service'; +export * from './alfresco-api-v2-loader.service'; diff --git a/lib/content-services/src/lib/aspect-list/services/aspect-list.service.spec.ts b/lib/content-services/src/lib/aspect-list/services/aspect-list.service.spec.ts index 6f4023c654..17a947ca5a 100644 --- a/lib/content-services/src/lib/aspect-list/services/aspect-list.service.spec.ts +++ b/lib/content-services/src/lib/aspect-list/services/aspect-list.service.spec.ts @@ -16,10 +16,10 @@ */ import { TestBed } from '@angular/core/testing'; -import { AlfrescoApiService } from '@alfresco/adf-core'; import { AspectListService } from './aspect-list.service'; import { AspectPaging, AspectsApi, AspectEntry } from '@alfresco/js-api'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { AlfrescoApiService } from '../../services'; const stdAspect1: AspectEntry = { entry: { id: 'std:standardAspectOne', description: 'Standard Aspect One', title: 'StandardAspectOne' } }; const stdAspect2: AspectEntry = { entry: { id: 'std:standardAspectTwo', description: 'Standard Aspect Two', title: 'StandardAspectTwo' } }; diff --git a/lib/content-services/src/lib/aspect-list/services/aspect-list.service.ts b/lib/content-services/src/lib/aspect-list/services/aspect-list.service.ts index fd2e0a98e5..e33b0c1395 100644 --- a/lib/content-services/src/lib/aspect-list/services/aspect-list.service.ts +++ b/lib/content-services/src/lib/aspect-list/services/aspect-list.service.ts @@ -16,7 +16,8 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; +import { AppConfigService } from '@alfresco/adf-core'; import { from, Observable, of, zip } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { AspectEntry, AspectPaging, AspectsApi } from '@alfresco/js-api'; diff --git a/lib/content-services/src/lib/aspect-list/services/node-aspect.service.spec.ts b/lib/content-services/src/lib/aspect-list/services/node-aspect.service.spec.ts index 174f4177fe..98ca282729 100644 --- a/lib/content-services/src/lib/aspect-list/services/node-aspect.service.spec.ts +++ b/lib/content-services/src/lib/aspect-list/services/node-aspect.service.spec.ts @@ -23,7 +23,7 @@ import { ContentTestingModule } from '../../testing/content.testing.module'; import { NodeAspectService } from './node-aspect.service'; import { DialogAspectListService } from './dialog-aspect-list.service'; import { CardViewContentUpdateService } from '../../common/services/card-view-content-update.service'; -import { TagService } from '@alfresco/adf-content-services'; +import { TagService } from '../../tag'; describe('NodeAspectService', () => { let dialogAspectListService: DialogAspectListService; diff --git a/lib/content-services/src/lib/category/services/category-tree-datasource.service.spec.ts b/lib/content-services/src/lib/category/services/category-tree-datasource.service.spec.ts index b318d337cc..414eb5215a 100644 --- a/lib/content-services/src/lib/category/services/category-tree-datasource.service.spec.ts +++ b/lib/content-services/src/lib/category/services/category-tree-datasource.service.spec.ts @@ -17,11 +17,12 @@ import { fakeAsync, TestBed } from '@angular/core/testing'; import { CategoryService } from '../services/category.service'; -import { CategoryNode, CategoryTreeDatasourceService } from '@alfresco/adf-content-services'; import { CategoryServiceMock } from '../mock/category-mock.service'; import { TreeNodeType, TreeResponse } from '../../tree'; import { EMPTY, of } from 'rxjs'; import { Pagination } from '@alfresco/js-api'; +import { CategoryTreeDatasourceService } from './category-tree-datasource.service'; +import { CategoryNode } from '../models/category-node.interface'; describe('CategoryTreeDatasourceService', () => { let categoryTreeDatasourceService: CategoryTreeDatasourceService; diff --git a/lib/content-services/src/lib/category/services/category.service.ts b/lib/content-services/src/lib/category/services/category.service.ts index f2ce9861ac..9471daa8a4 100644 --- a/lib/content-services/src/lib/category/services/category.service.ts +++ b/lib/content-services/src/lib/category/services/category.service.ts @@ -16,7 +16,7 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService, UserPreferencesService } from '@alfresco/adf-core'; +import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core'; import { CategoriesApi, CategoryBody, @@ -27,6 +27,7 @@ import { SearchApi, SEARCH_LANGUAGE } from '@alfresco/js-api'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { from, Observable } from 'rxjs'; @Injectable({ providedIn: 'root' }) diff --git a/lib/content-services/src/lib/common/services/content.service.ts b/lib/content-services/src/lib/common/services/content.service.ts index 9e5db1ec79..7898099fab 100644 --- a/lib/content-services/src/lib/common/services/content.service.ts +++ b/lib/content-services/src/lib/common/services/content.service.ts @@ -18,9 +18,10 @@ import { Injectable } from '@angular/core'; import { ContentApi, Node, NodeEntry } from '@alfresco/js-api'; import { Subject } from 'rxjs'; -import { AlfrescoApiService, AuthenticationService, ThumbnailService } from '@alfresco/adf-core'; +import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core'; import { PermissionsEnum } from '../models/permissions.enum'; import { AllowableOperationsEnum } from '../models/allowable-operations.enum'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; export interface FolderCreatedEvent { name: string; diff --git a/lib/content-services/src/lib/common/services/discovery-api.service.ts b/lib/content-services/src/lib/common/services/discovery-api.service.ts index 99b97965ab..3a8ab25974 100644 --- a/lib/content-services/src/lib/common/services/discovery-api.service.ts +++ b/lib/content-services/src/lib/common/services/discovery-api.service.ts @@ -18,21 +18,15 @@ import { Injectable } from '@angular/core'; import { from, Observable, throwError, Subject } from 'rxjs'; import { catchError, map, switchMap, filter, take } from 'rxjs/operators'; -import { - RepositoryInfo, - SystemPropertiesRepresentation, - DiscoveryApi, - AboutApi, - SystemPropertiesApi -} from '@alfresco/js-api'; +import { RepositoryInfo, SystemPropertiesRepresentation, DiscoveryApi, AboutApi, SystemPropertiesApi } from '@alfresco/js-api'; -import { AlfrescoApiService, BpmProductVersionModel, AuthenticationService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; +import { BpmProductVersionModel, AuthenticationService } from '@alfresco/adf-core'; @Injectable({ providedIn: 'root' }) export class DiscoveryApiService { - private _discoveryApi: DiscoveryApi; get discoveryApi(): DiscoveryApi { this._discoveryApi = this._discoveryApi ?? new DiscoveryApi(this.alfrescoApiService.getInstance()); @@ -44,34 +38,28 @@ export class DiscoveryApiService { */ ecmProductInfo$ = new Subject(); - constructor( - private authenticationService: AuthenticationService, - private alfrescoApiService: AlfrescoApiService - ) { + constructor(private authenticationService: AuthenticationService, private alfrescoApiService: AlfrescoApiService) { this.authenticationService.onLogin.subscribe(() => { - this.alfrescoApiService.alfrescoApiInitialized.pipe( - filter(() => this.authenticationService.isEcmLoggedIn()), - take(1), - switchMap(() => this.getEcmProductInfo()) - ) + this.alfrescoApiService.alfrescoApiInitialized + .pipe( + filter(() => this.authenticationService.isEcmLoggedIn()), + take(1), + switchMap(() => this.getEcmProductInfo()) + ) .subscribe((info) => this.ecmProductInfo$.next(info)); - }); } - /** * Gets product information for Content Services. * * @returns ProductVersionModel containing product details */ getEcmProductInfo(): Observable { - - return from(this.discoveryApi.getRepositoryInformation()) - .pipe( - map((res) => res.entry.repository), - catchError((err) => throwError(err)) - ); + return from(this.discoveryApi.getRepositoryInformation()).pipe( + map((res) => res.entry.repository), + catchError((err) => throwError(err)) + ); } /** @@ -82,25 +70,23 @@ export class DiscoveryApiService { getBpmProductInfo(): Observable { const aboutApi = new AboutApi(this.alfrescoApiService.getInstance()); - return from(aboutApi.getAppVersion()) - .pipe( - map((res) => new BpmProductVersionModel(res)), - catchError((err) => throwError(err)) - ); + return from(aboutApi.getAppVersion()).pipe( + map((res) => new BpmProductVersionModel(res)), + catchError((err) => throwError(err)) + ); } getBPMSystemProperties(): Observable { const systemPropertiesApi = new SystemPropertiesApi(this.alfrescoApiService.getInstance()); - return from(systemPropertiesApi.getProperties()) - .pipe( - map((res: any) => { - if ('string' === typeof (res)) { - throw new Error('Not valid response'); - } - return res; - }), - catchError((err) => throwError(err.error)) - ); + return from(systemPropertiesApi.getProperties()).pipe( + map((res: any) => { + if ('string' === typeof res) { + throw new Error('Not valid response'); + } + return res; + }), + catchError((err) => throwError(err.error)) + ); } } diff --git a/lib/content-services/src/lib/common/services/favorites-api.service.ts b/lib/content-services/src/lib/common/services/favorites-api.service.ts index 785ed0c08f..4bd719652c 100644 --- a/lib/content-services/src/lib/common/services/favorites-api.service.ts +++ b/lib/content-services/src/lib/common/services/favorites-api.service.ts @@ -18,7 +18,8 @@ import { Injectable } from '@angular/core'; import { FavoritesApi, NodePaging, FavoritePaging } from '@alfresco/js-api'; import { Observable, from, of } from 'rxjs'; -import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; +import { UserPreferencesService } from '@alfresco/adf-core'; import { catchError } from 'rxjs/operators'; @Injectable({ diff --git a/lib/content-services/src/lib/common/services/nodes-api.service.ts b/lib/content-services/src/lib/common/services/nodes-api.service.ts index ea4deca9b5..0d49083aea 100644 --- a/lib/content-services/src/lib/common/services/nodes-api.service.ts +++ b/lib/content-services/src/lib/common/services/nodes-api.service.ts @@ -15,12 +15,13 @@ * limitations under the License. */ -import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core'; +import { UserPreferencesService } from '@alfresco/adf-core'; import { ContentPagingQuery, Node, NodeAssignedHold, NodeEntry, NodePaging, NodesApi, NodesIncludeQuery, TrashcanApi } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; import { from, Observable, Subject, throwError } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { NodeMetadata } from '../models/node-metadata.model'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/common/services/people-content.service.spec.ts b/lib/content-services/src/lib/common/services/people-content.service.spec.ts index b34a3fea01..811824a190 100644 --- a/lib/content-services/src/lib/common/services/people-content.service.spec.ts +++ b/lib/content-services/src/lib/common/services/people-content.service.spec.ts @@ -16,12 +16,14 @@ */ import { fakeEcmUser } from '../mocks/ecm-user.service.mock'; -import { AlfrescoApiService, AlfrescoApiServiceMock, RedirectAuthService } from '@alfresco/adf-core'; +import { RedirectAuthService } from '@alfresco/adf-core'; import { PeopleContentQueryRequestModel, PeopleContentService } from './people-content.service'; import { TestBed } from '@angular/core/testing'; import { PersonPaging } from '@alfresco/js-api'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { EMPTY, of } from 'rxjs'; +import { AlfrescoApiService } from '../../services'; +import { AlfrescoApiServiceMock } from '../../mock'; export const fakeEcmUser2 = { id: 'another-fake-id', diff --git a/lib/content-services/src/lib/common/services/people-content.service.ts b/lib/content-services/src/lib/common/services/people-content.service.ts index d642fad402..95a89294fc 100644 --- a/lib/content-services/src/lib/common/services/people-content.service.ts +++ b/lib/content-services/src/lib/common/services/people-content.service.ts @@ -17,11 +17,12 @@ import { Injectable } from '@angular/core'; import { from, Observable, of } from 'rxjs'; -import { AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core'; +import { AuthenticationService } from '@alfresco/adf-core'; import { map, tap } from 'rxjs/operators'; import { Pagination, PeopleApi, PersonBodyCreate, PersonBodyUpdate } from '@alfresco/js-api'; import { EcmUserModel } from '../models/ecm-user.model'; import { ContentService } from './content.service'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; export interface PeopleContentQueryResponse { pagination: Pagination; diff --git a/lib/content-services/src/lib/common/services/rendition.service.ts b/lib/content-services/src/lib/common/services/rendition.service.ts index e0fc85e133..03d239dc50 100644 --- a/lib/content-services/src/lib/common/services/rendition.service.ts +++ b/lib/content-services/src/lib/common/services/rendition.service.ts @@ -17,7 +17,8 @@ import { Injectable } from '@angular/core'; import { ContentApi, RenditionEntry, RenditionPaging, RenditionsApi, VersionsApi } from '@alfresco/js-api'; -import { AlfrescoApiService, Track, TranslationService, ViewUtilService } from '@alfresco/adf-core'; +import { Track, TranslationService, ViewUtilService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/common/services/rendition.services.spec.ts b/lib/content-services/src/lib/common/services/rendition.services.spec.ts index 4ce3887094..9bc3b44d98 100644 --- a/lib/content-services/src/lib/common/services/rendition.services.spec.ts +++ b/lib/content-services/src/lib/common/services/rendition.services.spec.ts @@ -16,9 +16,10 @@ */ import { TestBed } from '@angular/core/testing'; -import { AlfrescoApiService, TranslationService, ViewUtilService } from '@alfresco/adf-core'; +import { TranslationService, ViewUtilService } from '@alfresco/adf-core'; import { Rendition, RenditionEntry, RenditionPaging, RenditionsApi } from '@alfresco/js-api'; -import { RenditionService } from '@alfresco/adf-content-services'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; +import { RenditionService } from './rendition.service'; const getRenditionEntry = (status: Rendition.StatusEnum): RenditionEntry => ({ entry: { diff --git a/lib/content-services/src/lib/common/services/sites.service.ts b/lib/content-services/src/lib/common/services/sites.service.ts index a48a595bca..058e24c993 100644 --- a/lib/content-services/src/lib/common/services/sites.service.ts +++ b/lib/content-services/src/lib/common/services/sites.service.ts @@ -17,7 +17,6 @@ import { Injectable } from '@angular/core'; import { from, Observable } from 'rxjs'; -import { AlfrescoApiService } from '@alfresco/adf-core'; import { Node, SiteBodyCreate, @@ -32,6 +31,7 @@ import { SitePaging, SitesApi } from '@alfresco/js-api'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/common/services/upload.service.spec.ts b/lib/content-services/src/lib/common/services/upload.service.spec.ts index 4dddb0d1e9..4f602abaef 100644 --- a/lib/content-services/src/lib/common/services/upload.service.spec.ts +++ b/lib/content-services/src/lib/common/services/upload.service.spec.ts @@ -17,13 +17,15 @@ import { EventEmitter } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigModule, AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core'; +import { AppConfigModule, AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core'; import { UploadService } from './upload.service'; import { RepositoryInfo } from '@alfresco/js-api'; import { BehaviorSubject } from 'rxjs'; import { DiscoveryApiService } from '../../common/services/discovery-api.service'; import { FileModel, FileUploadStatus } from '../../common/models/file.model'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { AlfrescoApiService } from '../../services'; +import { AlfrescoApiServiceMock } from '../../mock'; declare let jasmine: any; diff --git a/lib/content-services/src/lib/common/services/upload.service.ts b/lib/content-services/src/lib/common/services/upload.service.ts index e31729568f..600beac102 100644 --- a/lib/content-services/src/lib/common/services/upload.service.ts +++ b/lib/content-services/src/lib/common/services/upload.service.ts @@ -20,10 +20,11 @@ import { Minimatch } from 'minimatch'; import { Subject } from 'rxjs'; import { FileUploadCompleteEvent, FileUploadDeleteEvent, FileUploadErrorEvent, FileUploadEvent } from '../events/file.event'; import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.model'; -import { AppConfigService, AlfrescoApiService } from '@alfresco/adf-core'; +import { AppConfigService } from '@alfresco/adf-core'; import { filter } from 'rxjs/operators'; import { DiscoveryApiService } from '../../common/services/discovery-api.service'; import { NodeBodyCreate, NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; const MIN_CANCELLABLE_FILE_SIZE = 1000000; const MAX_CANCELLABLE_FILE_PERCENTAGE = 50; diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts index 5524e8bc21..6eb989d9e3 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts @@ -25,7 +25,7 @@ import { NodeAspectService } from '../../../aspect-list/services/node-aspect.ser import { ContentMetadataService } from '../../services/content-metadata.service'; import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum'; import { of } from 'rxjs'; -import { AlfrescoApiService, AlfrescoApiServiceMock, AuthModule, NoopTranslateModule } from '@alfresco/adf-core'; +import { AuthModule, NoopTranslateModule } from '@alfresco/adf-core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { versionCompatibilityFactory } from '../../../version-compatibility/version-compatibility-factory'; import { VersionCompatibilityService } from '../../../version-compatibility'; @@ -34,6 +34,8 @@ import { MatSnackBarModule } from '@angular/material/snack-bar'; import { CategoryService } from '../../../category'; import { TagService } from '../../../tag'; import { PropertyDescriptorsService } from '../../public-api'; +import { AlfrescoApiService } from '../../../services/alfresco-api.service'; +import { AlfrescoApiServiceMock } from '../../../mock/alfresco-api.service.mock'; describe('ContentMetadataCardComponent', () => { let component: ContentMetadataCardComponent; diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts index 4fcc02d80b..0a88874256 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts @@ -35,20 +35,16 @@ import { EMPTY, of, throwError } from 'rxjs'; import { CardViewContentUpdateService } from '../../../common/services/card-view-content-update.service'; import { PropertyGroup } from '../../interfaces/property-group.interface'; import { PropertyDescriptorsService } from '../../services/property-descriptors.service'; -import { - CategoriesManagementComponent, - CategoriesManagementMode, - CategoryService, - TagsCreatorComponent, - TagsCreatorMode, - TagService -} from '@alfresco/adf-content-services'; import { MatExpansionPanel } from '@angular/material/expansion'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { MatDialogModule } from '@angular/material/dialog'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatChipHarness } from '@angular/material/chips/testing'; +import { TagService } from '../../../tag/services/tag.service'; +import { CategoryService } from '../../../category/services/category.service'; +import { TagsCreatorComponent, TagsCreatorMode } from '../../../tag'; +import { CategoriesManagementComponent, CategoriesManagementMode } from '../../../category'; describe('ContentMetadataComponent', () => { let component: ContentMetadataComponent; diff --git a/lib/content-services/src/lib/content-metadata/services/property-descriptors.service.ts b/lib/content-services/src/lib/content-metadata/services/property-descriptors.service.ts index e91310a598..58be7372d3 100644 --- a/lib/content-services/src/lib/content-metadata/services/property-descriptors.service.ts +++ b/lib/content-services/src/lib/content-metadata/services/property-descriptors.service.ts @@ -16,7 +16,7 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { Observable, defer, forkJoin } from 'rxjs'; import { PropertyGroup, PropertyGroupContainer } from '../interfaces/content-metadata.interfaces'; import { map } from 'rxjs/operators'; diff --git a/lib/content-services/src/lib/content-node-share/content-node-share.directive.ts b/lib/content-services/src/lib/content-node-share/content-node-share.directive.ts index 15c3e375bb..c438cc9b6a 100644 --- a/lib/content-services/src/lib/content-node-share/content-node-share.directive.ts +++ b/lib/content-services/src/lib/content-node-share/content-node-share.directive.ts @@ -21,7 +21,7 @@ import { NodeEntry, NodesApi } from '@alfresco/js-api'; import { ShareDialogComponent } from './content-node-share.dialog'; import { Observable, from, Subject } from 'rxjs'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; import { takeUntil } from 'rxjs/operators'; @Directive({ diff --git a/lib/content-services/src/lib/content-node-share/services/shared-links-api.service.ts b/lib/content-services/src/lib/content-node-share/services/shared-links-api.service.ts index 1eb7c42cbb..2e515036c2 100644 --- a/lib/content-services/src/lib/content-node-share/services/shared-links-api.service.ts +++ b/lib/content-services/src/lib/content-node-share/services/shared-links-api.service.ts @@ -18,8 +18,9 @@ import { Injectable } from '@angular/core'; import { NodePaging, SharedLinkBodyCreate, SharedLinkEntry, SharedlinksApi } from '@alfresco/js-api'; import { Observable, from, of, Subject } from 'rxjs'; -import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core'; +import { UserPreferencesService } from '@alfresco/adf-core'; import { catchError } from 'rxjs/operators'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/content-type/content-type.service.ts b/lib/content-services/src/lib/content-type/content-type.service.ts index ac582c2f8e..d209749bce 100644 --- a/lib/content-services/src/lib/content-type/content-type.service.ts +++ b/lib/content-services/src/lib/content-type/content-type.service.ts @@ -17,9 +17,10 @@ import { TypeEntry, TypePaging, TypesApi } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; import { from, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; + @Injectable({ providedIn: 'root' }) diff --git a/lib/content-services/src/lib/content.module.ts b/lib/content-services/src/lib/content.module.ts index 5ef15d20f9..e283dbbfe2 100644 --- a/lib/content-services/src/lib/content.module.ts +++ b/lib/content-services/src/lib/content.module.ts @@ -46,6 +46,9 @@ import { AlfrescoViewerComponent } from './viewer'; import { ContentTypeDialogComponent } from './content-type'; import { MaterialModule } from './material.module'; import { AlfrescoIconComponent } from './alfresco-icon/alfresco-icon.component'; +import { AlfrescoApiService } from './services/alfresco-api.service'; +import { AlfrescoApiNoAuthService } from './api-factories/alfresco-api-no-auth.service'; +import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-factories/alfresco-api-v2-loader.service'; @NgModule({ imports: [ @@ -111,6 +114,7 @@ export class ContentModule { providers: [ provideTranslations('adf-content-services', 'assets/adf-content-services'), ContentAuthLoaderService, + { provide: AlfrescoApiService, useClass: AlfrescoApiNoAuthService }, { provide: APP_INITIALIZER, useFactory: versionCompatibilityFactory, @@ -122,6 +126,12 @@ export class ContentModule { useFactory: contentAuthLoaderFactory, deps: [ContentAuthLoaderService], multi: true + }, + { + provide: APP_INITIALIZER, + useFactory: createAlfrescoApiInstance, + deps: [AlfrescoApiLoaderService], + multi: true } ] }; diff --git a/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts index 9a1f7dad0c..7eae9cdff9 100755 --- a/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts +++ b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts @@ -21,8 +21,10 @@ import { DownloadZipDialogComponent } from './download-zip.dialog'; import { DownloadZipService } from './services/download-zip.service'; import { DownloadEntry, FileDownloadStatus } from '@alfresco/js-api'; import { EMPTY, Observable, of } from 'rxjs'; -import { AlfrescoApiService, AlfrescoApiServiceMock, NoopTranslateModule, RedirectAuthService } from '@alfresco/adf-core'; +import { NoopTranslateModule, RedirectAuthService } from '@alfresco/adf-core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { AlfrescoApiService } from '../../services'; +import { AlfrescoApiServiceMock } from '../../mock'; describe('DownloadZipDialogComponent', () => { let fixture: ComponentFixture; diff --git a/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts index 1de937e1cc..ef2680ed8f 100644 --- a/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts +++ b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts @@ -16,7 +16,6 @@ */ import { applicationConfig, Meta, moduleMetadata, StoryFn } from '@storybook/angular'; -import { AlfrescoApiService } from '@alfresco/adf-core'; import { MatButtonModule } from '@angular/material/button'; import { DownloadZipDialogStorybookComponent } from './download-zip.dialog.stories.component'; import { AlfrescoApiServiceMock, ContentApiMock, DownloadZipMockService, NodesApiMock } from './mock/download-zip-service.mock'; @@ -27,6 +26,7 @@ import { MatDialogModule } from '@angular/material/dialog'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { importProvidersFrom } from '@angular/core'; import { CoreStoryModule } from '../../../../../core/src/public-api'; +import { AlfrescoApiService } from '../../services'; export default { component: DownloadZipDialogStorybookComponent, diff --git a/lib/content-services/src/lib/dialogs/download-zip/services/download-zip.service.ts b/lib/content-services/src/lib/dialogs/download-zip/services/download-zip.service.ts index b0d1fe8758..4e1c972e1f 100755 --- a/lib/content-services/src/lib/dialogs/download-zip/services/download-zip.service.ts +++ b/lib/content-services/src/lib/dialogs/download-zip/services/download-zip.service.ts @@ -18,7 +18,7 @@ import { DownloadEntry, DownloadBodyCreate, DownloadsApi } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/dialogs/library/library.dialog.ts b/lib/content-services/src/lib/dialogs/library/library.dialog.ts index e1bb853c8d..ebae76c319 100644 --- a/lib/content-services/src/lib/dialogs/library/library.dialog.ts +++ b/lib/content-services/src/lib/dialogs/library/library.dialog.ts @@ -28,7 +28,7 @@ import { } from '@angular/forms'; import { MatDialogModule, MatDialogRef } from '@angular/material/dialog'; import { QueriesApi, SiteBodyCreate, SiteEntry, SitePaging } from '@alfresco/js-api'; -import { AlfrescoApiService, NotificationService } from '@alfresco/adf-core'; +import { NotificationService } from '@alfresco/adf-core'; import { debounceTime, finalize, mergeMap, takeUntil } from 'rxjs/operators'; import { SitesService } from '../../common/services/sites.service'; import { CommonModule } from '@angular/common'; @@ -38,6 +38,7 @@ import { MatInputModule } from '@angular/material/input'; import { AutoFocusDirective } from '../../directives'; import { MatRadioModule } from '@angular/material/radio'; import { MatButtonModule } from '@angular/material/button'; +import { AlfrescoApiService } from '../../services'; @Component({ selector: 'adf-library-dialog', diff --git a/lib/content-services/src/lib/dialogs/node-lock/node-lock.dialog.ts b/lib/content-services/src/lib/dialogs/node-lock/node-lock.dialog.ts index 0c35fda4f5..9fb80e4e98 100644 --- a/lib/content-services/src/lib/dialogs/node-lock/node-lock.dialog.ts +++ b/lib/content-services/src/lib/dialogs/node-lock/node-lock.dialog.ts @@ -20,7 +20,6 @@ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/materia import { ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; import { differenceInSeconds } from 'date-fns'; import { NodeBodyLock, Node, NodeEntry, NodesApi } from '@alfresco/js-api'; -import { AlfrescoApiService } from '@alfresco/adf-core'; import { CommonModule } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; import { MatCheckboxModule } from '@angular/material/checkbox'; @@ -28,6 +27,7 @@ import { MatFormFieldModule } from '@angular/material/form-field'; import { MatDatetimepickerModule } from '@mat-datetimepicker/core'; import { MatInputModule } from '@angular/material/input'; import { MatButtonModule } from '@angular/material/button'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Component({ selector: 'adf-node-lock', diff --git a/lib/content-services/src/lib/directives/library-favorite.directive.ts b/lib/content-services/src/lib/directives/library-favorite.directive.ts index 0e2c79fa93..96b78dcefc 100644 --- a/lib/content-services/src/lib/directives/library-favorite.directive.ts +++ b/lib/content-services/src/lib/directives/library-favorite.directive.ts @@ -17,7 +17,7 @@ import { Directive, HostListener, Input, OnChanges, Output, EventEmitter, SimpleChanges } from '@angular/core'; import { FavoriteBodyCreate, FavoritesApi } from '@alfresco/js-api'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; import { LibraryEntity } from '../interfaces/library-entity.interface'; @Directive({ diff --git a/lib/content-services/src/lib/directives/library-membership.directive.spec.ts b/lib/content-services/src/lib/directives/library-membership.directive.spec.ts index ec9172f5e8..2369621cab 100644 --- a/lib/content-services/src/lib/directives/library-membership.directive.spec.ts +++ b/lib/content-services/src/lib/directives/library-membership.directive.spec.ts @@ -19,9 +19,10 @@ import { fakeAsync, TestBed, tick } from '@angular/core/testing'; import { LibraryMembershipDirective } from './library-membership.directive'; import { SimpleChange } from '@angular/core'; import { of, throwError, Subject } from 'rxjs'; -import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core'; import { SitesService } from '../common/services/sites.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; +import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; describe('LibraryMembershipDirective', () => { let alfrescoApiService: AlfrescoApiService; diff --git a/lib/content-services/src/lib/directives/library-membership.directive.ts b/lib/content-services/src/lib/directives/library-membership.directive.ts index a78b8b83e2..86494626f6 100644 --- a/lib/content-services/src/lib/directives/library-membership.directive.ts +++ b/lib/content-services/src/lib/directives/library-membership.directive.ts @@ -18,7 +18,7 @@ import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { SiteEntry, SiteMembershipRequestBodyCreate, SiteMembershipRequestEntry, SitesApi } from '@alfresco/js-api'; import { BehaviorSubject, from, Observable } from 'rxjs'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; import { LibraryMembershipToggleEvent } from '../interfaces/library-membership-toggle-event.interface'; import { LibraryMembershipErrorEvent } from '../interfaces/library-membership-error-event.interface'; import { VersionCompatibilityService } from '../version-compatibility/version-compatibility.service'; diff --git a/lib/content-services/src/lib/directives/node-delete.directive.ts b/lib/content-services/src/lib/directives/node-delete.directive.ts index 9aca4c9681..ad33ad1385 100644 --- a/lib/content-services/src/lib/directives/node-delete.directive.ts +++ b/lib/content-services/src/lib/directives/node-delete.directive.ts @@ -20,8 +20,9 @@ import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core'; import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi } from '@alfresco/js-api'; import { Observable, forkJoin, from, of } from 'rxjs'; -import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; +import { TranslationService } from '@alfresco/adf-core'; import { map, catchError, retry } from 'rxjs/operators'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; interface ProcessedNodeData { entry: Node | DeletedNode; diff --git a/lib/content-services/src/lib/directives/node-download.directive.spec.ts b/lib/content-services/src/lib/directives/node-download.directive.spec.ts index 2795b657ce..0ac5b28258 100755 --- a/lib/content-services/src/lib/directives/node-download.directive.spec.ts +++ b/lib/content-services/src/lib/directives/node-download.directive.spec.ts @@ -19,10 +19,11 @@ import { TestBed, ComponentFixture } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; import { Component, DebugElement, ViewChild } from '@angular/core'; -import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core'; import { NodeDownloadDirective } from './node-download.directive'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ContentApi } from '@alfresco/js-api'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; +import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; @Component({ standalone: true, diff --git a/lib/content-services/src/lib/directives/node-download.directive.ts b/lib/content-services/src/lib/directives/node-download.directive.ts index 23dc1cd7b6..e083e5d715 100755 --- a/lib/content-services/src/lib/directives/node-download.directive.ts +++ b/lib/content-services/src/lib/directives/node-download.directive.ts @@ -17,9 +17,10 @@ import { Directive, Input, HostListener } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { AlfrescoApiService, DownloadService } from '@alfresco/adf-core'; +import { DownloadService } from '@alfresco/adf-core'; import { DownloadZipDialogComponent } from '../dialogs/download-zip/download-zip.dialog'; import { ContentApi, NodeEntry, VersionEntry } from '@alfresco/js-api'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; /** * Directive selectors without adf- prefix will be deprecated on 3.0.0 diff --git a/lib/content-services/src/lib/directives/node-favorite.directive.spec.ts b/lib/content-services/src/lib/directives/node-favorite.directive.spec.ts index 921448e9b6..ccdf375ff2 100644 --- a/lib/content-services/src/lib/directives/node-favorite.directive.spec.ts +++ b/lib/content-services/src/lib/directives/node-favorite.directive.spec.ts @@ -18,8 +18,10 @@ import { SimpleChange } from '@angular/core'; import { fakeAsync, TestBed, tick } from '@angular/core/testing'; import { NodeFavoriteDirective } from './node-favorite.directive'; -import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core'; +import { AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { AlfrescoApiService } from '../services'; +import { AlfrescoApiServiceMock } from '../mock'; describe('NodeFavoriteDirective', () => { let directive: NodeFavoriteDirective; diff --git a/lib/content-services/src/lib/directives/node-favorite.directive.ts b/lib/content-services/src/lib/directives/node-favorite.directive.ts index 8fad4044e7..daee2149f4 100644 --- a/lib/content-services/src/lib/directives/node-favorite.directive.ts +++ b/lib/content-services/src/lib/directives/node-favorite.directive.ts @@ -21,7 +21,7 @@ import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, Simple import { FavoriteBodyCreate, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi } from '@alfresco/js-api'; import { Observable, from, forkJoin, of } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; @Directive({ standalone: true, diff --git a/lib/content-services/src/lib/directives/node-restore.directive.ts b/lib/content-services/src/lib/directives/node-restore.directive.ts index fec1c82083..25cb0ced3c 100644 --- a/lib/content-services/src/lib/directives/node-restore.directive.ts +++ b/lib/content-services/src/lib/directives/node-restore.directive.ts @@ -21,8 +21,9 @@ import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/c import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging } from '@alfresco/js-api'; import { Observable, forkJoin, from, of } from 'rxjs'; import { tap, mergeMap, map, catchError } from 'rxjs/operators'; -import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; +import { TranslationService } from '@alfresco/adf-core'; import { RestoreMessageModel } from '../interfaces/restore-message-model.interface'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; @Directive({ standalone: true, diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.ts b/lib/content-services/src/lib/document-list/components/document-list.component.ts index c5a43e40d0..c09e9dddb6 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.ts +++ b/lib/content-services/src/lib/document-list/components/document-list.component.ts @@ -19,7 +19,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { - AlfrescoApiService, AppConfigService, ColumnsSelectorComponent, CustomEmptyContentTemplateDirective, @@ -86,6 +85,7 @@ import { FilterHeaderComponent } from './filter-header/filter-header.component'; import { TranslateModule } from '@ngx-translate/core'; import { MatIconModule } from '@angular/material/icon'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; const BYTES_TO_MB_CONVERSION_VALUE = 1048576; diff --git a/lib/content-services/src/lib/document-list/services/custom-resources.service.ts b/lib/content-services/src/lib/document-list/services/custom-resources.service.ts index 61b0281bd8..687a4c57ee 100644 --- a/lib/content-services/src/lib/document-list/services/custom-resources.service.ts +++ b/lib/content-services/src/lib/document-list/services/custom-resources.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, PaginationModel } from '@alfresco/adf-core'; +import { PaginationModel } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { DeletedNodesPaging, SearchRequest, diff --git a/lib/content-services/src/lib/document-list/services/document-list.service.ts b/lib/content-services/src/lib/document-list/services/document-list.service.ts index 929b23f068..ca6ea46f41 100644 --- a/lib/content-services/src/lib/document-list/services/document-list.service.ts +++ b/lib/content-services/src/lib/document-list/services/document-list.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoApiService, PaginationModel } from '@alfresco/adf-core'; +import { PaginationModel } from '@alfresco/adf-core'; import { NodesApiService } from '../../common/services/nodes-api.service'; import { inject, Injectable } from '@angular/core'; import { Node, NodeEntry, NodePaging, NodesApi } from '@alfresco/js-api'; @@ -24,6 +24,7 @@ import { Observable, from, forkJoin, Subject } from 'rxjs'; import { map } from 'rxjs/operators'; import { DocumentListLoader } from '../interfaces/document-list-loader.interface'; import { CustomResourcesService } from './custom-resources.service'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; const ROOT_ID = '-root-'; diff --git a/lib/content-services/src/lib/document-list/services/node-actions.service.ts b/lib/content-services/src/lib/document-list/services/node-actions.service.ts index d1af60ff5d..4e0ceb6b1f 100644 --- a/lib/content-services/src/lib/document-list/services/node-actions.service.ts +++ b/lib/content-services/src/lib/document-list/services/node-actions.service.ts @@ -18,10 +18,11 @@ import { Injectable, Output, EventEmitter } from '@angular/core'; import { Node, NodeEntry } from '@alfresco/js-api'; import { Subject } from 'rxjs'; -import { AlfrescoApiService, DownloadService } from '@alfresco/adf-core'; +import { DownloadService } from '@alfresco/adf-core'; import { MatDialog } from '@angular/material/dialog'; import { ContentService } from '../../common/services/content.service'; import { NodeDownloadDirective } from '../../directives/node-download.directive'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { DocumentListService } from './document-list.service'; import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service'; diff --git a/lib/content-services/src/lib/group/services/group.service.spec.ts b/lib/content-services/src/lib/group/services/group.service.spec.ts index 7a76d003de..70ad7ec1df 100644 --- a/lib/content-services/src/lib/group/services/group.service.spec.ts +++ b/lib/content-services/src/lib/group/services/group.service.spec.ts @@ -17,8 +17,8 @@ import { TestBed } from '@angular/core/testing'; import { ContentTestingModule } from '../../testing/content.testing.module'; -import { GroupService } from '@alfresco/adf-content-services'; import { ContentIncludeQuery, GroupEntry } from '@alfresco/js-api'; +import { GroupService } from './group.service'; describe('GroupService', () => { let service: GroupService; @@ -83,12 +83,16 @@ describe('GroupService', () => { service.updateGroup(group.entry, opts).subscribe((groupEntry) => { expect(groupEntry).toEqual(returnedGroup); - expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(group.entry.id, { - displayName: group.entry.displayName, - description: group.entry.description - }, { - include: ['description'] - }); + expect(service.groupsApi.updateGroup).toHaveBeenCalledWith( + group.entry.id, + { + displayName: group.entry.displayName, + description: group.entry.description + }, + { + include: ['description'] + } + ); done(); }); }); @@ -105,12 +109,16 @@ describe('GroupService', () => { description: '' } }); - expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(group.entry.id, { - displayName: group.entry.displayName, - description: group.entry.description - }, { - include: ['description'] - }); + expect(service.groupsApi.updateGroup).toHaveBeenCalledWith( + group.entry.id, + { + displayName: group.entry.displayName, + description: group.entry.description + }, + { + include: ['description'] + } + ); done(); }); }); @@ -121,12 +129,16 @@ describe('GroupService', () => { service.updateGroup(group.entry, opts).subscribe((groupEntry) => { expect(groupEntry).toEqual(returnedGroup); - expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(group.entry.id, { - displayName: group.entry.displayName, - description: group.entry.description - }, { - include: ['description'] - }); + expect(service.groupsApi.updateGroup).toHaveBeenCalledWith( + group.entry.id, + { + displayName: group.entry.displayName, + description: group.entry.description + }, + { + include: ['description'] + } + ); done(); }); }); diff --git a/lib/content-services/src/lib/group/services/group.service.ts b/lib/content-services/src/lib/group/services/group.service.ts index a59fbf0e03..0cab9e5434 100644 --- a/lib/content-services/src/lib/group/services/group.service.ts +++ b/lib/content-services/src/lib/group/services/group.service.ts @@ -17,7 +17,7 @@ import { Injectable } from '@angular/core'; import { ContentIncludeQuery, Group, GroupEntry, GroupsApi } from '@alfresco/js-api'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { from, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; diff --git a/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts b/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts index 09b729d4ff..9b877a3485 100644 --- a/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts +++ b/lib/content-services/src/lib/legal-hold/services/legal-hold.service.ts @@ -15,7 +15,6 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; import { BulkAssignHoldResponseEntry, ContentPagingQuery, @@ -30,6 +29,7 @@ import { import { Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; import { map } from 'rxjs/operators'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/core/src/lib/mock/alfresco-api.service.mock.ts b/lib/content-services/src/lib/mock/alfresco-api.service.mock.ts similarity index 90% rename from lib/core/src/lib/mock/alfresco-api.service.mock.ts rename to lib/content-services/src/lib/mock/alfresco-api.service.mock.ts index d2f490c027..043dff7295 100644 --- a/lib/core/src/lib/mock/alfresco-api.service.mock.ts +++ b/lib/content-services/src/lib/mock/alfresco-api.service.mock.ts @@ -16,9 +16,8 @@ */ import { Injectable } from '@angular/core'; -import { AppConfigService } from '../app-config/app-config.service'; import { AlfrescoApiService } from '../services/alfresco-api.service'; -import { StorageService } from '../common/services/storage.service'; +import { AppConfigService, StorageService } from '@alfresco/adf-core'; @Injectable() export class AlfrescoApiServiceMock extends AlfrescoApiService { diff --git a/lib/content-services/src/lib/mock/public-api.ts b/lib/content-services/src/lib/mock/public-api.ts index 741402f798..03479ba0e0 100644 --- a/lib/content-services/src/lib/mock/public-api.ts +++ b/lib/content-services/src/lib/mock/public-api.ts @@ -24,3 +24,4 @@ export * from './sites-dropdown.component.mock'; export * from './search-query.mock'; export * from './new-version-uploader.service.mock'; export * from './date-range-search-filter.mock'; +export * from './alfresco-api.service.mock'; diff --git a/lib/content-services/src/lib/mock/search.component.mock.ts b/lib/content-services/src/lib/mock/search.component.mock.ts index c4b2a354d5..fdb2715907 100644 --- a/lib/content-services/src/lib/mock/search.component.mock.ts +++ b/lib/content-services/src/lib/mock/search.component.mock.ts @@ -18,6 +18,8 @@ import { Component, ViewChild } from '@angular/core'; import { SearchComponent } from '../search/components/search.component'; import { SearchRequest, ResultSetPaging, ResultSetRowEntry, ContentInfo, UserInfo, ResultNode } from '@alfresco/js-api'; +import { SearchModule } from '../search'; +import { CommonModule } from '@angular/common'; const entryItem = new ResultSetRowEntry({ entry: new ResultNode({ @@ -103,7 +105,9 @@ export const noResult = { {{ message }} - ` + `, + standalone: true, + imports: [SearchModule, CommonModule] }) export class SimpleSearchTestComponent { @ViewChild('search', { static: true }) diff --git a/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts b/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts index deeb5dc552..f318ca86bc 100644 --- a/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts +++ b/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts @@ -17,7 +17,8 @@ import { Injectable } from '@angular/core'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; + import { NewVersionUploaderDialogComponent } from './new-version-uploader.dialog'; import { VersionsApi } from '@alfresco/js-api'; import { NewVersionUploaderData, NewVersionUploaderDialogData } from './models'; diff --git a/lib/content-services/src/lib/node-comments/services/node-comments.service.spec.ts b/lib/content-services/src/lib/node-comments/services/node-comments.service.spec.ts index 723eab3326..979db2c9de 100644 --- a/lib/content-services/src/lib/node-comments/services/node-comments.service.spec.ts +++ b/lib/content-services/src/lib/node-comments/services/node-comments.service.spec.ts @@ -16,11 +16,13 @@ */ import { TestBed } from '@angular/core/testing'; -import { AlfrescoApiService, AlfrescoApiServiceMock, CommentModel, RedirectAuthService } from '@alfresco/adf-core'; +import { CommentModel, RedirectAuthService } from '@alfresco/adf-core'; import { fakeContentComment, fakeContentComments } from '../mocks/node-comments.mock'; import { NodeCommentsService } from './node-comments.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { EMPTY, of } from 'rxjs'; +import { AlfrescoApiService } from '../../services'; +import { AlfrescoApiServiceMock } from '../../mock'; declare let jasmine: any; diff --git a/lib/content-services/src/lib/node-comments/services/node-comments.service.ts b/lib/content-services/src/lib/node-comments/services/node-comments.service.ts index 3c2c6ac5df..f2c7ea956f 100644 --- a/lib/content-services/src/lib/node-comments/services/node-comments.service.ts +++ b/lib/content-services/src/lib/node-comments/services/node-comments.service.ts @@ -15,12 +15,13 @@ * limitations under the License. */ -import { AlfrescoApiService, CommentModel, CommentsService, User } from '@alfresco/adf-core'; +import { CommentModel, CommentsService, User } from '@alfresco/adf-core'; import { CommentEntry, CommentsApi, Comment } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; import { map } from 'rxjs/operators'; import { ContentService } from '../../common/services/content.service'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/permission-manager/components/pop-over.directive.spec.ts b/lib/content-services/src/lib/permission-manager/components/pop-over.directive.spec.ts index 4518981b5b..461ac54d95 100644 --- a/lib/content-services/src/lib/permission-manager/components/pop-over.directive.spec.ts +++ b/lib/content-services/src/lib/permission-manager/components/pop-over.directive.spec.ts @@ -17,9 +17,9 @@ import { Component } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { PopOverDirective } from '@alfresco/adf-content-services'; import { By } from '@angular/platform-browser'; import { OverlayModule } from '@angular/cdk/overlay'; +import { PopOverDirective } from './pop-over.directive'; @Component({ standalone: true, diff --git a/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts b/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts index 7cb3046ba6..4cf316bfa1 100644 --- a/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts +++ b/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; +import { TranslationService } from '@alfresco/adf-core'; import { NodesApiService } from '../../common/services/nodes-api.service'; import { EcmUserModel } from '../../common/models/ecm-user.model'; import { Group, GroupMemberPaging, GroupsApi, Node, PathElement, PermissionElement, SearchRequest } from '@alfresco/js-api'; diff --git a/lib/content-services/src/lib/prediction/services/prediction.service.ts b/lib/content-services/src/lib/prediction/services/prediction.service.ts index 020749f819..e0011d78b2 100644 --- a/lib/content-services/src/lib/prediction/services/prediction.service.ts +++ b/lib/content-services/src/lib/prediction/services/prediction.service.ts @@ -16,9 +16,9 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService } from '@alfresco/adf-core'; import { PredictionsApi, PredictionPaging, ReviewStatus } from '@alfresco/js-api'; import { from, Observable } from 'rxjs'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' }) export class PredictionService { diff --git a/lib/content-services/src/lib/search/components/search-filter-autocomplete-chips/search-filter-autocomplete-chips.component.spec.ts b/lib/content-services/src/lib/search/components/search-filter-autocomplete-chips/search-filter-autocomplete-chips.component.spec.ts index 55f96bc514..37e56cbf14 100644 --- a/lib/content-services/src/lib/search/components/search-filter-autocomplete-chips/search-filter-autocomplete-chips.component.spec.ts +++ b/lib/content-services/src/lib/search/components/search-filter-autocomplete-chips/search-filter-autocomplete-chips.component.spec.ts @@ -19,9 +19,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { ContentTestingModule } from '../../../testing/content.testing.module'; import { SearchFilterAutocompleteChipsComponent } from './search-filter-autocomplete-chips.component'; -import { TagService } from '@alfresco/adf-content-services'; import { EMPTY, of } from 'rxjs'; import { AutocompleteField } from '../../models/autocomplete-option.interface'; +import { TagService } from '../../../tag/services/tag.service'; describe('SearchFilterAutocompleteChipsComponent', () => { let component: SearchFilterAutocompleteChipsComponent; diff --git a/lib/content-services/src/lib/search/components/search-properties/search-properties.component.spec.ts b/lib/content-services/src/lib/search/components/search-properties/search-properties.component.spec.ts index c128f178da..8e7b5fa416 100644 --- a/lib/content-services/src/lib/search/components/search-properties/search-properties.component.spec.ts +++ b/lib/content-services/src/lib/search/components/search-properties/search-properties.component.spec.ts @@ -20,10 +20,11 @@ import { SearchPropertiesComponent } from './search-properties.component'; import { ContentTestingModule } from '../../../testing/content.testing.module'; import { By } from '@angular/platform-browser'; import { MatOption } from '@angular/material/core'; -import { SearchChipAutocompleteInputComponent, SearchQueryBuilderService } from '@alfresco/adf-content-services'; import { FileSizeUnit } from './file-size-unit.enum'; import { FileSizeOperator } from './file-size-operator.enum'; import { SearchProperties } from './search-properties'; +import { SearchChipAutocompleteInputComponent } from '../search-chip-autocomplete-input'; +import { SearchQueryBuilderService } from '../../services/search-query-builder.service'; describe('SearchPropertiesComponent', () => { let component: SearchPropertiesComponent; diff --git a/lib/content-services/src/lib/search/components/search-sorting-picker/search-sorting-picker.component.spec.ts b/lib/content-services/src/lib/search/components/search-sorting-picker/search-sorting-picker.component.spec.ts index ccd71a827a..3e53f167c2 100644 --- a/lib/content-services/src/lib/search/components/search-sorting-picker/search-sorting-picker.component.spec.ts +++ b/lib/content-services/src/lib/search/components/search-sorting-picker/search-sorting-picker.component.spec.ts @@ -17,10 +17,11 @@ import { SearchSortingPickerComponent } from './search-sorting-picker.component'; import { SearchQueryBuilderService } from '../../services/search-query-builder.service'; -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { AppConfigService } from '@alfresco/adf-core'; import { SearchConfiguration } from '../../models/search-configuration.interface'; import { TestBed } from '@angular/core/testing'; import { ContentTestingModule } from '../../../testing/content.testing.module'; +import { AlfrescoApiService } from '../../../services/alfresco-api.service'; describe('SearchSortingPickerComponent', () => { let queryBuilder: SearchQueryBuilderService; diff --git a/lib/content-services/src/lib/search/components/search.component.spec.ts b/lib/content-services/src/lib/search/components/search.component.spec.ts index 8e8a3e3afd..bd3d9f4fc5 100644 --- a/lib/content-services/src/lib/search/components/search.component.spec.ts +++ b/lib/content-services/src/lib/search/components/search.component.spec.ts @@ -29,8 +29,7 @@ describe('SearchComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ContentTestingModule], - declarations: [SimpleSearchTestComponent] + imports: [ContentTestingModule, SimpleSearchTestComponent] }); fixture = TestBed.createComponent(SimpleSearchTestComponent); component = fixture.componentInstance; diff --git a/lib/content-services/src/lib/search/services/base-query-builder.service.ts b/lib/content-services/src/lib/search/services/base-query-builder.service.ts index ab3773780e..eb5eb72c5b 100644 --- a/lib/content-services/src/lib/search/services/base-query-builder.service.ts +++ b/lib/content-services/src/lib/search/services/base-query-builder.service.ts @@ -16,7 +16,7 @@ */ import { Subject, Observable, from, ReplaySubject } from 'rxjs'; -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { AppConfigService } from '@alfresco/adf-core'; import { SearchRequest, RequestFacetFields, @@ -36,6 +36,7 @@ import { SearchSortingDefinition } from '../models/search-sorting-definition.int import { FacetField } from '../models/facet-field.interface'; import { FacetFieldBucket } from '../models/facet-field-bucket.interface'; import { SearchForm } from '../models/search-form.interface'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; export abstract class BaseQueryBuilderService { private _searchApi: SearchApi; diff --git a/lib/content-services/src/lib/search/services/search-facet-filters.service.spec.ts b/lib/content-services/src/lib/search/services/search-facet-filters.service.spec.ts index 1ed7240433..f9174eb0cc 100644 --- a/lib/content-services/src/lib/search/services/search-facet-filters.service.spec.ts +++ b/lib/content-services/src/lib/search/services/search-facet-filters.service.spec.ts @@ -20,8 +20,9 @@ import { TestBed } from '@angular/core/testing'; import { SearchFacetFiltersService } from './search-facet-filters.service'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { SearchQueryBuilderService } from './search-query-builder.service'; -import { CategoryService, FacetBucketSortBy, FacetBucketSortDirection } from '@alfresco/adf-content-services'; import { EMPTY, of } from 'rxjs'; +import { CategoryService } from '../../category/services/category.service'; +import { FacetBucketSortBy, FacetBucketSortDirection } from '../models/facet-field.interface'; describe('SearchFacetFiltersService', () => { let searchFacetFiltersService: SearchFacetFiltersService; @@ -31,12 +32,14 @@ describe('SearchFacetFiltersService', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ContentTestingModule], - providers: [{ - provide: CategoryService, - useValue: { - getCategory: () => EMPTY + providers: [ + { + provide: CategoryService, + useValue: { + getCategory: () => EMPTY + } } - }] + ] }); categoryService = TestBed.inject(CategoryService); @@ -67,17 +70,19 @@ describe('SearchFacetFiltersService', () => { }; const queries = [ - { label: 'q1', filterQuery: 'query1', metrics: [{value: {count: 1}}] }, - { label: 'q2', filterQuery: 'query2', metrics: [{value: {count: 1}}] } + { label: 'q1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] }, + { label: 'q2', filterQuery: 'query2', metrics: [{ value: { count: 1 } }] } ]; const data = { list: { context: { - facets: [{ - type: 'query', - label: 'label1', - buckets: queries - }] + facets: [ + { + type: 'query', + label: 'label1', + buckets: queries + } + ] } } }; @@ -104,19 +109,20 @@ describe('SearchFacetFiltersService', () => { }; const queries = [ - { label: 'q2', filterQuery: 'query2', metrics: [{value: {count: 1}}] }, - { label: 'q1', filterQuery: 'query1', metrics: [{value: {count: 1}}] }, - { label: 'q3', filterQuery: 'query3', metrics: [{value: {count: 1}}] } - + { label: 'q2', filterQuery: 'query2', metrics: [{ value: { count: 1 } }] }, + { label: 'q1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] }, + { label: 'q3', filterQuery: 'query3', metrics: [{ value: { count: 1 } }] } ]; const data = { list: { context: { - facets: [{ - type: 'query', - label: 'label1', - buckets: queries - }] + facets: [ + { + type: 'query', + label: 'label1', + buckets: queries + } + ] } } }; @@ -158,10 +164,12 @@ describe('SearchFacetFiltersService', () => { queryBuilder.config = { categories: [], - facetFields: { fields: [ + facetFields: { + fields: [ { label: 'f1', field: 'f1', mincount: 0 }, { label: 'f2', field: 'f2', mincount: 0 } - ]}, + ] + }, facetQueries: { queries: [] } @@ -189,9 +197,7 @@ describe('SearchFacetFiltersService', () => { it('should filter response facet fields based on search filter config method', () => { queryBuilder.config = { categories: [], - facetFields: { fields: [ - { label: 'f1', field: 'f1' } - ]}, + facetFields: { fields: [{ label: 'f1', field: 'f1' }] }, facetQueries: { queries: [] }, @@ -199,10 +205,13 @@ describe('SearchFacetFiltersService', () => { }; const initialFields: any = [ - { type: 'field', label: 'f1', buckets: [ - { label: 'firstLabel', display: 'firstLabel', metrics: [{value: {count: 5}}] }, - { label: 'secondLabel', display: 'secondLabel', metrics: [{value: {count: 5}}] }, - { label: 'thirdLabel', display: 'thirdLabel', metrics: [{value: {count: 5}}] } + { + type: 'field', + label: 'f1', + buckets: [ + { label: 'firstLabel', display: 'firstLabel', metrics: [{ value: { count: 5 } }] }, + { label: 'secondLabel', display: 'secondLabel', metrics: [{ value: { count: 5 } }] }, + { label: 'thirdLabel', display: 'thirdLabel', metrics: [{ value: { count: 5 } }] } ] } ]; @@ -239,10 +248,12 @@ describe('SearchFacetFiltersService', () => { queryBuilder.config = { categories: [], - facetFields: { fields: [ + facetFields: { + fields: [ { label: 'f1', field: 'f1' }, { label: 'f2', field: 'f2' } - ]}, + ] + }, facetQueries: { queries: [] } @@ -253,8 +264,8 @@ describe('SearchFacetFiltersService', () => { type: 'field', label: 'f1', buckets: [ - { label: 'b1', metrics: [{value: {count: 10}}] }, - { label: 'b2', metrics: [{value: {count: 1}}] } + { label: 'b1', metrics: [{ value: { count: 10 } }] }, + { label: 'b2', metrics: [{ value: { count: 1 } }] } ] }, { type: 'field', label: 'f2', buckets: [] } @@ -276,17 +287,28 @@ describe('SearchFacetFiltersService', () => { it('should fetch facet fields from response payload and update the existing bucket values', () => { queryBuilder.config = { categories: [], - facetFields: { fields: [ + facetFields: { + fields: [ { label: 'f1', field: 'f1' }, { label: 'f2', field: 'f2' } - ]}, + ] + }, facetQueries: { queries: [] } }; const initialFields: any = [ - { type: 'field', label: 'f1', buckets: { items: [{ label: 'b1', count: 10, filterQuery: 'filter' }, { label: 'b2', count: 1 }]} }, + { + type: 'field', + label: 'f1', + buckets: { + items: [ + { label: 'b1', count: 10, filterQuery: 'filter' }, + { label: 'b2', count: 1 } + ] + } + }, { type: 'field', label: 'f2', buckets: [] } ]; searchFacetFiltersService.responseFacets = initialFields; @@ -294,9 +316,14 @@ describe('SearchFacetFiltersService', () => { expect(searchFacetFiltersService.responseFacets[0].buckets.items[1].count).toEqual(1); const serverResponseFields: any = [ - { type: 'field', label: 'f1', buckets: - [{ label: 'b1', metrics: [{value: {count: 6}}], filterQuery: 'filter' }, - { label: 'b2', metrics: [{value: {count: 0}}] }] }, + { + type: 'field', + label: 'f1', + buckets: [ + { label: 'b1', metrics: [{ value: { count: 6 } }], filterQuery: 'filter' }, + { label: 'b2', metrics: [{ value: { count: 0 } }] } + ] + }, { type: 'field', label: 'f2', buckets: [] } ]; const data = { @@ -321,21 +348,25 @@ describe('SearchFacetFiltersService', () => { facetQueries: { queries: [] } }; - const firstCallFields: any = [{ - type: 'field', - label: 'f1', - buckets: [{ label: 'b1', metrics: [{value: {count: 10}}] }] - }]; - const firstCallData = { list: { context: { facets: firstCallFields }}}; + const firstCallFields: any = [ + { + type: 'field', + label: 'f1', + buckets: [{ label: 'b1', metrics: [{ value: { count: 10 } }] }] + } + ]; + const firstCallData = { list: { context: { facets: firstCallFields } } }; searchFacetFiltersService.onDataLoaded(firstCallData); expect(searchFacetFiltersService.responseFacets[0].buckets.items[0].count).toEqual(10); - const secondCallFields: any = [{ - type: 'field', - label: 'f1', - buckets: [{ label: 'b1', metrics: [{value: {count: 6}}] }] - }]; - const secondCallData = { list: { context: { facets: secondCallFields}}}; + const secondCallFields: any = [ + { + type: 'field', + label: 'f1', + buckets: [{ label: 'b1', metrics: [{ value: { count: 6 } }] }] + } + ]; + const secondCallData = { list: { context: { facets: secondCallFields } } }; searchFacetFiltersService.onDataLoaded(secondCallData); expect(searchFacetFiltersService.responseFacets[0].buckets.items[0].count).toEqual(6); }); @@ -346,25 +377,33 @@ describe('SearchFacetFiltersService', () => { categories: [], facetIntervals: { intervals: [ - { label: 'test_intervals1', field: 'f1', sets: [ - { label: 'interval1', start: 's1', end: 'e1'}, - { label: 'interval2', start: 's2', end: 'e2'} - ]}, - { label: 'test_intervals2', field: 'f2', sets: [ - { label: 'interval3', start: 's3', end: 'e3'}, - { label: 'interval4', start: 's4', end: 'e4'} - ]} + { + label: 'test_intervals1', + field: 'f1', + sets: [ + { label: 'interval1', start: 's1', end: 'e1' }, + { label: 'interval2', start: 's2', end: 'e2' } + ] + }, + { + label: 'test_intervals2', + field: 'f2', + sets: [ + { label: 'interval3', start: 's3', end: 'e3' }, + { label: 'interval4', start: 's4', end: 'e4' } + ] + } ] } }; const response1 = [ - { label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 }}]}, - { label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 }}]} + { label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] }, + { label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 } }] } ]; const response2 = [ - { label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 }}]}, - { label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 }}]} + { label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 } }] }, + { label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 } }] } ]; const data = { list: { @@ -390,25 +429,35 @@ describe('SearchFacetFiltersService', () => { categories: [], facetIntervals: { intervals: [ - { label: 'test_intervals1', field: 'f1', mincount: 2, sets: [ - { label: 'interval1', start: 's1', end: 'e1'}, - { label: 'interval2', start: 's2', end: 'e2'} - ]}, - { label: 'test_intervals2', field: 'f2', mincount: 5, sets: [ - { label: 'interval3', start: 's3', end: 'e3'}, - { label: 'interval4', start: 's4', end: 'e4'} - ]} + { + label: 'test_intervals1', + field: 'f1', + mincount: 2, + sets: [ + { label: 'interval1', start: 's1', end: 'e1' }, + { label: 'interval2', start: 's2', end: 'e2' } + ] + }, + { + label: 'test_intervals2', + field: 'f2', + mincount: 5, + sets: [ + { label: 'interval3', start: 's3', end: 'e3' }, + { label: 'interval4', start: 's4', end: 'e4' } + ] + } ] } }; const response1 = [ - { label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 }}]}, - { label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 }}]} + { label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] }, + { label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 } }] } ]; const response2 = [ - { label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 }}]}, - { label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 }}]} + { label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 } }] }, + { label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 } }] } ]; const data = { list: { @@ -443,14 +492,14 @@ describe('SearchFacetFiltersService', () => { }, facetFields: { fields: [ - { field: 'field1', label: 'Field 1', settings: { facetOrder: 200 }}, - { field: 'field2', label: 'Field 2', settings: { facetOrder: 400 }}, - { field: 'field3', label: 'Field 3', settings: { facetOrder: 500 }}, - { field: 'field4', label: 'Field 4', settings: { facetOrder: 100 }} + { field: 'field1', label: 'Field 1', settings: { facetOrder: 200 } }, + { field: 'field2', label: 'Field 2', settings: { facetOrder: 400 } }, + { field: 'field3', label: 'Field 3', settings: { facetOrder: 500 } }, + { field: 'field4', label: 'Field 4', settings: { facetOrder: 100 } } ] } }; - const queryBucketsMock = [{ label: 'q1', filterQuery: 'query1', metrics: [{value: {count: 1} }] }]; + const queryBucketsMock = [{ label: 'q1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] }]; const fieldBucketsMock = [{ label: 'b1', metrics: [{ value: { count: 10 } }] }]; const data = { list: { @@ -467,20 +516,20 @@ describe('SearchFacetFiltersService', () => { }; searchFacetFiltersService.onDataLoaded(data); - expect(searchFacetFiltersService.responseFacets.map(f => f.field)).toEqual(['field4', 'field1', 'Query 1', 'field2', 'field3']); + expect(searchFacetFiltersService.responseFacets.map((f) => f.field)).toEqual(['field4', 'field1', 'Query 1', 'field2', 'field3']); }); it('should load category names for cm:categories facet', () => { - const entry = {id: 'test-id-test', name: 'name', path: '/categories/General/Test Category/Subcategory'}; + const entry = { id: 'test-id-test', name: 'name', path: '/categories/General/Test Category/Subcategory' }; searchFacetFiltersService.responseFacets = null; - spyOn(categoryService, 'getCategory').and.returnValue(of({entry})); + spyOn(categoryService, 'getCategory').and.returnValue(of({ entry })); queryBuilder.config = { categories: [], facetFields: { fields: [ - {label: 'f1', field: 'f1', mincount: 0}, - {label: 'categories', field: 'cm:categories', mincount: 0} + { label: 'f1', field: 'f1', mincount: 0 }, + { label: 'categories', field: 'cm:categories', mincount: 0 } ] }, facetQueries: { @@ -489,12 +538,16 @@ describe('SearchFacetFiltersService', () => { }; const fields: any = [ - {type: 'field', label: 'f1', buckets: [{label: 'a1'}, {label: 'a2'}]}, + { type: 'field', label: 'f1', buckets: [{ label: 'a1' }, { label: 'a2' }] }, { - type: 'field', label: 'categories', buckets: [{ - label: `workspace://SpacesStore/${entry.id}`, - filterQuery: `cm:categories:"workspace://SpacesStore/${entry.id}"` - }] + type: 'field', + label: 'categories', + buckets: [ + { + label: `workspace://SpacesStore/${entry.id}`, + filterQuery: `cm:categories:"workspace://SpacesStore/${entry.id}"` + } + ] } ]; const data = { @@ -507,7 +560,7 @@ describe('SearchFacetFiltersService', () => { searchFacetFiltersService.onDataLoaded(data); - expect(categoryService.getCategory).toHaveBeenCalledWith(entry.id, { include: [ 'path' ]}); + expect(categoryService.getCategory).toHaveBeenCalledWith(entry.id, { include: ['path'] }); expect(searchFacetFiltersService.responseFacets[1].buckets.items[0].display).toBe(`Test Category/Subcategory/${entry.name}`); expect(searchFacetFiltersService.responseFacets[1].buckets.length).toEqual(1); expect(searchFacetFiltersService.responseFacets.length).toEqual(2); @@ -517,10 +570,12 @@ describe('SearchFacetFiltersService', () => { searchFacetFiltersService.responseFacets = null; queryBuilder.config = { categories: [], - facetFields: { fields: [ + facetFields: { + fields: [ { label: 'creator', field: 'creator' }, { label: 'modifier', field: 'modifier' } - ]}, + ] + }, facetQueries: { queries: [] } @@ -531,16 +586,16 @@ describe('SearchFacetFiltersService', () => { type: 'field', label: 'creator', buckets: [ - { label: 'b1', metrics: [{value: {count: 10}}] }, - { label: 'b2', metrics: [{value: {count: 1}}] } + { label: 'b1', metrics: [{ value: { count: 10 } }] }, + { label: 'b2', metrics: [{ value: { count: 1 } }] } ] }, { type: 'field', label: 'modifier', buckets: [ - { label: 'c1', metrics: [{value: {count: 10}}] }, - { label: 'c2', metrics: [{value: {count: 1}}] } + { label: 'c1', metrics: [{ value: { count: 10 } }] }, + { label: 'c2', metrics: [{ value: { count: 1 } }] } ] } ]; @@ -594,13 +649,17 @@ describe('SearchFacetFiltersService', () => { facetQueries: { queries: [] }, facetFields: { fields: [ - { field: 'field', label: 'Field', settings: { bucketSortBy: FacetBucketSortBy.LABEL, bucketSortDirection: FacetBucketSortDirection.DESCENDING }} + { + field: 'field', + label: 'Field', + settings: { bucketSortBy: FacetBucketSortBy.LABEL, bucketSortDirection: FacetBucketSortDirection.DESCENDING } + } ] } }; searchFacetFiltersService.onDataLoaded(data); - expect(searchFacetFiltersService.responseFacets[0].buckets.items.map(b => b.label)).toEqual(['xyzzy', 'qux', 'foo', 'baz', 'bar']); + expect(searchFacetFiltersService.responseFacets[0].buckets.items.map((b) => b.label)).toEqual(['xyzzy', 'qux', 'foo', 'baz', 'bar']); }); it('should sort the buckets by count', () => { @@ -609,13 +668,17 @@ describe('SearchFacetFiltersService', () => { facetQueries: { queries: [] }, facetFields: { fields: [ - { field: 'field', label: 'Field', settings: { bucketSortBy: FacetBucketSortBy.COUNT, bucketSortDirection: FacetBucketSortDirection.ASCENDING }} + { + field: 'field', + label: 'Field', + settings: { bucketSortBy: FacetBucketSortBy.COUNT, bucketSortDirection: FacetBucketSortDirection.ASCENDING } + } ] } }; searchFacetFiltersService.onDataLoaded(data); - expect(searchFacetFiltersService.responseFacets[0].buckets.items.map(b => b.label)).toEqual(['baz', 'foo', 'xyzzy', 'qux', 'bar']); + expect(searchFacetFiltersService.responseFacets[0].buckets.items.map((b) => b.label)).toEqual(['baz', 'foo', 'xyzzy', 'qux', 'bar']); }); }); }); diff --git a/lib/content-services/src/lib/search/services/search-header-query-builder.service.spec.ts b/lib/content-services/src/lib/search/services/search-header-query-builder.service.spec.ts index bb6d996dfe..bbc6622f9d 100644 --- a/lib/content-services/src/lib/search/services/search-header-query-builder.service.spec.ts +++ b/lib/content-services/src/lib/search/services/search-header-query-builder.service.spec.ts @@ -16,10 +16,11 @@ */ import { SearchConfiguration } from '../models/search-configuration.interface'; -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { AppConfigService } from '@alfresco/adf-core'; import { SearchHeaderQueryBuilderService } from './search-header-query-builder.service'; import { TestBed } from '@angular/core/testing'; import { ContentTestingModule } from '../../testing/content.testing.module'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; describe('SearchHeaderQueryBuilderService', () => { diff --git a/lib/content-services/src/lib/search/services/search-header-query-builder.service.ts b/lib/content-services/src/lib/search/services/search-header-query-builder.service.ts index 550c78c760..6bb681ef7f 100644 --- a/lib/content-services/src/lib/search/services/search-header-query-builder.service.ts +++ b/lib/content-services/src/lib/search/services/search-header-query-builder.service.ts @@ -16,7 +16,7 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService, DataSorting } from '@alfresco/adf-core'; +import { AppConfigService, DataSorting } from '@alfresco/adf-core'; import { SearchConfiguration } from '../models/search-configuration.interface'; import { BaseQueryBuilderService } from './base-query-builder.service'; import { SearchCategory } from '../models/search-category.interface'; @@ -26,6 +26,7 @@ import { Observable } from 'rxjs'; import { SearchSortingDefinition } from '../models/search-sorting-definition.interface'; import { FilterSearch } from '../models/filter-search.interface'; import { NodesApiService } from '../../common/services/nodes-api.service'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/search/services/search-query-builder.service.spec.ts b/lib/content-services/src/lib/search/services/search-query-builder.service.spec.ts index ff544b9866..d8a8027ab0 100644 --- a/lib/content-services/src/lib/search/services/search-query-builder.service.spec.ts +++ b/lib/content-services/src/lib/search/services/search-query-builder.service.spec.ts @@ -17,7 +17,8 @@ import { SearchQueryBuilderService } from './search-query-builder.service'; import { SearchConfiguration } from '../models/search-configuration.interface'; -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { AppConfigService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { FacetField } from '../models/facet-field.interface'; import { TestBed } from '@angular/core/testing'; import { ContentTestingModule } from '../../testing/content.testing.module'; diff --git a/lib/content-services/src/lib/search/services/search-query-builder.service.ts b/lib/content-services/src/lib/search/services/search-query-builder.service.ts index 4f1dfd9407..38566542a7 100644 --- a/lib/content-services/src/lib/search/services/search-query-builder.service.ts +++ b/lib/content-services/src/lib/search/services/search-query-builder.service.ts @@ -16,10 +16,11 @@ */ import { Inject, Injectable, Optional } from '@angular/core'; -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { AppConfigService } from '@alfresco/adf-core'; import { SearchConfiguration } from '../models/search-configuration.interface'; import { BaseQueryBuilderService } from './base-query-builder.service'; import { ADF_SEARCH_CONFIGURATION } from '../search-configuration.token'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; @Injectable({ providedIn: 'root' }) export class SearchQueryBuilderService extends BaseQueryBuilderService { diff --git a/lib/content-services/src/lib/search/services/search.service.ts b/lib/content-services/src/lib/search/services/search.service.ts index 98bf6a001f..bef7eb0faa 100644 --- a/lib/content-services/src/lib/search/services/search.service.ts +++ b/lib/content-services/src/lib/search/services/search.service.ts @@ -18,7 +18,7 @@ import { inject, Injectable } from '@angular/core'; import { NodePaging, QueriesApi, SearchRequest, ResultSetPaging, SearchApi } from '@alfresco/js-api'; import { Observable, Subject, from } from 'rxjs'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { SearchConfigurationService } from './search-configuration.service'; @Injectable({ diff --git a/lib/content-services/src/lib/security/services/security-controls-groups-marks-security.service.ts b/lib/content-services/src/lib/security/services/security-controls-groups-marks-security.service.ts index 03f92b2231..deaf4d6419 100644 --- a/lib/content-services/src/lib/security/services/security-controls-groups-marks-security.service.ts +++ b/lib/content-services/src/lib/security/services/security-controls-groups-marks-security.service.ts @@ -32,8 +32,9 @@ import { NodeSecurityMarkBody, GsGroupInclude } from '@alfresco/js-api'; -import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core'; +import { UserPreferencesService } from '@alfresco/adf-core'; import { finalize } from 'rxjs/operators'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; const DEFAULT_SKIP_COUNT = 0; const DEFAULT_INCLUDE = 'inUse'; diff --git a/lib/core/src/lib/services/alfresco-api.interface.ts b/lib/content-services/src/lib/services/alfresco-api.interface.ts similarity index 100% rename from lib/core/src/lib/services/alfresco-api.interface.ts rename to lib/content-services/src/lib/services/alfresco-api.interface.ts diff --git a/lib/core/src/lib/services/alfresco-api.service.ts b/lib/content-services/src/lib/services/alfresco-api.service.ts similarity index 91% rename from lib/core/src/lib/services/alfresco-api.service.ts rename to lib/content-services/src/lib/services/alfresco-api.service.ts index a796b61ad2..9909a3a571 100644 --- a/lib/core/src/lib/services/alfresco-api.service.ts +++ b/lib/content-services/src/lib/services/alfresco-api.service.ts @@ -17,12 +17,9 @@ import { Inject, Injectable, InjectionToken, Optional } from '@angular/core'; import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api'; -import { AppConfigService, AppConfigValues } from '../app-config/app-config.service'; import { ReplaySubject } from 'rxjs'; -import { OauthConfigModel } from '../auth/models/oauth-config.model'; -import { StorageService } from '../common/services/storage.service'; -import { OpenidConfiguration } from '../auth/interfaces/openid-configuration.interface'; import { AlfrescoApiFactory } from './alfresco-api.interface'; +import { AppConfigService, AppConfigValues, OauthConfigModel, OpenidConfiguration, StorageService } from '@alfresco/adf-core'; export const ALFRESCO_API_FACTORY = new InjectionToken('ALFRESCO_API_FACTORY'); @@ -30,7 +27,6 @@ export const ALFRESCO_API_FACTORY = new InjectionToken('ALFRESCO_API_FACTORY'); providedIn: 'root' }) export class AlfrescoApiService { - alfrescoApiInitialized: ReplaySubject = new ReplaySubject(1); protected alfrescoApi: AlfrescoApi; @@ -50,14 +46,15 @@ export class AlfrescoApiService { protected appConfig: AppConfigService, protected storageService: StorageService, @Optional() - @Inject(ALFRESCO_API_FACTORY) private alfrescoApiFactory?: AlfrescoApiFactory + @Inject(ALFRESCO_API_FACTORY) + private alfrescoApiFactory?: AlfrescoApiFactory ) {} async load(config: AlfrescoApiConfig): Promise { this.currentAppConfig = config; if (config.authType === 'OAUTH') { - await this.mapAlfrescoApiOpenIdConfig(); + await this.mapAlfrescoApiOpenIdConfig(); } this.initAlfrescoApiWithConfig(); diff --git a/lib/content-services/src/lib/services/index.ts b/lib/content-services/src/lib/services/index.ts new file mode 100644 index 0000000000..54beb1a252 --- /dev/null +++ b/lib/content-services/src/lib/services/index.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './public-api'; diff --git a/lib/core/src/lib/services/public-api.ts b/lib/content-services/src/lib/services/public-api.ts similarity index 100% rename from lib/core/src/lib/services/public-api.ts rename to lib/content-services/src/lib/services/public-api.ts diff --git a/lib/content-services/src/lib/tag/services/tag.service.ts b/lib/content-services/src/lib/tag/services/tag.service.ts index 1584ea83ce..7216dc9cf3 100644 --- a/lib/content-services/src/lib/tag/services/tag.service.ts +++ b/lib/content-services/src/lib/tag/services/tag.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, AppConfigService, UserPreferencesService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; +import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core'; import { EventEmitter, Injectable, Output } from '@angular/core'; import { from, Observable } from 'rxjs'; import { map, tap } from 'rxjs/operators'; diff --git a/lib/content-services/src/lib/testing/content.testing.module.ts b/lib/content-services/src/lib/testing/content.testing.module.ts index 55d91801a2..87a0c2bd01 100644 --- a/lib/content-services/src/lib/testing/content.testing.module.ts +++ b/lib/content-services/src/lib/testing/content.testing.module.ts @@ -20,10 +20,8 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule, - AlfrescoApiService, AppConfigService, CookieService, - AlfrescoApiServiceMock, AppConfigServiceMock, CookieServiceMock, AuthModule, @@ -31,8 +29,10 @@ import { } from '@alfresco/adf-core'; import { ContentModule } from '../content.module'; import { versionCompatibilityFactory } from '../version-compatibility/version-compatibility-factory'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; import { VersionCompatibilityService } from '../version-compatibility/version-compatibility.service'; import { MatIconTestingModule } from '@angular/material/icon/testing'; +import { AlfrescoApiServiceMock } from '../mock'; @NgModule({ imports: [ diff --git a/lib/content-services/src/lib/version-manager/content-version.service.ts b/lib/content-services/src/lib/version-manager/content-version.service.ts index 11f58e1636..72ae319999 100644 --- a/lib/content-services/src/lib/version-manager/content-version.service.ts +++ b/lib/content-services/src/lib/version-manager/content-version.service.ts @@ -16,7 +16,7 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; import { ContentApi } from '@alfresco/js-api'; import { Observable, of } from 'rxjs'; diff --git a/lib/content-services/src/lib/version-manager/version-list.component.ts b/lib/content-services/src/lib/version-manager/version-list.component.ts index 3801dd6223..70cef49558 100644 --- a/lib/content-services/src/lib/version-manager/version-list.component.ts +++ b/lib/content-services/src/lib/version-manager/version-list.component.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, ConfirmDialogComponent } from '@alfresco/adf-core'; +import { ConfirmDialogComponent } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; import { Component, Input, OnChanges, ViewEncapsulation, EventEmitter, Output, OnInit, OnDestroy, ViewChild } from '@angular/core'; import { VersionsApi, Node, VersionEntry, NodesApi, NodeEntry, ContentApi, ContentPagingQuery } from '@alfresco/js-api'; import { MatDialog } from '@angular/material/dialog'; diff --git a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts index ed25b8232b..1979e3f401 100644 --- a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts +++ b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts @@ -23,8 +23,6 @@ import { AppExtensionService, ViewerExtensionRef } from '@alfresco/adf-extension import { ContentInfo, Node, NodeEntry, VersionEntry } from '@alfresco/js-api'; import { AlfrescoViewerComponent, ContentService, NodeActionsService, RenditionService } from '@alfresco/adf-content-services'; import { - AlfrescoApiService, - AlfrescoApiServiceMock, AuthModule, CloseButtonPosition, EventMock, @@ -41,6 +39,8 @@ import { throwError } from 'rxjs'; import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ESCAPE } from '@angular/cdk/keycodes'; import { By } from '@angular/platform-browser'; +import { AlfrescoApiService } from '../../services'; +import { AlfrescoApiServiceMock } from '../../mock'; @Component({ selector: 'adf-viewer-container-toolbar', diff --git a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts index 9973e91e4c..e7abd42814 100644 --- a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts +++ b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts @@ -30,7 +30,6 @@ import { ViewEncapsulation } from '@angular/core'; import { - AlfrescoApiService, CloseButtonPosition, Track, ViewerComponent, @@ -42,6 +41,7 @@ import { ViewerToolbarComponent, ViewUtilService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { Subject } from 'rxjs'; import { ContentApi, Node, NodeEntry, NodesApi, RenditionEntry, SharedlinksApi, Version, VersionEntry, VersionsApi } from '@alfresco/js-api'; import { RenditionService } from '../../common/services/rendition.service'; diff --git a/lib/content-services/src/public-api.ts b/lib/content-services/src/public-api.ts index 70d749aeef..79e0afd2d3 100644 --- a/lib/content-services/src/public-api.ts +++ b/lib/content-services/src/public-api.ts @@ -42,9 +42,13 @@ export * from './lib/tree/index'; export * from './lib/category/index'; export * from './lib/viewer/index'; export * from './lib/security/index'; +export * from './lib/api-factories'; +export * from './lib/services/index'; export * from './lib/infinite-scroll-datasource'; export * from './lib/prediction/index'; export * from './lib/legal-hold/index'; +export * from './lib/api-factories'; +export * from './lib/mock/alfresco-api.service.mock'; export * from './lib/content.module'; export * from './lib/material.module'; diff --git a/lib/core/index.ts b/lib/core/index.ts index e357b2379e..2cef37aee2 100644 --- a/lib/core/index.ts +++ b/lib/core/index.ts @@ -16,3 +16,4 @@ */ export * from './src/public-api'; +export * from './api/src/index'; diff --git a/lib/core/package.json b/lib/core/package.json index 6369fa747c..6f5980d914 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -37,7 +37,8 @@ "@alfresco/adf-extensions": ">=7.0.0-alpha.2-0", "@ngx-translate/core": ">=14.0.0", "minimatch-browser": ">=1.0.0", - "pdfjs-dist": ">=3.3.122" + "pdfjs-dist": ">=3.3.122", + "ts-morph": "^20.0.0" }, "keywords": [ "core", @@ -45,5 +46,11 @@ "angular", "components" ], - "license": "Apache-2.0" + "license": "Apache-2.0", + "ng-update": { + "migrations": "./schematics/migrations/collection.json" + }, + "nx-migrations": { + "migrations": "./schematics/migrations/collection.json" + } } diff --git a/lib/core/project.json b/lib/core/project.json index ce4abdea06..9b61e4d458 100644 --- a/lib/core/project.json +++ b/lib/core/project.json @@ -23,6 +23,16 @@ }, "defaultConfiguration": "production" }, + "build-schematics": { + "executor": "nx:run-commands", + "options": { + "commands": [ + { + "command": "npx tsc -p lib/core/tsconfig.schematics.json && cp lib/core/schematics/migrations/collection.json dist/libs/core/schematics/migrations/collection.json" + } + ] + } + }, "test": { "executor": "@angular-devkit/build-angular:karma", "options": { @@ -133,7 +143,7 @@ }, "npm-publish": { "executor": "nx:run-commands", - "dependsOn": ["build", "pretheme"], + "dependsOn": ["build", "pretheme", "build-schematics"], "options": { "cwd": "dist/libs/core", "commands": [ diff --git a/lib/core/schematics/migrations/7_0_0/index.ts b/lib/core/schematics/migrations/7_0_0/index.ts new file mode 100644 index 0000000000..02f3f1a2bd --- /dev/null +++ b/lib/core/schematics/migrations/7_0_0/index.ts @@ -0,0 +1,189 @@ +/*! + * @license + * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Rule, SchematicContext, SchematicsException, Tree } from '@angular-devkit/schematics'; +import { Project, NamedImports, SourceFile, ImportSpecifier, ImportDeclaration } from 'ts-morph'; + +interface MigrationData { + change: { + importedValue: string; + importSource: string; + }; + to: { + importedValue: string; + importSource: string; + }; +} + +const alfrescoApiServiceMigration: MigrationData = { + change: { + importedValue: 'AlfrescoApiService', + importSource: '@alfresco/adf-core' + }, + to: { + importedValue: 'AlfrescoApiService', + importSource: '@alfresco/adf-content-services' + } +}; + +const alfrescoApiMockMigration: MigrationData = { + change: { + importedValue: 'AlfrescoApiServiceMock', + importSource: '@alfresco/adf-core' + }, + to: { + importedValue: 'AlfrescoApiServiceMock', + importSource: '@alfresco/adf-content-services' + } +}; + +const alfrescoApiFactoryMigration: MigrationData = { + change: { + importedValue: 'AlfrescoApiFactory', + importSource: '@alfresco/adf-core' + }, + to: { + importedValue: 'AlfrescoApiFactory', + importSource: '@alfresco/adf-content-services' + } +}; + +const migrations: MigrationData[] = [alfrescoApiServiceMigration, alfrescoApiMockMigration, alfrescoApiFactoryMigration]; + +/** + * @returns Schematic rule for updating imports + */ +export function updateAlfrescoApiImports(): Rule { + const project = new Project(); + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + return (tree: Tree, _context: SchematicContext) => { + tree.visit((filePath: string) => visitor(filePath, tree, project)); + + return tree; + }; +} + +export const visitor = (filePath: string, tree: Pick, project: Project) => { + if ( + !filePath.includes('/.git/') && + !filePath.includes('/node_modules/') && + !filePath.includes('/.angular/') && + !filePath.includes('/.nxcache/') && + /\.ts$/.test(filePath) + ) { + const bufferFileContent = tree.read(filePath); + + if (!bufferFileContent) { + throw new SchematicsException(`Could not read file: ${filePath}`); + } + + migrations.forEach((migrationData) => { + const fileWithUpdatedImport = moveImport(filePath, bufferFileContent, project, migrationData); + + if (fileWithUpdatedImport) { + tree.overwrite(filePath, fileWithUpdatedImport); + } + }); + } +}; + +const moveImport = (filePath: string, bufferFileContent: Buffer, project: Project, migrationData: MigrationData): string | undefined => { + const fileContent = bufferFileContent.toString(); + const predictImport = fileContent.includes(migrationData.change.importedValue); + + if (predictImport) { + const sourceFile = project.getSourceFile(`migration-${filePath}`) ?? project.createSourceFile(`migration-${filePath}`, fileContent); + + const alfrescoApiImportResult = getImportedValueFromSource(sourceFile, { + importedIdentifier: migrationData.change.importedValue, + from: migrationData.change.importSource + }); + + if (alfrescoApiImportResult?.importedValue) { + if (alfrescoApiImportResult.allImportedValuesCount === 1) { + // There is only one import e.g. import { A } from 'A'; + // Therefore, we need to remove whole import statement + alfrescoApiImportResult.importSource?.remove(); + } else { + alfrescoApiImportResult.importedValue?.remove(); + } + + const alfrescoContentServiceImport = getSourceImport(sourceFile, migrationData.to.importSource); + + if (alfrescoContentServiceImport) { + alfrescoContentServiceImport.addNamedImport(migrationData.to.importedValue); + } else { + sourceFile.insertStatements( + sourceFile.getImportDeclarations().length + 1, + `import { ${migrationData.to.importedValue} } from '${migrationData.to.importSource}';` + ); + } + + return sourceFile.getFullText(); + } + } + + return undefined; +}; + +const getSourceImport = (sourceFile: SourceFile, from: string): ImportDeclaration | undefined => { + const moduleImports = sourceFile.getImportDeclarations(); + + const importDeclaration = moduleImports.find((moduleImport) => { + const currentImportSource = moduleImport.getModuleSpecifierValue(); + return currentImportSource === from; + }); + + return importDeclaration; +}; + +const getImportedValueFromSource = ( + sourceFile: SourceFile, + searchedImport: { + importedIdentifier: string; + from: string; + } +): { + importedValue: ImportSpecifier | undefined; + importSource: ImportDeclaration | undefined; + allImportedValuesCount: number | undefined; +} => { + const importSource = getSourceImport(sourceFile, searchedImport.from); + + if (!importSource) { + return { + importedValue: undefined, + importSource: undefined, + allImportedValuesCount: undefined + }; + } + + const importedValues = importSource?.getImportClause(); + const namedImports = importedValues?.getNamedBindings() as NamedImports; + const namedImportsElements = namedImports?.getElements() ?? []; + + const importedValue = namedImportsElements.find((binding) => binding.getName() === searchedImport.importedIdentifier); + + return { + importedValue, + importSource, + allImportedValuesCount: namedImportsElements.length + }; +}; + +export default updateAlfrescoApiImports; diff --git a/lib/core/schematics/migrations/collection.json b/lib/core/schematics/migrations/collection.json new file mode 100644 index 0000000000..5dbddf0794 --- /dev/null +++ b/lib/core/schematics/migrations/collection.json @@ -0,0 +1,46 @@ +{ + "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json", + "schematics": { + "move-out-alfresco-api": { + "description": "Update alfresco-api imports", + "version": "7.0.0", + "factory": "./7_0_0/index#updateAlfrescoApiImports" + } + }, + "packageJsonUpdates": { + "move-out-alfresco-api": { + "version": "7.0.0", + "packages": { + "ts-morph": { + "version": "^20.0.0", + "alwaysAddToPackageJson": true, + "addToPackageJson": "devDependencies" + }, + "@alfresco/adf-content-services": { + "version": "7.0.0", + "alwaysAddToPackageJson": false + }, + "@alfresco/adf-extensions": { + "version": "7.0.0", + "alwaysAddToPackageJson": false + }, + "@alfresco/adf-process-services-cloud": { + "version": "7.0.0", + "alwaysAddToPackageJson": false + }, + "@alfresco/adf-process-services": { + "version": "7.0.0", + "alwaysAddToPackageJson": false + }, + "@alfresco/eslint-plugin-eslint-angular": { + "version": "7.0.0", + "alwaysAddToPackageJson": false + }, + "@alfresco/js-api": { + "version": "8.0.0", + "alwaysAddToPackageJson": false + } + } + } + } +} diff --git a/lib/core/src/lib/app-config/app-config.service.ts b/lib/core/src/lib/app-config/app-config.service.ts index 6dd58b4de9..1efe6a50fa 100644 --- a/lib/core/src/lib/app-config/app-config.service.ts +++ b/lib/core/src/lib/app-config/app-config.service.ts @@ -63,7 +63,6 @@ export enum Status { providedIn: 'root' }) export class AppConfigService { - config: any = { application: { name: 'Alfresco ADF Application' @@ -97,11 +96,10 @@ export class AppConfigService { * @returns Property value, when loaded */ select(property: string): Observable { - return this.onLoadSubject - .pipe( - map((config) => ObjectUtils.getValue(config, property)), - distinctUntilChanged() - ); + return this.onLoadSubject.pipe( + map((config) => ObjectUtils.getValue(config, property)), + distinctUntilChanged() + ); } /** @@ -170,9 +168,7 @@ export class AppConfigService { protected onDataLoaded() { this.onLoadSubject.next(this.config); - this.extensionService.setup$ - .pipe(take(1)) - .subscribe((config) => this.onExtensionsLoaded(config)); + this.extensionService.setup$.pipe(take(1)).subscribe((config) => this.onExtensionsLoaded(config)); } protected onExtensionsLoaded(config: ExtensionConfig) { @@ -227,20 +223,18 @@ export class AppConfigService { * @param hostIdp host address * @returns Discovery configuration */ - loadWellKnown(hostIdp: string): Promise { + loadWellKnown(hostIdp: string): Promise { return new Promise((resolve, reject) => { - this.http - .get(`${hostIdp}/.well-known/openid-configuration`) - .subscribe({ - next: (res: OpenidConfiguration) => { - resolve(res); - }, - error: (err: any) => { - // eslint-disable-next-line no-console - console.error('hostIdp not correctly configured or unreachable'); - reject(err); - } - }); + this.http.get(`${hostIdp}/.well-known/openid-configuration`).subscribe({ + next: (res: OpenidConfiguration) => { + resolve(res); + }, + error: (err: any) => { + // eslint-disable-next-line no-console + console.error('hostIdp not correctly configured or unreachable'); + reject(err); + } + }); }); } @@ -273,5 +267,4 @@ export class AppConfigService { return result; } - } diff --git a/lib/core/src/lib/auth/oidc/auth.module.ts b/lib/core/src/lib/auth/oidc/auth.module.ts index e63697dd5f..a067960c22 100644 --- a/lib/core/src/lib/auth/oidc/auth.module.ts +++ b/lib/core/src/lib/auth/oidc/auth.module.ts @@ -17,8 +17,6 @@ import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core'; import { AUTH_CONFIG, OAuthModule, OAuthStorage } from 'angular-oauth2-oidc'; -import { AlfrescoApiNoAuthService } from '../../api-factories/alfresco-api-no-auth.service'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { AuthenticationService } from '../services/authentication.service'; import { StorageService } from '../../common/services/storage.service'; import { AuthModuleConfig, AUTH_MODULE_CONFIG } from './auth-config'; @@ -44,7 +42,6 @@ export function loginFactory(redirectService: RedirectAuthService): () => Promis providers: [ { provide: OAuthStorage, useExisting: StorageService }, { provide: AuthenticationService}, - { provide: AlfrescoApiService, useClass: AlfrescoApiNoAuthService }, { provide: AUTH_CONFIG, useFactory: authConfigFactory, diff --git a/lib/core/src/lib/common/services/user-preferences.service.spec.ts b/lib/core/src/lib/common/services/user-preferences.service.spec.ts index 912b30cb7f..a9685af9c8 100644 --- a/lib/core/src/lib/common/services/user-preferences.service.spec.ts +++ b/lib/core/src/lib/common/services/user-preferences.service.spec.ts @@ -21,8 +21,6 @@ import { AppConfigService } from '../../app-config/app-config.service'; import { StorageService } from '../../common/services/storage.service'; import { UserPreferencesService, UserPreferenceValues } from '../../common/services/user-preferences.service'; import { AppConfigServiceMock } from '../mock/app-config.service.mock'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { AlfrescoApiServiceMock } from '../../mock'; import { NoopTranslateModule } from '@alfresco/adf-core'; describe('UserPreferencesService', () => { @@ -30,14 +28,12 @@ describe('UserPreferencesService', () => { let preferences: UserPreferencesService; let storage: StorageService; let appConfig: AppConfigServiceMock; - let alfrescoApiService: AlfrescoApiServiceMock; let translate: TranslateService; beforeEach(() => { TestBed.configureTestingModule({ imports: [NoopTranslateModule], providers: [ - { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, { provide: AppConfigService, useClass: AppConfigServiceMock } ] }); @@ -53,7 +49,6 @@ describe('UserPreferencesService', () => { storage = TestBed.inject(StorageService); storage.clear(); translate = TestBed.inject(TranslateService); - alfrescoApiService = TestBed.inject(AlfrescoApiService) as AlfrescoApiServiceMock; }); afterEach(() => { @@ -103,7 +98,7 @@ describe('UserPreferencesService', () => { }); it('should null value return default prefix', () => { - storage.setItem('paginationSize', null); + storage.setItem('paginationSize', ''); const paginationSize = preferences.getPropertyKey('paginationSize'); expect(preferences.get(paginationSize, 'default')).toBe('default'); }); @@ -172,7 +167,7 @@ describe('UserPreferencesService', () => { } ]; appConfig.config.locale = 'fake-locale-config'; - alfrescoApiService.initialize(); + appConfig.load(); const textOrientation = preferences.getPropertyKey('textOrientation'); expect(storage.getItem(textOrientation)).toBe('ltr'); }); @@ -185,7 +180,7 @@ describe('UserPreferencesService', () => { } ]; appConfig.config.locale = 'fake-locale-config'; - alfrescoApiService.initialize(); + appConfig.load(); const textOrientation = preferences.getPropertyKey('textOrientation'); expect(storage.getItem(textOrientation)).toBe('rtl'); }); @@ -196,7 +191,6 @@ describe('UserPreferencesService', () => { key: 'fake-locale-browser' } ]; - alfrescoApiService.initialize(); const textOrientation = preferences.getPropertyKey('textOrientation'); expect(storage.getItem(textOrientation)).toBe(null); @@ -210,7 +204,7 @@ describe('UserPreferencesService', () => { } ]; spyOn(translate, 'getBrowserCultureLang').and.returnValue('fake-locale-browser'); - alfrescoApiService.initialize(); + appConfig.load(); let lastValue; diff --git a/lib/core/src/lib/common/services/user-preferences.service.ts b/lib/core/src/lib/common/services/user-preferences.service.ts index 20b5654560..b2bb5ccf5b 100644 --- a/lib/core/src/lib/common/services/user-preferences.service.ts +++ b/lib/core/src/lib/common/services/user-preferences.service.ts @@ -20,8 +20,7 @@ import { TranslateService } from '@ngx-translate/core'; import { Observable, BehaviorSubject } from 'rxjs'; import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service'; import { StorageService } from './storage.service'; -import { distinctUntilChanged, map, filter } from 'rxjs/operators'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; +import { distinctUntilChanged, map } from 'rxjs/operators'; import { LanguageItem } from './language-item.interface'; // eslint-disable-next-line no-shadow @@ -48,13 +47,17 @@ export class UserPreferencesService { private onChangeSubject: BehaviorSubject; onChange: Observable; - constructor(public translate: TranslateService, + constructor( + public translate: TranslateService, private appConfig: AppConfigService, - private storage: StorageService, - private alfrescoApiService: AlfrescoApiService) { - this.alfrescoApiService.alfrescoApiInitialized.pipe(filter(status => status)).subscribe(this.initUserPreferenceStatus.bind(this)); + private storage: StorageService + ) { this.onChangeSubject = new BehaviorSubject(this.userPreferenceStatus); this.onChange = this.onChangeSubject.asObservable(); + + this.appConfig.onLoad.subscribe(() => { + this.initUserPreferenceStatus(); + }); } private initUserPreferenceStatus() { @@ -168,7 +171,7 @@ export class UserPreferencesService { * * @param value Name of the prefix */ - setStoragePrefix(value: string) { + setStoragePrefix(value: string | null) { this.storage.setItem('USER_PROFILE', value || 'GUEST'); this.initUserPreferenceStatus(); } diff --git a/lib/core/src/lib/core.module.ts b/lib/core/src/lib/core.module.ts index 004a5fb959..eb417561a3 100644 --- a/lib/core/src/lib/core.module.ts +++ b/lib/core/src/lib/core.module.ts @@ -50,7 +50,6 @@ import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar'; import { loadAppConfig } from './app-config/app-config.loader'; import { AppConfigService } from './app-config/app-config.service'; import { StorageService } from './common/services/storage.service'; -import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-factories/alfresco-api-v2-loader.service'; import { MomentDateAdapter } from './common/utils/moment-date-adapter'; import { AppConfigPipe, StoragePrefixFactory } from './app-config'; import { IconComponent } from './icon'; @@ -159,12 +158,6 @@ export class CoreModule { useValue: { duration: 10000 } - }, - { - provide: APP_INITIALIZER, - useFactory: createAlfrescoApiInstance, - deps: [AlfrescoApiLoaderService], - multi: true } ] }; diff --git a/lib/core/src/lib/datatable/components/location-cell/location-cell.component.ts b/lib/core/src/lib/datatable/components/location-cell/location-cell.component.ts index 8afc921ca6..4bc1cf4ca7 100644 --- a/lib/core/src/lib/datatable/components/location-cell/location-cell.component.ts +++ b/lib/core/src/lib/datatable/components/location-cell/location-cell.component.ts @@ -19,7 +19,7 @@ import { ChangeDetectionStrategy, Component, Input, OnInit, ViewEncapsulation } import { DataTableCellComponent } from '../datatable-cell/datatable-cell.component'; import { AsyncPipe } from '@angular/common'; import { RouterModule } from '@angular/router'; -import { PathInfo } from '@alfresco/js-api'; +import { PathInfo } from '../../../models/path.model'; @Component({ standalone: true, diff --git a/lib/core/src/lib/datatable/components/mocks/datatable.mock.ts b/lib/core/src/lib/datatable/components/mocks/datatable.mock.ts index 8f9c1d9325..aa9092df4c 100644 --- a/lib/core/src/lib/datatable/components/mocks/datatable.mock.ts +++ b/lib/core/src/lib/datatable/components/mocks/datatable.mock.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { PathInfo } from '@alfresco/js-api'; +import { PathInfo } from '../../../models/path.model'; import { DataColumn } from '../../data/data-column.model'; export const mockCarsData: any = [ diff --git a/lib/core/src/lib/mock/public-api.ts b/lib/core/src/lib/mock/public-api.ts index bc8d4fec58..8447e49618 100644 --- a/lib/core/src/lib/mock/public-api.ts +++ b/lib/core/src/lib/mock/public-api.ts @@ -18,7 +18,6 @@ export * from './cookie.service.mock'; export * from './event.mock'; export * from './translation.service.mock'; -export * from './alfresco-api.service.mock'; export * from './form/form.component.mock'; export * from './form/form-definition.mock'; diff --git a/lib/core/src/lib/models/basic-auth.ts b/lib/core/src/lib/models/basic-auth.ts new file mode 100644 index 0000000000..c31ca33881 --- /dev/null +++ b/lib/core/src/lib/models/basic-auth.ts @@ -0,0 +1,22 @@ +/*! + * @license + * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export interface BasicAuth { + username?: string; + password?: string; + ticket?: string; +} diff --git a/lib/core/src/lib/models/oauth2.ts b/lib/core/src/lib/models/oauth2.ts new file mode 100644 index 0000000000..4c06250888 --- /dev/null +++ b/lib/core/src/lib/models/oauth2.ts @@ -0,0 +1,21 @@ +/*! + * @license + * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export interface Oauth2 { + refreshToken?: string; + accessToken?: string; +} diff --git a/lib/core/src/lib/models/path.model.ts b/lib/core/src/lib/models/path.model.ts new file mode 100644 index 0000000000..dc79877c54 --- /dev/null +++ b/lib/core/src/lib/models/path.model.ts @@ -0,0 +1,35 @@ +/*! + * @license + * Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class PathInfo { + elements?: PathElement[]; + name?: string; + isComplete?: boolean; + + constructor(input?: Partial) { + if (input) { + Object.assign(this, input); + } + } +} + +export interface PathElement { + id?: string; + name?: string; + nodeType?: string; + aspectNames?: string[]; +} diff --git a/lib/core/src/lib/models/public-api.ts b/lib/core/src/lib/models/public-api.ts index 5315520b17..1eb8725449 100644 --- a/lib/core/src/lib/models/public-api.ts +++ b/lib/core/src/lib/models/public-api.ts @@ -21,3 +21,4 @@ export * from './pagination.model'; export * from './request-pagination.model'; export * from './decimal-number.model'; export * from './general-user.model'; +export * from './path.model'; diff --git a/lib/core/src/lib/testing/core.testing.module.ts b/lib/core/src/lib/testing/core.testing.module.ts index 2c39290dfd..99fca4b510 100644 --- a/lib/core/src/lib/testing/core.testing.module.ts +++ b/lib/core/src/lib/testing/core.testing.module.ts @@ -19,8 +19,6 @@ import { NgModule, APP_INITIALIZER } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../core.module'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; -import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; import { AppConfigService } from '../app-config/app-config.service'; import { AppConfigServiceMock } from '../common/mock/app-config.service.mock'; import { DatePipe } from '@angular/common'; @@ -32,6 +30,7 @@ import { DirectionalityConfigService } from '../common/services/directionality-c import { AuthModule, RedirectAuthService } from '../auth'; import { EMPTY, of } from 'rxjs'; import { NoopTranslateModule } from './noop-translate.module'; +import { UserPreferencesService } from '../common/services/user-preferences.service'; @NgModule({ imports: [ @@ -44,7 +43,7 @@ import { NoopTranslateModule } from './noop-translate.module'; ], providers: [ DatePipe, - { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, + UserPreferencesService, { provide: AppConfigService, useClass: AppConfigServiceMock }, { provide: CookieService, useClass: CookieServiceMock }, { diff --git a/lib/core/src/lib/translation/translation.service.spec.ts b/lib/core/src/lib/translation/translation.service.spec.ts index 2ff591ba50..d53dba5fa0 100644 --- a/lib/core/src/lib/translation/translation.service.spec.ts +++ b/lib/core/src/lib/translation/translation.service.spec.ts @@ -24,8 +24,6 @@ import { TranslateLoaderService } from './translate-loader.service'; import { provideTranslations, TranslationService } from './translation.service'; import { AppConfigService } from '../app-config/app-config.service'; import { AppConfigServiceMock } from '../common/mock/app-config.service.mock'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; -import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; declare let jasmine: any; @@ -45,7 +43,6 @@ describe('TranslationService', () => { }) ], providers: [ - { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, { provide: AppConfigService, useClass: AppConfigServiceMock }, provideTranslations('@alfresco/adf-core', 'assets/ng2-alfresco-core') ] diff --git a/lib/core/src/public-api.ts b/lib/core/src/public-api.ts index 86a6c03f6e..63bb4d692a 100644 --- a/lib/core/src/public-api.ts +++ b/lib/core/src/public-api.ts @@ -38,7 +38,6 @@ export * from './lib/comments/index'; export * from './lib/sorting-picker/index'; export * from './lib/templates/index'; export * from './lib/pipes/index'; -export * from './lib/services/index'; export * from './lib/directives/index'; export * from './lib/dynamic-chip-list/index'; export * from './lib/clipboard/index'; @@ -49,7 +48,6 @@ export * from './lib/blank-page/index'; export * from './lib/search-text/index'; export * from './lib/snackbar-content/index'; export * from './lib/translation/index'; - export * from './lib/common/utils/index'; export * from './lib/interface/index'; export * from './lib/models/index'; diff --git a/lib/core/tsconfig.nx.migrations.json b/lib/core/tsconfig.nx.migrations.json new file mode 100644 index 0000000000..7b90cdf8eb --- /dev/null +++ b/lib/core/tsconfig.nx.migrations.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "lib": [ + "es2018", + "dom" + ], + "declaration": true, + "module": "commonjs", + "moduleResolution": "node", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitThis": true, + "noUnusedParameters": true, + "noUnusedLocals": true, + "rootDir": "./migrations", + "outDir": "../../dist/libs/core/migrations", + "skipDefaultLibCheck": true, + "skipLibCheck": true, + "sourceMap": true, + "strictNullChecks": true, + "target": "es2015", + "types": [] + }, + "include": [ + "migrations/**/*" + ], + "files": ["schematics/migrations/7_0_0/index.ts"] + } + diff --git a/lib/core/tsconfig.schematics.json b/lib/core/tsconfig.schematics.json new file mode 100644 index 0000000000..a9cd3d8a35 --- /dev/null +++ b/lib/core/tsconfig.schematics.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "lib": [ + "es2018", + "dom" + ], + "declaration": true, + "module": "commonjs", + "moduleResolution": "node", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitThis": true, + "noUnusedParameters": true, + "noUnusedLocals": true, + "rootDir": "./schematics", + "outDir": "../../dist/libs/core/schematics", + "skipDefaultLibCheck": true, + "skipLibCheck": true, + "sourceMap": true, + "strictNullChecks": true, + "target": "es2015", + "types": [] + }, + "include": [ + "schematics/**/*" + ] + } + diff --git a/lib/insights/ng-package.json b/lib/insights/ng-package.json index 504252c500..a5805e7386 100644 --- a/lib/insights/ng-package.json +++ b/lib/insights/ng-package.json @@ -22,6 +22,7 @@ }, "allowedNonPeerDependencies": [ "@alfresco/adf-core", + "@alfresco/adf-content-services", "@ngx-translate/core", "chart.js", "ng2-charts", diff --git a/lib/insights/package.json b/lib/insights/package.json index c50b405e54..72daba3563 100644 --- a/lib/insights/package.json +++ b/lib/insights/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@alfresco/adf-core": ">=7.0.0-alpha.2-0", + "@alfresco/adf-content-services": ">=7.0.0-alpha.2-0", "@ngx-translate/core": ">=14.0.0", "chart.js": "^4.3.0", "ng2-charts": "^4.1.1", diff --git a/lib/insights/src/lib/analytics-process/services/analytics.service.ts b/lib/insights/src/lib/analytics-process/services/analytics.service.ts index dea3454818..864de29df7 100644 --- a/lib/insights/src/lib/analytics-process/services/analytics.service.ts +++ b/lib/insights/src/lib/analytics-process/services/analytics.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; import { Observable, from, of } from 'rxjs'; import { ParameterValueModel } from '../../diagram/models/report/parameter-value.model'; diff --git a/lib/insights/src/lib/diagram/services/diagrams.service.ts b/lib/insights/src/lib/diagram/services/diagrams.service.ts index 990278488e..1d75d29094 100644 --- a/lib/insights/src/lib/diagram/services/diagrams.service.ts +++ b/lib/insights/src/lib/diagram/services/diagrams.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; import { ModelJsonBpmnApi } from '@alfresco/js-api'; diff --git a/lib/insights/src/lib/testing/insights.testing.module.ts b/lib/insights/src/lib/testing/insights.testing.module.ts index 65848a6daf..ab4fa461f2 100644 --- a/lib/insights/src/lib/testing/insights.testing.module.ts +++ b/lib/insights/src/lib/testing/insights.testing.module.ts @@ -18,13 +18,12 @@ import { NgModule } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { - AlfrescoApiService, - AlfrescoApiServiceMock, AppConfigService, AppConfigServiceMock, AuthModule, NoopTranslateModule } from '@alfresco/adf-core'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; @NgModule({ imports: [AuthModule.forRoot({ useHash: true }), NoopAnimationsModule, NoopTranslateModule], diff --git a/lib/insights/tsconfig.lib.json b/lib/insights/tsconfig.lib.json index 49f881d2fe..a26e6a261c 100644 --- a/lib/insights/tsconfig.lib.json +++ b/lib/insights/tsconfig.lib.json @@ -7,6 +7,7 @@ "paths": { "@alfresco/adf-extensions": ["../../../dist/libs/extensions"], "@alfresco/adf-extensions/*": ["../../../dist/libs/extensions/*"], + "@alfresco/adf-content-services": ["../../../dist/libs/content-services"], "@alfresco/adf-core": ["../../../dist/libs/core"], "@alfresco/adf-core/*": ["../../../dist/libs/core/*"], "@alfresco/js-api": ["../../../dist/libs/js-api"], diff --git a/lib/process-services-cloud/src/lib/app/components/app-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/app/components/app-list-cloud.component.spec.ts index 40b14aa9ad..799dfb72d1 100644 --- a/lib/process-services-cloud/src/lib/app/components/app-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/app/components/app-list-cloud.component.spec.ts @@ -17,7 +17,7 @@ import { Component } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { of, throwError } from 'rxjs'; import { fakeApplicationInstance } from '../mock/app-model.mock'; import { AppListCloudComponent, LAYOUT_GRID, LAYOUT_LIST } from './app-list-cloud.component'; diff --git a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts index 866c0f3598..4216b91a94 100644 --- a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts @@ -17,7 +17,8 @@ import { TestBed } from '@angular/core/testing'; import { throwError } from 'rxjs'; -import { AppConfigService, AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; +import { AppConfigService, CoreTestingModule } from '@alfresco/adf-core'; import { HttpErrorResponse } from '@angular/common/http'; import { AppsProcessCloudService } from './apps-process-cloud.service'; import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from '../mock/app-model.mock'; diff --git a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts index 4274990743..9e4ef8c10d 100644 --- a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts @@ -17,9 +17,8 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { VersionCompatibilityService } from '@alfresco/adf-content-services'; +import { VersionCompatibilityService, AlfrescoApiService } from '@alfresco/adf-content-services'; import { - AlfrescoApiService, ContentLinkModel, CoreModule, FormFieldModel, diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.ts b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.ts index 66cff0c117..7ad47c3fbf 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.ts @@ -25,7 +25,6 @@ import { FormValues, ContentLinkModel, AppConfigService, - AlfrescoApiService, UploadWidgetContentLinkModel, DestinationFolderPath } from '@alfresco/adf-core'; @@ -35,6 +34,7 @@ import { ProcessCloudContentService } from '../../../services/process-cloud-cont import { UploadCloudWidgetComponent } from './upload-cloud.widget'; import { DestinationFolderPathModel, DestinationFolderPathType } from '../../../models/form-cloud-representation.model'; import { + AlfrescoApiService, ContentNodeSelectorPanelService, NewVersionUploaderDataAction, NewVersionUploaderDialogData, diff --git a/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.spec.ts b/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.spec.ts index 517eda360f..1b9c288715 100644 --- a/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.spec.ts +++ b/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.spec.ts @@ -16,7 +16,8 @@ */ import { TestBed } from '@angular/core/testing'; -import { AlfrescoApiService, AlfrescoApiServiceMock, NotificationService } from '@alfresco/adf-core'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; +import { NotificationService } from '@alfresco/adf-core'; import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; import { of, Subject } from 'rxjs'; diff --git a/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.ts b/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.ts index 40e96aa6d7..d860e7eef3 100644 --- a/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.ts +++ b/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.ts @@ -16,9 +16,9 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, NotificationService } from '@alfresco/adf-core'; +import { NotificationService } from '@alfresco/adf-core'; import { MatDialog } from '@angular/material/dialog'; -import { ContentNodeSelectorComponent, ContentNodeSelectorComponentData, NodeAction } from '@alfresco/adf-content-services'; +import { ContentNodeSelectorComponent, ContentNodeSelectorComponentData, NodeAction, AlfrescoApiService } from '@alfresco/adf-content-services'; import { Node, NodeEntry, NodesApi } from '@alfresco/js-api'; import { from, Observable, Subject, throwError } from 'rxjs'; import { catchError, map, mapTo } from 'rxjs/operators'; diff --git a/lib/process-services-cloud/src/lib/form/services/process-cloud-content.service.ts b/lib/process-services-cloud/src/lib/form/services/process-cloud-content.service.ts index 5d280857be..b9cd3ac416 100644 --- a/lib/process-services-cloud/src/lib/form/services/process-cloud-content.service.ts +++ b/lib/process-services-cloud/src/lib/form/services/process-cloud-content.service.ts @@ -18,8 +18,8 @@ import { Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; import { map } from 'rxjs/operators'; -import { AlfrescoApiService, DownloadService } from '@alfresco/adf-core'; -import { ContentService, NodesApiService } from '@alfresco/adf-content-services'; +import { DownloadService } from '@alfresco/adf-core'; +import { ContentService, NodesApiService, AlfrescoApiService } from '@alfresco/adf-content-services'; import { AuthenticationApi, Node, UploadApi } from '@alfresco/js-api'; @Injectable({ diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts index 30687a2248..89b76a88e7 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts @@ -17,7 +17,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SimpleChange } from '@angular/core'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { MatDialog } from '@angular/material/dialog'; import { of } from 'rxjs'; diff --git a/lib/process-services-cloud/src/lib/services/base-cloud.service.ts b/lib/process-services-cloud/src/lib/services/base-cloud.service.ts index 040822fc06..252889503e 100644 --- a/lib/process-services-cloud/src/lib/services/base-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/services/base-cloud.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; +import { AppConfigService } from '@alfresco/adf-core'; import { Injectable, inject } from '@angular/core'; import { from, Observable } from 'rxjs'; import { AdfHttpClient } from '@alfresco/adf-core/api'; diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts index 678fba6c28..8adea7b11b 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts @@ -16,7 +16,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { StartTaskCloudComponent } from './start-task-cloud.component'; import { of, throwError } from 'rxjs'; import { taskDetailsMock } from '../mock/task-details.mock'; diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.spec.ts index 1d586985aa..cde511d7f5 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.spec.ts @@ -17,7 +17,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { MatDialog } from '@angular/material/dialog'; import { of, Subject } from 'rxjs'; import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; diff --git a/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts index c834899c06..1583c10495 100644 --- a/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts @@ -19,7 +19,8 @@ import { TaskHeaderCloudComponent } from './task-header-cloud.component'; import { of, throwError } from 'rxjs'; import { By } from '@angular/platform-browser'; import { ComponentFixture, TestBed, fakeAsync, flush, discardPeriodicTasks } from '@angular/core/testing'; -import { AppConfigService, AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; +import { AppConfigService } from '@alfresco/adf-core'; import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { TaskCloudService } from '../../services/task-cloud.service'; import { TaskHeaderCloudModule } from '../task-header-cloud.module'; diff --git a/lib/process-services-cloud/src/lib/task/task-list/testing/task-list.testing.module.ts b/lib/process-services-cloud/src/lib/task/task-list/testing/task-list.testing.module.ts index 31bcd5fe97..97736825fa 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/testing/task-list.testing.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/testing/task-list.testing.module.ts @@ -20,14 +20,13 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { HttpClientModule } from '@angular/common/http'; import { TaskListCloudModule } from '../task-list-cloud.module'; import { - AlfrescoApiService, - AlfrescoApiServiceMock, AppConfigService, AppConfigServiceMock, TranslationService, TranslationMock, CONTEXT_MENU_DIRECTIVES } from '@alfresco/adf-core'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; @NgModule({ imports: [HttpClientModule, NoopAnimationsModule, TaskListCloudModule, ...CONTEXT_MENU_DIRECTIVES], diff --git a/lib/process-services-cloud/src/lib/testing/process-service-cloud.testing.module.ts b/lib/process-services-cloud/src/lib/testing/process-service-cloud.testing.module.ts index 3fd0c5dfa6..07b5a5f0d0 100644 --- a/lib/process-services-cloud/src/lib/testing/process-service-cloud.testing.module.ts +++ b/lib/process-services-cloud/src/lib/testing/process-service-cloud.testing.module.ts @@ -19,8 +19,6 @@ import { NgModule } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { HttpClientModule } from '@angular/common/http'; import { - AlfrescoApiService, - AlfrescoApiServiceMock, AppConfigService, AppConfigServiceMock, TranslationService, @@ -28,6 +26,7 @@ import { CoreModule, AuthModule } from '@alfresco/adf-core'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { TranslateModule } from '@ngx-translate/core'; import { ProcessServicesCloudModule } from '../process-services-cloud.module'; import { RouterTestingModule } from '@angular/router/testing'; diff --git a/lib/process-services/src/lib/attachment/create-process-attachment/create-process-attachment.component.spec.ts b/lib/process-services/src/lib/attachment/create-process-attachment/create-process-attachment.component.spec.ts index 1c7518f493..334e50b3aa 100644 --- a/lib/process-services/src/lib/attachment/create-process-attachment/create-process-attachment.component.spec.ts +++ b/lib/process-services/src/lib/attachment/create-process-attachment/create-process-attachment.component.spec.ts @@ -18,8 +18,8 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CreateProcessAttachmentComponent } from './create-process-attachment.component'; -import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core'; import { ProcessTestingModule } from '../../testing/process.testing.module'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; declare let jasmine: any; diff --git a/lib/process-services/src/lib/form/services/activiti-alfresco.service.ts b/lib/process-services/src/lib/form/services/activiti-alfresco.service.ts index cefc4dcf81..df4d5cc189 100644 --- a/lib/process-services/src/lib/form/services/activiti-alfresco.service.ts +++ b/lib/process-services/src/lib/form/services/activiti-alfresco.service.ts @@ -15,8 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, ExternalContent } from '@alfresco/adf-core'; -import { SitesService } from '@alfresco/adf-content-services'; +import { AlfrescoApiService, SitesService } from '@alfresco/adf-content-services'; +import { ExternalContent } from '@alfresco/adf-core'; import { Injectable } from '@angular/core'; import { IntegrationAlfrescoOnPremiseApi, diff --git a/lib/process-services/src/lib/form/services/ecm-model.service.spec.ts b/lib/process-services/src/lib/form/services/ecm-model.service.spec.ts index 7e709744e1..ee674bbb63 100644 --- a/lib/process-services/src/lib/form/services/ecm-model.service.spec.ts +++ b/lib/process-services/src/lib/form/services/ecm-model.service.spec.ts @@ -19,6 +19,7 @@ import { Observable } from 'rxjs'; import { FormModel, CoreTestingModule } from '@alfresco/adf-core'; import { EcmModelService } from './ecm-model.service'; import { TestBed } from '@angular/core/testing'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; declare let jasmine: any; @@ -27,7 +28,8 @@ describe('EcmModelService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [CoreTestingModule], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(EcmModelService); jasmine.Ajax.install(); diff --git a/lib/process-services/src/lib/form/services/ecm-model.service.ts b/lib/process-services/src/lib/form/services/ecm-model.service.ts index 5b7e3c4ab9..efbc6443db 100644 --- a/lib/process-services/src/lib/form/services/ecm-model.service.ts +++ b/lib/process-services/src/lib/form/services/ecm-model.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, FormModel } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; +import { FormModel } from '@alfresco/adf-core'; import { EventEmitter, Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; import { map, catchError } from 'rxjs/operators'; diff --git a/lib/process-services/src/lib/form/services/editor.service.ts b/lib/process-services/src/lib/form/services/editor.service.ts index 5aea1642c3..18866d0dc8 100644 --- a/lib/process-services/src/lib/form/services/editor.service.ts +++ b/lib/process-services/src/lib/form/services/editor.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; import { FormModelsApi, FormRepresentation } from '@alfresco/js-api'; diff --git a/lib/process-services/src/lib/form/services/external-alfresco-api.service.ts b/lib/process-services/src/lib/form/services/external-alfresco-api.service.ts index ff60dc8311..e398331734 100644 --- a/lib/process-services/src/lib/form/services/external-alfresco-api.service.ts +++ b/lib/process-services/src/lib/form/services/external-alfresco-api.service.ts @@ -17,7 +17,7 @@ import { Injectable } from '@angular/core'; import { AlfrescoApi } from '@alfresco/js-api'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; @Injectable({ providedIn: 'root' }) export class ExternalAlfrescoApiService extends AlfrescoApiService { diff --git a/lib/process-services/src/lib/form/services/model.service.ts b/lib/process-services/src/lib/form/services/model.service.ts index d32f4fb98d..312b6e1a00 100644 --- a/lib/process-services/src/lib/form/services/model.service.ts +++ b/lib/process-services/src/lib/form/services/model.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; import { ModelsApi } from '@alfresco/js-api'; diff --git a/lib/process-services/src/lib/form/services/process-content.service.spec.ts b/lib/process-services/src/lib/form/services/process-content.service.spec.ts index 57d69b74f1..3aa0fc1238 100644 --- a/lib/process-services/src/lib/form/services/process-content.service.spec.ts +++ b/lib/process-services/src/lib/form/services/process-content.service.spec.ts @@ -19,6 +19,7 @@ import { TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { ProcessContentService } from './process-content.service'; import { CoreTestingModule } from '@alfresco/adf-core'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; declare let jasmine: any; @@ -66,7 +67,8 @@ describe('ProcessContentService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [CoreTestingModule], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(ProcessContentService); }); diff --git a/lib/process-services/src/lib/form/services/process-content.service.ts b/lib/process-services/src/lib/form/services/process-content.service.ts index fe9f49984b..0c3785adfc 100644 --- a/lib/process-services/src/lib/form/services/process-content.service.ts +++ b/lib/process-services/src/lib/form/services/process-content.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; import { ActivitiContentApi, diff --git a/lib/process-services/src/lib/form/services/process-definition.service.ts b/lib/process-services/src/lib/form/services/process-definition.service.ts index 627186dbf1..3b2d0da588 100644 --- a/lib/process-services/src/lib/form/services/process-definition.service.ts +++ b/lib/process-services/src/lib/form/services/process-definition.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, FormFieldOption } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; +import { FormFieldOption } from '@alfresco/adf-core'; import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; import { ProcessDefinitionsApi } from '@alfresco/js-api'; diff --git a/lib/process-services/src/lib/form/services/task-form.service.ts b/lib/process-services/src/lib/form/services/task-form.service.ts index 886f7faeff..a0c1c8acde 100644 --- a/lib/process-services/src/lib/form/services/task-form.service.ts +++ b/lib/process-services/src/lib/form/services/task-form.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, FormFieldOption, FormValues, TaskProcessVariableModel } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; +import { FormFieldOption, FormValues, TaskProcessVariableModel } from '@alfresco/adf-core'; import { Injectable } from '@angular/core'; import { from, Observable, throwError } from 'rxjs'; import { CompleteFormRepresentation, SaveFormRepresentation, TaskFormsApi } from '@alfresco/js-api'; diff --git a/lib/process-services/src/lib/form/services/task.service.ts b/lib/process-services/src/lib/form/services/task.service.ts index 31ea884fc8..4c408e1979 100644 --- a/lib/process-services/src/lib/form/services/task.service.ts +++ b/lib/process-services/src/lib/form/services/task.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; import { TaskRepresentation, TasksApi } from '@alfresco/js-api'; diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts index 45761ae380..269a837d3f 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts @@ -17,11 +17,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { ContentModule, ContentNodeSelectorPanelComponent, DocumentListService, SitesService, NodesApiService } from '@alfresco/adf-content-services'; +import { AlfrescoApiService, ContentModule, ContentNodeSelectorPanelComponent, DocumentListService, SitesService, NodesApiService } from '@alfresco/adf-content-services'; import { EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core'; import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { AttachFileWidgetDialogComponent } from './attach-file-widget-dialog.component'; -import { AlfrescoApiService, BasicAlfrescoAuthService, OidcAuthenticationService } from '@alfresco/adf-core'; +import { BasicAlfrescoAuthService, OidcAuthenticationService } from '@alfresco/adf-core'; import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface'; import { of, throwError } from 'rxjs'; import { By } from '@angular/platform-browser'; diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.ts index b0790038a6..f05582bff7 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.ts @@ -17,9 +17,9 @@ import { Component, Inject, ViewEncapsulation, ViewChild } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog'; -import { AlfrescoApiService, LoginDialogPanelComponent, TranslationService, AuthenticationService } from '@alfresco/adf-core'; +import { LoginDialogPanelComponent, TranslationService, AuthenticationService } from '@alfresco/adf-core'; import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface'; -import { DocumentListService, SitesService, SearchService, ContentNodeSelectorPanelComponent } from '@alfresco/adf-content-services'; +import { DocumentListService, SitesService, SearchService, ContentNodeSelectorPanelComponent, AlfrescoApiService } from '@alfresco/adf-content-services'; import { ExternalAlfrescoApiService } from '../../services/external-alfresco-api.service'; import { Node } from '@alfresco/js-api'; import { CommonModule } from '@angular/common'; diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.ts index d6563197eb..0bcf16112f 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.ts @@ -15,9 +15,10 @@ * limitations under the License. */ +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { MatDialog } from '@angular/material/dialog'; import { EventEmitter, Injectable, Output } from '@angular/core'; -import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; +import { TranslationService } from '@alfresco/adf-core'; import { Observable, of, Subject } from 'rxjs'; import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface'; import { AlfrescoEndpointRepresentation, Node, ContentApi } from '@alfresco/js-api'; diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.spec.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.spec.ts index 00ff85caf2..2de77f2be4 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.spec.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.spec.ts @@ -173,6 +173,7 @@ describe('AttachFileWidgetComponent', () => { }); it('should add file to tempFilesList when form has value and file source is configured', () => { + spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer)); spyOn(widget, 'isFileSourceConfigured').and.returnValue(true); widget.field = new FormFieldModel(new FormModel(), { type: FormFieldTypes.UPLOAD, diff --git a/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts b/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts index f188e99d51..6e5573ba0c 100644 --- a/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts @@ -22,6 +22,7 @@ import { ContentLinkModel, CoreTestingModule, DownloadService } from '@alfresco/ import { of } from 'rxjs'; import { ContentWidgetComponent } from './content.widget'; import { ProcessContentService } from '../../services/process-content.service'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; declare let jasmine: any; @@ -59,7 +60,8 @@ describe('ContentWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, ContentWidgetComponent] + imports: [CoreTestingModule, ContentWidgetComponent], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); downloadService = TestBed.inject(DownloadService); processContentService = TestBed.inject(ProcessContentService); diff --git a/lib/process-services/src/lib/form/widgets/radio-buttons/radio-buttons.widget.spec.ts b/lib/process-services/src/lib/form/widgets/radio-buttons/radio-buttons.widget.spec.ts index 4839b2213a..ff1c900205 100644 --- a/lib/process-services/src/lib/form/widgets/radio-buttons/radio-buttons.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/radio-buttons/radio-buttons.widget.spec.ts @@ -24,10 +24,8 @@ import { FormFieldOption, FormFieldModel, FormModel, - AlfrescoApiServiceMock, AppConfigServiceMock, AppConfigService, - AlfrescoApiService, NoopTranslateModule } from '@alfresco/adf-core'; import { RadioButtonsWidgetComponent } from './radio-buttons.widget'; @@ -36,6 +34,7 @@ import { ProcessDefinitionService } from '../../services/process-definition.serv import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatRadioButtonHarness, MatRadioGroupHarness } from '@angular/material/radio/testing'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; describe('RadioButtonsWidgetComponent', () => { let formService: FormService; diff --git a/lib/process-services/src/lib/process-comments/services/comment-process.service.ts b/lib/process-services/src/lib/process-comments/services/comment-process.service.ts index 6e91270041..e5bea56b1c 100644 --- a/lib/process-services/src/lib/process-comments/services/comment-process.service.ts +++ b/lib/process-services/src/lib/process-comments/services/comment-process.service.ts @@ -15,9 +15,10 @@ * limitations under the License. */ +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; -import { CommentModel, AlfrescoApiService, CommentsService, User } from '@alfresco/adf-core'; +import { CommentModel, CommentsService, User } from '@alfresco/adf-core'; import { map } from 'rxjs/operators'; import { ActivitiCommentsApi } from '@alfresco/js-api'; import { PeopleProcessService } from '../../services/people-process.service'; diff --git a/lib/process-services/src/lib/process-list/services/process-filter.service.spec.ts b/lib/process-services/src/lib/process-list/services/process-filter.service.spec.ts index 78ce31f05c..d3934dd9bf 100644 --- a/lib/process-services/src/lib/process-list/services/process-filter.service.spec.ts +++ b/lib/process-services/src/lib/process-list/services/process-filter.service.spec.ts @@ -20,6 +20,7 @@ import { ProcessFilterService } from './process-filter.service'; import { CoreTestingModule } from '@alfresco/adf-core'; import { ProcessInstanceFilterRepresentation, UserProcessInstanceFilterRepresentation } from '@alfresco/js-api'; import { of } from 'rxjs'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; declare let jasmine: any; @@ -49,7 +50,8 @@ describe('Process filter', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [CoreTestingModule], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(ProcessFilterService); }); diff --git a/lib/process-services/src/lib/process-list/services/process-filter.service.ts b/lib/process-services/src/lib/process-list/services/process-filter.service.ts index da0ef6c002..03bb7bf478 100644 --- a/lib/process-services/src/lib/process-list/services/process-filter.service.ts +++ b/lib/process-services/src/lib/process-list/services/process-filter.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; import { Observable, from, forkJoin } from 'rxjs'; import { map } from 'rxjs/operators'; diff --git a/lib/process-services/src/lib/process-list/services/process.service.ts b/lib/process-services/src/lib/process-list/services/process.service.ts index 19641e54c3..7cbd24721b 100644 --- a/lib/process-services/src/lib/process-list/services/process.service.ts +++ b/lib/process-services/src/lib/process-list/services/process.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoApiService, DateFnsUtils, FormValues } from '@alfresco/adf-core'; +import { DateFnsUtils, FormValues } from '@alfresco/adf-core'; import { inject, Injectable } from '@angular/core'; import { FormDefinitionRepresentation, @@ -31,6 +31,7 @@ import { ProcessDefinitionRepresentation, TaskRepresentation } from '@alfresco/js-api'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { from, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { DatePipe } from '@angular/common'; diff --git a/lib/process-services/src/lib/services/apps-process.service.ts b/lib/process-services/src/lib/services/apps-process.service.ts index e6a55c094d..42efe3f1a7 100644 --- a/lib/process-services/src/lib/services/apps-process.service.ts +++ b/lib/process-services/src/lib/services/apps-process.service.ts @@ -18,7 +18,7 @@ import { Injectable } from '@angular/core'; import { RuntimeAppDefinitionsApi, AppDefinitionRepresentation } from '@alfresco/js-api'; import { Observable, from } from 'rxjs'; -import { AlfrescoApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { map } from 'rxjs/operators'; @Injectable({ diff --git a/lib/process-services/src/lib/services/people-process.service.spec.ts b/lib/process-services/src/lib/services/people-process.service.spec.ts index 775056a51c..03c35b9147 100644 --- a/lib/process-services/src/lib/services/people-process.service.spec.ts +++ b/lib/process-services/src/lib/services/people-process.service.spec.ts @@ -19,6 +19,7 @@ import { fakeAsync, TestBed } from '@angular/core/testing'; import { PeopleProcessService } from './people-process.service'; import { CoreTestingModule } from '@alfresco/adf-core'; import { LightUserRepresentation } from '@alfresco/js-api'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; declare let jasmine: any; @@ -45,7 +46,8 @@ describe('PeopleProcessService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [CoreTestingModule], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(PeopleProcessService); }); diff --git a/lib/process-services/src/lib/services/people-process.service.ts b/lib/process-services/src/lib/services/people-process.service.ts index 974948a25a..1002ca0881 100644 --- a/lib/process-services/src/lib/services/people-process.service.ts +++ b/lib/process-services/src/lib/services/people-process.service.ts @@ -17,8 +17,9 @@ import { Injectable } from '@angular/core'; import { Observable, from } from 'rxjs'; -import { AlfrescoApiService, GroupModel } from '@alfresco/adf-core'; +import { GroupModel } from '@alfresco/adf-core'; import { map } from 'rxjs/operators'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { TaskActionsApi, UsersApi, ActivitiGroupsApi, UserProfileApi, UserRepresentation, LightUserRepresentation } from '@alfresco/js-api'; @Injectable({ diff --git a/lib/process-services/src/lib/services/task-comments.service.ts b/lib/process-services/src/lib/services/task-comments.service.ts index 39779b80e9..e20ab9187d 100644 --- a/lib/process-services/src/lib/services/task-comments.service.ts +++ b/lib/process-services/src/lib/services/task-comments.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, CommentModel, CommentsService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; +import { CommentModel, CommentsService } from '@alfresco/adf-core'; import { ActivitiCommentsApi } from '@alfresco/js-api'; import { inject, Injectable } from '@angular/core'; import { from, Observable } from 'rxjs'; diff --git a/lib/process-services/src/lib/task-list/components/task-list/task-list.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-list/task-list.component.spec.ts index 14f28a45ca..f34b374fa8 100644 --- a/lib/process-services/src/lib/task-list/components/task-list/task-list.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-list/task-list.component.spec.ts @@ -25,8 +25,6 @@ import { DataCellEvent, ObjectDataColumn, AppConfigServiceMock, - AlfrescoApiServiceMock, - AlfrescoApiService, DataColumnComponent, DataColumnListComponent, FullNamePipe, @@ -44,6 +42,7 @@ import { HarnessLoader } from '@angular/cdk/testing'; import { MatCheckboxHarness } from '@angular/material/checkbox/testing'; import { MatMenuItemHarness } from '@angular/material/menu/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { CommonModule } from '@angular/common'; declare let jasmine: any; diff --git a/lib/process-services/src/lib/task-list/services/task-filter.service.ts b/lib/process-services/src/lib/task-list/services/task-filter.service.ts index c7ac5f780a..c418a3e43a 100644 --- a/lib/process-services/src/lib/task-list/services/task-filter.service.ts +++ b/lib/process-services/src/lib/task-list/services/task-filter.service.ts @@ -15,11 +15,11 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; import { inject, Injectable } from '@angular/core'; import { Observable, forkJoin, from } from 'rxjs'; import { map } from 'rxjs/operators'; import { UserFiltersApi, UserTaskFilterRepresentation } from '@alfresco/js-api'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; @Injectable({ providedIn: 'root' diff --git a/lib/process-services/src/lib/task-list/services/tasklist.service.ts b/lib/process-services/src/lib/task-list/services/tasklist.service.ts index a0146f9d60..4db6986f58 100644 --- a/lib/process-services/src/lib/task-list/services/tasklist.service.ts +++ b/lib/process-services/src/lib/task-list/services/tasklist.service.ts @@ -15,7 +15,6 @@ * limitations under the License. */ -import { AlfrescoApiService } from '@alfresco/adf-core'; import { inject, Injectable } from '@angular/core'; import { Observable, from, of } from 'rxjs'; import { map, catchError, flatMap, filter } from 'rxjs/operators'; @@ -31,6 +30,7 @@ import { UserTaskFilterRepresentation, TaskRepresentation } from '@alfresco/js-api'; +import { AlfrescoApiService } from '@alfresco/adf-content-services'; @Injectable({ providedIn: 'root' diff --git a/lib/process-services/src/lib/testing/process.testing.module.ts b/lib/process-services/src/lib/testing/process.testing.module.ts index f2756c3122..679e11ada2 100644 --- a/lib/process-services/src/lib/testing/process.testing.module.ts +++ b/lib/process-services/src/lib/testing/process.testing.module.ts @@ -15,12 +15,11 @@ * limitations under the License. */ +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { NgModule } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { ProcessModule } from '../process.module'; import { - AlfrescoApiService, - AlfrescoApiServiceMock, AppConfigService, AppConfigServiceMock, CoreModule, diff --git a/package-lock.json b/package-lock.json index 2aaa4963ac..c43a1869bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,7 @@ "rxjs": "7.8.1", "subscriptions-transport-ws": "^0.11.0", "superagent": "^9.0.1", + "ts-morph": "^20.0.0", "tslib": "^2.6.2", "zone.js": "~0.11.4" }, @@ -622,11 +623,27 @@ "webpack": "^5.0.0" } }, + "node_modules/@angular-devkit/build-angular/node_modules/css-loader/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@angular-devkit/build-angular/node_modules/es-module-lexer": { "version": "0.9.3", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", - "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=4.0" + } }, "node_modules/@angular-devkit/build-angular/node_modules/eslint-scope": { "version": "5.1.1", @@ -656,6 +673,18 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/@angular-devkit/build-angular/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@angular-devkit/build-angular/node_modules/mini-css-extract-plugin": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.7.2.tgz", @@ -759,6 +788,58 @@ } } }, + "node_modules/@angular-devkit/build-angular/node_modules/schema-utils": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/@angular-devkit/build-angular/node_modules/schema-utils/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@angular-devkit/build-angular/node_modules/schema-utils/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/@angular-devkit/build-angular/node_modules/schema-utils/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/@angular-devkit/build-angular/node_modules/tslib": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", @@ -830,6 +911,12 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/@angular-devkit/build-angular/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/@angular-devkit/build-webpack": { "version": "0.1502.11", "resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.1502.11.tgz", @@ -1724,9 +1811,9 @@ } }, "node_modules/@babel/helper-compilation-targets/node_modules/browserslist": { - "version": "4.23.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.2.tgz", - "integrity": "sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", + "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", "funding": [ { "type": "opencollective", @@ -1742,9 +1829,9 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001640", - "electron-to-chromium": "^1.4.820", - "node-releases": "^2.0.14", + "caniuse-lite": "^1.0.30001646", + "electron-to-chromium": "^1.5.4", + "node-releases": "^2.0.18", "update-browserslist-db": "^1.1.0" }, "bin": { @@ -1763,18 +1850,16 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.8.tgz", - "integrity": "sha512-4f6Oqnmyp2PP3olgUMmOwC3akxSm5aBYraQ6YDdKy7NcAMkDECHWG0DEnV6M2UAkERgIBhYt8S27rURPg7SxWA==", + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.0.tgz", + "integrity": "sha512-GYM6BxeQsETc9mnct+nIIpf63SAyzvyYN7UB/IlTyd+MBg06afFGp0mIeUqGyWgS2mxad6vqbMrHVlaL3m70sQ==", "dependencies": { "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-environment-visitor": "^7.24.7", - "@babel/helper-function-name": "^7.24.7", "@babel/helper-member-expression-to-functions": "^7.24.8", "@babel/helper-optimise-call-expression": "^7.24.7", - "@babel/helper-replace-supers": "^7.24.7", + "@babel/helper-replace-supers": "^7.25.0", "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/traverse": "^7.25.0", "semver": "^6.3.1" }, "engines": { @@ -1795,17 +1880,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-create-class-features-plugin/node_modules/@babel/helper-split-export-declaration": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz", - "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==", - "dependencies": { - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-create-class-features-plugin/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -1879,6 +1953,7 @@ "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", + "devOptional": true, "dependencies": { "@babel/types": "^7.24.7" }, @@ -1886,31 +1961,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-function-name": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz", - "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==", - "dependencies": { - "@babel/template": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name/node_modules/@babel/template": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", - "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", - "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/parser": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-member-expression-to-functions": { "version": "7.24.8", "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.8.tgz", @@ -2140,9 +2190,12 @@ } }, "node_modules/@babel/parser": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.0.tgz", - "integrity": "sha512-CzdIU9jdP0dg7HdyB+bHvDJGagUv+qtzZt5rYCWwW6tITNqV9odjp6Qu41gkG0ca5UfdDUWrKkiAnHHdGRnOrA==", + "version": "7.25.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.3.tgz", + "integrity": "sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==", + "dependencies": { + "@babel/types": "^7.25.2" + }, "bin": { "parser": "bin/babel-parser.js" }, @@ -2282,14 +2335,14 @@ } }, "node_modules/@babel/plugin-proposal-decorators": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.24.7.tgz", - "integrity": "sha512-RL9GR0pUG5Kc8BUWLNDm2T5OpYwSX15r98I0IkgmRQTXuELq/OynH8xtMTMvTJFjXbMWFVTKtYkTaYQsuAwQlQ==", + "version": "7.21.0", "dev": true, "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-decorators": "^7.24.7" + "@babel/helper-create-class-features-plugin": "^7.21.0", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-replace-supers": "^7.20.7", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/plugin-syntax-decorators": "^7.21.0" }, "engines": { "node": ">=6.9.0" @@ -2557,12 +2610,10 @@ } }, "node_modules/@babel/plugin-syntax-decorators": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.24.7.tgz", - "integrity": "sha512-Ui4uLJJrRV1lb38zg1yYTmRKmiZLiftDEvZN2iq3kd9kUFU+PttmzTbAFC2ucRk/XJmtek6G23gPsuZbhrT8fQ==", + "version": "7.21.0", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -2953,13 +3004,13 @@ } }, "node_modules/@babel/plugin-transform-computed-properties/node_modules/@babel/template": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", - "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz", + "integrity": "sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==", "dependencies": { "@babel/code-frame": "^7.24.7", - "@babel/parser": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/parser": "^7.25.0", + "@babel/types": "^7.25.0" }, "engines": { "node": ">=6.9.0" @@ -3571,13 +3622,14 @@ } }, "node_modules/@babel/plugin-transform-typescript": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.24.8.tgz", - "integrity": "sha512-CgFgtN61BbdOGCP4fLaAMOPkzWUh6yQZNMr5YSt8uz2cZSSiQONCQFWqsE4NeVfOIhqDOlS9CR3WD91FzMeB2Q==", + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.25.2.tgz", + "integrity": "sha512-lBwRvjSmqiMYe/pS0+1gggjJleUJi7NzjvQ1Fkqtt69hBa/0t1YuW/MLQMAPixfwaQOHUXsd6jeU3Z+vdGv3+A==", "dependencies": { "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-create-class-features-plugin": "^7.24.8", + "@babel/helper-create-class-features-plugin": "^7.25.0", "@babel/helper-plugin-utils": "^7.24.8", + "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", "@babel/plugin-syntax-typescript": "^7.24.7" }, "engines": { @@ -11836,9 +11888,8 @@ }, "node_modules/@tootallnate/once": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } @@ -11852,29 +11903,87 @@ "node": ">=10.13.0" } }, + "node_modules/@ts-morph/common": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.21.0.tgz", + "integrity": "sha512-ES110Mmne5Vi4ypUKrtVQfXFDtCsDXiUiGxF6ILVlE90dDD4fdpC1LSjydl/ml7xJWKSDZwUYD2zkOePMSrPBA==", + "dependencies": { + "fast-glob": "^3.2.12", + "minimatch": "^7.4.3", + "mkdirp": "^2.1.6", + "path-browserify": "^1.0.1" + } + }, + "node_modules/@ts-morph/common/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@ts-morph/common/node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/@ts-morph/common/node_modules/minimatch": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.6.tgz", + "integrity": "sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@ts-morph/common/node_modules/mkdirp": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.6.tgz", + "integrity": "sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A==", + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@tsconfig/node10": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", - "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", - "dev": true + "version": "1.0.9", + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node12": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node14": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true + "version": "1.0.3", + "dev": true, + "license": "MIT" }, "node_modules/@tufjs/canonical-json": { "version": "1.0.0", @@ -11923,9 +12032,9 @@ } }, "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "version": "7.20.3", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.3.tgz", + "integrity": "sha512-54fjTSeSHwfan8AyHWrKbfBWiEUrNTZsUwPTDSNaaP1QDQIZbeNUg3a59E9D+375MzUw/x1vx2/0F5LBz+AeYA==", "dev": true, "dependencies": { "@babel/parser": "^7.20.7", @@ -13075,6 +13184,18 @@ "balanced-match": "^1.0.0" } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", @@ -13091,10 +13212,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { "semver": "bin/semver.js" }, @@ -13102,6 +13226,12 @@ "node": ">=10" } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/@typescript-eslint/utils": { "version": "5.48.2", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.2.tgz", @@ -15454,9 +15584,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001643", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz", - "integrity": "sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg==", + "version": "1.0.30001649", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001649.tgz", + "integrity": "sha512-fJegqZZ0ZX8HOWr6rcafGr72+xcgJKI9oWfDW5DrD7ExUtgZC7a7R7ZYmZqplh7XDocFdGeIFn7roAxhOeYrPQ==", "funding": [ { "type": "opencollective", @@ -15902,6 +16032,11 @@ "node": ">= 0.12.0" } }, + "node_modules/code-block-writer": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-12.0.0.tgz", + "integrity": "sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w==" + }, "node_modules/collapse-white-space": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.6.tgz", @@ -16400,11 +16535,11 @@ } }, "node_modules/core-js-compat": { - "version": "3.37.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.37.1.tgz", - "integrity": "sha512-9TNiImhKvQqSUkOvk/mMRZzOANTiEVC7WaBNhHcKM7x+/5E1l5NvsysR19zuDQScE8k+kfQXWRN3AtS/eOSHpg==", + "version": "3.38.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.0.tgz", + "integrity": "sha512-75LAicdLa4OJVwFxFbQR3NdnZjNgX6ILpVcVzcC4T2smerB5lELMrJQQQoWV6TiuC/vlaFqgU2tKQx9w5s0e0A==", "dependencies": { - "browserslist": "^4.23.0" + "browserslist": "^4.23.3" }, "funding": { "type": "opencollective", @@ -16412,9 +16547,9 @@ } }, "node_modules/core-js-compat/node_modules/browserslist": { - "version": "4.23.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.2.tgz", - "integrity": "sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA==", + "version": "4.23.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz", + "integrity": "sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==", "funding": [ { "type": "opencollective", @@ -16430,9 +16565,9 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001640", - "electron-to-chromium": "^1.4.820", - "node-releases": "^2.0.14", + "caniuse-lite": "^1.0.30001646", + "electron-to-chromium": "^1.5.4", + "node-releases": "^2.0.18", "update-browserslist-db": "^1.1.0" }, "bin": { @@ -16866,11 +17001,25 @@ } } }, - "node_modules/css-loader/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "node_modules/css-loader/node_modules/lru-cache": { + "version": "6.0.0", "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/css-loader/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { "semver": "bin/semver.js" }, @@ -16878,6 +17027,11 @@ "node": ">=10" } }, + "node_modules/css-loader/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, "node_modules/css-minimizer-webpack-plugin": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-3.4.1.tgz", @@ -18128,9 +18282,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.1.tgz", - "integrity": "sha512-FKbOCOQ5QRB3VlIbl1LZQefWIYwszlBloaXcY2rbfpu9ioJnNh3TK03YtIDKDo3WKBi8u+YV4+Fn2CkEozgf4w==" + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.5.tgz", + "integrity": "sha512-QR7/A7ZkMS8tZuoftC/jfqNkZLQO779SSW3YuZHP4eXpj3EffGLFcB/Xu9AAZQzLccTiCV+EmUo3ha4mQ9wnlA==" }, "node_modules/emittery": { "version": "0.13.1", @@ -19101,11 +19255,46 @@ "node": ">=6" } }, - "node_modules/eslint-plugin-unicorn/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "node_modules/eslint-plugin-unicorn/node_modules/lru-cache": { + "version": "6.0.0", "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-plugin-unicorn/node_modules/regjsparser": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.10.0.tgz", + "integrity": "sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==", + "dev": true, + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/eslint-plugin-unicorn/node_modules/regjsparser/node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/eslint-plugin-unicorn/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { "semver": "bin/semver.js" }, @@ -19113,6 +19302,11 @@ "node": ">=10" } }, + "node_modules/eslint-plugin-unicorn/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -20276,6 +20470,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -28631,9 +28826,7 @@ }, "node_modules/path-browserify": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true + "license": "MIT" }, "node_modules/path-exists": { "version": "4.0.0", @@ -31202,27 +31395,6 @@ "regjsparser": "bin/parser" } }, - "node_modules/regjsparser": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.10.0.tgz", - "integrity": "sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==", - "dev": true, - "dependencies": { - "jsesc": "~0.5.0" - }, - "bin": { - "regjsparser": "bin/parser" - } - }, - "node_modules/regjsparser/node_modules/jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - } - }, "node_modules/rehackt": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/rehackt/-/rehackt-0.1.0.tgz", @@ -32244,8 +32416,7 @@ }, "node_modules/semver/node_modules/lru-cache": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "license": "ISC", "dependencies": { "yallist": "^4.0.0" }, @@ -32255,8 +32426,7 @@ }, "node_modules/semver/node_modules/yallist": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "license": "ISC" }, "node_modules/send": { "version": "0.18.0", @@ -34396,6 +34566,19 @@ "node": ">=14.18.0" } }, + "node_modules/superagent/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/superagent/node_modules/mime": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", @@ -35270,6 +35453,15 @@ "node": ">=8" } }, + "node_modules/ts-morph": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-20.0.0.tgz", + "integrity": "sha512-JVmEJy2Wow5n/84I3igthL9sudQ8qzjh/6i4tmYCm6IqYyKFlNbJZi7oBdjyqcWSWYRu3CtL0xbT6fS03ESZIg==", + "dependencies": { + "@ts-morph/common": "~0.21.0", + "code-block-writer": "^12.0.0" + } + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", diff --git a/package.json b/package.json index cca25d14bd..d2c40533b8 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "rxjs": "7.8.1", "subscriptions-transport-ws": "^0.11.0", "superagent": "^9.0.1", + "ts-morph": "^20.0.0", "tslib": "^2.6.2", "zone.js": "~0.11.4" }, diff --git a/scripts/github/release/set-migrations.js b/scripts/github/release/set-migrations.js new file mode 100644 index 0000000000..c6d70ec716 --- /dev/null +++ b/scripts/github/release/set-migrations.js @@ -0,0 +1,69 @@ +const fs = require('fs'); +const semver = require('semver'); + +const getFile = (path) => { + const rawFile = fs.readFileSync(path, 'utf8'); + const file = JSON.parse(rawFile); + + return file; +}; + +const setMigration = () => { + const corePackagePath = 'lib/core/package.json'; + const jaApiConfigPackagePath = 'lib/js-api/package.json'; + const coreMigrationConfigPath = 'lib/core/schematics/migrations/collection.json'; + + const corePackage = getFile(corePackagePath); + const coreMigration = getFile(coreMigrationConfigPath); + const jsApiPackage = getFile(jaApiConfigPackagePath); + + const coreVersion = corePackage.version; + + const coreMigrations = [ + { + name: 'move-out-alfresco-api', + allowedVersionScope: '<=7.0.0' + } + ]; + + console.log(`Core version is ${coreVersion}`); + + coreMigrations.forEach((migration) => { + const isCoreVersionValid = semver.satisfies(semver.coerce(coreVersion), migration.allowedVersionScope); + + console.log(`Allowed scope for '${migration.name}' is ${migration.allowedVersionScope}`); + console.log(`${coreVersion} is ${isCoreVersionValid ? 'VALID' : 'NOT VALID'} for ${migration.name}`); + + if (!isCoreVersionValid) { + console.log(`Skipping migration for ${migration.name}`); + return; + } + + coreMigration['schematics'][migration.name]['version'] = coreVersion; + + const packageJsonUpdates = coreMigration['packageJsonUpdates']; + + if (packageJsonUpdates) { + packageJsonUpdates[migration.name]['version'] = coreVersion; + const packagesToUpdate = packageJsonUpdates[migration.name]['packages']; + + Object.keys(packagesToUpdate).forEach((packageName) => { + if (packageName === 'ts-morph') { + return; + } + + if (packageName === '@alfresco/js-api') { + packagesToUpdate[packageName]['version'] = jsApiPackage.version; + } else { + packagesToUpdate[packageName]['version'] = coreVersion; + } + }); + } + }); + + console.log('\nmigrations:', JSON.stringify(coreMigration, null, 2)); + + fs.writeFileSync(coreMigrationConfigPath, JSON.stringify(coreMigration, null, 2)); +}; + +module.exports = setMigration;