@acorex/connectivity 20.6.0-next.5 → 20.6.0-next.7

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 (16) hide show
  1. package/api/index.d.ts +191 -2
  2. package/fesm2022/{acorex-connectivity-api-execute.command-BesxhDsD.mjs → acorex-connectivity-api-execute.command-BwXw_Kn7.mjs} +4 -4
  3. package/fesm2022/{acorex-connectivity-api-execute.command-BesxhDsD.mjs.map → acorex-connectivity-api-execute.command-BwXw_Kn7.mjs.map} +1 -1
  4. package/fesm2022/acorex-connectivity-api.mjs +209 -115
  5. package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
  6. package/fesm2022/{acorex-connectivity-mock-category-with-items.query-Cii5As1T.mjs → acorex-connectivity-mock-category-with-items.query-NY9J0cQ0.mjs} +4 -4
  7. package/fesm2022/{acorex-connectivity-mock-category-with-items.query-Cii5As1T.mjs.map → acorex-connectivity-mock-category-with-items.query-NY9J0cQ0.mjs.map} +1 -1
  8. package/fesm2022/{acorex-connectivity-mock-distribution-record.command-w3zoeELy.mjs → acorex-connectivity-mock-distribution-record.command-B-Xviv6G.mjs} +4 -4
  9. package/fesm2022/{acorex-connectivity-mock-distribution-record.command-w3zoeELy.mjs.map → acorex-connectivity-mock-distribution-record.command-B-Xviv6G.mjs.map} +1 -1
  10. package/fesm2022/{acorex-connectivity-mock-sample.command-C5jZuYcW.mjs → acorex-connectivity-mock-sample.command-BkxMgq1C.mjs} +4 -4
  11. package/fesm2022/{acorex-connectivity-mock-sample.command-C5jZuYcW.mjs.map → acorex-connectivity-mock-sample.command-BkxMgq1C.mjs.map} +1 -1
  12. package/fesm2022/acorex-connectivity-mock.mjs +600 -600
  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/package.json +6 -6
@@ -138,10 +138,10 @@ class AXCApiEntityStorageService {
138
138
  };
139
139
  });
140
140
  }
141
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", 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.10", ngImport: i0, type: AXCApiEntityStorageService }); }
141
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", 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.12", ngImport: i0, type: AXCApiEntityStorageService }); }
143
143
  }
144
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCApiEntityStorageService, decorators: [{
144
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiEntityStorageService, decorators: [{
145
145
  type: Injectable
146
146
  }], ctorParameters: () => [{ type: i1.HttpClient }] });
147
147
 
@@ -285,10 +285,10 @@ class AXCFileStorageApiService extends AXPFileStorageService {
285
285
  // Silently fail in fallback mode
286
286
  }
287
287
  }
288
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCFileStorageApiService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
289
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCFileStorageApiService }); }
288
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCFileStorageApiService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
289
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCFileStorageApiService }); }
290
290
  }
291
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCFileStorageApiService, decorators: [{
291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCFileStorageApiService, decorators: [{
292
292
  type: Injectable
293
293
  }] });
294
294
 
@@ -333,10 +333,10 @@ class AXMOidcApplicationLoader {
333
333
  // features: item.features || [],
334
334
  };
335
335
  }
336
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", 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.10", ngImport: i0, type: AXMOidcApplicationLoader }); }
336
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", 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.12", ngImport: i0, type: AXMOidcApplicationLoader }); }
338
338
  }
339
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXMOidcApplicationLoader, decorators: [{
339
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcApplicationLoader, decorators: [{
340
340
  type: Injectable
341
341
  }], ctorParameters: () => [{ type: i1.HttpClient }] });
342
342
 
@@ -376,10 +376,10 @@ class AXMConfigurationService {
376
376
  switchMap(() => of(this.applicationConfig)));
377
377
  }
378
378
  }
379
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", 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.10", ngImport: i0, type: AXMConfigurationService, providedIn: 'root' }); }
379
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", 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.12", ngImport: i0, type: AXMConfigurationService, providedIn: 'root' }); }
381
381
  }
382
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXMConfigurationService, decorators: [{
382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMConfigurationService, decorators: [{
383
383
  type: Injectable,
384
384
  args: [{
385
385
  providedIn: 'root',
@@ -725,10 +725,10 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
725
725
  get name() {
726
726
  return 'oidc';
727
727
  }
728
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCAPIOidcStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
729
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCAPIOidcStrategy }); }
728
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCAPIOidcStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
729
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCAPIOidcStrategy }); }
730
730
  }
