From 57eb75d855ca1c14cc9413d860a87fb8077b8e43 Mon Sep 17 00:00:00 2001 From: VitoAlbano Date: Tue, 15 Oct 2024 16:42:47 +0100 Subject: [PATCH] Improved solutio for token with no need to set it explicitly --- app/src/app/app.module.ts | 5 +- package-lock.json | 60 +++++++++---------- package.json | 12 ++-- .../context-menu/context-menu.service.spec.ts | 9 +-- .../datatable-cell-badges.component.spec.ts | 4 +- .../name-column/name-column.component.spec.ts | 4 +- .../src/lib/testing/lib-testing-module.ts | 5 +- 7 files changed, 46 insertions(+), 53 deletions(-) diff --git a/app/src/app/app.module.ts b/app/src/app/app.module.ts index 9d7ed37953..2880ea729f 100644 --- a/app/src/app/app.module.ts +++ b/app/src/app/app.module.ts @@ -25,7 +25,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { AuthGuard, AuthModule, CoreModule, JWT_STORAGE_SERVICE, StorageService, TRANSLATION_PROVIDER } from '@alfresco/adf-core'; +import { AuthGuard, AuthModule, CoreModule, TRANSLATION_PROVIDER } from '@alfresco/adf-core'; import { AppService } from '@alfresco/aca-shared'; import { AppExtensionsModule } from './extensions.module'; @@ -111,8 +111,7 @@ registerLocaleData(localeSv); name: 'app', source: 'assets' } - }, - { provide: JWT_STORAGE_SERVICE, useClass: StorageService } + } ], declarations: [AppComponent], bootstrap: [AppComponent] diff --git a/package-lock.json b/package-lock.json index b5156bfd3e..9c2f169404 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,11 +9,11 @@ "version": "6.0.0", "license": "LGPL-3.0", "dependencies": { - "@alfresco/adf-content-services": "7.0.0-alpha.4-11336342104", - "@alfresco/adf-core": "7.0.0-alpha.4-11336342104", - "@alfresco/adf-extensions": "7.0.0-alpha.4-11336342104", - "@alfresco/eslint-plugin-eslint-angular": "7.0.0-alpha.4-11336342104", - "@alfresco/js-api": ">=8.0.0-alpha.4-11336342104", + "@alfresco/adf-content-services": "7.0.0-alpha.4-11348846149", + "@alfresco/adf-core": "7.0.0-alpha.4-11348846149", + "@alfresco/adf-extensions": "7.0.0-alpha.4-11348846149", + "@alfresco/eslint-plugin-eslint-angular": "7.0.0-alpha.4-11348846149", + "@alfresco/js-api": ">=8.0.0-alpha.4-11348846149", "@angular/animations": "16.2.9", "@angular/cdk": "16.2.9", "@angular/common": "16.2.9", @@ -41,7 +41,7 @@ "zone.js": "0.13.3" }, "devDependencies": { - "@alfresco/adf-cli": "7.0.0-alpha.4-11336342104", + "@alfresco/adf-cli": "7.0.0-alpha.4-11348846149", "@angular-devkit/build-angular": "16.2.9", "@angular-devkit/core": "16.2.9", "@angular-devkit/schematics": "16.2.9", @@ -106,12 +106,12 @@ "dev": true }, "node_modules/@alfresco/adf-cli": { - "version": "7.0.0-alpha.4-11336342104", - "resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-7.0.0-alpha.4-11336342104.tgz", - "integrity": "sha512-8g+Lyg5L1sMqpo03IKB6vExEFoWXY5iMsCAGbKw2emI+GzP1KVFS+CiwFvpyd0puMnlU9KNtLQ6UMtv0O0ksmg==", + "version": "7.0.0-alpha.4-11348846149", + "resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-7.0.0-alpha.4-11348846149.tgz", + "integrity": "sha512-/FGtu91ZX7eD2dOLbr8gEWj0a70i7wqt5Zlb9h6ALt+rg6miRPMUkPv4PsaO7gLU43bQxUC86cxBjRPgKaeu6A==", "dev": true, "dependencies": { - "@alfresco/js-api": ">=8.0.0-alpha.4-11336342104", + "@alfresco/js-api": ">=8.0.0-alpha.4-11348846149", "commander": "^6.2.1", "ejs": "^3.1.9", "license-checker": "^25.0.1", @@ -144,15 +144,15 @@ "dev": true }, "node_modules/@alfresco/adf-content-services": { - "version": "7.0.0-alpha.4-11336342104", - "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-7.0.0-alpha.4-11336342104.tgz", - "integrity": "sha512-AMj+PFtwXZWP5rO/Mi9aJmBfHgM+IlPK20eshWJw+msMv1asF+MFPoA+UrgNM97ERDUjnYFHFFxrySmpxgkDOQ==", + "version": "7.0.0-alpha.4-11348846149", + "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-7.0.0-alpha.4-11348846149.tgz", + "integrity": "sha512-2+q68L6MLjSXn6CdVD7I6hZrvz8nZ475bNXwGdgPQ7d8hWyBu5yOnL0CfBj9BMSpi1xN4L9c/hccpl6Z5/FKeQ==", "dependencies": { "tslib": "^2.3.0" }, "peerDependencies": { - "@alfresco/adf-core": ">=7.0.0-alpha.4-11336342104", - "@alfresco/js-api": ">=8.0.0-alpha.4-11336342104", + "@alfresco/adf-core": ">=7.0.0-alpha.4-11348846149", + "@alfresco/js-api": ">=8.0.0-alpha.4-11348846149", "@angular/animations": ">=14.1.3", "@angular/cdk": ">=14.1.2", "@angular/common": ">=14.1.3", @@ -167,9 +167,9 @@ } }, "node_modules/@alfresco/adf-core": { - "version": "7.0.0-alpha.4-11336342104", - "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-7.0.0-alpha.4-11336342104.tgz", - "integrity": "sha512-+Simb9zKf4TyQOWl0AMuCt2JEtK8L6D7Jgpmx8xFgnirw/Jn8OcPoC6REZ5sOI48n3sL2ZkO1NtZfzzwyTj4Ag==", + "version": "7.0.0-alpha.4-11348846149", + "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-7.0.0-alpha.4-11348846149.tgz", + "integrity": "sha512-EVrMD2urXTxj6PxL1+Jw5IiMJsQOo350Dzr+T+iwvYcRl8FU99ZMyDEW7skhA7/0BshG75ZtsHZU3MUpcP60Qg==", "dependencies": { "angular-oauth2-oidc": "^15.0.1", "angular-oauth2-oidc-jwks": "^17.0.2", @@ -177,8 +177,8 @@ "tslib": "^2.3.0" }, "peerDependencies": { - "@alfresco/adf-extensions": ">=7.0.0-alpha.4-11336342104", - "@alfresco/js-api": ">=8.0.0-alpha.4-11336342104", + "@alfresco/adf-extensions": ">=7.0.0-alpha.4-11348846149", + "@alfresco/js-api": ">=8.0.0-alpha.4-11348846149", "@angular/animations": ">=14.1.3", "@angular/cdk": ">=14.1.2", "@angular/common": ">=14.1.3", @@ -194,31 +194,31 @@ } }, "node_modules/@alfresco/adf-extensions": { - "version": "7.0.0-alpha.4-11336342104", - "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-7.0.0-alpha.4-11336342104.tgz", - "integrity": "sha512-j5UyYo0FSz/cvHsrUFhuhWCagh6qwTFHSvPMupqfAsQr3yhrMCnGoI8mJJ1U4PUQpkgvCTLfPe/o6x2SURR7ag==", + "version": "7.0.0-alpha.4-11348846149", + "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-7.0.0-alpha.4-11348846149.tgz", + "integrity": "sha512-kT27O+mP0osNWnlJCLsUSxO5u+TXK7clP2n4W6NKt4XgSxAuX04uropwxFvITfNRVmQMO9bgn8oxo2y8bkZwLw==", "dependencies": { "tslib": "^2.3.0" }, "peerDependencies": { - "@alfresco/js-api": ">=8.0.0-alpha.4-11336342104", + "@alfresco/js-api": ">=8.0.0-alpha.4-11348846149", "@angular/common": ">=14.1.3", "@angular/core": ">=14.1.3" } }, "node_modules/@alfresco/eslint-plugin-eslint-angular": { - "version": "7.0.0-alpha.4-11336342104", - "resolved": "https://registry.npmjs.org/@alfresco/eslint-plugin-eslint-angular/-/eslint-plugin-eslint-angular-7.0.0-alpha.4-11336342104.tgz", - "integrity": "sha512-cQfiU1kkQ21yvp7vwYnX4AlVv+HvPHTOBitEL6lrbI5D2sxdyckoourVO9kAklQW2ztpuxfnNFvxGlT4qjv0Gg==", + "version": "7.0.0-alpha.4-11348846149", + "resolved": "https://registry.npmjs.org/@alfresco/eslint-plugin-eslint-angular/-/eslint-plugin-eslint-angular-7.0.0-alpha.4-11348846149.tgz", + "integrity": "sha512-vW6DVRLMJyG2U/ANBeCyBhvKjvcPnC1GLoRkzTtIL3CBx3xQJFpY5ZGUx3P85ME1hZqQHoFXsdy+E8JoLvt31Q==", "dependencies": { "@angular-eslint/utils": "16.0.3", "@typescript-eslint/utils": "5.59.7" } }, "node_modules/@alfresco/js-api": { - "version": "8.0.0-alpha.4-11336342104", - "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-8.0.0-alpha.4-11336342104.tgz", - "integrity": "sha512-Kjd8aa0jd7krmgBbZKvRuHSHErC1HwLU83apZLxuLM6zbph51ma5R7zTHNfTOpBev6HFq09TJgWKy97iAlnt9Q==", + "version": "8.0.0-alpha.4-11348846149", + "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-8.0.0-alpha.4-11348846149.tgz", + "integrity": "sha512-i3DzYY9S76TjsN4BLe9pZryYjnrQH6p2aNTsLJ4iBvy1MvPpY7hMNiB9OceuUYIw2udm339NQ1pX74UKY5/B5w==", "dependencies": { "event-emitter": "^0.3.5", "superagent": "^9.0.1", diff --git a/package.json b/package.json index 64bea983d4..3c4e90b50d 100644 --- a/package.json +++ b/package.json @@ -30,11 +30,11 @@ }, "private": true, "dependencies": { - "@alfresco/adf-content-services": "7.0.0-alpha.4-11336342104", - "@alfresco/adf-core": "7.0.0-alpha.4-11336342104", - "@alfresco/adf-extensions": "7.0.0-alpha.4-11336342104", - "@alfresco/eslint-plugin-eslint-angular": "7.0.0-alpha.4-11336342104", - "@alfresco/js-api": ">=8.0.0-alpha.4-11336342104", + "@alfresco/adf-content-services": "7.0.0-alpha.4-11348846149", + "@alfresco/adf-core": "7.0.0-alpha.4-11348846149", + "@alfresco/adf-extensions": "7.0.0-alpha.4-11348846149", + "@alfresco/eslint-plugin-eslint-angular": "7.0.0-alpha.4-11348846149", + "@alfresco/js-api": ">=8.0.0-alpha.4-11348846149", "@angular/animations": "16.2.9", "@angular/cdk": "16.2.9", "@angular/common": "16.2.9", @@ -62,7 +62,7 @@ "zone.js": "0.13.3" }, "devDependencies": { - "@alfresco/adf-cli": "7.0.0-alpha.4-11336342104", + "@alfresco/adf-cli": "7.0.0-alpha.4-11348846149", "@angular-devkit/build-angular": "16.2.9", "@angular-devkit/core": "16.2.9", "@angular-devkit/schematics": "16.2.9", diff --git a/projects/aca-content/src/lib/components/context-menu/context-menu.service.spec.ts b/projects/aca-content/src/lib/components/context-menu/context-menu.service.spec.ts index 8c48d97bec..1e68d9483b 100644 --- a/projects/aca-content/src/lib/components/context-menu/context-menu.service.spec.ts +++ b/projects/aca-content/src/lib/components/context-menu/context-menu.service.spec.ts @@ -27,7 +27,7 @@ import { Overlay } from '@angular/cdk/overlay'; import { Injector } from '@angular/core'; import { Store } from '@ngrx/store'; import { of } from 'rxjs'; -import { AuthModule, CoreModule, JWT_STORAGE_SERVICE, StorageService, UserPreferencesService } from '@alfresco/adf-core'; +import { AuthModule, CoreModule, UserPreferencesService } from '@alfresco/adf-core'; import { ContextMenuService } from './context-menu.service'; import { TranslateModule } from '@ngx-translate/core'; import { ContextMenuComponent } from './context-menu.component'; @@ -52,12 +52,7 @@ describe('ContextMenuService', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), CoreModule.forRoot(), ContextMenuComponent, AuthModule.forRoot()], - providers: [ - Overlay, - { provide: Store, useValue: { select: () => of() } }, - UserPreferencesService, - { provide: JWT_STORAGE_SERVICE, useClass: StorageService } - ] + providers: [Overlay, { provide: Store, useValue: { select: () => of() } }, UserPreferencesService] }); injector = TestBed.inject(Injector); diff --git a/projects/aca-content/src/lib/components/dl-custom-components/datatable-cell-badges/datatable-cell-badges.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/datatable-cell-badges/datatable-cell-badges.component.spec.ts index a939923e83..fd957b88d2 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/datatable-cell-badges/datatable-cell-badges.component.spec.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/datatable-cell-badges/datatable-cell-badges.component.spec.ts @@ -26,7 +26,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { DatatableCellBadgesComponent } from './datatable-cell-badges.component'; import { AppExtensionService } from '@alfresco/aca-shared'; import { TranslateModule } from '@ngx-translate/core'; -import { AuthModule, JWT_STORAGE_SERVICE, StorageService } from '@alfresco/adf-core'; +import { AuthModule } from '@alfresco/adf-core'; import { Actions } from '@ngrx/effects'; import { NodeEntry } from '@alfresco/js-api'; import { of } from 'rxjs'; @@ -76,7 +76,7 @@ describe('DatatableCellBadgesComponent', () => { } ) ], - providers: [Actions, { provide: JWT_STORAGE_SERVICE, useClass: StorageService }] + providers: [Actions] }); fixture = TestBed.createComponent(DatatableCellBadgesComponent); diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts index cd4c73bfc4..d307248ed6 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts @@ -29,7 +29,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { HttpClientModule } from '@angular/common/http'; import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; -import { AuthModule, JWT_STORAGE_SERVICE, StorageService } from '@alfresco/adf-core'; +import { AuthModule } from '@alfresco/adf-core'; import { Component, Input } from '@angular/core'; import { NodeEntry } from '@alfresco/js-api'; @@ -70,7 +70,7 @@ describe('CustomNameColumnComponent', () => { } ) ], - providers: [Actions, { provide: JWT_STORAGE_SERVICE, useClass: StorageService }] + providers: [Actions] }); fixture = TestBed.createComponent(CustomNameColumnComponent); diff --git a/projects/aca-shared/src/lib/testing/lib-testing-module.ts b/projects/aca-shared/src/lib/testing/lib-testing-module.ts index c0daa2e675..fc44779772 100644 --- a/projects/aca-shared/src/lib/testing/lib-testing-module.ts +++ b/projects/aca-shared/src/lib/testing/lib-testing-module.ts @@ -25,7 +25,7 @@ import { Injectable, NgModule } from '@angular/core'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { JWT_STORAGE_SERVICE, StorageService, TranslateLoaderService, TranslationMock, TranslationService } from '@alfresco/adf-core'; +import { TranslateLoaderService, TranslationMock, TranslationService } from '@alfresco/adf-core'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { HttpClientModule } from '@angular/common/http'; import { RouterTestingModule } from '@angular/router/testing'; @@ -122,8 +122,7 @@ export class DocumentBasePageServiceMock extends DocumentBasePageService { exports: [TranslateModule], providers: [ { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, - { provide: TranslationService, useClass: TranslationMock }, - { provide: JWT_STORAGE_SERVICE, useClass: StorageService } + { provide: TranslationService, useClass: TranslationMock } ] }) export class LibTestingModule {}