@dereekb/dbx-core 1.2.0 → 3.0.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.
- package/README.md +1 -1
- package/esm2020/lib/action/action.handler.mjs +4 -126
- package/esm2020/lib/action/action.holder.mjs +13 -4
- package/esm2020/lib/action/action.machine.mjs +15 -7
- package/esm2020/lib/action/action.mjs +37 -17
- package/esm2020/lib/action/action.module.mjs +18 -18
- package/esm2020/lib/action/action.reference.mjs +7 -0
- package/esm2020/lib/action/action.store.mjs +63 -26
- package/esm2020/lib/action/action.store.source.mjs +27 -13
- package/esm2020/lib/action/directive/auto/action.automodify.directive.mjs +7 -7
- package/esm2020/lib/action/directive/auto/action.autotrigger.directive.mjs +13 -11
- package/esm2020/lib/action/directive/auto/index.mjs +2 -2
- package/esm2020/lib/action/directive/context/action.directive.mjs +7 -7
- package/esm2020/lib/action/directive/context/action.source.directive.mjs +3 -3
- package/esm2020/lib/action/directive/debug/action.logger.directive.mjs +6 -6
- package/esm2020/lib/action/directive/map/action.map.directive.mjs +3 -3
- package/esm2020/lib/action/directive/map/action.map.key.directive.mjs +3 -3
- package/esm2020/lib/action/directive/map/action.map.source.directive.mjs +3 -3
- package/esm2020/lib/action/directive/map/action.map.working.disable.directive.mjs +7 -7
- package/esm2020/lib/action/directive/state/action.disabled.directive.mjs +8 -7
- package/esm2020/lib/action/directive/state/action.enforce.modified.directive.mjs +48 -0
- package/esm2020/lib/action/directive/state/action.handler.directive.mjs +13 -12
- package/esm2020/lib/action/directive/state/action.success.directive.mjs +24 -36
- package/esm2020/lib/action/directive/state/action.success.handler.directive.mjs +48 -0
- package/esm2020/lib/action/directive/state/action.value.directive.mjs +13 -11
- package/esm2020/lib/action/directive/state/action.value.stream.directive.mjs +80 -0
- package/esm2020/lib/action/directive/state/action.value.trigger.directive.mjs +73 -0
- package/esm2020/lib/action/directive/state/action.value.trigger.instance.mjs +43 -0
- package/esm2020/lib/action/directive/state/action.working.component.mjs +29 -23
- package/esm2020/lib/action/directive/state/index.mjs +5 -3
- package/esm2020/lib/action/index.mjs +2 -2
- package/esm2020/lib/auth/auth.module.mjs +26 -0
- package/esm2020/lib/auth/auth.role.any.directive.mjs +36 -0
- package/esm2020/lib/auth/auth.role.has.directive.mjs +36 -0
- package/esm2020/lib/auth/auth.state.module.mjs +28 -0
- package/esm2020/lib/auth/auth.state.service.mjs +23 -0
- package/esm2020/lib/auth/auth.user.mjs +11 -0
- package/esm2020/lib/auth/index.mjs +10 -0
- package/esm2020/lib/auth/router/auth.router.mjs +6 -0
- package/esm2020/lib/auth/router/auth.router.module.mjs +26 -0
- package/esm2020/lib/auth/router/auth.router.service.mjs +61 -0
- package/esm2020/lib/auth/router/index.mjs +6 -0
- package/esm2020/lib/auth/router/provider/uirouter/auth.hook.mjs +23 -0
- package/esm2020/lib/auth/router/provider/uirouter/hook.mjs +65 -0
- package/esm2020/lib/auth/router/provider/uirouter/index.mjs +6 -0
- package/esm2020/lib/auth/router/provider/uirouter/redirect.mjs +29 -0
- package/esm2020/lib/auth/router/provider/uirouter/role.hook.mjs +32 -0
- package/esm2020/lib/auth/router/provider/uirouter/state.hook.mjs +53 -0
- package/esm2020/lib/auth/router/state/auth.router.state.module.mjs +32 -0
- package/esm2020/lib/auth/router/state/effect/auth.router.state.effect.mjs +46 -0
- package/esm2020/lib/auth/router/state/effect/index.mjs +2 -0
- package/esm2020/lib/auth/router/state/index.mjs +3 -0
- package/esm2020/lib/auth/service/auth.service.mjs +6 -0
- package/esm2020/lib/auth/service/auth.service.rxjs.mjs +27 -0
- package/esm2020/lib/auth/service/index.mjs +3 -0
- package/esm2020/lib/auth/state/action/auth.action.mjs +14 -0
- package/esm2020/lib/auth/state/action/index.mjs +12 -0
- package/esm2020/lib/auth/state/action/user.action.mjs +18 -0
- package/esm2020/lib/auth/state/effect/auth.effect.mjs +44 -0
- package/esm2020/lib/auth/state/index.mjs +13 -0
- package/esm2020/lib/auth/state/reducer/index.mjs +23 -0
- package/esm2020/lib/auth/state/reducer/user.reducer.mjs +12 -0
- package/esm2020/lib/auth/state/state.mjs +2 -0
- package/esm2020/lib/button/action/action.button.directive.mjs +14 -13
- package/esm2020/lib/button/action/action.button.trigger.directive.mjs +6 -6
- package/esm2020/lib/button/button.directive.mjs +7 -7
- package/esm2020/lib/button/button.loading.directive.mjs +3 -3
- package/esm2020/lib/button/button.mjs +1 -1
- package/esm2020/lib/button/button.module.mjs +4 -4
- package/esm2020/lib/button/router/button.segue.directive.mjs +8 -4
- package/esm2020/lib/context/context.directive.mjs +41 -0
- package/esm2020/lib/context/context.mjs +22 -0
- package/esm2020/lib/context/context.module.mjs +28 -0
- package/esm2020/lib/context/context.service.mjs +29 -0
- package/esm2020/lib/context/index.mjs +6 -0
- package/esm2020/lib/context/state/action/data.action.mjs +10 -0
- package/esm2020/lib/context/state/action/index.mjs +7 -0
- package/esm2020/lib/context/state/effect/index.mjs +38 -0
- package/esm2020/lib/context/state/index.mjs +13 -0
- package/esm2020/lib/context/state/reducer/data.reducer.mjs +16 -0
- package/esm2020/lib/context/state/reducer/index.mjs +25 -0
- package/esm2020/lib/context/state/state.mjs +2 -0
- package/esm2020/lib/filter/action/action.filter.source.directive.mjs +6 -6
- package/esm2020/lib/filter/filter.abstract.connector.directive.mjs +3 -3
- package/esm2020/lib/filter/filter.abstract.source.directive.mjs +4 -4
- package/esm2020/lib/filter/filter.connector.directive.mjs +3 -3
- package/esm2020/lib/filter/filter.map.connector.directive.mjs +3 -3
- package/esm2020/lib/filter/filter.map.directive.mjs +3 -3
- package/esm2020/lib/filter/filter.map.instance.directive.mjs +3 -3
- package/esm2020/lib/filter/filter.map.source.directive.mjs +3 -3
- package/esm2020/lib/filter/filter.module.mjs +4 -4
- package/esm2020/lib/filter/filter.source.directive.mjs +3 -3
- package/esm2020/lib/index.mjs +6 -2
- package/esm2020/lib/injection/index.mjs +9 -0
- package/esm2020/lib/injection/injection.component.mjs +34 -0
- package/esm2020/lib/injection/injection.component.module.mjs +31 -0
- package/esm2020/lib/injection/injection.context.directive.mjs +124 -0
- package/esm2020/lib/injection/injection.context.forward.directive.mjs +30 -0
- package/esm2020/lib/injection/injection.context.mjs +18 -0
- package/esm2020/lib/injection/injection.directive.mjs +33 -0
- package/esm2020/lib/injection/injection.instance.mjs +116 -0
- package/esm2020/lib/injection/injection.mjs +16 -0
- package/esm2020/lib/ngrx/index.mjs +2 -0
- package/esm2020/lib/ngrx/store.lockset.mjs +64 -0
- package/esm2020/lib/pipe/date/date.pipe.module.mjs +4 -4
- package/esm2020/lib/pipe/date/datedistance.pipe.mjs +3 -3
- package/esm2020/lib/pipe/date/dateformatdistance.pipe.mjs +3 -3
- package/esm2020/lib/pipe/date/datefromtoformat.pipe.mjs +3 -3
- package/esm2020/lib/pipe/date/minutesstring.pipe.mjs +3 -3
- package/esm2020/lib/pipe/date/timedistance.pipe.mjs +6 -6
- package/esm2020/lib/pipe/date/tojsdate.pipe.mjs +13 -5
- package/esm2020/lib/pipe/date/tominutes.pipe.mjs +3 -3
- package/esm2020/lib/pipe/index.mjs +3 -1
- package/esm2020/lib/pipe/misc/index.mjs +3 -0
- package/esm2020/lib/pipe/misc/misc.pipe.module.mjs +20 -0
- package/esm2020/lib/pipe/misc/prettyjson.pipe.mjs +27 -0
- package/esm2020/lib/pipe/pipe.module.mjs +21 -0
- package/esm2020/lib/router/anchor/anchor.directive.mjs +18 -5
- package/esm2020/lib/router/anchor/anchor.mjs +1 -1
- package/esm2020/lib/router/router/provider/angular/angular.router.service.mjs +8 -5
- package/esm2020/lib/router/router/provider/angular/angular.router.service.module.mjs +4 -4
- package/esm2020/lib/router/router/provider/uirouter/uirouter.router.service.mjs +32 -10
- package/esm2020/lib/router/router/provider/uirouter/uirouter.router.service.module.mjs +4 -4
- package/esm2020/lib/router/router/service/index.mjs +2 -1
- package/esm2020/lib/router/router/service/router.go.mjs +14 -0
- package/esm2020/lib/router/router/service/router.service.mjs +1 -1
- package/esm2020/lib/router/router/transition/transition.directive.mjs +7 -7
- package/esm2020/lib/router/router/transition/transition.watcher.directive.mjs +6 -6
- package/esm2020/lib/router/segue.mjs +17 -2
- package/esm2020/lib/storage/storage.accessor.simple.factory.mjs +3 -3
- package/esm2020/lib/storage/storage.module.mjs +4 -4
- package/esm2020/lib/subscription/subscription.directive.mjs +6 -6
- package/esm2020/lib/util/view.mjs +18 -2
- package/esm2020/lib/view/if.directive.mjs +30 -0
- package/esm2020/lib/view/index.mjs +2 -0
- package/fesm2015/dereekb-dbx-core.mjs +1977 -690
- package/fesm2015/dereekb-dbx-core.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-core.mjs +1970 -683
- package/fesm2020/dereekb-dbx-core.mjs.map +1 -1
- package/lib/action/action.d.ts +14 -12
- package/lib/action/action.handler.d.ts +7 -67
- package/lib/action/action.holder.d.ts +9 -5
- package/lib/action/action.machine.d.ts +21 -8
- package/lib/action/action.module.d.ts +5 -5
- package/lib/action/action.reference.d.ts +11 -0
- package/lib/action/action.store.d.ts +33 -15
- package/lib/action/action.store.source.d.ts +20 -13
- package/lib/action/directive/auto/action.automodify.directive.d.ts +5 -4
- package/lib/action/directive/auto/action.autotrigger.directive.d.ts +9 -9
- package/lib/action/directive/auto/index.d.ts +1 -1
- package/lib/action/directive/context/action.directive.d.ts +3 -3
- package/lib/action/directive/debug/action.logger.directive.d.ts +3 -3
- package/lib/action/directive/map/action.map.working.disable.directive.d.ts +6 -6
- package/lib/action/directive/state/action.disabled.directive.d.ts +5 -4
- package/lib/action/directive/state/action.enforce.modified.directive.d.ts +20 -0
- package/lib/action/directive/state/action.handler.directive.d.ts +3 -3
- package/lib/action/directive/state/action.success.directive.d.ts +11 -19
- package/lib/action/directive/state/action.success.handler.directive.d.ts +24 -0
- package/lib/action/directive/state/action.value.directive.d.ts +8 -8
- package/lib/action/directive/state/action.value.stream.directive.d.ts +25 -0
- package/lib/action/directive/state/action.value.trigger.directive.d.ts +34 -0
- package/lib/action/directive/state/action.value.trigger.instance.d.ts +34 -0
- package/lib/action/directive/state/action.working.component.d.ts +13 -7
- package/lib/action/directive/state/index.d.ts +4 -2
- package/lib/action/index.d.ts +1 -1
- package/lib/auth/auth.module.d.ts +8 -0
- package/lib/auth/auth.role.any.directive.d.ts +20 -0
- package/lib/auth/auth.role.has.directive.d.ts +20 -0
- package/lib/auth/auth.state.module.d.ts +8 -0
- package/lib/auth/auth.state.service.d.ts +13 -0
- package/lib/auth/auth.user.d.ts +28 -0
- package/lib/auth/index.d.ts +9 -0
- package/lib/auth/router/auth.router.d.ts +10 -0
- package/lib/auth/router/auth.router.module.d.ts +9 -0
- package/lib/auth/router/auth.router.service.d.ts +38 -0
- package/lib/auth/router/index.d.ts +5 -0
- package/lib/auth/router/provider/uirouter/auth.hook.d.ts +18 -0
- package/lib/auth/router/provider/uirouter/hook.d.ts +46 -0
- package/lib/auth/router/provider/uirouter/index.d.ts +5 -0
- package/lib/auth/router/provider/uirouter/redirect.d.ts +9 -0
- package/lib/auth/router/provider/uirouter/role.hook.d.ts +26 -0
- package/lib/auth/router/provider/uirouter/state.hook.d.ts +31 -0
- package/lib/auth/router/state/auth.router.state.module.d.ts +14 -0
- package/lib/auth/router/state/effect/auth.router.state.effect.d.ts +32 -0
- package/lib/auth/router/state/effect/index.d.ts +1 -0
- package/lib/auth/router/state/index.d.ts +2 -0
- package/lib/auth/service/auth.service.d.ts +46 -0
- package/lib/auth/service/auth.service.rxjs.d.ts +18 -0
- package/lib/auth/service/index.d.ts +2 -0
- package/lib/auth/state/action/auth.action.d.ts +12 -0
- package/lib/auth/state/action/index.d.ts +11 -0
- package/lib/auth/state/action/user.action.d.ts +34 -0
- package/lib/auth/state/effect/auth.effect.d.ts +31 -0
- package/lib/auth/state/index.d.ts +12 -0
- package/lib/auth/state/reducer/index.d.ts +29 -0
- package/lib/auth/state/reducer/user.reducer.d.ts +11 -0
- package/lib/auth/state/state.d.ts +5 -0
- package/lib/button/action/action.button.directive.d.ts +4 -4
- package/lib/button/action/action.button.trigger.directive.d.ts +3 -3
- package/lib/button/button.d.ts +5 -5
- package/lib/button/button.directive.d.ts +2 -2
- package/lib/button/router/button.segue.directive.d.ts +1 -0
- package/lib/context/context.d.ts +39 -0
- package/lib/context/context.directive.d.ts +19 -0
- package/lib/context/context.module.d.ts +8 -0
- package/lib/context/context.service.d.ts +16 -0
- package/lib/context/index.d.ts +5 -0
- package/lib/context/state/action/data.action.d.ts +13 -0
- package/lib/context/state/action/index.d.ts +6 -0
- package/lib/context/state/effect/index.d.ts +39 -0
- package/lib/context/state/index.d.ts +12 -0
- package/lib/context/state/reducer/data.reducer.d.ts +13 -0
- package/lib/context/state/reducer/index.d.ts +34 -0
- package/lib/context/state/state.d.ts +9 -0
- package/lib/filter/action/action.filter.source.directive.d.ts +2 -2
- package/lib/filter/filter.abstract.source.directive.d.ts +2 -2
- package/lib/index.d.ts +5 -1
- package/lib/injection/index.d.ts +8 -0
- package/lib/injection/injection.component.d.ts +15 -0
- package/lib/injection/injection.component.module.d.ts +9 -0
- package/lib/injection/injection.context.d.ts +39 -0
- package/lib/injection/injection.context.directive.d.ts +25 -0
- package/lib/injection/injection.context.forward.directive.d.ts +16 -0
- package/lib/{injected/injected.d.ts → injection/injection.d.ts} +4 -4
- package/lib/injection/injection.directive.d.ts +19 -0
- package/lib/{injected/injected.instance.d.ts → injection/injection.instance.d.ts} +8 -8
- package/lib/ngrx/index.d.ts +1 -0
- package/lib/ngrx/store.lockset.d.ts +36 -0
- package/lib/pipe/index.d.ts +2 -0
- package/lib/pipe/misc/index.d.ts +2 -0
- package/lib/pipe/misc/misc.pipe.module.d.ts +7 -0
- package/lib/pipe/misc/prettyjson.pipe.d.ts +9 -0
- package/lib/pipe/pipe.module.d.ts +8 -0
- package/lib/router/anchor/anchor.d.ts +5 -1
- package/lib/router/anchor/anchor.directive.d.ts +10 -2
- package/lib/router/router/provider/angular/angular.router.service.d.ts +7 -5
- package/lib/router/router/provider/uirouter/uirouter.router.service.d.ts +11 -5
- package/lib/router/router/service/index.d.ts +1 -0
- package/lib/router/router/service/router.go.d.ts +14 -0
- package/lib/router/router/service/router.service.d.ts +10 -4
- package/lib/router/router/transition/transition.directive.d.ts +2 -2
- package/lib/router/router/transition/transition.watcher.directive.d.ts +1 -1
- package/lib/router/segue.d.ts +10 -3
- package/lib/util/view.d.ts +12 -0
- package/lib/view/if.directive.d.ts +19 -0
- package/lib/view/index.d.ts +1 -0
- package/package.json +7 -18
- package/esm2020/lib/action/directive/auto/action.autotrigger.value.directive.mjs +0 -79
- package/esm2020/lib/action/directive/state/action.disabled.modified.directive.mjs +0 -35
- package/esm2020/lib/action/directive/state/action.success.component.mjs +0 -50
- package/esm2020/lib/action/snackbar/index.mjs +0 -3
- package/esm2020/lib/action/snackbar/snackbar.mjs +0 -24
- package/esm2020/lib/injected/index.mjs +0 -6
- package/esm2020/lib/injected/injected.component.mjs +0 -34
- package/esm2020/lib/injected/injected.component.module.mjs +0 -26
- package/esm2020/lib/injected/injected.directive.mjs +0 -33
- package/esm2020/lib/injected/injected.instance.mjs +0 -116
- package/esm2020/lib/injected/injected.mjs +0 -16
- package/lib/action/directive/auto/action.autotrigger.value.directive.d.ts +0 -25
- package/lib/action/directive/state/action.disabled.modified.directive.d.ts +0 -16
- package/lib/action/directive/state/action.success.component.d.ts +0 -15
- package/lib/action/snackbar/index.d.ts +0 -1
- package/lib/action/snackbar/snackbar.d.ts +0 -50
- package/lib/injected/index.d.ts +0 -5
- package/lib/injected/injected.component.d.ts +0 -15
- package/lib/injected/injected.component.module.d.ts +0 -8
- package/lib/injected/injected.directive.d.ts +0 -19
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { Maybe } from '@dereekb/util';
|
|
3
|
+
import { AbstractSubscriptionDirective } from '../../../subscription';
|
|
4
|
+
import { DbxActionContextStoreSourceInstance } from '../../action.store.source';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare const APP_ACTION_ENFORCE_MODIFIED_DIRECTIVE_KEY = "dbx_action_enforce_modified";
|
|
7
|
+
/**
|
|
8
|
+
* Directive that toggles disabling an action if the action is not marked modified.
|
|
9
|
+
*/
|
|
10
|
+
export declare class DbxActionEnforceModifiedDirective extends AbstractSubscriptionDirective implements OnInit, OnDestroy {
|
|
11
|
+
readonly source: DbxActionContextStoreSourceInstance;
|
|
12
|
+
private _enabled;
|
|
13
|
+
constructor(source: DbxActionContextStoreSourceInstance);
|
|
14
|
+
ngOnInit(): void;
|
|
15
|
+
ngOnDestroy(): void;
|
|
16
|
+
get enabled(): boolean;
|
|
17
|
+
set enabled(enabled: Maybe<string | boolean>);
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionEnforceModifiedDirective, [{ host: true; }]>;
|
|
19
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionEnforceModifiedDirective, "[dbxActionEnforceModified]", never, { "enabled": "dbxActionEnforceModified"; }, {}, never>;
|
|
20
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { AbstractSubscriptionDirective } from '../../../subscription';
|
|
3
|
-
import {
|
|
3
|
+
import { DbxActionContextStoreSourceInstance } from '../../action.store.source';
|
|
4
4
|
import { HandleActionFunction } from '../../action.handler';
|
|
5
5
|
import { Maybe } from '@dereekb/util';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
@@ -8,13 +8,13 @@ import * as i0 from "@angular/core";
|
|
|
8
8
|
* Context used for defining a function that performs an action using the input function on ValueReady.
|
|
9
9
|
*/
|
|
10
10
|
export declare class DbxActionHandlerDirective<T, O> extends AbstractSubscriptionDirective implements OnInit, OnDestroy {
|
|
11
|
-
readonly source:
|
|
11
|
+
readonly source: DbxActionContextStoreSourceInstance<T, O>;
|
|
12
12
|
private _handlerFunction;
|
|
13
13
|
readonly handlerFunction$: import("rxjs").Observable<HandleActionFunction<T, O>>;
|
|
14
14
|
get handlerFunction(): Maybe<HandleActionFunction<T, O>>;
|
|
15
15
|
set handlerFunction(handlerFunction: Maybe<HandleActionFunction<T, O>>);
|
|
16
16
|
private _delegate;
|
|
17
|
-
constructor(source:
|
|
17
|
+
constructor(source: DbxActionContextStoreSourceInstance<T, O>);
|
|
18
18
|
ngOnInit(): void;
|
|
19
19
|
ngOnDestroy(): void;
|
|
20
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionHandlerDirective<any, any>, [{ host: true; }]>;
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
2
|
import { Maybe } from '@dereekb/util';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { AbstractIfDirective } from '../../../view/if.directive';
|
|
4
|
+
import { DbxActionContextStoreSourceInstance } from '../../action.store.source';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Structural directive that displays the content when the store has a success value.
|
|
8
8
|
*/
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
readonly successFunction$: import("rxjs").Observable<SuccessActionFunction<O>>;
|
|
17
|
-
get successFunction(): Maybe<SuccessActionFunction<O>>;
|
|
18
|
-
set successFunction(successFunction: Maybe<SuccessActionFunction<O>>);
|
|
19
|
-
constructor(source: ActionContextStoreSourceInstance);
|
|
20
|
-
ngOnInit(): void;
|
|
21
|
-
ngOnDestroy(): void;
|
|
22
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionSuccessDirective<any, any>, [{ host: true; }]>;
|
|
23
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionSuccessDirective<any, any>, "[dbxActionSuccess]", never, { "successFunction": "dbxActionSuccess"; }, {}, never>;
|
|
9
|
+
export declare class DbxActionHasSuccessDirective extends AbstractIfDirective implements OnDestroy {
|
|
10
|
+
readonly source: DbxActionContextStoreSourceInstance;
|
|
11
|
+
hideAfter?: Maybe<number> | '';
|
|
12
|
+
readonly show$: import("rxjs").Observable<boolean>;
|
|
13
|
+
constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, source: DbxActionContextStoreSourceInstance);
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionHasSuccessDirective, never>;
|
|
15
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionHasSuccessDirective, "[dbxActionHasSuccess]", never, { "hideAfter": "dbxActionHasSuccess"; }, {}, never>;
|
|
24
16
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { Maybe } from '@dereekb/util';
|
|
3
|
+
import { AbstractSubscriptionDirective } from '../../../subscription';
|
|
4
|
+
import { DbxActionContextStoreSourceInstance } from '../../action.store.source';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Performs the action on success.
|
|
8
|
+
*/
|
|
9
|
+
export declare type DbxActionSuccessHandlerFunction<O> = (value: O) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Directive that executes a function on ActionContextStore Success.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DbxActionSuccessHandlerDirective<T, O> extends AbstractSubscriptionDirective implements OnInit, OnDestroy {
|
|
14
|
+
readonly source: DbxActionContextStoreSourceInstance<T, O>;
|
|
15
|
+
private _successFunction;
|
|
16
|
+
readonly successFunction$: import("rxjs").Observable<DbxActionSuccessHandlerFunction<O>>;
|
|
17
|
+
get successFunction(): Maybe<DbxActionSuccessHandlerFunction<O>>;
|
|
18
|
+
set successFunction(successFunction: Maybe<DbxActionSuccessHandlerFunction<O>>);
|
|
19
|
+
constructor(source: DbxActionContextStoreSourceInstance<T, O>);
|
|
20
|
+
ngOnInit(): void;
|
|
21
|
+
ngOnDestroy(): void;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionSuccessHandlerDirective<any, any>, [{ host: true; }]>;
|
|
23
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionSuccessHandlerDirective<any, any>, "[dbxActionSuccessHandler]", never, { "successFunction": "dbxActionSuccessHandler"; }, {}, never>;
|
|
24
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
|
-
import { Maybe,
|
|
2
|
+
import { Maybe, GetterOrValue } from '@dereekb/util';
|
|
3
3
|
import { AbstractSubscriptionDirective } from '../../../subscription';
|
|
4
|
-
import {
|
|
4
|
+
import { DbxActionContextStoreSourceInstance } from '../../action.store.source';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
/**
|
|
7
7
|
* Directive that provides a default value when triggered.
|
|
8
8
|
*
|
|
9
|
-
* No value is required, allowing the directive to automatically call readyValue
|
|
9
|
+
* No value is required, allowing the directive to automatically call readyValue.
|
|
10
10
|
*/
|
|
11
11
|
export declare class DbxActionValueDirective<T, O> extends AbstractSubscriptionDirective implements OnInit {
|
|
12
|
-
readonly source:
|
|
12
|
+
readonly source: DbxActionContextStoreSourceInstance<T, O>;
|
|
13
13
|
private _valueOrFunction;
|
|
14
|
-
readonly valueOrFunction$: import("rxjs").Observable<
|
|
15
|
-
get valueOrFunction(): Maybe<
|
|
16
|
-
set valueOrFunction(valueOrFunction: Maybe<
|
|
17
|
-
constructor(source:
|
|
14
|
+
readonly valueOrFunction$: import("rxjs").Observable<GetterOrValue<T>>;
|
|
15
|
+
get valueOrFunction(): Maybe<GetterOrValue<T>>;
|
|
16
|
+
set valueOrFunction(valueOrFunction: Maybe<GetterOrValue<T>>);
|
|
17
|
+
constructor(source: DbxActionContextStoreSourceInstance<T, O>);
|
|
18
18
|
ngOnInit(): void;
|
|
19
19
|
ngOnDestroy(): void;
|
|
20
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionValueDirective<any, any>, [{ host: true; }]>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DbxActionContextStoreSourceInstance } from '../../action.store.source';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { OnDestroy } from '@angular/core';
|
|
5
|
+
import { IsModifiedFunction } from '@dereekb/rxjs';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Directive that watches a value observable for changes and sets the new value and modified states as necessary.
|
|
9
|
+
*/
|
|
10
|
+
export declare class dbxActionValueStreamDirective<T, O> implements OnInit, OnDestroy {
|
|
11
|
+
readonly source: DbxActionContextStoreSourceInstance<T, O>;
|
|
12
|
+
private _valueObs;
|
|
13
|
+
private _isModifiedFn;
|
|
14
|
+
private _modifiedSub;
|
|
15
|
+
private _triggerSub;
|
|
16
|
+
set dbxActionValueStream(dbxActionValueStream: Observable<T>);
|
|
17
|
+
set dbxActionValueStreamIsNotEmpty(requireNonEmpty: any);
|
|
18
|
+
set dbxActionValueStreamModified(dbxActionValueStreamModified: IsModifiedFunction<T>);
|
|
19
|
+
readonly modifiedValue$: Observable<[boolean, T]>;
|
|
20
|
+
constructor(source: DbxActionContextStoreSourceInstance<T, O>);
|
|
21
|
+
ngOnInit(): void;
|
|
22
|
+
ngOnDestroy(): void;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<dbxActionValueStreamDirective<any, any>, [{ host: true; }]>;
|
|
24
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<dbxActionValueStreamDirective<any, any>, "[dbxActionValueStream]", never, { "dbxActionValueStream": "dbxActionValueStream"; "dbxActionValueStreamIsNotEmpty": "dbxActionValueStreamIsNotEmpty"; "dbxActionValueStreamModified": "dbxActionValueStreamModified"; }, {}, never>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ElementRef, OnDestroy, OnInit } from "@angular/core";
|
|
2
|
+
import { IsModifiedFunction } from "@dereekb/rxjs";
|
|
3
|
+
import { Maybe } from "@dereekb/util";
|
|
4
|
+
import { DbxActionContextStoreSourceInstance } from "../../action.store.source";
|
|
5
|
+
import { DbxActionValueOnTriggerFunction } from "./action.value.trigger.instance";
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Abstract class for directives that may perform an action when trigger is called, and returns a value.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class AbstractDbxActionValueOnTriggerDirective<T> {
|
|
11
|
+
readonly source: DbxActionContextStoreSourceInstance<T, any>;
|
|
12
|
+
private readonly _instance;
|
|
13
|
+
private _triggeredSub;
|
|
14
|
+
constructor(source: DbxActionContextStoreSourceInstance<T, any>, valueGetter?: Maybe<DbxActionValueOnTriggerFunction<T>>);
|
|
15
|
+
get valueGetter(): Maybe<DbxActionValueOnTriggerFunction<T>>;
|
|
16
|
+
set valueGetter(valueGetter: Maybe<DbxActionValueOnTriggerFunction<T>>);
|
|
17
|
+
get isModifiedFunction(): Maybe<IsModifiedFunction<T>>;
|
|
18
|
+
set isModifiedFunction(isModifiedFunction: Maybe<IsModifiedFunction<T>>);
|
|
19
|
+
ngOnInit(): void;
|
|
20
|
+
ngOnDestroy(): void;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AbstractDbxActionValueOnTriggerDirective<any>, never>;
|
|
22
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractDbxActionValueOnTriggerDirective<any>, never, never, {}, {}, never>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Action directive that is used to trigger/display a popover, then watches that popover for a value.
|
|
26
|
+
*/
|
|
27
|
+
export declare class DbxActionValueTriggerDirective<T = object> extends AbstractDbxActionValueOnTriggerDirective<T> implements OnInit, OnDestroy {
|
|
28
|
+
readonly elementRef: ElementRef;
|
|
29
|
+
set dbxActionValueOnTrigger(dbxActionValueTrigger: Maybe<DbxActionValueOnTriggerFunction<T>>);
|
|
30
|
+
set dbxActionValueTriggerModified(isModifiedFunction: Maybe<IsModifiedFunction>);
|
|
31
|
+
constructor(elementRef: ElementRef, source: DbxActionContextStoreSourceInstance<T, any>);
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionValueTriggerDirective<any>, never>;
|
|
33
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionValueTriggerDirective<any>, "[dbxActionValueOnTrigger]", ["dbxActionValueOnTrigger"], { "dbxActionValueOnTrigger": "dbxActionValueOnTrigger"; "dbxActionValueTriggerModified": "dbxActionValueTriggerModified"; }, {}, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ObservableOrValue, IsModifiedFunction } from '@dereekb/rxjs';
|
|
2
|
+
import { Destroyable, Initialized, Maybe } from '@dereekb/util';
|
|
3
|
+
import { DbxActionContextStoreSourceInstance } from '../../action.store.source';
|
|
4
|
+
/**
|
|
5
|
+
* DbxActionValueOnTriggerInstance function. Returns an ObervableGetter that returns a value.
|
|
6
|
+
*/
|
|
7
|
+
export declare type DbxActionValueOnTriggerFunction<T> = () => ObservableOrValue<Maybe<T>>;
|
|
8
|
+
export interface DbxActionValueOnTriggerResult<T = any> {
|
|
9
|
+
value?: Maybe<T>;
|
|
10
|
+
reject?: any;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* DbxActionValueOnTriggerInstance configuration.
|
|
14
|
+
*/
|
|
15
|
+
export interface DbxActionValueOnTriggerInstanceConfig<T> {
|
|
16
|
+
readonly source: DbxActionContextStoreSourceInstance<T, any>;
|
|
17
|
+
readonly valueGetter?: Maybe<DbxActionValueOnTriggerFunction<T>>;
|
|
18
|
+
readonly isModifiedFunction?: Maybe<IsModifiedFunction<T>>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Utility class that handles trigger events to retrieve a value.
|
|
22
|
+
*/
|
|
23
|
+
export declare class DbxActionValueOnTriggerInstance<T> implements Initialized, Destroyable {
|
|
24
|
+
private _valueGetter;
|
|
25
|
+
readonly valueGetter$: import("rxjs").Observable<DbxActionValueOnTriggerFunction<T>>;
|
|
26
|
+
readonly source: DbxActionContextStoreSourceInstance<T, any>;
|
|
27
|
+
isModifiedFunction?: Maybe<IsModifiedFunction<T>>;
|
|
28
|
+
private _triggeredSub;
|
|
29
|
+
constructor(config: DbxActionValueOnTriggerInstanceConfig<T>);
|
|
30
|
+
get valueGetter(): Maybe<DbxActionValueOnTriggerFunction<T>>;
|
|
31
|
+
set valueGetter(valueGetter: Maybe<DbxActionValueOnTriggerFunction<T>>);
|
|
32
|
+
init(): void;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { Maybe } from '@dereekb/util';
|
|
3
|
+
import { AbstractIfDirective } from '../../../view/if.directive';
|
|
4
|
+
import { DbxActionContextStoreSourceInstance } from '../../action.store.source';
|
|
2
5
|
import * as i0 from "@angular/core";
|
|
3
6
|
/**
|
|
4
|
-
*
|
|
7
|
+
* Structural directive that displays the content when the store is working.
|
|
8
|
+
*
|
|
9
|
+
* Can specify a period in milliseconds that shows how long to show up after working for a particular number of seconds.
|
|
5
10
|
*/
|
|
6
|
-
export declare class
|
|
7
|
-
readonly source:
|
|
11
|
+
export declare class DbxActionIsWorkingDirective extends AbstractIfDirective implements OnDestroy {
|
|
12
|
+
readonly source: DbxActionContextStoreSourceInstance;
|
|
13
|
+
showAfter?: Maybe<number> | '';
|
|
8
14
|
readonly show$: import("rxjs").Observable<boolean>;
|
|
9
|
-
constructor(source:
|
|
10
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
11
|
-
static
|
|
15
|
+
constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, source: DbxActionContextStoreSourceInstance);
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxActionIsWorkingDirective, never>;
|
|
17
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxActionIsWorkingDirective, "[dbxActionIsWorking]", never, { "showAfter": "dbxActionIsWorking"; }, {}, never>;
|
|
12
18
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './action.disabled.directive';
|
|
2
|
-
export * from './action.disabled.modified.directive';
|
|
3
2
|
export * from './action.handler.directive';
|
|
4
|
-
export * from './action.success.component';
|
|
5
3
|
export * from './action.success.directive';
|
|
4
|
+
export * from './action.success.handler.directive';
|
|
6
5
|
export * from './action.value.directive';
|
|
7
6
|
export * from './action.working.component';
|
|
7
|
+
export * from './action.enforce.modified.directive';
|
|
8
|
+
export * from './action.value.trigger.directive';
|
|
9
|
+
export * from './action.value.trigger.instance';
|
package/lib/action/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './directive';
|
|
2
|
-
export * from './snackbar';
|
|
3
2
|
export * from './action.handler';
|
|
4
3
|
export * from './action.holder';
|
|
5
4
|
export * from './action.machine';
|
|
6
5
|
export * from './action.module';
|
|
6
|
+
export * from './action.reference';
|
|
7
7
|
export * from './action.store.source';
|
|
8
8
|
export * from './action.store';
|
|
9
9
|
export * from './action';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./auth.role.has.directive";
|
|
3
|
+
import * as i2 from "./auth.role.any.directive";
|
|
4
|
+
export declare class DbxCoreAuthModule {
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxCoreAuthModule, never>;
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DbxCoreAuthModule, [typeof i1.DbxAuthHasRolesDirective, typeof i2.DbxAuthHasAnyRoleDirective], never, [typeof i1.DbxAuthHasRolesDirective, typeof i2.DbxAuthHasAnyRoleDirective]>;
|
|
7
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DbxCoreAuthModule>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AuthRole, ArrayOrValue } from '@dereekb/util';
|
|
2
|
+
import { TemplateRef, ViewContainerRef, OnDestroy } from '@angular/core';
|
|
3
|
+
import { DbxAuthService } from './service';
|
|
4
|
+
import { Maybe } from '@dereekb/util';
|
|
5
|
+
import { AbstractIfDirective } from '../view/if.directive';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Structural decorator directive similar to ngIf that embeds content if the current auth user has any of the target role(s).
|
|
9
|
+
*/
|
|
10
|
+
export declare class DbxAuthHasAnyRoleDirective extends AbstractIfDirective implements OnDestroy {
|
|
11
|
+
private dbxAuthService;
|
|
12
|
+
private _targetRoles;
|
|
13
|
+
readonly targetRoles$: import("rxjs").Observable<Maybe<ArrayOrValue<string>>>;
|
|
14
|
+
readonly show$: import("rxjs").Observable<boolean>;
|
|
15
|
+
constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, dbxAuthService: DbxAuthService);
|
|
16
|
+
ngOnDestroy(): void;
|
|
17
|
+
set targetRoles(roles: Maybe<ArrayOrValue<AuthRole>>);
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxAuthHasAnyRoleDirective, never>;
|
|
19
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxAuthHasAnyRoleDirective, "[dbxAuthHasAnyRole]", never, { "targetRoles": "dbxAuthHasAnyRole"; }, {}, never>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AuthRole, ArrayOrValue } from '@dereekb/util';
|
|
2
|
+
import { TemplateRef, ViewContainerRef, OnDestroy } from '@angular/core';
|
|
3
|
+
import { DbxAuthService } from './service';
|
|
4
|
+
import { Maybe } from '@dereekb/util';
|
|
5
|
+
import { AbstractIfDirective } from '../view/if.directive';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Structural decorator directive similar to ngIf that embeds content if the current auth user has all of the target role(s).
|
|
9
|
+
*/
|
|
10
|
+
export declare class DbxAuthHasRolesDirective extends AbstractIfDirective implements OnDestroy {
|
|
11
|
+
private dbxAuthService;
|
|
12
|
+
private _targetRoles;
|
|
13
|
+
readonly targetRoles$: import("rxjs").Observable<Maybe<ArrayOrValue<string>>>;
|
|
14
|
+
readonly show$: import("rxjs").Observable<boolean>;
|
|
15
|
+
constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, dbxAuthService: DbxAuthService);
|
|
16
|
+
ngOnDestroy(): void;
|
|
17
|
+
set targetRoles(roles: Maybe<ArrayOrValue<AuthRole>>);
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxAuthHasRolesDirective, never>;
|
|
19
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DbxAuthHasRolesDirective, "[dbxAuthHasRoles]", never, { "targetRoles": "dbxAuthHasRoles"; }, {}, never>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "@ngrx/store";
|
|
3
|
+
import * as i2 from "@ngrx/effects";
|
|
4
|
+
export declare class DbxAppAuthStateModule {
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxAppAuthStateModule, never>;
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DbxAppAuthStateModule, never, [typeof i1.StoreFeatureModule, typeof i2.EffectsFeatureModule], never>;
|
|
7
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DbxAppAuthStateModule>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Store } from "@ngrx/store";
|
|
2
|
+
import { DbxAppAuthFullState } from "./state/state";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* State for accessing the app's DbxAppAuthState defined within the DbxAppAuthFullState for the ngrx store.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DbxAppAuthStateService {
|
|
8
|
+
readonly store: Store<DbxAppAuthFullState>;
|
|
9
|
+
readonly authStateUser$: import("rxjs").Observable<import("./state/reducer/user.reducer").DbxAppAuthStateUser>;
|
|
10
|
+
constructor(store: Store<DbxAppAuthFullState>);
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxAppAuthStateService, never>;
|
|
12
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DbxAppAuthStateService>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Maybe } from "@dereekb/util";
|
|
2
|
+
/**
|
|
3
|
+
* An application user state.
|
|
4
|
+
*
|
|
5
|
+
* Generic states that define the current state of the user:
|
|
6
|
+
* - none: the user is not logged in
|
|
7
|
+
* - anon: the user is logged in as an anonymous account
|
|
8
|
+
* - error: there was an error loading the correct user state
|
|
9
|
+
* - new: the user has a full account but has not completed onboarding/setup
|
|
10
|
+
* - user: the user has a full account and has completed setup
|
|
11
|
+
*/
|
|
12
|
+
export declare type AuthUserState = 'none' | 'anon' | 'new' | 'user' | 'error';
|
|
13
|
+
/**
|
|
14
|
+
* Arbitrary identifier used to differentiate users.
|
|
15
|
+
*/
|
|
16
|
+
export declare type AuthUserIdentifier = string;
|
|
17
|
+
export declare const NO_AUTH_USER_IDENTIFIER = "0";
|
|
18
|
+
/**
|
|
19
|
+
* AuthUserIdentifier used to indicate that the user cannot be uniquely identifier.
|
|
20
|
+
*/
|
|
21
|
+
export declare type NoAuthUserIdentifier = typeof NO_AUTH_USER_IDENTIFIER;
|
|
22
|
+
/**
|
|
23
|
+
* Creates an AuthUserIdentifier from the input. If the input is undefined, returns the NoAuthUserIdentifier.
|
|
24
|
+
*
|
|
25
|
+
* @param inputId
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export declare function authUserIdentifier(inputId: Maybe<AuthUserIdentifier>): AuthUserIdentifier;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './router';
|
|
2
|
+
export * from './service';
|
|
3
|
+
export * from './state';
|
|
4
|
+
export * from './auth.user';
|
|
5
|
+
export * from './auth.module';
|
|
6
|
+
export * from './auth.role.any.directive';
|
|
7
|
+
export * from './auth.role.has.directive';
|
|
8
|
+
export * from './auth.state.module';
|
|
9
|
+
export * from './auth.state.service';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SegueRefOrSegueRefRouterLink } from '../../router/segue';
|
|
2
|
+
/**
|
|
3
|
+
* Auth routes configurations for an app.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class DbxAppAuthRoutes {
|
|
6
|
+
abstract readonly loginRef: SegueRefOrSegueRefRouterLink;
|
|
7
|
+
abstract readonly loggedOutRef?: SegueRefOrSegueRefRouterLink;
|
|
8
|
+
abstract readonly onboardRef?: SegueRefOrSegueRefRouterLink;
|
|
9
|
+
abstract readonly appRef: SegueRefOrSegueRefRouterLink;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { DbxAppAuthRoutes } from './auth.router';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DbxAppAuthRouterModule {
|
|
5
|
+
static forRoot(dbxAppAuthRoutes: DbxAppAuthRoutes): ModuleWithProviders<DbxAppAuthRouterModule>;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxAppAuthRouterModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DbxAppAuthRouterModule, never, never, never>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DbxAppAuthRouterModule>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DbxRouterService } from "../../router/router/service/router.service";
|
|
2
|
+
import { DbxAppAuthRoutes } from "./auth.router";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Helper service for navigating to important auth-related routes.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DbxAppAuthRouterService {
|
|
8
|
+
readonly dbxRouterService: DbxRouterService;
|
|
9
|
+
readonly dbxAppAuthRoutes: DbxAppAuthRoutes;
|
|
10
|
+
constructor(dbxRouterService: DbxRouterService, dbxAppAuthRoutes: DbxAppAuthRoutes);
|
|
11
|
+
get hasOnboardingState(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Navigates to the login state.
|
|
14
|
+
*
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
goToLogin(): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Navigates to the logged out state, if it exists, otherwise navigates to the login state.
|
|
20
|
+
*
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
goToLoggedOut(): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Navigates to the onboarding state if it is available, otherwise navigates to the app.
|
|
26
|
+
*
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
goToOnboarding(): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Navigates to the app state.
|
|
32
|
+
*
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
goToApp(): Promise<boolean>;
|
|
36
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxAppAuthRouterService, never>;
|
|
37
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DbxAppAuthRouterService>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TransitionService } from '@uirouter/core';
|
|
2
|
+
import { AuthTransitionHookOptions } from './hook';
|
|
3
|
+
export interface IsLoggedInHookConfig {
|
|
4
|
+
options: AuthTransitionHookOptions;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* UIRouter State data with configuration for the hasAuthRoleHook.
|
|
8
|
+
*/
|
|
9
|
+
export interface IsLoggedInStateData {
|
|
10
|
+
/**
|
|
11
|
+
* Whether or not the user needs to be logged in for this state.
|
|
12
|
+
*/
|
|
13
|
+
requiredLogIn: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* This hook redirects to the configured default state when a user is not logged in for configured states.
|
|
17
|
+
*/
|
|
18
|
+
export declare function enableIsLoggedInHook(transitionService: TransitionService, config: IsLoggedInHookConfig): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TransitionHookFn, Transition, UIInjector } from '@uirouter/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { SegueRef } from './../../../../router/segue';
|
|
4
|
+
import { DbxAuthService } from '../../../service/auth.service';
|
|
5
|
+
import { FactoryWithRequiredInput, Maybe } from '@dereekb/util';
|
|
6
|
+
import { Injector } from '@angular/core';
|
|
7
|
+
/**
|
|
8
|
+
* authTransitionHookFn() configuration. The values are handled as:
|
|
9
|
+
* - true: continue to the state.
|
|
10
|
+
* - false: redirect to the login page.
|
|
11
|
+
* - StateOrName: redirect to the target page instead.
|
|
12
|
+
*/
|
|
13
|
+
export declare type AuthTransitionDecision = true | false | SegueRef;
|
|
14
|
+
export interface AuthTransitionDecisionGetterInput {
|
|
15
|
+
readonly transition: Transition;
|
|
16
|
+
readonly injector: Injector;
|
|
17
|
+
readonly authService: DbxAuthService;
|
|
18
|
+
}
|
|
19
|
+
export declare type AuthTransitionRedirectTargetGetter = FactoryWithRequiredInput<Observable<Maybe<SegueRef>>, AuthTransitionDecisionGetterInput>;
|
|
20
|
+
export declare type AuthTransitionRedirectTargetOrGetter = Maybe<SegueRef> | AuthTransitionRedirectTargetGetter;
|
|
21
|
+
export interface AuthTransitionHookOptions {
|
|
22
|
+
/**
|
|
23
|
+
* The state to redirect the user to when their auth fails.
|
|
24
|
+
*/
|
|
25
|
+
defaultRedirectTarget: string;
|
|
26
|
+
/**
|
|
27
|
+
* The state to redirect the user to. Defaults to defaultRedirectTarget.
|
|
28
|
+
*/
|
|
29
|
+
errorRedirectTarget?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface AuthTransitionHookConfig extends AuthTransitionHookOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Creates the decision observable for the transition that decides whether or not to redirect or continue.
|
|
34
|
+
*/
|
|
35
|
+
makeDecisionsObs: (transition: Transition, authService: DbxAuthService, injector: UIInjector) => Observable<AuthTransitionDecision>;
|
|
36
|
+
}
|
|
37
|
+
export interface AuthTransitionStateData {
|
|
38
|
+
/**
|
|
39
|
+
* Optional getter/decision maker when a role needs to be
|
|
40
|
+
*/
|
|
41
|
+
redirectTo?: AuthTransitionRedirectTargetOrGetter;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* This generates a TransitionHookFn that can be used with redirecting routes.
|
|
45
|
+
*/
|
|
46
|
+
export declare function makeAuthTransitionHook(config: AuthTransitionHookConfig): TransitionHookFn;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ObjectMap } from "@dereekb/util";
|
|
2
|
+
import { AuthTransitionRedirectTargetGetter, AuthTransitionRedirectTargetOrGetter } from "./hook";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a AuthTransitionRedirectTargetGetter that can redirect values based on the current authUserState.
|
|
5
|
+
*
|
|
6
|
+
* @param stateMap
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function redirectBasedOnAuthUserState(stateMap: ObjectMap<AuthTransitionRedirectTargetOrGetter>): AuthTransitionRedirectTargetGetter;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AuthRole, SetIncludesMode, ArrayOrValue } from '@dereekb/util';
|
|
2
|
+
import { TransitionService } from '@uirouter/core';
|
|
3
|
+
import { AuthTransitionHookOptions, AuthTransitionStateData } from './hook';
|
|
4
|
+
export interface HasAuthRoleHookConfig {
|
|
5
|
+
options: AuthTransitionHookOptions;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* UIRouter State data with configuration for the hasAuthRoleHook.
|
|
9
|
+
*/
|
|
10
|
+
export interface HasAuthRoleStateData extends AuthTransitionStateData {
|
|
11
|
+
/**
|
|
12
|
+
* Auth roles marked for this state
|
|
13
|
+
*/
|
|
14
|
+
authRoles: ArrayOrValue<AuthRole>;
|
|
15
|
+
/**
|
|
16
|
+
* How to use the above auth roles. This defaults to 'all' by default.
|
|
17
|
+
*/
|
|
18
|
+
authRolesMode?: SetIncludesMode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This hook redirects to the configured default state when a user:
|
|
22
|
+
*
|
|
23
|
+
* - does not have an allowed state
|
|
24
|
+
* - has a disallowed state
|
|
25
|
+
*/
|
|
26
|
+
export declare function enableHasAuthRoleHook(transitionService: TransitionService, config: HasAuthRoleHookConfig): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ArrayOrValue } from '@dereekb/util';
|
|
2
|
+
import { TransitionService } from '@uirouter/core';
|
|
3
|
+
import { AuthUserState } from '../../../auth.user';
|
|
4
|
+
import { AuthTransitionHookOptions } from './hook';
|
|
5
|
+
export interface HasAuthStateHookConfig {
|
|
6
|
+
options: AuthTransitionHookOptions;
|
|
7
|
+
}
|
|
8
|
+
export declare type HasAuthStateConfig = ArrayOrValue<AuthUserState> | HasAuthStateObjectConfig;
|
|
9
|
+
export interface HasAuthStateObjectConfig {
|
|
10
|
+
/**
|
|
11
|
+
* Whether or not this state or any child state is considered "secure", which requires the user to be logged in.
|
|
12
|
+
*/
|
|
13
|
+
allowedStates?: ArrayOrValue<AuthUserState>;
|
|
14
|
+
/**
|
|
15
|
+
* States that are not allowed. If the current state is this state, a rejection is returned.
|
|
16
|
+
*/
|
|
17
|
+
disallowedStates?: ArrayOrValue<AuthUserState>;
|
|
18
|
+
}
|
|
19
|
+
export interface HasAuthStateData {
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for the hasAuthStateHook.
|
|
22
|
+
*/
|
|
23
|
+
authStates: HasAuthStateConfig;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* This hook redirects to the configured default state when a user:
|
|
27
|
+
*
|
|
28
|
+
* - does not have an allowed state
|
|
29
|
+
* - has a disallowed state
|
|
30
|
+
*/
|
|
31
|
+
export declare function enableHasAuthStateHook(transitionService: TransitionService, config: HasAuthStateHookConfig): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { ArrayOrValue } from '@dereekb/util';
|
|
3
|
+
import { DbxAppContextState } from '../../../context';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@ngrx/effects";
|
|
6
|
+
export interface DbxAppAuthRouterStateModuleConfig {
|
|
7
|
+
readonly activeRoutesToApplyEffects: ArrayOrValue<DbxAppContextState>;
|
|
8
|
+
}
|
|
9
|
+
export declare class DbxAppAuthRouterStateModule {
|
|
10
|
+
static forRoot(config: DbxAppAuthRouterStateModuleConfig): ModuleWithProviders<DbxAppAuthRouterStateModule>;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxAppAuthRouterStateModule, never>;
|
|
12
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DbxAppAuthRouterStateModule, never, [typeof i1.EffectsFeatureModule], never>;
|
|
13
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DbxAppAuthRouterStateModule>;
|
|
14
|
+
}
|