731
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCAPIOidcStrategy, decorators: [{
731
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCAPIOidcStrategy, decorators: [{
732
732
  type: Injectable
733
733
  }] });
734
734
 
@@ -753,10 +753,10 @@ class AXMOidcPermissionLoader {
753
753
  const truePolicies = Object.keys(policies).filter((key) => policies[key] === true);
754
754
  return truePolicies;
755
755
  }
756
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", 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.10", ngImport: i0, type: AXMOidcPermissionLoader }); }
756
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", 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.12", ngImport: i0, type: AXMOidcPermissionLoader }); }
758
758
  }
759
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXMOidcPermissionLoader, decorators: [{
759
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcPermissionLoader, decorators: [{
760
760
  type: Injectable
761
761
  }], ctorParameters: () => [{ type: i1.HttpClient }] });
762
762
 
@@ -782,10 +782,10 @@ class AXMOidcTenantLoader {
782
782
  // Add other fields and defaults as needed, and handle the logo if applicable
783
783
  };
784
784
  }
785
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", 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.10", ngImport: i0, type: AXMOidcTenantLoader }); }
785
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", 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.12", ngImport: i0, type: AXMOidcTenantLoader }); }
787
787
  }
788
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXMOidcTenantLoader, decorators: [{
788
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcTenantLoader, decorators: [{
789
789
  type: Injectable
790
790
  }], ctorParameters: () => [{ type: i1.HttpClient }] });
791
791
 
@@ -839,63 +839,174 @@ class AXCReportManagementDataService {
839
839
  this.http = inject(HttpClient);
840
840
  this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
841
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();
842
+ // Cache for category data to avoid duplicate API calls
843
+ this.categoryDataCache = new Map();
844
+ this.rootCategoriesCache = null;
845
+ this.pendingRequests = new Map();
846
+ this.pendingRootCategoriesRequest = null;
847
+ }
848
+ //#region ---- Lazy Category/Report Fetching ----
849
+ /**
850
+ * Fetch root categories (no parent). Only root categories without reports and children.
851
+ * Uses cache and pending requests to avoid duplicate API calls.
852
+ */
853
+ async getRootCategories() {
854
+ // Check if already cached
855
+ if (this.rootCategoriesCache !== null) {
856
+ return this.rootCategoriesCache;
849
857
  }
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
+ // Check if there's already a pending request
859
+ if (this.pendingRootCategoriesRequest !== null) {
860
+ return this.pendingRootCategoriesRequest;
861
+ }
862
+ // Create the request and cache it
863
+ const requestPromise = (async () => {
864
+ try {
865
+ const url = `${this.baseUrl}/v1/global/report-management/category`;
866
+ const params = { Skip: 0, Take: 1000 };
867
+ const response = await firstValueFrom(this.http.get(url, { params }));
868
+ const all = response.items ?? [];
869
+ const rootCategories = all.filter((i) => !i.reportCategoryParentId);
870
+ // Cache the result
871
+ this.rootCategoriesCache = rootCategories;
872
+ return rootCategories;
873
+ }
874
+ finally {
875
+ // Remove from pending requests after completion
876
+ this.pendingRootCategoriesRequest = null;
877
+ }
878
+ })();
879
+ this.pendingRootCategoriesRequest = requestPromise;
880
+ return requestPromise;
881
+ }
882
+ /**
883
+ * Fetch category data for a given parentId.
884
+ * Returns the parent category with its FolderItems (children) and ReportDefinitionItems (reports).
885
+ * Uses cache to avoid duplicate API calls.
886
+ */
887
+ async getCategoryData(parentId) {
888
+ // Check if already cached
889
+ if (this.categoryDataCache.has(parentId)) {
890
+ return this.categoryDataCache.get(parentId);
891
+ }
892
+ // Check if there's already a pending request for this category
893
+ if (this.pendingRequests.has(parentId)) {
894
+ return this.pendingRequests.get(parentId);
895
+ }
896
+ // Create the request and cache it
897
+ const requestPromise = (async () => {
898
+ try {
899
+ const url = `${this.baseUrl}/v1/global/report-management/category/${parentId}`;
900
+ const response = await firstValueFrom(this.http.get(url));
901
+ const categoryData = response.items?.[0];
902
+ // Cache the result
903
+ this.categoryDataCache.set(parentId, categoryData);
904
+ return categoryData;
905
+ }
906
+ catch {
907
+ const undefinedResult = undefined;
908
+ this.categoryDataCache.set(parentId, undefinedResult);
909
+ return undefinedResult;
910
+ }
911
+ finally {
912
+ // Remove from pending requests after completion
913
+ this.pendingRequests.delete(parentId);
914
+ }
915
+ })();
916
+ this.pendingRequests.set(parentId, requestPromise);
917
+ return requestPromise;
918
+ }
919
+ /**
920
+ * Fetch both child categories and reports for a given parentId.
921
+ * This method ensures only one API call is made and both results are returned.
922
+ */
923
+ async getCategoryChildrenAndReports(parentId) {
924
+ const categoryData = await this.getCategoryData(parentId);
925
+ return {
926
+ categories: categoryData?.folderItems ?? [],
927
+ reports: categoryData?.reportDefinitionItems ?? [],
928
+ };
858
929
  }
