@stemy/ngx-utils 19.9.7 → 19.9.8
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'zone.js';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, PLATFORM_ID, Inject, Injectable, Optional,
|
|
3
|
+
import { InjectionToken, runInInjectionContext, PLATFORM_ID, Inject, Injectable, Optional, inject, Injector, untracked, computed, signal, DestroyRef, isDevMode, ErrorHandler, EventEmitter, createComponent, NgZone, Pipe, input, output, ChangeDetectorRef, ElementRef, effect, HostListener, Directive, Input, HostBinding, Output, TemplateRef, ChangeDetectionStrategy, ViewEncapsulation, Component, ViewChild, forwardRef, ContentChild, contentChild, contentChildren, Renderer2, model, ContentChildren, provideAppInitializer, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
4
4
|
import 'reflect-metadata';
|
|
5
5
|
import * as i2 from '@angular/router';
|
|
6
6
|
import { ActivatedRouteSnapshot, Scroll, NavigationEnd, Router, DefaultUrlSerializer, UrlTree, UrlSegmentGroup, UrlSegment, UrlSerializer, ROUTES } from '@angular/router';
|
|
@@ -39,6 +39,7 @@ var StorageMode;
|
|
|
39
39
|
})(StorageMode || (StorageMode = {}));
|
|
40
40
|
// --- Reflect utils ---
|
|
41
41
|
function FactoryDependencies(...dependencies) {
|
|
42
|
+
console.warn(`FactoryDependencies is deprecated, please use Angular's inject() method to retrieve the services instead`);
|
|
42
43
|
return function (target, method) {
|
|
43
44
|
Reflect.defineMetadata("factoryDependencies", dependencies, target, method);
|
|
44
45
|
};
|
|
@@ -617,7 +618,7 @@ class ReflectUtils {
|
|
|
617
618
|
const parameters = depends.map(function (dep) {
|
|
618
619
|
return injector.get(dep);
|
|
619
620
|
}).concat(factory.params);
|
|
620
|
-
return factory.func.apply(null, parameters);
|
|
621
|
+
return runInInjectionContext(injector, () => factory.func.apply(factory.type ?? null, parameters));
|
|
621
622
|
}
|
|
622
623
|
}
|
|
623
624
|
|
|
@@ -892,15 +893,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
892
893
|
type: Optional
|
|
893
894
|
}] }] });
|
|
894
895
|
|
|
895
|
-
var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
896
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
897
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
898
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
899
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
900
|
-
};
|
|
901
|
-
var __metadata$1 = (this && this.__metadata) || function (k, v) {
|
|
902
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
903
|
-
};
|
|
904
896
|
class AuthGuard {
|
|
905
897
|
static guardAuthenticated(auth) {
|
|
906
898
|
return Promise.resolve(auth.isAuthenticated);
|
|
@@ -911,26 +903,24 @@ class AuthGuard {
|
|
|
911
903
|
static guardNothing() {
|
|
912
904
|
return Promise.resolve(true);
|
|
913
905
|
}
|
|
914
|
-
static guardAuthField(
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
return
|
|
906
|
+
static guardAuthField(expression = `auth.isAuthenticated`) {
|
|
907
|
+
const auth = inject(AUTH_SERVICE);
|
|
908
|
+
return async () => {
|
|
909
|
+
return ObjectUtils.evaluate(expression, { auth });
|
|
918
910
|
};
|
|
919
|
-
return lambda;
|
|
920
911
|
}
|
|
921
|
-
static guardStateField(
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
return
|
|
912
|
+
static guardStateField(expression = `state.data`) {
|
|
913
|
+
const state = inject(StateService);
|
|
914
|
+
return async () => {
|
|
915
|
+
return ObjectUtils.evaluate(expression, { state });
|
|
925
916
|
};
|
|
926
|
-
return lambda;
|
|
927
917
|
}
|
|
928
|
-
static guardAuthStateField(
|
|
929
|
-
|
|
930
|
-
const
|
|
931
|
-
|
|
918
|
+
static guardAuthStateField(expression = `auth.isAuthenticated`) {
|
|
919
|
+
const auth = inject(AUTH_SERVICE);
|
|
920
|
+
const state = inject(StateService);
|
|
921
|
+
return async () => {
|
|
922
|
+
return ObjectUtils.evaluate(expression, { auth, state });
|
|
932
923
|
};
|
|
933
|
-
return lambda;
|
|
934
924
|
}
|
|
935
925
|
static wildRouteMatch(segments) {
|
|
936
926
|
return { consumed: segments };
|
|
@@ -1015,24 +1005,6 @@ class AuthGuard {
|
|
|
1015
1005
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: AuthGuard, deps: [{ token: Injector }, { token: StateService }, { token: AUTH_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1016
1006
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: AuthGuard }); }
|
|
1017
1007
|
}
|
|
1018
|
-
__decorate$1([
|
|
1019
|
-
FactoryDependencies(AUTH_SERVICE),
|
|
1020
|
-
__metadata$1("design:type", Function),
|
|
1021
|
-
__metadata$1("design:paramtypes", [Object, String]),
|
|
1022
|
-
__metadata$1("design:returntype", Function)
|
|
1023
|
-
], AuthGuard, "guardAuthField", null);
|
|
1024
|
-
__decorate$1([
|
|
1025
|
-
FactoryDependencies(StateService),
|
|
1026
|
-
__metadata$1("design:type", Function),
|
|
1027
|
-
__metadata$1("design:paramtypes", [StateService, String]),
|
|
1028
|
-
__metadata$1("design:returntype", Function)
|
|
1029
|
-
], AuthGuard, "guardStateField", null);
|
|
1030
|
-
__decorate$1([
|
|
1031
|
-
FactoryDependencies(AUTH_SERVICE, StateService),
|
|
1032
|
-
__metadata$1("design:type", Function),
|
|
1033
|
-
__metadata$1("design:paramtypes", [Object, StateService, String]),
|
|
1034
|
-
__metadata$1("design:returntype", Function)
|
|
1035
|
-
], AuthGuard, "guardAuthStateField", null);
|
|
1036
1008
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: AuthGuard, decorators: [{
|
|
1037
1009
|
type: Injectable
|
|
1038
1010
|
}], ctorParameters: () => [{ type: i0.Injector, decorators: [{
|