@acorex/connectivity 20.3.0-next.8 → 20.4.0

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 (19) hide show
  1. package/api/index.d.ts +13 -7
  2. package/fesm2022/acorex-connectivity-api-execute.command-DW9Lro_P.mjs +86 -0
  3. package/fesm2022/acorex-connectivity-api-execute.command-DW9Lro_P.mjs.map +1 -0
  4. package/fesm2022/acorex-connectivity-api.mjs +350 -40
  5. package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
  6. package/fesm2022/{acorex-connectivity-mock-category-with-items.query-DEY9R9q2.mjs → acorex-connectivity-mock-category-with-items.query-wkRIfmup.mjs} +4 -4
  7. package/fesm2022/{acorex-connectivity-mock-category-with-items.query-DEY9R9q2.mjs.map → acorex-connectivity-mock-category-with-items.query-wkRIfmup.mjs.map} +1 -1
  8. package/fesm2022/acorex-connectivity-mock-distribution-record.command-DBTeqLVz.mjs +49 -0
  9. package/fesm2022/acorex-connectivity-mock-distribution-record.command-DBTeqLVz.mjs.map +1 -0
  10. package/fesm2022/{acorex-connectivity-mock-sample.command-BtkzyYby.mjs → acorex-connectivity-mock-sample.command-BghxC3n0.mjs} +4 -4
  11. package/fesm2022/{acorex-connectivity-mock-sample.command-BtkzyYby.mjs.map → acorex-connectivity-mock-sample.command-BghxC3n0.mjs.map} +1 -1
  12. package/fesm2022/acorex-connectivity-mock.mjs +19321 -16659
  13. package/fesm2022/acorex-connectivity-mock.mjs.map +1 -1
  14. package/fesm2022/acorex-connectivity-utils.mjs +7 -7
  15. package/fesm2022/acorex-connectivity-utils.mjs.map +1 -1
  16. package/mock/index.d.ts +296 -95
  17. package/package.json +6 -6
  18. package/fesm2022/acorex-connectivity-mock-employee-structure.queries-CchlfSox.mjs +0 -66
  19. package/fesm2022/acorex-connectivity-mock-employee-structure.queries-CchlfSox.mjs.map +0 -1
@@ -8,12 +8,14 @@ import { kebabCase } from 'lodash-es';
8
8
  import { firstValueFrom, catchError, of, map, BehaviorSubject, tap, filter, take, switchMap, delay } from 'rxjs';
9
9
  import * as i2 from '@acorex/platform/auth';
10
10
  import { AXPAuthStrategy, AXPSessionService, JwtUtil, TimeUtil, PkceUtil, AXPAuthModule, AXP_TENANT_LOADER, AXP_APPLICATION_LOADER, AXP_PERMISSION_LOADER, AXP_FEATURE_LOADER } from '@acorex/platform/auth';
11
- import { STRATEGY_CONFIG_TOKEN } from '@acorex/platform/widgets';
11
+ import { STRATEGY_CONFIG_TOKEN } from '@acorex/platform/layout/widgets';
12
12
  import * as i1$1 from 'angular-oauth2-oidc';
13
13
  import { OAuthService, OAuthModule } from 'angular-oauth2-oidc';
14
14
  import { AXM_AUTH_CONFIG_TOKEN } from '@acorex/modules/auth';
15
15
  import { Router } from '@angular/router';
16
16
  import { AXCUtilsModule, AXCExternalAuthorizationService } from '@acorex/connectivity/utils';
17
+ import { AXPRuntimeModule, provideCommandSetups } from '@acorex/platform/runtime';
18
+ import { AXP_REPORT_CATEGORY_PROVIDER, AXP_REPORT_DEFINITION_PROVIDER } from '@acorex/modules/report-management';
17
19
 
