@acorex-platform/module-report-management-server 0.0.18 → 2.0.0-next.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/src/commands.keys.d.ts +11 -0
- package/contracts/src/commands.keys.js +17 -0
- package/contracts/src/commands.keys.js.map +1 -0
- package/contracts/src/entities/index.d.ts +3 -0
- package/contracts/src/entities/index.js +3 -0
- package/contracts/src/entities/index.js.map +1 -1
- package/contracts/src/entities/query-snapshot/index.d.ts +1 -0
- package/contracts/src/entities/query-snapshot/index.js +5 -0
- package/contracts/src/entities/query-snapshot/index.js.map +1 -0
- package/contracts/src/entities/query-snapshot/query-snapshot.entity.d.ts +2 -0
- package/contracts/src/entities/query-snapshot/query-snapshot.entity.js +127 -0
- package/contracts/src/entities/query-snapshot/query-snapshot.entity.js.map +1 -0
- package/contracts/src/entities/query-snapshot/query-snapshot.types.d.ts +34 -0
- package/contracts/src/entities/query-snapshot/query-snapshot.types.js +5 -0
- package/contracts/src/entities/query-snapshot/query-snapshot.types.js.map +1 -0
- package/contracts/src/entities/query-snapshot-policy/index.d.ts +1 -0
- package/contracts/src/entities/query-snapshot-policy/index.js +5 -0
- package/contracts/src/entities/query-snapshot-policy/index.js.map +1 -0
- package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.entity.d.ts +2 -0
- package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.entity.js +100 -0
- package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.entity.js.map +1 -0
- package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.types.d.ts +14 -0
- package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.types.js +5 -0
- package/contracts/src/entities/query-snapshot-policy/query-snapshot-policy.types.js.map +1 -0
- package/contracts/src/entities/report/index.d.ts +1 -1
- package/contracts/src/entities/report/index.js +1 -1
- package/contracts/src/entities/report/index.js.map +1 -1
- package/contracts/src/entities/report/report.entity.js +51 -7
- package/contracts/src/entities/report/report.entity.js.map +1 -1
- package/contracts/src/entities/report-category/index.d.ts +1 -1
- package/contracts/src/entities/report-category/index.js +0 -2
- package/contracts/src/entities/report-category/index.js.map +1 -1
- package/contracts/src/entities/report-category/report-category.entity.js +14 -1
- package/contracts/src/entities/report-category/report-category.entity.js.map +1 -1
- package/contracts/src/entities/report-generation-request/index.d.ts +1 -0
- package/contracts/src/entities/report-generation-request/index.js +5 -0
- package/contracts/src/entities/report-generation-request/index.js.map +1 -0
- package/contracts/src/entities/report-generation-request/report-generation-request.entity.d.ts +2 -0
- package/contracts/src/entities/report-generation-request/report-generation-request.entity.js +208 -0
- package/contracts/src/entities/report-generation-request/report-generation-request.entity.js.map +1 -0
- package/contracts/src/entity-catalog.d.ts +7 -0
- package/contracts/src/entity-catalog.js +24 -0
- package/contracts/src/entity-catalog.js.map +1 -0
- package/contracts/src/entity-entry.query-snapshot-policy.d.ts +1 -0
- package/contracts/src/entity-entry.query-snapshot-policy.js +6 -0
- package/contracts/src/entity-entry.query-snapshot-policy.js.map +1 -0
- package/contracts/src/entity-entry.query-snapshot.d.ts +1 -0
- package/contracts/src/entity-entry.query-snapshot.js +6 -0
- package/contracts/src/entity-entry.query-snapshot.js.map +1 -0
- package/contracts/src/entity-entry.report-category.d.ts +1 -0
- package/contracts/src/entity-entry.report-category.js +6 -0
- package/contracts/src/entity-entry.report-category.js.map +1 -0
- package/contracts/src/entity-entry.report-generation-request.d.ts +1 -0
- package/contracts/src/entity-entry.report-generation-request.js +6 -0
- package/contracts/src/entity-entry.report-generation-request.js.map +1 -0
- package/contracts/src/entity-entry.report.d.ts +1 -0
- package/contracts/src/entity-entry.report.js +6 -0
- package/contracts/src/entity-entry.report.js.map +1 -0
- package/contracts/src/index.d.ts +5 -0
- package/contracts/src/index.js +5 -0
- package/contracts/src/index.js.map +1 -1
- package/contracts/src/manifest.d.ts +6 -0
- package/contracts/src/manifest.js +24 -0
- package/contracts/src/manifest.js.map +1 -0
- package/contracts/src/permission.keys.d.ts +30 -14
- package/contracts/src/permission.keys.js +28 -12
- package/contracts/src/permission.keys.js.map +1 -1
- package/contracts/src/report-generation.types.d.ts +97 -0
- package/contracts/src/report-generation.types.js +14 -0
- package/contracts/src/report-generation.types.js.map +1 -0
- package/contracts/src/report.types.d.ts +107 -107
- package/contracts/src/report.types.js.map +1 -1
- package/contracts/src/root-config.d.ts +23 -2
- package/contracts/src/root-config.js +23 -2
- package/contracts/src/root-config.js.map +1 -1
- package/contracts/src/runtime.keys.d.ts +14 -0
- package/contracts/src/runtime.keys.js +20 -0
- package/contracts/src/runtime.keys.js.map +1 -0
- package/contracts/src/settings.keys.d.ts +11 -0
- package/contracts/src/settings.keys.js +17 -0
- package/contracts/src/settings.keys.js.map +1 -0
- package/package.json +8 -8
- package/server/src/index.d.ts +2 -4
- package/server/src/index.js +5 -8
- package/server/src/index.js.map +1 -1
- package/server/src/lib/entities/index.d.ts +1 -0
- package/server/src/lib/entities/index.js +5 -0
- package/server/src/lib/entities/index.js.map +1 -0
- package/server/src/lib/entities/report-management.entity-catalog.d.ts +1 -0
- package/server/src/lib/entities/report-management.entity-catalog.js +12 -0
- package/server/src/lib/entities/report-management.entity-catalog.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot-bypass.util.d.ts +3 -0
- package/server/src/lib/query-snapshots/query-snapshot-bypass.util.js +16 -0
- package/server/src/lib/query-snapshots/query-snapshot-bypass.util.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot-debounce.service.d.ts +19 -0
- package/server/src/lib/query-snapshots/query-snapshot-debounce.service.js +118 -0
- package/server/src/lib/query-snapshots/query-snapshot-debounce.service.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot-enqueue.service.d.ts +24 -0
- package/server/src/lib/query-snapshots/query-snapshot-enqueue.service.js +61 -0
- package/server/src/lib/query-snapshots/query-snapshot-enqueue.service.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot-entity-change.middleware.d.ts +12 -0
- package/server/src/lib/query-snapshots/query-snapshot-entity-change.middleware.js +90 -0
- package/server/src/lib/query-snapshots/query-snapshot-entity-change.middleware.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot-entity-storage.bootstrap.d.ts +9 -0
- package/server/src/lib/query-snapshots/query-snapshot-entity-storage.bootstrap.js +25 -0
- package/server/src/lib/query-snapshots/query-snapshot-entity-storage.bootstrap.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot-payload.util.d.ts +22 -0
- package/server/src/lib/query-snapshots/query-snapshot-payload.util.js +282 -0
- package/server/src/lib/query-snapshots/query-snapshot-payload.util.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot-recalc.service.d.ts +23 -0
- package/server/src/lib/query-snapshots/query-snapshot-recalc.service.js +122 -0
- package/server/src/lib/query-snapshots/query-snapshot-recalc.service.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot-schedule.setup.d.ts +2 -0
- package/server/src/lib/query-snapshots/query-snapshot-schedule.setup.js +79 -0
- package/server/src/lib/query-snapshots/query-snapshot-schedule.setup.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot.constants.d.ts +17 -0
- package/server/src/lib/query-snapshots/query-snapshot.constants.js +46 -0
- package/server/src/lib/query-snapshots/query-snapshot.constants.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot.middleware.d.ts +21 -0
- package/server/src/lib/query-snapshots/query-snapshot.middleware.js +135 -0
- package/server/src/lib/query-snapshots/query-snapshot.middleware.js.map +1 -0
- package/server/src/lib/query-snapshots/query-snapshot.store.d.ts +34 -0
- package/server/src/lib/query-snapshots/query-snapshot.store.js +137 -0
- package/server/src/lib/query-snapshots/query-snapshot.store.js.map +1 -0
- package/server/src/lib/query-snapshots/recalculate-query-snapshots.command.d.ts +8 -0
- package/server/src/lib/query-snapshots/recalculate-query-snapshots.command.js +74 -0
- package/server/src/lib/query-snapshots/recalculate-query-snapshots.command.js.map +1 -0
- package/server/src/lib/query-snapshots/refresh-query-snapshots.command.d.ts +16 -0
- package/server/src/lib/query-snapshots/refresh-query-snapshots.command.js +56 -0
- package/server/src/lib/query-snapshots/refresh-query-snapshots.command.js.map +1 -0
- package/server/src/lib/report-browse.service.js +32 -13
- package/server/src/lib/report-browse.service.js.map +1 -1
- package/server/src/lib/report-browse.types.d.ts +27 -12
- package/server/src/lib/report-browse.types.js +0 -1
- package/server/src/lib/report-browse.types.js.map +1 -1
- package/server/src/lib/report-definition.seed-provider.d.ts +15 -0
- package/server/src/lib/report-definition.seed-provider.js +63 -0
- package/server/src/lib/report-definition.seed-provider.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-create.command.d.ts +17 -0
- package/server/src/lib/report-generation/report-generation-create.command.js +177 -0
- package/server/src/lib/report-generation/report-generation-create.command.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-enqueue.service.d.ts +21 -0
- package/server/src/lib/report-generation/report-generation-enqueue.service.js +58 -0
- package/server/src/lib/report-generation/report-generation-enqueue.service.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-execute.command.d.ts +10 -0
- package/server/src/lib/report-generation/report-generation-execute.command.js +49 -0
- package/server/src/lib/report-generation/report-generation-execute.command.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-execute.service.d.ts +23 -0
- package/server/src/lib/report-generation/report-generation-execute.service.js +225 -0
- package/server/src/lib/report-generation/report-generation-execute.service.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-job-presentation.util.d.ts +8 -0
- package/server/src/lib/report-generation/report-generation-job-presentation.util.js +43 -0
- package/server/src/lib/report-generation/report-generation-job-presentation.util.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-notify.service.d.ts +23 -0
- package/server/src/lib/report-generation/report-generation-notify.service.js +159 -0
- package/server/src/lib/report-generation/report-generation-notify.service.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-policy.util.d.ts +39 -0
- package/server/src/lib/report-generation/report-generation-policy.util.js +95 -0
- package/server/src/lib/report-generation/report-generation-policy.util.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-progress.util.d.ts +14 -0
- package/server/src/lib/report-generation/report-generation-progress.util.js +51 -0
- package/server/src/lib/report-generation/report-generation-progress.util.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-release-inline-watch.command.d.ts +10 -0
- package/server/src/lib/report-generation/report-generation-release-inline-watch.command.js +55 -0
- package/server/src/lib/report-generation/report-generation-release-inline-watch.command.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-runtime.handlers.d.ts +27 -0
- package/server/src/lib/report-generation/report-generation-runtime.handlers.js +136 -0
- package/server/src/lib/report-generation/report-generation-runtime.handlers.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-settings.service.d.ts +12 -0
- package/server/src/lib/report-generation/report-generation-settings.service.js +49 -0
- package/server/src/lib/report-generation/report-generation-settings.service.js.map +1 -0
- package/server/src/lib/report-generation/report-generation.constants.d.ts +16 -0
- package/server/src/lib/report-generation/report-generation.constants.js +24 -0
- package/server/src/lib/report-generation/report-generation.constants.js.map +1 -0
- package/server/src/lib/report-generation/report-generation.store.d.ts +25 -0
- package/server/src/lib/report-generation/report-generation.store.js +145 -0
- package/server/src/lib/report-generation/report-generation.store.js.map +1 -0
- package/server/src/lib/report-generation/report-generation.util.d.ts +8 -0
- package/server/src/lib/report-generation/report-generation.util.js +131 -0
- package/server/src/lib/report-generation/report-generation.util.js.map +1 -0
- package/server/src/lib/report-management-runtime.handlers.d.ts +32 -0
- package/server/src/lib/report-management-runtime.handlers.js +78 -0
- package/server/src/lib/report-management-runtime.handlers.js.map +1 -0
- package/server/src/lib/report-management-server.module.js +64 -9
- package/server/src/lib/report-management-server.module.js.map +1 -1
- package/server/src/lib/report-management.controller.d.ts +1 -4
- package/server/src/lib/report-management.controller.js +2 -16
- package/server/src/lib/report-management.controller.js.map +1 -1
- package/server/src/lib/seed/index.d.ts +0 -19
- package/server/src/lib/seed/index.js +0 -21
- package/server/src/lib/seed/index.js.map +0 -1
- package/server/src/lib/seed/report-management-seed.provider.d.ts +0 -4
- package/server/src/lib/seed/report-management-seed.provider.js +0 -18
- package/server/src/lib/seed/report-management-seed.provider.js.map +0 -1
- package/server/src/lib/seed/report-management-seed.tokens.d.ts +0 -1
- package/server/src/lib/seed/report-management-seed.tokens.js +0 -7
- package/server/src/lib/seed/report-management-seed.tokens.js.map +0 -1
- package/server/src/lib/seed/report-management.seed-catalog.d.ts +0 -2
- package/server/src/lib/seed/report-management.seed-catalog.js +0 -10
- package/server/src/lib/seed/report-management.seed-catalog.js.map +0 -1
- package/server/src/lib/seed/samples/employee-report.mock.d.ts +0 -9
- package/server/src/lib/seed/samples/employee-report.mock.js +0 -322
- package/server/src/lib/seed/samples/employee-report.mock.js.map +0 -1
- package/server/src/lib/seed/samples/index.d.ts +0 -2
- package/server/src/lib/seed/samples/index.js +0 -6
- package/server/src/lib/seed/samples/index.js.map +0 -1
- package/server/src/lib/seed/samples/location-report.mock.d.ts +0 -9
- package/server/src/lib/seed/samples/location-report.mock.js +0 -339
- package/server/src/lib/seed/samples/location-report.mock.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ReportGenerationProgressReporter {
|
|
2
|
+
reportProgress(progress: number, statusText?: string, currentStep?: string): Promise<void>;
|
|
3
|
+
heartbeat?(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Advances tray progress in steps while a demo/report simulate delay runs.
|
|
7
|
+
* Keeps the footer task bar moving instead of freezing on the first loading milestone.
|
|
8
|
+
*/
|
|
9
|
+
export declare function simulateReportGenerationProgressDelay(progress: ReportGenerationProgressReporter | undefined, delayMs: number, options: {
|
|
10
|
+
fromProgress: number;
|
|
11
|
+
toProgress: number;
|
|
12
|
+
statusText: string;
|
|
13
|
+
stepIntervalMs?: number;
|
|
14
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ----- Types -----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.simulateReportGenerationProgressDelay = simulateReportGenerationProgressDelay;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region ----- Constants -----
|
|
8
|
+
const DEFAULT_SIMULATE_STEP_MS = 500;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ----- Simulated progress -----
|
|
11
|
+
/**
|
|
12
|
+
* Advances tray progress in steps while a demo/report simulate delay runs.
|
|
13
|
+
* Keeps the footer task bar moving instead of freezing on the first loading milestone.
|
|
14
|
+
*/
|
|
15
|
+
function simulateReportGenerationProgressDelay(progress, delayMs, options) {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
if (delayMs <= 0) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!progress) {
|
|
22
|
+
yield sleep(delayMs);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const stepIntervalMs = Math.max(100, (_a = options.stepIntervalMs) !== null && _a !== void 0 ? _a : DEFAULT_SIMULATE_STEP_MS);
|
|
26
|
+
const fromProgress = options.fromProgress;
|
|
27
|
+
const toProgress = options.toProgress;
|
|
28
|
+
const startedAt = Date.now();
|
|
29
|
+
while (true) {
|
|
30
|
+
const elapsedMs = Date.now() - startedAt;
|
|
31
|
+
if (elapsedMs >= delayMs) {
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
const ratio = elapsedMs / delayMs;
|
|
35
|
+
const value = Math.round(fromProgress + (toProgress - fromProgress) * ratio);
|
|
36
|
+
yield progress.reportProgress(value, options.statusText);
|
|
37
|
+
yield ((_b = progress.heartbeat) === null || _b === void 0 ? void 0 : _b.call(progress));
|
|
38
|
+
const waitMs = Math.min(stepIntervalMs, delayMs - elapsedMs);
|
|
39
|
+
yield sleep(waitMs);
|
|
40
|
+
}
|
|
41
|
+
yield progress.reportProgress(toProgress, options.statusText);
|
|
42
|
+
yield ((_c = progress.heartbeat) === null || _c === void 0 ? void 0 : _c.call(progress));
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function sleep(ms) {
|
|
46
|
+
return new Promise((resolve) => {
|
|
47
|
+
setTimeout(resolve, ms);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//# sourceMappingURL=report-generation-progress.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generation-progress.util.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation-progress.util.ts"],"names":[],"mappings":";AAAA,2BAA2B;;AAqB3B,sFAyCC;;AAvDD,YAAY;AAEZ,+BAA+B;AAE/B,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAErC,YAAY;AAEZ,wCAAwC;AAExC;;;GAGG;AACH,SAAsB,qCAAqC,CACzD,QAAsD,EACtD,OAAe,EACf,OAKC;;;QAED,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAA,OAAO,CAAC,cAAc,mCAAI,wBAAwB,CAAC,CAAC;QACzF,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QAC1C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YACzC,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;gBACzB,MAAM;YACR,CAAC;YAED,MAAM,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC;YAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,UAAU,GAAG,YAAY,CAAC,GAAG,KAAK,CAAC,CAAC;YAC7E,MAAM,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;YACzD,MAAM,CAAA,MAAA,QAAQ,CAAC,SAAS,wDAAI,CAAA,CAAC;YAE7B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;YAC7D,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;QAED,MAAM,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QAC9D,MAAM,CAAA,MAAA,QAAQ,CAAC,SAAS,wDAAI,CAAA,CAAC;IAC/B,CAAC;CAAA;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,YAAY"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BackendSessionService } from '@acorex-platform/framework-server/security';
|
|
2
|
+
import type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';
|
|
3
|
+
import { type AXPReportGenerationReleaseInlineWatchInput } from '@acorex-platform/module-report-management-client/contracts';
|
|
4
|
+
import { ReportGenerationStore } from './report-generation.store';
|
|
5
|
+
export declare class ReportGenerationReleaseInlineWatchCommand implements AXPCommand<AXPReportGenerationReleaseInlineWatchInput, void> {
|
|
6
|
+
private readonly store;
|
|
7
|
+
private readonly session;
|
|
8
|
+
constructor(store: ReportGenerationStore, session: BackendSessionService);
|
|
9
|
+
execute(input: AXPReportGenerationReleaseInlineWatchInput): AXPCommandExecuteResultPromise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportGenerationReleaseInlineWatchCommand = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const abstract_1 = require("@acorex-platform/framework-server/domain/abstract");
|
|
7
|
+
const security_1 = require("@acorex-platform/framework-server/security");
|
|
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_store_1 = require("./report-generation.store");
|
|
11
|
+
//#region ----- Release inline watch -----
|
|
12
|
+
let ReportGenerationReleaseInlineWatchCommand = class ReportGenerationReleaseInlineWatchCommand {
|
|
13
|
+
constructor(store, session) {
|
|
14
|
+
this.store = store;
|
|
15
|
+
this.session = session;
|
|
16
|
+
}
|
|
17
|
+
execute(input) {
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
var _a;
|
|
20
|
+
const session = this.session.getSession();
|
|
21
|
+
if (!(session === null || session === void 0 ? void 0 : session.userId)) {
|
|
22
|
+
return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_FORBIDDEN_ERROR } };
|
|
23
|
+
}
|
|
24
|
+
const id = (_a = input.id) === null || _a === void 0 ? void 0 : _a.trim();
|
|
25
|
+
if (!id) {
|
|
26
|
+
return { success: true, kind: 'value', data: undefined };
|
|
27
|
+
}
|
|
28
|
+
const row = yield this.store.getById(id);
|
|
29
|
+
if (!row || row.requestedBy !== session.userId) {
|
|
30
|
+
return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_FORBIDDEN_ERROR } };
|
|
31
|
+
}
|
|
32
|
+
if (row.status !== 'queued' && row.status !== 'running') {
|
|
33
|
+
return { success: true, kind: 'value', data: undefined };
|
|
34
|
+
}
|
|
35
|
+
if (row.suppressNotificationOnComplete !== true) {
|
|
36
|
+
return { success: true, kind: 'value', data: undefined };
|
|
37
|
+
}
|
|
38
|
+
yield this.store.patchAsEngine(id, { suppressNotificationOnComplete: false });
|
|
39
|
+
return { success: true, kind: 'value', data: undefined };
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.ReportGenerationReleaseInlineWatchCommand = ReportGenerationReleaseInlineWatchCommand;
|
|
44
|
+
exports.ReportGenerationReleaseInlineWatchCommand = ReportGenerationReleaseInlineWatchCommand = tslib_1.__decorate([
|
|
45
|
+
(0, abstract_1.ServerHandler)({
|
|
46
|
+
key: module_report_management_contracts_1.AXMReportManagementCommandKeys.ReportGeneration.ReleaseInlineWatch,
|
|
47
|
+
auth: 'session',
|
|
48
|
+
permissions: [module_report_management_contracts_1.AXPInsightsReportingPermissionKeys.Access],
|
|
49
|
+
}),
|
|
50
|
+
(0, common_1.Injectable)(),
|
|
51
|
+
tslib_1.__metadata("design:paramtypes", [report_generation_store_1.ReportGenerationStore,
|
|
52
|
+
security_1.BackendSessionService])
|
|
53
|
+
], ReportGenerationReleaseInlineWatchCommand);
|
|
54
|
+
//#endregion
|
|
55
|
+
//# sourceMappingURL=report-generation-release-inline-watch.command.js.map
|
package/server/src/lib/report-generation/report-generation-release-inline-watch.command.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generation-release-inline-watch.command.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation-release-inline-watch.command.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,gFAAkF;AAClF,yEAAmF;AAEnF,4GAI6D;AAC7D,+EAAkF;AAClF,uEAAkE;AAElE,0CAA0C;AAQnC,IAAM,yCAAyC,GAA/C,MAAM,yCAAyC;IAGpD,YACmB,KAA4B,EAC5B,OAA8B;QAD9B,UAAK,GAAL,KAAK,CAAuB;QAC5B,YAAO,GAAP,OAAO,CAAuB;IAC9C,CAA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B,EAAE,KAAK,EAAE,CAAC,CAAC;YAC9E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC3D,CAAC;KAAA;CACF,CAAA;AArCY,8FAAyC;oDAAzC,yCAAyC;IANrD,IAAA,wBAAa,EAAC;QACb,GAAG,EAAE,mEAA8B,CAAC,gBAAgB,CAAC,kBAAkB;QACvE,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,CAAC,uEAAkC,CAAC,MAAM,CAAC;KACzD,CAAC;IACD,IAAA,mBAAU,GAAE;6CAKe,+CAAqB;QACnB,gCAAqB;GALtC,yCAAyC,CAqCrD;AAED,YAAY"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AXPServerQueryHandler } from '@acorex-platform/framework-server/domain/abstract';
|
|
2
|
+
import { FileStorageFacadeService } from '@acorex-platform/framework-server/file-storage/http';
|
|
3
|
+
import { BackendSessionService, RuntimePermissionService } from '@acorex-platform/framework-server/security';
|
|
4
|
+
import type { AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';
|
|
5
|
+
import { type AXPReportGenerationGetInput, type AXPReportGenerationGetViewerFreezeInput, type AXPReportGenerationListMineInput, type AXPReportViewerFreeze, type AXMReportGenerationRequest } from '@acorex-platform/module-report-management-client/contracts';
|
|
6
|
+
import { ReportGenerationStore } from './report-generation.store';
|
|
7
|
+
export declare class ReportGenerationGetQuery implements AXPServerQueryHandler<AXPReportGenerationGetInput, AXMReportGenerationRequest> {
|
|
8
|
+
private readonly store;
|
|
9
|
+
private readonly session;
|
|
10
|
+
private readonly permissions;
|
|
11
|
+
constructor(store: ReportGenerationStore, session: BackendSessionService, permissions: RuntimePermissionService);
|
|
12
|
+
execute(input: AXPReportGenerationGetInput): AXPQueryFetchResultPromise<AXMReportGenerationRequest>;
|
|
13
|
+
}
|
|
14
|
+
export declare class ReportGenerationListMineQuery implements AXPServerQueryHandler<AXPReportGenerationListMineInput, AXMReportGenerationRequest> {
|
|
15
|
+
private readonly store;
|
|
16
|
+
private readonly session;
|
|
17
|
+
constructor(store: ReportGenerationStore, session: BackendSessionService);
|
|
18
|
+
execute(input?: AXPReportGenerationListMineInput): AXPQueryFetchResultPromise<AXMReportGenerationRequest>;
|
|
19
|
+
}
|
|
20
|
+
export declare class ReportGenerationGetViewerFreezeQuery implements AXPServerQueryHandler<AXPReportGenerationGetViewerFreezeInput, AXPReportViewerFreeze> {
|
|
21
|
+
private readonly store;
|
|
22
|
+
private readonly session;
|
|
23
|
+
private readonly fileStorage;
|
|
24
|
+
private readonly permissions;
|
|
25
|
+
constructor(store: ReportGenerationStore, session: BackendSessionService, fileStorage: FileStorageFacadeService, permissions: RuntimePermissionService);
|
|
26
|
+
execute(input: AXPReportGenerationGetViewerFreezeInput): AXPQueryFetchResultPromise<AXPReportViewerFreeze>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region ---- Imports ----
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ReportGenerationGetViewerFreezeQuery = exports.ReportGenerationListMineQuery = exports.ReportGenerationGetQuery = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const abstract_1 = require("@acorex-platform/framework-server/domain/abstract");
|
|
8
|
+
const http_1 = require("@acorex-platform/framework-server/file-storage/http");
|
|
9
|
+
const security_1 = require("@acorex-platform/framework-server/security");
|
|
10
|
+
const core_1 = require("@acorex-platform/framework-shared/core");
|
|
11
|
+
const module_report_management_contracts_1 = require("@acorex-platform/module-report-management-client/contracts");
|
|
12
|
+
const report_generation_constants_1 = require("./report-generation.constants");
|
|
13
|
+
const report_generation_store_1 = require("./report-generation.store");
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region ---- Access ----
|
|
16
|
+
function canReadRequest(request, userId, canMaintain) {
|
|
17
|
+
if (canMaintain) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return Boolean(userId && request.requestedBy === userId);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ---- Queries ----
|
|
24
|
+
let ReportGenerationGetQuery = class ReportGenerationGetQuery {
|
|
25
|
+
constructor(store, session, permissions) {
|
|
26
|
+
this.store = store;
|
|
27
|
+
this.session = session;
|
|
28
|
+
this.permissions = permissions;
|
|
29
|
+
}
|
|
30
|
+
execute(input) {
|
|
31
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
const request = yield this.store.getById((_b = (_a = input.id) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '');
|
|
34
|
+
if (!request) {
|
|
35
|
+
return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_NOT_FOUND_ERROR } };
|
|
36
|
+
}
|
|
37
|
+
const userId = (_c = this.session.getSession()) === null || _c === void 0 ? void 0 : _c.userId;
|
|
38
|
+
const canMaintain = yield this.permissions.authorize(userId, module_report_management_contracts_1.AXPInsightsReportingPermissionKeys.MaintainReports);
|
|
39
|
+
if (!canReadRequest(request, userId, canMaintain)) {
|
|
40
|
+
return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_FORBIDDEN_ERROR } };
|
|
41
|
+
}
|
|
42
|
+
return (0, core_1.runtimeQuerySuccessObject)(request);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.ReportGenerationGetQuery = ReportGenerationGetQuery;
|
|
47
|
+
exports.ReportGenerationGetQuery = ReportGenerationGetQuery = tslib_1.__decorate([
|
|
48
|
+
(0, abstract_1.ServerQueryHandler)({
|
|
49
|
+
key: module_report_management_contracts_1.AXMReportManagementQueryKeys.ReportGeneration.Get,
|
|
50
|
+
auth: 'session',
|
|
51
|
+
permissions: [module_report_management_contracts_1.AXPInsightsReportingPermissionKeys.Access],
|
|
52
|
+
}),
|
|
53
|
+
(0, common_1.Injectable)(),
|
|
54
|
+
tslib_1.__metadata("design:paramtypes", [report_generation_store_1.ReportGenerationStore,
|
|
55
|
+
security_1.BackendSessionService,
|
|
56
|
+
security_1.RuntimePermissionService])
|
|
57
|
+
], ReportGenerationGetQuery);
|
|
58
|
+
let ReportGenerationListMineQuery = class ReportGenerationListMineQuery {
|
|
59
|
+
constructor(store, session) {
|
|
60
|
+
this.store = store;
|
|
61
|
+
this.session = session;
|
|
62
|
+
}
|
|
63
|
+
execute() {
|
|
64
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (input = {}) {
|
|
65
|
+
var _a;
|
|
66
|
+
const userId = (_a = this.session.getSession()) === null || _a === void 0 ? void 0 : _a.userId;
|
|
67
|
+
if (!userId) {
|
|
68
|
+
return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_FORBIDDEN_ERROR } };
|
|
69
|
+
}
|
|
70
|
+
const page = yield this.store.listMine({
|
|
71
|
+
userId,
|
|
72
|
+
skip: input.skip,
|
|
73
|
+
take: input.take,
|
|
74
|
+
});
|
|
75
|
+
return (0, core_1.runtimeQuerySuccessCollection)({ items: page.items, total: page.total });
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.ReportGenerationListMineQuery = ReportGenerationListMineQuery;
|
|
80
|
+
exports.ReportGenerationListMineQuery = ReportGenerationListMineQuery = tslib_1.__decorate([
|
|
81
|
+
(0, abstract_1.ServerQueryHandler)({
|
|
82
|
+
key: module_report_management_contracts_1.AXMReportManagementQueryKeys.ReportGeneration.ListMine,
|
|
83
|
+
auth: 'session',
|
|
84
|
+
permissions: [module_report_management_contracts_1.AXPInsightsReportingPermissionKeys.Access],
|
|
85
|
+
}),
|
|
86
|
+
(0, common_1.Injectable)(),
|
|
87
|
+
tslib_1.__metadata("design:paramtypes", [report_generation_store_1.ReportGenerationStore,
|
|
88
|
+
security_1.BackendSessionService])
|
|
89
|
+
], ReportGenerationListMineQuery);
|
|
90
|
+
let ReportGenerationGetViewerFreezeQuery = class ReportGenerationGetViewerFreezeQuery {
|
|
91
|
+
constructor(store, session, fileStorage, permissions) {
|
|
92
|
+
this.store = store;
|
|
93
|
+
this.session = session;
|
|
94
|
+
this.fileStorage = fileStorage;
|
|
95
|
+
this.permissions = permissions;
|
|
96
|
+
}
|
|
97
|
+
execute(input) {
|
|
98
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
var _a, _b, _c, _d;
|
|
100
|
+
const request = yield this.store.getById((_b = (_a = input.id) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '');
|
|
101
|
+
if (!request) {
|
|
102
|
+
return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_NOT_FOUND_ERROR } };
|
|
103
|
+
}
|
|
104
|
+
const userId = (_c = this.session.getSession()) === null || _c === void 0 ? void 0 : _c.userId;
|
|
105
|
+
const canMaintain = yield this.permissions.authorize(userId, module_report_management_contracts_1.AXPInsightsReportingPermissionKeys.MaintainReports);
|
|
106
|
+
if (!canReadRequest(request, userId, canMaintain)) {
|
|
107
|
+
return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_FORBIDDEN_ERROR } };
|
|
108
|
+
}
|
|
109
|
+
const viewer = (_d = request.artifacts) === null || _d === void 0 ? void 0 : _d.find((artifact) => artifact.kind === 'viewer' && artifact.fileId);
|
|
110
|
+
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.fileId)) {
|
|
111
|
+
return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_NOT_FOUND_ERROR } };
|
|
112
|
+
}
|
|
113
|
+
const file = yield this.fileStorage.readBinary(viewer.fileId);
|
|
114
|
+
const freeze = JSON.parse(file.buffer.toString('utf8'));
|
|
115
|
+
if (!freeze || freeze.version !== 1) {
|
|
116
|
+
return { success: false, message: { text: report_generation_constants_1.REPORT_GENERATION_NOT_FOUND_ERROR } };
|
|
117
|
+
}
|
|
118
|
+
return (0, core_1.runtimeQuerySuccessObject)(freeze);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
exports.ReportGenerationGetViewerFreezeQuery = ReportGenerationGetViewerFreezeQuery;
|
|
123
|
+
exports.ReportGenerationGetViewerFreezeQuery = ReportGenerationGetViewerFreezeQuery = tslib_1.__decorate([
|
|
124
|
+
(0, abstract_1.ServerQueryHandler)({
|
|
125
|
+
key: module_report_management_contracts_1.AXMReportManagementQueryKeys.ReportGeneration.GetViewerFreeze,
|
|
126
|
+
auth: 'session',
|
|
127
|
+
permissions: [module_report_management_contracts_1.AXPInsightsReportingPermissionKeys.Access],
|
|
128
|
+
}),
|
|
129
|
+
(0, common_1.Injectable)(),
|
|
130
|
+
tslib_1.__metadata("design:paramtypes", [report_generation_store_1.ReportGenerationStore,
|
|
131
|
+
security_1.BackendSessionService,
|
|
132
|
+
http_1.FileStorageFacadeService,
|
|
133
|
+
security_1.RuntimePermissionService])
|
|
134
|
+
], ReportGenerationGetViewerFreezeQuery);
|
|
135
|
+
//#endregion
|
|
136
|
+
//# sourceMappingURL=report-generation-runtime.handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generation-runtime.handlers.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation-runtime.handlers.ts"],"names":[],"mappings":";AAAA,2BAA2B;;;;AAE3B,2CAA4C;AAC5C,gFAAmH;AACnH,8EAA+F;AAC/F,yEAA6G;AAC7G,iEAGgD;AAEhD,4GAQ6D;AAC7D,+EAGuC;AACvC,uEAAkE;AAElE,YAAY;AAEZ,0BAA0B;AAE1B,SAAS,cAAc,CACrB,OAAmC,EACnC,MAA0B,EAC1B,WAAoB;IAEpB,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,WAAW,KAAK,MAAM,CAAC,C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AC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAA0B,CAAC;YACjF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;gBACpC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,+DAAiC,EAAE,EAAE,CAAC;YAClF,CAAC;YACD,OAAO,IAAA,gCAAyB,EAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;KAAA;CACF,CAAA;AAtCY,oFAAoC;+CAApC,oCAAoC;IANhD,IAAA,6BAAkB,EAAC;QAClB,GAAG,EAAE,iEAA4B,CAAC,gBAAgB,CAAC,eAAe;QAClE,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,CAAC,uEAAkC,CAAC,MAAM,CAAC;KACzD,CAAC;IACD,IAAA,mBAAU,GAAE;6CAKe,+CAAqB;QACnB,gCAAqB;QACjB,+BAAwB;QACxB,mCAAwB;GAP7C,oCAAoC,CAsChD;AAED,YAAY"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SettingsManagementStoreService } from '@acorex-platform/module-settings-management-server';
|
|
2
|
+
import { type AXPReportGenerationDedupePolicy } from '@acorex-platform/module-report-management-client/contracts';
|
|
3
|
+
export interface ReportGenerationPlatformSettings {
|
|
4
|
+
dedupePolicy: AXPReportGenerationDedupePolicy;
|
|
5
|
+
dedupeCooldownMs: number;
|
|
6
|
+
maxConcurrentPerUser: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class ReportGenerationSettingsService {
|
|
9
|
+
private readonly settingsStore;
|
|
10
|
+
constructor(settingsStore: SettingsManagementStoreService);
|
|
11
|
+
resolvePlatformSettings(): Promise<ReportGenerationPlatformSettings>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportGenerationSettingsService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const module_settings_management_server_1 = require("@acorex-platform/module-settings-management-server");
|
|
7
|
+
const module_report_management_contracts_1 = require("@acorex-platform/module-report-management-client/contracts");
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region ----- Settings service -----
|
|
10
|
+
let ReportGenerationSettingsService = class ReportGenerationSettingsService {
|
|
11
|
+
constructor(settingsStore) {
|
|
12
|
+
this.settingsStore = settingsStore;
|
|
13
|
+
}
|
|
14
|
+
resolvePlatformSettings() {
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a;
|
|
17
|
+
const document = yield this.settingsStore.findByPartition({ scope: 'P', documentId: 'P' });
|
|
18
|
+
const platform = (_a = document === null || document === void 0 ? void 0 : document.values) !== null && _a !== void 0 ? _a : {};
|
|
19
|
+
const defaults = module_report_management_contracts_1.AXP_REPORT_MANAGEMENT_GENERATION_SETTING_DEFAULTS;
|
|
20
|
+
const dedupePolicy = coerceDedupePolicy(platform[module_report_management_contracts_1.AXPReportManagementSettings.GenerationDedupePolicy], defaults[module_report_management_contracts_1.AXPReportManagementSettings.GenerationDedupePolicy]);
|
|
21
|
+
const cooldownMinutes = coerceNonNegativeInt(platform[module_report_management_contracts_1.AXPReportManagementSettings.GenerationDedupeCooldownMinutes], defaults[module_report_management_contracts_1.AXPReportManagementSettings.GenerationDedupeCooldownMinutes]);
|
|
22
|
+
return {
|
|
23
|
+
dedupePolicy,
|
|
24
|
+
dedupeCooldownMs: cooldownMinutes * 60000,
|
|
25
|
+
maxConcurrentPerUser: coerceNonNegativeInt(platform[module_report_management_contracts_1.AXPReportManagementSettings.GenerationMaxConcurrentPerUser], defaults[module_report_management_contracts_1.AXPReportManagementSettings.GenerationMaxConcurrentPerUser]),
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.ReportGenerationSettingsService = ReportGenerationSettingsService;
|
|
31
|
+
exports.ReportGenerationSettingsService = ReportGenerationSettingsService = tslib_1.__decorate([
|
|
32
|
+
(0, common_1.Injectable)(),
|
|
33
|
+
tslib_1.__metadata("design:paramtypes", [module_settings_management_server_1.SettingsManagementStoreService])
|
|
34
|
+
], ReportGenerationSettingsService);
|
|
35
|
+
function coerceDedupePolicy(value, fallback) {
|
|
36
|
+
if (value === 'none' || value === 'in-flight' || value === 'in-flight-or-cooldown') {
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
return fallback;
|
|
40
|
+
}
|
|
41
|
+
function coerceNonNegativeInt(value, fallback) {
|
|
42
|
+
const parsed = typeof value === 'number' ? value : Number(value);
|
|
43
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
44
|
+
return fallback;
|
|
45
|
+
}
|
|
46
|
+
return Math.floor(parsed);
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//# sourceMappingURL=report-generation-settings.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generation-settings.service.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation-settings.service.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,0GAAoG;AACpG,4GAI6D;AAU7D,YAAY;AAEZ,sCAAsC;AAG/B,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAC1C,YAA6B,aAA6C;QAA7C,kBAAa,GAAb,aAAa,CAAgC;IAAG,CAAC;IAExE,uBAAuB;;;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;YAC3F,MAAM,QAAQ,GAAG,MAAA,QAAQ,aAA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,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED,YAAY"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const REPORT_GENERATION_REQUEST_ENTITY: `${string}.ReportGenerationRequest`;
|
|
2
|
+
export declare const REPORT_GENERATION_JOB_PROVIDER_KEY = "report-management";
|
|
3
|
+
export declare const REPORT_GENERATION_FILE_REF_TYPE: `${string}.ReportGenerationRequest`;
|
|
4
|
+
export declare const REPORT_GENERATION_FILE_CATEGORY = "report-generation-freeze";
|
|
5
|
+
export declare const REPORT_GENERATION_DEFAULT_RETENTION_DAYS = 30;
|
|
6
|
+
export declare const REPORT_GENERATION_DEFAULT_TIMEOUT_MS: number;
|
|
7
|
+
export declare const REPORT_GENERATION_FREEZE_TAKE = 10000;
|
|
8
|
+
export declare const REPORT_GENERATION_NOTIFICATION_DEFINITION_KEY = "ReportManagement:ReportGeneration";
|
|
9
|
+
export { REPORT_GENERATION_OPEN_FROZEN_COMMAND } from '@acorex-platform/module-report-management-client/contracts';
|
|
10
|
+
export declare const REPORT_GENERATION_UNSUPPORTED_SOURCE_ERROR = "@report-management:report-generation.errors.unsupported-data-source";
|
|
11
|
+
export declare const REPORT_GENERATION_NOT_FOUND_ERROR = "@report-management:report-generation.errors.not-found";
|
|
12
|
+
export declare const REPORT_GENERATION_FORBIDDEN_ERROR = "@report-management:report-generation.errors.forbidden";
|
|
13
|
+
export declare const REPORT_GENERATION_REPORT_NOT_FOUND_ERROR = "@report-management:report-generation.errors.report-not-found";
|
|
14
|
+
export declare const REPORT_GENERATION_QUERY_FAILED_ERROR = "@report-management:report-generation.errors.query-failed";
|
|
15
|
+
export declare const REPORT_GENERATION_MAX_CONCURRENT_ERROR = "@report-management:report-generation.errors.max-concurrent";
|
|
16
|
+
export declare const REPORT_GENERATION_SCHEDULE_ALREADY_RUNNING_ERROR = "@report-management:report-generation.errors.schedule-already-running";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REPORT_GENERATION_SCHEDULE_ALREADY_RUNNING_ERROR = exports.REPORT_GENERATION_MAX_CONCURRENT_ERROR = exports.REPORT_GENERATION_QUERY_FAILED_ERROR = exports.REPORT_GENERATION_REPORT_NOT_FOUND_ERROR = exports.REPORT_GENERATION_FORBIDDEN_ERROR = exports.REPORT_GENERATION_NOT_FOUND_ERROR = exports.REPORT_GENERATION_UNSUPPORTED_SOURCE_ERROR = exports.REPORT_GENERATION_OPEN_FROZEN_COMMAND = exports.REPORT_GENERATION_NOTIFICATION_DEFINITION_KEY = exports.REPORT_GENERATION_FREEZE_TAKE = exports.REPORT_GENERATION_DEFAULT_TIMEOUT_MS = exports.REPORT_GENERATION_DEFAULT_RETENTION_DAYS = exports.REPORT_GENERATION_FILE_CATEGORY = exports.REPORT_GENERATION_FILE_REF_TYPE = exports.REPORT_GENERATION_JOB_PROVIDER_KEY = exports.REPORT_GENERATION_REQUEST_ENTITY = void 0;
|
|
4
|
+
const module_report_management_contracts_1 = require("@acorex-platform/module-report-management-client/contracts");
|
|
5
|
+
//#region ----- Constants -----
|
|
6
|
+
exports.REPORT_GENERATION_REQUEST_ENTITY = module_report_management_contracts_1.RootConfig.entities.reportGenerationRequest.fullName;
|
|
7
|
+
exports.REPORT_GENERATION_JOB_PROVIDER_KEY = 'report-management';
|
|
8
|
+
exports.REPORT_GENERATION_FILE_REF_TYPE = module_report_management_contracts_1.RootConfig.entities.reportGenerationRequest.fullName;
|
|
9
|
+
exports.REPORT_GENERATION_FILE_CATEGORY = 'report-generation-freeze';
|
|
10
|
+
exports.REPORT_GENERATION_DEFAULT_RETENTION_DAYS = 30;
|
|
11
|
+
exports.REPORT_GENERATION_DEFAULT_TIMEOUT_MS = 30 * 60 * 1000;
|
|
12
|
+
exports.REPORT_GENERATION_FREEZE_TAKE = 10000;
|
|
13
|
+
exports.REPORT_GENERATION_NOTIFICATION_DEFINITION_KEY = 'ReportManagement:ReportGeneration';
|
|
14
|
+
var module_report_management_contracts_2 = require("@acorex-platform/module-report-management-client/contracts");
|
|
15
|
+
Object.defineProperty(exports, "REPORT_GENERATION_OPEN_FROZEN_COMMAND", { enumerable: true, get: function () { return module_report_management_contracts_2.REPORT_GENERATION_OPEN_FROZEN_COMMAND; } });
|
|
16
|
+
exports.REPORT_GENERATION_UNSUPPORTED_SOURCE_ERROR = '@report-management:report-generation.errors.unsupported-data-source';
|
|
17
|
+
exports.REPORT_GENERATION_NOT_FOUND_ERROR = '@report-management:report-generation.errors.not-found';
|
|
18
|
+
exports.REPORT_GENERATION_FORBIDDEN_ERROR = '@report-management:report-generation.errors.forbidden';
|
|
19
|
+
exports.REPORT_GENERATION_REPORT_NOT_FOUND_ERROR = '@report-management:report-generation.errors.report-not-found';
|
|
20
|
+
exports.REPORT_GENERATION_QUERY_FAILED_ERROR = '@report-management:report-generation.errors.query-failed';
|
|
21
|
+
exports.REPORT_GENERATION_MAX_CONCURRENT_ERROR = '@report-management:report-generation.errors.max-concurrent';
|
|
22
|
+
exports.REPORT_GENERATION_SCHEDULE_ALREADY_RUNNING_ERROR = '@report-management:report-generation.errors.schedule-already-running';
|
|
23
|
+
//#endregion
|
|
24
|
+
//# sourceMappingURL=report-generation.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generation.constants.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation.constants.ts"],"names":[],"mappings":";;;AAAA,4GAAiF;AAEjF,+BAA+B;AAElB,QAAA,gCAAgC,GAAG,+CAAU,CAAC,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC;AAExF,QAAA,kCAAkC,GAAG,mBAAmB,CAAC;AAEzD,QAAA,+BAA+B,GAAG,+CAAU,CAAC,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC;AAEvF,QAAA,+BAA+B,GAAG,0BAA0B,CAAC;AAE7D,QAAA,wCAAwC,GAAG,EAAE,CAAC;AAE9C,QAAA,oCAAoC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtD,QAAA,6BAA6B,GAAG,KAAK,CAAC;AAEtC,QAAA,6CAA6C,GAAG,mCAAmC,CAAC;AAEjG,0GAA4G;AAAnG,2JAAA,qCAAqC,OAAA;AAEjC,QAAA,0CAA0C,GACrD,qEAAqE,CAAC;AAE3D,QAAA,iCAAiC,GAAG,uDAAuD,CAAC;AAE5F,QAAA,iCAAiC,GAAG,uDAAuD,CAAC;AAE5F,QAAA,wCAAwC,GACnD,8DAA8D,CAAC;AAEpD,QAAA,oCAAoC,GAC/C,0DAA0D,CAAC;AAEhD,QAAA,sCAAsC,GACjD,4DAA4D,CAAC;AAElD,QAAA,gDAAgD,GAC3D,sEAAsE,CAAC;AAEzE,YAAY"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EntityStorageMiddlewareService } from '@acorex-platform/framework-server/core';
|
|
2
|
+
import type { AXMReportGenerationRequest } from '@acorex-platform/module-report-management-client/contracts';
|
|
3
|
+
export declare class ReportGenerationStore {
|
|
4
|
+
private readonly storage;
|
|
5
|
+
constructor(storage: EntityStorageMiddlewareService);
|
|
6
|
+
insert(row: AXMReportGenerationRequest): Promise<string>;
|
|
7
|
+
getById(id: string): Promise<AXMReportGenerationRequest | null>;
|
|
8
|
+
patchAsEngine(id: string, patch: Partial<AXMReportGenerationRequest>): Promise<void>;
|
|
9
|
+
listMine(input: {
|
|
10
|
+
userId: string;
|
|
11
|
+
skip?: number;
|
|
12
|
+
take?: number;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
items: AXMReportGenerationRequest[];
|
|
15
|
+
total: number;
|
|
16
|
+
}>;
|
|
17
|
+
countActiveManualByUser(userId: string): Promise<number>;
|
|
18
|
+
findActiveByScheduleId(scheduleId: string): Promise<AXMReportGenerationRequest | null>;
|
|
19
|
+
listActiveByUserAndReport(userId: string, reportId: string): Promise<AXMReportGenerationRequest[]>;
|
|
20
|
+
listCompletedSinceByUserAndReport(input: {
|
|
21
|
+
userId: string;
|
|
22
|
+
reportId: string;
|
|
23
|
+
sinceIso: string;
|
|
24
|
+
}): Promise<AXMReportGenerationRequest[]>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportGenerationStore = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const core_1 = require("@acorex-platform/framework-server/core");
|
|
7
|
+
const abstract_1 = require("@acorex-platform/framework-server/jql/abstract");
|
|
8
|
+
const report_generation_constants_1 = require("./report-generation.constants");
|
|
9
|
+
//#region ----- Store -----
|
|
10
|
+
const ACTIVE_STATUSES = ['queued', 'running'];
|
|
11
|
+
let ReportGenerationStore = class ReportGenerationStore {
|
|
12
|
+
constructor(storage) {
|
|
13
|
+
this.storage = storage;
|
|
14
|
+
}
|
|
15
|
+
insert(row) {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
return this.storage.insertOne(report_generation_constants_1.REPORT_GENERATION_REQUEST_ENTITY, row);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
getById(id) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
var _a;
|
|
23
|
+
const row = (yield this.storage.getOne(report_generation_constants_1.REPORT_GENERATION_REQUEST_ENTITY, id));
|
|
24
|
+
if (row === null || row === void 0 ? void 0 : row.id) {
|
|
25
|
+
return row;
|
|
26
|
+
}
|
|
27
|
+
const page = yield this.storage.queryAsEngine(report_generation_constants_1.REPORT_GENERATION_REQUEST_ENTITY, (0, abstract_1.bypassAllEntityVisibilityFilters)({
|
|
28
|
+
skip: 0,
|
|
29
|
+
take: 1,
|
|
30
|
+
filter: {
|
|
31
|
+
logic: 'and',
|
|
32
|
+
filters: [{ field: 'id', operator: { type: 'equal' }, value: id }],
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
|
+
const item = ((_a = page.items) !== null && _a !== void 0 ? _a : [])[0];
|
|
36
|
+
return (item === null || item === void 0 ? void 0 : item.id) ? item : null;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
patchAsEngine(id, patch) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
yield this.storage.updateOneAsEngine(report_generation_constants_1.REPORT_GENERATION_REQUEST_ENTITY, id, patch);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
listMine(input) {
|
|
45
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
var _a, _b, _c, _d;
|
|
47
|
+
const result = yield this.storage.query(report_generation_constants_1.REPORT_GENERATION_REQUEST_ENTITY, {
|
|
48
|
+
skip: (_a = input.skip) !== null && _a !== void 0 ? _a : 0,
|
|
49
|
+
take: (_b = input.take) !== null && _b !== void 0 ? _b : 50,
|
|
50
|
+
sort: [{ field: 'startedAt', dir: 'desc' }],
|
|
51
|
+
filter: {
|
|
52
|
+
logic: 'and',
|
|
53
|
+
filters: [{ field: 'requestedBy', operator: { type: 'equal' }, value: input.userId }],
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
items: ((_c = result.items) !== null && _c !== void 0 ? _c : []),
|
|
58
|
+
total: (_d = result.totalCount) !== null && _d !== void 0 ? _d : 0,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
countActiveManualByUser(userId) {
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
var _a;
|
|
65
|
+
const result = yield this.storage.queryAsEngine(report_generation_constants_1.REPORT_GENERATION_REQUEST_ENTITY, (0, abstract_1.bypassAllEntityVisibilityFilters)({
|
|
66
|
+
skip: 0,
|
|
67
|
+
take: 0,
|
|
68
|
+
filter: {
|
|
69
|
+
logic: 'and',
|
|
70
|
+
filters: [
|
|
71
|
+
{ field: 'requestedBy', operator: { type: 'equal' }, value: userId },
|
|
72
|
+
{ field: 'trigger', operator: { type: 'equal' }, value: 'manual' },
|
|
73
|
+
{ field: 'status', operator: { type: 'in' }, value: [...ACTIVE_STATUSES] },
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
}));
|
|
77
|
+
return (_a = result.totalCount) !== null && _a !== void 0 ? _a : 0;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
findActiveByScheduleId(scheduleId) {
|
|
81
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
var _a;
|
|
83
|
+
const page = yield this.storage.queryAsEngine(report_generation_constants_1.REPORT_GENERATION_REQUEST_ENTITY, (0, abstract_1.bypassAllEntityVisibilityFilters)({
|
|
84
|
+
skip: 0,
|
|
85
|
+
take: 1,
|
|
86
|
+
sort: [{ field: 'startedAt', dir: 'desc' }],
|
|
87
|
+
filter: {
|
|
88
|
+
logic: 'and',
|
|
89
|
+
filters: [
|
|
90
|
+
{ field: 'scheduleId', operator: { type: 'equal' }, value: scheduleId },
|
|
91
|
+
{ field: 'status', operator: { type: 'in' }, value: [...ACTIVE_STATUSES] },
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
}));
|
|
95
|
+
const item = ((_a = page.items) !== null && _a !== void 0 ? _a : [])[0];
|
|
96
|
+
return (item === null || item === void 0 ? void 0 : item.id) ? item : null;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
listActiveByUserAndReport(userId, reportId) {
|
|
100
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
var _a;
|
|
102
|
+
const page = yield this.storage.queryAsEngine(report_generation_constants_1.REPORT_GENERATION_REQUEST_ENTITY, (0, abstract_1.bypassAllEntityVisibilityFilters)({
|
|
103
|
+
skip: 0,
|
|
104
|
+
take: 20,
|
|
105
|
+
sort: [{ field: 'startedAt', dir: 'desc' }],
|
|
106
|
+
filter: {
|
|
107
|
+
logic: 'and',
|
|
108
|
+
filters: [
|
|
109
|
+
{ field: 'requestedBy', operator: { type: 'equal' }, value: userId },
|
|
110
|
+
{ field: 'reportId', operator: { type: 'equal' }, value: reportId },
|
|
111
|
+
{ field: 'status', operator: { type: 'in' }, value: [...ACTIVE_STATUSES] },
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
}));
|
|
115
|
+
return ((_a = page.items) !== null && _a !== void 0 ? _a : []);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
listCompletedSinceByUserAndReport(input) {
|
|
119
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
var _a;
|
|
121
|
+
const page = yield this.storage.queryAsEngine(report_generation_constants_1.REPORT_GENERATION_REQUEST_ENTITY, (0, abstract_1.bypassAllEntityVisibilityFilters)({
|
|
122
|
+
skip: 0,
|
|
123
|
+
take: 20,
|
|
124
|
+
sort: [{ field: 'completedAt', dir: 'desc' }],
|
|
125
|
+
filter: {
|
|
126
|
+
logic: 'and',
|
|
127
|
+
filters: [
|
|
128
|
+
{ field: 'requestedBy', operator: { type: 'equal' }, value: input.userId },
|
|
129
|
+
{ field: 'reportId', operator: { type: 'equal' }, value: input.reportId },
|
|
130
|
+
{ field: 'status', operator: { type: 'equal' }, value: 'completed' },
|
|
131
|
+
{ field: 'completedAt', operator: { type: 'gte' }, value: input.sinceIso },
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
}));
|
|
135
|
+
return ((_a = page.items) !== null && _a !== void 0 ? _a : []);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
exports.ReportGenerationStore = ReportGenerationStore;
|
|
140
|
+
exports.ReportGenerationStore = ReportGenerationStore = tslib_1.__decorate([
|
|
141
|
+
(0, common_1.Injectable)(),
|
|
142
|
+
tslib_1.__metadata("design:paramtypes", [core_1.EntityStorageMiddlewareService])
|
|
143
|
+
], ReportGenerationStore);
|
|
144
|
+
//#endregion
|
|
145
|
+
//# sourceMappingURL=report-generation.store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generation.store.js","sourceRoot":"","sources":["../../../../../../../libs/modules/report-management/server/src/lib/report-generation/report-generation.store.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,iEAAwF;AACxF,6EAAkG;AAElG,+EAAiF;AAEjF,2BAA2B;AAE3B,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAU,CAAC;AAGhD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAA6B,OAAuC;QAAvC,YAAO,GAAP,OAAO,CAAgC;IAAG,CAAC;IAElE,MAAM,CAAC,GAA+B;;YAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,8DAAgC,EAAE,GAAG,CAAC,CAAC;QACvE,CAAC;KAAA;IAEK,OAAO,CAAC,EAAU;;;YACtB,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,8DAAgC,EAAE,EAAE,CAAC,CAEpE,CAAC;YACT,IAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,EAAE,EAAE,CAAC;gBACZ,OAAO,GAAG,CAAC;YACb,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAC3C,8DAAgC,EAChC,IAAA,2CAAgC,EAAC;gBAC/B,IAAI,EAAE,CAAC;gBACP,IAAI,EAAE,CAAC;gBACP,MAAM,EAAE;oBACN,KAAK,EAAE,KAAK;oBACZ,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;iBACnE;aACF,CAAC,CACH,CAAC;YACF,MAAM,IAAI,GAAG,CAAC,MAAA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