From 80ddf816b0cd9094b55e856b095ef4700f1fb8d8 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Wed, 1 Apr 2020 16:11:44 +0200 Subject: [PATCH] More migration fixes --- projects/common-map/package-lock.json | 16 ++++++------ projects/common-map/package.json | 2 +- projects/common-map/tsconfig.lib.json | 3 ++- projects/common-map/tsconfig.lib.prod.json | 6 ----- .../src/fm/services/auth-guard.service.ts | 25 ++++++++----------- .../src/fm/shared/app.config.factory.ts | 15 +++-------- projects/common/tsconfig.lib.json | 5 ++-- projects/common/tsconfig.lib.prod.json | 6 ----- src/app/app.module.ts | 7 +++++- src/tsconfig.app.json | 17 +++++++------ 10 files changed, 43 insertions(+), 59 deletions(-) delete mode 100644 projects/common-map/tsconfig.lib.prod.json delete mode 100644 projects/common/tsconfig.lib.prod.json diff --git a/projects/common-map/package-lock.json b/projects/common-map/package-lock.json index e625661..12c549e 100644 --- a/projects/common-map/package-lock.json +++ b/projects/common-map/package-lock.json @@ -4,10 +4,10 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "elm-pep": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/elm-pep/-/elm-pep-1.0.6.tgz", - "integrity": "sha512-1DJ6ReFk8+GtgoqRiEhBo28K69Rxe9Bfc7h16+1VMQT2KlCuPBYj5W33OYa2AZpqkuqCBLhcNzO10zxJVakapA==" + "@openlayers/pepjs": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@openlayers/pepjs/-/pepjs-0.5.3.tgz", + "integrity": "sha512-Bgvi5c14BS0FJWyYWWFstNEnXsB30nK8Jt8hkAAdqr7E0gDdBBWVDglF3Ub19wTxvgJ/CVHyTY6VuCtnyRzglg==" }, "ieee754": { "version": "1.1.13", @@ -23,11 +23,11 @@ } }, "ol": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ol/-/ol-6.2.1.tgz", - "integrity": "sha512-CT2szew/COd7Zf9Bls+pdzewBYZNgyfxFivJ3L4Jv9Th7JdWjcQAT+pqMPH25L9SbVT+T17RCMq2H2m9uBCl1A==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/ol/-/ol-6.1.1.tgz", + "integrity": "sha512-0dL3i3eJqgOpqIjDKEY3grkeQnjAYfV5L/JCxhOu4SxiaizRwFrFgeas6LILRoxKa03jhQFbut2r2bbgcLGQeA==", "requires": { - "elm-pep": "^1.0.4", + "@openlayers/pepjs": "^0.5.3", "pbf": "3.2.1", "pixelworks": "1.1.0", "rbush": "^3.0.1" diff --git a/projects/common-map/package.json b/projects/common-map/package.json index 0632565..dcfac83 100644 --- a/projects/common-map/package.json +++ b/projects/common-map/package.json @@ -6,7 +6,7 @@ }, "dependencies": { "ngx-openlayers": "1.0.0-next.13", - "ol": "6.2.1" + "ol": "6.1.1" }, "peerDependencies": { "@angular/core": "^9.1.0", diff --git a/projects/common-map/tsconfig.lib.json b/projects/common-map/tsconfig.lib.json index a78ed73..250ae7a 100644 --- a/projects/common-map/tsconfig.lib.json +++ b/projects/common-map/tsconfig.lib.json @@ -22,7 +22,8 @@ "strictMetadataEmit": true, "fullTemplateTypeCheck": true, "strictInjectionParameters": true, - "enableResourceInlining": true + "enableResourceInlining": true, + "enableIvy": false }, "exclude": [ "src/test.ts", diff --git a/projects/common-map/tsconfig.lib.prod.json b/projects/common-map/tsconfig.lib.prod.json deleted file mode 100644 index b1d501a..0000000 --- a/projects/common-map/tsconfig.lib.prod.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.lib.json", - "angularCompilerOptions": { - "enableIvy": false - } -} \ No newline at end of file diff --git a/projects/common/src/fm/services/auth-guard.service.ts b/projects/common/src/fm/services/auth-guard.service.ts index 578e767..dd4720e 100644 --- a/projects/common/src/fm/services/auth-guard.service.ts +++ b/projects/common/src/fm/services/auth-guard.service.ts @@ -38,24 +38,19 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild { checkLogin(url: string): boolean { if (!this.oauthService.hasValidAccessToken()) { - this.oauthService.responseType - if(this.oauthService.responseType == "code") - if(this.oauthService.getRefreshToken() != null ) { - this.oauthService.refreshToken().then(() => { - this.store.dispatch(new appCommonActions.InitUser()); - return true; - }).catch(() => { - this.oauthService.initCodeFlow(url); - return false; - } - ) - } else { + if(this.oauthService.getRefreshToken() != null ) { + this.oauthService.refreshToken().then(() => { + this.store.dispatch(new appCommonActions.InitUser()); + return true; + }).catch(() => { this.oauthService.initCodeFlow(url); return false; - } - else - this.oauthService.initImplicitFlow(url); + } + ) + } else { + this.oauthService.initCodeFlow(url); return false; + } } else { this.store.dispatch(new appCommonActions.InitUser()); return true; diff --git a/projects/common/src/fm/shared/app.config.factory.ts b/projects/common/src/fm/shared/app.config.factory.ts index c630dbd..33f4b60 100644 --- a/projects/common/src/fm/shared/app.config.factory.ts +++ b/projects/common/src/fm/shared/app.config.factory.ts @@ -1,7 +1,7 @@ import { Injector } from '@angular/core'; import { Location} from '@angular/common'; import { Router,UrlSerializer } from '@angular/router'; -import { AuthConfig, OAuthService, JwksValidationHandler, OAuthErrorEvent, OAuthStorage } from 'angular-oauth2-oidc'; +import { AuthConfig, OAuthService, OAuthErrorEvent, OAuthStorage } from 'angular-oauth2-oidc'; import { AppConfig } from "./app.config"; import {ItemTypeService} from '../services/itemtype.service'; import { IAuthconfigFactory } from './authconfigFactory'; @@ -26,21 +26,12 @@ export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthS }); oauthService.configure(authconfigFactory.getAuthConfig(appConfig)); oauthService.setStorage(authStorage); - oauthService.tokenValidationHandler = new JwksValidationHandler(); - oauthService.tokenValidationHandler.validateAtHash = function () { - return new Promise((res) => { res(true); }) - }; oauthService.setupAutomaticSilentRefresh(); let location = injector.get(Location); let router = injector.get(Router); - let urlPath = location.path(); oauthService.loadDiscoveryDocument().then(() => { - oauthService.tryLogin({ - onTokenReceived: (info) => { - urlPath = info.state; - } - }).then(() => { - router.navigateByUrl(urlPath); + oauthService.tryLoginCodeFlow().then(() => { + router.navigateByUrl(decodeURIComponent(oauthService.state)); }); }) }).then(() => { diff --git a/projects/common/tsconfig.lib.json b/projects/common/tsconfig.lib.json index fb2ea98..592eaa2 100644 --- a/projects/common/tsconfig.lib.json +++ b/projects/common/tsconfig.lib.json @@ -29,10 +29,11 @@ "strictMetadataEmit": true, "fullTemplateTypeCheck": true, "strictInjectionParameters": true, - "enableResourceInlining": true + "enableResourceInlining": true, + "enableIvy": false }, "exclude": [ "src/test.ts", "**/*.spec.ts" - ] + ] } diff --git a/projects/common/tsconfig.lib.prod.json b/projects/common/tsconfig.lib.prod.json deleted file mode 100644 index b1d501a..0000000 --- a/projects/common/tsconfig.lib.prod.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.lib.json", - "angularCompilerOptions": { - "enableIvy": false - } -} \ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 0c85445..fd010c3 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -61,7 +61,12 @@ export function provideBootstrapEffects(effects: Type[]) { AppCommonServiceModule.forRoot(), AppCommonMapModule.forRoot(), BrowserModule, - StoreModule.forRoot({}), + StoreModule.forRoot({},{runtimeChecks: { // TODO fix this should all be true + strictStateImmutability: false, + strictActionImmutability: false, + strictStateSerializability: false, + strictActionSerializability: false + }}), EffectsModule.forRoot([]) ], providers: [ diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json index fb6673b..f17d500 100644 --- a/src/tsconfig.app.json +++ b/src/tsconfig.app.json @@ -1,8 +1,8 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/app", - "types": [] +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "types": [] }, "files": [ "main.ts", @@ -10,5 +10,8 @@ ], "include": [ "src/**/*.d.ts" - ] -} + ], + "angularCompilerOptions": { + "enableIvy": false + } +}