@abp/ng.core 5.3.3 → 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.
Files changed (30) hide show
  1. package/esm2020/lib/directives/form-submit.directive.mjs +1 -1
  2. package/esm2020/lib/interceptors/api.interceptor.mjs +3 -2
  3. package/esm2020/lib/proxy/pages/abp/multi-tenancy/abp-tenant.service.mjs +3 -5
  4. package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/api-exploring/abp-api-definition.service.mjs +2 -2
  5. package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service.mjs +3 -5
  6. package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/models.mjs +1 -1
  7. package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/object-extending/models.mjs +1 -2
  8. package/esm2020/lib/proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models.mjs +1 -1
  9. package/esm2020/lib/proxy/volo/abp/http/modeling/models.mjs +1 -2
  10. package/esm2020/lib/proxy/volo/abp/localization/models.mjs +1 -1
  11. package/esm2020/lib/proxy/volo/abp/models.mjs +1 -1
  12. package/esm2020/lib/services/config-state.service.mjs +17 -1
  13. package/esm2020/lib/services/environment.service.mjs +14 -1
  14. package/esm2020/lib/services/multi-tenancy.service.mjs +3 -3
  15. package/esm2020/lib/services/rest.service.mjs +6 -2
  16. package/fesm2015/abp-ng.core.mjs +40 -10
  17. package/fesm2015/abp-ng.core.mjs.map +1 -1
  18. package/fesm2020/abp-ng.core.mjs +40 -14
  19. package/fesm2020/abp-ng.core.mjs.map +1 -1
  20. package/lib/proxy/pages/abp/multi-tenancy/abp-tenant.service.d.ts +2 -2
  21. package/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service.d.ts +2 -2
  22. package/lib/proxy/volo/abp/asp-net-core/mvc/application-configurations/models.d.ts +10 -4
  23. package/lib/proxy/volo/abp/http/modeling/models.d.ts +10 -0
  24. package/lib/services/config-state.service.d.ts +20 -5
  25. package/lib/services/environment.service.d.ts +2 -0
  26. package/lib/services/rest.service.d.ts +1 -0
  27. package/lib/strategies/auth-flow.strategy.d.ts +14 -4
  28. package/lib/utils/auth-utils.d.ts +7 -2
  29. package/lib/utils/initial-utils.d.ts +7 -2
  30. package/package.json +2 -2
@@ -264,6 +264,12 @@ class InternalStore {
264
264
  }
265
265
 
266
266
  const mapToApiUrl = (key) => (apis) => (apis[key] || apis.default).url || apis.default.url;
267
+ const mapToIssuer = (issuer) => {
268
+ if (!issuer) {
269
+ return issuer;
270
+ }
271
+ return issuer.endsWith('/') ? issuer : issuer + '/';
272
+ };
267
273
  class EnvironmentService {
268
274
  constructor() {
269
275
  this.store = new InternalStore({});
@@ -286,6 +292,13 @@ class EnvironmentService {
286
292
  setState(environment) {
287
293
  this.store.set(environment);
288
294
  }
295
+ getIssuer() {
296
+ const issuer = this.store.state.oAuthConfig.issuer;
297
+ return mapToIssuer(issuer);
298
+ }
299
+ getIssuer$() {
300
+ return this.store.sliceState(state => state.oAuthConfig.issuer).pipe(map(mapToIssuer));
301
+ }
289
302
  }
290
303
  EnvironmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: EnvironmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
291
304
  EnvironmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: EnvironmentService, providedIn: 'root' });