18
20
  class AXCApiEntityStorageService {
19
21
  constructor(http) {
@@ -22,6 +24,9 @@ class AXCApiEntityStorageService {
22
24
  this.filterService = inject(AXPFilterOperatorMiddlewareService);
23
25
  this.entityResolver = inject(AXPEntityResolver);
24
26
  this.mainUrl = this.configs.baseUrl;
27
+ // API routing constants
28
+ this.API_VERSION = 'v1';
29
+ this.DEFAULT_AREA = 'global';
25
30
  }
26
31
  get dbName() {
27
32
  return 'ACoreXPlatform';
@@ -37,6 +42,7 @@ class AXCApiEntityStorageService {
37
42
  module: moduleKebab,
38
43
  entity: entityKebab,
39
44
  area: areaKebab,
45
+ version: this.API_VERSION,
40
46
  };
41
47
  }
42
48
  else {
@@ -46,7 +52,8 @@ class AXCApiEntityStorageService {
46
52
  return {
47
53
  module: moduleKebab,
48
54
  entity: entityKebab,
49
- area: null,
55
+ area: this.DEFAULT_AREA,
56
+ version: this.API_VERSION,
50
57
  };
51
58
  }
52
59
  }
@@ -59,22 +66,22 @@ class AXCApiEntityStorageService {
59
66
  }
60
67
  async getOne(entityName, id) {
61
68
  const routeElement = await this.getConfigEntity(entityName);
62
- const url = `${this.mainUrl}/${routeElement.area ? routeElement.area + '/' : ''}${routeElement.module}/${routeElement.entity}${id ? '/' + id : ''}`;
69
+ const url = `${this.mainUrl}/${routeElement.version}/${routeElement.area}/${routeElement.module}/${routeElement.entity}${id ? '/' + id : ''}`;
63
70
  return firstValueFrom(this.http.get(url));
64
71
  }
65
72
  async updateOne(entityName, id, keyValue) {
66
73
  const routeElement = await this.getConfigEntity(entityName);
67
- const url = `${this.mainUrl}/${routeElement.area ? routeElement.area + '/' : ''}${routeElement.module}/${routeElement.entity}${id ? '/' + id : ''}`;
74
+ const url = `${this.mainUrl}/${routeElement.version}/${routeElement.area}/${routeElement.module}/${routeElement.entity}${id ? '/' + id : ''}`;
68
75
  return firstValueFrom(this.http.put(url, keyValue));
69
76
  }
70
77
  async deleteOne(entityName, id) {
71
78
  const routeElement = await this.getConfigEntity(entityName);
72
- const url = `${this.mainUrl}/${routeElement.area ? routeElement.area + '/' : ''}${routeElement.module}/${routeElement.entity}/${id}`;
79
+ const url = `${this.mainUrl}/${routeElement.version}/${routeElement.area}/${routeElement.module}/${routeElement.entity}/${id}`;
73
80
  firstValueFrom(this.http.delete(url));
74
81
  }
75
82
  async insertOne(entityName, entityItem) {
76
83
  const routeElement = await this.getConfigEntity(entityName);
77
- const url = `${this.mainUrl}/${routeElement.area ? routeElement.area + '/' : ''}${routeElement.module}/${routeElement.entity}`;
84
+ const url = `${this.mainUrl}/${routeElement.version}/${routeElement.area}/${routeElement.module}/${routeElement.entity}`;
78
85
  return firstValueFrom(this.http.post(url, entityItem));
79
86
  }
80
87
  async getAll(entityName) {
@@ -124,17 +131,17 @@ class AXCApiEntityStorageService {
124
131
  if (queryString) {
125
132
  httpParams = httpParams.set('$query', queryString);
126
133
  }
127
- return firstValueFrom(this.http.get(`${this.mainUrl}/${routeElement.area ? routeElement.area + '/' : ''}${routeElement.module}/${routeElement.entity}`, { params: httpParams })).then((response) => {
134
+ return firstValueFrom(this.http.get(`${this.mainUrl}/${routeElement.version}/${routeElement.area}/${routeElement.module}/${routeElement.entity}`, { params: httpParams })).then((response) => {
128
135
  return {
129
136
  total: response.totalCount,
130
137
  items: response.items,
131
138
  };
132
139
  });
133
140
  }
134
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiEntityStorageService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
135
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiEntityStorageService }); }
141
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCApiEntityStorageService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
142
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCApiEntityStorageService }); }
136
143
  }
