@acorex/connectivity 20.6.0-next.1 → 20.6.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 +198 -2
- package/fesm2022/{acorex-connectivity-api-execute.command-BesxhDsD.mjs → acorex-connectivity-api-execute.command-BwXw_Kn7.mjs} +4 -4
- package/fesm2022/{acorex-connectivity-api-execute.command-BesxhDsD.mjs.map → acorex-connectivity-api-execute.command-BwXw_Kn7.mjs.map} +1 -1
- package/fesm2022/acorex-connectivity-api.mjs +260 -117
- package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
- package/fesm2022/{acorex-connectivity-mock-category-with-items.query-Cii5As1T.mjs → acorex-connectivity-mock-category-with-items.query-NY9J0cQ0.mjs} +4 -4
- package/fesm2022/{acorex-connectivity-mock-category-with-items.query-Cii5As1T.mjs.map → acorex-connectivity-mock-category-with-items.query-NY9J0cQ0.mjs.map} +1 -1
- package/fesm2022/{acorex-connectivity-mock-distribution-record.command-w3zoeELy.mjs → acorex-connectivity-mock-distribution-record.command-B-Xviv6G.mjs} +4 -4
- package/fesm2022/{acorex-connectivity-mock-distribution-record.command-w3zoeELy.mjs.map → acorex-connectivity-mock-distribution-record.command-B-Xviv6G.mjs.map} +1 -1
- package/fesm2022/{acorex-connectivity-mock-sample.command-C5jZuYcW.mjs → acorex-connectivity-mock-sample.command-BkxMgq1C.mjs} +4 -4
- package/fesm2022/{acorex-connectivity-mock-sample.command-C5jZuYcW.mjs.map → acorex-connectivity-mock-sample.command-BkxMgq1C.mjs.map} +1 -1
- package/fesm2022/acorex-connectivity-mock.mjs +2537 -1050
- 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 +306 -61
- package/package.json +6 -6
|
@@ -8,11 +8,14 @@ import { kebabCase } from 'lodash-es';
|
|
|
8
8
|
import { firstValueFrom, catchError, of, map, BehaviorSubject, tap, filter, take, switchMap, delay } from 'rxjs';
|
|
9
9
|
import * as i2 from '@acorex/platform/auth';
|
|
10
10
|
import { AXPAuthStrategy, AXPSessionService, JwtUtil, TimeUtil, PkceUtil, AXPAuthModule, AXP_TENANT_LOADER, AXP_APPLICATION_LOADER, AXP_PERMISSION_LOADER, AXP_FEATURE_LOADER } from '@acorex/platform/auth';
|
|
11
|
+
import { AXP_USER_AVATAR_PROVIDER } from '@acorex/platform/layout/components';
|
|
11
12
|
import { STRATEGY_CONFIG_TOKEN } from '@acorex/platform/layout/widgets';
|
|
12
13
|
import * as i1$1 from 'angular-oauth2-oidc';
|
|
13
14
|
import { OAuthService, OAuthModule } from 'angular-oauth2-oidc';
|
|
14
15
|
import { AXM_AUTH_CONFIG_TOKEN } from '@acorex/modules/auth';
|
|
15
16
|
import { Router } from '@angular/router';
|
|
17
|
+
import { AXMUsersEntityService } from '@acorex/modules/security-management';
|
|
18
|
+
import { AXPDataGenerator } from '@acorex/platform/core';
|
|
16
19
|
import { AXCUtilsModule, AXCExternalAuthorizationService } from '@acorex/connectivity/utils';
|
|
17
20
|
import { AXPRuntimeModule, provideCommandSetups } from '@acorex/platform/runtime';
|
|
18
21
|
import { AXP_REPORT_CATEGORY_PROVIDER, AXP_REPORT_DEFINITION_PROVIDER } from '@acorex/modules/report-management';
|
|
@@ -138,10 +141,10 @@ class AXCApiEntityStorageService {
|
|
|
138
141
|
};
|
|
139
142
|
});
|
|
140
143
|
}
|
|
141
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
142
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
144
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiEntityStorageService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
145
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiEntityStorageService }); }
|
|
143
146
|
}
|
|
144
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiEntityStorageService, decorators: [{
|
|
145
148
|
type: Injectable
|
|
146
149
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
147
150
|
|
|
@@ -285,10 +288,10 @@ class AXCFileStorageApiService extends AXPFileStorageService {
|
|
|
285
288
|
// Silently fail in fallback mode
|
|
286
289
|
}
|
|
287
290
|
}
|
|
288
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
289
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
291
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCFileStorageApiService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
292
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCFileStorageApiService }); }
|
|
290
293
|
}
|
|
291
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCFileStorageApiService, decorators: [{
|
|
292
295
|
type: Injectable
|
|
293
296
|
}] });
|
|
294
297
|
|
|
@@ -333,10 +336,10 @@ class AXMOidcApplicationLoader {
|
|
|
333
336
|
// features: item.features || [],
|
|
334
337
|
};
|
|
335
338
|
}
|
|
336
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
337
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
339
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcApplicationLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
340
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcApplicationLoader }); }
|
|
338
341
|
}
|
|
339
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcApplicationLoader, decorators: [{
|
|
340
343
|
type: Injectable
|
|
341
344
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
342
345
|
|
|
@@ -376,10 +379,10 @@ class AXMConfigurationService {
|
|
|
376
379
|
switchMap(() => of(this.applicationConfig)));
|
|
377
380
|
}
|
|
378
381
|
}
|
|
379
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
380
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
382
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMConfigurationService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
383
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMConfigurationService, providedIn: 'root' }); }
|
|
381
384
|
}
|
|
382
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMConfigurationService, decorators: [{
|
|
383
386
|
type: Injectable,
|
|
384
387
|
args: [{
|
|
385
388
|
providedIn: 'root',
|
|
@@ -725,10 +728,10 @@ class AXCAPIOidcStrategy extends AXPAuthStrategy {
|
|
|
725
728
|
get name() {
|
|
726
729
|
return 'oidc';
|
|
727
730
|
}
|
|
728
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
729
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
731
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCAPIOidcStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
732
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCAPIOidcStrategy }); }
|
|
730
733
|
}
|
|
731
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCAPIOidcStrategy, decorators: [{
|
|
732
735
|
type: Injectable
|
|
733
736
|
}] });
|
|
734
737
|
|
|
@@ -753,10 +756,10 @@ class AXMOidcPermissionLoader {
|
|
|
753
756
|
const truePolicies = Object.keys(policies).filter((key) => policies[key] === true);
|
|
754
757
|
return truePolicies;
|
|
755
758
|
}
|
|
756
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
757
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
759
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcPermissionLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
760
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcPermissionLoader }); }
|
|
758
761
|
}
|
|
759
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
762
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcPermissionLoader, decorators: [{
|
|
760
763
|
type: Injectable
|
|
761
764
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
762
765
|
|
|
@@ -782,13 +785,51 @@ class AXMOidcTenantLoader {
|
|
|
782
785
|
// Add other fields and defaults as needed, and handle the logo if applicable
|
|
783
786
|
};
|
|
784
787
|
}
|
|
785
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
786
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
788
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcTenantLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
789
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcTenantLoader }); }
|
|
787
790
|
}
|
|
788
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
791
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXMOidcTenantLoader, decorators: [{
|
|
789
792
|
type: Injectable
|
|
790
793
|
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
791
794
|
|
|
795
|
+
class AXCApiUserAvatarProvider {
|
|
796
|
+
constructor() {
|
|
797
|
+
this.userService = inject(AXMUsersEntityService);
|
|
798
|
+
this.sessionService = inject(AXPSessionService);
|
|
799
|
+
}
|
|
800
|
+
async provide(userId) {
|
|
801
|
+
// Check if requesting current user info
|
|
802
|
+
const currentUser = this.sessionService.user;
|
|
803
|
+
const isCurrentUser = currentUser?.id === userId;
|
|
804
|
+
if (isCurrentUser && currentUser) {
|
|
805
|
+
// Use session service user data for current user
|
|
806
|
+
const [firstName, lastName] = (currentUser.name || '').split(' ') || ['', ''];
|
|
807
|
+
return {
|
|
808
|
+
id: currentUser.id,
|
|
809
|
+
username: currentUser.name || '',
|
|
810
|
+
firstName: firstName || '',
|
|
811
|
+
lastName: lastName || '',
|
|
812
|
+
status: 'online',
|
|
813
|
+
avatarUrl: currentUser.avatar || `https://avatar.iran.liara.run/public/${AXPDataGenerator.pick([35, 22, 16, 6, 31])}`,
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
// Use entity service for other users
|
|
817
|
+
const user = await this.userService.getOne(userId);
|
|
818
|
+
if (!user) {
|
|
819
|
+
throw new Error(`User not found for ${userId}`);
|
|
820
|
+
}
|
|
821
|
+
const [firstName, lastName] = user.displayName.split(' ') || ['', ''];
|
|
822
|
+
return {
|
|
823
|
+
id: user.id,
|
|
824
|
+
username: user.username,
|
|
825
|
+
firstName: firstName || '',
|
|
826
|
+
lastName: lastName || '',
|
|
827
|
+
status: 'online',
|
|
828
|
+
avatarUrl: `https://avatar.iran.liara.run/public/${AXPDataGenerator.pick([35, 22, 16, 6, 31])}`,
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
|
|
792
833
|
//#endregion
|
|
793
834
|
//#region ---- Helper Functions ----
|
|
794
835
|
// /**
|
|
@@ -839,63 +880,174 @@ class AXCReportManagementDataService {
|
|
|
839
880
|
this.http = inject(HttpClient);
|
|
840
881
|
this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
|
|
841
882
|
this.baseUrl = this.configs.baseUrl;
|
|
842
|
-
//
|
|
843
|
-
this.
|
|
844
|
-
this.
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
883
|
+
// Cache for category data to avoid duplicate API calls
|
|
884
|
+
this.categoryDataCache = new Map();
|
|
885
|
+
this.rootCategoriesCache = null;
|
|
886
|
+
this.pendingRequests = new Map();
|
|
887
|
+
this.pendingRootCategoriesRequest = null;
|
|
888
|
+
}
|
|
889
|
+
//#region ---- Lazy Category/Report Fetching ----
|
|
890
|
+
/**
|
|
891
|
+
* Fetch root categories (no parent). Only root categories without reports and children.
|
|
892
|
+
* Uses cache and pending requests to avoid duplicate API calls.
|
|
893
|
+
*/
|
|
894
|
+
async getRootCategories() {
|
|
895
|
+
// Check if already cached
|
|
896
|
+
if (this.rootCategoriesCache !== null) {
|
|
897
|
+
return this.rootCategoriesCache;
|
|
849
898
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
const
|
|
856
|
-
|
|
857
|
-
|
|
899
|
+
// Check if there's already a pending request
|
|
900
|
+
if (this.pendingRootCategoriesRequest !== null) {
|
|
901
|
+
return this.pendingRootCategoriesRequest;
|
|
902
|
+
}
|
|
903
|
+
// Create the request and cache it
|
|
904
|
+
const requestPromise = (async () => {
|
|
905
|
+
try {
|
|
906
|
+
const url = `${this.baseUrl}/v1/global/report-management/category`;
|
|
907
|
+
const params = { Skip: 0, Take: 1000 };
|
|
908
|
+
const response = await firstValueFrom(this.http.get(url, { params }));
|
|
909
|
+
const all = response.items ?? [];
|
|
910
|
+
const rootCategories = all.filter((i) => !i.reportCategoryParentId);
|
|
911
|
+
// Cache the result
|
|
912
|
+
this.rootCategoriesCache = rootCategories;
|
|
913
|
+
return rootCategories;
|
|
914
|
+
}
|
|
915
|
+
finally {
|
|
916
|
+
// Remove from pending requests after completion
|
|
917
|
+
this.pendingRootCategoriesRequest = null;
|
|
918
|
+
}
|
|
919
|
+
})();
|
|
920
|
+
this.pendingRootCategoriesRequest = requestPromise;
|
|
921
|
+
return requestPromise;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Fetch category data for a given parentId.
|
|
925
|
+
* Returns the parent category with its FolderItems (children) and ReportDefinitionItems (reports).
|
|
926
|
+
* Uses cache to avoid duplicate API calls.
|
|
927
|
+
*/
|
|
928
|
+
async getCategoryData(parentId) {
|
|
929
|
+
// Check if already cached
|
|
930
|
+
if (this.categoryDataCache.has(parentId)) {
|
|
931
|
+
return this.categoryDataCache.get(parentId);
|
|
932
|
+
}
|
|
933
|
+
// Check if there's already a pending request for this category
|
|
934
|
+
if (this.pendingRequests.has(parentId)) {
|
|
935
|
+
return this.pendingRequests.get(parentId);
|
|
936
|
+
}
|
|
937
|
+
// Create the request and cache it
|
|
938
|
+
const requestPromise = (async () => {
|
|
939
|
+
try {
|
|
940
|
+
const url = `${this.baseUrl}/v1/global/report-management/category/${parentId}`;
|
|
941
|
+
const response = await firstValueFrom(this.http.get(url));
|
|
942
|
+
const categoryData = response.items?.[0];
|
|
943
|
+
// Cache the result
|
|
944
|
+
this.categoryDataCache.set(parentId, categoryData);
|
|
945
|
+
return categoryData;
|
|
946
|
+
}
|
|
947
|
+
catch {
|
|
948
|
+
const undefinedResult = undefined;
|
|
949
|
+
this.categoryDataCache.set(parentId, undefinedResult);
|
|
950
|
+
return undefinedResult;
|
|
951
|
+
}
|
|
952
|
+
finally {
|
|
953
|
+
// Remove from pending requests after completion
|
|
954
|
+
this.pendingRequests.delete(parentId);
|
|
955
|
+
}
|
|
956
|
+
})();
|
|
957
|
+
this.pendingRequests.set(parentId, requestPromise);
|
|
958
|
+
return requestPromise;
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Fetch both child categories and reports for a given parentId.
|
|
962
|
+
* This method ensures only one API call is made and both results are returned.
|
|
963
|
+
*/
|
|
964
|
+
async getCategoryChildrenAndReports(parentId) {
|
|
965
|
+
const categoryData = await this.getCategoryData(parentId);
|
|
966
|
+
return {
|
|
967
|
+
categories: categoryData?.folderItems ?? [],
|
|
968
|
+
reports: categoryData?.reportDefinitionItems ?? [],
|
|
969
|
+
};
|
|
858
970
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
971
|
+
/**
|
|
972
|
+
* Fetch child categories of a given parent.
|
|
973
|
+
* Uses getCategoryData to get FolderItems (children) from the parent category.
|
|
974
|
+
*/
|
|
975
|
+
async getChildCategories(parentId) {
|
|
976
|
+
const categoryData = await this.getCategoryData(parentId);
|
|
977
|
+
return categoryData?.folderItems ?? [];
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Fetch report definitions that belong to a specific category.
|
|
981
|
+
* Uses getCategoryData to get ReportDefinitionItems (reports) from the category.
|
|
982
|
+
*/
|
|
983
|
+
async getCategoryReports(categoryId) {
|
|
984
|
+
const categoryData = await this.getCategoryData(categoryId);
|
|
985
|
+
return categoryData?.reportDefinitionItems ?? [];
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Fetch a single category by id.
|
|
989
|
+
* First checks cache, then uses getCategoryData if not found in cache.
|
|
990
|
+
*/
|
|
991
|
+
async getCategoryById(id) {
|
|
992
|
+
// First check if it's in cache (from previous getCategoryData calls)
|
|
993
|
+
if (this.categoryDataCache.has(id)) {
|
|
994
|
+
return this.categoryDataCache.get(id);
|
|
995
|
+
}
|
|
996
|
+
// Try to get from category data endpoint (which will cache it)
|
|
997
|
+
const categoryData = await this.getCategoryData(id);
|
|
998
|
+
if (categoryData) {
|
|
999
|
+
return categoryData;
|
|
1000
|
+
}
|
|
1001
|
+
// Fallback: search in root categories cache
|
|
1002
|
+
if (this.rootCategoriesCache) {
|
|
1003
|
+
const found = this.rootCategoriesCache.find((c) => c.id === id);
|
|
1004
|
+
if (found) {
|
|
1005
|
+
return found;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
// Last resort: search in all categories (but this should rarely happen)
|
|
1009
|
+
try {
|
|
1010
|
+
const url = `${this.baseUrl}/v1/global/report-management/category`;
|
|
1011
|
+
const params = { Skip: 0, Take: 1000 };
|
|
1012
|
+
const response = await firstValueFrom(this.http.get(url, { params }));
|
|
1013
|
+
const all = response.items ?? [];
|
|
1014
|
+
return all.find((c) => c.id === id);
|
|
1015
|
+
}
|
|
1016
|
+
catch {
|
|
1017
|
+
return undefined;
|
|
1018
|
+
}
|
|
862
1019
|
}
|
|
863
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
864
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
1020
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1021
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementDataService }); }
|
|
865
1022
|
}
|
|
866
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1023
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementDataService, decorators: [{
|
|
867
1024
|
type: Injectable
|
|
868
1025
|
}] });
|
|
869
1026
|
//#endregion
|
|
870
1027
|
//#region ---- API Providers ----
|
|
1028
|
+
/**
|
|
1029
|
+
* Category provider that uses the shared data service.
|
|
1030
|
+
* Both providers use the same dataService instance which ensures proper caching.
|
|
1031
|
+
*/
|
|
871
1032
|
class AXCReportCategoryApiProvider {
|
|
872
1033
|
constructor() {
|
|
873
1034
|
this.dataService = inject(AXCReportManagementDataService);
|
|
874
|
-
// Cache to store processed categories
|
|
875
|
-
this.categoriesCache = new Map();
|
|
876
1035
|
}
|
|
877
1036
|
async getList(parentId) {
|
|
878
|
-
// Check cache first
|
|
879
|
-
if (this.categoriesCache.has(parentId)) {
|
|
880
|
-
return this.categoriesCache.get(parentId);
|
|
881
|
-
}
|
|
882
1037
|
try {
|
|
883
|
-
//
|
|
884
|
-
const allCategoriesData = await this.dataService.getAllCategoriesData();
|
|
885
|
-
// Filter categories based on parentId
|
|
886
|
-
let filteredItems;
|
|
1038
|
+
// For root level, get root categories (each category includes folderItems in API response)
|
|
887
1039
|
if (!parentId) {
|
|
888
|
-
|
|
889
|
-
|
|
1040
|
+
const filteredItems = await this.dataService.getRootCategories();
|
|
1041
|
+
// Each root category has folderItems in the API response, but we only return the root categories themselves
|
|
1042
|
+
// The folderItems are preserved in the API response structure, similar to child state
|
|
1043
|
+
return filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
|
|
890
1044
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
this.categoriesCache.set(parentId, categories);
|
|
898
|
-
return categories;
|
|
1045
|
+
// For child level, get categories from category data (which includes folderItems)
|
|
1046
|
+
// This ensures we use the same API response that getList for definitions will use
|
|
1047
|
+
// The folderItems structure is preserved, similar to root state
|
|
1048
|
+
const categoryData = await this.dataService.getCategoryData(parentId);
|
|
1049
|
+
const filteredItems = categoryData?.folderItems ?? [];
|
|
1050
|
+
return filteredItems.map((item) => this.mapApiCategoryToReportCategory(item));
|
|
899
1051
|
}
|
|
900
1052
|
catch (error) {
|
|
901
1053
|
console.error('Error fetching report categories:', error);
|
|
@@ -904,9 +1056,7 @@ class AXCReportCategoryApiProvider {
|
|
|
904
1056
|
}
|
|
905
1057
|
async getById(id) {
|
|
906
1058
|
try {
|
|
907
|
-
|
|
908
|
-
const allCategoriesData = await this.dataService.getAllCategoriesData();
|
|
909
|
-
const apiItem = allCategoriesData.find((item) => item.id === id);
|
|
1059
|
+
const apiItem = await this.dataService.getCategoryById(id);
|
|
910
1060
|
if (!apiItem) {
|
|
911
1061
|
return undefined;
|
|
912
1062
|
}
|
|
@@ -927,48 +1077,32 @@ class AXCReportCategoryApiProvider {
|
|
|
927
1077
|
hasReport: apiItem.itemCount > 0, // reportDefinitionItems = files
|
|
928
1078
|
};
|
|
929
1079
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
this.categoriesCache.clear();
|
|
933
|
-
this.dataService.clearCache();
|
|
934
|
-
}
|
|
935
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportCategoryApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
936
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportCategoryApiProvider }); }
|
|
1080
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportCategoryApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1081
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportCategoryApiProvider }); }
|
|
937
1082
|
}
|
|
938
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1083
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportCategoryApiProvider, decorators: [{
|
|
939
1084
|
type: Injectable
|
|
940
1085
|
}] });
|
|
1086
|
+
/**
|
|
1087
|
+
* Definition provider that uses the shared data service.
|
|
1088
|
+
* Both providers use the same dataService instance which ensures proper caching.
|
|
1089
|
+
*/
|
|
941
1090
|
class AXCReportDefinitionApiProvider {
|
|
942
1091
|
constructor() {
|
|
943
1092
|
this.dataService = inject(AXCReportManagementDataService);
|
|
944
1093
|
this.http = inject(HttpClient);
|
|
945
|
-
// Cache to store report definitions by category to avoid unnecessary API calls
|
|
946
|
-
this.reportDefinitionsCache = new Map();
|
|
947
1094
|
}
|
|
948
1095
|
async getList(categoryId) {
|
|
949
|
-
// Check cache first
|
|
950
|
-
if (this.reportDefinitionsCache.has(categoryId)) {
|
|
951
|
-
return this.reportDefinitionsCache.get(categoryId);
|
|
952
|
-
}
|
|
953
1096
|
try {
|
|
954
|
-
//
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
const
|
|
958
|
-
|
|
959
|
-
// Cache empty result to avoid repeated API calls
|
|
960
|
-
this.reportDefinitionsCache.set(categoryId, []);
|
|
961
|
-
return [];
|
|
962
|
-
}
|
|
963
|
-
const reportDefinitions = categoryItem.reportDefinitionItems.map((item) => this.mapApiReportDefinitionItemToReportDefinition(item));
|
|
964
|
-
// Cache the result
|
|
965
|
-
this.reportDefinitionsCache.set(categoryId, reportDefinitions);
|
|
1097
|
+
// Use getCategoryData which is cached and shared with getCategories
|
|
1098
|
+
// This ensures only one API call is made when both getCategories and getReportsByCategoryId are called
|
|
1099
|
+
const categoryData = await this.dataService.getCategoryData(categoryId);
|
|
1100
|
+
const defs = categoryData?.reportDefinitionItems ?? [];
|
|
1101
|
+
const reportDefinitions = defs.map((item) => this.mapApiReportDefinitionItemToReportDefinition(item));
|
|
966
1102
|
return reportDefinitions;
|
|
967
1103
|
}
|
|
968
1104
|
catch (error) {
|
|
969
1105
|
console.error('Error fetching report definitions:', error);
|
|
970
|
-
// Cache empty result to avoid repeated failed API calls
|
|
971
|
-
this.reportDefinitionsCache.set(categoryId, []);
|
|
972
1106
|
return [];
|
|
973
1107
|
}
|
|
974
1108
|
}
|
|
@@ -1027,19 +1161,20 @@ class AXCReportDefinitionApiProvider {
|
|
|
1027
1161
|
};
|
|
1028
1162
|
return res;
|
|
1029
1163
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
this.reportDefinitionsCache.clear();
|
|
1033
|
-
this.dataService.clearCache();
|
|
1034
|
-
}
|
|
1035
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportDefinitionApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1036
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AXCReportDefinitionApiProvider }); }
|
|
1164
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportDefinitionApiProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1165
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportDefinitionApiProvider }); }
|
|
1037
1166
|
}
|
|
1038
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1167
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportDefinitionApiProvider, decorators: [{
|
|
1039
1168
|
type: Injectable
|
|
1040
1169
|
}] });
|
|
1041
1170
|
//#endregion
|
|
1171
|
+
//#endregion
|
|
1042
1172
|
//#region ---- Provider Exports ----
|
|
1173
|
+
/**
|
|
1174
|
+
* Both providers use the same dataService instance (which is a singleton),
|
|
1175
|
+
* ensuring they share the same cache and only one API call is made when both
|
|
1176
|
+
* getCategories and getReportsByCategoryId are called for the same categoryId.
|
|
1177
|
+
*/
|
|
1043
1178
|
const AXC_REPORT_CATEGORY_API_PROVIDER = {
|
|
1044
1179
|
provide: AXP_REPORT_CATEGORY_PROVIDER,
|
|
1045
1180
|
useClass: AXCReportCategoryApiProvider,
|
|
@@ -1052,21 +1187,21 @@ const AXC_REPORT_DEFINITION_API_PROVIDER = {
|
|
|
1052
1187
|
};
|
|
1053
1188
|
|
|
1054
1189
|
class AXCReportManagementApiModule {
|
|
1055
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1056
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
1057
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
1190
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1191
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, imports: [AXPRuntimeModule] }); }
|
|
1192
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, providers: [
|
|
1058
1193
|
AXCReportManagementDataService,
|
|
1059
1194
|
AXC_REPORT_CATEGORY_API_PROVIDER,
|
|
1060
1195
|
AXC_REPORT_DEFINITION_API_PROVIDER,
|
|
1061
1196
|
provideCommandSetups([
|
|
1062
1197
|
{
|
|
1063
1198
|
key: 'ReportManagement.Report:Execute',
|
|
1064
|
-
command: () => import('./acorex-connectivity-api-execute.command-
|
|
1199
|
+
command: () => import('./acorex-connectivity-api-execute.command-BwXw_Kn7.mjs').then((c) => c.AXCReportExecuteCommand),
|
|
1065
1200
|
},
|
|
1066
1201
|
]),
|
|
1067
1202
|
], imports: [AXPRuntimeModule] }); }
|
|
1068
1203
|
}
|
|
1069
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCReportManagementApiModule, decorators: [{
|
|
1070
1205
|
type: NgModule,
|
|
1071
1206
|
args: [{
|
|
1072
1207
|
imports: [AXPRuntimeModule],
|
|
@@ -1079,7 +1214,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
1079
1214
|
provideCommandSetups([
|
|
1080
1215
|
{
|
|
1081
1216
|
key: 'ReportManagement.Report:Execute',
|
|
1082
|
-
command: () => import('./acorex-connectivity-api-execute.command-
|
|
1217
|
+
command: () => import('./acorex-connectivity-api-execute.command-BwXw_Kn7.mjs').then((c) => c.AXCReportExecuteCommand),
|
|
1083
1218
|
},
|
|
1084
1219
|
]),
|
|
1085
1220
|
],
|
|
@@ -1087,10 +1222,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
1087
1222
|
}] });
|
|
1088
1223
|
|
|
1089
1224
|
class AXCApiModule {
|
|
1090
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1091
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
1225
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1226
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: AXCApiModule, imports: [i1$1.OAuthModule, i2.AXPAuthModule, AXCUtilsModule,
|
|
1092
1227
|
AXCReportManagementApiModule] }); }
|
|
1093
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
1228
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiModule, providers: [
|
|
1094
1229
|
{
|
|
1095
1230
|
provide: AXPEntityStorageService,
|
|
1096
1231
|
useClass: AXCApiEntityStorageService,
|
|
@@ -1121,7 +1256,11 @@ class AXCApiModule {
|
|
|
1121
1256
|
selectValueStrategy: 'valueField',
|
|
1122
1257
|
lookupValueStrategy: 'valueField',
|
|
1123
1258
|
},
|
|
1124
|
-
}
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
provide: AXP_USER_AVATAR_PROVIDER,
|
|
1262
|
+
useClass: AXCApiUserAvatarProvider,
|
|
1263
|
+
},
|
|
1125
1264
|
], imports: [OAuthModule.forRoot(),
|
|
1126
1265
|
AXPAuthModule.forRoot({
|
|
1127
1266
|
strategies: [AXCAPIOidcStrategy],
|
|
@@ -1129,7 +1268,7 @@ class AXCApiModule {
|
|
|
1129
1268
|
AXCUtilsModule,
|
|
1130
1269
|
AXCReportManagementApiModule] }); }
|
|
1131
1270
|
}
|
|
1132
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1271
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCApiModule, decorators: [{
|
|
1133
1272
|
type: NgModule,
|
|
1134
1273
|
args: [{
|
|
1135
1274
|
imports: [
|
|
@@ -1171,7 +1310,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
1171
1310
|
selectValueStrategy: 'valueField',
|
|
1172
1311
|
lookupValueStrategy: 'valueField',
|
|
1173
1312
|
},
|
|
1174
|
-
}
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
provide: AXP_USER_AVATAR_PROVIDER,
|
|
1316
|
+
useClass: AXCApiUserAvatarProvider,
|
|
1317
|
+
},
|
|
1175
1318
|
],
|
|
1176
1319
|
}]
|
|
1177
1320
|
}] });
|
|
@@ -1440,10 +1583,10 @@ class APIGoogleStrategy extends AXPAuthStrategy {
|
|
|
1440
1583
|
console.error('Authentication error:', error);
|
|
1441
1584
|
throw error;
|
|
1442
1585
|
}
|
|
1443
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1444
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
1586
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: APIGoogleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1587
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: APIGoogleStrategy }); }
|
|
1445
1588
|
}
|
|
1446
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: APIGoogleStrategy, decorators: [{
|
|
1447
1590
|
type: Injectable
|
|
1448
1591
|
}], ctorParameters: () => [] });
|
|
1449
1592
|
|
|
@@ -1451,5 +1594,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
1451
1594
|
* Generated bundle index. Do not edit.
|
|
1452
1595
|
*/
|
|
1453
1596
|
|
|
1454
|
-
export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCReportManagementApiModule, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
|
|
1597
|
+
export { APIGoogleStrategy, AXCAPIOidcStrategy, AXCApiEntityStorageService, AXCApiModule, AXCApiUserAvatarProvider, AXCReportCategoryApiProvider, AXCReportDefinitionApiProvider, AXCReportManagementApiModule, AXCReportManagementDataService, AXC_REPORT_CATEGORY_API_PROVIDER, AXC_REPORT_DEFINITION_API_PROVIDER, AXMConfigurationService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcTenantLoader };
|
|
1455
1598
|
//# sourceMappingURL=acorex-connectivity-api.mjs.map
|