859
- clearCache() {
860
- this.allCategoriesData = [];
861
- this.dataLoaded = false;
930
+ /**
931
+ * Fetch child categories of a given parent.
932
+ * Uses getCategoryData to get FolderItems (children) from the parent category.
933
+ */
934
+ async getChildCategories(parentId) {
935
+ const categoryData = await this.getCategoryData(parentId);
936
+ return categoryData?.folderItems ?? [];
937
+ }
938
+ /**
939
+ * Fetch report definitions that belong to a specific category.
940
+ * Uses getCategoryData to get ReportDefinitionItems (reports) from the category.
941
+ */
942
+ async getCategoryReports(categoryId) {
943
+ const categoryData = await this.getCategoryData(categoryId);
944
+ return categoryData?.reportDefinitionItems ?? [];
945
+ }
946
+ /**
947
+ * Fetch a single category by id.
948
+ * First checks cache, then uses getCategoryData if not found in cache.
949
+ */
950
+ async getCategoryById(id) {
951
+ // First check if it's in cache (from previous getCategoryData calls)
952
+ if (this.categoryDataCache.has(id)) {
953
+ return this.categoryDataCache.get(id);
954
+ }
955
+ // Try to get from category data endpoint (which will cache it)
956
+ const categoryData = await this.getCategoryData(id);
957
+ if (categoryData) {
958
+ return categoryData;
959
+ }
960
+ // Fallback: search in root categories cache
961
+ if (this.rootCategoriesCache) {
962
+ const found = this.rootCategoriesCache.find((c) => c.id === id);
963
+ if (found) {
964
+ return found;
965
+ }
966
+ }
967
+ // Last resort: search in all categories (but this should rarely happen)
968
+ try {
969
+ const url = `${this.baseUrl}/v1/global/report-management/category`;
970
+ const params = { Skip: 0, Take: 1000 };
971
+ const response = await firstValueFrom(this.http.get(url, { params }));
972
+ const all = response.items ?? [];
973
+ return all.find((c) => c.id === id);
974
+ }
975
+ catch {
976
+ return undefined;
977
+ }
862
978
  }
863
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportManagementDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
864
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportManagementDataService }); }
979
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
980
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementDataService }); }
865
981
  }
866
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportManagementDataService, decorators: [{
982
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementDataService, decorators: [{
867
983
  type: Injectable
868
984
  }] });
869
985
  //#endregion
870
986
  //#region ---- API Providers ----
987
+ /**
988
+ * Category provider that uses the shared data service.
989
+ * Both providers use the same dataService instance which ensures proper caching.
990
+ */
871
991
  class AXCReportCategoryApiProvider {
872
992
  constructor() {
873
993
  this.dataService = inject(AXCReportManagementDataService);
874
- // Cache to store processed categories
875
- this.categoriesCache = new Map();
876
994
  }
877
995
  async getList(parentId) {
878
- // Check cache first
879
- if (this.categoriesCache.has(parentId)) {
880
- return this.categoriesCache.get(parentId);
881
- }
882
996
  try {
883
- // Get data from shared service
884
- const allCategoriesData = await this.dataService.getAllCategoriesData();
885
- // Filter categories based on parentId
886
- let filteredItems;
997
+ // For root level, get root categories (each category includes folderItems in API response)
887
998
  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);
999
+ const filteredItems = await this.dataService.getRootCategories();
1000
+ // Each root category has folderItems in the API response, but we only return the root categories themselves
1001
+ // The folderItems are preserved in the API response structure, similar to child state
1002
+ return filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
894
1003
  }
895
- const categories = filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
896
- // Cache the result
897
- this.categoriesCache.set(parentId, categories);
898
- return categories;
1004
+ // For child level, get categories from category data (which includes folderItems)
1005
+ // This ensures we use the same API response that getList for definitions will use
1006
+ // The folderItems structure is preserved, similar to root state
1007
+ const categoryData = await this.dataService.getCategoryData(parentId);
1008
+ const filteredItems = categoryData?.folderItems ?? [];
1009
+ return filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
899
1010
  }
