@abp/ng.core 5.3.1 → 6.0.0-rc.1
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/esm2020/lib/directives/form-submit.directive.mjs +1 -1
- package/esm2020/lib/directives/permission.directive.mjs +15 -3
- package/esm2020/lib/interceptors/api.interceptor.mjs +3 -2
- package/esm2020/lib/proxy/pages/abp/multi-tenancy/abp-tenant.service.mjs +3 -5
- package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/api-exploring/abp-api-definition.service.mjs +2 -2
- package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service.mjs +3 -5
- package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/models.mjs +1 -1
- package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/object-extending/models.mjs +1 -2
- package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models.mjs +1 -1
- package/esm2020/lib/proxy/volo/abp/http/modeling/models.mjs +1 -2
- package/esm2020/lib/proxy/volo/abp/localization/models.mjs +1 -1
- package/esm2020/lib/proxy/volo/abp/models.mjs +1 -1
- package/esm2020/lib/services/config-state.service.mjs +17 -1
- package/esm2020/lib/services/environment.service.mjs +14 -1
- package/esm2020/lib/services/multi-tenancy.service.mjs +3 -3
- package/esm2020/lib/services/rest.service.mjs +6 -2
- package/fesm2015/abp-ng.core.mjs +53 -12
- package/fesm2015/abp-ng.core.mjs.map +1 -1
- package/fesm2020/abp-ng.core.mjs +53 -16
- package/fesm2020/abp-ng.core.mjs.map +1 -1
- package/lib/directives/permission.directive.d.ts +6 -3
- package/lib/proxy/pages/abp/multi-tenancy/abp-tenant.service.d.ts +2 -2
- package/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service.d.ts +2 -2
- package/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/models.d.ts +10 -4
- package/lib/proxy/volo/abp/http/modeling/models.d.ts +10 -0
- package/lib/services/config-state.service.d.ts +20 -5
- package/lib/services/environment.service.d.ts +2 -0
- package/lib/services/rest.service.d.ts +1 -0
- package/lib/strategies/auth-flow.strategy.d.ts +14 -4
- package/lib/utils/auth-utils.d.ts +7 -2
- package/lib/utils/initial-utils.d.ts +7 -2
- package/package.json +2 -2
package/fesm2015/abp-ng.core.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { ChangeDetectorRef, Component, Input, InjectionToken, Injectable, Inject, isDevMode, Optional, SkipSelf, Directive, EventEmitter, Output, Self, Injector, Pipe, NgModule, APP_INITIALIZER, LOCALE_ID, NgModuleFactory, Compiler, ComponentFactoryResolver, ApplicationRef, inject } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/router';
|
|
4
4
|
import { PRIMARY_OUTLET, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
5
|
-
import { BehaviorSubject, Subject, throwError, Subscription, combineLatest, from, fromEvent, of, timer, pipe, Observable, concat
|
|
5
|
+
import { BehaviorSubject, Subject, throwError, Subscription, combineLatest, from, fromEvent, ReplaySubject, of, timer, pipe, Observable, concat } from 'rxjs';
|
|
6
6
|
import { map, distinctUntilChanged, filter, catchError, switchMap, take, mapTo, debounceTime, takeUntil, tap, finalize, retryWhen, delay, shareReplay } from 'rxjs/operators';
|
|
7
7
|
import compare from 'just-compare';
|
|
8
8
|
import { __rest, __awaiter } from 'tslib';
|
|
@@ -238,6 +238,12 @@ function coreOptionsFactory(_a) {
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
const mapToApiUrl = (key) => (apis) => (apis[key] || apis.default).url || apis.default.url;
|
|
241
|
+
const mapToIssuer = (issuer) => {
|
|
242
|
+
if (!issuer) {
|
|
243
|
+
return issuer;
|
|
244
|
+
}
|
|
245
|
+
return issuer.endsWith('/') ? issuer : issuer + '/';
|
|
246
|
+
};
|
|
241
247
|
class EnvironmentService {
|
|
242
248
|
constructor() {
|
|
243
249
|
this.store = new InternalStore({});
|
|
@@ -260,6 +266,13 @@ class EnvironmentService {
|
|
|
260
266
|
setState(environment) {
|
|
261
267
|
this.store.set(environment);
|
|
262
268
|
}
|
|
269
|
+
getIssuer() {
|
|
270
|
+
const issuer = this.store.state.oAuthConfig.issuer;
|
|
271
|
+
return mapToIssuer(issuer);
|
|
272
|
+
}
|
|
273
|
+
getIssuer$() {
|
|
274
|
+
return this.store.sliceState(state => state.oAuthConfig.issuer).pipe(map(mapToIssuer));
|
|
275
|
+
}
|
|
263
276
|
}
|
|
264
277
|
EnvironmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: EnvironmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
265
278
|
EnvironmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: EnvironmentService, providedIn: 'root' });
|
|
@@ -313,8 +326,9 @@ class RestService {
|
|
|
313
326
|
api = api || this.getApiFromStore(config.apiName);
|
|
314
327
|
const { method, params } = request, options = __rest(request, ["method", "params"]);
|
|
315
328
|
const { observe = "body" /* Body */, skipHandleError } = config;
|
|
329
|
+
const url = this.removeDuplicateSlashes(api + request.url);
|
|
316
330
|
return this.http
|
|
317
|
-
.request(method,
|
|
331
|
+
.request(method, url, Object.assign(Object.assign({ observe }, (params && {
|
|
318
332
|
params: this.getParams(params, config.httpParamEncoder),
|
|
319
333
|
})), options))
|
|
320
334
|
.pipe(catchError(err => (skipHandleError ? throwError(err) : this.handleError(err))));
|
|
@@ -333,6 +347,9 @@ class RestService {
|
|
|
333
347
|
? new HttpParams({ encoder, fromObject: filteredParams })
|
|
334
348
|
: new HttpParams({ fromObject: filteredParams });
|
|
335
349
|
}
|
|
350
|
+
removeDuplicateSlashes(url) {
|
|
351
|
+
return url.replace(/([^:]\/)\/+/g, '$1');
|
|
352
|
+
}
|
|
336
353
|
}
|
|
337
354
|
RestService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: RestService, deps: [{ token: CORE_OPTIONS }, { token: i1.HttpClient }, { token: EnvironmentService }, { token: HttpErrorReporterService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
338
355
|
RestService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: RestService, providedIn: 'root' });
|
|
@@ -352,9 +369,7 @@ class AbpApplicationConfigurationService {
|
|
|
352
369
|
constructor(restService) {
|
|
353
370
|
this.restService = restService;
|
|
354
371
|
this.apiName = 'abp';
|
|
355
|
-
|
|
356
|
-
get() {
|
|
357
|
-
return this.restService.request({
|
|
372
|
+
this.get = () => this.restService.request({
|
|
358
373
|
method: 'GET',
|
|
359
374
|
url: '/api/abp/application-configuration',
|
|
360
375
|
}, { apiName: this.apiName });
|
|
@@ -473,6 +488,22 @@ class ConfigStateService {
|
|
|
473
488
|
}, {});
|
|
474
489
|
}));
|
|
475
490
|
}
|
|
491
|
+
getGlobalFeatures() {
|
|
492
|
+
return this.store.state.globalFeatures;
|
|
493
|
+
}
|
|
494
|
+
getGlobalFeatures$() {
|
|
495
|
+
return this.store.sliceState(state => state.globalFeatures);
|
|
496
|
+
}
|
|
497
|
+
isGlobalFeatureEnabled(key, globalFeatures) {
|
|
498
|
+
const features = globalFeatures.enabledFeatures || [];
|
|
499
|
+
return features.some(f => key === f);
|
|
500
|
+
}
|
|
501
|
+
getGlobalFeatureIsEnabled(key) {
|
|
502
|
+
return this.isGlobalFeatureEnabled(key, this.store.state.globalFeatures);
|
|
503
|
+
}
|
|
504
|
+
getGlobalFeatureIsEnabled$(key) {
|
|
505
|
+
return this.store.sliceState(state => this.isGlobalFeatureEnabled(key, state.globalFeatures));
|
|
506
|
+
}
|
|
476
507
|
}
|
|
477
508
|
ConfigStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ConfigStateService, deps: [{ token: AbpApplicationConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
478
509
|
ConfigStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ConfigStateService, providedIn: 'root' });
|
|
@@ -1919,6 +1950,8 @@ class PermissionDirective {
|
|
|
1919
1950
|
this.permissionService = permissionService;
|
|
1920
1951
|
this.cdRef = cdRef;
|
|
1921
1952
|
this.runChangeDetection = true;
|
|
1953
|
+
this.cdrSubject = new ReplaySubject();
|
|
1954
|
+
this.rendered = false;
|
|
1922
1955
|
}
|
|
1923
1956
|
check() {
|
|
1924
1957
|
if (this.subscription) {
|
|
@@ -1932,7 +1965,12 @@ class PermissionDirective {
|
|
|
1932
1965
|
if (isGranted)
|
|
1933
1966
|
this.vcRef.createEmbeddedView(this.templateRef);
|
|
1934
1967
|
if (this.runChangeDetection) {
|
|
1935
|
-
this.
|
|
1968
|
+
if (!this.rendered) {
|
|
1969
|
+
this.cdrSubject.next();
|
|
1970
|
+
}
|
|
1971
|
+
else {
|
|
1972
|
+
this.cdRef.detectChanges();
|
|
1973
|
+
}
|
|
1936
1974
|
}
|
|
1937
1975
|
else {
|
|
1938
1976
|
this.cdRef.markForCheck();
|
|
@@ -1946,6 +1984,10 @@ class PermissionDirective {
|
|
|
1946
1984
|
ngOnChanges() {
|
|
1947
1985
|
this.check();
|
|
1948
1986
|
}
|
|
1987
|
+
ngAfterViewInit() {
|
|
1988
|
+
this.cdrSubject.pipe(take(1)).subscribe(() => this.cdRef.detectChanges());
|
|
1989
|
+
this.rendered = true;
|
|
1990
|
+
}
|
|
1949
1991
|
}
|
|
1950
1992
|
PermissionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: PermissionDirective, deps: [{ token: i0.TemplateRef, optional: true }, { token: i0.ViewContainerRef }, { token: PermissionService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1951
1993
|
PermissionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: PermissionDirective, selector: "[abpPermission]", inputs: { condition: ["abpPermission", "condition"], runChangeDetection: ["abpPermissionRunChangeDetection", "runChangeDetection"] }, usesOnChanges: true, ngImport: i0 });
|
|
@@ -2295,6 +2337,7 @@ class ApiInterceptor {
|
|
|
2295
2337
|
if (!(existingHeaders === null || existingHeaders === void 0 ? void 0 : existingHeaders.has(this.tenantKey)) && (tenant === null || tenant === void 0 ? void 0 : tenant.id)) {
|
|
2296
2338
|
headers[this.tenantKey] = tenant.id;
|
|
2297
2339
|
}
|
|
2340
|
+
headers['X-Requested-With'] = 'XMLHttpRequest';
|
|
2298
2341
|
return headers;
|
|
2299
2342
|
}
|
|
2300
2343
|
}
|
|
@@ -2776,15 +2819,13 @@ class AbpTenantService {
|
|
|
2776
2819
|
constructor(restService) {
|
|
2777
2820
|
this.restService = restService;
|
|
2778
2821
|
this.apiName = 'abp';
|
|
2779
|
-
this.findTenantById = (id
|
|
2822
|
+
this.findTenantById = (id) => this.restService.request({
|
|
2780
2823
|
method: 'GET',
|
|
2781
2824
|
url: `/api/abp/multi-tenancy/tenants/by-id/${id}`,
|
|
2782
|
-
headers,
|
|
2783
2825
|
}, { apiName: this.apiName });
|
|
2784
|
-
this.findTenantByName = (name
|
|
2826
|
+
this.findTenantByName = (name) => this.restService.request({
|
|
2785
2827
|
method: 'GET',
|
|
2786
2828
|
url: `/api/abp/multi-tenancy/tenants/by-name/${name}`,
|
|
2787
|
-
headers,
|
|
2788
2829
|
}, { apiName: this.apiName });
|
|
2789
2830
|
}
|
|
2790
2831
|
}
|
|
@@ -2814,12 +2855,12 @@ class MultiTenancyService {
|
|
|
2814
2855
|
}
|
|
2815
2856
|
setTenantByName(tenantName) {
|
|
2816
2857
|
return this.tenantService
|
|
2817
|
-
.findTenantByName(tenantName
|
|
2858
|
+
.findTenantByName(tenantName)
|
|
2818
2859
|
.pipe(switchMap(this.setTenantToState));
|
|
2819
2860
|
}
|
|
2820
2861
|
setTenantById(tenantId) {
|
|
2821
2862
|
return this.tenantService
|
|
2822
|
-
.findTenantById(tenantId
|
|
2863
|
+
.findTenantById(tenantId)
|
|
2823
2864
|
.pipe(switchMap(this.setTenantToState));
|
|
2824
2865
|
}
|
|
2825
2866
|
}
|