@pattern-stack/codegen 0.14.1 → 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 CHANGED
@@ -4,6 +4,51 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.14.2] — 2026-06-02
8
+
9
+ Package-mode bridge fixes — the two gaps that left the event→job bridge wired but
10
+ inert when the runtime is consumed from the package (`runtime: package`, ADR-037)
11
+ rather than vendored. Both are follow-ons to 0.14.1's package-mode subsystem
12
+ support. Vendored mode is unchanged; these are additive.
13
+
14
+ ### Fixed
15
+
16
+ - **Embedded worker now drains the reserved `events_*` bridge pools.** The
17
+ subsystem barrel emitted `JobWorkerModule.forRoot({ mode: 'embedded' })` with no
18
+ pool list, so the in-process worker polled only `interactive` + `batch` and
19
+ bridge wrappers sat pending forever (the BRIDGE-8 footgun, just past the boot
20
+ guard). When `bridge` is in `subsystems.install`, the embedded worker now
21
+ defaults to `allPools: true` (every lane in-process — exactly the knob
22
+ `BridgeModule`'s reserved-pool guard short-circuits on).
23
+ - **A package-mode consumer's `@JobHandler.triggers` now bind.** Previously
24
+ `BridgeModule` hardwired the bundled `./generated/registry` placeholder (frozen
25
+ `{}` inside the package), and the registry generator skipped entirely in package
26
+ mode (it gated on a vendored `bridge.protocol.ts` that doesn't exist), so no
27
+ event ever routed to a job. The registry is now generated into the consumer's
28
+ `src/generated/bridge-registry.ts` (type imported from
29
+ `@pattern-stack/codegen/runtime/subsystems/bridge/index`, install gated on
30
+ `subsystems.install`) and threaded into `BridgeModule.forRoot({ registry })` by
31
+ the barrel. `subsystem install bridge` drops an empty-registry stub so the
32
+ import never dangles before the next `entity new`.
33
+
34
+ ### Added
35
+
36
+ - **`BridgeModuleOptions.registry?: BridgeRegistry`** — lets the generated barrel
37
+ supply the consumer's scanned registry. Omitted ⇒ falls back to the bundled
38
+ `./generated/registry` (which IS the consumer's generated file in vendored
39
+ mode), so existing consumers and tests are unaffected.
40
+ - **`jobs.worker_pools: string[]` and `jobs.all_pools: true`** config knobs on the
41
+ embedded worker. Precedence: explicit `worker_pools` (→ `pools: [...]`) >
42
+ `all_pools` (→ `allPools: true`) > bridge-installed default (`allPools: true`) >
43
+ the non-reserved default (unchanged).
44
+
45
+ ### Known gaps
46
+
47
+ - Package-mode trigger-event **validation** against the events registry is skipped
48
+ (the event codegen generator is not yet mode-aware, so its registry isn't found
49
+ under the package-mode generated path). Triggers still generate and bind; only
50
+ the build-time "unknown event" check is inert. Tracked for a follow-on.
51
+
7
52
  ## [0.13.0] — 2026-05-31
8
53
 
9
54
  Track D round-2/3 — the integration codegen now emits the **full** integration
@@ -1,5 +1,6 @@
1
1
  import { OnModuleInit, DynamicModule } from '@nestjs/common';
2
2
  import { JobWorkerModuleOptions } from '../jobs/job-worker.module.js';
3
+ import { BridgeRegistry } from './bridge.protocol.js';
3
4
  import '@nestjs/core';
4
5
  import '../../types/drizzle.js';
5
6
  import 'drizzle-orm/node-postgres';
@@ -15,6 +16,7 @@ import '../events/generated/types.js';
15
16
  import '../jobs/job-run-service.protocol.js';
16
17
  import '../jobs/job-step-service.protocol.js';
17
18
  import '../jobs/job-worker.js';
19
+ import './bridge-delivery.schema.js';
18
20
 
19
21
  /**
20
22
  * BridgeModule — `DynamicModule.forRoot({ backend, multiTenant })`
@@ -75,6 +77,26 @@ interface BridgeModuleOptions {
75
77
  * `null` always passes (cross-tenant work). Defaults to `false`.
76
78
  */
77
79
  multiTenant?: boolean;
80
+ /**
81
+ * The codegen-emitted `Record<EventTypeName, BridgeTriggerEntry[]>` that
82
+ * drives outbox-drain trigger lookup (BRIDGE-4) and the facade's Case B
83
+ * dedup (BRIDGE-7).
84
+ *
85
+ * **Package mode (ADR-037).** When the runtime is imported from
86
+ * `@pattern-stack/codegen` (not vendored), the bundled
87
+ * `./generated/registry` is a frozen empty placeholder (`{}`) — a
88
+ * consumer's `@JobHandler.triggers` are scanned into a registry that lives
89
+ * in THEIR `src/generated/bridge-registry.ts`, which the package can't
90
+ * import. The generated subsystem barrel therefore threads that registry in
91
+ * here: `BridgeModule.forRoot({ ..., registry: bridgeRegistry })`. Omitted
92
+ * (vendored mode / tests) ⇒ falls back to the bundled `./generated/registry`,
93
+ * which in vendored mode IS the consumer's freshly-generated file.
94
+ *
95
+ * Without this, package-mode consumers' triggers never bind and the bridge
96
+ * routes nothing (the "wrappers sit pending" footgun's silent twin —
97
+ * nothing is ever enqueued in the first place).
98
+ */
99
+ registry?: BridgeRegistry;
78
100
  }
79
101
  declare class BridgeModule implements OnModuleInit {
80
102
  private readonly workerOpts?;
@@ -3427,7 +3427,11 @@ var BridgeModule = class {
3427
3427
  providers: [
3428
3428
  { provide: BRIDGE_MODULE_OPTIONS, useValue: opts },
3429
3429
  { provide: BRIDGE_MULTI_TENANT, useValue: opts.multiTenant ?? false },
3430
- { provide: BRIDGE_REGISTRY, useValue: bridgeRegistry },
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 },
3431
3435
  repoProvider,
3432
3436
  // Drain hook — always wired; `DrizzleEventBus` consumes it via
3433
3437
  // `@Optional()`, so non-bridge mounts simply see `undefined`.