900
1011
  catch (error) {
901
1012
  console.error('Error fetching report categories:', error);
@@ -904,9 +1015,7 @@ class AXCReportCategoryApiProvider {
904
1015
  }
905
1016
  async getById(id) {
906
1017
  try {
907
- // Get data from shared service
908
- const allCategoriesData = await this.dataService.getAllCategoriesData();
909
- const apiItem = allCategoriesData.find((item) => item.id === id);
1018
+ const apiItem = await this.dataService.getCategoryById(id);
910
1019
  if (!apiItem) {
911
1020
  return undefined;
912
1021
  }
@@ -927,48 +1036,32 @@ class AXCReportCategoryApiProvider {
927
1036
  hasReport: apiItem.itemCount > 0, // reportDefinitionItems = files
928
1037
  };
929
1038
  }
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.10", ngImport: i0, type: AXCReportCategoryApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
936
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportCategoryApiProvider }); }
1039
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportCategoryApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1040
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportCategoryApiProvider }); }
937
1041
  }
938
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportCategoryApiProvider, decorators: [{
1042
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportCategoryApiProvider, decorators: [{
939
1043
  type: Injectable
940
1044
  }] });
1045
+ /**
1046
+ * Definition provider that uses the shared data service.
1047
+ * Both providers use the same dataService instance which ensures proper caching.
1048
+ */
941
1049
  class AXCReportDefinitionApiProvider {
942
1050
  constructor() {
943
1051
  this.dataService = inject(AXCReportManagementDataService);
944
1052
  this.http = inject(HttpClient);
945
- // Cache to store report definitions by category to avoid unnecessary API calls
946
- this.reportDefinitionsCache = new Map();
947
1053
  }
948
1054
  async getList(categoryId) {
949
- // Check cache first
950
- if (this.reportDefinitionsCache.has(categoryId)) {
951
- return this.reportDefinitionsCache.get(categoryId);
952
- }
953
1055
  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);
1056
+ // Use getCategoryData which is cached and shared with getCategories
1057
+ // This ensures only one API call is made when both getCategories and getReportsByCategoryId are called
1058
+ const categoryData = await this.dataService.getCategoryData(categoryId);
1059
+ const defs = categoryData?.reportDefinitionItems ?? [];
1060
+ const reportDefinitions = defs.map((item) => this.mapApiReportDefinitionItemToReportDefinition(item));
966
1061
  return reportDefinitions;
967
1062
  }
968
1063
  catch (error) {
969
1064
  console.error('Error fetching report definitions:', error);
970
- // Cache empty result to avoid repeated failed API calls
971
- this.reportDefinitionsCache.set(categoryId, []);
972
1065
  return [];
973
1066
  }
974
1067
  }
@@ -1027,19 +1120,20 @@ class AXCReportDefinitionApiProvider {
1027
1120
  };
1028
1121
  return res;
1029
1122
  }
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.10", ngImport: i0, type: AXCReportDefinitionApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1036
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportDefinitionApiProvider }); }
1123
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportDefinitionApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1124
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportDefinitionApiProvider }); }
1037
1125
  }
1038
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportDefinitionApiProvider, decorators: [{
1126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportDefinitionApiProvider, decorators: [{
1039
1127
  type: Injectable
1040
1128
  }] });
1041
1129
  //#endregion
1130
+ //#endregion
1042
1131
  //#region ---- Provider Exports ----
