@acorex-platform/module-report-management-server 0.0.18 → 2.0.0-beta.1

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 (194) hide show
  1. package/contracts/src/commands.keys.d.ts +13 -0
  2. package/contracts/src/commands.keys.js +19 -0
  3. package/contracts/src/commands.keys.js.map +1 -0
  4. package/contracts/src/entities/index.d.ts +1 -0
  5. package/contracts/src/entities/index.js +1 -0
  6. package/contracts/src/entities/index.js.map +1 -1
  7. package/contracts/src/entities/report/index.d.ts +1 -1
  8. package/contracts/src/entities/report/index.js +1 -1
  9. package/contracts/src/entities/report/index.js.map +1 -1
  10. package/contracts/src/entities/report/report.entity.js +180 -12
  11. package/contracts/src/entities/report/report.entity.js.map +1 -1
  12. package/contracts/src/entities/report-category/index.d.ts +1 -1
  13. package/contracts/src/entities/report-category/index.js +0 -2
  14. package/contracts/src/entities/report-category/index.js.map +1 -1
  15. package/contracts/src/entities/report-category/report-category.entity.js +14 -1
  16. package/contracts/src/entities/report-category/report-category.entity.js.map +1 -1
  17. package/contracts/src/entities/report-generation-request/index.d.ts +1 -0
  18. package/contracts/src/entities/report-generation-request/index.js +5 -0
  19. package/contracts/src/entities/report-generation-request/index.js.map +1 -0
  20. package/contracts/src/entities/report-generation-request/report-generation-request.entity.d.ts +2 -0
  21. package/contracts/src/entities/report-generation-request/report-generation-request.entity.js +208 -0
  22. package/contracts/src/entities/report-generation-request/report-generation-request.entity.js.map +1 -0
  23. package/contracts/src/entity-catalog.d.ts +7 -0
  24. package/contracts/src/entity-catalog.js +22 -0
  25. package/contracts/src/entity-catalog.js.map +1 -0
  26. package/contracts/src/entity-entry.report-category.d.ts +1 -0
  27. package/contracts/src/entity-entry.report-category.js +6 -0
  28. package/contracts/src/entity-entry.report-category.js.map +1 -0
  29. package/contracts/src/entity-entry.report-generation-request.d.ts +1 -0
  30. package/contracts/src/entity-entry.report-generation-request.js +6 -0
  31. package/contracts/src/entity-entry.report-generation-request.js.map +1 -0
  32. package/contracts/src/entity-entry.report.d.ts +1 -0
  33. package/contracts/src/entity-entry.report.js +6 -0
  34. package/contracts/src/entity-entry.report.js.map +1 -0
  35. package/contracts/src/index.d.ts +18 -1
  36. package/contracts/src/index.js +18 -1
  37. package/contracts/src/index.js.map +1 -1
  38. package/contracts/src/manifest.d.ts +6 -0
  39. package/contracts/src/manifest.js +24 -0
  40. package/contracts/src/manifest.js.map +1 -0
  41. package/contracts/src/permission.keys.d.ts +30 -14
  42. package/contracts/src/permission.keys.js +28 -12
  43. package/contracts/src/permission.keys.js.map +1 -1
  44. package/contracts/src/query-cache-targets.d.ts +5 -0
  45. package/contracts/src/query-cache-targets.js +113 -0
  46. package/contracts/src/query-cache-targets.js.map +1 -0
  47. package/contracts/src/report-filter-form.util.d.ts +20 -0
  48. package/contracts/src/report-filter-form.util.js +121 -0
  49. package/contracts/src/report-filter-form.util.js.map +1 -0
  50. package/contracts/src/report-generation.types.d.ts +97 -0
  51. package/contracts/src/report-generation.types.js +14 -0
  52. package/contracts/src/report-generation.types.js.map +1 -0
  53. package/contracts/src/report-interchange.projection.d.ts +22 -0
  54. package/contracts/src/report-interchange.projection.js +171 -0
  55. package/contracts/src/report-interchange.projection.js.map +1 -0
  56. package/contracts/src/report-interchange.snapshot.d.ts +12 -0
  57. package/contracts/src/report-interchange.snapshot.js +34 -0
  58. package/contracts/src/report-interchange.snapshot.js.map +1 -0
  59. package/contracts/src/report-interchange.types.d.ts +38 -0
  60. package/contracts/src/report-interchange.types.js +4 -0
  61. package/contracts/src/report-interchange.types.js.map +1 -0
  62. package/contracts/src/report-layout-field-schema.d.ts +64 -0
  63. package/contracts/src/report-layout-field-schema.js +294 -0
  64. package/contracts/src/report-layout-field-schema.js.map +1 -0
  65. package/contracts/src/report-layout-form.util.d.ts +67 -0
  66. package/contracts/src/report-layout-form.util.js +578 -0
  67. package/contracts/src/report-layout-form.util.js.map +1 -0
  68. package/contracts/src/report-layout-json-sections.d.ts +15 -0
  69. package/contracts/src/report-layout-json-sections.js +38 -0
  70. package/contracts/src/report-layout-json-sections.js.map +1 -0
  71. package/contracts/src/report-layout-sections.mapper.d.ts +37 -0
  72. package/contracts/src/report-layout-sections.mapper.js +306 -0
  73. package/contracts/src/report-layout-sections.mapper.js.map +1 -0
  74. package/contracts/src/report-layout-starter.d.ts +15 -0
  75. package/contracts/src/report-layout-starter.js +93 -0
  76. package/contracts/src/report-layout-starter.js.map +1 -0
  77. package/contracts/src/report-layout.presets.d.ts +17 -0
  78. package/contracts/src/report-layout.presets.js +72 -0
  79. package/contracts/src/report-layout.presets.js.map +1 -0
  80. package/contracts/src/report-parameter-binding.util.d.ts +8 -0
  81. package/contracts/src/report-parameter-binding.util.js +29 -0
  82. package/contracts/src/report-parameter-binding.util.js.map +1 -0
  83. package/contracts/src/report.types.d.ts +125 -107
  84. package/contracts/src/report.types.js.map +1 -1
  85. package/contracts/src/root-config.d.ts +9 -2
  86. package/contracts/src/root-config.js +9 -2
  87. package/contracts/src/root-config.js.map +1 -1
  88. package/contracts/src/runtime.keys.d.ts +14 -0
  89. package/contracts/src/runtime.keys.js +20 -0
  90. package/contracts/src/runtime.keys.js.map +1 -0
  91. package/contracts/src/settings.keys.d.ts +11 -0
  92. package/contracts/src/settings.keys.js +17 -0
  93. package/contracts/src/settings.keys.js.map +1 -0
  94. package/package.json +9 -7
  95. package/server/src/index.d.ts +4 -4
  96. package/server/src/index.js +9 -8
  97. package/server/src/index.js.map +1 -1
  98. package/server/src/lib/entities/index.d.ts +1 -0
  99. package/server/src/lib/entities/index.js +5 -0
  100. package/server/src/lib/entities/index.js.map +1 -0
  101. package/server/src/lib/entities/report-management.entity-catalog.d.ts +1 -0
  102. package/server/src/lib/entities/report-management.entity-catalog.js +12 -0
  103. package/server/src/lib/entities/report-management.entity-catalog.js.map +1 -0
  104. package/server/src/lib/interchange/report-interchange-definition.service.d.ts +18 -0
  105. package/server/src/lib/interchange/report-interchange-definition.service.js +94 -0
  106. package/server/src/lib/interchange/report-interchange-definition.service.js.map +1 -0
  107. package/server/src/lib/interchange/report-interchange-export-data-source.d.ts +16 -0
  108. package/server/src/lib/interchange/report-interchange-export-data-source.js +72 -0
  109. package/server/src/lib/interchange/report-interchange-export-data-source.js.map +1 -0
  110. package/server/src/lib/interchange/report-interchange-export-query.util.d.ts +10 -0
  111. package/server/src/lib/interchange/report-interchange-export-query.util.js +22 -0
  112. package/server/src/lib/interchange/report-interchange-export-query.util.js.map +1 -0
  113. package/server/src/lib/interchange/report-interchange-export.command.d.ts +31 -0
  114. package/server/src/lib/interchange/report-interchange-export.command.js +268 -0
  115. package/server/src/lib/interchange/report-interchange-export.command.js.map +1 -0
  116. package/server/src/lib/report-browse.service.js +32 -13
  117. package/server/src/lib/report-browse.service.js.map +1 -1
  118. package/server/src/lib/report-browse.types.d.ts +27 -12
  119. package/server/src/lib/report-browse.types.js +0 -1
  120. package/server/src/lib/report-browse.types.js.map +1 -1
  121. package/server/src/lib/report-definition.seed-provider.d.ts +15 -0
  122. package/server/src/lib/report-definition.seed-provider.js +63 -0
  123. package/server/src/lib/report-definition.seed-provider.js.map +1 -0
  124. package/server/src/lib/report-generation/report-generation-create.command.d.ts +17 -0
  125. package/server/src/lib/report-generation/report-generation-create.command.js +177 -0
  126. package/server/src/lib/report-generation/report-generation-create.command.js.map +1 -0
  127. package/server/src/lib/report-generation/report-generation-enqueue.service.d.ts +21 -0
  128. package/server/src/lib/report-generation/report-generation-enqueue.service.js +58 -0
  129. package/server/src/lib/report-generation/report-generation-enqueue.service.js.map +1 -0
  130. package/server/src/lib/report-generation/report-generation-execute.command.d.ts +10 -0
  131. package/server/src/lib/report-generation/report-generation-execute.command.js +49 -0
  132. package/server/src/lib/report-generation/report-generation-execute.command.js.map +1 -0
  133. package/server/src/lib/report-generation/report-generation-execute.service.d.ts +23 -0
  134. package/server/src/lib/report-generation/report-generation-execute.service.js +226 -0
  135. package/server/src/lib/report-generation/report-generation-execute.service.js.map +1 -0
  136. package/server/src/lib/report-generation/report-generation-job-presentation.util.d.ts +8 -0
  137. package/server/src/lib/report-generation/report-generation-job-presentation.util.js +43 -0
  138. package/server/src/lib/report-generation/report-generation-job-presentation.util.js.map +1 -0
  139. package/server/src/lib/report-generation/report-generation-notify.service.d.ts +23 -0
  140. package/server/src/lib/report-generation/report-generation-notify.service.js +159 -0
  141. package/server/src/lib/report-generation/report-generation-notify.service.js.map +1 -0
  142. package/server/src/lib/report-generation/report-generation-policy.util.d.ts +39 -0
  143. package/server/src/lib/report-generation/report-generation-policy.util.js +95 -0
  144. package/server/src/lib/report-generation/report-generation-policy.util.js.map +1 -0
  145. package/server/src/lib/report-generation/report-generation-progress.util.d.ts +14 -0
  146. package/server/src/lib/report-generation/report-generation-progress.util.js +51 -0
  147. package/server/src/lib/report-generation/report-generation-progress.util.js.map +1 -0
  148. package/server/src/lib/report-generation/report-generation-release-inline-watch.command.d.ts +10 -0
  149. package/server/src/lib/report-generation/report-generation-release-inline-watch.command.js +55 -0
  150. package/server/src/lib/report-generation/report-generation-release-inline-watch.command.js.map +1 -0
  151. package/server/src/lib/report-generation/report-generation-runtime.handlers.d.ts +27 -0
  152. package/server/src/lib/report-generation/report-generation-runtime.handlers.js +136 -0
  153. package/server/src/lib/report-generation/report-generation-runtime.handlers.js.map +1 -0
  154. package/server/src/lib/report-generation/report-generation-settings.service.d.ts +12 -0
  155. package/server/src/lib/report-generation/report-generation-settings.service.js +49 -0
  156. package/server/src/lib/report-generation/report-generation-settings.service.js.map +1 -0
  157. package/server/src/lib/report-generation/report-generation.constants.d.ts +16 -0
  158. package/server/src/lib/report-generation/report-generation.constants.js +24 -0
  159. package/server/src/lib/report-generation/report-generation.constants.js.map +1 -0
  160. package/server/src/lib/report-generation/report-generation.store.d.ts +25 -0
  161. package/server/src/lib/report-generation/report-generation.store.js +145 -0
  162. package/server/src/lib/report-generation/report-generation.store.js.map +1 -0
  163. package/server/src/lib/report-generation/report-generation.util.d.ts +8 -0
  164. package/server/src/lib/report-generation/report-generation.util.js +131 -0
  165. package/server/src/lib/report-generation/report-generation.util.js.map +1 -0
  166. package/server/src/lib/report-management-runtime.handlers.d.ts +32 -0
  167. package/server/src/lib/report-management-runtime.handlers.js +78 -0
  168. package/server/src/lib/report-management-runtime.handlers.js.map +1 -0
  169. package/server/src/lib/report-management-server.module.js +55 -9
  170. package/server/src/lib/report-management-server.module.js.map +1 -1
  171. package/server/src/lib/report-management.controller.d.ts +1 -4
  172. package/server/src/lib/report-management.controller.js +2 -16
  173. package/server/src/lib/report-management.controller.js.map +1 -1
  174. package/server/src/lib/seed/index.d.ts +0 -19
  175. package/server/src/lib/seed/index.js +0 -21
  176. package/server/src/lib/seed/index.js.map +0 -1
  177. package/server/src/lib/seed/report-management-seed.provider.d.ts +0 -4
  178. package/server/src/lib/seed/report-management-seed.provider.js +0 -18
  179. package/server/src/lib/seed/report-management-seed.provider.js.map +0 -1
  180. package/server/src/lib/seed/report-management-seed.tokens.d.ts +0 -1
  181. package/server/src/lib/seed/report-management-seed.tokens.js +0 -7
  182. package/server/src/lib/seed/report-management-seed.tokens.js.map +0 -1
  183. package/server/src/lib/seed/report-management.seed-catalog.d.ts +0 -2
  184. package/server/src/lib/seed/report-management.seed-catalog.js +0 -10
  185. package/server/src/lib/seed/report-management.seed-catalog.js.map +0 -1
  186. package/server/src/lib/seed/samples/employee-report.mock.d.ts +0 -9
  187. package/server/src/lib/seed/samples/employee-report.mock.js +0 -322
  188. package/server/src/lib/seed/samples/employee-report.mock.js.map +0 -1
  189. package/server/src/lib/seed/samples/index.d.ts +0 -2
  190. package/server/src/lib/seed/samples/index.js +0 -6
  191. package/server/src/lib/seed/samples/index.js.map +0 -1
  192. package/server/src/lib/seed/samples/location-report.mock.d.ts +0 -9
  193. package/server/src/lib/seed/samples/location-report.mock.js +0 -339
  194. package/server/src/lib/seed/samples/location-report.mock.js.map +0 -1
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportGenerationExecuteCommand = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const background_job_1 = require("@acorex-platform/framework-server/background-job");
7
+ const abstract_1 = require("@acorex-platform/framework-server/domain/abstract");
8
+ const module_report_management_contracts_1 = require("@acorex-platform/module-report-management-client/contracts");
9
+ const report_generation_constants_1 = require("./report-generation.constants");
10
+ const report_generation_execute_service_1 = require("./report-generation-execute.service");
11
+ const report_generation_store_1 = require("./report-generation.store");
12
+ //#region ----- Execute command -----
13
+ let ReportGenerationExecuteCommand = class ReportGenerationExecuteCommand {
14
+ constructor(store, executeService) {
15
+ this.store = store;
16
+ this.executeService = executeService;
17
+ }
18
+ execute(input) {
19
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
+ var _a, _b;
21
+ const runtime = background_job_1.BackgroundJobRuntime.current();
22
+ const reportRequestId = runtime && typeof ((_a = runtime.payload) === null || _a === void 0 ? void 0 : _a['reportRequestId']) === 'string'
23
+ ? String(runtime.payload['reportRequestId']).trim()
24
+ : (_b = input.reportRequestId) === null || _b === void 0 ? void 0 : _b.trim();
25
+ if (!reportRequestId) {
26
+ return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_NOT_FOUND_ERROR } };
27
+ }
28
+ const request = yield this.store.getById(reportRequestId);
29
+ if (!request) {
30
+ return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_NOT_FOUND_ERROR } };
31
+ }
32
+ yield (runtime === null || runtime === void 0 ? void 0 : runtime.reportProgress(0, '@report-management:report-generation.tray.progress.starting'));
33
+ yield (runtime === null || runtime === void 0 ? void 0 : runtime.heartbeat());
34
+ const data = yield this.executeService.run(request, runtime !== null && runtime !== void 0 ? runtime : undefined);
35
+ return { success: true, kind: 'object', data };
36
+ });
37
+ }
38
+ };
39
+ exports.ReportGenerationExecuteCommand = ReportGenerationExecuteCommand;
40
+ exports.ReportGenerationExecuteCommand = ReportGenerationExecuteCommand = tslib_1.__decorate([
41
+ (0, abstract_1.ServerHandler)({
42
+ key: module_report_management_contracts_1.AXMReportManagementCommandKeys.ReportGeneration.Execute,
43
+ }),
44
+ (0, common_1.Injectable)(),
45
+ tslib_1.__metadata("design:paramtypes", [report_generation_store_1.ReportGenerationStore,
46
+ report_generation_execute_service_1.ReportGenerationExecuteService])
47
+ ], ReportGenerationExecuteCommand);
48
+ //#endregion
49
+ //# sourceMappingURL=report-generation-execute.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-generation-execute.command.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation-execute.command.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,qFAAwF;AACxF,gFAAkF;AAElF,4GAI6D;AAC7D,+EAAkF;AAClF,2FAAqF;AACrF,uEAAkE;AAElE,qCAAqC;AAM9B,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGzC,YACmB,KAA4B,EAC5B,cAA8C;QAD9C,UAAK,GAAL,KAAK,CAAuB;QAC5B,mBAAc,GAAd,cAAc,CAAgC;IAC9D,CAAC;IAEE,OAAO,CACX,KAAsC;;;YAEtC,MAAM,OAAO,GAAG,qCAAoB,CAAC,OAAO,EAAE,CAAC;YAC/C,MAAM,eAAe,GACnB,OAAO,IAAI,OAAO,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAG,iBAAiB,CAAC,CAAA,KAAK,QAAQ;gBACjE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,EAAE;gBACnD,CAAC,CAAC,MAAA,KAAK,CAAC,eAAe,0CAAE,IAAI,EAAE,CAAC;YAEpC,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,+DAAiC,EAAE,EAAE,CAAC;YAClF,CAAC;YAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;YAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,+DAAiC,EAAE,EAAE,CAAC;YAClF,CAAC;YAED,MAAM,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAC,CAAC,EAAE,6DAA6D,CAAC,CAAA,CAAC;YAChG,MAAM,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAE,CAAA,CAAC;YAC3B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,SAAS,CAAC,CAAC;YAE1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACjD,CAAC;KAAA;CACF,CAAA;AAhCY,wEAA8B;yCAA9B,8BAA8B;IAJ1C,IAAA,wBAAa,EAAC;QACb,GAAG,EAAE,mEAA8B,CAAC,gBAAgB,CAAC,OAAO;KAC7D,CAAC;IACD,IAAA,mBAAU,GAAE;6CAKe,+CAAqB;QACZ,kEAA8B;GALtD,8BAA8B,CAgC1C;AAED,YAAY"}
@@ -0,0 +1,23 @@
1
+ import { FileStorageFacadeService } from '@acorex-platform/framework-server/file-storage/http';
2
+ import { ServerQueryRegistry } from '@acorex-platform/framework-server/domain/providers';
3
+ import { EntityStorageMiddlewareService } from '@acorex-platform/framework-server/core';
4
+ import { type AXPReportGenerationExecuteResult, type AXMReportGenerationRequest } from '@acorex-platform/module-report-management-client/contracts';
5
+ import { ReportGenerationNotifyService } from './report-generation-notify.service';
6
+ import { ReportGenerationStore } from './report-generation.store';
7
+ import type { ReportGenerationProgressReporter } from './report-generation-progress.util';
8
+ export type { ReportGenerationProgressReporter } from './report-generation-progress.util';
9
+ export declare class ReportGenerationExecuteService {
10
+ private readonly store;
11
+ private readonly storage;
12
+ private readonly queryRegistry;
13
+ private readonly fileStorage;
14
+ private readonly notify;
15
+ private readonly logger;
16
+ constructor(store: ReportGenerationStore, storage: EntityStorageMiddlewareService, queryRegistry: ServerQueryRegistry, fileStorage: FileStorageFacadeService, notify: ReportGenerationNotifyService);
17
+ /** Reads the latest inline-watch flag so a mid-run ReleaseInlineWatch is honored. */
18
+ private resolveSuppressNotificationOnComplete;
19
+ run(request: AXMReportGenerationRequest, progress?: ReportGenerationProgressReporter): Promise<AXPReportGenerationExecuteResult>;
20
+ private loadReport;
21
+ private resolveFreezeLayouts;
22
+ private fail;
23
+ }
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ var ReportGenerationExecuteService_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ReportGenerationExecuteService = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const common_1 = require("@nestjs/common");
7
+ const http_1 = require("@acorex-platform/framework-server/file-storage/http");
8
+ const providers_1 = require("@acorex-platform/framework-server/domain/providers");
9
+ const report_1 = require("@acorex-platform/framework-server/report");
10
+ const core_1 = require("@acorex-platform/framework-server/core");
11
+ const core_2 = require("@acorex-platform/framework-shared/core");
12
+ const module_report_management_contracts_1 = require("@acorex-platform/module-report-management-client/contracts");
13
+ const report_generation_constants_1 = require("./report-generation.constants");
14
+ const report_generation_notify_service_1 = require("./report-generation-notify.service");
15
+ const report_generation_store_1 = require("./report-generation.store");
16
+ const report_generation_util_1 = require("./report-generation.util");
17
+ const report_generation_progress_util_1 = require("./report-generation-progress.util");
18
+ //#region ----- Execute -----
19
+ let ReportGenerationExecuteService = ReportGenerationExecuteService_1 = class ReportGenerationExecuteService {
20
+ constructor(store, storage, queryRegistry, fileStorage, notify) {
21
+ this.store = store;
22
+ this.storage = storage;
23
+ this.queryRegistry = queryRegistry;
24
+ this.fileStorage = fileStorage;
25
+ this.notify = notify;
26
+ this.logger = new common_1.Logger(ReportGenerationExecuteService_1.name);
27
+ }
28
+ /** Reads the latest inline-watch flag so a mid-run ReleaseInlineWatch is honored. */
29
+ resolveSuppressNotificationOnComplete(request) {
30
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
31
+ const latest = yield this.store.getById(request.id);
32
+ if (!latest) {
33
+ return request.suppressNotificationOnComplete;
34
+ }
35
+ return latest.suppressNotificationOnComplete;
36
+ });
37
+ }
38
+ run(request, progress) {
39
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
41
+ const startedAt = new Date();
42
+ yield (progress === null || progress === void 0 ? void 0 : progress.reportProgress(5, '@report-management:report-generation.tray.progress.starting'));
43
+ yield ((_a = progress === null || progress === void 0 ? void 0 : progress.heartbeat) === null || _a === void 0 ? void 0 : _a.call(progress));
44
+ yield this.store.patchAsEngine(request.id, {
45
+ status: 'running',
46
+ startedAt: startedAt.toISOString(),
47
+ lastError: undefined,
48
+ });
49
+ const report = yield this.loadReport(request.reportId);
50
+ if (!report) {
51
+ yield this.fail(request, report, startedAt, report_generation_constants_1.REPORT_GENERATION_REPORT_NOT_FOUND_ERROR);
52
+ throw new Error(report_generation_constants_1.REPORT_GENERATION_REPORT_NOT_FOUND_ERROR);
53
+ }
54
+ yield (progress === null || progress === void 0 ? void 0 : progress.reportProgress(15, '@report-management:report-generation.tray.progress.loading-data'));
55
+ yield ((_b = progress === null || progress === void 0 ? void 0 : progress.heartbeat) === null || _b === void 0 ? void 0 : _b.call(progress));
56
+ const generation = (0, report_generation_util_1.resolveGenerationOptions)(report.generation);
57
+ const delayMs = (_c = generation.simulateDelayMs) !== null && _c !== void 0 ? _c : 0;
58
+ const usesSimulatedDelay = delayMs > 0;
59
+ if (usesSimulatedDelay) {
60
+ yield (0, report_generation_progress_util_1.simulateReportGenerationProgressDelay)(progress, delayMs, {
61
+ fromProgress: 15,
62
+ toProgress: 70,
63
+ statusText: '@report-management:report-generation.tray.progress.loading-data',
64
+ });
65
+ }
66
+ const layouts = this.resolveFreezeLayouts(report, request.layoutId, request.layoutIds, generation.freezeLayouts);
67
+ const dataSources = [];
68
+ let rowCount = 0;
69
+ const layoutCount = Math.max(layouts.length, 1);
70
+ for (let index = 0; index < layouts.length; index++) {
71
+ const layout = layouts[index];
72
+ const layoutTitle = (0, report_1.resolveDisplayTitle)(layout.title).trim() || layout.id;
73
+ const layoutSpan = usesSimulatedDelay ? 14 : 55;
74
+ const layoutStart = usesSimulatedDelay ? 70 : 20;
75
+ const progressValue = layoutStart + Math.round((layoutSpan * (index + 0.5)) / layoutCount);
76
+ yield (progress === null || progress === void 0 ? void 0 : progress.reportProgress(progressValue, '@report-management:report-generation.tray.progress.layout', layoutTitle));
77
+ yield ((_d = progress === null || progress === void 0 ? void 0 : progress.heartbeat) === null || _d === void 0 ? void 0 : _d.call(progress));
78
+ const dataSource = layout.dataSource;
79
+ if (!dataSource) {
80
+ continue;
81
+ }
82
+ if (dataSource.type !== 'query' || !dataSource.name) {
83
+ yield this.fail(request, report, startedAt, report_generation_constants_1.REPORT_GENERATION_UNSUPPORTED_SOURCE_ERROR);
84
+ throw new Error(report_generation_constants_1.REPORT_GENERATION_UNSUPPORTED_SOURCE_ERROR);
85
+ }
86
+ const filter = (0, module_report_management_contracts_1.applyReportParameterBindings)((0, report_generation_util_1.convertParametersToFilterClause)(request.parameters), dataSource.inputs);
87
+ const queryResult = (yield this.queryRegistry.execute(dataSource.name, {
88
+ skip: 0,
89
+ take: report_generation_constants_1.REPORT_GENERATION_FREEZE_TAKE,
90
+ filter,
91
+ }));
92
+ if (!(queryResult === null || queryResult === void 0 ? void 0 : queryResult.success)) {
93
+ yield this.fail(request, report, startedAt, report_generation_constants_1.REPORT_GENERATION_QUERY_FAILED_ERROR);
94
+ throw new Error(report_generation_constants_1.REPORT_GENERATION_QUERY_FAILED_ERROR);
95
+ }
96
+ const collection = (0, core_2.runtimeQueryCollectionData)(queryResult);
97
+ if (collection) {
98
+ rowCount += (_g = (_e = collection.total) !== null && _e !== void 0 ? _e : (_f = collection.items) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0;
99
+ }
100
+ dataSources.push({
101
+ layoutId: layout.id,
102
+ queryName: dataSource.name,
103
+ result: queryResult,
104
+ });
105
+ }
106
+ const generatedAt = new Date();
107
+ const freeze = {
108
+ version: 1,
109
+ reportId: report.id,
110
+ generatedAt: generatedAt.toISOString(),
111
+ parameters: (_h = request.parameters) !== null && _h !== void 0 ? _h : {},
112
+ dataSources,
113
+ };
114
+ if (generation.pinDefinition) {
115
+ freeze.definition = {
116
+ title: (0, core_2.coerceUnknownToMultiLanguageString)(report.title),
117
+ defaultLayoutId: ((_j = request.layoutIds) === null || _j === void 0 ? void 0 : _j[0]) || request.layoutId || report.defaultLayoutId,
118
+ layouts: report.layouts,
119
+ };
120
+ }
121
+ yield (progress === null || progress === void 0 ? void 0 : progress.reportProgress(85, '@report-management:report-generation.tray.progress.saving'));
122
+ yield ((_k = progress === null || progress === void 0 ? void 0 : progress.heartbeat) === null || _k === void 0 ? void 0 : _k.call(progress));
123
+ const fileName = (0, report_generation_util_1.slugFileName)((0, report_1.resolveDisplayTitle)(report.title), '.json');
124
+ const buffer = Buffer.from(JSON.stringify(freeze), 'utf8');
125
+ const saved = yield this.fileStorage.save({
126
+ buffer,
127
+ originalName: fileName,
128
+ mimeType: 'application/json',
129
+ name: fileName,
130
+ refId: request.id,
131
+ refType: report_generation_constants_1.REPORT_GENERATION_FILE_REF_TYPE,
132
+ category: report_generation_constants_1.REPORT_GENERATION_FILE_CATEGORY,
133
+ status: core_2.AXPFileStorageStatus.Temporary,
134
+ metadata: { reportRequestId: request.id, kind: 'viewer' },
135
+ });
136
+ const fileId = (_l = saved.fileId) === null || _l === void 0 ? void 0 : _l.trim();
137
+ if (!fileId) {
138
+ yield this.fail(request, report, startedAt, report_generation_constants_1.REPORT_GENERATION_QUERY_FAILED_ERROR);
139
+ throw new Error(report_generation_constants_1.REPORT_GENERATION_QUERY_FAILED_ERROR);
140
+ }
141
+ yield this.fileStorage.commit(fileId);
142
+ const suppressNotificationOnComplete = yield this.resolveSuppressNotificationOnComplete(request);
143
+ const completed = Object.assign(Object.assign({}, request), { status: 'completed', startedAt: startedAt.toISOString(), completedAt: generatedAt.toISOString(), durationMs: generatedAt.getTime() - startedAt.getTime(), expiresAt: (0, report_generation_util_1.computeExpiresAt)(generation.retentionDays, generatedAt), lastError: undefined, suppressNotificationOnComplete, artifacts: [
144
+ {
145
+ kind: 'viewer',
146
+ fileId,
147
+ contentType: 'application/json',
148
+ fileName,
149
+ rowCount,
150
+ byteLength: buffer.byteLength,
151
+ },
152
+ ] });
153
+ yield this.store.patchAsEngine(request.id, completed);
154
+ yield (progress === null || progress === void 0 ? void 0 : progress.reportProgress(100, '@report-management:report-generation.tray.progress.ready'));
155
+ yield this.notify.notifyComplete({
156
+ request: Object.assign(Object.assign({}, completed), { id: request.id }),
157
+ reportTitle: report.title,
158
+ recipientUserId: request.requestedBy,
159
+ });
160
+ return {
161
+ reportRequestId: request.id,
162
+ fileIds: [fileId],
163
+ rowCount,
164
+ };
165
+ });
166
+ }
167
+ loadReport(reportId) {
168
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
169
+ const row = yield (0, report_1.loadReportDefinitionById)(this.storage, reportId);
170
+ if (!row) {
171
+ return null;
172
+ }
173
+ return row;
174
+ });
175
+ }
176
+ resolveFreezeLayouts(report, layoutId, layoutIds, freezeLayouts) {
177
+ var _a, _b, _c;
178
+ if (layoutIds === null || layoutIds === void 0 ? void 0 : layoutIds.length) {
179
+ const selected = new Set(layoutIds);
180
+ const filtered = ((_a = report.layouts) !== null && _a !== void 0 ? _a : []).filter((layout) => selected.has(layout.id));
181
+ return filtered.length ? filtered : ((_b = report.layouts) !== null && _b !== void 0 ? _b : []);
182
+ }
183
+ if (freezeLayouts === 'current' && layoutId) {
184
+ const current = report.layouts.find((layout) => layout.id === layoutId);
185
+ return current ? [current] : report.layouts;
186
+ }
187
+ return (_c = report.layouts) !== null && _c !== void 0 ? _c : [];
188
+ }
189
+ fail(request, report, startedAt, lastError) {
190
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
191
+ const completedAt = new Date();
192
+ const suppressNotificationOnComplete = yield this.resolveSuppressNotificationOnComplete(request);
193
+ const failed = {
194
+ status: 'failed',
195
+ startedAt: startedAt.toISOString(),
196
+ completedAt: completedAt.toISOString(),
197
+ durationMs: completedAt.getTime() - startedAt.getTime(),
198
+ lastError,
199
+ expiresAt: (0, report_generation_util_1.computeExpiresAt)(report_generation_constants_1.REPORT_GENERATION_DEFAULT_RETENTION_DAYS, completedAt),
200
+ suppressNotificationOnComplete,
201
+ };
202
+ yield this.store.patchAsEngine(request.id, failed);
203
+ try {
204
+ yield this.notify.notifyFailed({
205
+ request: Object.assign(Object.assign(Object.assign({}, request), failed), { suppressNotificationOnComplete }),
206
+ reportTitle: report === null || report === void 0 ? void 0 : report.title,
207
+ recipientUserId: request.requestedBy,
208
+ });
209
+ }
210
+ catch (error) {
211
+ this.logger.warn(`Failed notification after generation error: ${String(error)}`);
212
+ }
213
+ });
214
+ }
215
+ };
216
+ exports.ReportGenerationExecuteService = ReportGenerationExecuteService;
217
+ exports.ReportGenerationExecuteService = ReportGenerationExecuteService = ReportGenerationExecuteService_1 = tslib_1.__decorate([
218
+ (0, common_1.Injectable)(),
219
+ tslib_1.__metadata("design:paramtypes", [report_generation_store_1.ReportGenerationStore,
220
+ core_1.EntityStorageMiddlewareService,
221
+ providers_1.ServerQueryRegistry,
222
+ http_1.FileStorageFacadeService,
223
+ report_generation_notify_service_1.ReportGenerationNotifyService])
224
+ ], ReportGenerationExecuteService);
225
+ //#endregion
226
+ //# sourceMappingURL=report-generation-execute.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-generation-execute.service.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation-execute.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,8EAA+F;AAC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jB,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;YAC/B,MAAM,8BAA8B,GAAG,MAAM,IAAI,CAAC,qCAAqC,CAAC,OAAO,CAAC,CAAC;YACjG,MAAM,MAAM,GAAwC;gBAClD,MAAM,EAAE,QAAQ;gBAChB,SAAS,EAAE,SAAS,CAAC,WAAW,EAAE;gBAClC,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE;gBACtC,UAAU,EAAE,WAAW,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE;gBACvD,SAAS;gBACT,SAAS,EAAE,IAAA,yCAAgB,EAAC,sEAAwC,EAAE,WAAW,CAAC;gBAClF,8BAA8B;aAC/B,CAAC;YACF,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YACnD,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;oBAC7B,OAAO,gDAAO,OAAO,GAAK,MAAM,KAAE,8BAA8B,GAAE;oBAClE,WAAW,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK;oBAC1B,eAAe,EAAE,OAAO,CAAC,WAAW;iBACrC,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+CAA+C,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACnF,CAAC;QACH,CAAC;KAAA;CACF,CAAA;AAhPY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;6CAKe,+CAAqB;QACnB,qCAA8B;QACxB,+BAAmB;QACrB,+BAAwB;QAC7B,gEAA6B;GAR7C,8BAA8B,CAgP1C;AAED,YAAY"}
@@ -0,0 +1,8 @@
1
+ import type { AXPReportDefinition } from '@acorex-platform/module-report-management-client/contracts';
2
+ export interface ReportGenerationJobPresentation {
3
+ title: string;
4
+ statusText: string;
5
+ currentStep?: string;
6
+ }
7
+ export declare function buildReportGenerationJobTitle(report: AXPReportDefinition): string;
8
+ export declare function buildReportGenerationJobPresentation(report: AXPReportDefinition, layoutId?: string, layoutIds?: string[]): ReportGenerationJobPresentation;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildReportGenerationJobTitle = buildReportGenerationJobTitle;
4
+ exports.buildReportGenerationJobPresentation = buildReportGenerationJobPresentation;
5
+ const report_1 = require("@acorex-platform/framework-server/report");
6
+ //#endregion
7
+ //#region ----- Job tray presentation -----
8
+ function buildReportGenerationJobTitle(report) {
9
+ const title = (0, report_1.resolveDisplayTitle)(report.title).trim();
10
+ return title || 'Report';
11
+ }
12
+ function buildReportGenerationJobPresentation(report, layoutId, layoutIds) {
13
+ var _a;
14
+ const title = buildReportGenerationJobTitle(report);
15
+ const layouts = (_a = report.layouts) !== null && _a !== void 0 ? _a : [];
16
+ const selectedIds = (layoutIds === null || layoutIds === void 0 ? void 0 : layoutIds.length) ? layoutIds : layoutId ? [layoutId] : [];
17
+ const selected = selectedIds.length
18
+ ? layouts.filter((layout) => selectedIds.includes(layout.id))
19
+ : layouts;
20
+ if (selected.length === 1) {
21
+ const layoutTitle = (0, report_1.resolveDisplayTitle)(selected[0].title).trim();
22
+ if (layoutTitle) {
23
+ return {
24
+ title,
25
+ statusText: '@report-management:report-generation.tray.layout-line-single',
26
+ currentStep: layoutTitle,
27
+ };
28
+ }
29
+ }
30
+ if (selected.length > 1) {
31
+ return {
32
+ title,
33
+ statusText: '@report-management:report-generation.tray.layout-line-multiple',
34
+ currentStep: String(selected.length),
35
+ };
36
+ }
37
+ return {
38
+ title,
39
+ statusText: '@report-management:report-generation.tray.queued',
40
+ };
41
+ }
42
+ //#endregion
43
+ //# sourceMappingURL=report-generation-job-presentation.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-generation-job-presentation.util.js","sourceRoot":"","sources":["../../../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,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO;YACL,KAAK;YACL,UAAU,EAAE,gEAAgE;YAC5E,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;SACrC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK;QACL,UAAU,EAAE,kDAAkD;KAC/D,CAAC;AACJ,CAAC;AAED,YAAY"}
@@ -0,0 +1,23 @@
1
+ import { ServerCommandExecutorService } from '@acorex-platform/framework-server/domain/providers';
2
+ import type { AXMReportGenerationRequest } from '@acorex-platform/module-report-management-client/contracts';
3
+ import { ReportGenerationStore } from './report-generation.store';
4
+ export declare class ReportGenerationNotifyService {
5
+ private readonly commandExecutor;
6
+ private readonly store;
7
+ private readonly logger;
8
+ constructor(commandExecutor: ServerCommandExecutorService, store: ReportGenerationStore);
9
+ private shouldSuppressNotification;
10
+ notifyComplete(input: {
11
+ request: AXMReportGenerationRequest;
12
+ reportTitle: unknown;
13
+ recipientUserId?: string;
14
+ }): Promise<void>;
15
+ notifyFailed(input: {
16
+ request: AXMReportGenerationRequest;
17
+ reportTitle: unknown;
18
+ recipientUserId?: string;
19
+ }): Promise<void>;
20
+ private buildCompleteRequest;
21
+ private buildFailedRequest;
22
+ private deliverInbox;
23
+ }
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var ReportGenerationNotifyService_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ReportGenerationNotifyService = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const common_1 = require("@nestjs/common");
7
+ const providers_1 = require("@acorex-platform/framework-server/domain/providers");
8
+ const core_1 = require("@acorex-platform/framework-shared/core");
9
+ const module_communication_management_contracts_1 = require("@acorex-platform/module-communication-management-client/contracts");
10
+ const report_generation_constants_1 = require("./report-generation.constants");
11
+ const report_generation_store_1 = require("./report-generation.store");
12
+ //#region ----- Notify -----
13
+ let ReportGenerationNotifyService = ReportGenerationNotifyService_1 = class ReportGenerationNotifyService {
14
+ constructor(commandExecutor, store) {
15
+ this.commandExecutor = commandExecutor;
16
+ this.store = store;
17
+ this.logger = new common_1.Logger(ReportGenerationNotifyService_1.name);
18
+ }
19
+ shouldSuppressNotification(request) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ const latest = yield this.store.getById(request.id);
22
+ const row = latest !== null && latest !== void 0 ? latest : request;
23
+ return row.suppressNotificationOnComplete === true;
24
+ });
25
+ }
26
+ notifyComplete(input) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ var _a, _b;
29
+ if (yield this.shouldSuppressNotification(input.request)) {
30
+ return;
31
+ }
32
+ const recipientUserId = ((_a = input.recipientUserId) === null || _a === void 0 ? void 0 : _a.trim()) || ((_b = input.request.requestedBy) === null || _b === void 0 ? void 0 : _b.trim());
33
+ if (!recipientUserId) {
34
+ return;
35
+ }
36
+ const title = (0, core_1.resolveMultiLanguageString)((0, core_1.coerceUnknownToMultiLanguageString)(input.reportTitle), 'en-US');
37
+ const notification = this.buildCompleteRequest({
38
+ request: input.request,
39
+ recipientUserId,
40
+ title,
41
+ });
42
+ yield this.deliverInbox(notification);
43
+ });
44
+ }
45
+ notifyFailed(input) {
46
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+ var _a, _b;
48
+ if (yield this.shouldSuppressNotification(input.request)) {
49
+ return;
50
+ }
51
+ const recipientUserId = ((_a = input.recipientUserId) === null || _a === void 0 ? void 0 : _a.trim()) || ((_b = input.request.requestedBy) === null || _b === void 0 ? void 0 : _b.trim());
52
+ if (!recipientUserId) {
53
+ return;
54
+ }
55
+ const title = (0, core_1.resolveMultiLanguageString)((0, core_1.coerceUnknownToMultiLanguageString)(input.reportTitle), 'en-US');
56
+ const notification = this.buildFailedRequest({
57
+ request: input.request,
58
+ recipientUserId,
59
+ title,
60
+ });
61
+ yield this.deliverInbox(notification);
62
+ });
63
+ }
64
+ //#region ----- Helpers -----
65
+ buildCompleteRequest(input) {
66
+ return {
67
+ correlationId: `report-generation:${input.request.id}`,
68
+ idempotencyKey: `report-generation-complete:${input.request.id}`,
69
+ title: input.title || '@report-management:report-generation.notifications.complete.title',
70
+ body: '@report-management:report-generation.notifications.complete.body',
71
+ recipientUserId: input.recipientUserId,
72
+ delivery: {
73
+ inbox: {
74
+ definitionKey: report_generation_constants_1.REPORT_GENERATION_NOTIFICATION_DEFINITION_KEY,
75
+ priority: 'Notice',
76
+ actions: [
77
+ {
78
+ title: '@report-management:report-generation.notifications.actions.open-viewer',
79
+ command: {
80
+ name: report_generation_constants_1.REPORT_GENERATION_OPEN_FROZEN_COMMAND,
81
+ options: {
82
+ reportId: input.request.reportId,
83
+ runId: input.request.id,
84
+ title: input.title || undefined,
85
+ },
86
+ },
87
+ },
88
+ ],
89
+ },
90
+ },
91
+ };
92
+ }
93
+ buildFailedRequest(input) {
94
+ return {
95
+ correlationId: `report-generation-failed:${input.request.id}`,
96
+ idempotencyKey: `report-generation-failed:${input.request.id}`,
97
+ title: input.title || '@report-management:report-generation.notifications.failed.title',
98
+ body: input.request.lastError || '@report-management:report-generation.notifications.failed.body',
99
+ recipientUserId: input.recipientUserId,
100
+ delivery: {
101
+ inbox: {
102
+ definitionKey: report_generation_constants_1.REPORT_GENERATION_NOTIFICATION_DEFINITION_KEY,
103
+ priority: 'Warning',
104
+ actions: [
105
+ {
106
+ title: '@report-management:report-generation.notifications.actions.open-viewer',
107
+ command: {
108
+ name: report_generation_constants_1.REPORT_GENERATION_OPEN_FROZEN_COMMAND,
109
+ options: {
110
+ reportId: input.request.reportId,
111
+ runId: input.request.id,
112
+ title: input.title || undefined,
113
+ },
114
+ },
115
+ },
116
+ ],
117
+ },
118
+ },
119
+ };
120
+ }
121
+ deliverInbox(request) {
122
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
123
+ var _a, _b;
124
+ if (!(0, core_1.axpShouldDeliverUserNotificationInbox)(request.delivery)) {
125
+ return;
126
+ }
127
+ const inbox = (0, core_1.axpResolveUserNotificationDelivery)(request.delivery).inbox;
128
+ const recipientUserId = (_a = request.recipientUserId) === null || _a === void 0 ? void 0 : _a.trim();
129
+ if (!recipientUserId) {
130
+ return;
131
+ }
132
+ const result = yield this.commandExecutor.execute(module_communication_management_contracts_1.AXMCommunicationManagementServerCommands.Send, {
133
+ title: request.title,
134
+ message: {
135
+ subject: request.title,
136
+ body: request.body,
137
+ },
138
+ channel: 'in-app',
139
+ recipientUserId,
140
+ definitionKey: inbox.definitionKey,
141
+ correlationId: request.correlationId,
142
+ idempotencyKey: request.idempotencyKey,
143
+ priority: (_b = inbox.priority) !== null && _b !== void 0 ? _b : 'Notice',
144
+ actions: inbox.actions,
145
+ });
146
+ if (!(result === null || result === void 0 ? void 0 : result.success)) {
147
+ this.logger.warn(`Failed to send report-generation inbox notification for ${request.correlationId}`);
148
+ }
149
+ });
150
+ }
151
+ };
152
+ exports.ReportGenerationNotifyService = ReportGenerationNotifyService;
153
+ exports.ReportGenerationNotifyService = ReportGenerationNotifyService = ReportGenerationNotifyService_1 = tslib_1.__decorate([
154
+ (0, common_1.Injectable)(),
155
+ tslib_1.__metadata("design:paramtypes", [providers_1.ServerCommandExecutorService,
156
+ report_generation_store_1.ReportGenerationStore])
157
+ ], ReportGenerationNotifyService);
158
+ //#endregion
159
+ //# sourceMappingURL=report-generation-notify.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-generation-notify.service.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation-notify.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,kFAAkG;AAClG,iEAOgD;AAChD,0HAAsH;AAEtH,+EAGuC;AACvC,uEAAkE;AAElE,4BAA4B;AAGrB,IAAM,6BAA6B,qCAAnC,MAAM,6BAA6B;IAGxC,YACmB,eAA6C,EAC7C,KAA4B;QAD5B,oBAAe,GAAf,eAAe,CAA8B;QAC7C,UAAK,GAAL,KAAK,CAAuB;QAJ9B,WAAM,GAAG,IAAI,eAAM,CAAC,+BAA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KAAK,CAAC,aAAa;gBAClC,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,QAAQ,EAAE,MAAA,KAAK,CAAC,QAAQ,mCAAI,QAAQ;gBACpC,OAAO,EAAE,KAAK,CAAC,OAAO;aACvB,CAAC,CAAC;YAEH,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAA,EAAE,CAAC;gBACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2DAA2D,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;YACvG,CAAC;QACH,CAAC;KAAA;CAGF,CAAA;AAlKY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,mBAAU,GAAE;6CAKyB,wCAA4B;QACtC,+CAAqB;GALpC,6BAA6B,CAkKzC;AAED,YAAY"}
@@ -0,0 +1,39 @@
1
+ import type { AXPReportGenerationDedupeOptions, AXPReportGenerationDedupePolicy } from '@acorex-platform/module-report-management-client/contracts';
2
+ import type { ReportGenerationPlatformSettings } from './report-generation-settings.service';
3
+ export interface EffectiveReportGenerationDedupe {
4
+ policy: AXPReportGenerationDedupePolicy;
5
+ cooldownMs: number;
6
+ }
7
+ export declare function resolveEffectiveDedupe(reportDedupe: AXPReportGenerationDedupeOptions | undefined, platform: Pick<ReportGenerationPlatformSettings, 'dedupePolicy' | 'dedupeCooldownMs'>): EffectiveReportGenerationDedupe;
8
+ export declare function isDedupePolicyActive(dedupe: EffectiveReportGenerationDedupe, trigger: 'manual' | 'schedule' | 'export'): boolean;
9
+ export declare function buildReportGenerationFingerprint(input: {
10
+ reportId: string;
11
+ layoutIds?: string[];
12
+ layoutId?: string;
13
+ parameters?: Record<string, unknown>;
14
+ }): string;
15
+ export declare function matchesReportGenerationFingerprint(candidate: {
16
+ reportId: string;
17
+ layoutIds?: string[];
18
+ layoutId?: string;
19
+ parameters?: Record<string, unknown>;
20
+ }, fingerprint: string): boolean;
21
+ export declare function findDedupeMatch(input: {
22
+ fingerprint: string;
23
+ dedupe: EffectiveReportGenerationDedupe;
24
+ candidates: Array<{
25
+ id: string;
26
+ jobId?: string;
27
+ status: string;
28
+ reportId: string;
29
+ layoutIds?: string[];
30
+ layoutId?: string;
31
+ parameters?: Record<string, unknown>;
32
+ completedAt?: string;
33
+ }>;
34
+ now?: Date;
35
+ }): {
36
+ id: string;
37
+ jobId?: string;
38
+ status: string;
39
+ } | null;