@pattern-stack/codegen 0.20.0 → 0.20.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 +82 -0
- package/dist/{chunk-5LXOJGO2.js → chunk-3VEVGL74.js} +5 -5
- package/dist/{chunk-I6UXRJ3Q.js → chunk-43SBT72G.js} +4 -4
- package/dist/{chunk-5RT7JGKT.js → chunk-7OVCARTQ.js} +4 -4
- package/dist/{chunk-NYJYK6J4.js → chunk-BKP72EDW.js} +5 -5
- package/dist/{chunk-QSJ3J4HE.js → chunk-CDLWYZVQ.js} +4 -4
- package/dist/{chunk-W2UIDI3R.js → chunk-CLWBNXKF.js} +4 -4
- package/dist/{chunk-27ETSJ2X.js → chunk-COGHTKXY.js} +2 -2
- package/dist/{chunk-3YCUIGPG.js → chunk-D44QFQJZ.js} +8 -8
- package/dist/{chunk-LARB26EI.js → chunk-DB5UXJC3.js} +10 -10
- package/dist/{chunk-LQXBQO72.js → chunk-E5FJWOMP.js} +7 -7
- package/dist/{chunk-CUSMC2KK.js → chunk-E6PLM6QG.js} +13 -13
- package/dist/{chunk-YK5JEVLX.js → chunk-FFUDEIFF.js} +6 -6
- package/dist/{chunk-4OC5MSHO.js → chunk-GOO5ZMYO.js} +4 -4
- package/dist/{chunk-T6SCOJF4.js → chunk-JGGZUP64.js} +4 -4
- package/dist/{chunk-KHQ72A5F.js → chunk-NR7QQ6ZI.js} +4 -4
- package/dist/chunk-NR7QQ6ZI.js.map +1 -0
- package/dist/{chunk-XWBK3XJK.js → chunk-O2A6XHGD.js} +4 -4
- package/dist/{chunk-ATVGYF3D.js → chunk-QFUIE37H.js} +3 -3
- package/dist/{chunk-WKNOEVWQ.js → chunk-QMN3LQR3.js} +5 -5
- package/dist/{chunk-SGSWVNNB.js → chunk-R6F6KFIL.js} +7 -7
- package/dist/{chunk-7YGORYZD.js → chunk-T6C4LFLC.js} +4 -4
- package/dist/{chunk-KBO5OOON.js → chunk-VDL5CJ5C.js} +9 -9
- package/dist/{chunk-FLYF76CU.js → chunk-VQOAATIG.js} +4 -4
- package/dist/{chunk-E45CSC33.js → chunk-XKWOJZZ4.js} +2 -2
- package/dist/runtime/base-classes/index.js +22 -22
- package/dist/runtime/shared/openapi/index.js +3 -3
- package/dist/runtime/subsystems/auth/auth.module.js +3 -3
- package/dist/runtime/subsystems/auth/index.js +11 -11
- package/dist/runtime/subsystems/bridge/bridge-delivery-handler.js +3 -3
- package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js +1 -1
- package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js +6 -6
- package/dist/runtime/subsystems/bridge/bridge.module.js +15 -15
- package/dist/runtime/subsystems/bridge/event-flow.service.js +2 -2
- package/dist/runtime/subsystems/bridge/index.js +15 -15
- package/dist/runtime/subsystems/cache/cache.drizzle-backend.js +2 -2
- package/dist/runtime/subsystems/cache/cache.module.js +3 -3
- package/dist/runtime/subsystems/cache/index.js +5 -5
- package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js +4 -4
- package/dist/runtime/subsystems/events/event-bus.memory-backend.js +2 -2
- package/dist/runtime/subsystems/events/events.module.d.ts +24 -7
- package/dist/runtime/subsystems/events/events.module.js +6 -6
- package/dist/runtime/subsystems/events/index.js +9 -9
- package/dist/runtime/subsystems/index.js +84 -84
- package/dist/runtime/subsystems/integration/build-change-source.js +2 -2
- package/dist/runtime/subsystems/integration/index.js +22 -22
- package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js +2 -2
- package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js +2 -2
- package/dist/runtime/subsystems/integration/integration.module.js +4 -4
- package/dist/runtime/subsystems/jobs/index.js +32 -32
- package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js +7 -7
- package/dist/runtime/subsystems/jobs/job-orchestrator.drizzle-backend.js +4 -4
- package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js +2 -2
- package/dist/runtime/subsystems/jobs/job-run-service.drizzle-backend.js +3 -3
- package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js +2 -2
- package/dist/runtime/subsystems/jobs/job-worker.bullmq-backend.js +3 -3
- package/dist/runtime/subsystems/jobs/job-worker.js +4 -4
- package/dist/runtime/subsystems/jobs/job-worker.module.js +10 -10
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js +8 -8
- package/dist/runtime/subsystems/observability/index.js +3 -3
- package/dist/runtime/subsystems/observability/observability.module.js +3 -3
- package/dist/runtime/subsystems/observability/observability.service.js +2 -2
- package/dist/src/cli/index.js +58 -11
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/index.js +7 -7
- package/package.json +1 -1
- package/runtime/subsystems/events/events.module.ts +24 -7
- package/dist/chunk-KHQ72A5F.js.map +0 -1
- /package/dist/{chunk-5LXOJGO2.js.map → chunk-3VEVGL74.js.map} +0 -0
- /package/dist/{chunk-I6UXRJ3Q.js.map → chunk-43SBT72G.js.map} +0 -0
- /package/dist/{chunk-5RT7JGKT.js.map → chunk-7OVCARTQ.js.map} +0 -0
- /package/dist/{chunk-NYJYK6J4.js.map → chunk-BKP72EDW.js.map} +0 -0
- /package/dist/{chunk-QSJ3J4HE.js.map → chunk-CDLWYZVQ.js.map} +0 -0
- /package/dist/{chunk-W2UIDI3R.js.map → chunk-CLWBNXKF.js.map} +0 -0
- /package/dist/{chunk-27ETSJ2X.js.map → chunk-COGHTKXY.js.map} +0 -0
- /package/dist/{chunk-3YCUIGPG.js.map → chunk-D44QFQJZ.js.map} +0 -0
- /package/dist/{chunk-LARB26EI.js.map → chunk-DB5UXJC3.js.map} +0 -0
- /package/dist/{chunk-LQXBQO72.js.map → chunk-E5FJWOMP.js.map} +0 -0
- /package/dist/{chunk-CUSMC2KK.js.map → chunk-E6PLM6QG.js.map} +0 -0
- /package/dist/{chunk-YK5JEVLX.js.map → chunk-FFUDEIFF.js.map} +0 -0
- /package/dist/{chunk-4OC5MSHO.js.map → chunk-GOO5ZMYO.js.map} +0 -0
- /package/dist/{chunk-T6SCOJF4.js.map → chunk-JGGZUP64.js.map} +0 -0
- /package/dist/{chunk-XWBK3XJK.js.map → chunk-O2A6XHGD.js.map} +0 -0
- /package/dist/{chunk-ATVGYF3D.js.map → chunk-QFUIE37H.js.map} +0 -0
- /package/dist/{chunk-WKNOEVWQ.js.map → chunk-QMN3LQR3.js.map} +0 -0
- /package/dist/{chunk-SGSWVNNB.js.map → chunk-R6F6KFIL.js.map} +0 -0
- /package/dist/{chunk-7YGORYZD.js.map → chunk-T6C4LFLC.js.map} +0 -0
- /package/dist/{chunk-KBO5OOON.js.map → chunk-VDL5CJ5C.js.map} +0 -0
- /package/dist/{chunk-FLYF76CU.js.map → chunk-VQOAATIG.js.map} +0 -0
- /package/dist/{chunk-E45CSC33.js.map → chunk-XKWOJZZ4.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,88 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.20.2] — 2026-06-06
|
|
8
|
+
|
|
9
|
+
Two consumer-found fixes (dogfooding swe-brain on 0.20.1).
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **ADR-039 boot tick was lost to a module-init race.** `EventSchedulerLifecycle`
|
|
14
|
+
ran `materializeBoot()` from `onModuleInit`, which fires during the EVENTS
|
|
15
|
+
module's own init — BEFORE later modules (notably `BridgeModule`, whose
|
|
16
|
+
outbox-drain hook turns a scheduled event into `bridge_delivery` rows) finish
|
|
17
|
+
wiring. With `listenNotify` the boot row drained within ~3ms and was marked
|
|
18
|
+
`processed` with ZERO deliveries and no error (verified live: slot
|
|
19
|
+
`@schedule/reconcile_due/1780707600000` processed 3ms after materialisation,
|
|
20
|
+
zero `bridge_delivery` rows for `reconcile-poll#0`; the in-loop tick at the
|
|
21
|
+
next slot boundary delivered correctly — boot-only loss). **Fix:** the
|
|
22
|
+
lifecycle now defers to `onApplicationBootstrap` (fires after all modules'
|
|
23
|
+
`onModuleInit` + every hook is attached), so the boot tick drains against the
|
|
24
|
+
fully-wired pipeline. The tick interval start moved with it (both passes live
|
|
25
|
+
in `EventScheduler.start()`). Regression tests assert the hook surface is
|
|
26
|
+
`onApplicationBootstrap` (not `onModuleInit`) and that a boot-materialised
|
|
27
|
+
scheduled event reaches a subscriber attached after init.
|
|
28
|
+
- **#473 — `subsystem install observability` never wired `ObservabilityModule`.**
|
|
29
|
+
The install added `observability` to `subsystems.install` but the barrel
|
|
30
|
+
emitter had no composer, so `ObservabilityModule.forRoot` was never emitted
|
|
31
|
+
into `SUBSYSTEM_MODULES` — consumers hand-wired it in `app.module.ts` (like
|
|
32
|
+
Auth). **Fix:** added an `observability` composer. It emits
|
|
33
|
+
`ObservabilityModule.forRoot()` (no `backend`/`multiTenant` — a combiner per
|
|
34
|
+
ADR-025 owns no durable state), imported package- or vendored-aware, and is
|
|
35
|
+
ordered LAST in `COMPOSABLE_ORDER` so its `forRoot` registers AFTER the
|
|
36
|
+
events/jobs/bridge/integration read ports it composes via `@Optional()` DI.
|
|
37
|
+
The `observability.reporters` block (OBS-6) is threaded into `forRoot` only
|
|
38
|
+
when a reporter is `enabled: true` (off-by-default, mirroring the
|
|
39
|
+
`listen_notify` / `differ` clauses); the default install stays a bare
|
|
40
|
+
`ObservabilityModule.forRoot()`. Closes #473.
|
|
41
|
+
|
|
42
|
+
### Tests
|
|
43
|
+
|
|
44
|
+
- `subsystem-barrel-generator` tests: observability composer coverage (both
|
|
45
|
+
modes, combiner ordering after the composed siblings, reporters threaded only
|
|
46
|
+
when enabled).
|
|
47
|
+
- **Subsystems smoke now asserts forRoot presence per installed subsystem** (not
|
|
48
|
+
just events' `eventRegistry`) — it installs observability too and fails if the
|
|
49
|
+
real generated barrel is missing any installed subsystem's `forRoot` or if
|
|
50
|
+
observability isn't ordered after the read ports. Both gap classes (the
|
|
51
|
+
scheduler threading and the missing observability wiring) survived because
|
|
52
|
+
nothing end-to-end checked per-subsystem wiring.
|
|
53
|
+
|
|
54
|
+
## [0.20.1] — 2026-06-06
|
|
55
|
+
|
|
56
|
+
**Fix: the subsystems barrel never threaded `eventRegistry` into
|
|
57
|
+
`EventsModule.forRoot`** — so `EventSchedulerLifecycle` never spawned and
|
|
58
|
+
ADR-039 scheduled events silently didn't tick (dogfood gap found consuming
|
|
59
|
+
0.20.0 in swe-brain, package mode). The 0.20.0 runtime expected the barrel to
|
|
60
|
+
pass the consumer's generated `eventRegistry`, but the emitter (`subsystem-
|
|
61
|
+
barrel-generator`) was never updated to do so.
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
|
|
65
|
+
- **`subsystem-barrel-generator` now threads `eventRegistry`** into
|
|
66
|
+
`EventsModule.forRoot` on every events branch (package + vendored, plain +
|
|
67
|
+
`listenNotify`). The registry is imported from `./events/registry`
|
|
68
|
+
(package mode) or `<subsystemsRoot>/events/generated/registry` (vendored) —
|
|
69
|
+
the same conditioning/relative-import mechanism the `TypedEventBus` import
|
|
70
|
+
already uses. `EventSchedulerLifecycle` reads `eventRegistry` (and only it —
|
|
71
|
+
no bundled fallback), so this is what makes the scheduler spawn.
|
|
72
|
+
- **Stub guard extended to vendored mode.** A bare `subsystem install events`
|
|
73
|
+
regenerates the barrel before `entity new --all` has emitted the generated
|
|
74
|
+
events set; the writer drops the empty 5-file set (incl. `registry.ts`) into
|
|
75
|
+
the vendored `<subsystemsRoot>/events/generated/` if absent, so the barrel's
|
|
76
|
+
new `eventRegistry` import never dangles (package mode already had this guard
|
|
77
|
+
for `./events/bus`; the same path emits `registry.ts`).
|
|
78
|
+
|
|
79
|
+
### Tests
|
|
80
|
+
|
|
81
|
+
- `subsystem-barrel-generator` tests updated for the new `forRoot` shape +
|
|
82
|
+
a both-modes regression guard asserting `eventRegistry` is imported AND
|
|
83
|
+
threaded.
|
|
84
|
+
- **Subsystems smoke now asserts the threading end-to-end** — the gap survived
|
|
85
|
+
because nothing checked that a consumer's barrel actually wires the scheduler.
|
|
86
|
+
`run-smoke-subsystems` now fails if the real generated barrel doesn't import
|
|
87
|
+
`eventRegistry` and pass it to `EventsModule.forRoot`.
|
|
88
|
+
|
|
7
89
|
## [0.20.0] — 2026-06-06
|
|
8
90
|
|
|
9
91
|
**Declarative time-based scheduling: time as an event source** (ADR-039;
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
toJobRunSummary
|
|
6
6
|
} from "./chunk-L3LZWWSX.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
MissingTenantIdError
|
|
9
|
+
} from "./chunk-T4BIIU5E.js";
|
|
10
10
|
import {
|
|
11
11
|
JOBS_MULTI_TENANT,
|
|
12
12
|
JOB_ORCHESTRATOR
|
|
13
13
|
} from "./chunk-ZPL74UQN.js";
|
|
14
14
|
import {
|
|
15
|
-
|
|
16
|
-
} from "./chunk-
|
|
15
|
+
jobRuns
|
|
16
|
+
} from "./chunk-OKXZ63IA.js";
|
|
17
17
|
import {
|
|
18
18
|
DRIZZLE
|
|
19
19
|
} from "./chunk-U64T4YZE.js";
|
|
@@ -198,4 +198,4 @@ DrizzleJobRunService = __decorateClass([
|
|
|
198
198
|
export {
|
|
199
199
|
DrizzleJobRunService
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
201
|
+
//# sourceMappingURL=chunk-3VEVGL74.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
WebhookChangeSource
|
|
3
|
-
} from "./chunk-TIZXQU26.js";
|
|
4
1
|
import {
|
|
5
2
|
PollChangeSource
|
|
6
3
|
} from "./chunk-4MF3HKJA.js";
|
|
4
|
+
import {
|
|
5
|
+
WebhookChangeSource
|
|
6
|
+
} from "./chunk-TIZXQU26.js";
|
|
7
7
|
|
|
8
8
|
// runtime/subsystems/integration/build-change-source.ts
|
|
9
9
|
function buildChangeSource(cfg, fetch, middlewares = []) {
|
|
@@ -26,4 +26,4 @@ function buildChangeSource(cfg, fetch, middlewares = []) {
|
|
|
26
26
|
export {
|
|
27
27
|
buildChangeSource
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-43SBT72G.js.map
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
JOB_ORCHESTRATOR
|
|
6
6
|
} from "./chunk-ZPL74UQN.js";
|
|
7
|
+
import {
|
|
8
|
+
EVENT_BUS
|
|
9
|
+
} from "./chunk-H5NH7KPE.js";
|
|
7
10
|
import {
|
|
8
11
|
BRIDGE_DELIVERY_REPO,
|
|
9
12
|
BRIDGE_MULTI_TENANT,
|
|
10
13
|
BRIDGE_REGISTRY
|
|
11
14
|
} from "./chunk-4LH67P4U.js";
|
|
12
|
-
import {
|
|
13
|
-
EVENT_BUS
|
|
14
|
-
} from "./chunk-H5NH7KPE.js";
|
|
15
15
|
import {
|
|
16
16
|
DRIZZLE
|
|
17
17
|
} from "./chunk-U64T4YZE.js";
|
|
@@ -106,4 +106,4 @@ EventFlowService = __decorateClass([
|
|
|
106
106
|
export {
|
|
107
107
|
EventFlowService
|
|
108
108
|
};
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
109
|
+
//# sourceMappingURL=chunk-7OVCARTQ.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DrizzleJobRunService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3VEVGL74.js";
|
|
4
4
|
import {
|
|
5
5
|
MemoryJobRunService
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CDLWYZVQ.js";
|
|
7
7
|
import {
|
|
8
8
|
DrizzleJobStepService
|
|
9
9
|
} from "./chunk-DV4RV2DC.js";
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
} from "./chunk-I6MVCB5A.js";
|
|
15
15
|
import {
|
|
16
16
|
DrizzleJobOrchestrator
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-E6PLM6QG.js";
|
|
18
18
|
import {
|
|
19
19
|
MemoryJobOrchestrator
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-VQOAATIG.js";
|
|
21
21
|
import {
|
|
22
22
|
MemoryJobStepService
|
|
23
23
|
} from "./chunk-PNZSGAB2.js";
|
|
@@ -114,4 +114,4 @@ JobsDomainModule = __decorateClass([
|
|
|
114
114
|
export {
|
|
115
115
|
JobsDomainModule
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=chunk-
|
|
117
|
+
//# sourceMappingURL=chunk-BKP72EDW.js.map
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
MemoryJobStore
|
|
9
9
|
} from "./chunk-SNQ3TOWP.js";
|
|
10
|
+
import {
|
|
11
|
+
MissingTenantIdError
|
|
12
|
+
} from "./chunk-T4BIIU5E.js";
|
|
10
13
|
import {
|
|
11
14
|
JOBS_MULTI_TENANT,
|
|
12
15
|
JOB_ORCHESTRATOR
|
|
13
16
|
} from "./chunk-ZPL74UQN.js";
|
|
14
|
-
import {
|
|
15
|
-
MissingTenantIdError
|
|
16
|
-
} from "./chunk-T4BIIU5E.js";
|
|
17
17
|
import {
|
|
18
18
|
__decorateClass,
|
|
19
19
|
__decorateParam
|
|
@@ -209,4 +209,4 @@ function compareBy(a, b, order) {
|
|
|
209
209
|
export {
|
|
210
210
|
MemoryJobRunService
|
|
211
211
|
};
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
212
|
+
//# sourceMappingURL=chunk-CDLWYZVQ.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JOB_RUN_SERVICE
|
|
3
3
|
} from "./chunk-ZPL74UQN.js";
|
|
4
|
-
import {
|
|
5
|
-
BRIDGE_DELIVERY_REPO
|
|
6
|
-
} from "./chunk-4LH67P4U.js";
|
|
7
4
|
import {
|
|
8
5
|
EVENT_READ_PORT
|
|
9
6
|
} from "./chunk-H5NH7KPE.js";
|
|
7
|
+
import {
|
|
8
|
+
BRIDGE_DELIVERY_REPO
|
|
9
|
+
} from "./chunk-4LH67P4U.js";
|
|
10
10
|
import {
|
|
11
11
|
INTEGRATION_CURSOR_STORE,
|
|
12
12
|
INTEGRATION_RUN_RECORDER
|
|
@@ -181,4 +181,4 @@ ObservabilityService = __decorateClass([
|
|
|
181
181
|
export {
|
|
182
182
|
ObservabilityService
|
|
183
183
|
};
|
|
184
|
-
//# sourceMappingURL=chunk-
|
|
184
|
+
//# sourceMappingURL=chunk-CLWBNXKF.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DrizzleCacheService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T6C4LFLC.js";
|
|
4
4
|
import {
|
|
5
5
|
MemoryCacheService
|
|
6
6
|
} from "./chunk-IF5I3DAA.js";
|
|
@@ -81,4 +81,4 @@ CacheModule = __decorateClass([
|
|
|
81
81
|
export {
|
|
82
82
|
CacheModule
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
84
|
+
//# sourceMappingURL=chunk-COGHTKXY.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JobWorker
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VDL5CJ5C.js";
|
|
4
4
|
import {
|
|
5
5
|
JobsDomainModule
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BKP72EDW.js";
|
|
7
7
|
import {
|
|
8
8
|
BULLMQ_CONNECTION,
|
|
9
9
|
BULLMQ_RESOLVED_CONFIG,
|
|
@@ -14,11 +14,6 @@ import {
|
|
|
14
14
|
allPoolNames,
|
|
15
15
|
loadPoolConfig
|
|
16
16
|
} from "./chunk-RHVN6NA7.js";
|
|
17
|
-
import {
|
|
18
|
-
JOB_ORCHESTRATOR,
|
|
19
|
-
JOB_RUN_SERVICE,
|
|
20
|
-
JOB_STEP_SERVICE
|
|
21
|
-
} from "./chunk-ZPL74UQN.js";
|
|
22
17
|
import {
|
|
23
18
|
BootValidationError,
|
|
24
19
|
ReservedPoolViolationError
|
|
@@ -26,6 +21,11 @@ import {
|
|
|
26
21
|
import {
|
|
27
22
|
HandlerRegistry
|
|
28
23
|
} from "./chunk-7P5ODGLA.js";
|
|
24
|
+
import {
|
|
25
|
+
JOB_ORCHESTRATOR,
|
|
26
|
+
JOB_RUN_SERVICE,
|
|
27
|
+
JOB_STEP_SERVICE
|
|
28
|
+
} from "./chunk-ZPL74UQN.js";
|
|
29
29
|
import {
|
|
30
30
|
tokenKey
|
|
31
31
|
} from "./chunk-GYGNEQSC.js";
|
|
@@ -290,4 +290,4 @@ export {
|
|
|
290
290
|
JobWorkerOrchestrator,
|
|
291
291
|
JobWorkerModule
|
|
292
292
|
};
|
|
293
|
-
//# sourceMappingURL=chunk-
|
|
293
|
+
//# sourceMappingURL=chunk-D44QFQJZ.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
clampEventLimit,
|
|
3
|
+
decodeEventCursor,
|
|
4
|
+
encodeEventCursor
|
|
5
|
+
} from "./chunk-UQ5EHOH2.js";
|
|
4
6
|
import {
|
|
5
7
|
EVENTS_WAKE_CHANNEL,
|
|
6
8
|
PgNotifyListener,
|
|
7
9
|
pgNotify
|
|
8
10
|
} from "./chunk-Q6LRJ4VI.js";
|
|
9
|
-
import {
|
|
10
|
-
domainEvents
|
|
11
|
-
} from "./chunk-E2BRT5IB.js";
|
|
12
11
|
import {
|
|
13
12
|
EVENTS_MODULE_OPTIONS
|
|
14
13
|
} from "./chunk-H5NH7KPE.js";
|
|
15
14
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
BRIDGE_OUTBOX_DRAIN_HOOK
|
|
16
|
+
} from "./chunk-4LH67P4U.js";
|
|
17
|
+
import {
|
|
18
|
+
domainEvents
|
|
19
|
+
} from "./chunk-E2BRT5IB.js";
|
|
20
20
|
import {
|
|
21
21
|
DRIZZLE
|
|
22
22
|
} from "./chunk-U64T4YZE.js";
|
|
@@ -460,4 +460,4 @@ DrizzleEventBus = __decorateClass([
|
|
|
460
460
|
export {
|
|
461
461
|
DrizzleEventBus
|
|
462
462
|
};
|
|
463
|
-
//# sourceMappingURL=chunk-
|
|
463
|
+
//# sourceMappingURL=chunk-DB5UXJC3.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BRIDGE_DELIVERY_JOB_TYPE
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R6F6KFIL.js";
|
|
4
4
|
import {
|
|
5
5
|
bridgeDelivery
|
|
6
6
|
} from "./chunk-BORNCTH3.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
JOBS_WAKE_CHANNEL,
|
|
9
|
+
pgNotify
|
|
10
|
+
} from "./chunk-Q6LRJ4VI.js";
|
|
10
11
|
import {
|
|
11
12
|
JOBS_LISTEN_NOTIFY
|
|
12
13
|
} from "./chunk-ZPL74UQN.js";
|
|
@@ -14,9 +15,8 @@ import {
|
|
|
14
15
|
BRIDGE_REGISTRY
|
|
15
16
|
} from "./chunk-4LH67P4U.js";
|
|
16
17
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./chunk-Q6LRJ4VI.js";
|
|
18
|
+
jobRuns
|
|
19
|
+
} from "./chunk-OKXZ63IA.js";
|
|
20
20
|
import {
|
|
21
21
|
__decorateClass,
|
|
22
22
|
__decorateParam
|
|
@@ -151,4 +151,4 @@ BridgeOutboxDrainHook = __decorateClass([
|
|
|
151
151
|
export {
|
|
152
152
|
BridgeOutboxDrainHook
|
|
153
153
|
};
|
|
154
|
-
//# sourceMappingURL=chunk-
|
|
154
|
+
//# sourceMappingURL=chunk-E5FJWOMP.js.map
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
jobRuns,
|
|
3
|
-
jobSteps,
|
|
4
|
-
jobs
|
|
5
|
-
} from "./chunk-OKXZ63IA.js";
|
|
6
|
-
import {
|
|
7
|
-
JOBS_LISTEN_NOTIFY,
|
|
8
|
-
JOBS_MULTI_TENANT
|
|
9
|
-
} from "./chunk-ZPL74UQN.js";
|
|
10
1
|
import {
|
|
11
2
|
JobCollisionError,
|
|
12
3
|
JobNotReplayableError,
|
|
@@ -14,14 +5,23 @@ import {
|
|
|
14
5
|
JobTypeNotFoundError,
|
|
15
6
|
MissingTenantIdError
|
|
16
7
|
} from "./chunk-T4BIIU5E.js";
|
|
8
|
+
import {
|
|
9
|
+
JOBS_WAKE_CHANNEL,
|
|
10
|
+
pgNotify
|
|
11
|
+
} from "./chunk-Q6LRJ4VI.js";
|
|
17
12
|
import {
|
|
18
13
|
keySelectorToTemplate,
|
|
19
14
|
resolveJobKey
|
|
20
15
|
} from "./chunk-7P5ODGLA.js";
|
|
21
16
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} from "./chunk-
|
|
17
|
+
JOBS_LISTEN_NOTIFY,
|
|
18
|
+
JOBS_MULTI_TENANT
|
|
19
|
+
} from "./chunk-ZPL74UQN.js";
|
|
20
|
+
import {
|
|
21
|
+
jobRuns,
|
|
22
|
+
jobSteps,
|
|
23
|
+
jobs
|
|
24
|
+
} from "./chunk-OKXZ63IA.js";
|
|
25
25
|
import {
|
|
26
26
|
DRIZZLE
|
|
27
27
|
} from "./chunk-U64T4YZE.js";
|
|
@@ -393,4 +393,4 @@ export {
|
|
|
393
393
|
evaluateKeyTemplate,
|
|
394
394
|
DrizzleJobOrchestrator
|
|
395
395
|
};
|
|
396
|
-
//# sourceMappingURL=chunk-
|
|
396
|
+
//# sourceMappingURL=chunk-E6PLM6QG.js.map
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
integrationRunItems,
|
|
3
|
+
integrationRuns,
|
|
4
|
+
integrationSubscriptions
|
|
5
|
+
} from "./chunk-HNWZFNKP.js";
|
|
1
6
|
import {
|
|
2
7
|
FieldDiffSchema
|
|
3
8
|
} from "./chunk-SQDOBLBP.js";
|
|
@@ -7,11 +12,6 @@ import {
|
|
|
7
12
|
import {
|
|
8
13
|
assertTenantId
|
|
9
14
|
} from "./chunk-MZ6GV4YF.js";
|
|
10
|
-
import {
|
|
11
|
-
integrationRunItems,
|
|
12
|
-
integrationRuns,
|
|
13
|
-
integrationSubscriptions
|
|
14
|
-
} from "./chunk-HNWZFNKP.js";
|
|
15
15
|
import {
|
|
16
16
|
DRIZZLE
|
|
17
17
|
} from "./chunk-U64T4YZE.js";
|
|
@@ -127,4 +127,4 @@ DrizzleIntegrationRunRecorder = __decorateClass([
|
|
|
127
127
|
export {
|
|
128
128
|
DrizzleIntegrationRunRecorder
|
|
129
129
|
};
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
130
|
+
//# sourceMappingURL=chunk-FFUDEIFF.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EVENTS_MODULE_OPTIONS
|
|
3
|
-
} from "./chunk-H5NH7KPE.js";
|
|
4
1
|
import {
|
|
5
2
|
clampEventLimit,
|
|
6
3
|
decodeEventCursor,
|
|
7
4
|
encodeEventCursor
|
|
8
5
|
} from "./chunk-UQ5EHOH2.js";
|
|
6
|
+
import {
|
|
7
|
+
EVENTS_MODULE_OPTIONS
|
|
8
|
+
} from "./chunk-H5NH7KPE.js";
|
|
9
9
|
import {
|
|
10
10
|
__decorateClass,
|
|
11
11
|
__decorateParam
|
|
@@ -243,4 +243,4 @@ MemoryEventBus = __decorateClass([
|
|
|
243
243
|
export {
|
|
244
244
|
MemoryEventBus
|
|
245
245
|
};
|
|
246
|
-
//# sourceMappingURL=chunk-
|
|
246
|
+
//# sourceMappingURL=chunk-GOO5ZMYO.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EnvEncryptionKey
|
|
3
|
-
} from "./chunk-IP4OO26U.js";
|
|
4
1
|
import {
|
|
5
2
|
AuthController
|
|
6
3
|
} from "./chunk-SZVPIHWE.js";
|
|
4
|
+
import {
|
|
5
|
+
EnvEncryptionKey
|
|
6
|
+
} from "./chunk-IP4OO26U.js";
|
|
7
7
|
import {
|
|
8
8
|
DrizzleOAuthStateStore
|
|
9
9
|
} from "./chunk-N5OTOWTP.js";
|
|
@@ -89,4 +89,4 @@ AuthModule = __decorateClass([
|
|
|
89
89
|
export {
|
|
90
90
|
AuthModule
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-JGGZUP64.js.map
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "./chunk-DUUCU77W.js";
|
|
8
8
|
import {
|
|
9
9
|
DrizzleEventBus
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DB5UXJC3.js";
|
|
11
11
|
import {
|
|
12
12
|
MemoryEventBus
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GOO5ZMYO.js";
|
|
14
14
|
import {
|
|
15
15
|
EVENTS_MODULE_OPTIONS,
|
|
16
16
|
EVENTS_MULTI_TENANT,
|
|
@@ -49,7 +49,7 @@ var EventSchedulerLifecycle = class {
|
|
|
49
49
|
opts;
|
|
50
50
|
logger = new Logger(EventSchedulerLifecycle.name);
|
|
51
51
|
scheduler = null;
|
|
52
|
-
async
|
|
52
|
+
async onApplicationBootstrap() {
|
|
53
53
|
const registry = this.opts?.eventRegistry;
|
|
54
54
|
if (!registry) return;
|
|
55
55
|
if (typeof this.bus.materializeScheduledEvent !== "function") return;
|
|
@@ -200,4 +200,4 @@ export {
|
|
|
200
200
|
EventSchedulerLifecycle,
|
|
201
201
|
EventsModule
|
|
202
202
|
};
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
203
|
+
//# sourceMappingURL=chunk-NR7QQ6ZI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../runtime/subsystems/events/events.module.ts"],"sourcesContent":["/**\n * EventsModule — DynamicModule factory for the event bus subsystem.\n *\n * Register once in AppModule:\n * ```typescript\n * @Module({\n * imports: [\n * EventsModule.forRoot({ backend: 'drizzle' }),\n * ],\n * })\n * export class AppModule {}\n * ```\n *\n * Tests swap to the memory backend without touching application code:\n * ```typescript\n * Test.createTestingModule({\n * imports: [EventsModule.forRoot({ backend: 'memory' })],\n * });\n * ```\n *\n * Per-pool drain isolation (EVT-4):\n * ```typescript\n * EventsModule.forRoot({ backend: 'drizzle', pools: ['events_change'] });\n * ```\n * Each process restricts its drain loop to the pools listed here. `pools`\n * is undefined by default → drain all pending rows (backwards-compatible).\n *\n * Typed facade + multi-tenancy (EVT-6):\n * - `TYPED_EVENT_BUS` resolves to the generated `TypedEventBus` wrapping\n * whichever backend is selected.\n * - `multiTenant: true` makes `TypedEventBus.publish` throw\n * `MissingTenantIdError` when the caller forgets `metadata.tenantId`.\n *\n * `global: true` means entity modules do not need to import EventsModule\n * individually — the EVENT_BUS and TYPED_EVENT_BUS tokens are available\n * project-wide.\n *\n * Async configuration (`forRootAsync`):\n * The async factory returns `EventsModuleOptions`; the EVENT_BUS provider\n * then receives its backend dependencies — DRIZZLE for the drizzle\n * backend, REDIS_URL for the redis backend, the resolved options for the\n * memory backend — through a proper `useFactory` so Nest DI wires them\n * correctly. Earlier revisions hand-constructed backends with\n * `new Class()` which silently left `db` / `redisUrl` undefined\n * (issue #108).\n */\nimport {\n Inject,\n Injectable,\n Logger,\n Module,\n Optional,\n type DynamicModule,\n type OnApplicationBootstrap,\n type OnModuleDestroy,\n type Provider,\n type Type,\n} from '@nestjs/common';\nimport {\n EVENT_BUS,\n EVENT_READ_PORT,\n EVENTS_MODULE_OPTIONS,\n EVENTS_MULTI_TENANT,\n REDIS_URL,\n TYPED_EVENT_BUS,\n} from './events.tokens';\nimport { DRIZZLE } from '../../constants/tokens';\nimport type { DrizzleClient } from '../../types/drizzle';\nimport { DrizzleEventBus } from './event-bus.drizzle-backend';\nimport { MemoryEventBus } from './event-bus.memory-backend';\nimport type { IEventBus } from './event-bus.protocol';\nimport {\n EventScheduler,\n scheduledEventsFromRegistry,\n type RegistrySchedule,\n} from './event-scheduler';\n// #6 — `RedisEventBus` is lazy-loaded only when `backend: 'redis'` is selected.\n// The file is filtered out of the vendor set for non-redis installs (see\n// `backendFileFilter` in src/cli/commands/subsystem.ts); the dynamic-string\n// import below makes TS treat the specifier as `any` so the consumer's tsc\n// never tries to resolve the absent file.\nimport { TypedEventBus } from './generated/bus';\n\n/**\n * Lazy-load the Redis backend. Routed through a non-literal specifier so\n * the consumer's `tsc` doesn't resolve `./event-bus.redis-backend` at type\n * check time — important because that file is filtered out of drizzle/\n * memory installs (#6).\n */\nasync function loadRedisEventBus(): Promise<new (url: string) => object> {\n // Non-literal specifier — TS gives this an `any` module type, sidestepping\n // resolution of a file that may not be vendored.\n const specifier = './event-bus.redis-backend';\n const mod = (await import(specifier)) as { RedisEventBus: new (url: string) => object };\n return mod.RedisEventBus;\n}\n\nexport interface EventsModuleOptions {\n backend: 'drizzle' | 'memory' | 'redis';\n /**\n * Redis connection URL used when `backend` is `'redis'`.\n * Falls back to the REDIS_URL environment variable, then\n * `redis://localhost:6379` if neither is set.\n */\n redisUrl?: string;\n /**\n * Restrict the drain loop to these pools. Each pool name matches the\n * `domain_events.pool` column (populated from `event.metadata.pool` at\n * publish time). Leave undefined to drain all pending rows.\n *\n * Typical lane split: one process per `events_inbound` /\n * `events_change` / `events_outbound` so a slow outbound handler\n * cannot stall change-event propagation (see ADR-022).\n */\n pools?: string[];\n /**\n * LISTEN-NOTIFY-1 — when `true` (drizzle backend only), the drainer holds a\n * dedicated listener connection and LISTENs on `codegen_events_wake`. Each\n * `publish`/`publishMany` emits an in-tx `pg_notify(codegen_events_wake,\n * <pool>)` so the drainer wakes the moment the publishing transaction commits,\n * instead of waiting for the next poll tick. Polling continues unchanged as\n * the fallback heartbeat; a lost notify degrades to poll latency, never to\n * lost work. Defaults to `false`.\n *\n * Ignored by the memory + redis backends (memory dispatches inline; redis has\n * its own fan-out). Requires a direct (non-transaction-pooler) connection —\n * see the events/jobs config block re: PgBouncer.\n */\n listenNotify?: boolean;\n /**\n * Multi-tenancy opt-in (EVT-6).\n *\n * When `true`, every `TypedEventBus.publish()` call must supply\n * `opts.metadata.tenantId` — otherwise it throws `MissingTenantIdError`.\n * The tenantId is preserved on `event.metadata` and, for the Drizzle\n * backend, written to `domain_events.tenant_id` (EVT-4).\n *\n * Drain-side tenant filtering is deferred — the tenant-context model\n * (per-process vs. per-request vs. async-local-storage) is still\n * unsettled; see ADR-024 §Multi-tenancy. Only the publish-side\n * requirement ships here.\n *\n * Defaults to `false`.\n */\n multiTenant?: boolean;\n /**\n * The generated `TypedEventBus` class to bind to `TYPED_EVENT_BUS`.\n *\n * **Package mode (ADR-037).** When the runtime is imported from\n * `@pattern-stack/codegen` (not vendored), the bundled `./generated/bus`\n * `TypedEventBus` is typed to an EMPTY event union and reads the bundled\n * empty `eventRegistry` — a consumer's `events/*.yaml` are scanned into\n * `src/generated/events/bus.ts` (typed to THEIR union, reading THEIR\n * registry), which the package can't import. The generated subsystem barrel\n * therefore threads that class in here:\n * `EventsModule.forRoot({ ..., typedBus: TypedEventBus })`. Nest constructs\n * it with this module's `EVENT_BUS` + `EVENTS_MULTI_TENANT` providers (the\n * generated class injects the same string-valued tokens, which match across\n * the package boundary).\n *\n * Omitted (vendored mode / tests) ⇒ falls back to the bundled\n * `./generated/bus`, which in a vendored tree IS the consumer's generated\n * file. Without this, a package-mode consumer's typed `publish<'…'>()` calls\n * resolve against the empty union and their events never get the right\n * `pool` / `direction` stamped.\n *\n * Only consulted by `forRoot` (the path the barrel emits); `forRootAsync`\n * keeps the bundled bus.\n */\n typedBus?: Type<unknown>;\n /**\n * ADR-039 — the consumer's generated `eventRegistry`, threaded so the\n * `EventScheduler` can read the `schedule:` block + routing metadata of every\n * scheduled event. Package mode: the generated subsystem barrel passes the\n * consumer's `eventRegistry` (the bundled one is the package's empty/fixture\n * registry, which the package can't see the consumer's events through — same\n * reason `typedBus` is threaded). Omitted ⇒ no scheduler is spawned (vendored\n * tree reads its own bundled registry only if the barrel passes it; tests\n * pass a registry directly).\n *\n * Structural shape: each value needs `schedule?` + `direction` + `pool`. The\n * generated `EventMetadata` satisfies it; typing it loosely here avoids a\n * runtime dependency on the generated types from the module file.\n */\n eventRegistry?: Record<\n string,\n { schedule?: RegistrySchedule; direction: string | null; pool: string | null }\n >;\n}\n\n/**\n * Lifecycle holder for the `EventScheduler` (ADR-039). Registered as a provider\n * on the drizzle/memory `forRoot` branches. Reads the scheduled-event set from\n * the threaded `eventRegistry` and starts the materialiser. No-op when nothing\n * declared `schedule:`, or under the redis backend (no outbox history).\n *\n * **Why `onApplicationBootstrap`, not `onModuleInit` (boot-tick race fix).**\n * `start()` runs `materializeBoot()`, which inserts the current slot's\n * `domain_events` row. With `listenNotify` enabled the outbox drain consumes\n * that row within milliseconds — so it MUST NOT run until every other module\n * has attached its outbox hooks. `onModuleInit` fires during the EVENTS\n * module's own init, BEFORE later modules (notably `BridgeModule`, which\n * attaches the bridge outbox-drain hook) finish initialising. The result was a\n * silent boot-only loss: the boot tick drained to `processed` with ZERO\n * `bridge_delivery` rows and no error (verified live in swe-brain on 0.20.1 —\n * slot `@schedule/reconcile_due/...` processed 3ms after materialisation, no\n * deliveries; the in-loop tick at the next slot delivered correctly).\n *\n * `onApplicationBootstrap` fires AFTER all modules' `onModuleInit` complete and\n * every hook is attached — the boot tick is then drained against the fully\n * wired pipeline. The tick interval starts here too (it lives inside `start()`,\n * and keeping both passes on the same hook keeps the boot/interval contract in\n * one place).\n */\n@Injectable()\nexport class EventSchedulerLifecycle implements OnApplicationBootstrap, OnModuleDestroy {\n private readonly logger = new Logger(EventSchedulerLifecycle.name);\n private scheduler: EventScheduler | null = null;\n\n constructor(\n @Inject(EVENT_BUS) private readonly bus: IEventBus,\n @Optional()\n @Inject(EVENTS_MODULE_OPTIONS)\n private readonly opts: EventsModuleOptions | null = null,\n ) {}\n\n async onApplicationBootstrap(): Promise<void> {\n const registry = this.opts?.eventRegistry;\n if (!registry) return;\n if (typeof this.bus.materializeScheduledEvent !== 'function') return; // redis\n const schedules = scheduledEventsFromRegistry(registry);\n if (schedules.length === 0) return;\n this.scheduler = new EventScheduler(this.bus, schedules);\n await this.scheduler.start();\n this.logger.log(`EventScheduler wired for ${schedules.length} scheduled event(s).`);\n }\n\n async onModuleDestroy(): Promise<void> {\n if (this.scheduler) {\n this.scheduler.stop();\n this.scheduler = null;\n }\n }\n}\n\nexport interface EventsModuleAsyncOptions {\n useFactory: (...args: unknown[]) => Promise<EventsModuleOptions> | EventsModuleOptions;\n inject?: unknown[];\n imports?: unknown[];\n}\n\n/**\n * Shared provider set: `TypedEventBus` itself, the `TYPED_EVENT_BUS` token\n * binding, and the resolved `EVENTS_MULTI_TENANT` flag. Returned from one\n * place so every `forRoot` branch and `forRootAsync` agree.\n */\nfunction buildTypedBusProviders(\n multiTenant: boolean,\n typedBus?: Type<unknown>,\n): Provider[] {\n // Package mode threads the consumer's generated `TypedEventBus` (typed to\n // their event union, reading their registry) via `typedBus`; vendored mode\n // omits it and we fall back to the bundled `./generated/bus` (which IS the\n // consumer's generated file in a vendored tree). See `EventsModuleOptions.typedBus`.\n const BusClass = typedBus ?? TypedEventBus;\n return [\n BusClass,\n { provide: TYPED_EVENT_BUS, useExisting: BusClass },\n { provide: EVENTS_MULTI_TENANT, useValue: multiTenant },\n ];\n}\n\n/**\n * Construct the backend instance for the async path, routing constructor\n * arguments through Nest-resolved dependencies.\n *\n * DRIZZLE is declared optional at inject time so that memory-backend\n * consumers aren't required to also import `DatabaseModule`. If the\n * drizzle backend is selected but no DRIZZLE provider is registered, we\n * throw a clear error instead of silently constructing a broken bus.\n */\nasync function buildEventBusAsync(\n options: EventsModuleOptions,\n db: DrizzleClient | null,\n redisUrl: string,\n): Promise<unknown> {\n if (options.backend === 'drizzle') {\n if (!db) {\n throw new Error(\n \"EventsModule.forRootAsync: backend: 'drizzle' selected but DRIZZLE provider is not available. \" +\n 'Ensure DatabaseModule (or another provider exposing DRIZZLE) is imported before EventsModule.forRootAsync.',\n );\n }\n return new DrizzleEventBus(db, options);\n }\n if (options.backend === 'redis') {\n // #6: lazy import — the redis backend ships only with `--backend redis`\n // installs; drizzle/memory consumers never touch the file.\n const RedisEventBus = await loadRedisEventBus();\n return new RedisEventBus(redisUrl);\n }\n return new MemoryEventBus(options);\n}\n\n@Module({})\nexport class EventsModule {\n static forRootAsync(asyncOptions: EventsModuleAsyncOptions): DynamicModule {\n return {\n module: EventsModule,\n global: true,\n imports: (asyncOptions.imports ?? []) as Parameters<typeof Module>[0]['imports'],\n providers: [\n {\n provide: EVENTS_MODULE_OPTIONS,\n useFactory: asyncOptions.useFactory,\n inject: (asyncOptions.inject ?? []) as (string | symbol | Function)[],\n },\n {\n provide: EVENTS_MULTI_TENANT,\n useFactory: (options: EventsModuleOptions) => options.multiTenant ?? false,\n inject: [EVENTS_MODULE_OPTIONS],\n },\n {\n provide: REDIS_URL,\n useFactory: (options: EventsModuleOptions) =>\n options.redisUrl ?? process.env['REDIS_URL'] ?? 'redis://localhost:6379',\n inject: [EVENTS_MODULE_OPTIONS],\n },\n {\n provide: EVENT_BUS,\n useFactory: (\n options: EventsModuleOptions,\n db: DrizzleClient | null,\n redisUrl: string,\n ) => buildEventBusAsync(options, db, redisUrl),\n inject: [\n EVENTS_MODULE_OPTIONS,\n { token: DRIZZLE, optional: true },\n REDIS_URL,\n ],\n },\n {\n // Read port (OBS-LIST-1). Drizzle + memory backends implement\n // IEventReadPort on the EVENT_BUS instance; the redis backend\n // retains no history, so EVENT_READ_PORT resolves to `null` and\n // optional consumers (the observability combiner) degrade to\n // empty results.\n provide: EVENT_READ_PORT,\n useFactory: (options: EventsModuleOptions, bus: unknown) =>\n options.backend === 'redis' ? null : bus,\n inject: [EVENTS_MODULE_OPTIONS, EVENT_BUS],\n },\n TypedEventBus,\n { provide: TYPED_EVENT_BUS, useExisting: TypedEventBus },\n ],\n exports: [EVENT_BUS, EVENT_READ_PORT, TYPED_EVENT_BUS, EVENTS_MULTI_TENANT],\n };\n }\n\n static forRoot(\n options: EventsModuleOptions = { backend: 'drizzle' },\n ): DynamicModule {\n const multiTenant = options.multiTenant ?? false;\n\n if (options.backend === 'redis') {\n const resolvedUrl =\n options.redisUrl ?? process.env['REDIS_URL'] ?? 'redis://localhost:6379';\n\n return {\n module: EventsModule,\n global: true,\n providers: [\n { provide: EVENTS_MODULE_OPTIONS, useValue: options },\n { provide: REDIS_URL, useValue: resolvedUrl },\n {\n // #6: useFactory + dynamic import so the consumer's tsc never\n // needs to resolve `event-bus.redis-backend.ts` for drizzle/\n // memory installs (the file is filtered out by\n // `backendFileFilter`). Nest awaits async factories + manages\n // lifecycle on the returned instance, so we drop the old bare\n // `RedisEventBus` provider entry.\n provide: EVENT_BUS,\n useFactory: async (url: string): Promise<object> => {\n const RedisEventBus = await loadRedisEventBus();\n return new RedisEventBus(url);\n },\n inject: [REDIS_URL],\n },\n ...buildTypedBusProviders(multiTenant, options.typedBus),\n ],\n exports: [EVENT_BUS, TYPED_EVENT_BUS, EVENTS_MULTI_TENANT],\n };\n }\n\n const provider =\n options.backend === 'drizzle'\n ? { provide: EVENT_BUS, useClass: DrizzleEventBus }\n : { provide: EVENT_BUS, useClass: MemoryEventBus };\n\n return {\n module: EventsModule,\n global: true,\n providers: [\n { provide: EVENTS_MODULE_OPTIONS, useValue: options },\n provider,\n // Read port (OBS-LIST-1): drizzle + memory backends implement\n // IEventReadPort on the same instance as EVENT_BUS. The redis\n // backend retains no history and does not provide this token.\n { provide: EVENT_READ_PORT, useExisting: EVENT_BUS },\n // ADR-039 — the scheduler lifecycle. No-op unless `eventRegistry` was\n // threaded AND some event declared `schedule:`. Drizzle/memory only\n // (the redis branch above never reaches here).\n EventSchedulerLifecycle,\n ...buildTypedBusProviders(multiTenant, options.typedBus),\n ],\n exports: [EVENT_BUS, EVENT_READ_PORT, TYPED_EVENT_BUS, EVENTS_MULTI_TENANT],\n };\n }\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
integrationSubscriptions
|
|
3
|
+
} from "./chunk-HNWZFNKP.js";
|
|
1
4
|
import {
|
|
2
5
|
INTEGRATION_MULTI_TENANT
|
|
3
6
|
} from "./chunk-S7C6TIIF.js";
|
|
4
7
|
import {
|
|
5
8
|
assertTenantId
|
|
6
9
|
} from "./chunk-MZ6GV4YF.js";
|
|
7
|
-
import {
|
|
8
|
-
integrationSubscriptions
|
|
9
|
-
} from "./chunk-HNWZFNKP.js";
|
|
10
10
|
import {
|
|
11
11
|
DRIZZLE
|
|
12
12
|
} from "./chunk-U64T4YZE.js";
|
|
@@ -97,4 +97,4 @@ PostgresCursorStore = __decorateClass([
|
|
|
97
97
|
export {
|
|
98
98
|
PostgresCursorStore
|
|
99
99
|
};
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
100
|
+
//# sourceMappingURL=chunk-O2A6XHGD.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DrizzleIntegrationRunRecorder
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FFUDEIFF.js";
|
|
4
4
|
import {
|
|
5
5
|
MemoryRunRecorder
|
|
6
6
|
} from "./chunk-EO2QPOKH.js";
|
|
7
7
|
import {
|
|
8
8
|
PostgresCursorStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-O2A6XHGD.js";
|
|
10
10
|
import {
|
|
11
11
|
MemoryCursorStore
|
|
12
12
|
} from "./chunk-AHV4GDYM.js";
|
|
@@ -84,4 +84,4 @@ IntegrationModule = __decorateClass([
|
|
|
84
84
|
export {
|
|
85
85
|
IntegrationModule
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=chunk-
|
|
87
|
+
//# sourceMappingURL=chunk-QFUIE37H.js.map
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
} from "./chunk-5A432NZJ.js";
|
|
4
4
|
import {
|
|
5
5
|
BridgeOutboxDrainHook
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-E5FJWOMP.js";
|
|
7
7
|
import {
|
|
8
8
|
EventFlowService
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7OVCARTQ.js";
|
|
10
10
|
import {
|
|
11
11
|
BRIDGE_RESERVED_POOLS
|
|
12
12
|
} from "./chunk-EDKJU5BO.js";
|
|
13
13
|
import {
|
|
14
14
|
BridgeDeliveryHandler
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-R6F6KFIL.js";
|
|
16
16
|
import {
|
|
17
17
|
DrizzleBridgeDeliveryRepo
|
|
18
18
|
} from "./chunk-MVKW2BCR.js";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./chunk-NXXDZ6ZF.js";
|
|
25
25
|
import {
|
|
26
26
|
JOB_WORKER_MODULE_OPTIONS
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-D44QFQJZ.js";
|
|
28
28
|
import {
|
|
29
29
|
BRIDGE_DELIVERY_REPO,
|
|
30
30
|
BRIDGE_MODULE_OPTIONS,
|
|
@@ -119,4 +119,4 @@ BridgeModule = __decorateClass([
|
|
|
119
119
|
export {
|
|
120
120
|
BridgeModule
|
|
121
121
|
};
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-QMN3LQR3.js.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertTenantId
|
|
3
3
|
} from "./chunk-6DWFJNIK.js";
|
|
4
|
-
import {
|
|
5
|
-
JOB_ORCHESTRATOR
|
|
6
|
-
} from "./chunk-ZPL74UQN.js";
|
|
7
4
|
import {
|
|
8
5
|
JobHandler,
|
|
9
6
|
JobHandlerBase
|
|
10
7
|
} from "./chunk-7P5ODGLA.js";
|
|
8
|
+
import {
|
|
9
|
+
JOB_ORCHESTRATOR
|
|
10
|
+
} from "./chunk-ZPL74UQN.js";
|
|
11
|
+
import {
|
|
12
|
+
EVENT_BUS
|
|
13
|
+
} from "./chunk-H5NH7KPE.js";
|
|
11
14
|
import {
|
|
12
15
|
BRIDGE_DELIVERY_REPO,
|
|
13
16
|
BRIDGE_MULTI_TENANT,
|
|
14
17
|
BRIDGE_REGISTRY
|
|
15
18
|
} from "./chunk-4LH67P4U.js";
|
|
16
|
-
import {
|
|
17
|
-
EVENT_BUS
|
|
18
|
-
} from "./chunk-H5NH7KPE.js";
|
|
19
19
|
import {
|
|
20
20
|
__decorateClass,
|
|
21
21
|
__decorateParam
|
|
@@ -118,4 +118,4 @@ export {
|
|
|
118
118
|
BRIDGE_DELIVERY_JOB_TYPE,
|
|
119
119
|
BridgeDeliveryHandler
|
|
120
120
|
};
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
121
|
+
//# sourceMappingURL=chunk-R6F6KFIL.js.map
|