@abp/ng.core 10.0.1 → 10.0.3
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/fesm2022/abp-ng.core.mjs +12 -5
- package/fesm2022/abp-ng.core.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +2 -2
package/fesm2022/abp-ng.core.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, ChangeDetectorRef, Input, Component, Injectable, InjectionToken, Injector, NgModuleFactory, Compiler, PLATFORM_ID, makeStateKey, TransferState, REQUEST, NgZone, signal, computed, effect, LOCALE_ID, ComponentFactoryResolver, ApplicationRef, isDevMode, input, ElementRef, Directive, EventEmitter, Output, TemplateRef, ViewContainerRef, IterableDiffers, HostListener, provideAppInitializer, makeEnvironmentProviders, Pipe, SecurityContext, NgModule } from '@angular/core';
|
|
3
|
-
import { of, BehaviorSubject, Subject, firstValueFrom, throwError, Observable, timer, pipe, concat, ReplaySubject, EMPTY, map as map$1, Subscription, combineLatest, from, take as take$1, filter as filter$1, fromEvent, switchMap as switchMap$1, startWith, distinctUntilChanged as distinctUntilChanged$1 } from 'rxjs';
|
|
3
|
+
import { of, BehaviorSubject, Subject, firstValueFrom, throwError, timeout, lastValueFrom, Observable, timer, pipe, concat, ReplaySubject, EMPTY, map as map$1, Subscription, combineLatest, from, take as take$1, filter as filter$1, fromEvent, switchMap as switchMap$1, startWith, distinctUntilChanged as distinctUntilChanged$1 } from 'rxjs';
|
|
4
4
|
import { PRIMARY_OUTLET, Router, NavigationStart, NavigationError, NavigationEnd, NavigationCancel, TitleStrategy, ActivatedRoute, RouterOutlet, RouterModule } from '@angular/router';
|
|
5
5
|
import { isPlatformBrowser, DOCUMENT, registerLocaleData, NgComponentOutlet, isPlatformServer, DatePipe, DATE_PIPE_DEFAULT_TIMEZONE, CommonModule } from '@angular/common';
|
|
6
6
|
import { map, distinctUntilChanged, filter, catchError, tap, take, switchMap, mapTo, takeUntil, delay, retryWhen, shareReplay, debounceTime, finalize } from 'rxjs/operators';
|
|
@@ -1102,6 +1102,7 @@ async function getInitialData() {
|
|
|
1102
1102
|
const environmentService = injector.get(EnvironmentService);
|
|
1103
1103
|
const configState = injector.get(ConfigStateService);
|
|
1104
1104
|
const options = injector.get(CORE_OPTIONS);
|
|
1105
|
+
const appStartedWithSSR = injector.get(APP_STARTED_WITH_SSR);
|
|
1105
1106
|
environmentService.setState(options.environment);
|
|
1106
1107
|
await getRemoteEnv(injector, options.environment);
|
|
1107
1108
|
await parseTenantFromUrl(injector);
|
|
@@ -1124,8 +1125,12 @@ async function getInitialData() {
|
|
|
1124
1125
|
}
|
|
1125
1126
|
return throwError(() => error);
|
|
1126
1127
|
}));
|
|
1127
|
-
|
|
1128
|
-
|
|
1128
|
+
if (appStartedWithSSR) {
|
|
1129
|
+
await firstValueFrom(result$.pipe(timeout(0), catchError(() => of(null))));
|
|
1130
|
+
}
|
|
1131
|
+
else {
|
|
1132
|
+
await lastValueFrom(result$);
|
|
1133
|
+
}
|
|
1129
1134
|
await localeInitializer(injector);
|
|
1130
1135
|
}
|
|
1131
1136
|
function localeInitializer(injector) {
|
|
@@ -5070,6 +5075,7 @@ class PermissionGuard {
|
|
|
5070
5075
|
this.authService = inject(AuthService);
|
|
5071
5076
|
this.permissionService = inject(PermissionService);
|
|
5072
5077
|
this.httpErrorReporter = inject(HttpErrorReporterService);
|
|
5078
|
+
this.configStateService = inject(ConfigStateService);
|
|
5073
5079
|
}
|
|
5074
5080
|
canActivate(route, state) {
|
|
5075
5081
|
let { requiredPolicy } = route.data || {};
|
|
@@ -5080,7 +5086,7 @@ class PermissionGuard {
|
|
|
5080
5086
|
if (!requiredPolicy) {
|
|
5081
5087
|
return of(true);
|
|
5082
5088
|
}
|
|
5083
|
-
return this.
|
|
5089
|
+
return this.configStateService.getAll$().pipe(filter(config => !!config?.auth?.grantedPolicies), take(1), switchMap(() => this.permissionService.getGrantedPolicy$(requiredPolicy)), take(1), map(access => {
|
|
5084
5090
|
if (access)
|
|
5085
5091
|
return true;
|
|
5086
5092
|
if (route.data?.['redirectUrl']) {
|
|
@@ -5107,6 +5113,7 @@ const permissionGuard = (route, state) => {
|
|
|
5107
5113
|
const authService = inject(AuthService);
|
|
5108
5114
|
const permissionService = inject(PermissionService);
|
|
5109
5115
|
const httpErrorReporter = inject(HttpErrorReporterService);
|
|
5116
|
+
const configStateService = inject(ConfigStateService);
|
|
5110
5117
|
const platformId = inject(PLATFORM_ID);
|
|
5111
5118
|
let { requiredPolicy } = route.data || {};
|
|
5112
5119
|
if (!requiredPolicy) {
|
|
@@ -5120,7 +5127,7 @@ const permissionGuard = (route, state) => {
|
|
|
5120
5127
|
if (isPlatformServer(platformId)) {
|
|
5121
5128
|
return of(true);
|
|
5122
5129
|
}
|
|
5123
|
-
return
|
|
5130
|
+
return configStateService.getAll$().pipe(filter(config => !!config?.auth?.grantedPolicies), take(1), switchMap(() => permissionService.getGrantedPolicy$(requiredPolicy)), take(1), map(access => {
|
|
5124
5131
|
if (access)
|
|
5125
5132
|
return true;
|
|
5126
5133
|
if (route.data?.['redirectUrl']) {
|