@acorex/connectivity 21.0.0-next.8 → 21.0.0-next.85
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/fesm2022/{acorex-connectivity-api-execute.command-SGNBLcOi.mjs → acorex-connectivity-api-execute.command-CjCFEav4.mjs} +18 -8
- package/fesm2022/acorex-connectivity-api-execute.command-CjCFEav4.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-api.mjs +196 -192
- package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-Btm13GJK.mjs +86927 -0
- package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-Btm13GJK.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-assign-to-manager.activity-CY_5d0KF.mjs +288 -0
- package/fesm2022/acorex-connectivity-mock-assign-to-manager.activity-CY_5d0KF.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-category-metadata-inheritance.query-CIof4zTg.mjs +200 -0
- package/fesm2022/acorex-connectivity-mock-category-metadata-inheritance.query-CIof4zTg.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-category-with-items.query-Dsxj98tX.mjs → acorex-connectivity-mock-category-with-items.query-DAKUJIIt.mjs} +18 -17
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-DAKUJIIt.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-chat-generate-image.command-Hj-2bHyJ.mjs +111 -0
- package/fesm2022/acorex-connectivity-mock-chat-generate-image.command-Hj-2bHyJ.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-0ZnevjmT.mjs +121 -0
- package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-0ZnevjmT.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-chat-transcribe-speech.command-D8sCgp69.mjs +121 -0
- package/fesm2022/acorex-connectivity-mock-chat-transcribe-speech.command-D8sCgp69.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-check-permission.activity-vr3OHtjC.mjs +45 -0
- package/fesm2022/acorex-connectivity-mock-check-permission.activity-vr3OHtjC.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-contact-core.module-5TLCGWOR.mjs +968 -0
- package/fesm2022/acorex-connectivity-mock-contact-core.module-5TLCGWOR.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-content-management.module-GQdqKsPB.mjs +16 -0
- package/fesm2022/acorex-connectivity-mock-content-management.module-GQdqKsPB.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-distribution-record.command-DRiDwlqN.mjs → acorex-connectivity-mock-distribution-record.activity-a1_k9Czb.mjs} +29 -14
- package/fesm2022/acorex-connectivity-mock-distribution-record.activity-a1_k9Czb.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-entity-create.activity-CdoUzUvF.mjs +67 -0
- package/fesm2022/acorex-connectivity-mock-entity-create.activity-CdoUzUvF.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-entity-delete.activity-ErEN1c24.mjs +60 -0
- package/fesm2022/acorex-connectivity-mock-entity-delete.activity-ErEN1c24.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-entity-read.activity-1fJW8gVe.mjs +67 -0
- package/fesm2022/acorex-connectivity-mock-entity-read.activity-1fJW8gVe.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-entity-update.activity-06HTKiQQ.mjs +68 -0
- package/fesm2022/acorex-connectivity-mock-entity-update.activity-06HTKiQQ.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-extract-document-text.command-nGfUTSf6.mjs +64 -0
- package/fesm2022/acorex-connectivity-mock-extract-document-text.command-nGfUTSf6.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-application-versions-chart-data.query-C3eQfF0A.mjs → acorex-connectivity-mock-get-application-versions-chart-data.query-DwVuYuKx.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-application-versions-chart-data.query-DwVuYuKx.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-application-versions-timeline.query-CLzDz9ob.mjs → acorex-connectivity-mock-get-application-versions-timeline.query-sFKYynZA.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-application-versions-timeline.query-sFKYynZA.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-get-current-session-user.activity-CsmxwXsM.mjs +39 -0
- package/fesm2022/acorex-connectivity-mock-get-current-session-user.activity-CsmxwXsM.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs +69 -0
- package/fesm2022/acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-get-employee-list.query-BWbZj3tp.mjs +214 -0
- package/fesm2022/acorex-connectivity-mock-get-employee-list.query-BWbZj3tp.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-get-location-list.query-CQ2rFDUM.mjs +209 -0
- package/fesm2022/acorex-connectivity-mock-get-location-list.query-CQ2rFDUM.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-get-product-chart-data.query-D7DBzLT-.mjs +186 -0
- package/fesm2022/acorex-connectivity-mock-get-product-chart-data.query-D7DBzLT-.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-product-list.query-ChtYlSTt.mjs → acorex-connectivity-mock-get-product-list.query-Bv1im5yj.mjs} +111 -14
- package/fesm2022/acorex-connectivity-mock-get-product-list.query-Bv1im5yj.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-get-product-pdf-data.query-Cp65_mpB.mjs +192 -0
- package/fesm2022/acorex-connectivity-mock-get-product-pdf-data.query-Cp65_mpB.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-subscriptions-chart-data.query-HxX_bCT8.mjs → acorex-connectivity-mock-get-subscriptions-chart-data.query-CkQnH-F_.mjs} +5 -5
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-chart-data.query-CkQnH-F_.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-subscriptions-timeline.query-dp08JqLP.mjs → acorex-connectivity-mock-get-subscriptions-timeline.query-C_ecGCyk.mjs} +92 -14
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-timeline.query-C_ecGCyk.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-application-access.query-IATTXcAV.mjs → acorex-connectivity-mock-get-tenant-application-access.query-t4BHU8qk.mjs} +92 -14
- package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-t4BHU8qk.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-registration-chart-data.query-DlXi4Rcg.mjs → acorex-connectivity-mock-get-tenant-registration-chart-data.query-CgMZxfzh.mjs} +5 -5
- package/fesm2022/acorex-connectivity-mock-get-tenant-registration-chart-data.query-CgMZxfzh.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-registration-timeline.query-hskw8Ioa.mjs → acorex-connectivity-mock-get-tenant-registration-timeline.query-COmTsDCV.mjs} +92 -14
- package/fesm2022/acorex-connectivity-mock-get-tenant-registration-timeline.query-COmTsDCV.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-user-distribution.query-Bs5U5tze.mjs → acorex-connectivity-mock-get-tenant-user-distribution.query-jQAsUf_h.mjs} +92 -14
- package/fesm2022/acorex-connectivity-mock-get-tenant-user-distribution.query-jQAsUf_h.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-if.activity-DvzuhItL.mjs +35 -0
- package/fesm2022/acorex-connectivity-mock-if.activity-DvzuhItL.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs +73 -0
- package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-report-summary.util-CGOhHIZr.mjs +56 -0
- package/fesm2022/acorex-connectivity-mock-report-summary.util-CGOhHIZr.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-sample.command-CkH5bmEs.mjs → acorex-connectivity-mock-sample.command-CJmDL4pL.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-sample.command-CJmDL4pL.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-structured-text-completion.command-l31pjl9-.mjs +38 -0
- package/fesm2022/acorex-connectivity-mock-structured-text-completion.command-l31pjl9-.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-user-roles-for-list-column.query-D2QjJXu4.mjs +30 -0
- package/fesm2022/acorex-connectivity-mock-user-roles-for-list-column.query-D2QjJXu4.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock.mjs +2 -50419
- 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/fesm2022/acorex-connectivity.mjs.map +1 -1
- package/package.json +8 -7
- package/{api/index.d.ts → types/acorex-connectivity-api.d.ts} +14 -60
- package/types/acorex-connectivity-mock.d.ts +4224 -0
- package/fesm2022/acorex-connectivity-api-execute.command-SGNBLcOi.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-Dsxj98tX.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-distribution-record.command-DRiDwlqN.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-application-versions-chart-data.query-C3eQfF0A.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-application-versions-timeline.query-CLzDz9ob.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-product-chart-data.query-DDVVFeYN.mjs +0 -97
- package/fesm2022/acorex-connectivity-mock-get-product-chart-data.query-DDVVFeYN.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-product-list.query-ChtYlSTt.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-chart-data.query-HxX_bCT8.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-timeline.query-dp08JqLP.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-IATTXcAV.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-registration-chart-data.query-DlXi4Rcg.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-registration-timeline.query-hskw8Ioa.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-user-distribution.query-Bs5U5tze.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-sample.command-CkH5bmEs.mjs.map +0 -1
- package/mock/index.d.ts +0 -2669
- /package/{utils/index.d.ts → types/acorex-connectivity-utils.d.ts} +0 -0
- /package/{index.d.ts → types/acorex-connectivity.d.ts} +0 -0
|
@@ -26,25 +26,37 @@ class GetTenantRegistrationTimelineQuery {
|
|
|
26
26
|
.data();
|
|
27
27
|
}
|
|
28
28
|
async fetch(input) {
|
|
29
|
+
// Extract filters from AXPFilterClause format
|
|
30
|
+
const extractedFilters = this.extractTenantFilters(input.filters);
|
|
31
|
+
const filterLogic = input.filters?.logic || input.logic || 'and';
|
|
32
|
+
// Separate custom filters from entity filters
|
|
33
|
+
const entityFilters = [];
|
|
34
|
+
let dateRangeFilter;
|
|
35
|
+
if (extractedFilters && extractedFilters.length > 0) {
|
|
36
|
+
for (const filter of extractedFilters) {
|
|
37
|
+
if (filter.field === 'dateRange') {
|
|
38
|
+
dateRangeFilter = filter.value;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
entityFilters.push(filter);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
29
45
|
// Get all tenants
|
|
30
46
|
const tenantsResult = await this.tenantService.query({
|
|
31
47
|
skip: 0,
|
|
32
48
|
take: 10000,
|
|
33
|
-
filter:
|
|
49
|
+
filter: entityFilters.length > 0
|
|
34
50
|
? {
|
|
35
|
-
logic:
|
|
36
|
-
filters:
|
|
51
|
+
logic: filterLogic,
|
|
52
|
+
filters: entityFilters,
|
|
37
53
|
}
|
|
38
54
|
: undefined,
|
|
39
55
|
});
|
|
40
56
|
let tenants = tenantsResult.items.filter((t) => t.registrationDate);
|
|
41
57
|
// Apply date range filter if provided
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
if (filter.field === 'dateRange' && filter.value) {
|
|
45
|
-
tenants = this.applyDateRangeFilter(tenants, filter.value);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
58
|
+
if (dateRangeFilter) {
|
|
59
|
+
tenants = this.applyDateRangeFilter(tenants, dateRangeFilter);
|
|
48
60
|
}
|
|
49
61
|
// Get all tenant users for counting
|
|
50
62
|
const tenantUsersResult = await this.tenantUserService.query({
|
|
@@ -109,7 +121,7 @@ class GetTenantRegistrationTimelineQuery {
|
|
|
109
121
|
if (input.sort && input.sort.length > 0) {
|
|
110
122
|
results.sort((a, b) => {
|
|
111
123
|
for (const sortField of input.sort) {
|
|
112
|
-
const field = sortField.
|
|
124
|
+
const field = sortField.name;
|
|
113
125
|
const aValue = a[field];
|
|
114
126
|
const bValue = b[field];
|
|
115
127
|
const dir = sortField.dir === 'asc' ? 1 : -1;
|
|
@@ -184,6 +196,72 @@ class GetTenantRegistrationTimelineQuery {
|
|
|
184
196
|
return counts;
|
|
185
197
|
}
|
|
186
198
|
//#endregion
|
|
199
|
+
//#region ---- Filter Extraction ----
|
|
200
|
+
/**
|
|
201
|
+
* Extract tenant-specific filters from AXPFilterClause format
|
|
202
|
+
* Maps report parameter paths to tenant entity field names
|
|
203
|
+
*/
|
|
204
|
+
extractTenantFilters(parameters) {
|
|
205
|
+
const filters = [];
|
|
206
|
+
const paramsAny = parameters;
|
|
207
|
+
if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {
|
|
208
|
+
return filters;
|
|
209
|
+
}
|
|
210
|
+
for (const filter of paramsAny.filters) {
|
|
211
|
+
if (!filter?.field || filter?.value === undefined || filter?.value === null) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const field = filter.field;
|
|
215
|
+
const value = filter.value;
|
|
216
|
+
const operator = filter.operator || { type: 'equal' };
|
|
217
|
+
// Handle tenant-specific field mappings
|
|
218
|
+
if (field === 'tenantId') {
|
|
219
|
+
// Tenant ID filter - can be array of IDs or single ID
|
|
220
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
221
|
+
filters.push({
|
|
222
|
+
field: 'id',
|
|
223
|
+
operator: { type: 'in' },
|
|
224
|
+
value: value,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
else if (value) {
|
|
228
|
+
filters.push({
|
|
229
|
+
field: 'id',
|
|
230
|
+
operator: { type: 'equal' },
|
|
231
|
+
value: value,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else if (field === 'statusId') {
|
|
236
|
+
// Status filter - skip 'all' value
|
|
237
|
+
if (value && value !== 'all') {
|
|
238
|
+
filters.push({
|
|
239
|
+
field: 'statusId',
|
|
240
|
+
operator: { type: 'equal' },
|
|
241
|
+
value: value,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else if (field === 'dateRange') {
|
|
246
|
+
// Date range filter - custom logic handled in query
|
|
247
|
+
filters.push({
|
|
248
|
+
field: 'dateRange',
|
|
249
|
+
operator: { type: 'equal' },
|
|
250
|
+
value: value,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
// Direct field mapping
|
|
255
|
+
filters.push({
|
|
256
|
+
field: field,
|
|
257
|
+
operator: operator,
|
|
258
|
+
value: value,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return filters;
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
187
265
|
//#region ---- Custom Filter Handlers ----
|
|
188
266
|
/**
|
|
189
267
|
* Apply date range filter to tenants
|
|
@@ -202,10 +280,10 @@ class GetTenantRegistrationTimelineQuery {
|
|
|
202
280
|
return regDate >= startDate && regDate <= endDate;
|
|
203
281
|
});
|
|
204
282
|
}
|
|
205
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
206
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
283
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetTenantRegistrationTimelineQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
284
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetTenantRegistrationTimelineQuery, providedIn: 'root' }); }
|
|
207
285
|
}
|
|
208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetTenantRegistrationTimelineQuery, decorators: [{
|
|
209
287
|
type: Injectable,
|
|
210
288
|
args: [{
|
|
211
289
|
providedIn: 'root',
|
|
@@ -213,4 +291,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
213
291
|
}] });
|
|
214
292
|
|
|
215
293
|
export { GetTenantRegistrationTimelineQuery };
|
|
216
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-registration-timeline.query-
|
|
294
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-registration-timeline.query-COmTsDCV.mjs.map
|
package/fesm2022/acorex-connectivity-mock-get-tenant-registration-timeline.query-COmTsDCV.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-tenant-registration-timeline.query-COmTsDCV.mjs","sources":["../../../../libs/connectivity/mock/src/lib/tenant-management/reports/get-tenant-registration-timeline.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMTenantManagementTenantEntityModel } from '@acorex/modules/tenant-management';\nimport { AXMTenantManagementTenantUserEntityModel } from '@acorex/modules/tenant-management';\nimport { AXMSubscriptionManagementSubscriptionEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMSubscriptionManagementSubscriptionPlanItemEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMApplicationManagementApplicationEntityModel } from '@acorex/modules/application-management';\nimport { RootConfig as TenantRootConfig } from '@acorex/modules/tenant-management';\nimport { RootConfig as SubscriptionRootConfig } from '@acorex/modules/subscription-management';\nimport { RootConfig as ApplicationRootConfig } from '@acorex/modules/application-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetTenantRegistrationTimelineQueryInput {\n skip?: number;\n take?: number;\n sort?: import('@acorex/platform/common').AXPQuerySort[];\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface TenantRegistrationTimelineResult {\n tenantId: string;\n tenantName: string;\n registrationDate: Date;\n registrationDateStr: string;\n status: string;\n country?: string;\n userCount: number;\n applicationCount: number;\n subscriptionCount: number;\n month: string;\n monthNumber: number;\n quarter: string;\n year: number;\n}\n\nexport interface GetTenantRegistrationTimelineQueryResult {\n items: TenantRegistrationTimelineResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetTenantRegistrationTimelineQuery\n implements AXPQuery<GetTenantRegistrationTimelineQueryInput, GetTenantRegistrationTimelineQueryResult>\n{\n private readonly entityService = inject(AXPEntityService);\n private tenantService = this.entityService\n .withEntity(`${TenantRootConfig.module.name}.${TenantRootConfig.entities.tenant.name}`)\n .data<string, AXMTenantManagementTenantEntityModel>();\n private tenantUserService = this.entityService\n .withEntity(`${TenantRootConfig.module.name}.${TenantRootConfig.entities.tenantUser.name}`)\n .data<string, AXMTenantManagementTenantUserEntityModel>();\n private subscriptionService = this.entityService\n .withEntity(`${SubscriptionRootConfig.module.name}.${SubscriptionRootConfig.entities.subscription.name}`)\n .data<string, AXMSubscriptionManagementSubscriptionEntityModel>();\n private planItemService = this.entityService\n .withEntity(`${SubscriptionRootConfig.module.name}.${SubscriptionRootConfig.entities.subscriptionPlanItem.name}`)\n .data<string, AXMSubscriptionManagementSubscriptionPlanItemEntityModel>();\n private applicationService = this.entityService\n .withEntity(`${ApplicationRootConfig.module.name}.${ApplicationRootConfig.entities.application.name}`)\n .data<string, AXMApplicationManagementApplicationEntityModel>();\n\n async fetch(input: GetTenantRegistrationTimelineQueryInput | any): Promise<GetTenantRegistrationTimelineQueryResult> {\n // Extract filters from AXPFilterClause format\n const extractedFilters = this.extractTenantFilters(input.filters);\n const filterLogic = (input.filters as any)?.logic || input.logic || 'and';\n\n // Separate custom filters from entity filters\n const entityFilters: GetTenantRegistrationTimelineQueryInput['filters'] = [];\n let dateRangeFilter: any;\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n if (filter.field === 'dateRange') {\n dateRangeFilter = filter.value;\n } else {\n entityFilters.push(filter);\n }\n }\n }\n\n // Get all tenants\n const tenantsResult = await this.tenantService.query({\n skip: 0,\n take: 10000,\n filter:\n entityFilters.length > 0\n ? ({\n logic: filterLogic,\n filters: entityFilters,\n } as any)\n : undefined,\n });\n\n let tenants = tenantsResult.items.filter((t) => t.registrationDate);\n\n // Apply date range filter if provided\n if (dateRangeFilter) {\n tenants = this.applyDateRangeFilter(tenants, dateRangeFilter);\n }\n\n // Get all tenant users for counting\n const tenantUsersResult = await this.tenantUserService.query({\n skip: 0,\n take: 10000,\n });\n const tenantUsers = tenantUsersResult.items;\n\n // Get all subscriptions for counting\n const subscriptionsResult = await this.subscriptionService.query({\n skip: 0,\n take: 10000,\n });\n const subscriptions = subscriptionsResult.items.filter((s) => s.subscriberType === 'Tenant');\n\n // Get all plan items and applications for application counting\n const planItemsResult = await this.planItemService.query({\n skip: 0,\n take: 10000,\n });\n const planItems = planItemsResult.items;\n\n const applicationsResult = await this.applicationService.query({\n skip: 0,\n take: 10000,\n });\n const applications = applicationsResult.items;\n\n // Get application counts for tenants\n const applicationCounts = await this.getApplicationCountsForTenants(\n tenants.map((t) => t.id),\n subscriptions,\n planItems,\n applications\n );\n\n // Build results\n const results: TenantRegistrationTimelineResult[] = [];\n\n for (const tenant of tenants) {\n if (!tenant.registrationDate) continue;\n\n const registrationDate = new Date(tenant.registrationDate);\n\n // Extract time period info\n const year = registrationDate.getFullYear();\n const month = registrationDate.getMonth() + 1;\n const monthName = registrationDate.toLocaleString('en-US', { month: 'long' });\n const quarter = Math.ceil(month / 3);\n const quarterName = `Q${quarter}`;\n\n // Count users for this tenant\n const userCount = tenantUsers.filter((tu) => tu.tenantId === tenant.id).length;\n\n // Count subscriptions for this tenant\n const subscriptionCount = subscriptions.filter((s) => s.subscriberId === tenant.id).length;\n\n // Get application count\n const applicationCount = applicationCounts.get(tenant.id) || 0;\n\n results.push({\n tenantId: tenant.id,\n tenantName: tenant.title,\n registrationDate: registrationDate,\n registrationDateStr: registrationDate.toISOString(),\n status: tenant.statusId || 'Unknown',\n country: tenant.country?.title,\n userCount: userCount,\n applicationCount: applicationCount,\n subscriptionCount: subscriptionCount,\n month: monthName,\n monthNumber: month,\n quarter: quarterName,\n year: year,\n });\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n results.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.name as keyof TenantRegistrationTimelineResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n if (aValue === undefined && bValue === undefined) continue;\n if (aValue === undefined) return 1 * dir;\n if (bValue === undefined) return -1 * dir;\n\n // Handle date comparison\n if (field === 'registrationDate') {\n const aDate = a.registrationDate.getTime();\n const bDate = b.registrationDate.getTime();\n if (aDate < bDate) return -1 * dir;\n if (aDate > bDate) return 1 * dir;\n continue;\n }\n\n if (aValue < bValue) return -1 * dir;\n if (aValue > bValue) return 1 * dir;\n }\n return 0;\n });\n } else {\n // Default sort by registration date descending (newest first)\n results.sort((a, b) => {\n return b.registrationDate.getTime() - a.registrationDate.getTime();\n });\n }\n\n // Apply pagination\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = results.length;\n const items = results.slice(skip, skip + take);\n\n return {\n items,\n total,\n };\n }\n\n //#region ---- Helper Methods ----\n\n /**\n * Get application counts for tenants\n */\n private async getApplicationCountsForTenants(\n tenantIds: string[],\n subscriptions: AXMSubscriptionManagementSubscriptionEntityModel[],\n planItems: AXMSubscriptionManagementSubscriptionPlanItemEntityModel[],\n applications: AXMApplicationManagementApplicationEntityModel[]\n ): Promise<Map<string, number>> {\n const counts = new Map<string, number>();\n\n for (const tenantId of tenantIds) {\n const tenantSubscriptions = subscriptions.filter((s) => s.subscriberId === tenantId);\n\n // Get unique applications through subscriptions → plans → plan items → editions → applications\n const applicationSet = new Set<string>();\n\n for (const subscription of tenantSubscriptions) {\n if (!subscription.planId) continue;\n\n // Get plan items for this plan\n const planPlanItems = planItems.filter((pi) => pi.planId === subscription.planId);\n\n for (const planItem of planPlanItems) {\n if (!planItem.editionId) continue;\n\n // Find applications that have this edition\n for (const application of applications) {\n if (application.editionIds && application.editionIds.includes(planItem.editionId)) {\n applicationSet.add(application.id);\n }\n }\n }\n }\n\n counts.set(tenantId, applicationSet.size);\n }\n\n return counts;\n }\n\n //#endregion\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract tenant-specific filters from AXPFilterClause format\n * Maps report parameter paths to tenant entity field names\n */\n private extractTenantFilters(parameters: any): GetTenantRegistrationTimelineQueryInput['filters'] {\n const filters: GetTenantRegistrationTimelineQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n return filters;\n }\n\n for (const filter of paramsAny.filters) {\n if (!filter?.field || filter?.value === undefined || filter?.value === null) {\n continue;\n }\n\n const field = filter.field;\n const value = filter.value;\n const operator = filter.operator || { type: 'equal' };\n\n // Handle tenant-specific field mappings\n if (field === 'tenantId') {\n // Tenant ID filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'id',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'id',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'statusId') {\n // Status filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'statusId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'dateRange') {\n // Date range filter - custom logic handled in query\n filters.push({\n field: 'dateRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else {\n // Direct field mapping\n filters.push({\n field: field,\n operator: operator,\n value: value,\n });\n }\n }\n\n return filters;\n }\n\n //#endregion\n\n //#region ---- Custom Filter Handlers ----\n\n /**\n * Apply date range filter to tenants\n */\n private applyDateRangeFilter(\n tenants: AXMTenantManagementTenantEntityModel[],\n dateRange: any\n ): AXMTenantManagementTenantEntityModel[] {\n if (!dateRange || !dateRange.start || !dateRange.end) {\n return tenants;\n }\n\n const startDate = new Date(dateRange.start);\n const endDate = new Date(dateRange.end);\n endDate.setHours(23, 59, 59, 999);\n\n return tenants.filter((tenant) => {\n if (!tenant.registrationDate) return false;\n const regDate = new Date(tenant.registrationDate);\n return regDate >= startDate && regDate <= endDate;\n });\n }\n\n //#endregion\n}\n\n"],"names":["TenantRootConfig","SubscriptionRootConfig","ApplicationRootConfig"],"mappings":";;;;;;;AA+CA;MAKa,kCAAkC,CAAA;AAH/C,IAAA,WAAA,GAAA;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,aAAa,GAAG,IAAI,CAAC;AAC1B,aAAA,UAAU,CAAC,CAAA,EAAGA,UAAgB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA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AAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kCAAkC,cAFjC,MAAM,EAAA,CAAA,CAAA;;2FAEP,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAH9C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -16,25 +16,37 @@ class GetTenantUserDistributionQuery {
|
|
|
16
16
|
.data();
|
|
17
17
|
}
|
|
18
18
|
async fetch(input) {
|
|
19
|
+
// Extract filters from AXPFilterClause format
|
|
20
|
+
const extractedFilters = this.extractTenantFilters(input.filters);
|
|
21
|
+
const filterLogic = input.filters?.logic || input.logic || 'and';
|
|
22
|
+
// Separate custom filters from entity filters
|
|
23
|
+
const entityFilters = [];
|
|
24
|
+
let dateRangeFilter;
|
|
25
|
+
if (extractedFilters && extractedFilters.length > 0) {
|
|
26
|
+
for (const filter of extractedFilters) {
|
|
27
|
+
if (filter.field === 'dateRange') {
|
|
28
|
+
dateRangeFilter = filter.value;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
entityFilters.push(filter);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
19
35
|
// Get all tenants
|
|
20
36
|
const tenantsResult = await this.tenantService.query({
|
|
21
37
|
skip: 0,
|
|
22
38
|
take: 10000,
|
|
23
|
-
filter:
|
|
39
|
+
filter: entityFilters.length > 0
|
|
24
40
|
? {
|
|
25
|
-
logic:
|
|
26
|
-
filters:
|
|
41
|
+
logic: filterLogic,
|
|
42
|
+
filters: entityFilters,
|
|
27
43
|
}
|
|
28
44
|
: undefined,
|
|
29
45
|
});
|
|
30
46
|
let tenants = tenantsResult.items;
|
|
31
47
|
// Apply date range filter if provided
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
if (filter.field === 'dateRange' && filter.value) {
|
|
35
|
-
tenants = this.applyDateRangeFilter(tenants, filter.value);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
48
|
+
if (dateRangeFilter) {
|
|
49
|
+
tenants = this.applyDateRangeFilter(tenants, dateRangeFilter);
|
|
38
50
|
}
|
|
39
51
|
// Get all tenant users
|
|
40
52
|
const tenantUsersResult = await this.tenantUserService.query({
|
|
@@ -70,7 +82,7 @@ class GetTenantUserDistributionQuery {
|
|
|
70
82
|
if (input.sort && input.sort.length > 0) {
|
|
71
83
|
results.sort((a, b) => {
|
|
72
84
|
for (const sortField of input.sort) {
|
|
73
|
-
const field = sortField.
|
|
85
|
+
const field = sortField.name;
|
|
74
86
|
const aValue = a[field];
|
|
75
87
|
const bValue = b[field];
|
|
76
88
|
const dir = sortField.dir === 'asc' ? 1 : -1;
|
|
@@ -102,6 +114,72 @@ class GetTenantUserDistributionQuery {
|
|
|
102
114
|
total,
|
|
103
115
|
};
|
|
104
116
|
}
|
|
117
|
+
//#region ---- Filter Extraction ----
|
|
118
|
+
/**
|
|
119
|
+
* Extract tenant-specific filters from AXPFilterClause format
|
|
120
|
+
* Maps report parameter paths to tenant entity field names
|
|
121
|
+
*/
|
|
122
|
+
extractTenantFilters(parameters) {
|
|
123
|
+
const filters = [];
|
|
124
|
+
const paramsAny = parameters;
|
|
125
|
+
if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {
|
|
126
|
+
return filters;
|
|
127
|
+
}
|
|
128
|
+
for (const filter of paramsAny.filters) {
|
|
129
|
+
if (!filter?.field || filter?.value === undefined || filter?.value === null) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const field = filter.field;
|
|
133
|
+
const value = filter.value;
|
|
134
|
+
const operator = filter.operator || { type: 'equal' };
|
|
135
|
+
// Handle tenant-specific field mappings
|
|
136
|
+
if (field === 'tenantId') {
|
|
137
|
+
// Tenant ID filter - can be array of IDs or single ID
|
|
138
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
139
|
+
filters.push({
|
|
140
|
+
field: 'id',
|
|
141
|
+
operator: { type: 'in' },
|
|
142
|
+
value: value,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
else if (value) {
|
|
146
|
+
filters.push({
|
|
147
|
+
field: 'id',
|
|
148
|
+
operator: { type: 'equal' },
|
|
149
|
+
value: value,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else if (field === 'statusId') {
|
|
154
|
+
// Status filter - skip 'all' value
|
|
155
|
+
if (value && value !== 'all') {
|
|
156
|
+
filters.push({
|
|
157
|
+
field: 'statusId',
|
|
158
|
+
operator: { type: 'equal' },
|
|
159
|
+
value: value,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else if (field === 'dateRange') {
|
|
164
|
+
// Date range filter - custom logic handled in query
|
|
165
|
+
filters.push({
|
|
166
|
+
field: 'dateRange',
|
|
167
|
+
operator: { type: 'equal' },
|
|
168
|
+
value: value,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
// Direct field mapping
|
|
173
|
+
filters.push({
|
|
174
|
+
field: field,
|
|
175
|
+
operator: operator,
|
|
176
|
+
value: value,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return filters;
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
105
183
|
//#region ---- Custom Filter Handlers ----
|
|
106
184
|
/**
|
|
107
185
|
* Apply date range filter to tenants
|
|
@@ -120,10 +198,10 @@ class GetTenantUserDistributionQuery {
|
|
|
120
198
|
return regDate >= startDate && regDate <= endDate;
|
|
121
199
|
});
|
|
122
200
|
}
|
|
123
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
124
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
201
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetTenantUserDistributionQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
202
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetTenantUserDistributionQuery, providedIn: 'root' }); }
|
|
125
203
|
}
|
|
126
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetTenantUserDistributionQuery, decorators: [{
|
|
127
205
|
type: Injectable,
|
|
128
206
|
args: [{
|
|
129
207
|
providedIn: 'root',
|
|
@@ -131,4 +209,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
131
209
|
}] });
|
|
132
210
|
|
|
133
211
|
export { GetTenantUserDistributionQuery };
|
|
134
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-user-distribution.query-
|
|
212
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-user-distribution.query-jQAsUf_h.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-tenant-user-distribution.query-jQAsUf_h.mjs","sources":["../../../../libs/connectivity/mock/src/lib/tenant-management/reports/get-tenant-user-distribution.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMTenantManagementTenantEntityModel } from '@acorex/modules/tenant-management';\nimport { AXMTenantManagementTenantUserEntityModel } from '@acorex/modules/tenant-management';\nimport { AXPSystemStatusType } from '@acorex/platform/common';\nimport { RootConfig as TenantRootConfig } from '@acorex/modules/tenant-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetTenantUserDistributionQueryInput {\n skip?: number;\n take?: number;\n sort?: import('@acorex/platform/common').AXPQuerySort[];\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface TenantUserDistributionResult {\n tenantId: string;\n tenantName: string;\n tenantStatus: string;\n totalUsersCount: number;\n activeUsersCount: number;\n inactiveUsersCount: number;\n maxUsers?: number;\n utilizationPercent: number;\n registrationDate?: Date;\n registrationDateStr?: string;\n}\n\nexport interface GetTenantUserDistributionQueryResult {\n items: TenantUserDistributionResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetTenantUserDistributionQuery\n implements AXPQuery<GetTenantUserDistributionQueryInput, GetTenantUserDistributionQueryResult>\n{\n private readonly entityService = inject(AXPEntityService);\n private tenantService = this.entityService\n .withEntity(`${TenantRootConfig.module.name}.${TenantRootConfig.entities.tenant.name}`)\n .data<string, AXMTenantManagementTenantEntityModel>();\n private tenantUserService = this.entityService\n .withEntity(`${TenantRootConfig.module.name}.${TenantRootConfig.entities.tenantUser.name}`)\n .data<string, AXMTenantManagementTenantUserEntityModel>();\n\n async fetch(input: GetTenantUserDistributionQueryInput | any): Promise<GetTenantUserDistributionQueryResult> {\n // Extract filters from AXPFilterClause format\n const extractedFilters = this.extractTenantFilters(input.filters);\n const filterLogic = (input.filters as any)?.logic || input.logic || 'and';\n\n // Separate custom filters from entity filters\n const entityFilters: GetTenantUserDistributionQueryInput['filters'] = [];\n let dateRangeFilter: any;\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n if (filter.field === 'dateRange') {\n dateRangeFilter = filter.value;\n } else {\n entityFilters.push(filter);\n }\n }\n }\n\n // Get all tenants\n const tenantsResult = await this.tenantService.query({\n skip: 0,\n take: 10000,\n filter:\n entityFilters.length > 0\n ? ({\n logic: filterLogic,\n filters: entityFilters,\n } as any)\n : undefined,\n });\n\n let tenants = tenantsResult.items;\n\n // Apply date range filter if provided\n if (dateRangeFilter) {\n tenants = this.applyDateRangeFilter(tenants, dateRangeFilter);\n }\n\n // Get all tenant users\n const tenantUsersResult = await this.tenantUserService.query({\n skip: 0,\n take: 10000,\n });\n const tenantUsers = tenantUsersResult.items;\n\n // Build results for each tenant\n const results: TenantUserDistributionResult[] = [];\n\n for (const tenant of tenants) {\n // Get tenant's users\n const tenantUsersList = tenantUsers.filter((tu) => tu.tenantId === tenant.id);\n\n // Count active and inactive users\n const activeUsers = tenantUsersList.filter(\n (tu) => tu.statusId === AXPSystemStatusType.Active\n );\n const inactiveUsers = tenantUsersList.filter(\n (tu) => tu.statusId !== AXPSystemStatusType.Active\n );\n\n // Calculate utilization percentage\n const maxUsers = tenant.maxUsers;\n const utilizationPercent =\n maxUsers && maxUsers > 0 ? Math.round((tenantUsersList.length / maxUsers) * 100) : 0;\n\n results.push({\n tenantId: tenant.id,\n tenantName: tenant.title,\n tenantStatus: tenant.statusId || 'Unknown',\n totalUsersCount: tenantUsersList.length,\n activeUsersCount: activeUsers.length,\n inactiveUsersCount: inactiveUsers.length,\n maxUsers: maxUsers,\n utilizationPercent: utilizationPercent,\n registrationDate: tenant.registrationDate,\n registrationDateStr: tenant.registrationDate?.toISOString(),\n });\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n results.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.name as keyof TenantUserDistributionResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n if (aValue === undefined && bValue === undefined) continue;\n if (aValue === undefined) return 1 * dir;\n if (bValue === undefined) return -1 * dir;\n\n if (aValue < bValue) return -1 * dir;\n if (aValue > bValue) return 1 * dir;\n }\n return 0;\n });\n } else {\n // Default sort by tenant name\n results.sort((a, b) => a.tenantName.localeCompare(b.tenantName));\n }\n\n // Apply pagination\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = results.length;\n const items = results.slice(skip, skip + take);\n\n return {\n items,\n total,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract tenant-specific filters from AXPFilterClause format\n * Maps report parameter paths to tenant entity field names\n */\n private extractTenantFilters(parameters: any): GetTenantUserDistributionQueryInput['filters'] {\n const filters: GetTenantUserDistributionQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n return filters;\n }\n\n for (const filter of paramsAny.filters) {\n if (!filter?.field || filter?.value === undefined || filter?.value === null) {\n continue;\n }\n\n const field = filter.field;\n const value = filter.value;\n const operator = filter.operator || { type: 'equal' };\n\n // Handle tenant-specific field mappings\n if (field === 'tenantId') {\n // Tenant ID filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'id',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'id',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'statusId') {\n // Status filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'statusId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'dateRange') {\n // Date range filter - custom logic handled in query\n filters.push({\n field: 'dateRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else {\n // Direct field mapping\n filters.push({\n field: field,\n operator: operator,\n value: value,\n });\n }\n }\n\n return filters;\n }\n\n //#endregion\n\n //#region ---- Custom Filter Handlers ----\n\n /**\n * Apply date range filter to tenants\n */\n private applyDateRangeFilter(\n tenants: AXMTenantManagementTenantEntityModel[],\n dateRange: any\n ): AXMTenantManagementTenantEntityModel[] {\n if (!dateRange || !dateRange.start || !dateRange.end) {\n return tenants;\n }\n\n const startDate = new Date(dateRange.start);\n const endDate = new Date(dateRange.end);\n endDate.setHours(23, 59, 59, 999);\n\n return tenants.filter((tenant) => {\n if (!tenant.registrationDate) return false;\n const regDate = new Date(tenant.registrationDate);\n return regDate >= startDate && regDate <=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
|
5
|
+
/**
|
|
6
|
+
* If Activity (Backend - Mock)
|
|
7
|
+
*
|
|
8
|
+
* Evaluates a condition and continues via Then or Else outcome.
|
|
9
|
+
* Activity type: workflow-activity:if
|
|
10
|
+
* Outcomes: Then | Else
|
|
11
|
+
*/
|
|
12
|
+
class IfActivity {
|
|
13
|
+
async execute(input) {
|
|
14
|
+
const condition = input?.condition ?? false;
|
|
15
|
+
const outcome = condition ? 'Then' : 'Else';
|
|
16
|
+
return {
|
|
17
|
+
success: true,
|
|
18
|
+
data: { condition: !!condition },
|
|
19
|
+
metadata: {
|
|
20
|
+
outcome,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: IfActivity, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
25
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: IfActivity, providedIn: 'root' }); }
|
|
26
|
+
}
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: IfActivity, decorators: [{
|
|
28
|
+
type: Injectable,
|
|
29
|
+
args: [{
|
|
30
|
+
providedIn: 'root',
|
|
31
|
+
}]
|
|
32
|
+
}] });
|
|
33
|
+
|
|
34
|
+
export { IfActivity };
|
|
35
|
+
//# sourceMappingURL=acorex-connectivity-mock-if.activity-DvzuhItL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-if.activity-DvzuhItL.mjs","sources":["../../../../libs/connectivity/mock/src/lib/workflow-management/activities/if.activity.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\n\n//#region ---- Types ----\n\nexport interface IfActivityInput {\n condition?: boolean;\n}\n\nexport interface IfActivityOutput {\n condition: boolean;\n}\n\n//#endregion\n\n/**\n * If Activity (Backend - Mock)\n *\n * Evaluates a condition and continues via Then or Else outcome.\n * Activity type: workflow-activity:if\n * Outcomes: Then | Else\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class IfActivity implements AXPCommand<IfActivityInput, IfActivityOutput> {\n async execute(\n input: IfActivityInput,\n ): Promise<AXPExecuteCommandResult<IfActivityOutput>> {\n const condition = input?.condition ?? false;\n const outcome = condition ? 'Then' : 'Else';\n\n return {\n success: true,\n data: { condition: !!condition },\n metadata: {\n outcome,\n },\n };\n }\n}\n"],"names":[],"mappings":";;;AAcA;AAEA;;;;;;AAMG;MAIU,UAAU,CAAA;IACrB,MAAM,OAAO,CACX,KAAsB,EAAA;AAEtB,QAAA,MAAM,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,KAAK;QAC3C,MAAM,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM;QAE3C,OAAO;AACL,YAAA,OAAO,EAAE,IAAI;AACb,YAAA,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE;AAChC,YAAA,QAAQ,EAAE;gBACR,OAAO;AACR,aAAA;SACF;IACH;8GAdW,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAV,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,cAFT,MAAM,EAAA,CAAA,CAAA;;2FAEP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AXPDataGenerator } from '@acorex/platform/core';
|
|
2
|
+
import { AXToastService } from '@acorex/components/toast';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
|
|
6
|
+
//#region ---- Imports ----
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ---- Input parsing ----
|
|
9
|
+
function parseSendInput(raw) {
|
|
10
|
+
const obj = raw != null && typeof raw === 'object' && !Array.isArray(raw) ? raw : null;
|
|
11
|
+
if (!obj) {
|
|
12
|
+
return { ok: false, error: 'Invalid arguments: expected an object.' };
|
|
13
|
+
}
|
|
14
|
+
const to = typeof obj['to'] === 'string' ? obj['to'].trim() : '';
|
|
15
|
+
const subject = typeof obj['subject'] === 'string' ? obj['subject'].trim() : '';
|
|
16
|
+
const body = typeof obj['body'] === 'string' ? obj['body'].trim() : '';
|
|
17
|
+
if (!to) {
|
|
18
|
+
return { ok: false, error: 'Invalid arguments: "to" is required.' };
|
|
19
|
+
}
|
|
20
|
+
if (!subject) {
|
|
21
|
+
return { ok: false, error: 'Invalid arguments: "subject" is required.' };
|
|
22
|
+
}
|
|
23
|
+
if (!body) {
|
|
24
|
+
return { ok: false, error: 'Invalid arguments: "body" is required.' };
|
|
25
|
+
}
|
|
26
|
+
const cc = typeof obj['cc'] === 'string' ? obj['cc'].trim() : '';
|
|
27
|
+
const bcc = typeof obj['bcc'] === 'string' ? obj['bcc'].trim() : '';
|
|
28
|
+
const tid = typeof obj['textTemplateId'] === 'string' ? obj['textTemplateId'].trim() : '';
|
|
29
|
+
return {
|
|
30
|
+
ok: true,
|
|
31
|
+
value: {
|
|
32
|
+
to,
|
|
33
|
+
subject,
|
|
34
|
+
body,
|
|
35
|
+
...(cc ? { cc } : {}),
|
|
36
|
+
...(bcc ? { bcc } : {}),
|
|
37
|
+
...(tid ? { textTemplateId: tid } : {}),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region ---- Mock send command ----
|
|
43
|
+
const MOCK_SEND_LATENCY_MS = 120;
|
|
44
|
+
class NotificationManagementEmailSendMockCommand {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.toastService = inject(AXToastService);
|
|
47
|
+
}
|
|
48
|
+
async execute(input) {
|
|
49
|
+
await new Promise((resolve) => setTimeout(resolve, MOCK_SEND_LATENCY_MS));
|
|
50
|
+
const parsed = parseSendInput(input);
|
|
51
|
+
if (!parsed.ok) {
|
|
52
|
+
return { success: false, message: { text: parsed.error } };
|
|
53
|
+
}
|
|
54
|
+
// Mock transport: surface as UI toast only; replace with HTTP when backend exists.
|
|
55
|
+
this.toastService.show({
|
|
56
|
+
color: 'warning',
|
|
57
|
+
title: 'Email send (simulation)',
|
|
58
|
+
content: `No email was delivered — mock only.\n To: ${parsed.value.to}.\n Subject: ${parsed.value.subject}.`,
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
success: true,
|
|
62
|
+
data: { messageId: AXPDataGenerator.uuid() },
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NotificationManagementEmailSendMockCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
66
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NotificationManagementEmailSendMockCommand }); }
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NotificationManagementEmailSendMockCommand, decorators: [{
|
|
69
|
+
type: Injectable
|
|
70
|
+
}] });
|
|
71
|
+
|
|
72
|
+
export { NotificationManagementEmailSendMockCommand };
|
|
73
|
+
//# sourceMappingURL=acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs","sources":["../../../../libs/connectivity/mock/src/lib/notification-management/commands/notification-management-email-send.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPDataGenerator } from '@acorex/platform/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport type {\n NotificationManagementEmailSendInput,\n NotificationManagementEmailSendResult,\n} from '@acorex/modules/notification-management';\nimport { AXToastService } from '@acorex/components/toast';\nimport { inject, Injectable } from '@angular/core';\n\n//#endregion\n\n//#region ---- Input parsing ----\n\nfunction parseSendInput(\n raw: unknown,\n): { ok: true; value: NotificationManagementEmailSendInput } | { ok: false; error: string } {\n const obj =\n raw != null && typeof raw === 'object' && !Array.isArray(raw) ? (raw as Record<string, unknown>) : null;\n if (!obj) {\n return { ok: false, error: 'Invalid arguments: expected an object.' };\n }\n const to = typeof obj['to'] === 'string' ? obj['to'].trim() : '';\n const subject = typeof obj['subject'] === 'string' ? obj['subject'].trim() : '';\n const body = typeof obj['body'] === 'string' ? obj['body'].trim() : '';\n if (!to) {\n return { ok: false, error: 'Invalid arguments: \"to\" is required.' };\n }\n if (!subject) {\n return { ok: false, error: 'Invalid arguments: \"subject\" is required.' };\n }\n if (!body) {\n return { ok: false, error: 'Invalid arguments: \"body\" is required.' };\n }\n const cc = typeof obj['cc'] === 'string' ? obj['cc'].trim() : '';\n const bcc = typeof obj['bcc'] === 'string' ? obj['bcc'].trim() : '';\n const tid = typeof obj['textTemplateId'] === 'string' ? obj['textTemplateId'].trim() : '';\n return {\n ok: true,\n value: {\n to,\n subject,\n body,\n ...(cc ? { cc } : {}),\n ...(bcc ? { bcc } : {}),\n ...(tid ? { textTemplateId: tid } : {}),\n },\n };\n}\n\n//#endregion\n\n//#region ---- Mock send command ----\n\nconst MOCK_SEND_LATENCY_MS = 120;\n\n@Injectable()\nexport class NotificationManagementEmailSendMockCommand\n implements AXPCommand<NotificationManagementEmailSendInput, NotificationManagementEmailSendResult> {\n private readonly toastService = inject(AXToastService);\n\n async execute(\n input: NotificationManagementEmailSendInput,\n ): Promise<AXPExecuteCommandResult<NotificationManagementEmailSendResult>> {\n await new Promise<void>((resolve) => setTimeout(resolve, MOCK_SEND_LATENCY_MS));\n const parsed = parseSendInput(input);\n if (!parsed.ok) {\n return { success: false, message: { text: parsed.error } };\n }\n // Mock transport: surface as UI toast only; replace with HTTP when backend exists.\n this.toastService.show({\n color: 'warning',\n title: 'Email send (simulation)',\n content: `No email was delivered — mock only.\\n To: ${parsed.value.to}.\\n Subject: ${parsed.value.subject}.`,\n });\n return {\n success: true,\n data: { messageId: AXPDataGenerator.uuid() },\n };\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;AAAA;AAYA;AAEA;AAEA,SAAS,cAAc,CACrB,GAAY,EAAA;IAEZ,MAAM,GAAG,GACP,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAI,GAA+B,GAAG,IAAI;IACzG,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,wCAAwC,EAAE;IACvE;IACA,MAAM,EAAE,GAAG,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE;IAChE,MAAM,OAAO,GAAG,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE;IAC/E,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE;IAC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,QAAA,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;AAC/E,QAAA,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC;AACpC,QAAA,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;AACd,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE;QAC5D;;AAEA,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;AACrB,YAAA,KAAK,EAAE,SAAS;AAChB,YAAA,KAAK,EAAE,yBAAyB;AAChC,YAAA,OAAO,EAAE,CAAA,0CAAA,EAA6C,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA,aAAA,EAAgB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAA,CAAA,CAAG;AAC7G,SAAA,CAAC;QACF,OAAO;AACL,YAAA,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,CAAC,IAAI,EAAE,EAAE;SAC7C;IACH;8GAtBW,0CAA0C,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA1C,0CAA0C,EAAA,CAAA,CAAA;;2FAA1C,0CAA0C,EAAA,UAAA,EAAA,CAAA;kBADtD;;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region ---- Summary Computation ----
|
|
2
|
+
/**
|
|
3
|
+
* Computes server-side report footer totals over the full filtered dataset (before pagination).
|
|
4
|
+
*/
|
|
5
|
+
function computeReportFooterSummary(rows, summaryConfig) {
|
|
6
|
+
const specs = summaryConfig?.filter((s) => s.displayIn === 'reportFooter') ?? [];
|
|
7
|
+
if (specs.length === 0) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
const result = {};
|
|
11
|
+
for (const spec of specs) {
|
|
12
|
+
result[spec.field] = computeSummaryOperation(rows, spec.field, spec.operation);
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
function computeSummaryOperation(rows, field, operation) {
|
|
17
|
+
if (operation === 'count') {
|
|
18
|
+
const count = rows.filter((row) => row[field] != null && row[field] !== '').length;
|
|
19
|
+
return count;
|
|
20
|
+
}
|
|
21
|
+
const numbers = rows
|
|
22
|
+
.map((row) => toNumber(row[field]))
|
|
23
|
+
.filter((n) => n !== null);
|
|
24
|
+
if (numbers.length === 0) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
switch (operation) {
|
|
28
|
+
case 'sum':
|
|
29
|
+
return roundDecimal(numbers.reduce((acc, n) => acc + n, 0));
|
|
30
|
+
case 'avg':
|
|
31
|
+
return roundDecimal(numbers.reduce((acc, n) => acc + n, 0) / numbers.length);
|
|
32
|
+
case 'min':
|
|
33
|
+
return roundDecimal(Math.min(...numbers));
|
|
34
|
+
case 'max':
|
|
35
|
+
return roundDecimal(Math.max(...numbers));
|
|
36
|
+
default:
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function roundDecimal(value, decimals = 2) {
|
|
41
|
+
return Number(value.toFixed(decimals));
|
|
42
|
+
}
|
|
43
|
+
function toNumber(value) {
|
|
44
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
48
|
+
const parsed = Number(value);
|
|
49
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
|
|
55
|
+
export { computeReportFooterSummary as c };
|
|
56
|
+
//# sourceMappingURL=acorex-connectivity-mock-report-summary.util-CGOhHIZr.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-report-summary.util-CGOhHIZr.mjs","sources":["../../../../libs/connectivity/mock/src/lib/report-management/report-summary.util.ts"],"sourcesContent":["import { AXPReportSummaryOptions } from '@acorex/modules/report-management';\n\n//#region ---- Summary Computation ----\n\n/**\n * Computes server-side report footer totals over the full filtered dataset (before pagination).\n */\nexport function computeReportFooterSummary(\n rows: Record<string, unknown>[],\n summaryConfig: AXPReportSummaryOptions[] | undefined,\n): Record<string, number | null> | undefined {\n const specs = summaryConfig?.filter((s) => s.displayIn === 'reportFooter') ?? [];\n if (specs.length === 0) {\n return undefined;\n }\n\n const result: Record<string, number | null> = {};\n\n for (const spec of specs) {\n result[spec.field] = computeSummaryOperation(rows, spec.field, spec.operation);\n }\n\n return result;\n}\n\nfunction computeSummaryOperation(\n rows: Record<string, unknown>[],\n field: string,\n operation: AXPReportSummaryOptions['operation'],\n): number | null {\n if (operation === 'count') {\n const count = rows.filter((row) => row[field] != null && row[field] !== '').length;\n return count;\n }\n\n const numbers = rows\n .map((row) => toNumber(row[field]))\n .filter((n): n is number => n !== null);\n\n if (numbers.length === 0) {\n return null;\n }\n\n switch (operation) {\n case 'sum':\n return roundDecimal(numbers.reduce((acc, n) => acc + n, 0));\n case 'avg':\n return roundDecimal(numbers.reduce((acc, n) => acc + n, 0) / numbers.length);\n case 'min':\n return roundDecimal(Math.min(...numbers));\n case 'max':\n return roundDecimal(Math.max(...numbers));\n default:\n return null;\n }\n}\n\nfunction roundDecimal(value: number, decimals = 2): number {\n return Number(value.toFixed(decimals));\n}\n\nfunction toNumber(value: unknown): number | null {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return value;\n }\n if (typeof value === 'string' && value.trim().length > 0) {\n const parsed = Number(value);\n return Number.isFinite(parsed) ? parsed : null;\n }\n return null;\n}\n\n//#endregion\n"],"names":[],"mappings":"AAEA;AAEA;;AAEG;AACG,SAAU,0BAA0B,CACxC,IAA+B,EAC/B,aAAoD,EAAA;AAEpD,IAAA,MAAM,KAAK,GA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C,KAAK,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;AAC9E,QAAA,KAAK,KAAK;YACR,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;AAC3C,QAAA,KAAK,KAAK;YACR,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;AAC3C,QAAA;AACE,YAAA,OAAO,IAAI;;AAEjB;AAEA,SAAS,YAAY,CAAC,KAAa,EAAE,QAAQ,GAAG,CAAC,EAAA;IAC/C,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACxC;AAEA,SAAS,QAAQ,CAAC,KAAc,EAAA;AAC9B,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACvD,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;AACxD,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;AAC5B,QAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI;IAChD;AACA,IAAA,OAAO,IAAI;AACb;AAEA;;;;"}
|
|
@@ -9,10 +9,10 @@ class AXMReportSampleActionExecuteCommand {
|
|
|
9
9
|
success: true,
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
13
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMReportSampleActionExecuteCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMReportSampleActionExecuteCommand, providedIn: 'root' }); }
|
|
14
14
|
}
|
|
15
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMReportSampleActionExecuteCommand, decorators: [{
|
|
16
16
|
type: Injectable,
|
|
17
17
|
args: [{
|
|
18
18
|
providedIn: 'root',
|
|
@@ -20,4 +20,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
20
20
|
}] });
|
|
21
21
|
|
|
22
22
|
export { AXMReportSampleActionExecuteCommand };
|
|
23
|
-
//# sourceMappingURL=acorex-connectivity-mock-sample.command-
|
|
23
|
+
//# sourceMappingURL=acorex-connectivity-mock-sample.command-CJmDL4pL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-sample.command-CJmDL4pL.mjs","sources":["../../../../libs/connectivity/mock/src/lib/report-management/sample.command.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\n\n\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXMReportSampleActionExecuteCommand implements AXPCommand<any, void> {\n\n\n //#region ---- Command Implementation ----\n\n async execute(context: any): Promise<AXPExecuteCommandResult<void>> {\n console.log('ReportManagement.Report:SampleAction', context);\n return {\n success: true,\n };\n }\n\n //#endregion\n} "],"names":[],"mappings":";;;MASa,mCAAmC,CAAA;;IAK9C,MAAM,OAAO,CAAC,OAAY,EAAA;AACxB,QAAA,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,OAAO,CAAC;QAC5D,OAAO;AACL,YAAA,OAAO,EAAE,IAAI;SACd;IACH;8GAVW,mCAAmC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mCAAmC,cAFlC,MAAM,EAAA,CAAA,CAAA;;2FAEP,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAH/C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|