@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pattern-stack/codegen",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "Entity-driven code generation for full-stack TypeScript applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -70,6 +70,7 @@ import { BridgeOutboxDrainHook } from './bridge-outbox-drain-hook';
70
70
  import { EventFlowService } from './event-flow.service';
71
71
  import { BridgeDeliveryHandler } from './bridge-delivery-handler';
72
72
  import { bridgeRegistry } from './generated/registry';
73
+ import type { BridgeRegistry } from './bridge.protocol';
73
74
  import { BRIDGE_RESERVED_POOLS } from './reserved-pools';
74
75
 
75
76
  export interface BridgeModuleOptions {
@@ -87,6 +88,26 @@ export interface BridgeModuleOptions {
87
88
  * `null` always passes (cross-tenant work). Defaults to `false`.
88
89
  */
89
90
  multiTenant?: boolean;
91
+ /**
92
+ * The codegen-emitted `Record<EventTypeName, BridgeTriggerEntry[]>` that
93
+ * drives outbox-drain trigger lookup (BRIDGE-4) and the facade's Case B
94
+ * dedup (BRIDGE-7).
95
+ *
96
+ * **Package mode (ADR-037).** When the runtime is imported from
97
+ * `@pattern-stack/codegen` (not vendored), the bundled
98
+ * `./generated/registry` is a frozen empty placeholder (`{}`) — a
99
+ * consumer's `@JobHandler.triggers` are scanned into a registry that lives
100
+ * in THEIR `src/generated/bridge-registry.ts`, which the package can't
101
+ * import. The generated subsystem barrel therefore threads that registry in
102
+ * here: `BridgeModule.forRoot({ ..., registry: bridgeRegistry })`. Omitted
103
+ * (vendored mode / tests) ⇒ falls back to the bundled `./generated/registry`,
104
+ * which in vendored mode IS the consumer's freshly-generated file.
105
+ *
106
+ * Without this, package-mode consumers' triggers never bind and the bridge
107
+ * routes nothing (the "wrappers sit pending" footgun's silent twin —
108
+ * nothing is ever enqueued in the first place).
109
+ */
110
+ registry?: BridgeRegistry;
90
111
  }
91
112
 
92
113
  @Module({})
@@ -108,7 +129,11 @@ export class BridgeModule implements OnModuleInit {
108
129
  providers: [
109
130
  { provide: BRIDGE_MODULE_OPTIONS, useValue: opts },
110
131
  { provide: BRIDGE_MULTI_TENANT, useValue: opts.multiTenant ?? false },
111
- { provide: BRIDGE_REGISTRY, useValue: bridgeRegistry },
132
+ // Package mode threads the consumer's generated registry through
133
+ // `opts.registry`; vendored mode omits it and we fall back to the
134
+ // bundled `./generated/registry` (which IS the consumer's generated
135
+ // file in a vendored tree). See `BridgeModuleOptions.registry`.
136
+ { provide: BRIDGE_REGISTRY, useValue: opts.registry ?? bridgeRegistry },
112
137
  repoProvider,
113
138
  // Drain hook — always wired; `DrizzleEventBus` consumes it via
114
139
  // `@Optional()`, so non-bridge mounts simply see `undefined`.