@acorex-platform/module-report-management-server 0.0.18 → 2.0.0-next.42

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 (209) hide show
  1. package/contracts/src/commands.keys.d.ts +11 -0
  2. package/contracts/src/commands.keys.js +17 -0
  3. package/contracts/src/commands.keys.js.map +1 -0
  4. package/contracts/src/entities/index.d.ts +3 -0
  5. package/contracts/src/entities/index.js +3 -0
  6. package/contracts/src/entities/index.js.map +1 -1
  7. package/contracts/src/entities/query-snapshot/index.d.ts +1 -0
  8. package/contracts/src/entities/query-snapshot/index.js +5 -0
  9. package/contracts/src/entities/query-snapshot/index.js.map +1 -0
  10. package/contracts/src/entities/query-snapshot/query-snapshot.entity.d.ts +2 -0
  11. package/contracts/src/entities/query-snapshot/query-snapshot.entity.js +127 -0
  12. package/contracts/src/entities/query-snapshot/query-snapshot.entity.js.map +1 -0
  13. package/contracts/src/entities/query-snapshot/query-snapshot.types.d.ts +34 -0
  14. package/contracts/src/entities/query-snapshot/query-snapshot.types.js +5 -0
  15. package/contracts/src/entities/query-snapshot/query-snapshot.types.js.map +1 -0
  16. package/contracts/src/entities/query-snapshot-policy/index.d.ts +1 -0
  17. package/contracts/src/entities/query-snapshot-policy/index.js +5 -0
  18. package/contracts/src/entities/query-snapshot-policy/index.js.map +1 -0
  19. package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.entity.d.ts +2 -0
  20. package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.entity.js +100 -0
  21. package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.entity.js.map +1 -0
  22. package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.types.d.ts +14 -0
  23. package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.types.js +5 -0
  24. package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.types.js.map +1 -0
  25. package/contracts/src/entities/report/index.d.ts +1 -1
  26. package/contracts/src/entities/report/index.js +1 -1
  27. package/contracts/src/entities/report/index.js.map +1 -1
  28. package/contracts/src/entities/report/report.entity.js +51 -7
  29. package/contracts/src/entities/report/report.entity.js.map +1 -1
  30. package/contracts/src/entities/report-category/index.d.ts +1 -1
  31. package/contracts/src/entities/report-category/index.js +0 -2
  32. package/contracts/src/entities/report-category/index.js.map +1 -1
  33. package/contracts/src/entities/report-category/report-category.entity.js +14 -1
  34. package/contracts/src/entities/report-category/report-category.entity.js.map +1 -1
  35. package/contracts/src/entities/report-generation-request/index.d.ts +1 -0
  36. package/contracts/src/entities/report-generation-request/index.js +5 -0
  37. package/contracts/src/entities/report-generation-request/index.js.map +1 -0
  38. package/contracts/src/entities/report-generation-request/report-generation-request.entity.d.ts +2 -0
  39. package/contracts/src/entities/report-generation-request/report-generation-request.entity.js +208 -0
  40. package/contracts/src/entities/report-generation-request/report-generation-request.entity.js.map +1 -0
  41. package/contracts/src/entity-catalog.d.ts +7 -0
  42. package/contracts/src/entity-catalog.js +24 -0
  43. package/contracts/src/entity-catalog.js.map +1 -0
  44. package/contracts/src/entity-entry.query-snapshot-policy.d.ts +1 -0
  45. package/contracts/src/entity-entry.query-snapshot-policy.js +6 -0
  46. package/contracts/src/entity-entry.query-snapshot-policy.js.map +1 -0
  47. package/contracts/src/entity-entry.query-snapshot.d.ts +1 -0
  48. package/contracts/src/entity-entry.query-snapshot.js +6 -0
  49. package/contracts/src/entity-entry.query-snapshot.js.map +1 -0
  50. package/contracts/src/entity-entry.report-category.d.ts +1 -0
  51. package/contracts/src/entity-entry.report-category.js +6 -0
  52. package/contracts/src/entity-entry.report-category.js.map +1 -0
  53. package/contracts/src/entity-entry.report-generation-request.d.ts +1 -0
  54. package/contracts/src/entity-entry.report-generation-request.js +6 -0
  55. package/contracts/src/entity-entry.report-generation-request.js.map +1 -0
  56. package/contracts/src/entity-entry.report.d.ts +1 -0
  57. package/contracts/src/entity-entry.report.js +6 -0
  58. package/contracts/src/entity-entry.report.js.map +1 -0
  59. package/contracts/src/index.d.ts +5 -0
  60. package/contracts/src/index.js +5 -0
  61. package/contracts/src/index.js.map +1 -1
  62. package/contracts/src/manifest.d.ts +6 -0
  63. package/contracts/src/manifest.js +24 -0
  64. package/contracts/src/manifest.js.map +1 -0
  65. package/contracts/src/permission.keys.d.ts +30 -14
  66. package/contracts/src/permission.keys.js +28 -12
  67. package/contracts/src/permission.keys.js.map +1 -1
  68. package/contracts/src/report-generation.types.d.ts +97 -0
  69. package/contracts/src/report-generation.types.js +14 -0
  70. package/contracts/src/report-generation.types.js.map +1 -0
  71. package/contracts/src/report.types.d.ts +107 -107
  72. package/contracts/src/report.types.js.map +1 -1
  73. package/contracts/src/root-config.d.ts +23 -2
  74. package/contracts/src/root-config.js +23 -2
  75. package/contracts/src/root-config.js.map +1 -1
  76. package/contracts/src/runtime.keys.d.ts +14 -0
  77. package/contracts/src/runtime.keys.js +20 -0
  78. package/contracts/src/runtime.keys.js.map +1 -0
  79. package/contracts/src/settings.keys.d.ts +11 -0
  80. package/contracts/src/settings.keys.js +17 -0
  81. package/contracts/src/settings.keys.js.map +1 -0
  82. package/package.json +8 -8
  83. package/server/src/index.d.ts +2 -4
  84. package/server/src/index.js +5 -8
  85. package/server/src/index.js.map +1 -1
  86. package/server/src/lib/entities/index.d.ts +1 -0
  87. package/server/src/lib/entities/index.js +5 -0
  88. package/server/src/lib/entities/index.js.map +1 -0
  89. package/server/src/lib/entities/report-management.entity-catalog.d.ts +1 -0
  90. package/server/src/lib/entities/report-management.entity-catalog.js +12 -0
  91. package/server/src/lib/entities/report-management.entity-catalog.js.map +1 -0
  92. package/server/src/lib/query-snapshots/query-snapshot-bypass.util.d.ts +3 -0
  93. package/server/src/lib/query-snapshots/query-snapshot-bypass.util.js +16 -0
  94. package/server/src/lib/query-snapshots/query-snapshot-bypass.util.js.map +1 -0
  95. package/server/src/lib/query-snapshots/query-snapshot-debounce.service.d.ts +19 -0
  96. package/server/src/lib/query-snapshots/query-snapshot-debounce.service.js +118 -0
  97. package/server/src/lib/query-snapshots/query-snapshot-debounce.service.js.map +1 -0
  98. package/server/src/lib/query-snapshots/query-snapshot-enqueue.service.d.ts +24 -0
  99. package/server/src/lib/query-snapshots/query-snapshot-enqueue.service.js +61 -0
  100. package/server/src/lib/query-snapshots/query-snapshot-enqueue.service.js.map +1 -0
  101. package/server/src/lib/query-snapshots/query-snapshot-entity-change.middleware.d.ts +12 -0
  102. package/server/src/lib/query-snapshots/query-snapshot-entity-change.middleware.js +90 -0
  103. package/server/src/lib/query-snapshots/query-snapshot-entity-change.middleware.js.map +1 -0
  104. package/server/src/lib/query-snapshots/query-snapshot-entity-storage.bootstrap.d.ts +9 -0
  105. package/server/src/lib/query-snapshots/query-snapshot-entity-storage.bootstrap.js +25 -0
  106. package/server/src/lib/query-snapshots/query-snapshot-entity-storage.bootstrap.js.map +1 -0
  107. package/server/src/lib/query-snapshots/query-snapshot-payload.util.d.ts +22 -0
  108. package/server/src/lib/query-snapshots/query-snapshot-payload.util.js +282 -0
  109. package/server/src/lib/query-snapshots/query-snapshot-payload.util.js.map +1 -0
  110. package/server/src/lib/query-snapshots/query-snapshot-recalc.service.d.ts +23 -0
  111. package/server/src/lib/query-snapshots/query-snapshot-recalc.service.js +122 -0
  112. package/server/src/lib/query-snapshots/query-snapshot-recalc.service.js.map +1 -0
  113. package/server/src/lib/query-snapshots/query-snapshot-schedule.setup.d.ts +2 -0
  114. package/server/src/lib/query-snapshots/query-snapshot-schedule.setup.js +79 -0
  115. package/server/src/lib/query-snapshots/query-snapshot-schedule.setup.js.map +1 -0
  116. package/server/src/lib/query-snapshots/query-snapshot.constants.d.ts +17 -0
  117. package/server/src/lib/query-snapshots/query-snapshot.constants.js +46 -0
  118. package/server/src/lib/query-snapshots/query-snapshot.constants.js.map +1 -0
  119. package/server/src/lib/query-snapshots/query-snapshot.middleware.d.ts +21 -0
  120. package/server/src/lib/query-snapshots/query-snapshot.middleware.js +135 -0
  121. package/server/src/lib/query-snapshots/query-snapshot.middleware.js.map +1 -0
  122. package/server/src/lib/query-snapshots/query-snapshot.store.d.ts +34 -0
  123. package/server/src/lib/query-snapshots/query-snapshot.store.js +137 -0
  124. package/server/src/lib/query-snapshots/query-snapshot.store.js.map +1 -0
  125. package/server/src/lib/query-snapshots/recalculate-query-snapshots.command.d.ts +8 -0
  126. package/server/src/lib/query-snapshots/recalculate-query-snapshots.command.js +74 -0
  127. package/server/src/lib/query-snapshots/recalculate-query-snapshots.command.js.map +1 -0
  128. package/server/src/lib/query-snapshots/refresh-query-snapshots.command.d.ts +16 -0
  129. package/server/src/lib/query-snapshots/refresh-query-snapshots.command.js +56 -0
  130. package/server/src/lib/query-snapshots/refresh-query-snapshots.command.js.map +1 -0
  131. package/server/src/lib/report-browse.service.js +32 -13
  132. package/server/src/lib/report-browse.service.js.map +1 -1
  133. package/server/src/lib/report-browse.types.d.ts +27 -12
  134. package/server/src/lib/report-browse.types.js +0 -1
  135. package/server/src/lib/report-browse.types.js.map +1 -1
  136. package/server/src/lib/report-definition.seed-provider.d.ts +15 -0
  137. package/server/src/lib/report-definition.seed-provider.js +63 -0
  138. package/server/src/lib/report-definition.seed-provider.js.map +1 -0
  139. package/server/src/lib/report-generation/report-generation-create.command.d.ts +17 -0
  140. package/server/src/lib/report-generation/report-generation-create.command.js +177 -0
  141. package/server/src/lib/report-generation/report-generation-create.command.js.map +1 -0
  142. package/server/src/lib/report-generation/report-generation-enqueue.service.d.ts +21 -0
  143. package/server/src/lib/report-generation/report-generation-enqueue.service.js +58 -0
  144. package/server/src/lib/report-generation/report-generation-enqueue.service.js.map +1 -0
  145. package/server/src/lib/report-generation/report-generation-execute.command.d.ts +10 -0
  146. package/server/src/lib/report-generation/report-generation-execute.command.js +49 -0
  147. package/server/src/lib/report-generation/report-generation-execute.command.js.map +1 -0
  148. package/server/src/lib/report-generation/report-generation-execute.service.d.ts +23 -0
  149. package/server/src/lib/report-generation/report-generation-execute.service.js +225 -0
  150. package/server/src/lib/report-generation/report-generation-execute.service.js.map +1 -0
  151. package/server/src/lib/report-generation/report-generation-job-presentation.util.d.ts +8 -0
  152. package/server/src/lib/report-generation/report-generation-job-presentation.util.js +43 -0
  153. package/server/src/lib/report-generation/report-generation-job-presentation.util.js.map +1 -0
  154. package/server/src/lib/report-generation/report-generation-notify.service.d.ts +23 -0
  155. package/server/src/lib/report-generation/report-generation-notify.service.js +159 -0
  156. package/server/src/lib/report-generation/report-generation-notify.service.js.map +1 -0
  157. package/server/src/lib/report-generation/report-generation-policy.util.d.ts +39 -0
  158. package/server/src/lib/report-generation/report-generation-policy.util.js +95 -0
  159. package/server/src/lib/report-generation/report-generation-policy.util.js.map +1 -0
  160. package/server/src/lib/report-generation/report-generation-progress.util.d.ts +14 -0
  161. package/server/src/lib/report-generation/report-generation-progress.util.js +51 -0
  162. package/server/src/lib/report-generation/report-generation-progress.util.js.map +1 -0
  163. package/server/src/lib/report-generation/report-generation-release-inline-watch.command.d.ts +10 -0
  164. package/server/src/lib/report-generation/report-generation-release-inline-watch.command.js +55 -0
  165. package/server/src/lib/report-generation/report-generation-release-inline-watch.command.js.map +1 -0
  166. package/server/src/lib/report-generation/report-generation-runtime.handlers.d.ts +27 -0
  167. package/server/src/lib/report-generation/report-generation-runtime.handlers.js +136 -0
  168. package/server/src/lib/report-generation/report-generation-runtime.handlers.js.map +1 -0
  169. package/server/src/lib/report-generation/report-generation-settings.service.d.ts +12 -0
  170. package/server/src/lib/report-generation/report-generation-settings.service.js +49 -0
  171. package/server/src/lib/report-generation/report-generation-settings.service.js.map +1 -0
  172. package/server/src/lib/report-generation/report-generation.constants.d.ts +16 -0
  173. package/server/src/lib/report-generation/report-generation.constants.js +24 -0
  174. package/server/src/lib/report-generation/report-generation.constants.js.map +1 -0
  175. package/server/src/lib/report-generation/report-generation.store.d.ts +25 -0
  176. package/server/src/lib/report-generation/report-generation.store.js +145 -0
  177. package/server/src/lib/report-generation/report-generation.store.js.map +1 -0
  178. package/server/src/lib/report-generation/report-generation.util.d.ts +8 -0
  179. package/server/src/lib/report-generation/report-generation.util.js +131 -0
  180. package/server/src/lib/report-generation/report-generation.util.js.map +1 -0
  181. package/server/src/lib/report-management-runtime.handlers.d.ts +32 -0
  182. package/server/src/lib/report-management-runtime.handlers.js +78 -0
  183. package/server/src/lib/report-management-runtime.handlers.js.map +1 -0
  184. package/server/src/lib/report-management-server.module.js +64 -9
  185. package/server/src/lib/report-management-server.module.js.map +1 -1
  186. package/server/src/lib/report-management.controller.d.ts +1 -4
  187. package/server/src/lib/report-management.controller.js +2 -16
  188. package/server/src/lib/report-management.controller.js.map +1 -1
  189. package/server/src/lib/seed/index.d.ts +0 -19
  190. package/server/src/lib/seed/index.js +0 -21
  191. package/server/src/lib/seed/index.js.map +0 -1
  192. package/server/src/lib/seed/report-management-seed.provider.d.ts +0 -4
  193. package/server/src/lib/seed/report-management-seed.provider.js +0 -18
  194. package/server/src/lib/seed/report-management-seed.provider.js.map +0 -1
  195. package/server/src/lib/seed/report-management-seed.tokens.d.ts +0 -1
  196. package/server/src/lib/seed/report-management-seed.tokens.js +0 -7
  197. package/server/src/lib/seed/report-management-seed.tokens.js.map +0 -1
  198. package/server/src/lib/seed/report-management.seed-catalog.d.ts +0 -2
  199. package/server/src/lib/seed/report-management.seed-catalog.js +0 -10
  200. package/server/src/lib/seed/report-management.seed-catalog.js.map +0 -1
  201. package/server/src/lib/seed/samples/employee-report.mock.d.ts +0 -9
  202. package/server/src/lib/seed/samples/employee-report.mock.js +0 -322
  203. package/server/src/lib/seed/samples/employee-report.mock.js.map +0 -1
  204. package/server/src/lib/seed/samples/index.d.ts +0 -2
  205. package/server/src/lib/seed/samples/index.js +0 -6
  206. package/server/src/lib/seed/samples/index.js.map +0 -1
  207. package/server/src/lib/seed/samples/location-report.mock.d.ts +0 -9
  208. package/server/src/lib/seed/samples/location-report.mock.js +0 -339
  209. package/server/src/lib/seed/samples/location-report.mock.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ import type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';
