@daffodil/auth 0.53.0 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/esm2020/driver/in-memory/backend/auth.service.mjs +2 -2
  2. package/esm2020/routing/config/default.mjs +3 -1
  3. package/esm2020/routing/config/interface.mjs +1 -1
  4. package/esm2020/routing/config/public_api.mjs +2 -2
  5. package/esm2020/routing/config/token.mjs +9 -2
  6. package/esm2020/routing/effects/redirect.effects.mjs +35 -0
  7. package/esm2020/routing/module.mjs +1 -1
  8. package/esm2020/routing/public_api.mjs +2 -1
  9. package/esm2020/routing/redirect.module.mjs +25 -0
  10. package/esm2020/state/auth-state.module.mjs +1 -4
  11. package/esm2020/state/config/default.mjs +1 -3
  12. package/esm2020/state/config/type.mjs +1 -1
  13. package/esm2020/testing/factories/account-registration.factory.mjs +2 -2
  14. package/esm2020/testing/factories/auth-token.factory.mjs +2 -2
  15. package/esm2020/testing/factories/reset-password-info.factory.mjs +2 -2
  16. package/fesm2015/daffodil-auth-driver-in-memory.mjs +1 -1
  17. package/fesm2015/daffodil-auth-driver-in-memory.mjs.map +1 -1
  18. package/fesm2015/daffodil-auth-routing.mjs +57 -4
  19. package/fesm2015/daffodil-auth-routing.mjs.map +1 -1
  20. package/fesm2015/daffodil-auth-state.mjs +0 -32
  21. package/fesm2015/daffodil-auth-state.mjs.map +1 -1
  22. package/fesm2015/daffodil-auth-testing.mjs +1 -1
  23. package/fesm2015/daffodil-auth-testing.mjs.map +1 -1
  24. package/fesm2020/daffodil-auth-driver-in-memory.mjs +1 -1
  25. package/fesm2020/daffodil-auth-driver-in-memory.mjs.map +1 -1
  26. package/fesm2020/daffodil-auth-routing.mjs +58 -4
  27. package/fesm2020/daffodil-auth-routing.mjs.map +1 -1
  28. package/fesm2020/daffodil-auth-state.mjs +0 -30
  29. package/fesm2020/daffodil-auth-state.mjs.map +1 -1
  30. package/fesm2020/daffodil-auth-testing.mjs +1 -1
  31. package/fesm2020/daffodil-auth-testing.mjs.map +1 -1
  32. package/package.json +3 -3
  33. package/routing/config/interface.d.ts +10 -0
  34. package/routing/config/public_api.d.ts +1 -1
  35. package/routing/config/token.d.ts +2 -1
  36. package/{state → routing}/effects/redirect.effects.d.ts +2 -2
  37. package/routing/module.d.ts +1 -1
  38. package/routing/public_api.d.ts +1 -0
  39. package/routing/redirect.module.d.ts +7 -0
  40. package/state/config/type.d.ts +0 -10
  41. package/esm2020/state/effects/redirect.effects.mjs +0 -35
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-auth-testing.mjs","sources":["../../../libs/auth/testing/src/factories/account-registration.factory.ts","../../../libs/auth/testing/src/factories/auth-token.factory.ts","../../../libs/auth/testing/src/factories/reset-password-info.factory.ts","../../../libs/auth/testing/src/daffodil-auth-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker';\n\nimport { DaffAccountRegistration } from '@daffodil/auth';\nimport { DaffModelFactory } from '@daffodil/core/testing';\n\nexport class MockAccountRegistration implements DaffAccountRegistration {\n email = faker.internet.email();\n password = faker.random.alphaNumeric(16);\n subscribe = faker.datatype.boolean();\n firstName = faker.name.firstName();\n lastName = faker.name.lastName();\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffAccountRegistrationFactory extends DaffModelFactory<DaffAccountRegistration> {\n constructor() {\n super(MockAccountRegistration);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker';\n\nimport { DaffAuthToken } from '@daffodil/auth';\nimport { DaffModelFactory } from '@daffodil/core/testing';\n\nexport class MockAuthToken implements DaffAuthToken {\n token = faker.random.alphaNumeric(16);\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffAuthTokenFactory extends DaffModelFactory<DaffAuthToken> {\n constructor() {\n super(MockAuthToken);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker';\n\nimport { DaffAuthResetPasswordInfo } from '@daffodil/auth';\nimport { DaffModelFactory } from '@daffodil/core/testing';\n\nexport class MockAuthResetPasswordInfo implements DaffAuthResetPasswordInfo {\n email = faker.internet.email();\n password = faker.random.alphaNumeric(16);\n token = faker.random.alphaNumeric(16);\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffAuthResetPasswordInfoFactory extends DaffModelFactory<DaffAuthResetPasswordInfo> {\n constructor() {\n super(MockAuthResetPasswordInfo);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAMa,uBAAuB,CAAA;AAApC,IAAA,WAAA,GAAA;AACE,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AACzC,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;AACrC,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;AACnC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;KAClC;AAAA,CAAA;AAAA,CAAC;AAKI,MAAO,8BAA+B,SAAQ,gBAAyC,CAAA;AAC3F,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAChC;;8IAHU,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA9B,mBAAA,8BAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,8BAA8B,cAF7B,MAAM,EAAA,CAAA,CAA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ACE,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAClC;;gJAHU,gCAAgC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhC,mBAAA,gCAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,cAF/B,MAAM,EAAA,CAAA,CAAA;2FAEP,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAH5C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACdD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-auth-testing.mjs","sources":["../../../libs/auth/testing/src/factories/account-registration.factory.ts","../../../libs/auth/testing/src/factories/auth-token.factory.ts","../../../libs/auth/testing/src/factories/reset-password-info.factory.ts","../../../libs/auth/testing/src/daffodil-auth-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffAccountRegistration } from '@daffodil/auth';\nimport { DaffModelFactory } from '@daffodil/core/testing';\n\nexport class MockAccountRegistration implements DaffAccountRegistration {\n email = faker.internet.email();\n password = faker.random.alphaNumeric(16);\n subscribe = faker.datatype.boolean();\n firstName = faker.name.firstName();\n lastName = faker.name.lastName();\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffAccountRegistrationFactory extends DaffModelFactory<DaffAccountRegistration> {\n constructor() {\n super(MockAccountRegistration);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffAuthToken } from '@daffodil/auth';\nimport { DaffModelFactory } from '@daffodil/core/testing';\n\nexport class MockAuthToken implements DaffAuthToken {\n token = faker.random.alphaNumeric(16);\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffAuthTokenFactory extends DaffModelFactory<DaffAuthToken> {\n constructor() {\n super(MockAuthToken);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffAuthResetPasswordInfo } from '@daffodil/auth';\nimport { DaffModelFactory } from '@daffodil/core/testing';\n\nexport class MockAuthResetPasswordInfo implements DaffAuthResetPasswordInfo {\n email = faker.internet.email();\n password = faker.random.alphaNumeric(16);\n token = faker.random.alphaNumeric(16);\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffAuthResetPasswordInfoFactory extends DaffModelFactory<DaffAuthResetPasswordInfo> {\n constructor() {\n super(MockAuthResetPasswordInfo);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAMa,uBAAuB,CAAA;AAApC,IAAA,WAAA,GAAA;AACE,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AACzC,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;AACrC,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;AACnC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;KAClC;AAAA,CAAA;AAAA,CAAC;AAKI,MAAO,8BAA+B,SAAQ,gBAAyC,CAAA;AAC3F,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAChC;;8IAHU,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA9B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AC;QACzC,IAAK,CAAA,KAAA,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;KACvC;AAAA,CAAA;AAAA,CAAC;AAKI,MAAO,gCAAiC,SAAQ,gBAA2C,CAAA;AAC/F,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAClC;;gJAHU,gCAAgC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhC,mBAAA,gCAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,cAF/B,MAAM,EAAA,CAAA,CAAA;2FAEP,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAH5C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACdD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daffodil/auth",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "description": "Reducers, State, Selectors, and Drivers for logging in and registering users.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,12 +18,12 @@
18
18
  "peerDependencies": {
19
19
  "@angular/common": "^13.0.0",
20
20
  "@angular/core": "^13.0.0",
21
- "@daffodil/core": "0.53.0",
21
+ "@daffodil/core": "0.54.0",
22
22
  "@ngrx/store": "^13.0.0",
23
23
  "rxjs": "7.5.5"
24
24
  },
25
25
  "optionalDependencies": {
26
- "@daffodil/driver": "0.53.0"
26
+ "@daffodil/driver": "0.54.0"
27
27
  },
28
28
  "module": "fesm2015/daffodil-auth.mjs",
29
29
  "es2020": "fesm2020/daffodil-auth.mjs",
@@ -6,4 +6,14 @@ export interface DaffAuthRoutingConfig {
6
6
  * The name of the query param to which the reset password token will be set.
7
7
  */
8
8
  resetPasswordTokenParam?: string;
9
+ /**
10
+ * The path to which the user will be redirected when they are logged in and the auth token is stored.
11
+ * Defaults to `'/'`.
12
+ */
13
+ authCompleteRedirectPath: string;
14
+ /**
15
+ * The path to which the user will be redirected when they are logged out.
16
+ * Defaults to `'/'`.
17
+ */
18
+ logoutRedirectPath: string;
9
19
  }
@@ -1,3 +1,3 @@
1
1
  export { DAFF_AUTH_ROUTING_CONFIG_DEFAULT } from './default';
2
2
  export { DaffAuthRoutingConfig } from './interface';
3
- export { DAFF_AUTH_ROUTING_CONFIG } from './token';
3
+ export { DAFF_AUTH_ROUTING_CONFIG, provideDaffAuthRoutingConfig, } from './token';
@@ -1,6 +1,7 @@
1
- import { InjectionToken } from '@angular/core';
1
+ import { InjectionToken, ValueProvider } from '@angular/core';
2
2
  import { DaffAuthRoutingConfig } from './interface';
3
3
  /**
4
4
  * The token used to provide @daffodil/auth/routing config data.
5
5
  */
6
6
  export declare const DAFF_AUTH_ROUTING_CONFIG: InjectionToken<DaffAuthRoutingConfig>;
7
+ export declare const provideDaffAuthRoutingConfig: (config: Partial<DaffAuthRoutingConfig>) => ValueProvider;
@@ -1,6 +1,6 @@
1
1
  import { Router } from '@angular/router';
2
2
  import { Actions } from '@ngrx/effects';
3
- import { DaffAuthStateConfig } from '../config/public_api';
3
+ import { DaffAuthRoutingConfig } from '../config/public_api';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * Redirects the user to certain pages based on certain auth actions.
@@ -9,7 +9,7 @@ export declare class DaffAuthRedirectEffects {
9
9
  private actions$;
10
10
  private router;
11
11
  private config;
12
- constructor(actions$: Actions, router: Router, config: DaffAuthStateConfig);
12
+ constructor(actions$: Actions, router: Router, config: DaffAuthRoutingConfig);
13
13
  redirectAfterLoginOrRegister$: import("rxjs").Observable<never> & import("@ngrx/effects").CreateEffectMetadata;
14
14
  redirectAfterLogout$: import("rxjs").Observable<never> & import("@ngrx/effects").CreateEffectMetadata;
15
15
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffAuthRedirectEffects, never>;
@@ -2,7 +2,7 @@ import { ModuleWithProviders } from '@angular/core';
2
2
  import { DaffAuthRoutingConfig } from './config/public_api';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class DaffAuthRoutingModule {
5
- static withConfig(config?: DaffAuthRoutingConfig): ModuleWithProviders<DaffAuthRoutingModule>;
5
+ static withConfig(config?: Partial<DaffAuthRoutingConfig>): ModuleWithProviders<DaffAuthRoutingModule>;
6
6
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffAuthRoutingModule, never>;
7
7
  static ɵmod: i0.ɵɵNgModuleDeclaration<DaffAuthRoutingModule, never, never, never>;
8
8
  static ɵinj: i0.ɵɵInjectorDeclaration<DaffAuthRoutingModule>;
@@ -1,3 +1,4 @@
1
1
  export * from './guards/public_api';
2
2
  export * from './config/public_api';
3
3
  export * from './module';
4
+ export * from './redirect.module';
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "@ngrx/effects";
3
+ export declare class DaffAuthRoutingRedirectModule {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffAuthRoutingRedirectModule, never>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffAuthRoutingRedirectModule, never, [typeof i1.EffectsFeatureModule], never>;
6
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffAuthRoutingRedirectModule>;
7
+ }
@@ -4,14 +4,4 @@ export interface DaffAuthStateConfig {
4
4
  * Defaults to twenty minutes.
5
5
  */
6
6
  checkInterval: number;
7
- /**
8
- * The path to which the user will be redirected when they are logged in and the auth token is stored.
9
- * Defaults to `'/'`.
10
- */
11
- authCompleteRedirectPath: string;
12
- /**
13
- * The path to which the user will be redirected when they are logged out.
14
- * Defaults to `'/'`.
15
- */
16
- logoutRedirectPath: string;
17
7
  }
@@ -1,35 +0,0 @@
1
- import { Inject, Injectable, } from '@angular/core';
2
- import { Router } from '@angular/router';
3
- import { Actions, createEffect, ofType, } from '@ngrx/effects';
4
- import { EMPTY } from 'rxjs';
5
- import { switchMap, tap, } from 'rxjs/operators';
6
- import { DaffAuthActionTypes, DaffAuthLoginActionTypes, } from '../actions/public_api';
7
- import { DAFF_AUTH_STATE_CONFIG, } from '../config/public_api';
8
- import * as i0 from "@angular/core";
9
- import * as i1 from "@ngrx/effects";
10
- import * as i2 from "@angular/router";
11
- /**
12
- * Redirects the user to certain pages based on certain auth actions.
13
- */
14
- export class DaffAuthRedirectEffects {
15
- constructor(actions$, router, config) {
16
- this.actions$ = actions$;
17
- this.router = router;
18
- this.config = config;
19
- this.redirectAfterLoginOrRegister$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCompleteAction), tap(() => {
20
- this.router.navigateByUrl(this.config.authCompleteRedirectPath);
21
- }), switchMap(() => EMPTY)), { dispatch: false });
22
- this.redirectAfterLogout$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutSuccessAction, DaffAuthActionTypes.AuthRevokeAction), tap(() => {
23
- this.router.navigateByUrl(this.config.logoutRedirectPath);
24
- }), switchMap(() => EMPTY)), { dispatch: false });
25
- }
26
- }
27
- /** @nocollapse */ DaffAuthRedirectEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects, deps: [{ token: i1.Actions }, { token: i2.Router }, { token: DAFF_AUTH_STATE_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
28
- /** @nocollapse */ DaffAuthRedirectEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects });
29
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRedirectEffects, decorators: [{
30
- type: Injectable
31
- }], ctorParameters: function () { return [{ type: i1.Actions }, { type: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