@acorex/connectivity 21.0.0-next.91 → 21.0.0-next.93

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.
Files changed (54) hide show
  1. package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
  2. package/fesm2022/{acorex-connectivity-mock-acorex-connectivity-mock-B5bnzTKN.mjs → acorex-connectivity-mock-acorex-connectivity-mock-g0RVU1Og.mjs} +3962 -3636
  3. package/fesm2022/{acorex-connectivity-mock-acorex-connectivity-mock-B5bnzTKN.mjs.map → acorex-connectivity-mock-acorex-connectivity-mock-g0RVU1Og.mjs.map} +1 -1
  4. package/fesm2022/{acorex-connectivity-mock-assign-to-manager.activity-Dv7Jzdhf.mjs → acorex-connectivity-mock-assign-to-manager.activity-CTrrsAvF.mjs} +2 -2
  5. package/fesm2022/acorex-connectivity-mock-assign-to-manager.activity-CTrrsAvF.mjs.map +1 -0
  6. package/fesm2022/acorex-connectivity-mock-category-metadata-inheritance.query-CIof4zTg.mjs.map +1 -1
  7. package/fesm2022/acorex-connectivity-mock-category-with-items.query-DAKUJIIt.mjs.map +1 -1
  8. package/fesm2022/{acorex-connectivity-mock-chat-generate-image.command-C_1j3JPR.mjs → acorex-connectivity-mock-chat-generate-image.command-CSbgiZEm.mjs} +2 -3
  9. package/fesm2022/acorex-connectivity-mock-chat-generate-image.command-CSbgiZEm.mjs.map +1 -0
  10. package/fesm2022/{acorex-connectivity-mock-chat-synthesize-speech.command-0y5swsxw.mjs → acorex-connectivity-mock-chat-synthesize-speech.command-CjdySQzM.mjs} +2 -3
  11. package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-CjdySQzM.mjs.map +1 -0
  12. package/fesm2022/{acorex-connectivity-mock-chat-transcribe-speech.command-D59NedG-.mjs → acorex-connectivity-mock-chat-transcribe-speech.command-Wm1Ao81s.mjs} +2 -3
  13. package/fesm2022/acorex-connectivity-mock-chat-transcribe-speech.command-Wm1Ao81s.mjs.map +1 -0
  14. package/fesm2022/acorex-connectivity-mock-check-permission.activity-vr3OHtjC.mjs.map +1 -1
  15. package/fesm2022/acorex-connectivity-mock-distribution-record.activity-a1_k9Czb.mjs.map +1 -1
  16. package/fesm2022/acorex-connectivity-mock-entity-create.activity-CdoUzUvF.mjs.map +1 -1
  17. package/fesm2022/acorex-connectivity-mock-entity-delete.activity-ErEN1c24.mjs.map +1 -1
  18. package/fesm2022/acorex-connectivity-mock-entity-read.activity-1fJW8gVe.mjs.map +1 -1
  19. package/fesm2022/acorex-connectivity-mock-entity-update.activity-06HTKiQQ.mjs.map +1 -1
  20. package/fesm2022/acorex-connectivity-mock-extract-document-text.command-nGfUTSf6.mjs.map +1 -1
  21. package/fesm2022/acorex-connectivity-mock-get-application-versions-chart-data.query-DwVuYuKx.mjs.map +1 -1
  22. package/fesm2022/acorex-connectivity-mock-get-application-versions-timeline.query-sFKYynZA.mjs.map +1 -1
  23. package/fesm2022/acorex-connectivity-mock-get-current-session-user.activity-CsmxwXsM.mjs.map +1 -1
  24. package/fesm2022/acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs.map +1 -1
  25. package/fesm2022/acorex-connectivity-mock-get-employee-list.query-BWbZj3tp.mjs.map +1 -1
  26. package/fesm2022/acorex-connectivity-mock-get-location-list.query-CQ2rFDUM.mjs.map +1 -1
  27. package/fesm2022/acorex-connectivity-mock-get-product-chart-data.query-D7DBzLT-.mjs.map +1 -1
  28. package/fesm2022/acorex-connectivity-mock-get-product-list.query-o9TcY_RC.mjs.map +1 -1
  29. package/fesm2022/acorex-connectivity-mock-get-product-pdf-data.query-DUZvwsmY.mjs.map +1 -1
  30. package/fesm2022/acorex-connectivity-mock-get-subscriptions-chart-data.query-BXDzY2Sd.mjs.map +1 -1
  31. package/fesm2022/acorex-connectivity-mock-get-subscriptions-timeline.query-D_jVT-7a.mjs.map +1 -1
  32. package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-BG6t0137.mjs.map +1 -1
  33. package/fesm2022/acorex-connectivity-mock-get-tenant-registration-chart-data.query-CgMZxfzh.mjs.map +1 -1
  34. package/fesm2022/acorex-connectivity-mock-get-tenant-registration-timeline.query-COmTsDCV.mjs.map +1 -1
  35. package/fesm2022/acorex-connectivity-mock-get-tenant-user-distribution.query-gqSqvIaa.mjs.map +1 -1
  36. package/fesm2022/acorex-connectivity-mock-if.activity-DvzuhItL.mjs.map +1 -1
  37. package/fesm2022/{acorex-connectivity-mock-jira-instance-sync.command-BYOuTU3R.mjs → acorex-connectivity-mock-jira-instance-sync.command-CaOd4PJa.mjs} +1 -2
  38. package/fesm2022/{acorex-connectivity-mock-jira-instance-sync.command-BYOuTU3R.mjs.map → acorex-connectivity-mock-jira-instance-sync.command-CaOd4PJa.mjs.map} +1 -1
  39. package/fesm2022/{acorex-connectivity-mock-notification-management-email-send.command-Df6E-9-c.mjs → acorex-connectivity-mock-notification-management-email-send.command-BuH_Lm6V.mjs} +1 -2
  40. package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-BuH_Lm6V.mjs.map +1 -0
  41. package/fesm2022/acorex-connectivity-mock-sample.command-CJmDL4pL.mjs.map +1 -1
  42. package/fesm2022/acorex-connectivity-mock-structured-text-completion.command-l31pjl9-.mjs.map +1 -1
  43. package/fesm2022/{acorex-connectivity-mock-user-roles-for-list-column.query-DVuh_6NC.mjs → acorex-connectivity-mock-user-roles-for-list-column.query-wRFHOp-X.mjs} +2 -2
  44. package/fesm2022/acorex-connectivity-mock-user-roles-for-list-column.query-wRFHOp-X.mjs.map +1 -0
  45. package/fesm2022/acorex-connectivity-mock.mjs +1 -1
  46. package/package.json +2 -2
  47. package/types/acorex-connectivity-api.d.ts +1 -2
  48. package/types/acorex-connectivity-mock.d.ts +73 -56
  49. package/fesm2022/acorex-connectivity-mock-assign-to-manager.activity-Dv7Jzdhf.mjs.map +0 -1
  50. package/fesm2022/acorex-connectivity-mock-chat-generate-image.command-C_1j3JPR.mjs.map +0 -1
  51. package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-0y5swsxw.mjs.map +0 -1
  52. package/fesm2022/acorex-connectivity-mock-chat-transcribe-speech.command-D59NedG-.mjs.map +0 -1
  53. package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-Df6E-9-c.mjs.map +0 -1
  54. package/fesm2022/acorex-connectivity-mock-user-roles-for-list-column.query-DVuh_6NC.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-connectivity-mock-get-application-versions-timeline.query-sFKYynZA.mjs","sources":["../../../../libs/connectivity/mock/src/lib/application-management/reports/get-application-versions-timeline.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMAppVersionEntityModel } from '@acorex/modules/application-management';\nimport { RootConfig } from '@acorex/modules/application-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetApplicationVersionsTimelineQueryInput {\n skip?: number;\n take?: number;\n sort?: Array<{ field: string; dir: 'asc' | 'desc' }>;\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface ApplicationVersionTimelineResult {\n versionNumber: string;\n publishDate: string;\n publishDateObj: Date;\n year: number;\n month: string;\n monthNumber: number;\n quarter: string;\n versionCount: number;\n}\n\nexport interface GetApplicationVersionsTimelineQueryResult {\n items: ApplicationVersionTimelineResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetApplicationVersionsTimelineQuery\n implements AXPQuery<GetApplicationVersionsTimelineQueryInput, GetApplicationVersionsTimelineQueryResult> {\n\n\n private readonly entityService = inject(AXPEntityService);\n private appVersionService = this.entityService\n .withEntity(`${RootConfig.module.name}.${RootConfig.entities.appVersion.name}`)\n .data<string, AXMAppVersionEntityModel>();\n\n async fetch(input: GetApplicationVersionsTimelineQueryInput): Promise<GetApplicationVersionsTimelineQueryResult> {\n // Get all app versions from storage\n const allVersionsResult = await this.appVersionService.query({\n skip: 0,\n take: 10000, // Get all versions for aggregation\n filter:\n input.filters && input.filters.length > 0\n ? ({\n logic: input.logic || 'and',\n filters: input.filters,\n } as any)\n : undefined,\n });\n\n let allVersions = allVersionsResult.items;\n\n // Apply date range filter if provided\n if (input.filters) {\n for (const filter of input.filters) {\n if (filter.field === 'dateRange' && filter.value) {\n allVersions = this.applyDateRangeFilter(allVersions, filter.value);\n }\n if (filter.field === 'versionNumber' && filter.value) {\n allVersions = this.applyVersionNumberFilter(allVersions, filter.value);\n }\n }\n }\n\n // Group versions by time period (month/quarter/year)\n const periodGroups = new Map<string, AXMAppVersionEntityModel[]>();\n\n for (const version of allVersions) {\n const publishDate = new Date(version.publishDate);\n const year = publishDate.getFullYear();\n const month = publishDate.getMonth() + 1;\n const quarter = Math.ceil(month / 3);\n const monthName = publishDate.toLocaleString('en-US', { month: 'long' });\n const quarterName = `Q${quarter}`;\n const periodKey = `${year}-${String(month).padStart(2, '0')}`;\n\n if (!periodGroups.has(periodKey)) {\n periodGroups.set(periodKey, []);\n }\n\n periodGroups.get(periodKey)!.push(version);\n }\n\n // Create timeline results\n const timelineResults: ApplicationVersionTimelineResult[] = [];\n\n for (const version of allVersions) {\n const publishDate = new Date(version.publishDate);\n const year = publishDate.getFullYear();\n const month = publishDate.getMonth() + 1;\n const quarter = Math.ceil(month / 3);\n const monthName = publishDate.toLocaleString('en-US', { month: 'long' });\n const quarterName = `Q${quarter}`;\n const periodKey = `${year}-${String(month).padStart(2, '0')}`;\n\n const versionsInPeriod = periodGroups.get(periodKey)?.length || 0;\n\n timelineResults.push({\n versionNumber: version.versionNumber,\n publishDate: version.publishDate,\n publishDateObj: publishDate,\n year,\n month: monthName,\n monthNumber: month,\n quarter: quarterName,\n versionCount: versionsInPeriod,\n });\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n timelineResults.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.field as keyof ApplicationVersionTimelineResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n // Handle undefined values\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 === 'publishDateObj') {\n const aDate = a.publishDateObj.getTime();\n const bDate = b.publishDateObj.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 publish date descending (newest first)\n timelineResults.sort((a, b) => {\n return b.publishDateObj.getTime() - a.publishDateObj.getTime();\n });\n }\n\n // Apply pagination\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = timelineResults.length;\n const items = timelineResults.slice(skip, skip + take);\n\n return {\n items,\n total,\n };\n }\n\n //#region ---- Custom Filter Handlers ----\n\n /**\n * Apply date range filter to versions\n */\n private applyDateRangeFilter(versions: AXMAppVersionEntityModel[], dateRange: any): AXMAppVersionEntityModel[] {\n if (!dateRange || !dateRange.start || !dateRange.end) {\n return versions;\n }\n\n const startDate = new Date(dateRange.start);\n const endDate = new Date(dateRange.end);\n endDate.setHours(23, 59, 59, 999); // Include the entire end date\n\n return versions.filter((version) => {\n const publishDate = new Date(version.publishDate);\n return publishDate >= startDate && publishDate <= endDate;\n });\n }\n\n /**\n * Apply version number filter to versions\n */\n private applyVersionNumberFilter(\n versions: AXMAppVersionEntityModel[],\n versionNumber: string\n ): AXMAppVersionEntityModel[] {\n if (!versionNumber) {\n return versions;\n }\n\n const searchTerm = versionNumber.toLowerCase().trim();\n\n return versions.filter((version) => {\n return version.versionNumber.toLowerCase().includes(searchTerm);\n });\n }\n\n //#endregion\n}\n\n"],"names":[],"mappings":";;;;;AAoCA;MAKa,mCAAmC,CAAA;AAHhD,IAAA,WAAA,GAAA;AAOmB,QAAA,IAAA,CAAA,aAAa,GAA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{"version":3,"file":"acorex-connectivity-mock-get-application-versions-timeline.query-sFKYynZA.mjs","sources":["../../../../libs/connectivity/mock/src/lib/application-management/reports/get-application-versions-timeline.query.ts"],"sourcesContent":["import { AXPQuery } from '@acorex/platform/runtime-contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMAppVersionEntityModel } from '@acorex/modules/application-management';\nimport { RootConfig } from '@acorex/modules/application-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetApplicationVersionsTimelineQueryInput {\n skip?: number;\n take?: number;\n sort?: Array<{ field: string; dir: 'asc' | 'desc' }>;\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface ApplicationVersionTimelineResult {\n versionNumber: string;\n publishDate: string;\n publishDateObj: Date;\n year: number;\n month: string;\n monthNumber: number;\n quarter: string;\n versionCount: number;\n}\n\nexport interface GetApplicationVersionsTimelineQueryResult {\n items: ApplicationVersionTimelineResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetApplicationVersionsTimelineQuery\n implements AXPQuery<GetApplicationVersionsTimelineQueryInput, GetApplicationVersionsTimelineQueryResult> {\n\n\n private readonly entityService = inject(AXPEntityService);\n private appVersionService = this.entityService\n .withEntity(`${RootConfig.module.name}.${RootConfig.entities.appVersion.name}`)\n .data<string, AXMAppVersionEntityModel>();\n\n async fetch(input: GetApplicationVersionsTimelineQueryInput): Promise<GetApplicationVersionsTimelineQueryResult> {\n // Get all app versions from storage\n const allVersionsResult = await this.appVersionService.query({\n skip: 0,\n take: 10000, // Get all versions for aggregation\n filter:\n input.filters && input.filters.length > 0\n ? ({\n logic: input.logic || 'and',\n filters: input.filters,\n } as any)\n : undefined,\n });\n\n let allVersions = allVersionsResult.items;\n\n // Apply date range filter if provided\n if (input.filters) {\n for (const filter of input.filters) {\n if (filter.field === 'dateRange' && filter.value) {\n allVersions = this.applyDateRangeFilter(allVersions, filter.value);\n }\n if (filter.field === 'versionNumber' && filter.value) {\n allVersions = this.applyVersionNumberFilter(allVersions, filter.value);\n }\n }\n }\n\n // Group versions by time period (month/quarter/year)\n const periodGroups = new Map<string, AXMAppVersionEntityModel[]>();\n\n for (const version of allVersions) {\n const publishDate = new Date(version.publishDate);\n const year = publishDate.getFullYear();\n const month = publishDate.getMonth() + 1;\n const quarter = Math.ceil(month / 3);\n const monthName = publishDate.toLocaleString('en-US', { month: 'long' });\n const quarterName = `Q${quarter}`;\n const periodKey = `${year}-${String(month).padStart(2, '0')}`;\n\n if (!periodGroups.has(periodKey)) {\n periodGroups.set(periodKey, []);\n }\n\n periodGroups.get(periodKey)!.push(version);\n }\n\n // Create timeline results\n const timelineResults: ApplicationVersionTimelineResult[] = [];\n\n for (const version of allVersions) {\n const publishDate = new Date(version.publishDate);\n const year = publishDate.getFullYear();\n const month = publishDate.getMonth() + 1;\n const quarter = Math.ceil(month / 3);\n const monthName = publishDate.toLocaleString('en-US', { month: 'long' });\n const quarterName = `Q${quarter}`;\n const periodKey = `${year}-${String(month).padStart(2, '0')}`;\n\n const versionsInPeriod = periodGroups.get(periodKey)?.length || 0;\n\n timelineResults.push({\n versionNumber: version.versionNumber,\n publishDate: version.publishDate,\n publishDateObj: publishDate,\n year,\n month: monthName,\n monthNumber: month,\n quarter: quarterName,\n versionCount: versionsInPeriod,\n });\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n timelineResults.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.field as keyof ApplicationVersionTimelineResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n // Handle undefined values\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 === 'publishDateObj') {\n const aDate = a.publishDateObj.getTime();\n const bDate = b.publishDateObj.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 publish date descending (newest first)\n timelineResults.sort((a, b) => {\n return b.publishDateObj.getTime() - a.publishDateObj.getTime();\n });\n }\n\n // Apply pagination\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = timelineResults.length;\n const items = timelineResults.slice(skip, skip + take);\n\n return {\n items,\n total,\n };\n }\n\n //#region ---- Custom Filter Handlers ----\n\n /**\n * Apply date range filter to versions\n */\n private applyDateRangeFilter(versions: AXMAppVersionEntityModel[], dateRange: any): AXMAppVersionEntityModel[] {\n if (!dateRange || !dateRange.start || !dateRange.end) {\n return versions;\n }\n\n const startDate = new Date(dateRange.start);\n const endDate = new Date(dateRange.end);\n endDate.setHours(23, 59, 59, 999); // Include the entire end date\n\n return versions.filter((version) => {\n const publishDate = new Date(version.publishDate);\n return publishDate >= startDate && publishDate <= endDate;\n });\n }\n\n /**\n * Apply version number filter to versions\n */\n private applyVersionNumberFilter(\n versions: AXMAppVersionEntityModel[],\n versionNumber: string\n ): AXMAppVersionEntityModel[] {\n if (!versionNumber) {\n return versions;\n }\n\n const searchTerm = versionNumber.toLowerCase().trim();\n\n return versions.filter((version) => {\n return version.versionNumber.toLowerCase().includes(searchTerm);\n });\n }\n\n //#endregion\n}\n\n"],"names":[],"mappings":";;;;;AAqCA;MAKa,mCAAmC,CAAA;AAHhD,IAAA,WAAA,GAAA;AAOmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,iBAAiB,GAAG,IAAI,CAAC;AAC9B,aAAA,UAAU,CAAC,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAI,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE;AAC7E,aAAA,IAAI,EAAoC;AAiK5C,IAAA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AC,CAAC,OAAO,KAAI;YACjC,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;AACjD,YAAA,OAAO,WAAW,IAAI,SAAS,IAAI,WAAW,IAAI,OAAO;AAC3D,QAAA,CAAC,CAAC;IACJ;AAEA;;AAEG;IACK,wBAAwB,CAC9B,QAAoC,EACpC,aAAqB,EAAA;QAErB,IAAI,CAAC,aAAa,EAAE;AAClB,YAAA,OAAO,QAAQ;QACjB;QAEA,MAAM,UAAU,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE;AAErD,QAAA,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,KAAI;YACjC,OAAO,OAAO,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;AACjE,QAAA,CAAC,CAAC;IACJ;8GArKW,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;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-connectivity-mock-get-current-session-user.activity-CsmxwXsM.mjs","sources":["../../../../libs/connectivity/mock/src/lib/workflow-management/activities/get-current-session-user.activity.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { AXPSessionService } from '@acorex/platform/auth';\n\nexport interface GetCurrentSessionUserOutput {\n userId: string | null;\n}\n\n/**\n * Returns the platform user id of the current session (workflow initiator when run in UI).\n *\n * Activity Type: workflow-activity:get-current-session-user\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class GetCurrentSessionUserActivity\n implements AXPCommand<Record<string, never>, GetCurrentSessionUserOutput>\n{\n private readonly sessionService = inject(AXPSessionService);\n\n async execute(): Promise<AXPExecuteCommandResult<GetCurrentSessionUserOutput>> {\n const userId = this.sessionService.user?.id ?? null;\n console.log('[WFM-LifecycleTaskTrace] get-current-session-user', {\n userId,\n hasSession: !!this.sessionService.user,\n });\n return {\n success: true,\n data: { userId },\n metadata: {\n outcome: 'Done',\n },\n };\n }\n}\n"],"names":[],"mappings":";;;;AASA;;;;AAIG;MAIU,6BAA6B,CAAA;AAH1C,IAAA,WAAA,GAAA;AAMmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAgB5D,IAAA;AAdC,IAAA,MAAM,OAAO,GAAA;QACX,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI;AACnD,QAAA,OAAO,CAAC,GAAG,CAAC,mDAAmD,EAAE;YAC/D,MAAM;AACN,YAAA,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI;AACvC,SAAA,CAAC;QACF,OAAO;AACL,YAAA,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,EAAE,MAAM,EAAE;AAChB,YAAA,QAAQ,EAAE;AACR,gBAAA,OAAO,EAAE,MAAM;AAChB,aAAA;SACF;IACH;8GAlBW,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA7B,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,6BAA6B,cAF5B,MAAM,EAAA,CAAA,CAAA;;2FAEP,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAHzC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