@@ -339,8 +352,9 @@ class RestService {
339
352
  api = api || this.getApiFromStore(config.apiName);
340
353
  const { method, params, ...options } = request;
341
354
  const { observe = "body" /* Body */, skipHandleError } = config;
355
+ const url = this.removeDuplicateSlashes(api + request.url);
342
356
  return this.http
343
- .request(method, api + request.url, {
357
+ .request(method, url, {
344
358
  observe,
345
359
  ...(params && {
346
360
  params: this.getParams(params, config.httpParamEncoder),
@@ -363,6 +377,9 @@ class RestService {
363
377
  ? new HttpParams({ encoder, fromObject: filteredParams })
364
378
  : new HttpParams({ fromObject: filteredParams });
365
379
  }
380
+ removeDuplicateSlashes(url) {
381
+ return url.replace(/([^:]\/)\/+/g, '$1');
382
+ }
366
383
  }
367
384
  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 });
368
385
  RestService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: RestService, providedIn: 'root' });
@@ -380,9 +397,7 @@ class AbpApplicationConfigurationService {
380
397
  constructor(restService) {
381
398
  this.restService = restService;
382
399
  this.apiName = 'abp';
383
- }
384
- get() {
385
- return this.restService.request({
400
+ this.get = () => this.restService.request({
386
401
  method: 'GET',
387
402
  url: '/api/abp/application-configuration',
388
403
  }, { apiName: this.apiName });
@@ -498,6 +513,22 @@ class ConfigStateService {
498
513
  }, {});
499
514
  }));
500
515
  }
516
+ getGlobalFeatures() {
517
+ return this.store.state.globalFeatures;
518
+ }
519
+ getGlobalFeatures$() {
520
+ return this.store.sliceState(state => state.globalFeatures);
521
+ }
522
+ isGlobalFeatureEnabled(key, globalFeatures) {
523
+ const features = globalFeatures.enabledFeatures || [];
524
+ return features.some(f => key === f);
525
+ }
526
+ getGlobalFeatureIsEnabled(key) {
527
+ return this.isGlobalFeatureEnabled(key, this.store.state.globalFeatures);
528
+ }
529
+ getGlobalFeatureIsEnabled$(key) {
530
+ return this.store.sliceState(state => this.isGlobalFeatureEnabled(key, state.globalFeatures));
531
+ }
501
532
  }
502
533
  ConfigStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ConfigStateService, deps: [{ token: AbpApplicationConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
503
534
  ConfigStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: ConfigStateService, providedIn: 'root' });
@@ -2296,6 +2327,7 @@ class ApiInterceptor {
2296
2327
  if (!existingHeaders?.has(this.tenantKey) && tenant?.id) {
2297
2328
  headers[this.tenantKey] = tenant.id;
2298
2329
  }
2330
+ headers['X-Requested-With'] = 'XMLHttpRequest';
2299
2331
  return headers;
2300
2332
  }
2301
2333
  }
@@ -2762,15 +2794,13 @@ class AbpTenantService {
2762
2794
  constructor(restService) {
2763
2795
  this.restService = restService;
2764
2796
  this.apiName = 'abp';
2765
- this.findTenantById = (id, headers) => this.restService.request({
2797
+ this.findTenantById = (id) => this.restService.request({
2766
2798
  method: 'GET',
2767
2799
  url: `/api/abp/multi-tenancy/tenants/by-id/${id}`,
2768
- headers,
2769
2800
  }, { apiName: this.apiName });
2770
- this.findTenantByName = (name, headers) => this.restService.request({
2801
+ this.findTenantByName = (name) => this.restService.request({
2771
2802
  method: 'GET',
2772
2803
  url: `/api/abp/multi-tenancy/tenants/by-name/${name}`,
2773
- headers,
2774
2804
  }, { apiName: this.apiName });
2775
2805
  }
2776
2806
  }
@@ -2800,12 +2830,12 @@ class MultiTenancyService {
2800
2830
  }
2801
2831
  setTenantByName(tenantName) {
2802
2832
  return this.tenantService
2803
- .findTenantByName(tenantName, { [this.tenantKey]: '' })
2833
+ .findTenantByName(tenantName)
2804
2834
  .pipe(switchMap(this.setTenantToState));
2805
2835
  }
2806
2836
  setTenantById(tenantId) {
2807
2837
  return this.tenantService
2808
- .findTenantById(tenantId, { [this.tenantKey]: '' })
2838
+ .findTenantById(tenantId)
2809
2839
  .pipe(switchMap(this.setTenantToState));
2810
2840
  }
2811
2841
  }
@@ -3933,14 +3963,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImpor
3933
3963
  }]
3934
3964
  }], ctorParameters: function () { return [{ type: RestService }]; } });
3935
3965
 
3936
- /* eslint-disable @typescript-eslint/ban-types */
3937
-
3938
3966
  var index = /*#__PURE__*/Object.freeze({
3939
3967
  __proto__: null
3940
3968
  });
3941
3969
 
3942
- /* eslint-disable @typescript-eslint/ban-types */
3943
-
3944
3970
  class ContainerStrategy {
3945
3971
  constructor(containerRef) {
3946
3972
  this.containerRef = containerRef;