@pattern-stack/codegen 0.23.0 → 0.24.0

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/consumer-skills/integration/SKILL.md +11 -3
  3. package/dist/{chunk-XKWOJZZ4.js → chunk-37PILMIT.js} +4 -4
  4. package/dist/{chunk-42763UEE.js → chunk-6M6LZEP6.js} +2 -2
  5. package/dist/{chunk-FIUC6QB5.js → chunk-CKLM57IE.js} +10 -10
  6. package/dist/{chunk-SH76CFAY.js → chunk-ENAR3F5S.js} +2 -2
  7. package/dist/{chunk-FFUDEIFF.js → chunk-HN5HT5WL.js} +2 -2
  8. package/dist/{chunk-4M66MQYA.js → chunk-K4BQQ2NN.js} +4 -2
  9. package/dist/chunk-K4BQQ2NN.js.map +1 -0
  10. package/dist/{chunk-QFUIE37H.js → chunk-KFXXOFDC.js} +4 -4
  11. package/dist/{chunk-O2A6XHGD.js → chunk-LLDJS7PJ.js} +2 -2
  12. package/dist/{chunk-JOBQ6RUU.js → chunk-LQZESSM3.js} +28 -1
  13. package/dist/chunk-LQZESSM3.js.map +1 -0
  14. package/dist/{chunk-JRQO2IOF.js → chunk-MU54DZCC.js} +27 -1
  15. package/dist/chunk-MU54DZCC.js.map +1 -0
  16. package/dist/{chunk-INO47JXD.js → chunk-PBENHIN2.js} +3 -3
  17. package/dist/{chunk-CLWBNXKF.js → chunk-PLUJEQLU.js} +2 -2
  18. package/dist/{chunk-S7C6TIIF.js → chunk-S5G3HO7N.js} +3 -1
  19. package/dist/chunk-S5G3HO7N.js.map +1 -0
  20. package/dist/{chunk-6XP2Q5SS.js → chunk-WZOPWQN2.js} +2 -2
  21. package/dist/{chunk-TDEHU73T.js → chunk-YIVQ7KLS.js} +46 -5
  22. package/dist/chunk-YIVQ7KLS.js.map +1 -0
  23. package/dist/runtime/base-classes/index.js +17 -17
  24. package/dist/runtime/subsystems/auth/auth.module.js +1 -1
  25. package/dist/runtime/subsystems/auth/index.js +3 -3
  26. package/dist/runtime/subsystems/bridge/bridge.module.js +6 -6
  27. package/dist/runtime/subsystems/bridge/index.js +6 -6
  28. package/dist/runtime/subsystems/events/events.module.js +4 -4
  29. package/dist/runtime/subsystems/events/generated/bus.js +3 -3
  30. package/dist/runtime/subsystems/events/generated/index.d.ts +2 -2
  31. package/dist/runtime/subsystems/events/generated/index.js +9 -3
  32. package/dist/runtime/subsystems/events/generated/registry.d.ts +36 -0
  33. package/dist/runtime/subsystems/events/generated/registry.js +1 -1
  34. package/dist/runtime/subsystems/events/generated/schemas.d.ts +109 -1
  35. package/dist/runtime/subsystems/events/generated/schemas.js +7 -1
  36. package/dist/runtime/subsystems/events/generated/types.d.ts +48 -2
  37. package/dist/runtime/subsystems/events/index.js +4 -4
  38. package/dist/runtime/subsystems/index.d.ts +3 -2
  39. package/dist/runtime/subsystems/index.js +26 -22
  40. package/dist/runtime/subsystems/integration/execute-integration.use-case.d.ts +11 -1
  41. package/dist/runtime/subsystems/integration/execute-integration.use-case.js +2 -2
  42. package/dist/runtime/subsystems/integration/index.d.ts +2 -1
  43. package/dist/runtime/subsystems/integration/index.js +10 -8
  44. package/dist/runtime/subsystems/integration/integration-change-emitter.protocol.d.ts +106 -0
  45. package/dist/runtime/subsystems/integration/integration-change-emitter.protocol.js +1 -0
  46. package/dist/runtime/subsystems/integration/integration-change-emitter.protocol.js.map +1 -0
  47. package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js +2 -2
  48. package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js +2 -2
  49. package/dist/runtime/subsystems/integration/integration.module.js +4 -4
  50. package/dist/runtime/subsystems/integration/integration.tokens.d.ts +11 -1
  51. package/dist/runtime/subsystems/integration/integration.tokens.js +3 -1
  52. package/dist/runtime/subsystems/jobs/index.js +11 -11
  53. package/dist/runtime/subsystems/jobs/job-worker.module.js +5 -5
  54. package/dist/runtime/subsystems/jobs/jobs-domain.module.js +4 -4
  55. package/dist/runtime/subsystems/observability/index.js +3 -3
  56. package/dist/runtime/subsystems/observability/observability.module.js +3 -3
  57. package/dist/runtime/subsystems/observability/observability.service.js +2 -2
  58. package/dist/src/cli/index.js +203 -26
  59. package/dist/src/cli/index.js.map +1 -1
  60. package/dist/src/index.d.ts +13 -0
  61. package/dist/src/index.js +7 -7
  62. package/package.json +1 -1
  63. package/runtime/subsystems/events/generated/registry.ts +27 -0
  64. package/runtime/subsystems/events/generated/schemas.ts +26 -0
  65. package/runtime/subsystems/events/generated/types.ts +52 -0
  66. package/runtime/subsystems/index.ts +23 -0
  67. package/runtime/subsystems/integration/execute-integration.use-case.ts +69 -1
  68. package/runtime/subsystems/integration/index.ts +6 -0
  69. package/runtime/subsystems/integration/integration-change-emitter.protocol.ts +107 -0
  70. package/runtime/subsystems/integration/integration.tokens.ts +11 -0
  71. package/dist/chunk-4M66MQYA.js.map +0 -1
  72. package/dist/chunk-JOBQ6RUU.js.map +0 -1
  73. package/dist/chunk-JRQO2IOF.js.map +0 -1
  74. package/dist/chunk-S7C6TIIF.js.map +0 -1
  75. package/dist/chunk-TDEHU73T.js.map +0 -1
  76. /package/dist/{chunk-XKWOJZZ4.js.map → chunk-37PILMIT.js.map} +0 -0
  77. /package/dist/{chunk-42763UEE.js.map → chunk-6M6LZEP6.js.map} +0 -0
  78. /package/dist/{chunk-FIUC6QB5.js.map → chunk-CKLM57IE.js.map} +0 -0
  79. /package/dist/{chunk-SH76CFAY.js.map → chunk-ENAR3F5S.js.map} +0 -0
  80. /package/dist/{chunk-FFUDEIFF.js.map → chunk-HN5HT5WL.js.map} +0 -0
  81. /package/dist/{chunk-QFUIE37H.js.map → chunk-KFXXOFDC.js.map} +0 -0
  82. /package/dist/{chunk-O2A6XHGD.js.map → chunk-LLDJS7PJ.js.map} +0 -0
  83. /package/dist/{chunk-INO47JXD.js.map → chunk-PBENHIN2.js.map} +0 -0
  84. /package/dist/{chunk-CLWBNXKF.js.map → chunk-PLUJEQLU.js.map} +0 -0
  85. /package/dist/{chunk-6XP2Q5SS.js.map → chunk-WZOPWQN2.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,7 +2,29 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [Unreleased]
5
+ ## [0.24.0] — 2026-06-06
6
+
7
+ ### Added
8
+
9
+ - **Integration: opt-in post-upsert change-event emission seam.** An entity that
10
+ declares `integration.sink.emit_changes: true` now gets typed per-entity domain
11
+ events published automatically when integration sync upserts/soft-deletes rows.
12
+ Codegen (a) desugars the entity into `<entity>_created` / `<entity>_edited` /
13
+ `<entity>_deleted` events (merged into the generated events registry exactly
14
+ like a hand-authored `events/*.yaml` — TypedEventBus augmentation, the
15
+ `EventTypeName` union, payload schemas), and (b) emits a fully-`@generated`
16
+ `<entity>.change-emitter.ts` that the per-entity assembly module binds to the
17
+ new optional `INTEGRATION_CHANGE_EMITTER` token. `ExecuteIntegrationUseCase`
18
+ injects the emitter `@Optional()` and publishes after every real sink
19
+ write/soft-delete (never on a `noop` diff or a delete that hit no row). Payload:
20
+ `{ entityId, externalId, provider, changedFields?, source: 'integration' }` —
21
+ the `source` provenance marker lets a write-back action detect
22
+ integration-originated changes and break the inbound→writeback loop. The verb
23
+ is `_edited`, NOT `_updated` (swe-brain ADR-0009 B1). Entities that don't opt in
24
+ are byte-for-byte unchanged (the emitter token stays unbound). Generalizes the
25
+ emission swe-brain hand-built in its sinks. See `docs/specs/EMIT-CHANGES-1.md`.
26
+
27
+ ## [0.23.0] — 2026-06-06
6
28
 
7
29
  ### Fixed
8
30
 
@@ -114,9 +114,17 @@ export class AppModule {}
114
114
  those records. This is the most common "wait, what?" moment; document it in
115
115
  your runbooks. Retry semantics are caller-owned.
116
116
 
117
- 7. **The orchestrator does not emit events, schedule itself, retry, or resolve
118
- subscriptions.** Those are all consumer concerns. Wire event emission inside
119
- your sink's transaction; wire scheduling via a job or webhook handler.
117
+ 7. **Event emission is an opt-in seam; scheduling/retry/subscription-resolution
118
+ stay consumer concerns.** Declare `integration.sink.emit_changes: true` on an
119
+ entity and codegen generates `<entity>_created` / `<entity>_edited` /
120
+ `<entity>_deleted` typed events plus a `<entity>.change-emitter.ts` the
121
+ assembly binds to `INTEGRATION_CHANGE_EMITTER`; the orchestrator then publishes
122
+ after every real sink write/soft-delete (payload carries
123
+ `source: 'integration'` for loop-breaking). Omit the flag (the default) and the
124
+ orchestrator emits nothing — hand-roll emission in your sink if you need a
125
+ bespoke payload, or override the generated event via a top-level
126
+ `events/<entity>_created.yaml`. Scheduling is still a job/webhook concern;
127
+ retry semantics are still caller-owned. See `docs/specs/EMIT-CHANGES-1.md`.
120
128
 
121
129
  ## Do not
122
130
 
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  BridgeMetricsReporter
3
3
  } from "./chunk-AQFQ4BYM.js";
