@acorex/connectivity 20.3.0-next.1 → 20.3.0-next.11
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 +13 -7
- package/fesm2022/acorex-connectivity-api-execute.command-CP4cZ_5M.mjs +86 -0
- package/fesm2022/acorex-connectivity-api-execute.command-CP4cZ_5M.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-api.mjs +369 -39
- package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-DEY9R9q2.mjs +116 -0
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-DEY9R9q2.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-employee-structure.queries-CchlfSox.mjs +66 -0
- package/fesm2022/acorex-connectivity-mock-employee-structure.queries-CchlfSox.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-sample.command-BtkzyYby.mjs +20 -0
- package/fesm2022/acorex-connectivity-mock-sample.command-BtkzyYby.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock.mjs +34114 -13309
- package/fesm2022/acorex-connectivity-mock.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-utils.mjs +7 -7
- package/fesm2022/acorex-connectivity-utils.mjs.map +1 -1
- package/mock/index.d.ts +1530 -500
- package/package.json +2 -3
|
@@ -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:
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
135
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.
|
|
141
|
+
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 }); }
|
|
142
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiEntityStorageService }); }
|
|
136
143
|
}
|
|
137
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiEntityStorageService, decorators: [{
|
|
138
145
|
type: Injectable
|
|
139
146
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
140
147
|
|
|
@@ -246,6 +253,14 @@ class AXCFileStorageApiService extends AXPFileStorageService {
|
|
|
246
253
|
return this.fallbackFileInfo;
|
|
247
254
|
}
|
|
248
255
|
}
|
|
256
|
+
async findMany(ids) {
|
|
257
|
+
try {
|
|
258
|
+
return await firstValueFrom(this.http.post(`${this.baseUrl}/find-many`, { ids }).pipe(catchError(() => of([]))));
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
return [];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
249
264
|
async remove(fileId) {
|
|
250
265
|
try {
|
|
251
266
|
await firstValueFrom(this.http.delete(`${this.baseUrl}/remove/${fileId}`).pipe(catchError(() => of(void 0))));
|
|
@@ -270,10 +285,10 @@ class AXCFileStorageApiService extends AXPFileStorageService {
|
|
|
270
285
|
// Silently fail in fallback mode
|
|
271
286
|
}
|
|
272
287
|
}
|
|
273
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
274
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.
|
|
288
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCFileStorageApiService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
289
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCFileStorageApiService }); }
|
|
275
290
|
}
|
|
276
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
291
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCFileStorageApiService, decorators: [{
|
|
277
292
|
type: Injectable
|
|
278
293
|
}] });
|
|
279
294
|
|
|
@@ -318,10 +333,10 @@ class AXMOidcApplicationLoader {
|
|
|
318
333
|
// features: item.features || [],
|
|
319
334
|
};
|
|
320
335
|
}
|
|
321
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
322
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.
|
|
336
|
+
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 }); }
|
|
337
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcApplicationLoader }); }
|
|
323
338
|
}
|
|
324
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
339
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcApplicationLoader, decorators: [{
|
|
325
340
|
type: Injectable
|
|
326
341
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
327
342
|
|
|
@@ -361,10 +376,10 @@ class AXMConfigurationService {
|
|
|
361
376
|
switchMap(() => of(this.applicationConfig)));
|
|
362
377
|
}
|
|
363
378
|
}
|
|
364
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
365
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.
|
|
379
|
+
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 }); }
|
|
380
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMConfigurationService, providedIn: 'root' }); }
|
|
366
381
|
}
|
|
367
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMConfigurationService, decorators: [{
|
|
368
383
|
type: Injectable,
|
|
369
384
|
args: [{
|
|
370
385
|
providedIn: 'root',
|
|
@@ -623,7 +638,8 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
|
|
|
623
638
|
localStorage.removeItem('pkce_code_verifier');
|
|
624
639
|
localStorage.removeItem('oauth_provider');
|
|
625
640
|
console.log(this.openidConfigurationInfo?.info?.discoveryDocument);
|
|
626
|
-
|
|
641
|
+
// Use configured logoutUrl or derive from baseUrl
|
|
642
|
+
const logoutUrl = this.aXMAuthConfigs.logoutUrl || `connect/logout`;
|
|
627
643
|
window.location.href = logoutUrl;
|
|
628
644
|
}
|
|
629
645
|
async refreshToken(context) {
|
|
@@ -707,10 +723,10 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
|
|
|
707
723
|
get name() {
|
|
708
724
|
return 'oidc';
|
|
709
725
|
}
|
|
710
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
711
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.
|
|
726
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCAPIOidcStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
727
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCAPIOidcStrategy }); }
|
|
712
728
|
}
|
|
713
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
729
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCAPIOidcStrategy, decorators: [{
|
|
714
730
|
type: Injectable
|
|
715
731
|
}] });
|
|
716
732
|
|
|
@@ -735,10 +751,10 @@ class AXMOidcPermissionLoader {
|
|
|
735
751
|
const truePolicies = Object.keys(policies).filter((key) => policies[key] === true);
|
|
736
752
|
return truePolicies;
|
|
737
753
|
}
|
|
738
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
739
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.
|
|
754
|
+
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 }); }
|
|
755
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcPermissionLoader }); }
|
|
740
756
|
}
|
|
741
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
757
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcPermissionLoader, decorators: [{
|
|
742
758
|
type: Injectable
|
|
743
759
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
744
760
|
|
|
@@ -764,17 +780,329 @@ class AXMOidcTenantLoader {
|
|
|
764
780
|
// Add other fields and defaults as needed, and handle the logo if applicable
|
|
765
781
|
};
|
|
766
782
|
}
|
|
767
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
768
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.
|
|
783
|
+
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 }); }
|
|
784
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcTenantLoader }); }
|
|
769
785
|
}
|
|
770
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
786
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXMOidcTenantLoader, decorators: [{
|
|
771
787
|
type: Injectable
|
|
772
788
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
773
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
|
+
|
|
774
1101
|
class AXCApiModule {
|
|
775
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
776
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.
|
|
777
|
-
|
|
1102
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
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] }); }
|
|
1105
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, providers: [
|
|
778
1106
|
{
|
|
779
1107
|
provide: AXPEntityStorageService,
|
|
780
1108
|
useClass: AXCApiEntityStorageService,
|
|
@@ -805,14 +1133,15 @@ class AXCApiModule {
|
|
|
805
1133
|
selectValueStrategy: 'valueField',
|
|
806
1134
|
lookupValueStrategy: 'valueField',
|
|
807
1135
|
},
|
|
808
|
-
}
|
|
1136
|
+
}
|
|
809
1137
|
], imports: [OAuthModule.forRoot(),
|
|
810
1138
|
AXPAuthModule.forRoot({
|
|
811
1139
|
strategies: [AXCAPIOidcStrategy],
|
|
812
1140
|
}),
|
|
813
|
-
AXCUtilsModule
|
|
1141
|
+
AXCUtilsModule,
|
|
1142
|
+
AXCReportManagementApiModule] }); }
|
|
814
1143
|
}
|
|
815
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
1144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCApiModule, decorators: [{
|
|
816
1145
|
type: NgModule,
|
|
817
1146
|
args: [{
|
|
818
1147
|
imports: [
|
|
@@ -821,6 +1150,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
821
1150
|
strategies: [AXCAPIOidcStrategy],
|
|
822
1151
|
}),
|
|
823
1152
|
AXCUtilsModule,
|
|
1153
|
+
AXCReportManagementApiModule,
|
|
824
1154
|
],
|
|
825
1155
|
providers: [
|
|
826
1156
|
{
|
|
@@ -853,7 +1183,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
853
1183
|
selectValueStrategy: 'valueField',
|
|
854
1184
|
lookupValueStrategy: 'valueField',
|
|
855
1185
|
},
|
|
856
|
-
}
|
|
1186
|
+
}
|
|
857
1187
|
],
|
|
858
1188
|
}]
|
|
859
1189
|
}] });
|
|
@@ -1122,10 +1452,10 @@ class APIGoogleStrategy extends AXPAuthStrategy {
|
|
|
1122
1452
|
console.error('Authentication error:', error);
|
|
1123
1453
|
throw error;
|
|
1124
1454
|
}
|
|
1125
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
1126
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.
|
|
1455
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: APIGoogleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1456
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: APIGoogleStrategy }); }
|
|
1127
1457
|
}
|
|
1128
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.
|
|
1458
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: APIGoogleStrategy, decorators: [{
|
|
1129
1459
|
type: Injectable
|
|
1130
1460
|
}], ctorParameters: () => [] });
|
|
1131
1461
|
|
|
@@ -1133,5 +1463,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
1133
1463
|
* Generated bundle index. Do not edit.
|
|
1134
1464
|
*/
|
|
1135
1465
|
|
|
1136
|
-
export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
|
|
1466
|
+
export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCReportManagementApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
|
|
1137
1467
|
//# sourceMappingURL=acorex-connectivity-api.mjs.map
|