@abp/ng.core 10.0.0 → 10.0.2
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 +24 -7
- package/fesm2022/abp-ng.core.mjs.map +1 -1
- package/index.d.ts +1 -1
- 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) {
|
|
@@ -5080,10 +5085,16 @@ class PermissionGuard {
|
|
|
5080
5085
|
if (!requiredPolicy) {
|
|
5081
5086
|
return of(true);
|
|
5082
5087
|
}
|
|
5083
|
-
return this.permissionService.getGrantedPolicy$(requiredPolicy).pipe(
|
|
5084
|
-
if (
|
|
5088
|
+
return this.permissionService.getGrantedPolicy$(requiredPolicy).pipe(take(1), map(access => {
|
|
5089
|
+
if (access)
|
|
5090
|
+
return true;
|
|
5091
|
+
if (route.data?.['redirectUrl']) {
|
|
5092
|
+
return this.router.parseUrl(route.data['redirectUrl']);
|
|
5093
|
+
}
|
|
5094
|
+
if (this.authService.isAuthenticated) {
|
|
5085
5095
|
this.httpErrorReporter.reportError({ status: 403 });
|
|
5086
5096
|
}
|
|
5097
|
+
return false;
|
|
5087
5098
|
}));
|
|
5088
5099
|
}
|
|
5089
5100
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: PermissionGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
@@ -5114,10 +5125,16 @@ const permissionGuard = (route, state) => {
|
|
|
5114
5125
|
if (isPlatformServer(platformId)) {
|
|
5115
5126
|
return of(true);
|
|
5116
5127
|
}
|
|
5117
|
-
return permissionService.getGrantedPolicy$(requiredPolicy).pipe(
|
|
5118
|
-
if (
|
|
5128
|
+
return permissionService.getGrantedPolicy$(requiredPolicy).pipe(take(1), map(access => {
|
|
5129
|
+
if (access)
|
|
5130
|
+
return true;
|
|
5131
|
+
if (route.data?.['redirectUrl']) {
|
|
5132
|
+
return router.parseUrl(route.data['redirectUrl']);
|
|
5133
|
+
}
|
|
5134
|
+
if (authService.isAuthenticated) {
|
|
5119
5135
|
httpErrorReporter.reportError({ status: 403 });
|
|
5120
5136
|
}
|
|
5137
|
+
return false;
|
|
5121
5138
|
}));
|
|
5122
5139
|
};
|
|
5123
5140
|
|