1
+ {"version":3,"file":"acorex-connectivity-mock-get-current-session-user.activity-CsmxwXsM.mjs","sources":["../../../../libs/connectivity/mock/src/lib/workflow-management/activities/get-current-session-user.activity.ts"],"sourcesContent":["import { AXPCommand } from '@acorex/platform/runtime-contracts';\nimport { inject, Injectable } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\n\nimport { AXPSessionService } from '@acorex/platform/auth';\n\nexport interface GetCurrentSessionUserOutput {\n userId: string | null;\n}\n\n/**\n * Returns the platform user id of the current session (workflow initiator when run in UI).\n *\n * Activity Type: workflow-activity:get-current-session-user\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class GetCurrentSessionUserActivity\n implements AXPCommand<Record<string, never>, GetCurrentSessionUserOutput>\n{\n private readonly sessionService = inject(AXPSessionService);\n\n async execute(): Promise<AXPExecuteCommandResult<GetCurrentSessionUserOutput>> {\n const userId = this.sessionService.user?.id ?? null;\n console.log('[WFM-LifecycleTaskTrace] get-current-session-user', {\n userId,\n hasSession: !!this.sessionService.user,\n });\n return {\n success: true,\n data: { userId },\n metadata: {\n outcome: 'Done',\n },\n };\n }\n}\n"],"names":[],"mappings":";;;;AAUA;;;;AAIG;MAIU,6BAA6B,CAAA;AAH1C,IAAA,WAAA,GAAA;AAMmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAgB5D,IAAA;AAdC,IAAA,MAAM,OAAO,GAAA;QACX,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI;AACnD,QAAA,OAAO,CAAC,GAAG,CAAC,mDAAmD,EAAE;YAC/D,MAAM;AACN,YAAA,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI;AACvC,SAAA,CAAC;QACF,OAAO;AACL,YAAA,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,EAAE,MAAM,EAAE;AAChB,YAAA,QAAQ,EAAE;AACR,gBAAA,OAAO,EAAE,MAAM;AAChB,aAAA;SACF;IACH;8GAlBW,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA7B,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,6BAA6B,cAF5B,MAAM,EAAA,CAAA,CAAA;;2FAEP,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAHzC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs","sources":["../../../../libs/connectivity/mock/src/lib/workflow-management/activities/get-current-user-manager.activity.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\n\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { AXPEntityStorageService } from '@acorex/platform/layout/entity';\nimport { AXPSessionService } from '@acorex/platform/auth';\n\nconst EMPLOYEE_ENTITY = 'HumanCapitalManagement.Employee';\n\nexport interface GetCurrentUserManagerOutput {\n managerId: string | null;\n}\n\n/**\n * Get Current User Manager Activity (Backend - Mock)\n *\n * Resolves the manager of the current user (Employee → managerId → manager's userId).\n * Use when assigning a review task to the current user's manager (e.g. questionnaire review)\n * without a leave request or other ref entity.\n *\n * Execution Mode: backend\n * Activity Type: workflow-activity:get-current-user-manager\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class GetCurrentUserManagerActivity implements AXPCommand<Record<string, never>, GetCurrentUserManagerOutput> {\n private readonly entityStorage = inject(AXPEntityStorageService);\n private readonly sessionService = inject(AXPSessionService);\n\n async execute(): Promise<AXPExecuteCommandResult<GetCurrentUserManagerOutput>> {\n let managerId: string | null = null;\n const userId = this.sessionService.user?.id;\n\n if (userId) {\n try {\n const result = await this.entityStorage.query(EMPLOYEE_ENTITY, {\n skip: 0,\n take: 1,\n filter: {\n field: 'userId',\n operator: { type: 'equal' },\n value: userId,\n },\n });\n const employees = result.items as { id: string; managerId?: string | null }[] | undefined;\n const employee = employees?.[0];\n const managerEmployeeId = employee?.managerId;\n\n if (managerEmployeeId) {\n const managerEmp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, managerEmployeeId)) as {\n userId?: string;\n } | null;\n managerId = managerEmp?.userId ?? managerEmployeeId;\n }\n } catch {\n // keep managerId null\n }\n }\n\n return {\n success: true,\n data: {\n managerId,\n },\n metadata: {\n outcome: 'Done',\n },\n };\n }\n}\n"],"names":[],"mappings":";;;;;AAOA,MAAM,eAAe,GAAG,iCAAiC;AAMzD;;;;;;;;;AASG;MAIU,6BAA6B,CAAA;AAH1C,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC/C,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AA0C5D,IAAA;AAxCC,IAAA,MAAM,OAAO,GAAA;QACX,IAAI,SAAS,GAAkB,IAAI;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE;QAE3C,IAAI,MAAM,EAAE;AACV,YAAA,IAAI;gBACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,EAAE;AA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
1
+ {"version":3,"file":"acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs","sources":["../../../../libs/connectivity/mock/src/lib/workflow-management/activities/get-current-user-manager.activity.ts"],"sourcesContent":["import { AXPCommand } from '@acorex/platform/runtime-contracts';\nimport { inject, Injectable } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/contracts';\n\nimport { AXPEntityStorageService } from '@acorex/platform/layout/entity';\nimport { AXPSessionService } from '@acorex/platform/auth';\n\nconst EMPLOYEE_ENTITY = 'HumanCapitalManagement.Employee';\n\nexport interface GetCurrentUserManagerOutput {\n managerId: string | null;\n}\n\n/**\n * Get Current User Manager Activity (Backend - Mock)\n *\n * Resolves the manager of the current user (Employee → managerId → manager's userId).\n * Use when assigning a review task to the current user's manager (e.g. questionnaire review)\n * without a leave request or other ref entity.\n *\n * Execution Mode: backend\n * Activity Type: workflow-activity:get-current-user-manager\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class GetCurrentUserManagerActivity implements AXPCommand<Record<string, never>, GetCurrentUserManagerOutput> {\n private readonly entityStorage = inject(AXPEntityStorageService);\n private readonly sessionService = inject(AXPSessionService);\n\n async execute(): Promise<AXPExecuteCommandResult<GetCurrentUserManagerOutput>> {\n let managerId: string | null = null;\n const userId = this.sessionService.user?.id;\n\n if (userId) {\n try {\n const result = await this.entityStorage.query(EMPLOYEE_ENTITY, {\n skip: 0,\n take: 1,\n filter: {\n field: 'userId',\n operator: { type: 'equal' },\n value: userId,\n },\n });\n const employees = result.items as { id: string; managerId?: string | null }[] | undefined;\n const employee = employees?.[0];\n const managerEmployeeId = employee?.managerId;\n\n if (managerEmployeeId) {\n const managerEmp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, managerEmployeeId)) as {\n userId?: string;\n } | null;\n managerId = managerEmp?.userId ?? managerEmployeeId;\n }\n } catch {\n // keep managerId null\n }\n }\n\n return {\n success: true,\n data: {\n managerId,\n },\n metadata: {\n outcome: 'Done',\n },\n };\n }\n}\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YAAA,QAAQ,EAAE;AACR,gBAAA,OAAO,EAAE,MAAM;AAChB,aAAA;SACF;IACH;8GA3CW,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA7B,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,6BAA6B,cAF5B,MAAM,EAAA,CAAA,CAAA;;2FAEP,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAHzC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-connectivity-mock-get-employee-list.query-BWbZj3tp.mjs","sources":["../../../../libs/connectivity/mock/src/lib/report-management/samples/get-employee-list.query.ts"],"sourcesContent":["import { AXPQuerySort } from '@acorex/platform/layout/entity-contracts';\nimport { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMHumanCapitalManagementEmployeeEntityModel } from '@acorex/modules/human-capital-management';\nimport { RootConfig as HumanCapitalRootConfig } from '@acorex/modules/human-capital-management';\n\nimport { AXPReportSummaryOptions } from '@acorex/modules/report-management';\nimport { computeReportFooterSummary } from '../report-summary.util';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetEmployeeListQueryInput {\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 EmployeeByDepartmentResult {\n departmentId: string;\n departmentTitle: string;\n teamId?: string;\n teamTitle?: string;\n employeeCount: number;\n employmentTypes: string;\n averageExperience: number;\n totalEmployees: number;\n}\n\nexport interface GetEmployeeListQueryResult {\n items: EmployeeByDepartmentResult[];\n total: number;\n summary?: Record<string, number | null>;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetEmployeeListQuery implements AXPQuery<GetEmployeeListQueryInput, GetEmployeeListQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private employeeService = this.entityService\n .withEntity(`${HumanCapitalRootConfig.module.name}.${HumanCapitalRootConfig.entities.employee.name}`)\n .data<string, AXMHumanCapitalManagementEmployeeEntityModel>();\n\n async fetch(input: GetEmployeeListQueryInput | any): Promise<GetEmployeeListQueryResult> {\n // Extract employee-specific filters from AXPFilterClause format\n const extractedFilters = this.extractEmployeeFilters(input.filters);\n\n // Separate custom filters from entity filters\n const entityFilters: GetEmployeeListQueryInput['filters'] = [];\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n entityFilters.push(filter);\n }\n }\n\n // Get all employees from storage with entity filters\n const allEmployeesResult = await this.employeeService.query({\n skip: 0,\n take: 10000, // Get all employees 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 const allEmployees = allEmployeesResult.items;\n\n // Group employees by department and team\n const departmentGroups = new Map<string, Map<string, AXMHumanCapitalManagementEmployeeEntityModel[]>>();\n\n for (const employee of allEmployees) {\n // Get department from position (assuming position has departmentId)\n const departmentId = (employee as any).position?.departmentId || (employee as any).departmentId || 'unknown';\n const departmentTitle = (employee as any).position?.department?.title || 'Unknown Department';\n\n // Get team from team memberships (assuming employee has teamId or teamMemberships)\n const teamId = (employee as any).teamId || (employee as any).teamMemberships?.[0]?.teamId || undefined;\n const teamTitle = (employee as any).team?.title || (employee as any).teamMemberships?.[0]?.team?.title || undefined;\n\n const teamKey = teamId || 'no-team';\n\n if (!departmentGroups.has(departmentId)) {\n departmentGroups.set(departmentId, new Map());\n }\n\n const teamMap = departmentGroups.get(departmentId)!;\n if (!teamMap.has(teamKey)) {\n teamMap.set(teamKey, []);\n }\n\n teamMap.get(teamKey)!.push(employee);\n }\n\n // Aggregate data by department and team\n const aggregatedResults: EmployeeByDepartmentResult[] = [];\n\n for (const [departmentId, teamMap] of departmentGroups.entries()) {\n const firstEmployee = Array.from(teamMap.values())[0]?.[0];\n const departmentTitle = (firstEmployee as any)?.position?.department?.title || 'Unknown Department';\n\n for (const [teamKey, employees] of teamMap.entries()) {\n const teamId = teamKey !== 'no-team' ? teamKey : undefined;\n const teamTitle =\n teamKey !== 'no-team' ? (employees[0] as any)?.team?.title || (employees[0] as any)?.teamMemberships?.[0]?.team?.title : undefined;\n\n // Calculate average experience (years since hire date)\n const now = new Date();\n const experiences = employees\n .map((emp) => {\n if (!emp.hireDate) return 0;\n const hireDate = new Date(emp.hireDate);\n const diffTime = Math.abs(now.getTime() - hireDate.getTime());\n return diffTime / (1000 * 60 * 60 * 24 * 365.25); // Convert to years\n })\n .filter((exp) => exp > 0);\n\n const averageExperience = experiences.length > 0 ? experiences.reduce((sum, exp) => sum + exp, 0) / experiences.length : 0;\n\n // Get unique employment types\n const employmentTypeSet = new Set<string>();\n for (const employee of employees) {\n if ((employee as any).employmentType?.title) {\n employmentTypeSet.add((employee as any).employmentType.title);\n }\n }\n const employmentTypes = Array.from(employmentTypeSet).join(', ') || 'N/A';\n\n aggregatedResults.push({\n departmentId,\n departmentTitle,\n teamId,\n teamTitle,\n employeeCount: employees.length,\n employmentTypes,\n averageExperience: Number(averageExperience.toFixed(2)),\n totalEmployees: employees.length,\n });\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 EmployeeByDepartmentResult;\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 employee-specific filters from AXPFilterClause format\n * Maps report parameter paths to employee entity field names\n */\n private extractEmployeeFilters(parameters: any): GetEmployeeListQueryInput['filters'] {\n const filters: GetEmployeeListQueryInput['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 employee-specific field mappings\n if (field === 'department') {\n // Department filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'position.departmentId', // Assuming position has departmentId\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'position.departmentId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'team') {\n // Team filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'teamId', // Assuming employee has teamId or teamMemberships\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'teamId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'employmentType') {\n // Employment type filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'employmentTypeId',\n operator: { type: 'equal' },\n value: value,\n });\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"],"names":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;gBAEL,OAAO,CAAC,IAAI,CAAC;AACX,oBAAA,KAAK,EAAE,KAAK;AACZ,oBAAA,QAAQ,EAAE,QAAQ;AAClB,oBAAA,KAAK,EAAE,KAAK;AACb,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;8GA1NW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,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,oBAAoB,cAFnB,MAAM,EAAA,CAAA,CAAA;;2FAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
1
+ {"version":3,"file":"acorex-connectivity-mock-get-employee-list.query-BWbZj3tp.mjs","sources":["../../../../libs/connectivity/mock/src/lib/report-management/samples/get-employee-list.query.ts"],"sourcesContent":["import { AXPQuery } from '@acorex/platform/runtime-contracts';\nimport { AXPQuerySort } from '@acorex/platform/layout/entity-contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMHumanCapitalManagementEmployeeEntityModel } from '@acorex/modules/human-capital-management';\nimport { RootConfig as HumanCapitalRootConfig } from '@acorex/modules/human-capital-management';\n\nimport { AXPReportSummaryOptions } from '@acorex/modules/report-management';\nimport { computeReportFooterSummary } from '../report-summary.util';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetEmployeeListQueryInput {\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 EmployeeByDepartmentResult {\n departmentId: string;\n departmentTitle: string;\n teamId?: string;\n teamTitle?: string;\n employeeCount: number;\n employmentTypes: string;\n averageExperience: number;\n totalEmployees: number;\n}\n\nexport interface GetEmployeeListQueryResult {\n items: EmployeeByDepartmentResult[];\n total: number;\n summary?: Record<string, number | null>;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetEmployeeListQuery implements AXPQuery<GetEmployeeListQueryInput, GetEmployeeListQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private employeeService = this.entityService\n .withEntity(`${HumanCapitalRootConfig.module.name}.${HumanCapitalRootConfig.entities.employee.name}`)\n .data<string, AXMHumanCapitalManagementEmployeeEntityModel>();\n\n async fetch(input: GetEmployeeListQueryInput | any): Promise<GetEmployeeListQueryResult> {\n // Extract employee-specific filters from AXPFilterClause format\n const extractedFilters = this.extractEmployeeFilters(input.filters);\n\n // Separate custom filters from entity filters\n const entityFilters: GetEmployeeListQueryInput['filters'] = [];\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n entityFilters.push(filter);\n }\n }\n\n // Get all employees from storage with entity filters\n const allEmployeesResult = await this.employeeService.query({\n skip: 0,\n take: 10000, // Get all employees 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 const allEmployees = allEmployeesResult.items;\n\n // Group employees by department and team\n const departmentGroups = new Map<string, Map<string, AXMHumanCapitalManagementEmployeeEntityModel[]>>();\n\n for (const employee of allEmployees) {\n // Get department from position (assuming position has departmentId)\n const departmentId = (employee as any).position?.departmentId || (employee as any).departmentId || 'unknown';\n const departmentTitle = (employee as any).position?.department?.title || 'Unknown Department';\n\n // Get team from team memberships (assuming employee has teamId or teamMemberships)\n const teamId = (employee as any).teamId || (employee as any).teamMemberships?.[0]?.teamId || undefined;\n const teamTitle = (employee as any).team?.title || (employee as any).teamMemberships?.[0]?.team?.title || undefined;\n\n const teamKey = teamId || 'no-team';\n\n if (!departmentGroups.has(departmentId)) {\n departmentGroups.set(departmentId, new Map());\n }\n\n const teamMap = departmentGroups.get(departmentId)!;\n if (!teamMap.has(teamKey)) {\n teamMap.set(teamKey, []);\n }\n\n teamMap.get(teamKey)!.push(employee);\n }\n\n // Aggregate data by department and team\n const aggregatedResults: EmployeeByDepartmentResult[] = [];\n\n for (const [departmentId, teamMap] of departmentGroups.entries()) {\n const firstEmployee = Array.from(teamMap.values())[0]?.[0];\n const departmentTitle = (firstEmployee as any)?.position?.department?.title || 'Unknown Department';\n\n for (const [teamKey, employees] of teamMap.entries()) {\n const teamId = teamKey !== 'no-team' ? teamKey : undefined;\n const teamTitle =\n teamKey !== 'no-team' ? (employees[0] as any)?.team?.title || (employees[0] as any)?.teamMemberships?.[0]?.team?.title : undefined;\n\n // Calculate average experience (years since hire date)\n const now = new Date();\n const experiences = employees\n .map((emp) => {\n if (!emp.hireDate) return 0;\n const hireDate = new Date(emp.hireDate);\n const diffTime = Math.abs(now.getTime() - hireDate.getTime());\n return diffTime / (1000 * 60 * 60 * 24 * 365.25); // Convert to years\n })\n .filter((exp) => exp > 0);\n\n const averageExperience = experiences.length > 0 ? experiences.reduce((sum, exp) => sum + exp, 0) / experiences.length : 0;\n\n // Get unique employment types\n const employmentTypeSet = new Set<string>();\n for (const employee of employees) {\n if ((employee as any).employmentType?.title) {\n employmentTypeSet.add((employee as any).employmentType.title);\n }\n }\n const employmentTypes = Array.from(employmentTypeSet).join(', ') || 'N/A';\n\n aggregatedResults.push({\n departmentId,\n departmentTitle,\n teamId,\n teamTitle,\n employeeCount: employees.length,\n employmentTypes,\n averageExperience: Number(averageExperience.toFixed(2)),\n totalEmployees: employees.length,\n });\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 EmployeeByDepartmentResult;\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 employee-specific filters from AXPFilterClause format\n * Maps report parameter paths to employee entity field names\n */\n private extractEmployeeFilters(parameters: any): GetEmployeeListQueryInput['filters'] {\n const filters: GetEmployeeListQueryInput['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 employee-specific field mappings\n if (field === 'department') {\n // Department filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'position.departmentId', // Assuming position has departmentId\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'position.departmentId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'team') {\n // Team filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'teamId', // Assuming employee has teamId or teamMemberships\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'teamId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'employmentType') {\n // Employment type filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'employmentTypeId',\n operator: { type: 'equal' },\n value: value,\n });\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"],"names":["HumanCapitalRootConfig"],"mappings":";;;;;;AA2CA;MAKa,oBAAoB,CAAA;AAHjC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,eAAe,GAAG,IAAI,CAAC;AAC5B,aAAA,UAAU,CAAC,CAAA,EAAGA,UAAsB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,UAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;AACnG,aAAA,IAAI,EAAwD;AAyNhE,IAAA;IAvNC,MAAM,KAAK,CAAC,KAAsC,EAAA;;QAEhD,MAAM,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC;;QAGnE,MAAM,aAAa,GAAyC,EAAE;QAE9D,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;AACnD,YAAA,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE;AACrC,gBAAA,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;YAC5B;QACF;;QAGA,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;AAC1D,YAAA,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,KAAK;AACX,YAAA,MAAM,EACJ,aAAa,CAAC,MAAM,GAAG;AACrB,kBAAG;AACC,oBAAA,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,KAAK;AAC3B,oBAAA,OAAO,EAAE,aAAa;AACf;AACX,kBAAE,SAAS;AAChB,SAAA,CAAC;AAEF,QAAA,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK;;AAG7C,QAAA,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAuE;AAEvG,Q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,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;AAC3B,wBAAA,KAAK,EAAE,KAAK;AACb,qBAAA,CAAC;gBACJ;YACF;iBAAO;;gBAEL,OAAO,CAAC,IAAI,CAAC;AACX,oBAAA,KAAK,EAAE,KAAK;AACZ,oBAAA,QAAQ,EAAE,QAAQ;AAClB,oBAAA,KAAK,EAAE,KAAK;AACb,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;8GA1NW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,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,oBAAoB,cAFnB,MAAM,EAAA,CAAA,CAAA;;2FAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-connectivity-mock-get-location-list.query-CQ2rFDUM.mjs","sources":["../../../../libs/connectivity/mock/src/lib/report-management/samples/get-location-list.query.ts"],"sourcesContent":["import { AXPQuerySort } from '@acorex/platform/layout/entity-contracts';\nimport { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMLocationManagementLocationEntityModel } from '@acorex/modules/location-management';\nimport { RootConfig as LocationRootConfig } from '@acorex/modules/location-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetLocationListQueryInput {\n skip?: number;\n take?: number;\n sort?: AXPQuerySort[];\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface LocationByCityResult {\n countryId?: string;\n countryTitle?: string;\n provinceId?: string;\n provinceTitle?: string;\n cityId?: string;\n cityTitle?: string;\n locationCount: number;\n totalLocations: number;\n}\n\nexport interface GetLocationListQueryResult {\n items: LocationByCityResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetLocationListQuery implements AXPQuery<GetLocationListQueryInput, GetLocationListQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private locationService = this.entityService\n .withEntity(`${LocationRootConfig.module.name}.${LocationRootConfig.entities.location.name}`)\n .data<string, AXMLocationManagementLocationEntityModel>();\n\n async fetch(input: GetLocationListQueryInput | any): Promise<GetLocationListQueryResult> {\n // Extract location-specific filters from AXPFilterClause format\n const extractedFilters = this.extractLocationFilters(input.filters);\n // Separate custom filters from entity filters\n const entityFilters: GetLocationListQueryInput['filters'] = [];\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n entityFilters.push(filter);\n }\n }\n // Get all locations from storage with entity filters\n const allLocationsResult = await this.locationService.query({\n skip: 0,\n take: 10000, // Get all locations 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 const allLocations = allLocationsResult.items;\n\n // Group locations by country, province, and city\n const locationGroups = new Map<string, Map<string, Map<string, AXMLocationManagementLocationEntityModel[]>>>();\n\n for (const location of allLocations) {\n // Get geographic information\n const countryId = (location as any).countryId || 'unknown';\n const countryTitle = (location as any).country?.title || 'Unknown Country';\n\n const provinceId = (location as any).stateId || 'unknown';\n const provinceTitle = (location as any).state?.title || 'Unknown Province';\n\n const cityId = (location as any).cityId || 'unknown';\n const cityTitle = (location as any).city?.title || 'Unknown City';\n\n // Create nested map structure: country -> province -> city -> locations[]\n if (!locationGroups.has(countryId)) {\n locationGroups.set(countryId, new Map());\n }\n\n const provinceMap = locationGroups.get(countryId)!;\n if (!provinceMap.has(provinceId)) {\n provinceMap.set(provinceId, new Map());\n }\n\n const cityMap = provinceMap.get(provinceId)!;\n if (!cityMap.has(cityId)) {\n cityMap.set(cityId, []);\n }\n\n cityMap.get(cityId)!.push(location);\n }\n\n // Aggregate data by country, province, and city\n const aggregatedResults: LocationByCityResult[] = [];\n\n for (const [countryId, provinceMap] of locationGroups.entries()) {\n const firstLocation = Array.from(provinceMap.values())[0]?.values().next().value?.[0];\n const countryTitle = (firstLocation as any)?.country?.title || 'Unknown Country';\n\n for (const [provinceId, cityMap] of provinceMap.entries()) {\n const firstLocationInProvince = cityMap.values().next().value?.[0];\n const provinceTitle = (firstLocationInProvince as any)?.state?.title || 'Unknown Province';\n\n for (const [cityId, locations] of cityMap.entries()) {\n const cityTitle = (locations[0] as any)?.city?.title || 'Unknown City';\n\n aggregatedResults.push({\n countryId,\n countryTitle,\n provinceId,\n provinceTitle,\n cityId,\n cityTitle,\n locationCount: locations.length,\n totalLocations: locations.length,\n });\n }\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 LocationByCityResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n // Handle undefined values\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 // Apply pagination\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 };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract location-specific filters from AXPFilterClause format\n * Maps report parameter paths to location entity field names\n */\n private extractLocationFilters(parameters: any): GetLocationListQueryInput['filters'] {\n const filters: GetLocationListQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n console.log('⚠️ [extractLocationFilters] No filters array found or not an array');\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 location-specific field mappings\n if (field === 'country') {\n // Country filter\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'countryId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'countryId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'province') {\n // Province/State filter\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'stateId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'stateId',\n operator: { type: 'equal' },\n value: value,\n });\n console.log('✅ [extractLocationFilters] Added province filter (equal):', value);\n }\n } else if (field === 'city') {\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'cityId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'cityId',\n operator: { type: 'equal' },\n value: value,\n });\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"],"names":["LocationRootConfig"],"mappings":";;;;;AAqCA;MAKa,oBAAoB,CAAA;AAHjC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,eAAe,GAAG,IAAI,CAAC;AAC5B,aAAA,UAAU,CAAC,CAAA,EAAGA,UAAkB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,UAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;AAC3F,aAAA,IAAI,EAAoD;AA6M5D,IAAA;IA3MC,MAAM,KAAK,CAAC,KAAsC,EAAA;;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AE,QAAQ;AACf,wBAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;AAC3B,wBAAA,KAAK,EAAE,KAAK;AACb,qBAAA,CAAC;gBACJ;YACF;iBAAO;;gBAEL,OAAO,CAAC,IAAI,CAAC;AACX,oBAAA,KAAK,EAAE,KAAK;AACZ,oBAAA,QAAQ,EAAE,QAAQ;AAClB,oBAAA,KAAK,EAAE,KAAK;AACb,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;8GA9MW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,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,oBAAoB,cAFnB,MAAM,EAAA,CAAA,CAAA;;2FAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
1
+ {"version":3,"file":"acorex-connectivity-mock-get-location-list.query-CQ2rFDUM.mjs","sources":["../../../../libs/connectivity/mock/src/lib/report-management/samples/get-location-list.query.ts"],"sourcesContent":["import { AXPQuery } from '@acorex/platform/runtime-contracts';\nimport { AXPQuerySort } from '@acorex/platform/layout/entity-contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMLocationManagementLocationEntityModel } from '@acorex/modules/location-management';\nimport { RootConfig as LocationRootConfig } from '@acorex/modules/location-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetLocationListQueryInput {\n skip?: number;\n take?: number;\n sort?: AXPQuerySort[];\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface LocationByCityResult {\n countryId?: string;\n countryTitle?: string;\n provinceId?: string;\n provinceTitle?: string;\n cityId?: string;\n cityTitle?: string;\n locationCount: number;\n totalLocations: number;\n}\n\nexport interface GetLocationListQueryResult {\n items: LocationByCityResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetLocationListQuery implements AXPQuery<GetLocationListQueryInput, GetLocationListQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private locationService = this.entityService\n .withEntity(`${LocationRootConfig.module.name}.${LocationRootConfig.entities.location.name}`)\n .data<string, AXMLocationManagementLocationEntityModel>();\n\n async fetch(input: GetLocationListQueryInput | any): Promise<GetLocationListQueryResult> {\n // Extract location-specific filters from AXPFilterClause format\n const extractedFilters = this.extractLocationFilters(input.filters);\n // Separate custom filters from entity filters\n const entityFilters: GetLocationListQueryInput['filters'] = [];\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n entityFilters.push(filter);\n }\n }\n // Get all locations from storage with entity filters\n const allLocationsResult = await this.locationService.query({\n skip: 0,\n take: 10000, // Get all locations 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 const allLocations = allLocationsResult.items;\n\n // Group locations by country, province, and city\n const locationGroups = new Map<string, Map<string, Map<string, AXMLocationManagementLocationEntityModel[]>>>();\n\n for (const location of allLocations) {\n // Get geographic information\n const countryId = (location as any).countryId || 'unknown';\n const countryTitle = (location as any).country?.title || 'Unknown Country';\n\n const provinceId = (location as any).stateId || 'unknown';\n const provinceTitle = (location as any).state?.title || 'Unknown Province';\n\n const cityId = (location as any).cityId || 'unknown';\n const cityTitle = (location as any).city?.title || 'Unknown City';\n\n // Create nested map structure: country -> province -> city -> locations[]\n if (!locationGroups.has(countryId)) {\n locationGroups.set(countryId, new Map());\n }\n\n const provinceMap = locationGroups.get(countryId)!;\n if (!provinceMap.has(provinceId)) {\n provinceMap.set(provinceId, new Map());\n }\n\n const cityMap = provinceMap.get(provinceId)!;\n if (!cityMap.has(cityId)) {\n cityMap.set(cityId, []);\n }\n\n cityMap.get(cityId)!.push(location);\n }\n\n // Aggregate data by country, province, and city\n const aggregatedResults: LocationByCityResult[] = [];\n\n for (const [countryId, provinceMap] of locationGroups.entries()) {\n const firstLocation = Array.from(provinceMap.values())[0]?.values().next().value?.[0];\n const countryTitle = (firstLocation as any)?.country?.title || 'Unknown Country';\n\n for (const [provinceId, cityMap] of provinceMap.entries()) {\n const firstLocationInProvince = cityMap.values().next().value?.[0];\n const provinceTitle = (firstLocationInProvince as any)?.state?.title || 'Unknown Province';\n\n for (const [cityId, locations] of cityMap.entries()) {\n const cityTitle = (locations[0] as any)?.city?.title || 'Unknown City';\n\n aggregatedResults.push({\n countryId,\n countryTitle,\n provinceId,\n provinceTitle,\n cityId,\n cityTitle,\n locationCount: locations.length,\n totalLocations: locations.length,\n });\n }\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 LocationByCityResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n // Handle undefined values\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 // Apply pagination\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 };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract location-specific filters from AXPFilterClause format\n * Maps report parameter paths to location entity field names\n */\n private extractLocationFilters(parameters: any): GetLocationListQueryInput['filters'] {\n const filters: GetLocationListQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n console.log('⚠️ [extractLocationFilters] No filters array found or not an array');\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 location-specific field mappings\n if (field === 'country') {\n // Country filter\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'countryId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'countryId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'province') {\n // Province/State filter\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'stateId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'stateId',\n operator: { type: 'equal' },\n value: value,\n });\n console.log('✅ [extractLocationFilters] Added province filter (equal):', value);\n }\n } else if (field === 'city') {\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'cityId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'cityId',\n operator: { type: 'equal' },\n value: value,\n });\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"],"names":["LocationRootConfig"],"mappings":";;;;;AAsCA;MAKa,oBAAoB,CAAA;AAHjC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,eAAe,GAAG,IAAI,CAAC;AAC5B,aAAA,UAAU,CAAC,CAAA,EAAGA,UAAkB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,UAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;AAC3F,aAAA,IAAI,EAAoD;AA6M5D,IAAA;IA3MC,MAAM,KAAK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;AACX,wBAAA,KAAK,EAAE,QAAQ;AACf,wBAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;AAC3B,wBAAA,KAAK,EAAE,KAAK;AACb,qBAAA,CAAC;gBACJ;YACF;iBAAO;;gBAEL,OAAO,CAAC,IAAI,CAAC;AACX,oBAAA,KAAK,EAAE,KAAK;AACZ,oBAAA,QAAQ,EAAE,QAAQ;AAClB,oBAAA,KAAK,EAAE,KAAK;AACb,iBAAA,CAAC;YACJ;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;8GA9MW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,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,oBAAoB,cAFnB,MAAM,EAAA,CAAA,CAAA;;2FAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-connectivity-mock-get-product-chart-data.query-D7DBzLT-.mjs","sources":["../../../../libs/connectivity/mock/src/lib/product-catalog/reports/get-product-chart-data.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMProductCatalogProductEntityModel } from '@acorex/modules/product-catalog';\nimport { RootConfig } from '@acorex/modules/product-catalog';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetProductChartDataQueryInput {\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface ProductChartDataResult {\n brand: string;\n productCount: number;\n}\n\nexport interface GetProductChartDataQueryResult {\n items: ProductChartDataResult[];\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetProductChartDataQuery implements AXPQuery<GetProductChartDataQueryInput, GetProductChartDataQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private productService = this.entityService.withEntity(`${RootConfig.module.name}.${RootConfig.entities.product.name}`).data<string, AXMProductCatalogProductEntityModel>();\n\n async fetch(input: GetProductChartDataQueryInput | any): Promise<GetProductChartDataQueryResult> {\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: GetProductChartDataQueryInput['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 (no pagination for charts)\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 for chart\n const chartResults: ProductChartDataResult[] = [];\n\n for (const [brandName, products] of brandGroups.entries()) {\n chartResults.push({\n brand: brandName,\n productCount: products.length,\n });\n }\n\n return {\n items: chartResults,\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): GetProductChartDataQueryInput['filters'] {\n const filters: GetProductChartDataQueryInput['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\n"],"names":[],"mappings":";;;;;AA0BA;MAKa,wBAAwB,CAAA;AAHrC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAA,CAAE,CAAC,CAAC,IAAI,EAA+C;AA0L5K,IAAA;IAxLC,MAAM,KAAK,CAAC,KAA0C,EAAA;;QAEpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC;;QAGlE,MAAM,aAAa,GAA6C,EAAE;AAClE,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,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;AACxD,YAAA,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,KAAK;AACX,YAAA,MAAM,EACJ,aAAa,CAAC,MAAM,GAAG;AACrB,kBAAG;AACD,oBAAA,KAAK,EAAE,KAAK,CAAC,K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b,OAAO,KAAK,GAAG,EAAE;AACnB,gBAAA,KAAK,QAAQ;AACX,oBAAA,OAAO,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,GAAG;AACnC,gBAAA,KAAK,SAAS;AACZ,oBAAA,OAAO,KAAK,IAAI,GAAG,IAAI,KAAK,GAAG,GAAG;AACpC,gBAAA,KAAK,UAAU;AACb,oBAAA,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;8GAzLW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,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,wBAAwB,cAFvB,MAAM,EAAA,CAAA,CAAA;;2FAEP,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAHpC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
1
+ {"version":3,"file":"acorex-connectivity-mock-get-product-chart-data.query-D7DBzLT-.mjs","sources":["../../../../libs/connectivity/mock/src/lib/product-catalog/reports/get-product-chart-data.query.ts"],"sourcesContent":["import { AXPQuery } from '@acorex/platform/runtime-contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMProductCatalogProductEntityModel } from '@acorex/modules/product-catalog';\nimport { RootConfig } from '@acorex/modules/product-catalog';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetProductChartDataQueryInput {\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface ProductChartDataResult {\n brand: string;\n productCount: number;\n}\n\nexport interface GetProductChartDataQueryResult {\n items: ProductChartDataResult[];\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetProductChartDataQuery implements AXPQuery<GetProductChartDataQueryInput, GetProductChartDataQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private productService = this.entityService.withEntity(`${RootConfig.module.name}.${RootConfig.entities.product.name}`).data<string, AXMProductCatalogProductEntityModel>();\n\n async fetch(input: GetProductChartDataQueryInput | any): Promise<GetProductChartDataQueryResult> {\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: GetProductChartDataQueryInput['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 (no pagination for charts)\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 for chart\n const chartResults: ProductChartDataResult[] = [];\n\n for (const [brandName, products] of brandGroups.entries()) {\n chartResults.push({\n brand: brandName,\n productCount: products.length,\n });\n }\n\n return {\n items: chartResults,\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): GetProductChartDataQueryInput['filters'] {\n const filters: GetProductChartDataQueryInput['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\n"],"names":[],"mappings":";;;;;AA2BA;MAKa,wBAAwB,CAAA;AAHrC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAA,CAAE,CAAC,CAAC,IAAI,EAA+C;AA0L5K,IAAA;IAxLC,MAAM,KAAK,CAAC,KAA0C,EAAA;;QAEpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC;;QAGlE,MAAM,aAAa,GAA6C,EAAE;AAClE,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,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;AACxD,YAAA,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,KAAK;AACX,YAAA,MAAM,EACJ,aAAa,CAAC,M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IAAI,CAAC;YAEpC,QAAQ,UAAU;AAChB,gBAAA,KAAK,UAAU;oBACb,OAAO,KAAK,GAAG,EAAE;AACnB,gBAAA,KAAK,QAAQ;AACX,oBAAA,OAAO,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,GAAG;AACnC,gBAAA,KAAK,SAAS;AACZ,oBAAA,OAAO,KAAK,IAAI,GAAG,IAAI,KAAK,GAAG,GAAG;AACpC,gBAAA,KAAK,UAAU;AACb,oBAAA,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;8GAzLW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,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,wBAAwB,cAFvB,MAAM,EAAA,CAAA,CAAA;;2FAEP,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAHpC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
@@ -1 +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 { AXPQuerySort } from '@acorex/platform/layout/entity-contracts';\nimport { resolveMultiLanguageString } from '@acorex/platform/contracts';\n\nimport { AXPReportSummaryOptions } from '@acorex/modules/report-management';\nimport { AXMProductCatalogProductEntityModel, RootConfig } from '@acorex/modules/product-catalog';\n\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":";;;;;;;AA6CA;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,MA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AAK,GAAG,EAAE;AACnB,gBAAA,KAAK,QAAQ;AACX,oBAAA,OAAO,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,GAAG;AACnC,gBAAA,KAAK,SAAS;AACZ,oBAAA,OAAO,KAAK,IAAI,GAAG,IAAI,KAAK,GAAG,GAAG;AACpC,gBAAA,KAAK,UAAU;AACb,oBAAA,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
+ {"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 { AXPQuery } from '@acorex/platform/runtime-contracts';\nimport { AXPQuerySort } from '@acorex/platform/layout/entity-contracts';\nimport { resolveMultiLanguageString } from '@acorex/platform/contracts';\n\nimport { AXPReportSummaryOptions } from '@acorex/modules/report-management';\nimport { AXMProductCatalogProductEntityModel, RootConfig } from '@acorex/modules/product-catalog';\n\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\n\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":";;;;;;;AA8CA;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,YAA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E,IAAI,KAAK,GAAG,GAAG;AACnC,gBAAA,KAAK,SAAS;AACZ,oBAAA,OAAO,KAAK,IAAI,GAAG,IAAI,KAAK,GAAG,GAAG;AACpC,gBAAA,KAAK,UAAU;AACb,oBAAA,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 +1 @@
1
- {"version":3,"file":"acorex-connectivity-mock-get-product-pdf-data.query-DUZvwsmY.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,SAAS;AACjB,YAAA,QAAQ,EAAE,CAAA,eAAA,EAAkB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA,IAAA,CAAM;SAC3E;IACL;;AAIA;;;AAGG;AACK,IAAA,qBAAqB,CAAC,UAAe,EAAA;QACzC,MAAM,OAAO,GAAwC,EAAE;QACvD,MAAM,SAAS,GAAG,UAAiB;AAEnC,QAAA,IAAI,CAAC,SAAS,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;AAC1D,YAAA,OAAO,OAAO;Q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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
+ {"version":3,"file":"acorex-connectivity-mock-get-product-pdf-data.query-DUZvwsmY.mjs","sources":["../../../../libs/connectivity/mock/src/lib/product-catalog/reports/get-product-pdf-data.query.ts"],"sourcesContent":["import { AXPQuery } from '@acorex/platform/runtime-contracts';\nimport { inject, Injectable } from '@angular/core';\n\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 00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;;;;;;;;;;;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 +1 @@
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,MAA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MAAM;AACxB,QAAA,CAAC,CAAC;QAEF,OAAO;AACL,YAAA,KAAK,EAAE,OAAO;SACf;IACH;8GA5CW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,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
+ {"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 { AXPQuery } from '@acorex/platform/runtime-contracts';\nimport { inject, Injectable } from '@angular/core';\n\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":";;;;AA4BA;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,IAAI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