137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiEntityStorageService, decorators: [{
144
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCApiEntityStorageService, decorators: [{
138
145
  type: Injectable
139
146
  }], ctorParameters: () => [{ type: i1.HttpClient }] });
140
147
 
@@ -278,10 +285,10 @@ class AXCFileStorageApiService extends AXPFileStorageService {
278
285
  // Silently fail in fallback mode
279
286
  }
280
287
  }
281
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCFileStorageApiService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
282
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCFileStorageApiService }); }
288
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCFileStorageApiService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
289
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCFileStorageApiService }); }
283
290
  }
284
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCFileStorageApiService, decorators: [{
291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCFileStorageApiService, decorators: [{
285
292
  type: Injectable
286
293
  }] });
287
294
 
@@ -326,10 +333,10 @@ class AXMOidcApplicationLoader {
326
333
  // features: item.features || [],
327
334
  };
328
335
  }
329
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcApplicationLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
330
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcApplicationLoader }); }
336
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMOidcApplicationLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
337
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMOidcApplicationLoader }); }
331
338
  }
332
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcApplicationLoader, decorators: [{
339
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMOidcApplicationLoader, decorators: [{
333
340
  type: Injectable
334
341
  }], ctorParameters: () => [{ type: i1.HttpClient }] });
335
342
 
@@ -369,10 +376,10 @@ class AXMConfigurationService {
369
376
  switchMap(() => of(this.applicationConfig)));
370
377
  }
371
378
  }
372
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMConfigurationService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
373
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMConfigurationService, providedIn: 'root' }); }
379
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMConfigurationService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
380
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMConfigurationService, providedIn: 'root' }); }
374
381
  }
375
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMConfigurationService, decorators: [{
382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMConfigurationService, decorators: [{
376
383
  type: Injectable,
377
384
  args: [{
378
385
  providedIn: 'root',
@@ -621,6 +628,8 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
621
628
  .join('&');
622
629
  const authorizeUrl = `${authorizeEndpoint}?${queryParams}`;
623
630
  window.location.href = authorizeUrl;
631
+ // Prevent further execution by waiting on a never-resolving Promise after redirect
632
+ await new Promise(() => { });
624
633
  }
625
634
  }
626
635
  catch (error) {
@@ -631,7 +640,8 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
631
640
  localStorage.removeItem('pkce_code_verifier');
632
641
  localStorage.removeItem('oauth_provider');
633
642
  console.log(this.openidConfigurationInfo?.info?.discoveryDocument);
634
- const logoutUrl = `${this.aXMAuthConfigs?.baseUrl}/connect/logout`;
643
+ // Use configured logoutUrl or derive from baseUrl
644
+ const logoutUrl = this.aXMAuthConfigs.logoutUrl || `connect/logout`;
635
645
  window.location.href = logoutUrl;
636
646
  }
637
647
  async refreshToken(context) {
@@ -715,10 +725,10 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
715
725
  get name() {
716
726
  return 'oidc';
717
727
  }
718
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCAPIOidcStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
719
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCAPIOidcStrategy }); }
728
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCAPIOidcStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
729
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCAPIOidcStrategy }); }
720
730
  }
721
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCAPIOidcStrategy, decorators: [{
731
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCAPIOidcStrategy, decorators: [{
722
732
  type: Injectable
723
733
  }] });
724
734
 
@@ -743,10 +753,10 @@ class AXMOidcPermissionLoader {
743
753
  const truePolicies = Object.keys(policies).filter((key) => policies[key] === true);
744
754
  return truePolicies;
745
755
  }
746
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcPermissionLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
747
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcPermissionLoader }); }
756
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMOidcPermissionLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
757
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMOidcPermissionLoader }); }
748
758
  }
749
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcPermissionLoader, decorators: [{
759
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMOidcPermissionLoader, decorators: [{
750
760
  type: Injectable
751
761
  }], ctorParameters: () => [{ type: i1.HttpClient }] });
