@acorex/connectivity 20.3.0-next.0 → 20.3.0-next.10
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 +361 -39
- package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
- package/fesm2022/{acorex-connectivity-mock-category-with-items.query-72bKFWcj.mjs → acorex-connectivity-mock-category-with-items.query-DEY9R9q2.mjs} +38 -8
- 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 +16618 -4293
- 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 +172 -110
- package/package.json +5 -5
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-72bKFWcj.mjs.map +0 -1
|
@@ -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
|
|
|
@@ -278,10 +285,10 @@ class AXCFileStorageApiService extends AXPFileStorageService {
|
|
|
278
285
|
// Silently fail in fallback mode
|
|
279
286
|
}
|
|
280
287
|
}
|
|
281
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
282
|
-
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 }); }
|
|
283
290
|
}
|
|
284
|
-
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: [{
|
|
285
292
|
type: Injectable
|
|
286
293
|
}] });
|
|
287
294
|
|
|
@@ -326,10 +333,10 @@ class AXMOidcApplicationLoader {
|
|
|
326
333
|
// features: item.features || [],
|
|
327
334
|
};
|
|
328
335
|
}
|
|
329
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
330
|
-
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 }); }
|
|
331
338
|
}
|
|
332
|
-
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: [{
|
|
333
340
|
type: Injectable
|
|
334
341
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
335
342
|
|
|
@@ -369,10 +376,10 @@ class AXMConfigurationService {
|
|
|
369
376
|
switchMap(() => of(this.applicationConfig)));
|
|
370
377
|
}
|
|
371
378
|
}
|
|
372
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
373
|
-
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' }); }
|
|
374
381
|
}
|
|
375
|
-
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: [{
|
|
376
383
|
type: Injectable,
|
|
377
384
|
args: [{
|
|
378
385
|
providedIn: 'root',
|
|
@@ -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
|
-
|
|
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) {
|
|
@@ -715,10 +723,10 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
|
|
|
715
723
|
get name() {
|
|
716
724
|
return 'oidc';
|
|
717
725
|
}
|
|
718
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
719
|
-
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 }); }
|
|
720
728
|
}
|
|
721
|
-
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: [{
|
|
722
730
|
type: Injectable
|
|
723
731
|
}] });
|
|
724
732
|
|
|
@@ -743,10 +751,10 @@ class AXMOidcPermissionLoader {
|
|
|
743
751
|
const truePolicies = Object.keys(policies).filter((key) => policies[key] === true);
|
|
744
752
|
return truePolicies;
|
|
745
753
|
}
|
|
746
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
747
|
-
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 }); }
|
|
748
756
|
}
|
|
749
|
-
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: [{
|
|
750
758
|
type: Injectable
|
|
751
759
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
752
760
|
|
|
@@ -772,17 +780,329 @@ class AXMOidcTenantLoader {
|
|
|
772
780
|
// Add other fields and defaults as needed, and handle the logo if applicable
|
|
773
781
|
};
|
|
774
782
|
}
|
|
775
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
776
|
-
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 }); }
|
|
777
785
|
}
|
|
778
|
-
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: [{
|
|
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
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
784
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.
|
|
785
|
-
|
|
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: [
|
|
786
1106
|
{
|
|
787
1107
|
provide: AXPEntityStorageService,
|
|
788
1108
|
useClass: AXCApiEntityStorageService,
|
|
@@ -813,14 +1133,15 @@ 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
|
-
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: [{
|
|
824
1145
|
type: NgModule,
|
|
825
1146
|
args: [{
|
|
826
1147
|
imports: [
|
|
@@ -829,6 +1150,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", 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.6", ngImpor
|
|
|
861
1183
|
selectValueStrategy: 'valueField',
|
|
862
1184
|
lookupValueStrategy: 'valueField',
|
|
863
1185
|
},
|
|
864
|
-
}
|
|
1186
|
+
}
|
|
865
1187
|
],
|
|
866
1188
|
}]
|
|
867
1189
|
}] });
|
|
@@ -1130,10 +1452,10 @@ class APIGoogleStrategy extends AXPAuthStrategy {
|
|
|
1130
1452
|
console.error('Authentication error:', error);
|
|
1131
1453
|
throw error;
|
|
1132
1454
|
}
|
|
1133
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.
|
|
1134
|
-
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 }); }
|
|
1135
1457
|
}
|
|
1136
|
-
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: [{
|
|
1137
1459
|
type: Injectable
|
|
1138
1460
|
}], ctorParameters: () => [] });
|
|
1139
1461
|
|
|
@@ -1141,5 +1463,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", 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
|