4
- import {
5
- ObservabilityService
6
- } from "./chunk-CLWBNXKF.js";
7
4
  import {
8
5
  OBSERVABILITY,
9
6
  OBSERVABILITY_MODULE_OPTIONS
10
7
  } from "./chunk-Y7RRSEOC.js";
8
+ import {
9
+ ObservabilityService
10
+ } from "./chunk-PLUJEQLU.js";
11
11
  import {
12
12
  __decorateClass
13
13
  } from "./chunk-2E224ZSN.js";
@@ -45,4 +45,4 @@ ObservabilityModule = __decorateClass([
45
45
  export {
46
46
  ObservabilityModule
47
47
  };
48
- //# sourceMappingURL=chunk-XKWOJZZ4.js.map
48
+ //# sourceMappingURL=chunk-37PILMIT.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TypedEventBus
3
- } from "./chunk-INO47JXD.js";
3
+ } from "./chunk-PBENHIN2.js";
4
4
  import {
5
5
  EventScheduler,
6
6
  scheduledEventsFromRegistry
@@ -200,4 +200,4 @@ export {
200
200
  EventSchedulerLifecycle,
201
201
  EventsModule
202
202
  };
203
- //# sourceMappingURL=chunk-42763UEE.js.map
203
+ //# sourceMappingURL=chunk-6M6LZEP6.js.map
@@ -1,6 +1,3 @@
1
- import {
2
- MemoryJobOrchestrator
3
- } from "./chunk-VQOAATIG.js";
4
1
  import {
5
2
  DrizzleJobRunService
6
3
  } from "./chunk-3VEVGL74.js";
@@ -10,12 +7,6 @@ import {
10
7
  import {
11
8
  DrizzleJobStepService
12
9
  } from "./chunk-DV4RV2DC.js";
13
- import {
14
- MemoryJobStepService
15
- } from "./chunk-PNZSGAB2.js";
16
- import {
17
- MemoryJobStore
18
- } from "./chunk-SNQ3TOWP.js";
19
10
  import {
20
11
  BULLMQ_CONNECTION,
21
12
  BULLMQ_RESOLVED_CONFIG,
@@ -24,6 +15,15 @@ import {
24
15
  import {
25
16
  DrizzleJobOrchestrator
26
17
  } from "./chunk-E6PLM6QG.js";
18
+ import {
19
+ MemoryJobOrchestrator
20
+ } from "./chunk-VQOAATIG.js";
21
+ import {
22
+ MemoryJobStepService
23
+ } from "./chunk-PNZSGAB2.js";
24
+ import {
25
+ MemoryJobStore
26
+ } from "./chunk-SNQ3TOWP.js";
27
27
  import {
28
28
  JOBS_LISTEN_NOTIFY,
29
29
  JOBS_MULTI_TENANT,
@@ -114,4 +114,4 @@ JobsDomainModule = __decorateClass([
114
114
  export {
115
115
  JobsDomainModule
116
116
  };
117
- //# sourceMappingURL=chunk-FIUC6QB5.js.map
117
+ //# sourceMappingURL=chunk-CKLM57IE.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7B7MMDOJ.js";
4
4
  import {
5
5
  JobsDomainModule
6
- } from "./chunk-FIUC6QB5.js";
6
+ } from "./chunk-CKLM57IE.js";
7
7
  import {
8
8
  BULLMQ_CONNECTION,
9
9
  BULLMQ_RESOLVED_CONFIG,
@@ -295,4 +295,4 @@ export {
295
295
  JobWorkerOrchestrator,
296
296
  JobWorkerModule
297
297
  };
298
- //# sourceMappingURL=chunk-SH76CFAY.js.map
298
+ //# sourceMappingURL=chunk-ENAR3F5S.js.map
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-SQDOBLBP.js";
9
9
  import {
10
10
  INTEGRATION_MULTI_TENANT
11
- } from "./chunk-S7C6TIIF.js";
11
+ } from "./chunk-S5G3HO7N.js";
12
12
  import {
13
13
  assertTenantId
14
14
  } from "./chunk-MZ6GV4YF.js";
@@ -127,4 +127,4 @@ DrizzleIntegrationRunRecorder = __decorateClass([
127
127
  export {
128
128
  DrizzleIntegrationRunRecorder
129
129
  };
130
- //# sourceMappingURL=chunk-FFUDEIFF.js.map
130
+ //# sourceMappingURL=chunk-HN5HT5WL.js.map
@@ -399,7 +399,9 @@ var ProviderIntegrationSchema = z.object({
399
399
  var SinkPolicySchema = z.object({
400
400
  delete: z.enum(["soft", "tombstone", "noop"]).optional(),
401
401
  // NO .default() — see default fence in spec §Goal
402
- exclude_fields: z.array(z.string()).optional()
402
+ exclude_fields: z.array(z.string()).optional(),
403
+ emit_changes: z.boolean().optional()
404
+ // NO .default() — absent ⇒ no emission
403
405
  }).strict();
404
406
  var IntegrationConfigSchema = z.object({
405
407
  electric: z.boolean().optional().default(false),
@@ -4347,4 +4349,4 @@ export {
4347
4349
  analyzeDomain,
4348
4350
  validateEntities
4349
4351
  };
4350
- //# sourceMappingURL=chunk-4M66MQYA.js.map
4352
+ //# sourceMappingURL=chunk-K4BQQ2NN.js.map