@acorex/connectivity 20.3.0-next.7 → 20.3.0-next.9

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/api/index.d.ts CHANGED
@@ -2,11 +2,12 @@ import { AXPQueryRequest, AXPPagedListResult } from '@acorex/platform/core';
2
2
  import { AXPEntityStorageService } from '@acorex/platform/layout/entity';
3
3
  import { HttpClient } from '@angular/common/http';
4
4
  import * as i0 from '@angular/core';
5
- import * as i1 from 'angular-oauth2-oidc';
5
+ import * as i1$1 from 'angular-oauth2-oidc';
6
6
  import { AuthConfig } from 'angular-oauth2-oidc';
7
7
  import * as i2 from '@acorex/platform/auth';
8
8
  import { AXPApplicationLoader, AXPApplication, AXPFeatureLoader, AXPFeature, AXPAuthStrategy, AXPBaseCredentials, AXPSignInResult, AXPSessionContext, AXPPermissionLoader, AXPPermission, AXPTenantLoader, AXPTenant } from '@acorex/platform/auth';
9
9
  import * as i3 from '@acorex/connectivity/utils';
10
+ import * as i1 from '@acorex/platform/runtime';
10
11
  import { Observable } from 'rxjs';
11
12
 
12
13
  declare class AXCApiEntityStorageService implements AXPEntityStorageService<string, any> {
@@ -15,16 +16,15 @@ declare class AXCApiEntityStorageService implements AXPEntityStorageService<stri
15
16
  private filterService;
16
17
  private entityResolver;
17
18
  private mainUrl;
19
+ private readonly API_VERSION;
20
+ private readonly DEFAULT_AREA;
18
21
  constructor(http: HttpClient);
19
22
  get dbName(): string;
20
23
  getConfigEntity(entityName: string): {
21
24
  module: string;
22
25
  entity: string;
23
26
  area: string;
24
- } | {
25
- module: string;
26
- entity: string;
27
- area: null;
27
+ version: string;
28
28
  };
29
29
  initial<T = any>(entityName: string, collection: T[]): Promise<T[]>;
30
30
  getOne<T = any>(entityName: string, id: string): Promise<T>;
@@ -39,9 +39,15 @@ declare class AXCApiEntityStorageService implements AXPEntityStorageService<stri
39
39
  static ɵprov: i0.ɵɵInjectableDeclaration<AXCApiEntityStorageService>;
40
40
  }
41
41
 
42
+ declare class AXCReportManagementApiModule {
43
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXCReportManagementApiModule, never>;
44
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AXCReportManagementApiModule, never, [typeof i1.AXPRuntimeModule], never>;
45
+ static ɵinj: i0.ɵɵInjectorDeclaration<AXCReportManagementApiModule>;
46
+ }
47
+
42
48
  declare class AXCApiModule {
43
49
  static ɵfac: i0.ɵɵFactoryDeclaration<AXCApiModule, never>;
44
- static ɵmod: i0.ɵɵNgModuleDeclaration<AXCApiModule, never, [typeof i1.OAuthModule, typeof i2.AXPAuthModule, typeof i3.AXCUtilsModule], never>;
50
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AXCApiModule, never, [typeof i1$1.OAuthModule, typeof i2.AXPAuthModule, typeof i3.AXCUtilsModule, typeof AXCReportManagementApiModule], never>;
45
51
  static ɵinj: i0.ɵɵInjectorDeclaration<AXCApiModule>;
46
52
  }
47
53
 
@@ -228,5 +234,5 @@ declare class APIGoogleStrategy extends AXPAuthStrategy {
228
234
  static ɵprov: i0.ɵɵInjectableDeclaration<APIGoogleStrategy>;
229
235
  }
230
236
 
231
- export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
237
+ export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCReportManagementApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
232
238
  export type { AXPOAuthExternalCredentials, AXPUserPassCredentials, ApplicationConfiguration, Auth, Culture, IAuthenticationDataModel, Language, Localization, NameValue, Resource };