752
762
 
@@ -772,17 +782,315 @@ class AXMOidcTenantLoader {
772
782
  // Add other fields and defaults as needed, and handle the logo if applicable
773
783
  };
774
784
  }
775
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcTenantLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
776
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcTenantLoader }); }
785
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMOidcTenantLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
786
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMOidcTenantLoader }); }
777
787
  }
778
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcTenantLoader, decorators: [{
788
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMOidcTenantLoader, decorators: [{
779
789
  type: Injectable
780
790
  }], ctorParameters: () => [{ type: i1.HttpClient }] });
781
791
 
792
+ //#endregion
793
+ //#region ---- Helper Functions ----
794
+ // /**
795
+ // * Converts a widget string to AXPWidgetsList key
796
+ // */
797
+ // function convertWidgetStringToAXPWidgetsListKey(
798
+ // widgetString: string,
799
+ // )
800
+ // :
801
+ // | keyof typeof AXPWidgetsList.Editors
802
+ // | keyof typeof AXPWidgetsList.Layouts
803
+ // | keyof typeof AXPWidgetsList.Actions
804
+ // | keyof typeof AXPWidgetsList.Advanced
805
+ // | keyof typeof AXPWidgetsList.Templates
806
+ // | keyof typeof AXPWidgetsList.Entity
807
+ // | keyof typeof AXPWidgetsList.Theme
808
+ // {
809
+ // console.log('Converting widget string:', widgetString);
810
+ // // Check if the string is in format "AXPWidgetsList.Category.Key"
811
+ // if (widgetString.startsWith('AXPWidgetsList.')) {
812
+ // // Extract the key from "AXPWidgetsList.Editors.DateTimeBox" -> "DateTimeBox"
813
+ // const parts = widgetString.split('.');
814
+ // if (parts.length >= 3) {
815
+ // const key = parts[parts.length - 1]; // Get the last part (key)
816
+ // console.log('Extracted key from AXPWidgetsList format:', key);
817
+ // return key as any;
818
+ // }
819
+ // }
820
+ // // Search through all AXPWidgetsList categories to find matching widget
821
+ // for (const category of Object.values(AXPWidgetsList)) {
822
+ // if (typeof category === 'object') {
823
+ // for (const [key, value] of Object.entries(category)) {
824
+ // if (value === widgetString) {
825
+ // console.log('Found matching widget:', key, 'for value:', value);
826
+ // return key as any; // Return the AXPWidgetsList key (e.g., "DateTimeBox")
827
+ // }
828
+ // }
829
+ // }
830
+ // }
831
+ // console.log('Widget not found in AXPWidgetsList, returning original string:', widgetString);
832
+ // // If not found in AXPWidgetsList, return the original string as fallback
833
+ // return widgetString as any;
834
+ // }
835
+ //#endregion
836
+ //#region ---- Shared Data Service ----
837
+ class AXCReportManagementDataService {
838
+ constructor() {
839
+ this.http = inject(HttpClient);
840
+ this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
841
+ this.baseUrl = this.configs.baseUrl;
842
+ // Shared cache for all categories data
843
+ this.allCategoriesData = [];
844
+ this.dataLoaded = false;
845
+ }
846
+ async getAllCategoriesData() {
847
+ if (!this.dataLoaded) {
848
+ await this.loadAllCategories();
849
+ }
850
+ return this.allCategoriesData;
851
+ }
852
+ async loadAllCategories() {
853
+ const url = `${this.baseUrl}/v1/global/report-management/category`;
854
+ const params = { Skip: 0, Take: 1000 };
855
+ const response = await firstValueFrom(this.http.get(url, { params }));
856
+ this.allCategoriesData = response.items;
857
+ this.dataLoaded = true;
858
+ }
859
+ clearCache() {
860
+ this.allCategoriesData = [];
861
+ this.dataLoaded = false;
862
+ }
863
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportManagementDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
864
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportManagementDataService }); }
865
+ }
866
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportManagementDataService, decorators: [{
867
+ type: Injectable
868
+ }] });
869
+ //#endregion
870
+ //#region ---- API Providers ----
871
+ class AXCReportCategoryApiProvider {
872
+ constructor() {
873
+ this.dataService = inject(AXCReportManagementDataService);
874
+ // Cache to store processed categories
875
+ this.categoriesCache = new Map();
876
+ }
877
+ async getList(parentId) {
878
+ // Check cache first
879
+ if (this.categoriesCache.has(parentId)) {
880
+ return this.categoriesCache.get(parentId);
881
+ }
882
+ try {
883
+ // Get data from shared service
884
+ const allCategoriesData = await this.dataService.getAllCategoriesData();
885
+ // Filter categories based on parentId
886
+ let filteredItems;
887
+ if (!parentId) {
888
+ // Root categories (no parent)
889
+ filteredItems = allCategoriesData.filter((item) => !item.reportCategoryParentId);
890
+ }
891
+ else {
892
+ // Child categories
893
+ filteredItems = allCategoriesData.filter((item) => item.reportCategoryParentId === parentId);
894
+ }
895
+ const categories = filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
896
+ // Cache the result
897
+ this.categoriesCache.set(parentId, categories);
898
+ return categories;
899
+ }
900
+ catch (error) {
901
+ console.error('Error fetching report categories:', error);
902
+ return [];
903
+ }
904
+ }
905
+ async getById(id) {
906
+ try {
907
+ // Get data from shared service
908
+ const allCategoriesData = await this.dataService.getAllCategoriesData();
909
+ const apiItem = allCategoriesData.find((item) => item.id === id);
910
+ if (!apiItem) {
911
+ return undefined;
912
+ }
913
+ return this.mapApiCategoryToReportCategory(apiItem);
914
+ }
915
+ catch (error) {
916
+ console.error('Error fetching report category by ID:', error);
917
+ return undefined;
918
+ }
919
+ }
920
+ mapApiCategoryToReportCategory(apiItem) {
921
+ return {
922
+ id: apiItem.id,
923
+ title: apiItem.title,
924
+ description: apiItem.description || undefined,
925
+ parentId: apiItem.reportCategoryParentId || undefined,
926
+ hasChild: apiItem.folderCount > 0, // folderItems = folders
927
+ hasReport: apiItem.itemCount > 0, // reportDefinitionItems = files
928
+ };
929
+ }
930
+ // Method to clear cache when needed
931
+ clearCache() {
932
+ this.categoriesCache.clear();
933
+ this.dataService.clearCache();
934
+ }
935
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportCategoryApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
936
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportCategoryApiProvider }); }
937
+ }
938
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportCategoryApiProvider, decorators: [{
939
+ type: Injectable
940
+ }] });
941
+ class AXCReportDefinitionApiProvider {
942
+ constructor() {
943
+ this.dataService = inject(AXCReportManagementDataService);
944
+ this.http = inject(HttpClient);
945
+ // Cache to store report definitions by category to avoid unnecessary API calls
946
+ this.reportDefinitionsCache = new Map();
947
+ }
948
+ async getList(categoryId) {
949
+ // Check cache first
950
+ if (this.reportDefinitionsCache.has(categoryId)) {
951
+ return this.reportDefinitionsCache.get(categoryId);
952
+ }
953
+ try {
954
+ // Get data from shared service
955
+ const allCategoriesData = await this.dataService.getAllCategoriesData();
956
+ // Find the specific category and extract its report definitions
957
+ const categoryItem = allCategoriesData.find((item) => item.id === categoryId);
958
+ if (!categoryItem) {
959
+ // Cache empty result to avoid repeated API calls
960
+ this.reportDefinitionsCache.set(categoryId, []);
961
+ return [];
962
+ }
963
+ const reportDefinitions = categoryItem.reportDefinitionItems.map((item) => this.mapApiReportDefinitionItemToReportDefinition(item));
964
+ // Cache the result
965
+ this.reportDefinitionsCache.set(categoryId, reportDefinitions);
966
+ return reportDefinitions;
967
+ }
968
+ catch (error) {
969
+ console.error('Error fetching report definitions:', error);
970
+ // Cache empty result to avoid repeated failed API calls
971
+ this.reportDefinitionsCache.set(categoryId, []);
972
+ return [];
973
+ }
974
+ }
975
+ async getById(id) {
976
+ try {
977
+ // Make API call to get full report definition with layouts
978
+ const url = `${this.dataService['baseUrl']}/v1/global/report-management/report/${id}`;
979
+ const response = await firstValueFrom(this.http.get(url));
980
+ return this.mapApiReportDefinitionToReportDefinition(response);
981
+ }
982
+ catch (error) {
983
+ console.error('Error fetching report definition by ID:', error);
984
+ return undefined;
985
+ }
986
+ }
987
+ mapApiReportDefinitionItemToReportDefinition(apiItem) {
988
+ return {
989
+ id: apiItem.id,
990
+ title: apiItem.title,
991
+ description: apiItem.description || undefined,
992
+ categoryIds: apiItem.categoryIds,
993
+ parameterGroups: [], // These would need to be fetched separately if needed
994
+ layouts: [], // These would need to be fetched separately if needed
995
+ defaultLayoutId: '', // This would need to be set based on the first layout
996
+ };
997
+ }
998
+ mapApiReportDefinitionToReportDefinition(apiResponse) {
999
+ let res = {
1000
+ id: apiResponse.id,
1001
+ title: apiResponse.title,
1002
+ description: apiResponse.description || undefined,
1003
+ categoryIds: apiResponse.categoryIds,
1004
+ parameterGroups: apiResponse.parameterGroups.map((group) => ({
1005
+ name: group.name,
1006
+ title: group.title,
1007
+ parameters: group.parameters.map((param) => ({
1008
+ path: param.path,
1009
+ title: param.title,
1010
+ description: param.description,
1011
+ widget: {
1012
+ type: param.widget.type,
1013
+ options: param.widget.options || {},
1014
+ valueTransforms: param.widget.valueTransforms || {},
1015
+ },
1016
+ })),
1017
+ })),
1018
+ layouts: apiResponse.layouts.map((layout) => ({
1019
+ id: layout.id,
1020
+ title: layout.title,
1021
+ layout: layout.layout,
1022
+ dataSource: layout.dataSource,
1023
+ export: layout.export,
1024
+ isDefault: layout.isDefault || false,
1025
+ })),
1026
+ defaultLayoutId: apiResponse.defaultLayoutId,
1027
+ };
1028
+ return res;
1029
+ }
1030
+ // Method to clear cache when needed
1031
+ clearCache() {
1032
+ this.reportDefinitionsCache.clear();
1033
+ this.dataService.clearCache();
1034
+ }
1035
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportDefinitionApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1036
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportDefinitionApiProvider }); }
1037
+ }
1038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportDefinitionApiProvider, decorators: [{
1039
+ type: Injectable
1040
+ }] });
1041
+ //#endregion
1042
+ //#region ---- Provider Exports ----
1043
+ const AXC_REPORT_CATEGORY_API_PROVIDER = {
1044
+ provide: AXP_REPORT_CATEGORY_PROVIDER,
1045
+ useClass: AXCReportCategoryApiProvider,
1046
+ multi: true,
1047
+ };
1048
+ const AXC_REPORT_DEFINITION_API_PROVIDER = {
1049
+ provide: AXP_REPORT_DEFINITION_PROVIDER,
1050
+ useClass: AXCReportDefinitionApiProvider,
1051
+ multi: true,
1052
+ };
1053
+
1054
+ class AXCReportManagementApiModule {
1055
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportManagementApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1056
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXCReportManagementApiModule, imports: [AXPRuntimeModule] }); }
1057
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportManagementApiModule, providers: [
1058
+ AXCReportManagementDataService,
1059
+ AXC_REPORT_CATEGORY_API_PROVIDER,
1060
+ AXC_REPORT_DEFINITION_API_PROVIDER,
1061
+ provideCommandSetups([
1062
+ {
1063
+ key: 'ReportManagement.Report:Execute',
1064
+ command: () => import('./acorex-connectivity-api-execute.command-DW9Lro_P.mjs').then((c) => c.AXCReportExecuteCommand),
1065
+ },
1066
+ ]),
1067
+ ], imports: [AXPRuntimeModule] }); }
1068
+ }
1069
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCReportManagementApiModule, decorators: [{
1070
+ type: NgModule,
1071
+ args: [{
1072
+ imports: [AXPRuntimeModule],
1073
+ exports: [],
1074
+ declarations: [],
1075
+ providers: [
1076
+ AXCReportManagementDataService,
1077
+ AXC_REPORT_CATEGORY_API_PROVIDER,
1078
+ AXC_REPORT_DEFINITION_API_PROVIDER,
1079
+ provideCommandSetups([
1080
+ {
1081
+ key: 'ReportManagement.Report:Execute',
1082
+ command: () => import('./acorex-connectivity-api-execute.command-DW9Lro_P.mjs').then((c) => c.AXCReportExecuteCommand),
1083
+ },
1084
+ ]),
1085
+ ],
1086
+ }]
1087
+ }] });
1088
+
782
1089
  class AXCApiModule {
783
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
784
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, imports: [i1$1.OAuthModule, i2.AXPAuthModule, AXCUtilsModule] }); }
785
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, providers: [
1090
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1091
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXCApiModule, imports: [i1$1.OAuthModule, i2.AXPAuthModule, AXCUtilsModule,
1092
+ AXCReportManagementApiModule] }); }
1093
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCApiModule, providers: [
786
1094
  {
787
1095
  provide: AXPEntityStorageService,
788
1096
  useClass: AXCApiEntityStorageService,
@@ -813,14 +1121,15 @@ class AXCApiModule {
813
1121
  selectValueStrategy: 'valueField',
814
1122
  lookupValueStrategy: 'valueField',
815
1123
  },
816
- },
1124
+ }
817
1125
  ], imports: [OAuthModule.forRoot(),
818
1126
  AXPAuthModule.forRoot({
819
1127
  strategies: [AXCAPIOidcStrategy],
820
1128
  }),
821
- AXCUtilsModule] }); }
1129
+ AXCUtilsModule,
1130
+ AXCReportManagementApiModule] }); }
822
1131
  }