1132
+ /**
1133
+ * Both providers use the same dataService instance (which is a singleton),
1134
+ * ensuring they share the same cache and only one API call is made when both
1135
+ * getCategories and getReportsByCategoryId are called for the same categoryId.
1136
+ */
1043
1137
  const AXC_REPORT_CATEGORY_API_PROVIDER = {
1044
1138
  provide: AXP_REPORT_CATEGORY_PROVIDER,
1045
1139
  useClass: AXCReportCategoryApiProvider,
@@ -1052,21 +1146,21 @@ const AXC_REPORT_DEFINITION_API_PROVIDER = {
1052
1146
  };
1053
1147
 
1054
1148
  class AXCReportManagementApiModule {
1055
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportManagementApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1056
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: AXCReportManagementApiModule, imports: [AXPRuntimeModule] }); }
1057
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportManagementApiModule, providers: [
1149
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1150
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, imports: [AXPRuntimeModule] }); }
1151
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, providers: [
1058
1152
  AXCReportManagementDataService,
1059
1153
  AXC_REPORT_CATEGORY_API_PROVIDER,
1060
1154
  AXC_REPORT_DEFINITION_API_PROVIDER,
1061
1155
  provideCommandSetups([
1062
1156
  {
1063
1157
  key: 'ReportManagement.Report:Execute',
1064
- command: () => import('./acorex-connectivity-api-execute.command-BesxhDsD.mjs').then((c) => c.AXCReportExecuteCommand),
1158
+ command: () => import('./acorex-connectivity-api-execute.command-BwXw_Kn7.mjs').then((c) => c.AXCReportExecuteCommand),
1065
1159
  },
1066
1160
  ]),
1067
1161
  ], imports: [AXPRuntimeModule] }); }
1068
1162
  }
1069
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportManagementApiModule, decorators: [{
1163
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, decorators: [{
1070
1164
  type: NgModule,
1071
1165
  args: [{
1072
1166
  imports: [AXPRuntimeModule],
@@ -1079,7 +1173,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
1079
1173
  provideCommandSetups([
1080
1174
  {
1081
1175
  key: 'ReportManagement.Report:Execute',
1082
- command: () => import('./acorex-connectivity-api-execute.command-BesxhDsD.mjs').then((c) => c.AXCReportExecuteCommand),
1176
+ command: () => import('./acorex-connectivity-api-execute.command-BwXw_Kn7.mjs').then((c) => c.AXCReportExecuteCommand),
1083
1177
  },
1084
1178
  ]),
1085
1179
  ],
@@ -1087,10 +1181,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
1087
1181
  }] });
1088
1182
 
1089
1183
  class AXCApiModule {
1090
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1091
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: AXCApiModule, imports: [i1$1.OAuthModule, i2.AXPAuthModule, AXCUtilsModule,
1184
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1185
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: AXCApiModule, imports: [i1$1.OAuthModule, i2.AXPAuthModule, AXCUtilsModule,
1092
1186
  AXCReportManagementApiModule] }); }
1093
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCApiModule, providers: [
1187
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiModule, providers: [
1094
1188
  {
1095
1189
  provide: AXPEntityStorageService,
1096
1190
  useClass: AXCApiEntityStorageService,
@@ -1129,7 +1223,7 @@ class AXCApiModule {
1129
1223
  AXCUtilsModule,
1130
1224
  AXCReportManagementApiModule] }); }
1131
1225
  }
1132
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCApiModule, decorators: [{
1226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiModule, decorators: [{
1133
1227
  type: NgModule,
1134
1228
  args: [{
1135
1229
  imports: [
@@ -1440,10 +1534,10 @@ class APIGoogleStrategy extends AXPAuthStrategy {
1440
1534
  console.error('Authentication error:', error);
1441
1535
  throw error;
1442
1536
  }
1443
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: APIGoogleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1444
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: APIGoogleStrategy }); }
1537
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: APIGoogleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1538
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: APIGoogleStrategy }); }
1445
1539
  }
1446
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: APIGoogleStrategy, decorators: [{
1540
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: APIGoogleStrategy, decorators: [{
1447
1541
  type: Injectable
1448
1542
  }], ctorParameters: () => [] });
1449
1543
 
@@ -1451,5 +1545,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
1451
1545
  * Generated bundle index. Do not edit.
1452
1546
  */
1453
1547
 
1454
- export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCReportManagementApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
1548
+ export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCReportCategoryApiProvider, AXCReportDefinitionApiProvider, AXCReportManagementApiModule, AXCReportManagementDataService, AXC_REPORT_CATEGORY_API_PROVIDER, AXC_REPORT_DEFINITION_API_PROVIDER, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
1455
1549
  //# sourceMappingURL=acorex-connectivity-api.mjs.map