@@ -0,0 +1,86 @@
1
+ import { AXPReportDefinitionService } from '@acorex/modules/report-management';
2
+ import { AXP_ROOT_CONFIG_TOKEN } from '@acorex/platform/common';
3
+ import { HttpClient } from '@angular/common/http';
4
+ import * as i0 from '@angular/core';
5
+ import { inject, Injectable } from '@angular/core';
6
+ import { firstValueFrom } from 'rxjs';
7
+
8
+ class AXCReportExecuteCommand {
9
+ constructor() {
10
+ this.http = inject(HttpClient);
11
+ this.reportDefinitionService = inject(AXPReportDefinitionService);
12
+ this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
13
+ this.baseUrl = this.configs.baseUrl;
14
+ }
15
+ //#region ---- Command Implementation ----
16
+ async execute(context) {
17
+ try {
18
+ const { reportId, layoutId, parameters } = context;
19
+ // Get the report definition to find the layout
20
+ const reportDefinition = await this.reportDefinitionService.getReportById(reportId);
21
+ if (!reportDefinition) {
22
+ throw new Error(`Report with ID ${reportId} not found`);
23
+ }
24
+ // Find the specific layout
25
+ const layoutDefinition = reportDefinition.layouts.find((l) => l.id === layoutId);
26
+ if (!layoutDefinition) {
27
+ throw new Error(`Layout with ID ${layoutId} not found in report ${reportId}`);
28
+ }
29
+ // Call the Execute API endpoint
30
+ const url = `${this.baseUrl}/v1/global/Report-Management/report/Execute`;
31
+ const body = {
32
+ reportId,
33
+ parameters,
34
+ };
35
+ const executeResult = await firstValueFrom(this.http.post(url, body));
36
+ // Convert ExecuteReportDto to AXPExecutionReportResult format
37
+ let executionResult;
38
+ if (executeResult.type === 'table') {
39
+ executionResult = {
40
+ type: 'table',
41
+ items: executeResult.items,
42
+ total: executeResult.totalCount,
43
+ };
44
+ }
45
+ else if (executeResult.type === 'chart') {
46
+ executionResult = {
47
+ type: 'chart',
48
+ data: executeResult.items[0] || {},
49
+ };
50
+ }
51
+ else if (executeResult.type === 'cards') {
52
+ executionResult = {
53
+ type: 'cards',
54
+ items: executeResult.items,
55
+ };
56
+ }
57
+ else {
58
+ executionResult = {
59
+ type: 'custom',
60
+ data: executeResult.items,
61
+ };
62
+ }
63
+ // Return the combined layout configuration and data
64
+ return {
65
+ ...layoutDefinition.layout,
66
+ data: executionResult,
67
+ };
68
+ }
69
+ catch (error) {
70
+ console.error('Error executing report:', error);
71
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
72
+ throw new Error(`Failed to execute report: ${errorMessage}`);
73
+ }
74
+ }
75
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportExecuteCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
76
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportExecuteCommand, providedIn: 'root' }); }
77
+ }
78
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportExecuteCommand, decorators: [{
79
+ type: Injectable,
80
+ args: [{
81
+ providedIn: 'root',
82
+ }]
83
+ }] });
84
+
85
+ export { AXCReportExecuteCommand };
86
+ //# sourceMappingURL=acorex-connectivity-api-execute.command-CP4cZ_5M.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-connectivity-api-execute.command-CP4cZ_5M.mjs","sources":["../tmp-esm2022/api/lib/report-management/execute.command.js"],"sourcesContent":["import { AXPReportDefinitionService, } from '@acorex/modules/report-management';\nimport { AXP_ROOT_CONFIG_TOKEN } from '@acorex/platform/common';\nimport { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { firstValueFrom } from 'rxjs';\nimport * as i0 from \"@angular/core\";\nexport class AXCReportExecuteCommand {\n constructor() {\n this.http = inject(HttpClient);\n this.reportDefinitionService = inject(AXPReportDefinitionService);\n this.configs = inject(AXP_ROOT_CONFIG_TOKEN);\n this.baseUrl = this.configs.baseUrl;\n }\n //#region ---- Command Implementation ----\n async execute(context) {\n try {\n const { reportId, layoutId, parameters } = context;\n // Get the report definition to find the layout\n const reportDefinition = await this.reportDefinitionService.getReportById(reportId);\n if (!reportDefinition) {\n throw new Error(`Report with ID ${reportId} not found`);\n }\n // Find the specific layout\n const layoutDefinition = reportDefinition.layouts.find((l) => l.id === layoutId);\n if (!layoutDefinition) {\n throw new Error(`Layout with ID ${layoutId} not found in report ${reportId}`);\n }\n // Call the Execute API endpoint\n const url = `${this.baseUrl}/v1/global/Report-Management/report/Execute`;\n const body = {\n reportId,\n parameters,\n };\n const executeResult = await firstValueFrom(this.http.post(url, body));\n // Convert ExecuteReportDto to AXPExecutionReportResult format\n let executionResult;\n if (executeResult.type === 'table') {\n executionResult = {\n type: 'table',\n items: executeResult.items,\n total: executeResult.totalCount,\n };\n }\n else if (executeResult.type === 'chart') {\n executionResult = {\n type: 'chart',\n data: executeResult.items[0] || {},\n };\n }\n else if (executeResult.type === 'cards') {\n executionResult = {\n type: 'cards',\n items: executeResult.items,\n };\n }\n else {\n executionResult = {\n type: 'custom',\n data: executeResult.items,\n };\n }\n // Return the combined layout configuration and data\n return {\n ...layoutDefinition.layout,\n data: executionResult,\n };\n }\n catch (error) {\n console.error('Error executing report:', error);\n const errorMessage = error instanceof Error ? error.message : 'Unknown error';\n throw new Error(`Failed to execute report: ${errorMessage}`);\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.1.8\", ngImport: i0, type: AXCReportExecuteCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"20.1.8\", ngImport: i0, type: AXCReportExecuteCommand, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"20.1.8\", ngImport: i0, type: AXCReportExecuteCommand, decorators: [{\n type: Injectable,\n args: [{\n providedIn: 'root',\n }]\n }] });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhlY3V0ZS5jb21tYW5kLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb25uZWN0aXZpdHkvYX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BAAuB,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;AAC1L,IAAI,SAAS,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,qBAAqB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;AACjK;AACA,EAAE,CAAC,wBAAwB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,UAAU,EAAE,CAAC;AACjI,YAAY,IAAI,EAAE,UAAU;AAC5B,YAAY,IAAI,EAAE,CAAC;AACnB,oBAAoB,UAAU,EAAE,MAAM;AACtC,iBAAiB;AACjB,SAAS,CAAC,EAAE,CAAC;;;;"}
@@ -14,6 +14,8 @@ 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,7 +131,7 @@ 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,
@@ -631,7 +638,8 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
631
638
  localStorage.removeItem('pkce_code_verifier');
