@acorex/connectivity 21.0.0-next.83 → 21.0.0-next.88
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.mjs +72 -5
- package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
- package/fesm2022/{acorex-connectivity-mock-acorex-connectivity-mock-Btm13GJK.mjs → acorex-connectivity-mock-acorex-connectivity-mock-B4RpuTuH.mjs} +7073 -3015
- package/fesm2022/{acorex-connectivity-mock-acorex-connectivity-mock-Btm13GJK.mjs.map → acorex-connectivity-mock-acorex-connectivity-mock-B4RpuTuH.mjs.map} +1 -1
- package/fesm2022/{acorex-connectivity-mock-assign-to-manager.activity-CY_5d0KF.mjs → acorex-connectivity-mock-assign-to-manager.activity-DM_691iw.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-assign-to-manager.activity-DM_691iw.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-category-metadata-inheritance.query-CIof4zTg.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-DAKUJIIt.mjs.map +1 -1
- package/fesm2022/{acorex-connectivity-mock-chat-generate-image.command-Hj-2bHyJ.mjs → acorex-connectivity-mock-chat-generate-image.command-D6oMaUmf.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-chat-generate-image.command-D6oMaUmf.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-chat-synthesize-speech.command-0ZnevjmT.mjs → acorex-connectivity-mock-chat-synthesize-speech.command-CiKasu2J.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-CiKasu2J.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-chat-transcribe-speech.command-D8sCgp69.mjs → acorex-connectivity-mock-chat-transcribe-speech.command-vx9t5m5w.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-chat-transcribe-speech.command-vx9t5m5w.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-check-permission.activity-vr3OHtjC.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-distribution-record.activity-a1_k9Czb.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-entity-create.activity-CdoUzUvF.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-entity-delete.activity-ErEN1c24.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-entity-read.activity-1fJW8gVe.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-entity-update.activity-06HTKiQQ.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-extract-document-text.command-nGfUTSf6.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-get-current-session-user.activity-CsmxwXsM.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs.map +1 -1
- package/fesm2022/{acorex-connectivity-mock-get-product-list.query-Bv1im5yj.mjs → acorex-connectivity-mock-get-product-list.query-o9TcY_RC.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-get-product-list.query-o9TcY_RC.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-product-pdf-data.query-Cp65_mpB.mjs → acorex-connectivity-mock-get-product-pdf-data.query-DUZvwsmY.mjs} +2 -2
- package/fesm2022/{acorex-connectivity-mock-get-product-pdf-data.query-Cp65_mpB.mjs.map → acorex-connectivity-mock-get-product-pdf-data.query-DUZvwsmY.mjs.map} +1 -1
- package/fesm2022/{acorex-connectivity-mock-get-subscriptions-chart-data.query-CkQnH-F_.mjs → acorex-connectivity-mock-get-subscriptions-chart-data.query-BXDzY2Sd.mjs} +2 -2
- package/fesm2022/{acorex-connectivity-mock-get-subscriptions-chart-data.query-CkQnH-F_.mjs.map → acorex-connectivity-mock-get-subscriptions-chart-data.query-BXDzY2Sd.mjs.map} +1 -1
- package/fesm2022/{acorex-connectivity-mock-get-subscriptions-timeline.query-C_ecGCyk.mjs → acorex-connectivity-mock-get-subscriptions-timeline.query-D_jVT-7a.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-timeline.query-D_jVT-7a.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-application-access.query-t4BHU8qk.mjs → acorex-connectivity-mock-get-tenant-application-access.query-BG6t0137.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-BG6t0137.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-user-distribution.query-jQAsUf_h.mjs → acorex-connectivity-mock-get-tenant-user-distribution.query-gqSqvIaa.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-get-tenant-user-distribution.query-gqSqvIaa.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-if.activity-DvzuhItL.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-jira-instance-sync.command-BYOuTU3R.mjs +475 -0
- package/fesm2022/acorex-connectivity-mock-jira-instance-sync.command-BYOuTU3R.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs → acorex-connectivity-mock-notification-management-email-send.command-Df6E-9-c.mjs} +2 -2
- package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-Df6E-9-c.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-sample.command-CJmDL4pL.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-structured-text-completion.command-l31pjl9-.mjs.map +1 -1
- package/fesm2022/{acorex-connectivity-mock-user-roles-for-list-column.query-D2QjJXu4.mjs → acorex-connectivity-mock-user-roles-for-list-column.query-B6arRXiE.mjs} +2 -2
- package/fesm2022/{acorex-connectivity-mock-user-roles-for-list-column.query-D2QjJXu4.mjs.map → acorex-connectivity-mock-user-roles-for-list-column.query-B6arRXiE.mjs.map} +1 -1
- package/fesm2022/acorex-connectivity-mock.mjs +1 -1
- package/package.json +2 -2
- package/types/acorex-connectivity-api.d.ts +9 -2
- package/types/acorex-connectivity-mock.d.ts +449 -96
- package/fesm2022/acorex-connectivity-mock-assign-to-manager.activity-CY_5d0KF.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-chat-generate-image.command-Hj-2bHyJ.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-0ZnevjmT.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-chat-transcribe-speech.command-D8sCgp69.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-contact-core.module-5TLCGWOR.mjs +0 -968
- package/fesm2022/acorex-connectivity-mock-contact-core.module-5TLCGWOR.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-product-list.query-Bv1im5yj.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-timeline.query-C_ecGCyk.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-t4BHU8qk.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-user-distribution.query-jQAsUf_h.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-product-list.query-o9TcY_RC.mjs","sources":["../../../../libs/connectivity/mock/src/lib/product-catalog/reports/get-product-list.query.ts"],"sourcesContent":["import { resolveMultiLanguageString } from '@acorex/platform/contracts';\n\nimport { AXPReportSummaryOptions } from '@acorex/modules/report-management';\nimport { AXMProductCatalogProductEntityModel, RootConfig } from '@acorex/modules/product-catalog';\nimport { AXPQuerySort } from '@acorex/platform/common';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { computeReportFooterSummary } from '../../report-management/report-summary.util';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetProductListQueryInput {\n skip?: number;\n take?: number;\n sort?: AXPQuerySort[];\n summary?: AXPReportSummaryOptions[];\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface ProductByBrandResult {\n brand: string;\n brandId?: string;\n manufacturer: string;\n manufacturerId?: string;\n productCount: number;\n totalValue: number;\n averagePrice: number;\n minPrice: number;\n maxPrice: number;\n categories: string;\n}\n\nexport interface GetProductListQueryResult {\n items: ProductByBrandResult[];\n total: number;\n summary?: Record<string, number | null>;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetProductListQuery implements AXPQuery<GetProductListQueryInput, GetProductListQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private productService = this.entityService\n .withEntity(`${RootConfig.module.name}.${RootConfig.entities.product.name}`)\n .data<string, AXMProductCatalogProductEntityModel>();\n\n async fetch(input: GetProductListQueryInput | any): Promise<GetProductListQueryResult> {\n // Extract product-specific filters from AXPFilterClause format\n const extractedFilters = this.extractProductFilters(input.filters);\n\n // Separate custom filters from entity filters\n const entityFilters: GetProductListQueryInput['filters'] = [];\n let priceRangeFilter: string | undefined;\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n if (filter.field === 'priceRange') {\n priceRangeFilter = filter.value;\n } else {\n entityFilters.push(filter);\n }\n }\n }\n\n // Get all products from storage with entity filters\n const allProductsResult = await this.productService.query({\n skip: 0,\n take: 10000, // Get all products for aggregation\n filter:\n entityFilters.length > 0\n ? ({\n logic: input.logic || 'and',\n filters: entityFilters,\n } as any)\n : undefined,\n });\n\n let allProducts = allProductsResult.items;\n\n // Apply custom price range filter after fetching\n if (priceRangeFilter && priceRangeFilter !== 'all') {\n allProducts = this.applyPriceRangeFilter(allProducts, priceRangeFilter);\n }\n\n // Group products by brand\n const brandGroups = new Map<string, AXMProductCatalogProductEntityModel[]>();\n\n for (const product of allProducts) {\n const brandKey = product.brand?.title || product.brandId || 'Unknown';\n\n if (!brandGroups.has(brandKey)) {\n brandGroups.set(brandKey, []);\n }\n\n brandGroups.get(brandKey)!.push(product);\n }\n\n // Aggregate data by brand\n const aggregatedResults: ProductByBrandResult[] = [];\n\n for (const [brandName, products] of brandGroups.entries()) {\n const prices = products.map((p) => p.basePrice || 0).filter((p) => p > 0);\n const totalValue = prices.reduce((sum, price) => sum + price, 0);\n const productCount = products.length;\n const averagePrice = productCount > 0 ? totalValue / productCount : 0;\n const minPrice = prices.length > 0 ? Math.min(...prices) : 0;\n const maxPrice = prices.length > 0 ? Math.max(...prices) : 0;\n\n // Get unique categories\n const categorySet = new Set<string>();\n for (const product of products) {\n if (product.categories && Array.isArray(product.categories)) {\n for (const cat of product.categories) {\n if (cat.title) {\n categorySet.add(resolveMultiLanguageString(cat.title, 'en-US'));\n }\n }\n }\n }\n const categories = Array.from(categorySet).join(', ');\n\n // Get brand ID from first product\n const brandId = products[0]?.brandId || products[0]?.brand?.id;\n\n // Get manufacturer from first product (assuming all products in a brand have same manufacturer)\n const manufacturerName =\n (products[0]?.manufacturer?.title != null\n ? resolveMultiLanguageString(products[0].manufacturer!.title, 'en-US')\n : '') ||\n products[0]?.manufacturerId ||\n 'Unknown';\n const manufacturerId = products[0]?.manufacturerId || products[0]?.manufacturer?.id;\n\n aggregatedResults.push({\n brand: brandName,\n brandId,\n manufacturer: manufacturerName,\n manufacturerId,\n productCount,\n totalValue: Number(totalValue.toFixed(2)),\n averagePrice: Number(averagePrice.toFixed(2)),\n minPrice: Number(minPrice.toFixed(2)),\n maxPrice: Number(maxPrice.toFixed(2)),\n categories,\n });\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n aggregatedResults.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.name as keyof ProductByBrandResult;\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 }\n\n const summary = computeReportFooterSummary(\n aggregatedResults as unknown as Record<string, unknown>[],\n input.summary,\n );\n\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = aggregatedResults.length;\n const items = aggregatedResults.slice(skip, skip + take);\n\n return {\n items,\n total,\n summary,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract product-specific filters from AXPFilterClause format\n * Maps report parameter paths to product entity field names\n */\n private extractProductFilters(parameters: any): GetProductListQueryInput['filters'] {\n const filters: GetProductListQueryInput['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 product-specific field mappings\n if (field === 'brand') {\n // Brand filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'brandId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'brandId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'category') {\n // Category filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value[0], // Use first category for contains check\n });\n } else if (value) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value,\n });\n }\n } else if (field === 'status') {\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 === 'priceRange') {\n // Price range filter - custom logic handled in query\n filters.push({\n field: 'priceRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else if (field === 'startDate' || field === 'endDate') {\n // Date filters - can be handled if needed\n // For now, skip as they might not be directly on product entity\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 custom price range filter to products\n */\n private applyPriceRangeFilter(\n products: AXMProductCatalogProductEntityModel[],\n priceRange: string,\n ): AXMProductCatalogProductEntityModel[] {\n return products.filter((product) => {\n const price = product.basePrice || 0;\n\n switch (priceRange) {\n case 'under-50':\n return price < 50;\n case '50-100':\n return price >= 50 && price < 100;\n case '100-500':\n return price >= 100 && price < 500;\n case '500-1000':\n return price >= 500 && price < 1000;\n case 'over-1000':\n return price >= 1000;\n default:\n return true;\n }\n });\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;AA4CA;MAKa,mBAAmB,CAAA;AAHhC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,cAAc,GAAG,IAAI,CAAC;AAC3B,aAAA,UAAU,CAAC,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;AAC1E,aAAA,IAAI,EAA+C;AAkQvD,IAAA;IAhQC,MAAM,KAAK,CAAC,KAAqC,EAAA;;QAE/C,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC;;QAGlE,MAAM,aAAa,GAAwC,EAAE;AAC7D,QAAA,IAAI,gBAAoC;QAExC,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;AACnD,YAAA,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE;AACrC,gBAAA,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,EAAE;AACjC,oBAAA,gBAAgB,GAAG,MAAM,CAAC,KAAK;gBACjC;qBAAO;AACL,oBAAA,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC5B;YACF;QACF;;QAGA,MA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BAAA,OAAO,KAAK,IAAI,GAAG,IAAI,KAAK,GAAG,IAAI;AACrC,gBAAA,KAAK,WAAW;oBACd,OAAO,KAAK,IAAI,IAAI;AACtB,gBAAA;AACE,oBAAA,OAAO,IAAI;;AAEjB,QAAA,CAAC,CAAC;IACJ;8GAnQW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnB,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,mBAAmB,cAFlB,MAAM,EAAA,CAAA,CAAA;;2FAEP,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
|
-
import { GetProductListQuery } from './acorex-connectivity-mock-get-product-list.query-
|
|
3
|
+
import { GetProductListQuery } from './acorex-connectivity-mock-get-product-list.query-o9TcY_RC.mjs';
|
|
4
4
|
|
|
5
5
|
//#endregion
|
|
6
6
|
class GetProductPdfDataQuery {
|
|
@@ -189,4 +189,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
189
189
|
}] });
|
|
190
190
|
|
|
191
191
|
export { GetProductPdfDataQuery };
|
|
192
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-product-pdf-data.query-
|
|
192
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-product-pdf-data.query-DUZvwsmY.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-connectivity-mock-get-product-pdf-data.query-Cp65_mpB.mjs","sources":["../../../../libs/connectivity/mock/src/lib/product-catalog/reports/get-product-pdf-data.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { GetProductListQueryInput, GetProductListQueryResult } from './get-product-list.query';\nimport { GetProductListQuery } from './get-product-list.query';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetProductPdfDataQueryInput {\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface GetProductPdfDataQueryResult {\n url?: string;\n base64?: string;\n blob?: Blob;\n filename?: string;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetProductPdfDataQuery implements AXPQuery<GetProductPdfDataQueryInput, GetProductPdfDataQueryResult> {\n private readonly productListQuery = inject(GetProductListQuery);\n\n async fetch(input: GetProductPdfDataQueryInput | any): Promise<GetProductPdfDataQueryResult> {\n // Extract product-specific filters from AXPFilterClause format\n const extractedFilters = this.extractProductFilters(input.filters);\n\n // Get the product list data to generate PDF content\n const productListInput: GetProductListQueryInput = {\n skip: 0,\n take: 10000, // Get all products for PDF\n filters: extractedFilters,\n logic: input.logic,\n };\n\n const productData = await this.productListQuery.fetch(productListInput);\n\n // Generate a mock PDF base64 string\n // In production, this would call an actual PDF generation service\n const pdfBase64 = this.generateMockPdfBase64(productData);\n\n return {\n base64: pdfBase64,\n filename: `Product_Report_${new Date().toISOString().split('T')[0]}.pdf`,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract product-specific filters from AXPFilterClause format\n * Maps report parameter paths to product entity field names\n */\n private extractProductFilters(parameters: any): GetProductListQueryInput['filters'] {\n const filters: GetProductListQueryInput['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 product-specific field mappings\n if (field === 'brand') {\n // Brand filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'brandId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'brandId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'category') {\n // Category filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value[0], // Use first category for contains check\n });\n } else if (value) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value,\n });\n }\n } else if (field === 'status') {\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 === 'priceRange') {\n // Price range filter - custom logic handled in query\n filters.push({\n field: 'priceRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else if (field === 'startDate' || field === 'endDate') {\n // Date filters - can be handled if needed\n // For now, skip as they might not be directly on product entity\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 ---- PDF Generation Helpers ----\n\n /**\n * Generate a mock PDF base64 string\n * In production, this would call an actual PDF generation service\n */\n private generateMockPdfBase64(productData: GetProductListQueryResult): string {\n // Create a minimal valid PDF with some content\n // This is a very basic PDF structure for demonstration\n // In production, use a proper PDF library like jsPDF or call a backend service\n\n const pdfContent = this.createSimplePdf(productData);\n\n // Convert to base64\n const base64 = btoa(pdfContent);\n\n return base64;\n }\n\n /**\n * Create a simple PDF document structure\n * This is a minimal valid PDF for demonstration - in production use a proper PDF library\n */\n private createSimplePdf(productData: GetProductListQueryResult): string {\n // Use a minimal valid PDF structure that browsers can render\n // This is a very basic single-page PDF\n const pdf = `%PDF-1.4\n1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n3 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>\nendobj\n4 0 obj\n<< /Length 200 >>\nstream\nBT\n/F1 12 Tf\n100 700 Td\n(Product Report) Tj\n0 -20 Td\n(Total Brands: ${productData.total}) Tj\n0 -20 Td\n(Generated: ${new Date().toLocaleDateString()}) Tj\n0 -20 Td\n(Items: ${productData.items.length}) Tj\nET\nendstream\nendobj\n5 0 obj\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\nendobj\nxref\n0 6\n0000000000 65535 f \n0000000009 00000 n \n0000000058 00000 n \n0000000115 00000 n \n0000000317 00000 n \n0000000444 00000 n \ntrailer\n<< /Size 6 /Root 1 0 R >>\nstartxref\n527\n%%EOF`;\n\n return pdf;\n }\n\n //#endregion\n}\n\n"],"names":[],"mappings":";;;;AAuBA;MAKa,sBAAsB,CAAA;AAHnC,IAAA,WAAA,GAAA;AAIqB,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,mBAAmB,CAAC;AA2LlE,IAAA;IAzLG,MAAM,KAAK,CAAC,KAAwC,EAAA;;QAEhD,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC;;AAGlE,QAAA,MAAM,gBAAgB,GAA6B;AAC/C,YAAA,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,KAAK;AACX,YAAA,OAAO,EAAE,gBAAgB;YACzB,KAAK,EAAE,KAAK,CAAC,KAAK;SACrB;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,CAAC;;;QAIvE,MAAM,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC;QAEzD,OAAO;AACH,YAAA,MAAM,EAAE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ib/product-catalog/reports/get-product-pdf-data.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { GetProductListQueryInput, GetProductListQueryResult } from './get-product-list.query';\nimport { GetProductListQuery } from './get-product-list.query';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetProductPdfDataQueryInput {\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface GetProductPdfDataQueryResult {\n url?: string;\n base64?: string;\n blob?: Blob;\n filename?: string;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetProductPdfDataQuery implements AXPQuery<GetProductPdfDataQueryInput, GetProductPdfDataQueryResult> {\n private readonly productListQuery = inject(GetProductListQuery);\n\n async fetch(input: GetProductPdfDataQueryInput | any): Promise<GetProductPdfDataQueryResult> {\n // Extract product-specific filters from AXPFilterClause format\n const extractedFilters = this.extractProductFilters(input.filters);\n\n // Get the product list data to generate PDF content\n const productListInput: GetProductListQueryInput = {\n skip: 0,\n take: 10000, // Get all products for PDF\n filters: extractedFilters,\n logic: input.logic,\n };\n\n const productData = await this.productListQuery.fetch(productListInput);\n\n // Generate a mock PDF base64 string\n // In production, this would call an actual PDF generation service\n const pdfBase64 = this.generateMockPdfBase64(productData);\n\n return {\n base64: pdfBase64,\n filename: `Product_Report_${new Date().toISOString().split('T')[0]}.pdf`,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract product-specific filters from AXPFilterClause format\n * Maps report parameter paths to product entity field names\n */\n private extractProductFilters(parameters: any): GetProductListQueryInput['filters'] {\n const filters: GetProductListQueryInput['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 product-specific field mappings\n if (field === 'brand') {\n // Brand filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'brandId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'brandId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'category') {\n // Category filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value[0], // Use first category for contains check\n });\n } else if (value) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value,\n });\n }\n } else if (field === 'status') {\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 === 'priceRange') {\n // Price range filter - custom logic handled in query\n filters.push({\n field: 'priceRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else if (field === 'startDate' || field === 'endDate') {\n // Date filters - can be handled if needed\n // For now, skip as they might not be directly on product entity\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 ---- PDF Generation Helpers ----\n\n /**\n * Generate a mock PDF base64 string\n * In production, this would call an actual PDF generation service\n */\n private generateMockPdfBase64(productData: GetProductListQueryResult): string {\n // Create a minimal valid PDF with some content\n // This is a very basic PDF structure for demonstration\n // In production, use a proper PDF library like jsPDF or call a backend service\n\n const pdfContent = this.createSimplePdf(productData);\n\n // Convert to base64\n const base64 = btoa(pdfContent);\n\n return base64;\n }\n\n /**\n * Create a simple PDF document structure\n * This is a minimal valid PDF for demonstration - in production use a proper PDF library\n */\n private createSimplePdf(productData: GetProductListQueryResult): string {\n // Use a minimal valid PDF structure that browsers can render\n // This is a very basic single-page PDF\n const pdf = `%PDF-1.4\n1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n3 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>\nendobj\n4 0 obj\n<< /Length 200 >>\nstream\nBT\n/F1 12 Tf\n100 700 Td\n(Product Report) Tj\n0 -20 Td\n(Total Brands: ${productData.total}) Tj\n0 -20 Td\n(Generated: ${new Date().toLocaleDateString()}) Tj\n0 -20 Td\n(Items: ${productData.items.length}) Tj\nET\nendstream\nendobj\n5 0 obj\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\nendobj\nxref\n0 6\n0000000000 65535 f \n0000000009 00000 n \n0000000058 00000 n \n0000000115 00000 n \n0000000317 00000 n \n0000000444 00000 n \ntrailer\n<< /Size 6 /Root 1 0 R >>\nstartxref\n527\n%%EOF`;\n\n return pdf;\n }\n\n //#endregion\n}\n\n"],"names":[],"mappings":";;;;AAuBA;MAKa,sBAAsB,CAAA;AAHnC,IAAA,WAAA,GAAA;AAIqB,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,mBAAmB,CAAC;AA2LlE,IAAA;IAzLG,MAAM,KAAK,CAAC,KAAwC,EAAA;;QAEhD,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC;;AAGlE,QAAA,MAAM,gBAAgB,GAA6B;AAC/C,YAAA,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,KAAK;AACX,YAAA,OAAO,EAAE,gBAAgB;YACzB,KAAK,EAAE,KAAK,CAAC,KAAK;SACrB;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,CAAC;;;QAIvE,MAAM,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC;QAEzD,OAAO;AACH,YAAA,MAAM,EAAE,SAAS;AACjB,YAAA,QAAQ,EAAE,CAAA,eAAA,EAAkB,I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,QAAQ,EAAE,QAAQ;AAClB,oBAAA,KAAK,EAAE,KAAK;AACf,iBAAA,CAAC;YACN;QACJ;AAEA,QAAA,OAAO,OAAO;IAClB;;;AAMA;;;AAGG;AACK,IAAA,qBAAqB,CAAC,WAAsC,EAAA;;;;QAKhE,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC;;AAGpD,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;AAE/B,QAAA,OAAO,MAAM;IACjB;AAEA;;;AAGG;AACK,IAAA,eAAe,CAAC,WAAsC,EAAA;;;AAG1D,QAAA,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;AAkBH,eAAA,EAAA,WAAW,CAAC,KAAK,CAAA;;AAEpB,YAAA,EAAA,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,CAAA;;UAEnC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAA;;;;;;;;;;;;;;;;;;;MAmB5B;AAEE,QAAA,OAAO,GAAG;IACd;8GAzLS,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAtB,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,sBAAsB,cAFnB,MAAM,EAAA,CAAA,CAAA;;2FAET,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAHlC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE,MAAM;AACrB,iBAAA;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
|
-
import { GetSubscriptionsTimelineQuery } from './acorex-connectivity-mock-get-subscriptions-timeline.query-
|
|
3
|
+
import { GetSubscriptionsTimelineQuery } from './acorex-connectivity-mock-get-subscriptions-timeline.query-D_jVT-7a.mjs';
|
|
4
4
|
|
|
5
5
|
//#endregion
|
|
6
6
|
class GetSubscriptionsChartDataQuery {
|
|
@@ -53,4 +53,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
53
53
|
}] });
|
|
54
54
|
|
|
55
55
|
export { GetSubscriptionsChartDataQuery };
|
|
56
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-subscriptions-chart-data.query-
|
|
56
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-subscriptions-chart-data.query-BXDzY2Sd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-connectivity-mock-get-subscriptions-chart-data.query-
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-subscriptions-chart-data.query-BXDzY2Sd.mjs","sources":["../../../../libs/connectivity/mock/src/lib/tenant-management/reports/get-subscriptions-chart-data.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { GetSubscriptionsTimelineQueryInput } from './get-subscriptions-timeline.query';\nimport { GetSubscriptionsTimelineQuery } from './get-subscriptions-timeline.query';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetSubscriptionsChartDataQueryInput {\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface SubscriptionsChartDataResult {\n month: string;\n year: number;\n quarter: string;\n subscriptionCount: number;\n}\n\nexport interface GetSubscriptionsChartDataQueryResult {\n items: SubscriptionsChartDataResult[];\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetSubscriptionsChartDataQuery\n implements AXPQuery<GetSubscriptionsChartDataQueryInput, GetSubscriptionsChartDataQueryResult>\n{\n private readonly subscriptionsTimelineQuery = inject(GetSubscriptionsTimelineQuery);\n\n async fetch(input: GetSubscriptionsChartDataQueryInput | any): Promise<GetSubscriptionsChartDataQueryResult> {\n // Get all subscription timeline data (no pagination for charts)\n const timelineResult = await this.subscriptionsTimelineQuery.fetch({\n skip: 0,\n take: 10000,\n filters: input.filters,\n logic: input.logic,\n });\n\n // Group by month\n const monthGroups = new Map<string, SubscriptionsChartDataResult>();\n\n for (const item of timelineResult.items) {\n const monthKey = `${item.year}-${String(item.monthNumber).padStart(2, '0')}`;\n\n if (!monthGroups.has(monthKey)) {\n monthGroups.set(monthKey, {\n month: item.month,\n year: item.year,\n quarter: item.quarter,\n subscriptionCount: 0,\n });\n }\n\n const group = monthGroups.get(monthKey)!;\n group.subscriptionCount++;\n }\n\n // Convert to array and sort by date\n const results = Array.from(monthGroups.values()).sort((a, b) => {\n if (a.year !== b.year) return a.year - b.year;\n const monthA = new Date(`${a.month} 1, ${a.year}`).getMonth();\n const monthB = new Date(`${b.month} 1, ${b.year}`).getMonth();\n return monthA - monthB;\n });\n\n return {\n items: results,\n };\n }\n}\n\n"],"names":[],"mappings":";;;;AA2BA;MAKa,8BAA8B,CAAA;AAH3C,IAAA,WAAA,GAAA;AAMmB,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AA0CpF,IAAA;IAxCC,MAAM,KAAK,CAAC,KAAgD,EAAA;;QAE1D,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC;AACjE,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK;AACnB,SAAA,CAAC;;AAGF,QAAA,MAAM,WAAW,GAAG,IAAI,GAAG,EAAwC;AAEnE,QAAA,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,KAAK,EAAE;YACvC,MAAM,QAAQ,GAAG,CAAA,EAAG,IAAI,CAAC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A,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA9B,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,8BAA8B,cAF7B,MAAM,EAAA,CAAA,CAAA;;2FAEP,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAH1C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { AXPSystemStatusType } from '@acorex/platform/contracts';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
3
|
import { inject, Injectable } from '@angular/core';
|
|
3
4
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
4
|
-
import { AXPSystemStatusType } from '@acorex/platform/common';
|
|
5
5
|
import { RootConfig } from '@acorex/modules/subscription-management';
|
|
6
6
|
import { RootConfig as RootConfig$1 } from '@acorex/modules/tenant-management';
|
|
7
7
|
|
|
@@ -243,4 +243,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
243
243
|
}] });
|
|
244
244
|
|
|
245
245
|
export { GetSubscriptionsTimelineQuery };
|
|
246
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-subscriptions-timeline.query-
|
|
246
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-subscriptions-timeline.query-D_jVT-7a.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-subscriptions-timeline.query-D_jVT-7a.mjs","sources":["../../../../libs/connectivity/mock/src/lib/tenant-management/reports/get-subscriptions-timeline.query.ts"],"sourcesContent":["import { AXPSystemStatusType } from '@acorex/platform/contracts';\nimport { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMSubscriptionManagementSubscriptionEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMTenantManagementTenantEntityModel } from '@acorex/modules/tenant-management';\n\nimport { RootConfig as SubscriptionRootConfig } from '@acorex/modules/subscription-management';\nimport { RootConfig as TenantRootConfig } from '@acorex/modules/tenant-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetSubscriptionsTimelineQueryInput {\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 SubscriptionsTimelineResult {\n subscriptionId: string;\n subscriptionTitle: string;\n tenantId: string;\n tenantName: string;\n planId?: string;\n planName: string;\n status: string;\n startDate: Date;\n startDateStr: string;\n endDate?: Date;\n endDateStr?: string;\n durationDays: number;\n month: string;\n monthNumber: number;\n quarter: string;\n year: number;\n isActive: boolean;\n}\n\nexport interface GetSubscriptionsTimelineQueryResult {\n items: SubscriptionsTimelineResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetSubscriptionsTimelineQuery\n implements AXPQuery<GetSubscriptionsTimelineQueryInput, GetSubscriptionsTimelineQueryResult>\n{\n private readonly entityService = inject(AXPEntityService);\n private subscriptionService = this.entityService\n .withEntity(`${SubscriptionRootConfig.module.name}.${SubscriptionRootConfig.entities.subscription.name}`)\n .data<string, AXMSubscriptionManagementSubscriptionEntityModel>();\n private tenantService = this.entityService\n .withEntity(`${TenantRootConfig.module.name}.${TenantRootConfig.entities.tenant.name}`)\n .data<string, AXMTenantManagementTenantEntityModel>();\n\n async fetch(input: GetSubscriptionsTimelineQueryInput | any): Promise<GetSubscriptionsTimelineQueryResult> {\n // Extract filters from AXPFilterClause format\n const extractedFilters = this.extractSubscriptionFilters(input.filters);\n const filterLogic = (input.filters as any)?.logic || input.logic || 'and';\n\n // Separate custom filters from entity filters\n const entityFilters: GetSubscriptionsTimelineQueryInput['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 subscriptions\n const subscriptionsResult = await this.subscriptionService.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 subscriptions = subscriptionsResult.items.filter((s) => s.subscriberType === 'Tenant');\n\n // Get all tenants for lookup\n const tenantsResult = await this.tenantService.query({\n skip: 0,\n take: 10000,\n });\n const tenants = tenantsResult.items;\n const tenantMap = new Map(tenants.map((t) => [t.id, t]));\n\n // Apply date range filter if provided\n if (dateRangeFilter) {\n subscriptions = this.applyDateRangeFilter(subscriptions, dateRangeFilter);\n }\n\n const now = new Date();\n\n // Build results\n const results: SubscriptionsTimelineResult[] = [];\n\n for (const subscription of subscriptions) {\n const startDate = new Date(subscription.startDate);\n const endDate = subscription.endDate ? new Date(subscription.endDate) : undefined;\n\n // Calculate duration in days\n const durationDays = endDate\n ? Math.ceil((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24))\n : Math.ceil((now.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24));\n\n // Extract time period info from start date\n const year = startDate.getFullYear();\n const month = startDate.getMonth() + 1;\n const monthName = startDate.toLocaleString('en-US', { month: 'long' });\n const quarter = Math.ceil(month / 3);\n const quarterName = `Q${quarter}`;\n\n // Check if subscription is currently active\n const isActive =\n subscription.statusId === AXPSystemStatusType.Active &&\n startDate <= now &&\n (!endDate || endDate >= now);\n\n // Get tenant name\n const tenant = tenantMap.get(subscription.subscriberId);\n\n results.push({\n subscriptionId: subscription.id,\n subscriptionTitle: subscription.title || `${tenant?.title || 'Unknown'} - ${subscription.plan?.title || 'Unknown Plan'}`,\n tenantId: subscription.subscriberId,\n tenantName: tenant?.title || 'Unknown',\n planId: subscription.planId,\n planName: subscription.plan?.title || 'Unknown',\n status: subscription.statusId || 'Unknown',\n startDate: startDate,\n startDateStr: startDate.toISOString(),\n endDate: endDate,\n endDateStr: endDate?.toISOString(),\n durationDays: durationDays,\n month: monthName,\n monthNumber: month,\n quarter: quarterName,\n year: year,\n isActive: isActive,\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 SubscriptionsTimelineResult;\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 === 'startDate') {\n const aDate = a.startDate.getTime();\n const bDate = b.startDate.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 start date descending (newest first)\n results.sort((a, b) => {\n return b.startDate.getTime() - a.startDate.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 ---- Filter Extraction ----\n\n /**\n * Extract subscription-specific filters from AXPFilterClause format\n * Maps report parameter paths to subscription entity field names\n */\n private extractSubscriptionFilters(parameters: any): GetSubscriptionsTimelineQueryInput['filters'] {\n const filters: GetSubscriptionsTimelineQueryInput['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 subscription-specific field mappings\n if (field === 'planId') {\n // Plan ID filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'planId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'planId',\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 subscriptions\n */\n private applyDateRangeFilter(\n subscriptions: AXMSubscriptionManagementSubscriptionEntityModel[],\n dateRange: any\n ): AXMSubscriptionManagementSubscriptionEntityModel[] {\n if (!dateRange || !dateRange.start || !dateRange.end) {\n return subscriptions;\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 subscriptions.filter((subscription) => {\n const subStartDate = new Date(subscription.startDate);\n const subEndDate = subscription.endDate ? new Date(subscription.endDate) : null;\n\n // Check if subscription overlaps with the date range\n return (\n (subStartDate >= startDate && subStartDate <= endDate) ||\n (subEndDate && subEndDate >= startDate && subEndDate <= endDate) ||\n (subStartDate <= startDate && (!subEndDate || subEndDate >= endDate))\n );\n });\n }\n\n //#endregion\n}\n\n"],"names":["SubscriptionRootConfig","TenantRootConfig"],"mappings":";;;;;;;AAiDA;MAKa,6BAA6B,CAAA;AAH1C,IAAA,WAAA,GAAA;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,mBAAmB,GAAG,IAAI,CA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AAA;;2FAEP,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAHzC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { AXPSystemStatusType } from '@acorex/platform/contracts';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
3
|
import { inject, Injectable } from '@angular/core';
|
|
3
4
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
4
|
-
import { AXPSystemStatusType } from '@acorex/platform/common';
|
|
5
5
|
import { RootConfig } from '@acorex/modules/tenant-management';
|
|
6
6
|
import { RootConfig as RootConfig$1 } from '@acorex/modules/subscription-management';
|
|
7
7
|
import { RootConfig as RootConfig$2 } from '@acorex/modules/application-management';
|
|
@@ -255,4 +255,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
255
255
|
}] });
|
|
256
256
|
|
|
257
257
|
export { GetTenantApplicationAccessQuery };
|
|
258
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-application-access.query-
|
|
258
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-application-access.query-BG6t0137.mjs.map
|
package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-BG6t0137.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-tenant-application-access.query-BG6t0137.mjs","sources":["../../../../libs/connectivity/mock/src/lib/tenant-management/reports/get-tenant-application-access.query.ts"],"sourcesContent":["import { AXPSystemStatusType } from '@acorex/platform/contracts';\nimport { 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 { AXMSubscriptionManagementSubscriptionEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMSubscriptionManagementSubscriptionPlanEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMSubscriptionManagementSubscriptionPlanItemEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMApplicationManagementApplicationEntityModel } from '@acorex/modules/application-management';\n\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 GetTenantApplicationAccessQueryInput {\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 TenantApplicationAccessResult {\n tenantId: string;\n tenantName: string;\n tenantStatus: string;\n subscriptionCount: number;\n applicationsCount: number;\n applicationsList: string;\n activeSubscriptionsCount: number;\n registrationDate?: Date;\n registrationDateStr?: string;\n}\n\nexport interface GetTenantApplicationAccessQueryResult {\n items: TenantApplicationAccessResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetTenantApplicationAccessQuery\n implements AXPQuery<GetTenantApplicationAccessQueryInput, GetTenantApplicationAccessQueryResult> {\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 subscriptionService = this.entityService\n .withEntity(`${SubscriptionRootConfig.module.name}.${SubscriptionRootConfig.entities.subscription.name}`)\n .data<string, AXMSubscriptionManagementSubscriptionEntityModel>();\n private planService = this.entityService\n .withEntity(`${SubscriptionRootConfig.module.name}.${SubscriptionRootConfig.entities.subscriptionPlan.name}`)\n .data<string, AXMSubscriptionManagementSubscriptionPlanEntityModel>();\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: GetTenantApplicationAccessQueryInput | any): Promise<GetTenantApplicationAccessQueryResult> {\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: GetTenantApplicationAccessQueryInput['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 subscriptions\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 plans\n const plansResult = await this.planService.query({\n skip: 0,\n take: 10000,\n });\n const plans = plansResult.items;\n\n // Get all plan items\n const planItemsResult = await this.planItemService.query({\n skip: 0,\n take: 10000,\n });\n const planItems = planItemsResult.items;\n\n // Get all applications\n const applicationsResult = await this.applicationService.query({\n skip: 0,\n take: 10000,\n });\n const applications = applicationsResult.items;\n\n // Build results for each tenant\n const results: TenantApplicationAccessResult[] = [];\n\n for (const tenant of tenants) {\n // Get tenant's subscriptions\n const tenantSubscriptions = subscriptions.filter((s) => s.subscriberId === tenant.id);\n\n // Get unique applications through subscriptions → plans → plan items → editions → applications\n const applicationSet = new Set<string>();\n const applicationNames: 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 if (!applicationSet.has(application.id)) {\n applicationSet.add(application.id);\n applicationNames.push(application.title);\n }\n }\n }\n }\n }\n\n // Count active subscriptions\n const activeSubscriptions = tenantSubscriptions.filter(\n (s) => s.statusId === AXPSystemStatusType.Active\n );\n\n results.push({\n tenantId: tenant.id,\n tenantName: tenant.title,\n tenantStatus: tenant.statusId || 'Unknown',\n subscriptionCount: tenantSubscriptions.length,\n applicationsCount: applicationSet.size,\n applicationsList: applicationNames.join(', '),\n activeSubscriptionsCount: activeSubscriptions.length,\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 TenantApplicationAccessResult;\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): GetTenantApplicationAccessQueryInput['filters'] {\n const filters: GetTenantApplicationAccessQueryInput['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":";;;;;;;;AA6CA;MAKa,+BAA+B,CAAA;AAH5C,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,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,+BAA+B,cAF9B,MAAM,EAAA,CAAA,CAAA;;2FAEP,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAH3C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { AXPSystemStatusType } from '@acorex/platform/contracts';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
3
|
import { inject, Injectable } from '@angular/core';
|
|
3
4
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
4
|
-
import { AXPSystemStatusType } from '@acorex/platform/common';
|
|
5
5
|
import { RootConfig } from '@acorex/modules/tenant-management';
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
@@ -209,4 +209,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
209
209
|
}] });
|
|
210
210
|
|
|
211
211
|
export { GetTenantUserDistributionQuery };
|
|
212
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-user-distribution.query-
|
|
212
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-user-distribution.query-gqSqvIaa.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-tenant-user-distribution.query-gqSqvIaa.mjs","sources":["../../../../libs/connectivity/mock/src/lib/tenant-management/reports/get-tenant-user-distribution.query.ts"],"sourcesContent":["import { AXPSystemStatusType } from '@acorex/platform/contracts';\nimport { 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';\n\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 <= endDate;\n });\n }\n\n //#endregion\n}\n\n"],"names":["TenantRootConfig"],"mappings":";;;;;;AAyCA;MAKa,8BAA8B,CAAA;AAH3C,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,EAAIA,UAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE;AACrF,aAAA,IAAI,EAAgD;QAC/C,IAAA,CAAA,iBAAiB,GAAG,IAAI,CAAC;AAC9B,aAAA,UAAU,CAAC,CAAA,EAAGA,UAAgB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,UAAgB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE;AACzF,aAAA,IAAI,EAAoD;AAoN5D,IAAA;IAlNC,MAAM,KAAK,CAAC,KAAgD,EAAA;;QAE1D,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,OAAO,CAAC;AACjE,QAAA,MAAM,WAAW,GAAI,KAAK,CAAC,OAAe,EAAE,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK;;QAGzE,MAAM,aAAa,GAAmD,EAAE;AACxE,QAAA,IAAI,eAAoB;QAExB,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;AACnD,YAAA,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE;AACrC,gBAAA,IAAI,MAAM,CAAC,KAAK,KAAK,WAAW,EAAE;AAChC,oBAAA,eAAe,GAAG,MAAM,CAAC,KAAK;gBAChC;qBAAO;AACL,oBAAA,aAAa,CAAC,IAAI,C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{"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/
|
|
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/contracts';\n\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":";;;AAeA;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;;;;;"}
|