@acorex/connectivity 20.6.0-next.8 → 21.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.d.ts +40 -68
- package/fesm2022/{acorex-connectivity-api-execute.command-BwXw_Kn7.mjs → acorex-connectivity-api-execute.command-SGNBLcOi.mjs} +14 -5
- package/fesm2022/acorex-connectivity-api-execute.command-SGNBLcOi.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-api.mjs +210 -296
- package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
- package/fesm2022/{acorex-connectivity-mock-category-with-items.query-NY9J0cQ0.mjs → acorex-connectivity-mock-category-with-items.query-Dsxj98tX.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-Dsxj98tX.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-distribution-record.command-B-Xviv6G.mjs → acorex-connectivity-mock-distribution-record.command-DRiDwlqN.mjs} +12 -3
- package/fesm2022/acorex-connectivity-mock-distribution-record.command-DRiDwlqN.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-sample.command-BkxMgq1C.mjs → acorex-connectivity-mock-sample.command-CkH5bmEs.mjs} +4 -1
- package/fesm2022/acorex-connectivity-mock-sample.command-CkH5bmEs.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock.mjs +22194 -14850
- package/fesm2022/acorex-connectivity-mock.mjs.map +1 -1
- package/mock/index.d.ts +660 -636
- package/package.json +2 -2
- package/fesm2022/acorex-connectivity-api-execute.command-BwXw_Kn7.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-NY9J0cQ0.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-distribution-record.command-B-Xviv6G.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-sample.command-BkxMgq1C.mjs.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AXP_ROOT_CONFIG_TOKEN, AXPFilterOperatorMiddlewareService, AXPFileStorageService, AXPFileStorageStatus } from '@acorex/platform/common';
|
|
2
|
-
import { AXPEntityResolver, AXPEntityStorageService } from '@acorex/platform/layout/entity';
|
|
3
2
|
import * as i1 from '@angular/common/http';
|
|
4
3
|
import { HttpParams, HttpClient, HttpHeaders } from '@angular/common/http';
|
|
5
4
|
import * as i0 from '@angular/core';
|
|
6
5
|
import { inject, Injectable, NgModule } from '@angular/core';
|
|
7
6
|
import { kebabCase } from 'lodash-es';
|
|
8
|
-
import { firstValueFrom, catchError, of,
|
|
7
|
+
import { firstValueFrom, catchError, of, BehaviorSubject, tap, filter, take, switchMap } from 'rxjs';
|
|
9
8
|
import * as i2 from '@acorex/platform/auth';
|
|
10
9
|
import { AXPAuthStrategy, AXPSessionService, JwtUtil, TimeUtil, PkceUtil, AXPAuthModule, AXP_TENANT_LOADER, AXP_APPLICATION_LOADER, AXP_PERMISSION_LOADER, AXP_FEATURE_LOADER } from '@acorex/platform/auth';
|
|
10
|
+
import { AXPEntityStorageService } from '@acorex/platform/layout/entity';
|
|
11
11
|
import { AXP_USER_AVATAR_PROVIDER } from '@acorex/platform/layout/components';
|
|
12
12
|
import { STRATEGY_CONFIG_TOKEN } from '@acorex/platform/layout/widgets';
|
|
13
13
|
import * as i1$1 from 'angular-oauth2-oidc';
|
|
@@ -25,7 +25,6 @@ class AXCApiEntityStorageService {
|
|
|
25
25
|
this.http = http;
|
|
26
26
|
this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
|
|
27
27
|
this.filterService = inject(AXPFilterOperatorMiddlewareService);
|
|
28
|
-
this.entityResolver = inject(AXPEntityResolver);
|
|
29
28
|
this.mainUrl = this.configs.baseUrl;
|
|
30
29
|
// API routing constants
|
|
31
30
|
this.API_VERSION = 'v1';
|
|
@@ -208,6 +207,9 @@ class AXCFileStorageApiService extends AXPFileStorageService {
|
|
|
208
207
|
if (request.path !== undefined) {
|
|
209
208
|
updateData.path = request.path;
|
|
210
209
|
}
|
|
210
|
+
if (request.name !== undefined) {
|
|
211
|
+
updateData.name = request.name;
|
|
212
|
+
}
|
|
211
213
|
if (request.isPrimary !== undefined) {
|
|
212
214
|
updateData.isPrimary = request.isPrimary;
|
|
213
215
|
}
|
|
@@ -302,10 +304,9 @@ class AXMOidcApplicationLoader {
|
|
|
302
304
|
this.apiGetApps = `${this.configs.baseUrl}/applications/applications-for-current-tenant`;
|
|
303
305
|
this.apiSetApp = `${this.configs.baseUrl}/SetApplication`;
|
|
304
306
|
}
|
|
305
|
-
getList() {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}));
|
|
307
|
+
async getList(context) {
|
|
308
|
+
const response = await firstValueFrom(this.http.get(this.apiGetApps));
|
|
309
|
+
return response.items.map((item) => this.mapToAXPApplication(item));
|
|
309
310
|
}
|
|
310
311
|
set(application) {
|
|
311
312
|
return Promise.resolve();
|
|
@@ -332,7 +333,13 @@ class AXMOidcApplicationLoader {
|
|
|
332
333
|
version: item.version || '1.0.0',
|
|
333
334
|
description: item.description,
|
|
334
335
|
logo: item.logo, // Assuming logo is of type AXPLogoConfig or undefined
|
|
335
|
-
|
|
336
|
+
edition: item.edition
|
|
337
|
+
? {
|
|
338
|
+
id: item.edition.id,
|
|
339
|
+
title: item.edition.title,
|
|
340
|
+
description: item.edition.description,
|
|
341
|
+
}
|
|
342
|
+
: undefined,
|
|
336
343
|
// features: item.features || [],
|
|
337
344
|
};
|
|
338
345
|
}
|
|
@@ -404,8 +411,8 @@ class AXMOidcFeatureLoader {
|
|
|
404
411
|
}
|
|
405
412
|
];
|
|
406
413
|
}
|
|
407
|
-
getList() {
|
|
408
|
-
return
|
|
414
|
+
async getList(context) {
|
|
415
|
+
return this.list;
|
|
409
416
|
}
|
|
410
417
|
}
|
|
411
418
|
|
|
@@ -639,13 +646,40 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
|
|
|
639
646
|
this.handleError(error);
|
|
640
647
|
}
|
|
641
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Signs out the user according to OpenID Connect standards.
|
|
651
|
+
* Tries to call the standard OIDC end_session_endpoint if available, else falls back to configured logoutUrl.
|
|
652
|
+
* Falls back to root landing page on local logout if nothing is provided.
|
|
653
|
+
* This runs in the background (without redirecting user immediately to the endpoint).
|
|
654
|
+
*/
|
|
642
655
|
async signout() {
|
|
643
656
|
localStorage.removeItem('pkce_code_verifier');
|
|
644
657
|
localStorage.removeItem('oauth_provider');
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
658
|
+
// Standard OIDC logout: try to use end_session_endpoint if found in the discovery document
|
|
659
|
+
const discoveryDoc = this.openidConfigurationInfo?.info?.discoveryDocument;
|
|
660
|
+
let logoutUrl;
|
|
661
|
+
if (discoveryDoc?.end_session_endpoint) {
|
|
662
|
+
logoutUrl = discoveryDoc.end_session_endpoint;
|
|
663
|
+
// Optional: append id_token_hint, post_logout_redirect_uri or others as needed by your IdP
|
|
664
|
+
// For example: logoutUrl += `?post_logout_redirect_uri=${encodeURIComponent(window.location.origin)}`;
|
|
665
|
+
}
|
|
666
|
+
else if (this.aXMAuthConfigs.logoutUrl) {
|
|
667
|
+
logoutUrl = this.aXMAuthConfigs.logoutUrl;
|
|
668
|
+
}
|
|
669
|
+
// Call logout in the background (don't redirect)
|
|
670
|
+
if (logoutUrl) {
|
|
671
|
+
// Fire-and-forget: Create an invisible iframe to make the logout request in the background
|
|
672
|
+
const iframe = document.createElement('iframe');
|
|
673
|
+
iframe.style.display = 'none';
|
|
674
|
+
iframe.src = logoutUrl;
|
|
675
|
+
document.body.appendChild(iframe);
|
|
676
|
+
// Optionally, remove iframe after load
|
|
677
|
+
iframe.onload = () => {
|
|
678
|
+
setTimeout(() => document.body.removeChild(iframe), 1000);
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
// Always send user to landing page after local logout, regardless
|
|
682
|
+
window.location.href = '/';
|
|
649
683
|
}
|
|
650
684
|
async refreshToken(context) {
|
|
651
685
|
try {
|
|
@@ -741,15 +775,16 @@ class AXMOidcPermissionLoader {
|
|
|
741
775
|
this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
|
|
742
776
|
this.apiGetConfig = `${this.configs.baseUrl}/abp/application-configuration`;
|
|
743
777
|
}
|
|
744
|
-
getList(context) {
|
|
745
|
-
|
|
778
|
+
async getList(context) {
|
|
779
|
+
const response = await firstValueFrom(this.http.get(this.apiGetConfig));
|
|
780
|
+
return this.mapTo(response);
|
|
746
781
|
// if (context.user == null)
|
|
747
|
-
// return
|
|
782
|
+
// return [];
|
|
748
783
|
// else if (context.user.name.toLowerCase() == 'admin')
|
|
749
|
-
// return
|
|
784
|
+
// return ['axp.admin.console', 'asc.admin.message', 'asc.admin.settings', 'asc.admin.gliding', 'asc.user.gliding'];
|
|
750
785
|
// else
|
|
751
|
-
// return
|
|
752
|
-
// return
|
|
786
|
+
// return ['asc.user.gliding'];
|
|
787
|
+
// return ['axp.admin.console', 'asc.admin.message', 'asc.admin.settings', 'asc.admin.gliding', 'asc.user.gliding'];
|
|
753
788
|
}
|
|
754
789
|
mapTo(jsonObj) {
|
|
755
790
|
const policies = jsonObj.auth.grantedPolicies;
|
|
@@ -769,10 +804,11 @@ class AXMOidcTenantLoader {
|
|
|
769
804
|
this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
|
|
770
805
|
this.apiGetTenants = `${this.configs.baseUrl}/tenants/available-for-user`;
|
|
771
806
|
}
|
|
772
|
-
getList() {
|
|
773
|
-
|
|
807
|
+
async getList(context) {
|
|
808
|
+
const response = await firstValueFrom(this.http.get(this.apiGetTenants));
|
|
809
|
+
return response.items.map((item) => {
|
|
774
810
|
return this.mapToAXPTenant(item);
|
|
775
|
-
})
|
|
811
|
+
});
|
|
776
812
|
}
|
|
777
813
|
async set(tenant) {
|
|
778
814
|
return Promise.resolve();
|
|
@@ -796,43 +832,24 @@ class AXCApiUserAvatarProvider {
|
|
|
796
832
|
constructor() {
|
|
797
833
|
this.userService = inject(AXMUsersEntityService);
|
|
798
834
|
this.sessionService = inject(AXPSessionService);
|
|
799
|
-
this.http = inject(HttpClient);
|
|
800
|
-
this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
|
|
801
|
-
this.baseUrl = this.configs.baseUrl;
|
|
802
835
|
}
|
|
803
836
|
async provide(userId) {
|
|
804
837
|
// Check if requesting current user info
|
|
805
838
|
const currentUser = this.sessionService.user;
|
|
806
839
|
const isCurrentUser = currentUser?.id === userId;
|
|
807
|
-
if (isCurrentUser) {
|
|
808
|
-
// Use
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}
|
|
819
|
-
const userInfo = await firstValueFrom(this.http.get(userInfoUrl, { headers }));
|
|
820
|
-
const [firstName, lastName] = (userInfo.name || userInfo.sub || '').split(' ') || ['', ''];
|
|
821
|
-
return {
|
|
822
|
-
id: userInfo.sub || userId,
|
|
823
|
-
username: userInfo.preferred_username || userInfo.name || '',
|
|
824
|
-
firstName: firstName || userInfo.given_name || '',
|
|
825
|
-
lastName: lastName || userInfo.family_name || '',
|
|
826
|
-
status: 'online',
|
|
827
|
-
avatarUrl: userInfo.picture || 'https://via.placeholder.com/150',
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
catch (error) {
|
|
831
|
-
console.error('Failed to load userinfo from /connect/userinfo, falling back to entity service', error);
|
|
832
|
-
// Fallback to entity service if userinfo endpoint fails
|
|
833
|
-
}
|
|
840
|
+
if (isCurrentUser && currentUser) {
|
|
841
|
+
// Use session service user data for current user
|
|
842
|
+
const [firstName, lastName] = (currentUser.name || '').split(' ') || ['', ''];
|
|
843
|
+
return {
|
|
844
|
+
id: currentUser.id,
|
|
845
|
+
username: currentUser.name || '',
|
|
846
|
+
firstName: firstName || '',
|
|
847
|
+
lastName: lastName || '',
|
|
848
|
+
status: 'online',
|
|
849
|
+
avatarUrl: currentUser.avatar || AXPDataGenerator.avatar(),
|
|
850
|
+
};
|
|
834
851
|
}
|
|
835
|
-
// Use entity service for other users
|
|
852
|
+
// Use entity service for other users
|
|
836
853
|
const user = await this.userService.getOne(userId);
|
|
837
854
|
if (!user) {
|
|
838
855
|
throw new Error(`User not found for ${userId}`);
|
|
@@ -844,229 +861,37 @@ class AXCApiUserAvatarProvider {
|
|
|
844
861
|
firstName: firstName || '',
|
|
845
862
|
lastName: lastName || '',
|
|
846
863
|
status: 'online',
|
|
847
|
-
avatarUrl:
|
|
864
|
+
avatarUrl: AXPDataGenerator.avatar(),
|
|
848
865
|
};
|
|
849
866
|
}
|
|
850
867
|
}
|
|
851
868
|
|
|
852
869
|
//#endregion
|
|
853
|
-
//#region ----
|
|
854
|
-
|
|
855
|
-
// * Converts a widget string to AXPWidgetsList key
|
|
856
|
-
// */
|
|
857
|
-
// function convertWidgetStringToAXPWidgetsListKey(
|
|
858
|
-
// widgetString: string,
|
|
859
|
-
// )
|
|
860
|
-
// :
|
|
861
|
-
// | keyof typeof AXPWidgetsList.Editors
|
|
862
|
-
// | keyof typeof AXPWidgetsList.Layouts
|
|
863
|
-
// | keyof typeof AXPWidgetsList.Actions
|
|
864
|
-
// | keyof typeof AXPWidgetsList.Advanced
|
|
865
|
-
// | keyof typeof AXPWidgetsList.Templates
|
|
866
|
-
// | keyof typeof AXPWidgetsList.Entity
|
|
867
|
-
// | keyof typeof AXPWidgetsList.Theme
|
|
868
|
-
// {
|
|
869
|
-
// console.log('Converting widget string:', widgetString);
|
|
870
|
-
// // Check if the string is in format "AXPWidgetsList.Category.Key"
|
|
871
|
-
// if (widgetString.startsWith('AXPWidgetsList.')) {
|
|
872
|
-
// // Extract the key from "AXPWidgetsList.Editors.DateTimeBox" -> "DateTimeBox"
|
|
873
|
-
// const parts = widgetString.split('.');
|
|
874
|
-
// if (parts.length >= 3) {
|
|
875
|
-
// const key = parts[parts.length - 1]; // Get the last part (key)
|
|
876
|
-
// console.log('Extracted key from AXPWidgetsList format:', key);
|
|
877
|
-
// return key as any;
|
|
878
|
-
// }
|
|
879
|
-
// }
|
|
880
|
-
// // Search through all AXPWidgetsList categories to find matching widget
|
|
881
|
-
// for (const category of Object.values(AXPWidgetsList)) {
|
|
882
|
-
// if (typeof category === 'object') {
|
|
883
|
-
// for (const [key, value] of Object.entries(category)) {
|
|
884
|
-
// if (value === widgetString) {
|
|
885
|
-
// console.log('Found matching widget:', key, 'for value:', value);
|
|
886
|
-
// return key as any; // Return the AXPWidgetsList key (e.g., "DateTimeBox")
|
|
887
|
-
// }
|
|
888
|
-
// }
|
|
889
|
-
// }
|
|
890
|
-
// }
|
|
891
|
-
// console.log('Widget not found in AXPWidgetsList, returning original string:', widgetString);
|
|
892
|
-
// // If not found in AXPWidgetsList, return the original string as fallback
|
|
893
|
-
// return widgetString as any;
|
|
894
|
-
// }
|
|
895
|
-
//#endregion
|
|
896
|
-
//#region ---- Shared Data Service ----
|
|
897
|
-
class AXCReportManagementDataService {
|
|
870
|
+
//#region ---- API Providers ----
|
|
871
|
+
class AXCReportCategoryApiProvider {
|
|
898
872
|
constructor() {
|
|
899
873
|
this.http = inject(HttpClient);
|
|
900
874
|
this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
|
|
901
875
|
this.baseUrl = this.configs.baseUrl;
|
|
902
|
-
// Cache for category data to avoid duplicate API calls
|
|
903
|
-
this.categoryDataCache = new Map();
|
|
904
|
-
this.rootCategoriesCache = null;
|
|
905
|
-
this.pendingRequests = new Map();
|
|
906
|
-
this.pendingRootCategoriesRequest = null;
|
|
907
876
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
return this.pendingRootCategoriesRequest;
|
|
921
|
-
}
|
|
922
|
-
// Create the request and cache it
|
|
923
|
-
const requestPromise = (async () => {
|
|
924
|
-
try {
|
|
925
|
-
const url = `${this.baseUrl}/v1/global/report-management/category`;
|
|
877
|
+
async getList(parentId) {
|
|
878
|
+
try {
|
|
879
|
+
let url;
|
|
880
|
+
if (parentId) {
|
|
881
|
+
url = `${this.baseUrl}/v1/global/report-management/category/${parentId}`;
|
|
882
|
+
const response = await firstValueFrom(this.http.get(url));
|
|
883
|
+
const categoryData = response.items?.[0];
|
|
884
|
+
const filteredItems = categoryData?.folderItems ?? [];
|
|
885
|
+
return filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
|
|
886
|
+
}
|
|
887
|
+
else {
|
|
888
|
+
url = `${this.baseUrl}/v1/global/report-management/category`;
|
|
926
889
|
const params = { Skip: 0, Take: 1000 };
|
|
927
890
|
const response = await firstValueFrom(this.http.get(url, { params }));
|
|
928
891
|
const all = response.items ?? [];
|
|
929
892
|
const rootCategories = all.filter((i) => !i.reportCategoryParentId);
|
|
930
|
-
|
|
931
|
-
this.rootCategoriesCache = rootCategories;
|
|
932
|
-
return rootCategories;
|
|
933
|
-
}
|
|
934
|
-
finally {
|
|
935
|
-
// Remove from pending requests after completion
|
|
936
|
-
this.pendingRootCategoriesRequest = null;
|
|
937
|
-
}
|
|
938
|
-
})();
|
|
939
|
-
this.pendingRootCategoriesRequest = requestPromise;
|
|
940
|
-
return requestPromise;
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Fetch category data for a given parentId.
|
|
944
|
-
* Returns the parent category with its FolderItems (children) and ReportDefinitionItems (reports).
|
|
945
|
-
* Uses cache to avoid duplicate API calls.
|
|
946
|
-
*/
|
|
947
|
-
async getCategoryData(parentId) {
|
|
948
|
-
// Check if already cached
|
|
949
|
-
if (this.categoryDataCache.has(parentId)) {
|
|
950
|
-
return this.categoryDataCache.get(parentId);
|
|
951
|
-
}
|
|
952
|
-
// Check if there's already a pending request for this category
|
|
953
|
-
if (this.pendingRequests.has(parentId)) {
|
|
954
|
-
return this.pendingRequests.get(parentId);
|
|
955
|
-
}
|
|
956
|
-
// Create the request and cache it
|
|
957
|
-
const requestPromise = (async () => {
|
|
958
|
-
try {
|
|
959
|
-
const url = `${this.baseUrl}/v1/global/report-management/category/${parentId}`;
|
|
960
|
-
const response = await firstValueFrom(this.http.get(url));
|
|
961
|
-
const categoryData = response.items?.[0];
|
|
962
|
-
// Cache the result
|
|
963
|
-
this.categoryDataCache.set(parentId, categoryData);
|
|
964
|
-
return categoryData;
|
|
965
|
-
}
|
|
966
|
-
catch {
|
|
967
|
-
const undefinedResult = undefined;
|
|
968
|
-
this.categoryDataCache.set(parentId, undefinedResult);
|
|
969
|
-
return undefinedResult;
|
|
970
|
-
}
|
|
971
|
-
finally {
|
|
972
|
-
// Remove from pending requests after completion
|
|
973
|
-
this.pendingRequests.delete(parentId);
|
|
974
|
-
}
|
|
975
|
-
})();
|
|
976
|
-
this.pendingRequests.set(parentId, requestPromise);
|
|
977
|
-
return requestPromise;
|
|
978
|
-
}
|
|
979
|
-
/**
|
|
980
|
-
* Fetch both child categories and reports for a given parentId.
|
|
981
|
-
* This method ensures only one API call is made and both results are returned.
|
|
982
|
-
*/
|
|
983
|
-
async getCategoryChildrenAndReports(parentId) {
|
|
984
|
-
const categoryData = await this.getCategoryData(parentId);
|
|
985
|
-
return {
|
|
986
|
-
categories: categoryData?.folderItems ?? [],
|
|
987
|
-
reports: categoryData?.reportDefinitionItems ?? [],
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
/**
|
|
991
|
-
* Fetch child categories of a given parent.
|
|
992
|
-
* Uses getCategoryData to get FolderItems (children) from the parent category.
|
|
993
|
-
*/
|
|
994
|
-
async getChildCategories(parentId) {
|
|
995
|
-
const categoryData = await this.getCategoryData(parentId);
|
|
996
|
-
return categoryData?.folderItems ?? [];
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* Fetch report definitions that belong to a specific category.
|
|
1000
|
-
* Uses getCategoryData to get ReportDefinitionItems (reports) from the category.
|
|
1001
|
-
*/
|
|
1002
|
-
async getCategoryReports(categoryId) {
|
|
1003
|
-
const categoryData = await this.getCategoryData(categoryId);
|
|
1004
|
-
return categoryData?.reportDefinitionItems ?? [];
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Fetch a single category by id.
|
|
1008
|
-
* First checks cache, then uses getCategoryData if not found in cache.
|
|
1009
|
-
*/
|
|
1010
|
-
async getCategoryById(id) {
|
|
1011
|
-
// First check if it's in cache (from previous getCategoryData calls)
|
|
1012
|
-
if (this.categoryDataCache.has(id)) {
|
|
1013
|
-
return this.categoryDataCache.get(id);
|
|
1014
|
-
}
|
|
1015
|
-
// Try to get from category data endpoint (which will cache it)
|
|
1016
|
-
const categoryData = await this.getCategoryData(id);
|
|
1017
|
-
if (categoryData) {
|
|
1018
|
-
return categoryData;
|
|
1019
|
-
}
|
|
1020
|
-
// Fallback: search in root categories cache
|
|
1021
|
-
if (this.rootCategoriesCache) {
|
|
1022
|
-
const found = this.rootCategoriesCache.find((c) => c.id === id);
|
|
1023
|
-
if (found) {
|
|
1024
|
-
return found;
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
// Last resort: search in all categories (but this should rarely happen)
|
|
1028
|
-
try {
|
|
1029
|
-
const url = `${this.baseUrl}/v1/global/report-management/category`;
|
|
1030
|
-
const params = { Skip: 0, Take: 1000 };
|
|
1031
|
-
const response = await firstValueFrom(this.http.get(url, { params }));
|
|
1032
|
-
const all = response.items ?? [];
|
|
1033
|
-
return all.find((c) => c.id === id);
|
|
1034
|
-
}
|
|
1035
|
-
catch {
|
|
1036
|
-
return undefined;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1040
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementDataService }); }
|
|
1041
|
-
}
|
|
1042
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementDataService, decorators: [{
|
|
1043
|
-
type: Injectable
|
|
1044
|
-
}] });
|
|
1045
|
-
//#endregion
|
|
1046
|
-
//#region ---- API Providers ----
|
|
1047
|
-
/**
|
|
1048
|
-
* Category provider that uses the shared data service.
|
|
1049
|
-
* Both providers use the same dataService instance which ensures proper caching.
|
|
1050
|
-
*/
|
|
1051
|
-
class AXCReportCategoryApiProvider {
|
|
1052
|
-
constructor() {
|
|
1053
|
-
this.dataService = inject(AXCReportManagementDataService);
|
|
1054
|
-
}
|
|
1055
|
-
async getList(parentId) {
|
|
1056
|
-
try {
|
|
1057
|
-
// For root level, get root categories (each category includes folderItems in API response)
|
|
1058
|
-
if (!parentId) {
|
|
1059
|
-
const filteredItems = await this.dataService.getRootCategories();
|
|
1060
|
-
// Each root category has folderItems in the API response, but we only return the root categories themselves
|
|
1061
|
-
// The folderItems are preserved in the API response structure, similar to child state
|
|
1062
|
-
return filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
|
|
893
|
+
return rootCategories.map((item) => this.mapApiCategoryToReportCategory(item));
|
|
1063
894
|
}
|
|
1064
|
-
// For child level, get categories from category data (which includes folderItems)
|
|
1065
|
-
// This ensures we use the same API response that getList for definitions will use
|
|
1066
|
-
// The folderItems structure is preserved, similar to root state
|
|
1067
|
-
const categoryData = await this.dataService.getCategoryData(parentId);
|
|
1068
|
-
const filteredItems = categoryData?.folderItems ?? [];
|
|
1069
|
-
return filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
|
|
1070
895
|
}
|
|
1071
896
|
catch (error) {
|
|
1072
897
|
console.error('Error fetching report categories:', error);
|
|
@@ -1075,9 +900,17 @@ class AXCReportCategoryApiProvider {
|
|
|
1075
900
|
}
|
|
1076
901
|
async getById(id) {
|
|
1077
902
|
try {
|
|
1078
|
-
const
|
|
903
|
+
const url = `${this.baseUrl}/v1/global/report-management/category/${id}`;
|
|
904
|
+
const response = await firstValueFrom(this.http.get(url));
|
|
905
|
+
const apiItem = response.items?.[0];
|
|
1079
906
|
if (!apiItem) {
|
|
1080
|
-
|
|
907
|
+
// Fallback: search in all categories
|
|
908
|
+
const allUrl = `${this.baseUrl}/v1/global/report-management/category`;
|
|
909
|
+
const params = { Skip: 0, Take: 1000 };
|
|
910
|
+
const allResponse = await firstValueFrom(this.http.get(allUrl, { params }));
|
|
911
|
+
const all = allResponse.items ?? [];
|
|
912
|
+
const found = all.find((c) => c.id === id);
|
|
913
|
+
return found ? this.mapApiCategoryToReportCategory(found) : undefined;
|
|
1081
914
|
}
|
|
1082
915
|
return this.mapApiCategoryToReportCategory(apiItem);
|
|
1083
916
|
}
|
|
@@ -1092,8 +925,8 @@ class AXCReportCategoryApiProvider {
|
|
|
1092
925
|
title: apiItem.title,
|
|
1093
926
|
description: apiItem.description || undefined,
|
|
1094
927
|
parentId: apiItem.reportCategoryParentId || undefined,
|
|
1095
|
-
|
|
1096
|
-
|
|
928
|
+
childrenCount: apiItem.folderCount ?? 0,
|
|
929
|
+
itemsCount: apiItem.itemCount ?? 0,
|
|
1097
930
|
};
|
|
1098
931
|
}
|
|
1099
932
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportCategoryApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
@@ -1102,23 +935,31 @@ class AXCReportCategoryApiProvider {
|
|
|
1102
935
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportCategoryApiProvider, decorators: [{
|
|
1103
936
|
type: Injectable
|
|
1104
937
|
}] });
|
|
1105
|
-
/**
|
|
1106
|
-
* Definition provider that uses the shared data service.
|
|
1107
|
-
* Both providers use the same dataService instance which ensures proper caching.
|
|
1108
|
-
*/
|
|
1109
938
|
class AXCReportDefinitionApiProvider {
|
|
1110
939
|
constructor() {
|
|
1111
|
-
this.dataService = inject(AXCReportManagementDataService);
|
|
1112
940
|
this.http = inject(HttpClient);
|
|
941
|
+
this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
|
|
942
|
+
this.baseUrl = this.configs.baseUrl;
|
|
1113
943
|
}
|
|
1114
944
|
async getList(categoryId) {
|
|
1115
945
|
try {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
const categoryData =
|
|
946
|
+
const url = `${this.baseUrl}/v1/global/report-management/category/${categoryId}`;
|
|
947
|
+
const response = await firstValueFrom(this.http.get(url));
|
|
948
|
+
const categoryData = response.items?.[0];
|
|
1119
949
|
const defs = categoryData?.reportDefinitionItems ?? [];
|
|
1120
|
-
|
|
1121
|
-
|
|
950
|
+
// Fetch full report definitions for each item to get layouts and parameterGroups
|
|
951
|
+
const fullDefinitions = await Promise.all(defs.map(async (item) => {
|
|
952
|
+
try {
|
|
953
|
+
const reportUrl = `${this.baseUrl}/v1/global/report-management/report/${item.id}`;
|
|
954
|
+
const reportResponse = await firstValueFrom(this.http.get(reportUrl));
|
|
955
|
+
return this.mapApiReportDefinitionToReportDefinition(reportResponse);
|
|
956
|
+
}
|
|
957
|
+
catch {
|
|
958
|
+
// Fallback to item mapping if full fetch fails
|
|
959
|
+
return this.mapApiReportDefinitionItemToReportDefinition(item);
|
|
960
|
+
}
|
|
961
|
+
}));
|
|
962
|
+
return fullDefinitions;
|
|
1122
963
|
}
|
|
1123
964
|
catch (error) {
|
|
1124
965
|
console.error('Error fetching report definitions:', error);
|
|
@@ -1127,8 +968,7 @@ class AXCReportDefinitionApiProvider {
|
|
|
1127
968
|
}
|
|
1128
969
|
async getById(id) {
|
|
1129
970
|
try {
|
|
1130
|
-
|
|
1131
|
-
const url = `${this.dataService['baseUrl']}/v1/global/report-management/report/${id}`;
|
|
971
|
+
const url = `${this.baseUrl}/v1/global/report-management/report/${id}`;
|
|
1132
972
|
const response = await firstValueFrom(this.http.get(url));
|
|
1133
973
|
return this.mapApiReportDefinitionToReportDefinition(response);
|
|
1134
974
|
}
|
|
@@ -1143,13 +983,13 @@ class AXCReportDefinitionApiProvider {
|
|
|
1143
983
|
title: apiItem.title,
|
|
1144
984
|
description: apiItem.description || undefined,
|
|
1145
985
|
categoryIds: apiItem.categoryIds,
|
|
1146
|
-
parameterGroups: [],
|
|
1147
|
-
layouts: [],
|
|
1148
|
-
defaultLayoutId: '',
|
|
986
|
+
parameterGroups: [],
|
|
987
|
+
layouts: [],
|
|
988
|
+
defaultLayoutId: '',
|
|
1149
989
|
};
|
|
1150
990
|
}
|
|
1151
991
|
mapApiReportDefinitionToReportDefinition(apiResponse) {
|
|
1152
|
-
|
|
992
|
+
return {
|
|
1153
993
|
id: apiResponse.id,
|
|
1154
994
|
title: apiResponse.title,
|
|
1155
995
|
description: apiResponse.description || undefined,
|
|
@@ -1178,7 +1018,6 @@ class AXCReportDefinitionApiProvider {
|
|
|
1178
1018
|
})),
|
|
1179
1019
|
defaultLayoutId: apiResponse.defaultLayoutId,
|
|
1180
1020
|
};
|
|
1181
|
-
return res;
|
|
1182
1021
|
}
|
|
1183
1022
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportDefinitionApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1184
1023
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportDefinitionApiProvider }); }
|
|
@@ -1187,13 +1026,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
1187
1026
|
type: Injectable
|
|
1188
1027
|
}] });
|
|
1189
1028
|
//#endregion
|
|
1190
|
-
//#endregion
|
|
1191
1029
|
//#region ---- Provider Exports ----
|
|
1192
|
-
/**
|
|
1193
|
-
* Both providers use the same dataService instance (which is a singleton),
|
|
1194
|
-
* ensuring they share the same cache and only one API call is made when both
|
|
1195
|
-
* getCategories and getReportsByCategoryId are called for the same categoryId.
|
|
1196
|
-
*/
|
|
1197
1030
|
const AXC_REPORT_CATEGORY_API_PROVIDER = {
|
|
1198
1031
|
provide: AXP_REPORT_CATEGORY_PROVIDER,
|
|
1199
1032
|
useClass: AXCReportCategoryApiProvider,
|
|
@@ -1209,14 +1042,13 @@ class AXCReportManagementApiModule {
|
|
|
1209
1042
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1210
1043
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, imports: [AXPRuntimeModule] }); }
|
|
1211
1044
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, providers: [
|
|
1212
|
-
AXCReportManagementDataService,
|
|
1213
1045
|
AXC_REPORT_CATEGORY_API_PROVIDER,
|
|
1214
1046
|
AXC_REPORT_DEFINITION_API_PROVIDER,
|
|
1215
1047
|
provideCommandSetups([
|
|
1216
1048
|
{
|
|
1217
1049
|
key: 'ReportManagement.Report:Execute',
|
|
1218
|
-
command: () => import('./acorex-connectivity-api-execute.command-
|
|
1219
|
-
}
|
|
1050
|
+
command: () => import('./acorex-connectivity-api-execute.command-SGNBLcOi.mjs').then((c) => c.AXCReportExecuteCommand),
|
|
1051
|
+
}
|
|
1220
1052
|
]),
|
|
1221
1053
|
], imports: [AXPRuntimeModule] }); }
|
|
1222
1054
|
}
|
|
@@ -1227,14 +1059,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
1227
1059
|
exports: [],
|
|
1228
1060
|
declarations: [],
|
|
1229
1061
|
providers: [
|
|
1230
|
-
AXCReportManagementDataService,
|
|
1231
1062
|
AXC_REPORT_CATEGORY_API_PROVIDER,
|
|
1232
1063
|
AXC_REPORT_DEFINITION_API_PROVIDER,
|
|
1233
1064
|
provideCommandSetups([
|
|
1234
1065
|
{
|
|
1235
1066
|
key: 'ReportManagement.Report:Execute',
|
|
1236
|
-
command: () => import('./acorex-connectivity-api-execute.command-
|
|
1237
|
-
}
|
|
1067
|
+
command: () => import('./acorex-connectivity-api-execute.command-SGNBLcOi.mjs').then((c) => c.AXCReportExecuteCommand),
|
|
1068
|
+
}
|
|
1238
1069
|
]),
|
|
1239
1070
|
],
|
|
1240
1071
|
}]
|
|
@@ -1609,9 +1440,92 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
1609
1440
|
type: Injectable
|
|
1610
1441
|
}], ctorParameters: () => [] });
|
|
1611
1442
|
|
|
1443
|
+
//#region ---- Imports ----
|
|
1444
|
+
//#endregion
|
|
1445
|
+
//#region ---- API Providers ----
|
|
1446
|
+
class AXCSystemInsightReportCategoryApiProvider {
|
|
1447
|
+
constructor() {
|
|
1448
|
+
this.http = inject(HttpClient);
|
|
1449
|
+
}
|
|
1450
|
+
async getList(parentId) {
|
|
1451
|
+
try {
|
|
1452
|
+
// Call API to get report categories
|
|
1453
|
+
const params = {};
|
|
1454
|
+
if (parentId) {
|
|
1455
|
+
params.parentId = parentId;
|
|
1456
|
+
}
|
|
1457
|
+
const response = await firstValueFrom(this.http.get('/api/system-insight/report-categories', { params }));
|
|
1458
|
+
return response;
|
|
1459
|
+
}
|
|
1460
|
+
catch (error) {
|
|
1461
|
+
console.error('Failed to fetch system insight report categories from API:', error);
|
|
1462
|
+
return [];
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
async getById(id) {
|
|
1466
|
+
try {
|
|
1467
|
+
const response = await firstValueFrom(this.http.get(`/api/system-insight/report-categories/${id}`));
|
|
1468
|
+
return response;
|
|
1469
|
+
}
|
|
1470
|
+
catch (error) {
|
|
1471
|
+
console.error(`Failed to fetch system insight report category ${id} from API:`, error);
|
|
1472
|
+
return undefined;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCSystemInsightReportCategoryApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1476
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCSystemInsightReportCategoryApiProvider }); }
|
|
1477
|
+
}
|
|
1478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCSystemInsightReportCategoryApiProvider, decorators: [{
|
|
1479
|
+
type: Injectable
|
|
1480
|
+
}] });
|
|
1481
|
+
class AXCSystemInsightReportDefinitionApiProvider {
|
|
1482
|
+
constructor() {
|
|
1483
|
+
this.http = inject(HttpClient);
|
|
1484
|
+
}
|
|
1485
|
+
async getList(categoryId) {
|
|
1486
|
+
try {
|
|
1487
|
+
const response = await firstValueFrom(this.http.get(`/api/system-insight/report-definitions`, {
|
|
1488
|
+
params: { categoryId }
|
|
1489
|
+
}));
|
|
1490
|
+
return response;
|
|
1491
|
+
}
|
|
1492
|
+
catch (error) {
|
|
1493
|
+
console.error(`Failed to fetch system insight report definitions for category ${categoryId} from API:`, error);
|
|
1494
|
+
return [];
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
async getById(id) {
|
|
1498
|
+
try {
|
|
1499
|
+
const response = await firstValueFrom(this.http.get(`/api/system-insight/report-definitions/${id}`));
|
|
1500
|
+
return response;
|
|
1501
|
+
}
|
|
1502
|
+
catch (error) {
|
|
1503
|
+
console.error(`Failed to fetch system insight report definition ${id} from API:`, error);
|
|
1504
|
+
return undefined;
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCSystemInsightReportDefinitionApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1508
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCSystemInsightReportDefinitionApiProvider }); }
|
|
1509
|
+
}
|
|
1510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCSystemInsightReportDefinitionApiProvider, decorators: [{
|
|
1511
|
+
type: Injectable
|
|
1512
|
+
}] });
|
|
1513
|
+
//#endregion
|
|
1514
|
+
//#region ---- Provider Exports ----
|
|
1515
|
+
const AXC_SYSTEM_INSIGHT_REPORT_CATEGORY_API_PROVIDER = {
|
|
1516
|
+
provide: AXP_REPORT_CATEGORY_PROVIDER,
|
|
1517
|
+
useClass: AXCSystemInsightReportCategoryApiProvider,
|
|
1518
|
+
multi: true,
|
|
1519
|
+
};
|
|
1520
|
+
const AXC_SYSTEM_INSIGHT_REPORT_DEFINITION_API_PROVIDER = {
|
|
1521
|
+
provide: AXP_REPORT_DEFINITION_PROVIDER,
|
|
1522
|
+
useClass: AXCSystemInsightReportDefinitionApiProvider,
|
|
1523
|
+
multi: true,
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1612
1526
|
/**
|
|
1613
1527
|
* Generated bundle index. Do not edit.
|
|
1614
1528
|
*/
|
|
1615
1529
|
|
|
1616
|
-
export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCApiUserAvatarProvider, AXCReportCategoryApiProvider, AXCReportDefinitionApiProvider, AXCReportManagementApiModule,
|
|
1530
|
+
export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCApiUserAvatarProvider, AXCReportCategoryApiProvider, AXCReportDefinitionApiProvider, AXCReportManagementApiModule, AXCSystemInsightReportCategoryApiProvider, AXCSystemInsightReportDefinitionApiProvider, AXC_REPORT_CATEGORY_API_PROVIDER, AXC_REPORT_DEFINITION_API_PROVIDER, AXC_SYSTEM_INSIGHT_REPORT_CATEGORY_API_PROVIDER, AXC_SYSTEM_INSIGHT_REPORT_DEFINITION_API_PROVIDER, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
|
|
1617
1531
|
//# sourceMappingURL=acorex-connectivity-api.mjs.map
|