632
639
  localStorage.removeItem('oauth_provider');
633
640
  console.log(this.openidConfigurationInfo?.info?.discoveryDocument);
634
- const logoutUrl = `${this.aXMAuthConfigs?.baseUrl}/connect/logout`;
641
+ // Use configured logoutUrl or derive from baseUrl
642
+ const logoutUrl = this.aXMAuthConfigs.logoutUrl || `connect/logout`;
635
643
  window.location.href = logoutUrl;
636
644
  }
637
645
  async refreshToken(context) {
@@ -779,9 +787,321 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
779
787
  type: Injectable
780
788
  }], ctorParameters: () => [{ type: i1.HttpClient }] });
781
789
 
790
+ //#endregion
791
+ //#region ---- Helper Functions ----
792
+ // /**
793
+ // * Converts a widget string to AXPWidgetsList key
794
+ // */
795
+ // function convertWidgetStringToAXPWidgetsListKey(
796
+ // widgetString: string,
797
+ // )
798
+ // :
799
+ // | keyof typeof AXPWidgetsList.Editors
800
+ // | keyof typeof AXPWidgetsList.Layouts
801
+ // | keyof typeof AXPWidgetsList.Actions
802
+ // | keyof typeof AXPWidgetsList.Advanced
803
+ // | keyof typeof AXPWidgetsList.Templates
804
+ // | keyof typeof AXPWidgetsList.Entity
805
+ // | keyof typeof AXPWidgetsList.Theme
806
+ // {
807
+ // console.log('Converting widget string:', widgetString);
808
+ // // Check if the string is in format "AXPWidgetsList.Category.Key"
809
+ // if (widgetString.startsWith('AXPWidgetsList.')) {
810
+ // // Extract the key from "AXPWidgetsList.Editors.DateTimeBox" -> "DateTimeBox"
811
+ // const parts = widgetString.split('.');
812
+ // if (parts.length >= 3) {
813
+ // const key = parts[parts.length - 1]; // Get the last part (key)
814
+ // console.log('Extracted key from AXPWidgetsList format:', key);
815
+ // return key as any;
816
+ // }
817
+ // }
818
+ // // Search through all AXPWidgetsList categories to find matching widget
819
+ // for (const category of Object.values(AXPWidgetsList)) {
820
+ // if (typeof category === 'object') {
821
+ // for (const [key, value] of Object.entries(category)) {
822
+ // if (value === widgetString) {
823
+ // console.log('Found matching widget:', key, 'for value:', value);
824
+ // return key as any; // Return the AXPWidgetsList key (e.g., "DateTimeBox")
825
+ // }
826
+ // }
827
+ // }
828
+ // }
829
+ // console.log('Widget not found in AXPWidgetsList, returning original string:', widgetString);
830
+ // // If not found in AXPWidgetsList, return the original string as fallback
831
+ // return widgetString as any;
832
+ // }
833
+ //#endregion
834
+ //#region ---- Shared Data Service ----
835
+ class AXCReportManagementDataService {
836
+ constructor() {
837
+ this.http = inject(HttpClient);
838
+ this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
839
+ this.baseUrl = this.configs.baseUrl;
840
+ // Shared cache for all categories data
841
+ this.allCategoriesData = [];
842
+ this.dataLoaded = false;
843
+ }
844
+ async getAllCategoriesData() {
845
+ if (!this.dataLoaded) {
846
+ await this.loadAllCategories();
847
+ }
848
+ return this.allCategoriesData;
849
+ }
850
+ async loadAllCategories() {
851
+ const url = `${this.baseUrl}/v1/global/report-management/category`;
852
+ const params = { Skip: 0, Take: 1000 };
853
+ const response = await firstValueFrom(this.http.get(url, { params }));
854
+ this.allCategoriesData = response.items;
855
+ this.dataLoaded = true;
856
+ }
857
+ clearCache() {
858
+ this.allCategoriesData = [];
859
+ this.dataLoaded = false;
860
+ }
861
+ async executeReport(reportId, parameters = {}) {
862
+ debugger;
863
+ const url = `{this.dataService['baseUrl']}/api/v1/global/Report-Management/report/Execute`;
864
+ const body = {
865
+ reportId,
866
+ parameters,
867
+ };
868
+ const response = await firstValueFrom(this.http.post(url, body));
869
+ return response;
870
+ }
871
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportManagementDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
872
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportManagementDataService }); }
873
+ }
874
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportManagementDataService, decorators: [{
875
+ type: Injectable
876
+ }] });
877
+ //#endregion
878
+ //#region ---- API Providers ----
879
+ class AXCReportCategoryApiProvider {
880
+ constructor() {
881
+ this.dataService = inject(AXCReportManagementDataService);
882
+ // Cache to store processed categories
883
+ this.categoriesCache = new Map();
884
+ }
885
+ async getList(parentId) {
886
+ // Check cache first
887
+ if (this.categoriesCache.has(parentId)) {
888
+ return this.categoriesCache.get(parentId);
889
+ }
890
+ try {
891
+ // Get data from shared service
892
+ const allCategoriesData = await this.dataService.getAllCategoriesData();
893
+ // Filter categories based on parentId
894
+ let filteredItems;
895
+ if (!parentId) {
896
+ // Root categories (no parent)
897
+ filteredItems = allCategoriesData.filter((item) => !item.reportCategoryParentId);
898
+ }
899
+ else {
900
+ // Child categories
901
+ filteredItems = allCategoriesData.filter((item) => item.reportCategoryParentId === parentId);
902
+ }
903
+ const categories = filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
904
+ // Cache the result
905
+ this.categoriesCache.set(parentId, categories);
906
+ return categories;
907
+ }
908
+ catch (error) {
909
+ console.error('Error fetching report categories:', error);
910
+ return [];
911
+ }
912
+ }
913
+ async getById(id) {
914
+ try {
915
+ // Get data from shared service
916
+ const allCategoriesData = await this.dataService.getAllCategoriesData();
917
+ const apiItem = allCategoriesData.find((item) => item.id === id);
918
+ if (!apiItem) {
919
+ return undefined;
920
+ }
921
+ return this.mapApiCategoryToReportCategory(apiItem);
922
+ }
923
+ catch (error) {
924
+ console.error('Error fetching report category by ID:', error);
925
+ return undefined;
926
+ }
927
+ }
928
+ mapApiCategoryToReportCategory(apiItem) {
929
+ return {
930
+ id: apiItem.id,
931
+ title: apiItem.title,
932
+ description: apiItem.description || undefined,
933
+ parentId: apiItem.reportCategoryParentId || undefined,
934
+ hasChild: apiItem.folderCount > 0, // folderItems = folders
935
+ hasReport: apiItem.itemCount > 0, // reportDefinitionItems = files
936
+ };
937
+ }
938
+ // Method to clear cache when needed
939
+ clearCache() {
940
+ this.categoriesCache.clear();
941
+ this.dataService.clearCache();
942
+ }
943
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportCategoryApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
944
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportCategoryApiProvider }); }
945
+ }
946
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportCategoryApiProvider, decorators: [{
947
+ type: Injectable
948
+ }] });
949
+ class AXCReportDefinitionApiProvider {
950
+ constructor() {
951
+ this.dataService = inject(AXCReportManagementDataService);
952
+ this.http = inject(HttpClient);
953
+ // Cache to store report definitions by category to avoid unnecessary API calls
954
+ this.reportDefinitionsCache = new Map();
955
+ }
956
+ async getList(categoryId) {
957
+ // Check cache first
958
+ if (this.reportDefinitionsCache.has(categoryId)) {
959
+ return this.reportDefinitionsCache.get(categoryId);
960
+ }
961
+ try {
962
+ // Get data from shared service
963
+ const allCategoriesData = await this.dataService.getAllCategoriesData();
964
+ // Find the specific category and extract its report definitions
965
+ const categoryItem = allCategoriesData.find((item) => item.id === categoryId);
966
+ if (!categoryItem) {
967
+ // Cache empty result to avoid repeated API calls
968
+ this.reportDefinitionsCache.set(categoryId, []);
969
+ return [];
970
+ }
971
+ const reportDefinitions = categoryItem.reportDefinitionItems.map((item) => this.mapApiReportDefinitionItemToReportDefinition(item));
972
+ // Cache the result
973
+ this.reportDefinitionsCache.set(categoryId, reportDefinitions);
974
+ return reportDefinitions;
975
+ }
976
+ catch (error) {
977
+ console.error('Error fetching report definitions:', error);
978
+ // Cache empty result to avoid repeated failed API calls
979
+ this.reportDefinitionsCache.set(categoryId, []);
980
+ return [];
981
+ }
982
+ }
983
+ async getById(id) {
984
+ try {
985
+ console.log('AXCReportDefinitionApiProvider.getById called with ID:', id);
986
+ // Make API call to get full report definition with layouts
987
+ const url = `${this.dataService['baseUrl']}/v1/global/report-management/report/${id}`;
988
+ console.log('Making API call to:', url);
989
+ const response = await firstValueFrom(this.http.get(url));
990
+ return this.mapApiReportDefinitionToReportDefinition(response);
991
+ }
992
+ catch (error) {
993
+ console.error('Error fetching report definition by ID:', error);
994
+ return undefined;
995
+ }
996
+ }
997
+ mapApiReportDefinitionItemToReportDefinition(apiItem) {
998
+ return {
999
+ id: apiItem.id,
1000
+ title: apiItem.title,
1001
+ description: apiItem.description || undefined,
1002
+ categoryIds: apiItem.categoryIds,
1003
+ parameterGroups: [], // These would need to be fetched separately if needed
1004
+ layouts: [], // These would need to be fetched separately if needed
1005
+ defaultLayoutId: '', // This would need to be set based on the first layout
1006
+ };
1007
+ }
1008
+ mapApiReportDefinitionToReportDefinition(apiResponse) {
1009
+ let res = {
1010
+ id: apiResponse.id,
1011
+ title: apiResponse.title,
1012
+ description: apiResponse.description || undefined,
1013
+ categoryIds: apiResponse.categoryIds,
1014
+ parameterGroups: apiResponse.parameterGroups.map((group) => ({
1015
+ name: group.name,
1016
+ title: group.title,
1017
+ parameters: group.parameters.map((param) => ({
1018
+ path: param.path,
1019
+ title: param.title,
1020
+ widget: {
1021
+ type: param.widget.type,
1022
+ options: param.widget.options || {},
1023
+ valueTransforms: param.widget.valueTransforms || {},
1024
+ },
1025
+ })),
1026
+ })),
1027
+ layouts: apiResponse.layouts.map((layout) => ({
1028
+ id: layout.id,
1029
+ title: layout.title,
1030
+ layout: layout.layout,
1031
+ dataSource: layout.dataSource,
1032
+ export: layout.export,
1033
+ isDefault: layout.isDefault || false,
1034
+ })),
1035
+ defaultLayoutId: apiResponse.defaultLayoutId,
1036
+ };
1037
+ return res;
1038
+ }
1039
+ async executeReport(reportId, parameters = {}) {
1040
+ return await this.dataService.executeReport(reportId, parameters);
1041
+ }
1042
+ // Method to clear cache when needed
1043
+ clearCache() {
1044
+ this.reportDefinitionsCache.clear();
1045
+ this.dataService.clearCache();
1046
+ }
1047
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportDefinitionApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1048
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportDefinitionApiProvider }); }
1049
+ }
1050
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportDefinitionApiProvider, decorators: [{
1051
+ type: Injectable
1052
+ }] });
1053
+ //#endregion
1054
+ //#region ---- Provider Exports ----
1055
+ const AXC_REPORT_CATEGORY_API_PROVIDER = {
1056
+ provide: AXP_REPORT_CATEGORY_PROVIDER,
1057
+ useClass: AXCReportCategoryApiProvider,
1058
+ multi: true,
1059
+ };
1060
+ const AXC_REPORT_DEFINITION_API_PROVIDER = {
1061
+ provide: AXP_REPORT_DEFINITION_PROVIDER,
1062
+ useClass: AXCReportDefinitionApiProvider,
1063
+ multi: true,
1064
+ };
1065
+
1066
+ class AXCReportManagementApiModule {
1067
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportManagementApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1068
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.8", ngImport: i0, type: AXCReportManagementApiModule, imports: [AXPRuntimeModule] }); }
1069
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportManagementApiModule, providers: [
1070
+ AXCReportManagementDataService,
1071
+ AXC_REPORT_CATEGORY_API_PROVIDER,
1072
+ AXC_REPORT_DEFINITION_API_PROVIDER,
1073
+ provideCommandSetups([
1074
+ {
1075
+ key: 'ReportManagement.Report:Execute',
1076
+ command: () => import('./acorex-connectivity-api-execute.command-CP4cZ_5M.mjs').then((c) => c.AXCReportExecuteCommand),
1077
+ },
1078
+ ]),
1079
+ ], imports: [AXPRuntimeModule] }); }
1080
+ }
1081
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCReportManagementApiModule, decorators: [{
1082
+ type: NgModule,
1083
+ args: [{
1084
+ imports: [AXPRuntimeModule],
1085
+ exports: [],
1086
+ declarations: [],
1087
+ providers: [
1088
+ AXCReportManagementDataService,
1089
+ AXC_REPORT_CATEGORY_API_PROVIDER,
1090
+ AXC_REPORT_DEFINITION_API_PROVIDER,
1091
+ provideCommandSetups([
1092
+ {
1093
+ key: 'ReportManagement.Report:Execute',
1094
+ command: () => import('./acorex-connectivity-api-execute.command-CP4cZ_5M.mjs').then((c) => c.AXCReportExecuteCommand),
1095
+ },
1096
+ ]),
1097
+ ],
1098
+ }]
1099
+ }] });
1100
+
782
1101
  class AXCApiModule {
783
1102
  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] }); }