1
2
  export interface ReportCategoryApiResponse {
2
3
  totalCount: number;
3
4
  items: ReportCategoryApiItem[];
@@ -5,8 +6,8 @@ export interface ReportCategoryApiResponse {
5
6
  export interface ReportCategoryApiItem {
6
7
  id: string;
7
8
  name: string;
8
- title: string;
9
- description: string | null;
9
+ title: AXPMultiLanguageString;
10
+ description: AXPMultiLanguageString | null;
10
11
  reportCategoryParentId: string | null;
11
12
  folderCount: number;
12
13
  itemCount: number;
@@ -17,31 +18,44 @@ export interface ReportCategoryApiItem {
17
18
  export interface ReportDefinitionApiItem {
18
19
  id: string;
19
20
  name: string;
20
- title: string;
21
- description: string | null;
21
+ title: AXPMultiLanguageString;
22
+ description: AXPMultiLanguageString | null;
22
23
  categoryIds: string[];
23
24
  isArchived: boolean;
24
25
  }
25
26
  export interface ReportDefinitionApiResponse {
26
27
  id: string;
27
28
  name: string;
28
- title: string;
29
- description: string | null;
29
+ title: AXPMultiLanguageString;
30
+ description: AXPMultiLanguageString | null;
30
31
  categoryIds: string[];
31
32
  parameterGroups: ReportParameterGroupApi[];
32
33
  layouts: ReportLayoutDefinitionApi[];
33
34
  defaultLayoutId: string;
35
+ generation?: {
36
+ mode?: 'interactive' | 'background' | 'choose';
37
+ formats?: Array<'viewer' | 'pdf' | 'excel' | 'csv'>;
38
+ executionTimeoutMs?: number;
39
+ retentionDays?: number;
40
+ freezeLayouts?: 'current' | 'all';
41
+ pinDefinition?: boolean;
42
+ };
34
43
  }
35
44
  export interface ReportParameterGroupApi {
36
45
  name: string;
37
- title: string;
38
- description?: string;
46
+ title: AXPMultiLanguageString;
47
+ description?: AXPMultiLanguageString;
39
48
  parameters: ReportParameterApi[];
40
49
  }
41
50
  export interface ReportParameterApi {
42
51
  path: string;
43
- title: string;
44
- description?: string;
52
+ title: AXPMultiLanguageString;
53
+ description?: AXPMultiLanguageString;
54
+ /**
55
+ * Boolean or expression (e.g. `{{ permission.check("…") }}`).
56
+ * Evaluated by the Report Viewer / layout renderer.
57
+ */
58
+ visible?: boolean | string;
45
59
  widget: {
46
60
  type: string;
47
61
  path?: string | null;
@@ -51,8 +65,9 @@ export interface ReportParameterApi {
51
65
  }
52
66
  export interface ReportLayoutDefinitionApi {
53
67
  id: string;
54
- title: string;
55
- description?: string;
68
+ title: AXPMultiLanguageString;
69
+ description?: AXPMultiLanguageString;
70
+ icon?: string;
56
71
  layout: unknown;
57
72
  dataSource?: {
58
73
  type: string;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- //#region ---- Report browse API DTOs (connectivity/api contract) ----
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  //#endregion
5
4
  //# sourceMappingURL=report-browse.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"report-browse.types.js","sourceRoot":"","sources":["../../../../../../libs/modules/report-management/server/src/lib/report-browse.types.ts"],"names":[],"mappings":";AAAA,sEAAsE;;AA2EtE,YAAY"}
1
+ {"version":3,"file":"report-browse.types.js","sourceRoot":"","sources":["../../../../../../libs/modules/report-management/server/src/lib/report-browse.types.ts"],"names":[],"mappings":";;AA2FA,YAAY"}
@@ -0,0 +1,15 @@
1
+ import type { JqlSeedEntityTarget, JqlSeedProvider, JqlSeedResolveContext } from '@acorex-platform/framework-server/jql/seed';
2
+ import { BackendReportDefinitionRegistry } from '@acorex-platform/framework-server/report';
3
+ /**
4
+ * Seeds built-in report categories and definitions in the JQL `data` phase,
5
+ * after entity schemas are registered — same pipeline as other entity catalogs.
6
+ */
7
+ export declare class ReportDefinitionSeedProvider implements JqlSeedProvider {
8
+ private readonly registry;
9
+ readonly name = "report-definitions";
10
+ readonly phase: "data";
11
+ readonly moduleName = "report-management";
12
+ readonly tags: string[];
13
+ constructor(registry: BackendReportDefinitionRegistry);
14
+ resolve(_context: JqlSeedResolveContext): Promise<readonly JqlSeedEntityTarget[]>;
15
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportDefinitionSeedProvider = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const report_1 = require("@acorex-platform/framework-server/report");
7
+ //#region ----- Report definition JQL seed -----
8
+ /**
9
+ * Seeds built-in report categories and definitions in the JQL `data` phase,
10
+ * after entity schemas are registered — same pipeline as other entity catalogs.
11
+ */
12
+ let ReportDefinitionSeedProvider = class ReportDefinitionSeedProvider {
13
+ constructor(registry) {
14
+ this.registry = registry;
15
+ this.name = 'report-definitions';
16
+ this.phase = 'data';
17
+ this.moduleName = 'report-management';
18
+ this.tags = ['pack', 'core', 'reports'];
19
+ }
20
+ resolve(_context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ const { categories, definitions } = this.registry.collectSeedRows();
23
+ return [
24
+ {
25
+ key: 'report-management/ReportCategoryDataSeeder',
26
+ name: 'ReportCategoryDataSeeder',
27
+ moduleName: this.moduleName,
28
+ providerName: this.name,
29
+ phase: 'data',
30
+ kind: 'entity',
31
+ jqlInstance: 'storage',
32
+ target: report_1.REPORT_CATEGORY_ENTITY,
33
+ records: categories,
34
+ mergeType: 'merge',
35
+ uniqueKeys: ['id'],
36
+ tags: [...this.tags],
37
+ },
38
+ {
39
+ key: 'report-management/ReportDataSeeder',
40
+ name: 'ReportDataSeeder',
41
+ moduleName: this.moduleName,
42
+ providerName: this.name,
43
+ phase: 'data',
44
+ kind: 'entity',
45
+ jqlInstance: 'storage',
46
+ target: report_1.REPORT_ENTITY,
47
+ records: definitions,
48
+ mergeType: 'merge',
49
+ uniqueKeys: ['id'],
50
+ tags: [...this.tags],
51
+ dependsOn: ['report-management/ReportCategoryDataSeeder'],
52
+ },
53
+ ];
54
+ });
55
+ }
56
+ };
57
+ exports.ReportDefinitionSeedProvider = ReportDefinitionSeedProvider;
58
+ exports.ReportDefinitionSeedProvider = ReportDefinitionSeedProvider = tslib_1.__decorate([
59
+ (0, common_1.Injectable)(),
60
+ tslib_1.__metadata("design:paramtypes", [report_1.BackendReportDefinitionRegistry])
61
+ ], ReportDefinitionSeedProvider);
62
+ //#endregion
63
+ //# sourceMappingURL=report-definition.seed-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-definition.seed-provider.js","sourceRoot":"","sources":["../../../../../../libs/modules/report-management/server/src/lib/report-definition.seed-provider.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAM5C,qEAIkD;AAElD,gDAAgD;AAEhD;;;GAGG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAMvC,YAA6B,QAAyC;QAAzC,aAAQ,GAAR,QAAQ,CAAiC;QAL7D,SAAI,GAAG,oBAAoB,CAAC;QAC5B,UAAK,GAAG,MAAe,CAAC;QACxB,eAAU,GAAG,mBAAmB,CAAC;QACjC,SAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAE6B,CAAC;IAEpE,OAAO,CAAC,QAA+B;;YAC3C,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;YAEpE,OAAO;gBACL;oBACE,GAAG,EAAE,4CAA4C;oBACjD,IAAI,EAAE,0BAA0B;oBAChC,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,YAAY,EAAE,IAAI,CAAC,IAAI;oBACvB,KAAK,EAAE,MAAM;oBACb,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,SAAS;oBACtB,MAAM,EAAE,+BAAsB;oBAC9B,OAAO,EAAE,UAAU;oBACnB,SAAS,EAAE,OAAO;oBAClB,UAAU,EAAE,CAAC,IAAI,CAAC;oBAClB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;iBACrB;gBACD;oBACE,GAAG,EAAE,oCAAoC;oBACzC,IAAI,EAAE,kBAAkB;oBACxB,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,YAAY,EAAE,IAAI,CAAC,IAAI;oBACvB,KAAK,EAAE,MAAM;oBACb,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,SAAS;oBACtB,MAAM,EAAE,sBAAa;oBACrB,OAAO,EAAE,WAAW;oBACpB,SAAS,EAAE,OAAO;oBAClB,UAAU,EAAE,CAAC,IAAI,CAAC;oBAClB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;oBACpB,SAAS,EAAE,CAAC,4CAA4C,CAAC;iBAC1D;aACF,CAAC;QACJ,CAAC;KAAA;CACF,CAAA;AA3CY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,mBAAU,GAAE;6CAO4B,wCAA+B;GAN3D,4BAA4B,CA2CxC;AAED,YAAY"}
@@ -0,0 +1,17 @@
1
+ import { EntityStorageMiddlewareService } from '@acorex-platform/framework-server/core';
2
+ import { BackendSessionService, RuntimePermissionService } from '@acorex-platform/framework-server/security';
3
+ import type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';
4
+ import { type AXPReportGenerationCreateInput, type AXPReportGenerationCreateResult } from '@acorex-platform/module-report-management-client/contracts';
5
+ import { ReportGenerationEnqueueService } from './report-generation-enqueue.service';
6
+ import { ReportGenerationStore } from './report-generation.store';
7
+ import { ReportGenerationSettingsService } from './report-generation-settings.service';
8
+ export declare class ReportGenerationCreateCommand implements AXPCommand<AXPReportGenerationCreateInput, AXPReportGenerationCreateResult> {
9
+ private readonly store;
10
+ private readonly enqueue;
11
+ private readonly session;
12
+ private readonly storage;
13
+ private readonly permissions;
14
+ private readonly generationSettings;
15
+ constructor(store: ReportGenerationStore, enqueue: ReportGenerationEnqueueService, session: BackendSessionService, storage: EntityStorageMiddlewareService, permissions: RuntimePermissionService, generationSettings: ReportGenerationSettingsService);
16
+ execute(input: AXPReportGenerationCreateInput): AXPCommandExecuteResultPromise<AXPReportGenerationCreateResult>;
17
+ }
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportGenerationCreateCommand = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const node_crypto_1 = require("node:crypto");
6
+ const common_1 = require("@nestjs/common");
7
+ const abstract_1 = require("@acorex-platform/framework-server/domain/abstract");
8
+ const report_1 = require("@acorex-platform/framework-server/report");
9
+ const core_1 = require("@acorex-platform/framework-server/core");
10
+ const security_1 = require("@acorex-platform/framework-server/security");
11
+ const module_report_management_contracts_1 = require("@acorex-platform/module-report-management-client/contracts");
12
+ const report_generation_enqueue_service_1 = require("./report-generation-enqueue.service");
13
+ const report_generation_store_1 = require("./report-generation.store");
14
+ const report_generation_constants_1 = require("./report-generation.constants");
15
+ const report_generation_policy_util_1 = require("./report-generation-policy.util");
16
+ const report_generation_settings_service_1 = require("./report-generation-settings.service");
17
+ const report_generation_job_presentation_util_1 = require("./report-generation-job-presentation.util");
18
+ const report_generation_util_1 = require("./report-generation.util");
19
+ function resolveKeepInTrayAfterComplete(generation, mode) {
20
+ if (typeof (generation === null || generation === void 0 ? void 0 : generation.keepInTray) === 'boolean') {
21
+ return generation.keepInTray;
22
+ }
23
+ return mode === 'background' || mode === 'choose';
24
+ }
25
+ //#region ----- Create command -----
26
+ let ReportGenerationCreateCommand = class ReportGenerationCreateCommand {
27
+ constructor(store, enqueue, session, storage, permissions, generationSettings) {
28
+ this.store = store;
29
+ this.enqueue = enqueue;
30
+ this.session = session;
31
+ this.storage = storage;
32
+ this.permissions = permissions;
33
+ this.generationSettings = generationSettings;
34
+ }
35
+ execute(input) {
36
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
37
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
38
+ const session = this.session.getSession();
39
+ const tenantId = (_a = session === null || session === void 0 ? void 0 : session.tenantId) === null || _a === void 0 ? void 0 : _a.trim();
40
+ if (!(session === null || session === void 0 ? void 0 : session.userId) || !tenantId) {
41
+ return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_FORBIDDEN_ERROR } };
42
+ }
43
+ const reportId = (_b = input.reportId) === null || _b === void 0 ? void 0 : _b.trim();
44
+ if (!reportId) {
45
+ return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_REPORT_NOT_FOUND_ERROR } };
46
+ }
47
+ const reportRow = yield (0, report_1.loadReportDefinitionById)(this.storage, reportId);
48
+ if (!reportRow) {
49
+ return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_REPORT_NOT_FOUND_ERROR } };
50
+ }
51
+ const report = reportRow;
52
+ const reportPermissions = (_c = report.permissions) !== null && _c !== void 0 ? _c : [];
53
+ if (reportPermissions.length > 0) {
54
+ const allowed = yield this.permissions.authorize(session.userId, ...reportPermissions);
55
+ if (!allowed) {
56
+ return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_FORBIDDEN_ERROR } };
57
+ }
58
+ }
59
+ const trigger = (_d = input.trigger) !== null && _d !== void 0 ? _d : 'manual';
60
+ const platformSettings = yield this.generationSettings.resolvePlatformSettings();
61
+ const generation = (0, report_generation_util_1.resolveGenerationOptions)(report.generation);
62
+ const formats = ((_e = input.formats) === null || _e === void 0 ? void 0 : _e.length) ? input.formats : generation.formats;
63
+ const layoutIds = (_f = input.layoutIds) === null || _f === void 0 ? void 0 : _f.map((id) => id.trim()).filter(Boolean);
64
+ const layoutId = ((_g = input.layoutId) === null || _g === void 0 ? void 0 : _g.trim()) || (layoutIds === null || layoutIds === void 0 ? void 0 : layoutIds[0]) || undefined;
65
+ if (trigger === 'schedule' && ((_h = input.scheduleId) === null || _h === void 0 ? void 0 : _h.trim())) {
66
+ const activeScheduleRun = yield this.store.findActiveByScheduleId(input.scheduleId.trim());
67
+ if (activeScheduleRun) {
68
+ return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_SCHEDULE_ALREADY_RUNNING_ERROR } };
69
+ }
70
+ }
71
+ if (trigger === 'manual') {
72
+ const maxConcurrent = platformSettings.maxConcurrentPerUser;
73
+ if (maxConcurrent > 0) {
74
+ const activeCount = yield this.store.countActiveManualByUser(session.userId);
75
+ if (activeCount >= maxConcurrent) {
76
+ return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_MAX_CONCURRENT_ERROR } };
77
+ }
78
+ }
79
+ }
80
+ const effectiveDedupe = (0, report_generation_policy_util_1.resolveEffectiveDedupe)((_j = report.generation) === null || _j === void 0 ? void 0 : _j.dedupe, platformSettings);
81
+ const fingerprint = (0, report_generation_policy_util_1.buildReportGenerationFingerprint)({
82
+ reportId,
83
+ layoutIds,
84
+ layoutId,
85
+ parameters: (_k = input.parameters) !== null && _k !== void 0 ? _k : {},
86
+ });
87
+ if ((0, report_generation_policy_util_1.isDedupePolicyActive)(effectiveDedupe, trigger)) {
88
+ const activeCandidates = yield this.store.listActiveByUserAndReport(session.userId, reportId);
89
+ let dedupeCandidates = activeCandidates;
90
+ if (effectiveDedupe.policy === 'in-flight-or-cooldown' && effectiveDedupe.cooldownMs > 0) {
91
+ const sinceIso = new Date(Date.now() - effectiveDedupe.cooldownMs).toISOString();
92
+ const completedCandidates = yield this.store.listCompletedSinceByUserAndReport({
93
+ userId: session.userId,
94
+ reportId,
95
+ sinceIso,
96
+ });
97
+ dedupeCandidates = [...activeCandidates, ...completedCandidates];
98
+ }
99
+ const dedupeMatch = (0, report_generation_policy_util_1.findDedupeMatch)({
100
+ fingerprint,
101
+ dedupe: effectiveDedupe,
102
+ candidates: dedupeCandidates,
103
+ });
104
+ if (dedupeMatch) {
105
+ if (input.suppressNotificationOnComplete === true &&
106
+ (dedupeMatch.status === 'queued' || dedupeMatch.status === 'running')) {
107
+ yield this.store.patchAsEngine(dedupeMatch.id, { suppressNotificationOnComplete: true });
108
+ }
109
+ return {
110
+ success: true,
111
+ kind: 'object',
112
+ data: {
113
+ id: dedupeMatch.id,
114
+ jobId: dedupeMatch.jobId,
115
+ status: dedupeMatch.status,
116
+ deduplicated: true,
117
+ },
118
+ };
119
+ }
120
+ }
121
+ const id = (0, node_crypto_1.randomUUID)();
122
+ const row = {
123
+ id,
124
+ reportId,
125
+ layoutId,
126
+ layoutIds: (layoutIds === null || layoutIds === void 0 ? void 0 : layoutIds.length) ? layoutIds : undefined,
127
+ parameters: (_l = input.parameters) !== null && _l !== void 0 ? _l : {},
128
+ formats,
129
+ trigger,
130
+ status: 'queued',
131
+ requestedBy: session.userId,
132
+ scheduleId: input.scheduleId,
133
+ scheduledOccurrence: input.scheduledOccurrence,
134
+ sourceRequestId: input.sourceRequestId,
135
+ suppressNotificationOnComplete: input.suppressNotificationOnComplete === true ? true : undefined,
136
+ artifacts: [],
137
+ };
138
+ yield this.store.insert(row);
139
+ const presentation = (0, report_generation_job_presentation_util_1.buildReportGenerationJobPresentation)(report, layoutId, layoutIds);
140
+ const job = yield this.enqueue.enqueue({
141
+ reportRequestId: id,
142
+ tenantId,
143
+ applicationId: ((_m = session.applicationId) === null || _m === void 0 ? void 0 : _m.trim()) || undefined,
144
+ userId: session.userId,
145
+ trigger: trigger === 'schedule' ? 'schedule' : 'manual',
146
+ executionTimeoutMs: generation.executionTimeoutMs,
147
+ title: presentation.title,
148
+ statusText: presentation.statusText,
149
+ currentStep: presentation.currentStep,
150
+ keepInTrayAfterComplete: resolveKeepInTrayAfterComplete(report.generation, generation.mode),
151
+ });
152
+ yield this.store.patchAsEngine(id, { jobId: job.jobId });
153
+ return {
154
+ success: true,
155
+ kind: 'object',
156
+ data: { id, jobId: job.jobId, status: 'queued', deduplicated: false },
157
+ };
158
+ });
159
+ }
160
+ };
161
+ exports.ReportGenerationCreateCommand = ReportGenerationCreateCommand;
162
+ exports.ReportGenerationCreateCommand = ReportGenerationCreateCommand = tslib_1.__decorate([
163
+ (0, abstract_1.ServerHandler)({
164
+ key: module_report_management_contracts_1.AXMReportManagementCommandKeys.ReportGeneration.Create,
165
+ auth: 'session',
166
+ permissions: [module_report_management_contracts_1.AXPInsightsReportingPermissionKeys.Access],
167
+ }),
168
+ (0, common_1.Injectable)(),
169
+ tslib_1.__metadata("design:paramtypes", [report_generation_store_1.ReportGenerationStore,
170
+ report_generation_enqueue_service_1.ReportGenerationEnqueueService,
171
+ security_1.BackendSessionService,
172
+ core_1.EntityStorageMiddlewareService,
173
+ security_1.RuntimePermissionService,
174
+ report_generation_settings_service_1.ReportGenerationSettingsService])
175
+ ], ReportGenerationCreateCommand);
176
+ //#endregion
177
+ //# sourceMappingURL=report-generation-create.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-generation-create.command.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation-create.command.ts"],"names":[],"mappings":";;;;AAAA,6CAAyC;AACzC,2CAA4C;AAC5C,gFAAkF;AAClF,qEAAoF;AACpF,iEAAwF;AACxF,yEAA6G;AAE7G,4GAQ6D;AAC7D,2FAAqF;AACrF,uEAAkE;AAClE,+EAKuC;AACvC,mFAKyC;AACzC,6FAAuF;AACvF,uGAEmD;AACnD,qEAAoE;AAEpE,SAAS,8BAA8B,CACrC,UAA6C,EAC7C,IAAyD;IAEzD,IAAI,OAAO,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,CAAA,KAAK,SAAS,EAAE,CAAC;QAChD,OAAO,UAAU,CAAC,UAAU,CAAC;IAC/B,CAAC;IACD,OAAO,IAAI,KAAK,YAAY,IAAI,IAAI,KAAK,QAAQ,CAAC;AACpD,CAAC;AAED,oCAAoC;AAQ7B,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAGxC,YACmB,KAA4B,EAC5B,OAAuC,EACvC,OAA8B,EAC9B,OAAuC,EACvC,WAAqC,EACrC,kBAAmD;QALnD,UAAK,GAAL,KAAK,CAAuB;QAC5B,YAAO,GAAP,OAAO,CAAgC;QACvC,YAAO,GAAP,OAAO,CAAuB;QAC9B,YAAO,GAAP,OAAO,CAAgC;QACvC,gBAAW,GAAX,WAAW,CAA0B;QACrC,uBAAkB,GAAlB,kBAAkB,CAAiC;IACnE,CAAC;IAEE,OAAO,CACX,KAAqC;;;YAErC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YAC1C,MAAM,QAAQ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SAAS;QACf,WAAW,EAAE,CAAC,uEAAkC,CAAC,MAAM,CAAC;KACzD,CAAC;IACD,IAAA,mBAAU,GAAE;6CAKe,+CAAqB;QACnB,kEAA8B;QAC9B,gCAAqB;QACrB,qCAA8B;QAC1B,mCAAwB;QACjB,oEAA+B;GAT3D,6BAA6B,CA0JzC;AAED,YAAY"}
@@ -0,0 +1,21 @@
1
+ import { BackgroundJobService } from '@acorex-platform/framework-server/background-job';
2
+ import type { AXPBackgroundJobTrigger } from '@acorex-platform/framework-shared/background-job';
3
+ export declare class ReportGenerationEnqueueService {
4
+ private readonly backgroundJobs;
5
+ constructor(backgroundJobs: BackgroundJobService);
6
+ enqueue(input: {
7
+ reportRequestId: string;
8
+ tenantId: string;
9
+ applicationId?: string;
10
+ userId?: string;
11
+ trigger: Extract<AXPBackgroundJobTrigger, 'manual' | 'schedule' | 'system'>;
12
+ executionTimeoutMs?: number;
13
+ title?: string;
14
+ statusText?: string;
15
+ currentStep?: string;
16
+ keepInTrayAfterComplete?: boolean;
17
+ }): Promise<{
18
+ jobId: string;
19
+ deduplicated?: boolean;
20
+ }>;
21
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportGenerationEnqueueService = 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 module_report_management_contracts_1 = require("@acorex-platform/module-report-management-client/contracts");
8
+ const report_generation_constants_1 = require("./report-generation.constants");
9
+ //#region ----- Enqueue -----
10
+ let ReportGenerationEnqueueService = class ReportGenerationEnqueueService {
11
+ constructor(backgroundJobs) {
12
+ this.backgroundJobs = backgroundJobs;
13
+ }
14
+ enqueue(input) {
15
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
+ var _a, _b;
17
+ const executionTimeoutMs = (_a = input.executionTimeoutMs) !== null && _a !== void 0 ? _a : report_generation_constants_1.REPORT_GENERATION_DEFAULT_TIMEOUT_MS;
18
+ const title = ((_b = input.title) === null || _b === void 0 ? void 0 : _b.trim()) || 'Generate Report';
19
+ const result = yield this.backgroundJobs.createJob({
20
+ command: {
21
+ key: module_report_management_contracts_1.AXMReportManagementCommandKeys.ReportGeneration.Execute,
22
+ title,
23
+ payload: { reportRequestId: input.reportRequestId },
24
+ },
25
+ providerKey: report_generation_constants_1.REPORT_GENERATION_JOB_PROVIDER_KEY,
26
+ title,
27
+ trigger: input.trigger,
28
+ tenantId: input.tenantId,
29
+ applicationId: input.applicationId,
30
+ userId: input.userId,
31
+ idempotencyKey: `report-generation:${input.reportRequestId}`,
32
+ visibility: 'initiator',
33
+ executionTimeoutMs,
34
+ progress: 0,
35
+ statusText: input.statusText,
36
+ currentStep: input.currentStep,
37
+ capabilities: {
38
+ clickable: true,
39
+ // ReportGenerationNotifyService owns inbox copy (report name + Open Report).
40
+ notifyOnComplete: false,
41
+ notifyOnFailed: false,
42
+ supportsCooperativeCancellation: true,
43
+ supportsProgress: true,
44
+ supportsEstimate: true,
45
+ keepInTrayAfterComplete: input.keepInTrayAfterComplete !== false,
46
+ },
47
+ });
48
+ return { jobId: result.jobId, deduplicated: result.deduplicated };
49
+ });
50
+ }
51
+ };
52
+ exports.ReportGenerationEnqueueService = ReportGenerationEnqueueService;
53
+ exports.ReportGenerationEnqueueService = ReportGenerationEnqueueService = tslib_1.__decorate([
54
+ (0, common_1.Injectable)(),
55
+ tslib_1.__metadata("design:paramtypes", [background_job_1.BackgroundJobService])
56
+ ], ReportGenerationEnqueueService);
57
+ //#endregion
58
+ //# sourceMappingURL=report-generation-enqueue.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-generation-enqueue.service.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation-enqueue.service.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,qFAAwF;AAExF,4GAAqG;AACrG,+EAGuC;AAGvC,6BAA6B;AA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AAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;QACpE,CAAC;KAAA;CACF,CAAA;AAjDY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;6CAEkC,qCAAoB;GADtD,8BAA8B,CAiD1C;AAED,YAAY"}
@@ -0,0 +1,10 @@
1
+ import type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';
2
+ import { type AXPReportGenerationExecuteInput, type AXPReportGenerationExecuteResult } from '@acorex-platform/module-report-management-client/contracts';
3
+ import { ReportGenerationExecuteService } from './report-generation-execute.service';
4
+ import { ReportGenerationStore } from './report-generation.store';
5
+ export declare class ReportGenerationExecuteCommand implements AXPCommand<AXPReportGenerationExecuteInput, AXPReportGenerationExecuteResult> {
6
+ private readonly store;
7
+ private readonly executeService;
8
+ constructor(store: ReportGenerationStore, executeService: ReportGenerationExecuteService);
9
+ execute(input: AXPReportGenerationExecuteInput): AXPCommandExecuteResultPromise<AXPReportGenerationExecuteResult>;
10
+ }
@@ -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;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E,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, 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
+ }