@pattern-stack/codegen 0.14.0 → 0.14.2
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/CHANGELOG.md +45 -0
- package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.d.ts +1 -1
- package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.js +2 -2
- package/dist/runtime/subsystems/bridge/bridge-delivery.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/bridge/bridge.module.d.ts +22 -0
- package/dist/runtime/subsystems/bridge/bridge.module.js +177 -160
- package/dist/runtime/subsystems/bridge/bridge.module.js.map +1 -1
- package/dist/runtime/subsystems/bridge/index.js +159 -142
- package/dist/runtime/subsystems/bridge/index.js.map +1 -1
- package/dist/runtime/subsystems/index.js +161 -148
- package/dist/runtime/subsystems/index.js.map +1 -1
- package/dist/runtime/subsystems/jobs/index.js +128 -115
- package/dist/runtime/subsystems/jobs/index.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js +128 -6
- package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js +17 -0
- package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-step-service.memory-backend.js +25 -2
- package/dist/runtime/subsystems/jobs/job-step-service.memory-backend.js.map +1 -1
- package/dist/runtime/subsystems/jobs/job-worker.module.d.ts +26 -1
- package/dist/runtime/subsystems/jobs/job-worker.module.js +150 -137
- package/dist/runtime/subsystems/jobs/job-worker.module.js.map +1 -1
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js +133 -124
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js.map +1 -1
- package/dist/src/cli/index.js +1040 -635
- package/dist/src/cli/index.js.map +1 -1
- package/package.json +1 -1
- package/runtime/subsystems/bridge/bridge-delivery.memory-backend.ts +8 -1
- package/runtime/subsystems/bridge/bridge.module.ts +26 -1
- package/runtime/subsystems/jobs/job-orchestrator.memory-backend.ts +8 -3
- package/runtime/subsystems/jobs/job-run-service.memory-backend.ts +4 -1
- package/runtime/subsystems/jobs/job-step-service.memory-backend.ts +7 -2
- package/runtime/subsystems/jobs/job-worker.module.ts +13 -1
|
@@ -12,19 +12,20 @@ var __decorateParam = (index4, decorator) => (target, key2) => decorator(target,
|
|
|
12
12
|
|
|
13
13
|
// runtime/subsystems/bridge/bridge.module.ts
|
|
14
14
|
import {
|
|
15
|
-
Inject as
|
|
15
|
+
Inject as Inject13,
|
|
16
16
|
Module as Module3,
|
|
17
17
|
Optional as Optional7
|
|
18
18
|
} from "@nestjs/common";
|
|
19
19
|
|
|
20
20
|
// runtime/subsystems/jobs/job-worker.module.ts
|
|
21
21
|
import {
|
|
22
|
-
Inject as
|
|
22
|
+
Inject as Inject8,
|
|
23
23
|
Injectable as Injectable8,
|
|
24
24
|
Logger as Logger4,
|
|
25
25
|
Module as Module2,
|
|
26
26
|
Optional as Optional2
|
|
27
27
|
} from "@nestjs/common";
|
|
28
|
+
import { ModuleRef as ModuleRef2 } from "@nestjs/core";
|
|
28
29
|
|
|
29
30
|
// runtime/subsystems/token-key.ts
|
|
30
31
|
var PKG = "@pattern-stack/codegen";
|
|
@@ -916,8 +917,129 @@ DrizzleJobStepService = __decorateClass([
|
|
|
916
917
|
], DrizzleJobStepService);
|
|
917
918
|
|
|
918
919
|
// runtime/subsystems/jobs/job-orchestrator.memory-backend.ts
|
|
920
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
921
|
+
import { Inject as Inject5, Injectable as Injectable5, Logger as Logger2, Optional } from "@nestjs/common";
|
|
922
|
+
import { ModuleRef } from "@nestjs/core";
|
|
923
|
+
|
|
924
|
+
// runtime/subsystems/jobs/memory-job-store.ts
|
|
925
|
+
var MemoryJobStore = class {
|
|
926
|
+
/** Runs keyed by `id` (single source of truth for status/scope/lineage). */
|
|
927
|
+
runs = /* @__PURE__ */ new Map();
|
|
928
|
+
/** Steps keyed by `job_run_id`; array order matches insertion order. */
|
|
929
|
+
steps = /* @__PURE__ */ new Map();
|
|
930
|
+
/** Job definitions keyed by `type` — memory mirror of the `job` table. */
|
|
931
|
+
jobs = /* @__PURE__ */ new Map();
|
|
932
|
+
/** Reset everything. Tests call this in `beforeEach`. */
|
|
933
|
+
clear() {
|
|
934
|
+
this.runs.clear();
|
|
935
|
+
this.steps.clear();
|
|
936
|
+
this.jobs.clear();
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
// runtime/subsystems/jobs/job-step-service.memory-backend.ts
|
|
919
941
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
920
|
-
import { Inject as Inject4, Injectable as Injectable4
|
|
942
|
+
import { Inject as Inject4, Injectable as Injectable4 } from "@nestjs/common";
|
|
943
|
+
var MemoryJobStepService = class {
|
|
944
|
+
// ADR-037 (package-mode DI): explicit `@Inject(MemoryJobStore)` — the
|
|
945
|
+
// published bundle carries no `design:paramtypes`, so a by-type inject
|
|
946
|
+
// would resolve to `undefined` in package mode.
|
|
947
|
+
constructor(store) {
|
|
948
|
+
this.store = store;
|
|
949
|
+
}
|
|
950
|
+
store;
|
|
951
|
+
async findStep(runId, stepId) {
|
|
952
|
+
const rows = this.store.steps.get(runId);
|
|
953
|
+
if (!rows) return null;
|
|
954
|
+
const match = rows.find(
|
|
955
|
+
(r) => r.stepId === stepId && r.status === "completed"
|
|
956
|
+
);
|
|
957
|
+
return match ?? null;
|
|
958
|
+
}
|
|
959
|
+
async recordStep(input) {
|
|
960
|
+
const rows = this.getOrCreateRows(input.jobRunId);
|
|
961
|
+
const existingIdx = rows.findIndex((r) => r.stepId === input.stepId);
|
|
962
|
+
const normalisedInput = input.input ?? null;
|
|
963
|
+
const normalisedOutput = input.output ?? null;
|
|
964
|
+
if (existingIdx >= 0) {
|
|
965
|
+
const prev = rows[existingIdx];
|
|
966
|
+
const next = {
|
|
967
|
+
...prev,
|
|
968
|
+
status: input.status,
|
|
969
|
+
input: normalisedInput ?? prev.input,
|
|
970
|
+
output: normalisedOutput ?? prev.output,
|
|
971
|
+
error: input.error ?? prev.error,
|
|
972
|
+
attempts: input.attempts ?? prev.attempts,
|
|
973
|
+
startedAt: input.startedAt ?? prev.startedAt,
|
|
974
|
+
finishedAt: input.finishedAt ?? prev.finishedAt
|
|
975
|
+
};
|
|
976
|
+
rows[existingIdx] = next;
|
|
977
|
+
return next;
|
|
978
|
+
}
|
|
979
|
+
const seq = input.seq ?? this.nextSeq(rows);
|
|
980
|
+
const row = {
|
|
981
|
+
id: randomUUID2(),
|
|
982
|
+
jobRunId: input.jobRunId,
|
|
983
|
+
stepId: input.stepId,
|
|
984
|
+
kind: input.kind,
|
|
985
|
+
seq,
|
|
986
|
+
status: input.status,
|
|
987
|
+
input: normalisedInput,
|
|
988
|
+
output: normalisedOutput,
|
|
989
|
+
error: input.error ?? null,
|
|
990
|
+
attempts: input.attempts ?? 0,
|
|
991
|
+
startedAt: input.startedAt ?? null,
|
|
992
|
+
finishedAt: input.finishedAt ?? null
|
|
993
|
+
};
|
|
994
|
+
rows.push(row);
|
|
995
|
+
return row;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Replay helper — wipe every step row for a run. Mirrors the `scratch`
|
|
999
|
+
* replay mode of the Drizzle backend (`DELETE FROM job_step WHERE job_run_id = …`).
|
|
1000
|
+
*/
|
|
1001
|
+
clearStepsForRun(runId) {
|
|
1002
|
+
this.store.steps.delete(runId);
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Remove every non-`completed` row for the run. Memoized (`completed`)
|
|
1006
|
+
* rows are preserved — this is the `last_checkpoint` / `last_step`
|
|
1007
|
+
* semantics the Drizzle backend implements via
|
|
1008
|
+
* `DELETE … WHERE status != 'completed'`. Both replay modes route here
|
|
1009
|
+
* (Phase 1 collapses `last_step` onto this behaviour; see JOB-3 notes).
|
|
1010
|
+
*/
|
|
1011
|
+
clearIncompleteSteps(runId) {
|
|
1012
|
+
const rows = this.store.steps.get(runId);
|
|
1013
|
+
if (!rows) return;
|
|
1014
|
+
const kept = rows.filter((r) => r.status === "completed");
|
|
1015
|
+
if (kept.length === 0) {
|
|
1016
|
+
this.store.steps.delete(runId);
|
|
1017
|
+
} else {
|
|
1018
|
+
this.store.steps.set(runId, kept);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
getOrCreateRows(runId) {
|
|
1022
|
+
let rows = this.store.steps.get(runId);
|
|
1023
|
+
if (!rows) {
|
|
1024
|
+
rows = [];
|
|
1025
|
+
this.store.steps.set(runId, rows);
|
|
1026
|
+
}
|
|
1027
|
+
return rows;
|
|
1028
|
+
}
|
|
1029
|
+
nextSeq(rows) {
|
|
1030
|
+
let max = 0;
|
|
1031
|
+
for (const r of rows) {
|
|
1032
|
+
if (r.seq > max) max = r.seq;
|
|
1033
|
+
}
|
|
1034
|
+
return max + 1;
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
MemoryJobStepService = __decorateClass([
|
|
1038
|
+
Injectable4(),
|
|
1039
|
+
__decorateParam(0, Inject4(MemoryJobStore))
|
|
1040
|
+
], MemoryJobStepService);
|
|
1041
|
+
|
|
1042
|
+
// runtime/subsystems/jobs/job-orchestrator.memory-backend.ts
|
|
921
1043
|
var QUEUED_RUN_AT = /* @__PURE__ */ new Date(864e13);
|
|
922
1044
|
var TERMINAL_STATUSES2 = [
|
|
923
1045
|
"completed",
|
|
@@ -1088,7 +1210,7 @@ var MemoryJobOrchestrator = class {
|
|
|
1088
1210
|
}
|
|
1089
1211
|
}
|
|
1090
1212
|
}
|
|
1091
|
-
const newId =
|
|
1213
|
+
const newId = randomUUID3();
|
|
1092
1214
|
let rootRunId = newId;
|
|
1093
1215
|
if (opts.parentRunId) {
|
|
1094
1216
|
const parent = this.store.runs.get(opts.parentRunId);
|
|
@@ -1486,9 +1608,12 @@ var MemoryJobOrchestrator = class {
|
|
|
1486
1608
|
}
|
|
1487
1609
|
};
|
|
1488
1610
|
MemoryJobOrchestrator = __decorateClass([
|
|
1489
|
-
|
|
1490
|
-
__decorateParam(
|
|
1491
|
-
__decorateParam(
|
|
1611
|
+
Injectable5(),
|
|
1612
|
+
__decorateParam(0, Inject5(MemoryJobStore)),
|
|
1613
|
+
__decorateParam(1, Inject5(MemoryJobStepService)),
|
|
1614
|
+
__decorateParam(2, Inject5(JOBS_MULTI_TENANT)),
|
|
1615
|
+
__decorateParam(3, Optional()),
|
|
1616
|
+
__decorateParam(3, Inject5(ModuleRef))
|
|
1492
1617
|
], MemoryJobOrchestrator);
|
|
1493
1618
|
function classifyError(err, policy, currentAttempts) {
|
|
1494
1619
|
if (!policy) return "fail";
|
|
@@ -1522,7 +1647,7 @@ function serialiseError(err, attempt, retryable) {
|
|
|
1522
1647
|
}
|
|
1523
1648
|
|
|
1524
1649
|
// runtime/subsystems/jobs/job-run-service.memory-backend.ts
|
|
1525
|
-
import { Inject as
|
|
1650
|
+
import { Inject as Inject6, Injectable as Injectable6 } from "@nestjs/common";
|
|
1526
1651
|
var NON_TERMINAL_STATUSES2 = [
|
|
1527
1652
|
"pending",
|
|
1528
1653
|
"running",
|
|
@@ -1689,9 +1814,10 @@ var MemoryJobRunService = class {
|
|
|
1689
1814
|
}
|
|
1690
1815
|
};
|
|
1691
1816
|
MemoryJobRunService = __decorateClass([
|
|
1692
|
-
|
|
1693
|
-
__decorateParam(
|
|
1694
|
-
__decorateParam(
|
|
1817
|
+
Injectable6(),
|
|
1818
|
+
__decorateParam(0, Inject6(MemoryJobStore)),
|
|
1819
|
+
__decorateParam(1, Inject6(JOB_ORCHESTRATOR)),
|
|
1820
|
+
__decorateParam(2, Inject6(JOBS_MULTI_TENANT))
|
|
1695
1821
|
], MemoryJobRunService);
|
|
1696
1822
|
function compareBy(a, b, order) {
|
|
1697
1823
|
switch (order) {
|
|
@@ -1707,120 +1833,6 @@ function compareBy(a, b, order) {
|
|
|
1707
1833
|
}
|
|
1708
1834
|
}
|
|
1709
1835
|
|
|
1710
|
-
// runtime/subsystems/jobs/job-step-service.memory-backend.ts
|
|
1711
|
-
import { randomUUID as randomUUID3 } from "crypto";
|
|
1712
|
-
import { Injectable as Injectable6 } from "@nestjs/common";
|
|
1713
|
-
var MemoryJobStepService = class {
|
|
1714
|
-
constructor(store) {
|
|
1715
|
-
this.store = store;
|
|
1716
|
-
}
|
|
1717
|
-
store;
|
|
1718
|
-
async findStep(runId, stepId) {
|
|
1719
|
-
const rows = this.store.steps.get(runId);
|
|
1720
|
-
if (!rows) return null;
|
|
1721
|
-
const match = rows.find(
|
|
1722
|
-
(r) => r.stepId === stepId && r.status === "completed"
|
|
1723
|
-
);
|
|
1724
|
-
return match ?? null;
|
|
1725
|
-
}
|
|
1726
|
-
async recordStep(input) {
|
|
1727
|
-
const rows = this.getOrCreateRows(input.jobRunId);
|
|
1728
|
-
const existingIdx = rows.findIndex((r) => r.stepId === input.stepId);
|
|
1729
|
-
const normalisedInput = input.input ?? null;
|
|
1730
|
-
const normalisedOutput = input.output ?? null;
|
|
1731
|
-
if (existingIdx >= 0) {
|
|
1732
|
-
const prev = rows[existingIdx];
|
|
1733
|
-
const next = {
|
|
1734
|
-
...prev,
|
|
1735
|
-
status: input.status,
|
|
1736
|
-
input: normalisedInput ?? prev.input,
|
|
1737
|
-
output: normalisedOutput ?? prev.output,
|
|
1738
|
-
error: input.error ?? prev.error,
|
|
1739
|
-
attempts: input.attempts ?? prev.attempts,
|
|
1740
|
-
startedAt: input.startedAt ?? prev.startedAt,
|
|
1741
|
-
finishedAt: input.finishedAt ?? prev.finishedAt
|
|
1742
|
-
};
|
|
1743
|
-
rows[existingIdx] = next;
|
|
1744
|
-
return next;
|
|
1745
|
-
}
|
|
1746
|
-
const seq = input.seq ?? this.nextSeq(rows);
|
|
1747
|
-
const row = {
|
|
1748
|
-
id: randomUUID3(),
|
|
1749
|
-
jobRunId: input.jobRunId,
|
|
1750
|
-
stepId: input.stepId,
|
|
1751
|
-
kind: input.kind,
|
|
1752
|
-
seq,
|
|
1753
|
-
status: input.status,
|
|
1754
|
-
input: normalisedInput,
|
|
1755
|
-
output: normalisedOutput,
|
|
1756
|
-
error: input.error ?? null,
|
|
1757
|
-
attempts: input.attempts ?? 0,
|
|
1758
|
-
startedAt: input.startedAt ?? null,
|
|
1759
|
-
finishedAt: input.finishedAt ?? null
|
|
1760
|
-
};
|
|
1761
|
-
rows.push(row);
|
|
1762
|
-
return row;
|
|
1763
|
-
}
|
|
1764
|
-
/**
|
|
1765
|
-
* Replay helper — wipe every step row for a run. Mirrors the `scratch`
|
|
1766
|
-
* replay mode of the Drizzle backend (`DELETE FROM job_step WHERE job_run_id = …`).
|
|
1767
|
-
*/
|
|
1768
|
-
clearStepsForRun(runId) {
|
|
1769
|
-
this.store.steps.delete(runId);
|
|
1770
|
-
}
|
|
1771
|
-
/**
|
|
1772
|
-
* Remove every non-`completed` row for the run. Memoized (`completed`)
|
|
1773
|
-
* rows are preserved — this is the `last_checkpoint` / `last_step`
|
|
1774
|
-
* semantics the Drizzle backend implements via
|
|
1775
|
-
* `DELETE … WHERE status != 'completed'`. Both replay modes route here
|
|
1776
|
-
* (Phase 1 collapses `last_step` onto this behaviour; see JOB-3 notes).
|
|
1777
|
-
*/
|
|
1778
|
-
clearIncompleteSteps(runId) {
|
|
1779
|
-
const rows = this.store.steps.get(runId);
|
|
1780
|
-
if (!rows) return;
|
|
1781
|
-
const kept = rows.filter((r) => r.status === "completed");
|
|
1782
|
-
if (kept.length === 0) {
|
|
1783
|
-
this.store.steps.delete(runId);
|
|
1784
|
-
} else {
|
|
1785
|
-
this.store.steps.set(runId, kept);
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
getOrCreateRows(runId) {
|
|
1789
|
-
let rows = this.store.steps.get(runId);
|
|
1790
|
-
if (!rows) {
|
|
1791
|
-
rows = [];
|
|
1792
|
-
this.store.steps.set(runId, rows);
|
|
1793
|
-
}
|
|
1794
|
-
return rows;
|
|
1795
|
-
}
|
|
1796
|
-
nextSeq(rows) {
|
|
1797
|
-
let max = 0;
|
|
1798
|
-
for (const r of rows) {
|
|
1799
|
-
if (r.seq > max) max = r.seq;
|
|
1800
|
-
}
|
|
1801
|
-
return max + 1;
|
|
1802
|
-
}
|
|
1803
|
-
};
|
|
1804
|
-
MemoryJobStepService = __decorateClass([
|
|
1805
|
-
Injectable6()
|
|
1806
|
-
], MemoryJobStepService);
|
|
1807
|
-
|
|
1808
|
-
// runtime/subsystems/jobs/memory-job-store.ts
|
|
1809
|
-
var MemoryJobStore = class {
|
|
1810
|
-
/** Runs keyed by `id` (single source of truth for status/scope/lineage). */
|
|
1811
|
-
runs = /* @__PURE__ */ new Map();
|
|
1812
|
-
/** Steps keyed by `job_run_id`; array order matches insertion order. */
|
|
1813
|
-
steps = /* @__PURE__ */ new Map();
|
|
1814
|
-
/** Job definitions keyed by `type` — memory mirror of the `job` table. */
|
|
1815
|
-
jobs = /* @__PURE__ */ new Map();
|
|
1816
|
-
/** Reset everything. Tests call this in `beforeEach`. */
|
|
1817
|
-
clear() {
|
|
1818
|
-
this.runs.clear();
|
|
1819
|
-
this.steps.clear();
|
|
1820
|
-
this.jobs.clear();
|
|
1821
|
-
}
|
|
1822
|
-
};
|
|
1823
|
-
|
|
1824
1836
|
// runtime/subsystems/jobs/pool-config.loader.ts
|
|
1825
1837
|
import { existsSync, readFileSync } from "fs";
|
|
1826
1838
|
import { resolve } from "path";
|
|
@@ -2036,7 +2048,7 @@ JobsDomainModule = __decorateClass([
|
|
|
2036
2048
|
], JobsDomainModule);
|
|
2037
2049
|
|
|
2038
2050
|
// runtime/subsystems/jobs/job-worker.ts
|
|
2039
|
-
import { Inject as
|
|
2051
|
+
import { Inject as Inject7, Injectable as Injectable7, Logger as Logger3 } from "@nestjs/common";
|
|
2040
2052
|
import { and as and4, asc as asc2, desc as desc3, eq as eq4, inArray as inArray3, lt as lt2, lte, sql as sql4 } from "drizzle-orm";
|
|
2041
2053
|
var JOB_WORKER_OPTIONS = Symbol.for(tokenKey("jobs", "worker-options"));
|
|
2042
2054
|
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
@@ -2423,11 +2435,11 @@ var JobWorker = class {
|
|
|
2423
2435
|
};
|
|
2424
2436
|
JobWorker = __decorateClass([
|
|
2425
2437
|
Injectable7(),
|
|
2426
|
-
__decorateParam(0,
|
|
2427
|
-
__decorateParam(1,
|
|
2428
|
-
__decorateParam(2,
|
|
2429
|
-
__decorateParam(3,
|
|
2430
|
-
__decorateParam(4,
|
|
2438
|
+
__decorateParam(0, Inject7(DRIZZLE)),
|
|
2439
|
+
__decorateParam(1, Inject7(JOB_ORCHESTRATOR)),
|
|
2440
|
+
__decorateParam(2, Inject7(JOB_RUN_SERVICE)),
|
|
2441
|
+
__decorateParam(3, Inject7(JOB_STEP_SERVICE)),
|
|
2442
|
+
__decorateParam(4, Inject7(JOB_WORKER_OPTIONS))
|
|
2431
2443
|
], JobWorker);
|
|
2432
2444
|
|
|
2433
2445
|
// runtime/subsystems/jobs/job-worker.module.ts
|
|
@@ -2625,16 +2637,17 @@ var JobWorkerOrchestrator = class {
|
|
|
2625
2637
|
};
|
|
2626
2638
|
JobWorkerOrchestrator = __decorateClass([
|
|
2627
2639
|
Injectable8(),
|
|
2628
|
-
__decorateParam(0,
|
|
2629
|
-
__decorateParam(1,
|
|
2630
|
-
__decorateParam(2,
|
|
2631
|
-
__decorateParam(3,
|
|
2640
|
+
__decorateParam(0, Inject8(JOB_ORCHESTRATOR)),
|
|
2641
|
+
__decorateParam(1, Inject8(JOB_RUN_SERVICE)),
|
|
2642
|
+
__decorateParam(2, Inject8(JOB_STEP_SERVICE)),
|
|
2643
|
+
__decorateParam(3, Inject8(JOB_WORKER_MODULE_OPTIONS)),
|
|
2632
2644
|
__decorateParam(4, Optional2()),
|
|
2633
|
-
__decorateParam(4,
|
|
2645
|
+
__decorateParam(4, Inject8(DRIZZLE)),
|
|
2646
|
+
__decorateParam(5, Inject8(ModuleRef2)),
|
|
2634
2647
|
__decorateParam(6, Optional2()),
|
|
2635
|
-
__decorateParam(6,
|
|
2648
|
+
__decorateParam(6, Inject8(BULLMQ_CONNECTION)),
|
|
2636
2649
|
__decorateParam(7, Optional2()),
|
|
2637
|
-
__decorateParam(7,
|
|
2650
|
+
__decorateParam(7, Inject8(BULLMQ_RESOLVED_CONFIG))
|
|
2638
2651
|
], JobWorkerOrchestrator);
|
|
2639
2652
|
var JobWorkerModule = class {
|
|
2640
2653
|
static forRoot(opts) {
|
|
@@ -2774,11 +2787,11 @@ var MemoryBridgeDeliveryRepo = class {
|
|
|
2774
2787
|
* Unlike `insertDelivery`, this read does NOT call `assertTenantId`:
|
|
2775
2788
|
* `tenantId === undefined` is the supported cross-tenant admin view.
|
|
2776
2789
|
*/
|
|
2777
|
-
async getStatusHistogram(windowHours, tenantId) {
|
|
2790
|
+
async getStatusHistogram(windowHours, tenantId, nowMs = Date.now()) {
|
|
2778
2791
|
if (!Number.isFinite(windowHours) || windowHours <= 0) {
|
|
2779
2792
|
throw new RangeError("windowHours must be positive");
|
|
2780
2793
|
}
|
|
2781
|
-
const cutoffMs =
|
|
2794
|
+
const cutoffMs = nowMs - windowHours * 36e5;
|
|
2782
2795
|
const histogram = {
|
|
2783
2796
|
pending: 0,
|
|
2784
2797
|
delivered: 0,
|
|
@@ -2820,7 +2833,7 @@ var MemoryBridgeDeliveryRepo = class {
|
|
|
2820
2833
|
};
|
|
2821
2834
|
|
|
2822
2835
|
// runtime/subsystems/bridge/bridge-delivery.drizzle-backend.ts
|
|
2823
|
-
import { Inject as
|
|
2836
|
+
import { Inject as Inject9, Injectable as Injectable9, Optional as Optional3 } from "@nestjs/common";
|
|
2824
2837
|
import { eq as eq5, and as and5, gte as gte2, isNull as isNull2, sql as sql7 } from "drizzle-orm";
|
|
2825
2838
|
|
|
2826
2839
|
// runtime/subsystems/bridge/bridge-delivery.schema.ts
|
|
@@ -3080,17 +3093,17 @@ var DrizzleBridgeDeliveryRepo = class {
|
|
|
3080
3093
|
};
|
|
3081
3094
|
DrizzleBridgeDeliveryRepo = __decorateClass([
|
|
3082
3095
|
Injectable9(),
|
|
3083
|
-
__decorateParam(0,
|
|
3096
|
+
__decorateParam(0, Inject9(DRIZZLE)),
|
|
3084
3097
|
__decorateParam(1, Optional3()),
|
|
3085
|
-
__decorateParam(1,
|
|
3098
|
+
__decorateParam(1, Inject9(BRIDGE_MULTI_TENANT))
|
|
3086
3099
|
], DrizzleBridgeDeliveryRepo);
|
|
3087
3100
|
|
|
3088
3101
|
// runtime/subsystems/bridge/bridge-outbox-drain-hook.ts
|
|
3089
|
-
import { Inject as
|
|
3102
|
+
import { Inject as Inject11, Injectable as Injectable11, Logger as Logger6, Optional as Optional5 } from "@nestjs/common";
|
|
3090
3103
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
3091
3104
|
|
|
3092
3105
|
// runtime/subsystems/bridge/bridge-delivery-handler.ts
|
|
3093
|
-
import { Inject as
|
|
3106
|
+
import { Inject as Inject10, Injectable as Injectable10, Logger as Logger5, Optional as Optional4 } from "@nestjs/common";
|
|
3094
3107
|
|
|
3095
3108
|
// runtime/subsystems/events/events.tokens.ts
|
|
3096
3109
|
var EVENT_BUS = "EVENT_BUS";
|
|
@@ -3180,12 +3193,12 @@ BridgeDeliveryHandler = __decorateClass([
|
|
|
3180
3193
|
retry: { attempts: 3, backoff: "exponential", baseMs: 250 },
|
|
3181
3194
|
replayFrom: "last_step"
|
|
3182
3195
|
}),
|
|
3183
|
-
__decorateParam(0,
|
|
3184
|
-
__decorateParam(1,
|
|
3185
|
-
__decorateParam(2,
|
|
3186
|
-
__decorateParam(3,
|
|
3196
|
+
__decorateParam(0, Inject10(BRIDGE_DELIVERY_REPO)),
|
|
3197
|
+
__decorateParam(1, Inject10(JOB_ORCHESTRATOR)),
|
|
3198
|
+
__decorateParam(2, Inject10(EVENT_BUS)),
|
|
3199
|
+
__decorateParam(3, Inject10(BRIDGE_REGISTRY)),
|
|
3187
3200
|
__decorateParam(4, Optional4()),
|
|
3188
|
-
__decorateParam(4,
|
|
3201
|
+
__decorateParam(4, Inject10(BRIDGE_MULTI_TENANT))
|
|
3189
3202
|
], BridgeDeliveryHandler);
|
|
3190
3203
|
|
|
3191
3204
|
// runtime/subsystems/bridge/bridge-outbox-drain-hook.ts
|
|
@@ -3294,11 +3307,11 @@ var BridgeOutboxDrainHook = class {
|
|
|
3294
3307
|
BridgeOutboxDrainHook = __decorateClass([
|
|
3295
3308
|
Injectable11(),
|
|
3296
3309
|
__decorateParam(0, Optional5()),
|
|
3297
|
-
__decorateParam(0,
|
|
3310
|
+
__decorateParam(0, Inject11(BRIDGE_REGISTRY))
|
|
3298
3311
|
], BridgeOutboxDrainHook);
|
|
3299
3312
|
|
|
3300
3313
|
// runtime/subsystems/bridge/event-flow.service.ts
|
|
3301
|
-
import { Inject as
|
|
3314
|
+
import { Inject as Inject12, Injectable as Injectable12, Optional as Optional6 } from "@nestjs/common";
|
|
3302
3315
|
var EventFlowService = class {
|
|
3303
3316
|
constructor(db, eventBus, orchestrator, bridgeRepo, registry = {}, multiTenant = false) {
|
|
3304
3317
|
this.db = db;
|
|
@@ -3370,14 +3383,14 @@ var EventFlowService = class {
|
|
|
3370
3383
|
};
|
|
3371
3384
|
EventFlowService = __decorateClass([
|
|
3372
3385
|
Injectable12(),
|
|
3373
|
-
__decorateParam(0,
|
|
3374
|
-
__decorateParam(1,
|
|
3375
|
-
__decorateParam(2,
|
|
3376
|
-
__decorateParam(3,
|
|
3386
|
+
__decorateParam(0, Inject12(DRIZZLE)),
|
|
3387
|
+
__decorateParam(1, Inject12(EVENT_BUS)),
|
|
3388
|
+
__decorateParam(2, Inject12(JOB_ORCHESTRATOR)),
|
|
3389
|
+
__decorateParam(3, Inject12(BRIDGE_DELIVERY_REPO)),
|
|
3377
3390
|
__decorateParam(4, Optional6()),
|
|
3378
|
-
__decorateParam(4,
|
|
3391
|
+
__decorateParam(4, Inject12(BRIDGE_REGISTRY)),
|
|
3379
3392
|
__decorateParam(5, Optional6()),
|
|
3380
|
-
__decorateParam(5,
|
|
3393
|
+
__decorateParam(5, Inject12(BRIDGE_MULTI_TENANT))
|
|
3381
3394
|
], EventFlowService);
|
|
3382
3395
|
|
|
3383
3396
|
// runtime/subsystems/bridge/generated/registry.ts
|
|
@@ -3414,7 +3427,11 @@ var BridgeModule = class {
|
|
|
3414
3427
|
providers: [
|
|
3415
3428
|
{ provide: BRIDGE_MODULE_OPTIONS, useValue: opts },
|
|
3416
3429
|
{ provide: BRIDGE_MULTI_TENANT, useValue: opts.multiTenant ?? false },
|
|
3417
|
-
|
|
3430
|
+
// Package mode threads the consumer's generated registry through
|
|
3431
|
+
// `opts.registry`; vendored mode omits it and we fall back to the
|
|
3432
|
+
// bundled `./generated/registry` (which IS the consumer's generated
|
|
3433
|
+
// file in a vendored tree). See `BridgeModuleOptions.registry`.
|
|
3434
|
+
{ provide: BRIDGE_REGISTRY, useValue: opts.registry ?? bridgeRegistry },
|
|
3418
3435
|
repoProvider,
|
|
3419
3436
|
// Drain hook — always wired; `DrizzleEventBus` consumes it via
|
|
3420
3437
|
// `@Optional()`, so non-bridge mounts simply see `undefined`.
|
|
@@ -3456,7 +3473,7 @@ var BridgeModule = class {
|
|
|
3456
3473
|
BridgeModule = __decorateClass([
|
|
3457
3474
|
Module3({}),
|
|
3458
3475
|
__decorateParam(0, Optional7()),
|
|
3459
|
-
__decorateParam(0,
|
|
3476
|
+
__decorateParam(0, Inject13(JOB_WORKER_MODULE_OPTIONS))
|
|
3460
3477
|
], BridgeModule);
|
|
3461
3478
|
export {
|
|
3462
3479
|
BridgeModule
|