1103
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, imports: [i1$1.OAuthModule, i2.AXPAuthModule, AXCUtilsModule,
1104
+ AXCReportManagementApiModule] }); }
785
1105
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, providers: [
786
1106
  {
787
1107
  provide: AXPEntityStorageService,
@@ -813,12 +1133,13 @@ class AXCApiModule {
813
1133
  selectValueStrategy: 'valueField',
814
1134
  lookupValueStrategy: 'valueField',
815
1135
  },
816
- },
1136
+ }
817
1137
  ], imports: [OAuthModule.forRoot(),
818
1138
  AXPAuthModule.forRoot({
819
1139
  strategies: [AXCAPIOidcStrategy],
820
1140
  }),
821
- AXCUtilsModule] }); }
1141
+ AXCUtilsModule,
1142
+ AXCReportManagementApiModule] }); }
822
1143
  }
823
1144
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, decorators: [{
824
1145
  type: NgModule,
@@ -829,6 +1150,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
829
1150
  strategies: [AXCAPIOidcStrategy],
830
1151
  }),
831
1152
  AXCUtilsModule,
1153
+ AXCReportManagementApiModule,
832
1154
  ],
833
1155
  providers: [
834
1156
  {
@@ -861,7 +1183,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
861
1183
  selectValueStrategy: 'valueField',
862
1184
  lookupValueStrategy: 'valueField',
863
1185
  },
864
- },
1186
+ }
865
1187
  ],
866
1188
  }]
867
1189
  }] });
@@ -1141,5 +1463,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
1141
1463
  * Generated bundle index. Do not edit.
1142
1464
  */
1143
1465
 
1144
- export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
1466
+ export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCReportManagementApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
1145
1467
  //# sourceMappingURL=acorex-connectivity-api.mjs.map