823
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, decorators: [{
1132
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCApiModule, decorators: [{
824
1133
  type: NgModule,
825
1134
  args: [{
826
1135
  imports: [
@@ -829,6 +1138,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
829
1138
  strategies: [AXCAPIOidcStrategy],
830
1139
  }),
831
1140
  AXCUtilsModule,
1141
+ AXCReportManagementApiModule,
832
1142
  ],
833
1143
  providers: [
834
1144
  {
@@ -861,7 +1171,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
861
1171
  selectValueStrategy: 'valueField',
862
1172
  lookupValueStrategy: 'valueField',
863
1173
  },
864
- },
1174
+ }
865
1175
  ],
866
1176
  }]
867
1177
  }] });
@@ -1130,10 +1440,10 @@ class APIGoogleStrategy extends AXPAuthStrategy {
1130
1440
  console.error('Authentication error:', error);
1131
1441
  throw error;
1132
1442
  }
1133
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: APIGoogleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1134
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: APIGoogleStrategy }); }
1443
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: APIGoogleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1444
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: APIGoogleStrategy }); }
1135
1445
  }
1136
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: APIGoogleStrategy, decorators: [{
1446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: APIGoogleStrategy, decorators: [{
1137
1447
  type: Injectable
1138
1448
  }], ctorParameters: () => [] });
1139
1449
 
@@ -1141,5 +1451,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
1141
1451
  * Generated bundle index. Do not edit.
1142
1452
  */
1143
1453
 
1144
- export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
1454
+ export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCReportManagementApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
1145
1455
  //# sourceMappingURL=acorex-connectivity-api.mjs.map