@pattern-stack/codegen 0.16.0 → 0.17.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 (112) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/consumer-skills/entities/families-and-queries.md +5 -3
  3. package/consumer-skills/integration/change-sources-and-sinks.md +1 -1
  4. package/dist/{chunk-3RWMQC3K.js → chunk-3MAZ4TQH.js} +12 -12
  5. package/dist/{chunk-VNBC3VXM.js → chunk-3VEVGL74.js} +4 -4
  6. package/dist/{chunk-WWGYCIJX.js → chunk-43SBT72G.js} +2 -2
  7. package/dist/{chunk-Y7GDG744.js → chunk-4GLNY5V6.js} +5 -5
  8. package/dist/{chunk-BK5ICA2F.js → chunk-4MVGAMUA.js} +4 -4
  9. package/dist/{chunk-3NMCDN7L.js → chunk-5TK7MEN4.js} +2 -2
  10. package/dist/chunk-5TK7MEN4.js.map +1 -0
  11. package/dist/{chunk-T6SCOJF4.js → chunk-7LKAMLV4.js} +4 -4
  12. package/dist/{chunk-BHZP6LOV.js → chunk-CDLWYZVQ.js} +7 -7
  13. package/dist/{chunk-DKKFTHHI.js → chunk-CZQUOIDY.js} +4 -4
  14. package/dist/{chunk-XWBK3XJK.js → chunk-DCCZB4UC.js} +4 -4
  15. package/dist/{chunk-EBKVKN75.js → chunk-DTXH24LR.js} +2 -2
  16. package/dist/{chunk-RUYLXR5F.js → chunk-GJDEPTPY.js} +10 -10
  17. package/dist/{chunk-32DOFN3T.js → chunk-IOQMMH6C.js} +17 -7
  18. package/dist/{chunk-32DOFN3T.js.map → chunk-IOQMMH6C.js.map} +1 -1
  19. package/dist/{chunk-BOPZWRJK.js → chunk-JYBFPNBJ.js} +8 -8
  20. package/dist/chunk-JYBFPNBJ.js.map +1 -0
  21. package/dist/{chunk-KSTZIULO.js → chunk-K2I6XIK5.js} +4 -4
  22. package/dist/{chunk-CEWLVVAH.js → chunk-L3VJ47BU.js} +5 -5
  23. package/dist/chunk-MKWQKKK7.js +72 -0
  24. package/dist/chunk-MKWQKKK7.js.map +1 -0
  25. package/dist/{chunk-DRCLNYH7.js → chunk-NXNVTXKG.js} +4 -4
  26. package/dist/{chunk-TDEHU73T.js → chunk-OGIZXGPY.js} +4 -4
  27. package/dist/{chunk-XDIIVIIK.js → chunk-OITTYGJS.js} +4 -4
  28. package/dist/{chunk-24WXSC3C.js → chunk-P3AYBRP6.js} +7 -7
  29. package/dist/{chunk-EJBK7I4F.js → chunk-RHYNACZS.js} +3 -3
  30. package/dist/{chunk-YK5JEVLX.js → chunk-SR7F3TJY.js} +4 -4
  31. package/dist/{chunk-YLPAPPLW.js → chunk-TIZXQU26.js} +36 -9
  32. package/dist/chunk-TIZXQU26.js.map +1 -0
  33. package/dist/{chunk-4PFF3ED4.js → chunk-UTNWFHJF.js} +4 -4
  34. package/dist/{chunk-LQ6PYFU6.js → chunk-Z7PQCAVK.js} +4 -4
  35. package/dist/runtime/base-classes/activity-entity-repository.d.ts +39 -7
  36. package/dist/runtime/base-classes/activity-entity-repository.js +1 -1
  37. package/dist/runtime/base-classes/activity-entity-service.d.ts +12 -10
  38. package/dist/runtime/base-classes/activity-entity-service.js +1 -1
  39. package/dist/runtime/base-classes/index.js +23 -23
  40. package/dist/runtime/shared/openapi/index.js +7 -7
  41. package/dist/runtime/shared/openapi/registry.js +2 -2
  42. package/dist/runtime/subsystems/analytics/analytics.module.js +2 -2
  43. package/dist/runtime/subsystems/analytics/index.js +4 -4
  44. package/dist/runtime/subsystems/auth/auth.module.js +3 -3
  45. package/dist/runtime/subsystems/auth/index.js +7 -7
  46. package/dist/runtime/subsystems/bridge/bridge-delivery-handler.js +2 -2
  47. package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js +2 -2
  48. package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js +4 -4
  49. package/dist/runtime/subsystems/bridge/bridge.module.js +15 -15
  50. package/dist/runtime/subsystems/bridge/index.js +17 -17
  51. package/dist/runtime/subsystems/cache/cache.module.js +1 -1
  52. package/dist/runtime/subsystems/cache/index.js +3 -3
  53. package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js +2 -2
  54. package/dist/runtime/subsystems/events/event-bus.memory-backend.js +2 -2
  55. package/dist/runtime/subsystems/events/events.module.js +4 -4
  56. package/dist/runtime/subsystems/events/index.js +4 -4
  57. package/dist/runtime/subsystems/index.js +107 -107
  58. package/dist/runtime/subsystems/integration/build-change-source.js +2 -2
  59. package/dist/runtime/subsystems/integration/detection-config.schema.d.ts +23 -15
  60. package/dist/runtime/subsystems/integration/detection-config.schema.js +1 -1
  61. package/dist/runtime/subsystems/integration/execute-integration.use-case.js +2 -2
  62. package/dist/runtime/subsystems/integration/index.js +43 -43
  63. package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js +2 -2
  64. package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js +2 -2
  65. package/dist/runtime/subsystems/integration/integration.module.js +5 -5
  66. package/dist/runtime/subsystems/integration/webhook-change-source.d.ts +36 -6
  67. package/dist/runtime/subsystems/integration/webhook-change-source.js +1 -1
  68. package/dist/runtime/subsystems/jobs/index.js +30 -30
  69. package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js +4 -4
  70. package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js +1 -1
  71. package/dist/runtime/subsystems/jobs/job-run-service.drizzle-backend.js +2 -2
  72. package/dist/runtime/subsystems/jobs/job-run-service.memory-backend.js +2 -2
  73. package/dist/runtime/subsystems/jobs/job-worker.js +2 -2
  74. package/dist/runtime/subsystems/jobs/job-worker.module.js +10 -10
  75. package/dist/runtime/subsystems/jobs/jobs-domain.module.js +8 -8
  76. package/dist/runtime/subsystems/storage/index.js +4 -4
  77. package/dist/runtime/subsystems/storage/storage.module.js +2 -2
  78. package/dist/src/cli/index.js +15 -15
  79. package/dist/src/index.d.ts +34 -19
  80. package/dist/src/index.js +14 -14
  81. package/package.json +2 -1
  82. package/runtime/base-classes/activity-entity-repository.ts +72 -13
  83. package/runtime/base-classes/activity-entity-service.ts +14 -12
  84. package/runtime/subsystems/integration/detection-config.schema.ts +64 -54
  85. package/runtime/subsystems/integration/webhook-change-source.ts +187 -133
  86. package/src/patterns/library/activity.pattern.ts +40 -10
  87. package/dist/chunk-3NMCDN7L.js.map +0 -1
  88. package/dist/chunk-BOPZWRJK.js.map +0 -1
  89. package/dist/chunk-XCEI7NUH.js +0 -41
  90. package/dist/chunk-XCEI7NUH.js.map +0 -1
  91. package/dist/chunk-YLPAPPLW.js.map +0 -1
  92. /package/dist/{chunk-3RWMQC3K.js.map → chunk-3MAZ4TQH.js.map} +0 -0
  93. /package/dist/{chunk-VNBC3VXM.js.map → chunk-3VEVGL74.js.map} +0 -0
  94. /package/dist/{chunk-WWGYCIJX.js.map → chunk-43SBT72G.js.map} +0 -0
  95. /package/dist/{chunk-Y7GDG744.js.map → chunk-4GLNY5V6.js.map} +0 -0
  96. /package/dist/{chunk-BK5ICA2F.js.map → chunk-4MVGAMUA.js.map} +0 -0
  97. /package/dist/{chunk-T6SCOJF4.js.map → chunk-7LKAMLV4.js.map} +0 -0
  98. /package/dist/{chunk-BHZP6LOV.js.map → chunk-CDLWYZVQ.js.map} +0 -0
  99. /package/dist/{chunk-DKKFTHHI.js.map → chunk-CZQUOIDY.js.map} +0 -0
  100. /package/dist/{chunk-XWBK3XJK.js.map → chunk-DCCZB4UC.js.map} +0 -0
  101. /package/dist/{chunk-EBKVKN75.js.map → chunk-DTXH24LR.js.map} +0 -0
  102. /package/dist/{chunk-RUYLXR5F.js.map → chunk-GJDEPTPY.js.map} +0 -0
  103. /package/dist/{chunk-KSTZIULO.js.map → chunk-K2I6XIK5.js.map} +0 -0
  104. /package/dist/{chunk-CEWLVVAH.js.map → chunk-L3VJ47BU.js.map} +0 -0
  105. /package/dist/{chunk-DRCLNYH7.js.map → chunk-NXNVTXKG.js.map} +0 -0
  106. /package/dist/{chunk-TDEHU73T.js.map → chunk-OGIZXGPY.js.map} +0 -0
  107. /package/dist/{chunk-XDIIVIIK.js.map → chunk-OITTYGJS.js.map} +0 -0
  108. /package/dist/{chunk-24WXSC3C.js.map → chunk-P3AYBRP6.js.map} +0 -0
  109. /package/dist/{chunk-EJBK7I4F.js.map → chunk-RHYNACZS.js.map} +0 -0
  110. /package/dist/{chunk-YK5JEVLX.js.map → chunk-SR7F3TJY.js.map} +0 -0
  111. /package/dist/{chunk-4PFF3ED4.js.map → chunk-UTNWFHJF.js.map} +0 -0
  112. /package/dist/{chunk-LQ6PYFU6.js.map → chunk-Z7PQCAVK.js.map} +0 -0
@@ -1,17 +1,3 @@
1
- import "../../chunk-ZUMULSEQ.js";
2
- import {
3
- StorageModule
4
- } from "../../chunk-BK5ICA2F.js";
5
- import {
6
- STORAGE
7
- } from "../../chunk-NYBCQZC7.js";
8
- import {
9
- LocalStorageBackend
10
- } from "../../chunk-JWNHNUYL.js";
11
- import {
12
- MemoryStorageBackend
13
- } from "../../chunk-3SZFUTXE.js";
14
- import "../../chunk-J6MN42LG.js";
15
1
  import "../../chunk-FI34KYZ5.js";
16
2
  import "../../chunk-L4SDDEEU.js";
17
3
  import {
@@ -26,71 +12,20 @@ import {
26
12
  OBSERVABILITY,
27
13
  OBSERVABILITY_MODULE_OPTIONS
28
14
  } from "../../chunk-Y7RRSEOC.js";
29
- import "../../chunk-W4HOHZVF.js";
30
- import "../../chunk-RUYLXR5F.js";
31
- import "../../chunk-XDIIVIIK.js";
32
- import "../../chunk-3RWMQC3K.js";
33
- import "../../chunk-DV4RV2DC.js";
34
- import "../../chunk-OTR44OH6.js";
35
- import "../../chunk-BULPAAD3.js";
36
- import "../../chunk-PNZSGAB2.js";
37
- import "../../chunk-VNBC3VXM.js";
38
- import "../../chunk-BHZP6LOV.js";
39
- import "../../chunk-SNQ3TOWP.js";
40
- import "../../chunk-T4BIIU5E.js";
41
- import "../../chunk-L3LZWWSX.js";
42
- import "../../chunk-I6MVCB5A.js";
43
- import "../../chunk-RHVN6NA7.js";
44
- import "../../chunk-ZPL74UQN.js";
45
- import "../../chunk-CO6LUM72.js";
46
- import {
47
- collisionModeEnum,
48
- jobRunStatusEnum,
49
- jobRuns,
50
- jobStepKindEnum,
51
- jobStepStatusEnum,
52
- jobSteps,
53
- jobs,
54
- parentClosePolicyEnum,
55
- replayFromEnum,
56
- triggerSourceEnum,
57
- waitKindEnum
58
- } from "../../chunk-OKXZ63IA.js";
59
- import "../../chunk-IWAOY6KC.js";
60
- import {
61
- CacheModule
62
- } from "../../chunk-COGHTKXY.js";
63
- import {
64
- DrizzleCacheService
65
- } from "../../chunk-T6C4LFLC.js";
66
- import {
67
- MemoryCacheService
68
- } from "../../chunk-IF5I3DAA.js";
69
- import "../../chunk-FASRXRX5.js";
70
- import {
71
- CACHE
72
- } from "../../chunk-L6FTY45T.js";
73
- import "../../chunk-FN2PYDPP.js";
15
+ import "../../chunk-ZUMULSEQ.js";
74
16
  import {
75
- EventsModule
76
- } from "../../chunk-EJBK7I4F.js";
77
- import "../../chunk-GM3RMJIJ.js";
78
- import "../../chunk-BGULBWKJ.js";
79
- import "../../chunk-JRQO2IOF.js";
80
- import "../../chunk-V4AF6DI4.js";
17
+ StorageModule
18
+ } from "../../chunk-4MVGAMUA.js";
81
19
  import {
82
- DrizzleEventBus
83
- } from "../../chunk-4PFF3ED4.js";
84
- import "../../chunk-MYQIQ27N.js";
85
- import "../../chunk-4LH67P4U.js";
86
- import "../../chunk-OFRRBC7M.js";
20
+ LocalStorageBackend
21
+ } from "../../chunk-JWNHNUYL.js";
87
22
  import {
88
- MemoryEventBus
89
- } from "../../chunk-LQ6PYFU6.js";
23
+ MemoryStorageBackend
24
+ } from "../../chunk-3SZFUTXE.js";
25
+ import "../../chunk-J6MN42LG.js";
90
26
  import {
91
- EVENT_BUS
92
- } from "../../chunk-H5NH7KPE.js";
93
- import "../../chunk-UQ5EHOH2.js";
27
+ STORAGE
28
+ } from "../../chunk-NYBCQZC7.js";
94
29
  import "../../chunk-7C3FOSDI.js";
95
30
  import {
96
31
  OAuth2RefreshStrategy
@@ -106,15 +41,27 @@ import {
106
41
  isSessionExpiredError
107
42
  } from "../../chunk-7RELQJIN.js";
108
43
  import "../../chunk-OSQRXVG2.js";
44
+ import "../../chunk-W4HOHZVF.js";
45
+ import "../../chunk-GJDEPTPY.js";
46
+ import "../../chunk-OITTYGJS.js";
47
+ import "../../chunk-3MAZ4TQH.js";
48
+ import "../../chunk-BULPAAD3.js";
49
+ import "../../chunk-3VEVGL74.js";
50
+ import "../../chunk-CDLWYZVQ.js";
51
+ import "../../chunk-L3LZWWSX.js";
52
+ import "../../chunk-DV4RV2DC.js";
53
+ import "../../chunk-PNZSGAB2.js";
54
+ import "../../chunk-SNQ3TOWP.js";
55
+ import "../../chunk-I6MVCB5A.js";
56
+ import "../../chunk-RHVN6NA7.js";
57
+ import "../../chunk-OTR44OH6.js";
58
+ import "../../chunk-T4BIIU5E.js";
109
59
  import {
110
60
  AuthModule
111
- } from "../../chunk-T6SCOJF4.js";
61
+ } from "../../chunk-7LKAMLV4.js";
112
62
  import {
113
63
  EnvEncryptionKey
114
64
  } from "../../chunk-IP4OO26U.js";
115
- import {
116
- AuthController
117
- } from "../../chunk-SZVPIHWE.js";
118
65
  import {
119
66
  DrizzleOAuthStateStore
120
67
  } from "../../chunk-N5OTOWTP.js";
@@ -125,8 +72,8 @@ import {
125
72
  OAuthStateError
126
73
  } from "../../chunk-BPARRK6F.js";
127
74
  import {
128
- authOAuthState
129
- } from "../../chunk-NPFPZ2HO.js";
75
+ AuthController
76
+ } from "../../chunk-SZVPIHWE.js";
130
77
  import {
131
78
  AUTH_CONNECTION_GRANT_SINK,
132
79
  AUTH_CONNECTION_READER,
@@ -137,52 +84,105 @@ import {
137
84
  OAUTH_STATE_STORE,
138
85
  STRATEGY_REGISTRY
139
86
  } from "../../chunk-6XY6ZMMD.js";
87
+ import {
88
+ authOAuthState
89
+ } from "../../chunk-NPFPZ2HO.js";
90
+ import "../../chunk-FN2PYDPP.js";
91
+ import "../../chunk-CO6LUM72.js";
92
+ import "../../chunk-ZPL74UQN.js";
93
+ import {
94
+ collisionModeEnum,
95
+ jobRunStatusEnum,
96
+ jobRuns,
97
+ jobStepKindEnum,
98
+ jobStepStatusEnum,
99
+ jobSteps,
100
+ jobs,
101
+ parentClosePolicyEnum,
102
+ replayFromEnum,
103
+ triggerSourceEnum,
104
+ waitKindEnum
105
+ } from "../../chunk-OKXZ63IA.js";
106
+ import {
107
+ EventsModule
108
+ } from "../../chunk-RHYNACZS.js";
109
+ import "../../chunk-GM3RMJIJ.js";
110
+ import "../../chunk-BGULBWKJ.js";
111
+ import "../../chunk-JRQO2IOF.js";
112
+ import "../../chunk-V4AF6DI4.js";
113
+ import "../../chunk-IWAOY6KC.js";
114
+ import {
115
+ CacheModule
116
+ } from "../../chunk-COGHTKXY.js";
117
+ import {
118
+ DrizzleEventBus
119
+ } from "../../chunk-UTNWFHJF.js";
120
+ import "../../chunk-MYQIQ27N.js";
121
+ import "../../chunk-4LH67P4U.js";
122
+ import "../../chunk-OFRRBC7M.js";
123
+ import {
124
+ MemoryEventBus
125
+ } from "../../chunk-Z7PQCAVK.js";
126
+ import "../../chunk-UQ5EHOH2.js";
127
+ import {
128
+ EVENT_BUS
129
+ } from "../../chunk-H5NH7KPE.js";
130
+ import {
131
+ DrizzleCacheService
132
+ } from "../../chunk-T6C4LFLC.js";
133
+ import "../../chunk-FASRXRX5.js";
134
+ import {
135
+ MemoryCacheService
136
+ } from "../../chunk-IF5I3DAA.js";
137
+ import {
138
+ CACHE
139
+ } from "../../chunk-L6FTY45T.js";
140
140
  import "../../chunk-GYGNEQSC.js";
141
+ import "../../chunk-ZUKFQL6E.js";
141
142
  import "../../chunk-KVOWSC5S.js";
142
- import "../../chunk-24WXSC3C.js";
143
- import "../../chunk-EO2QPOKH.js";
143
+ import "../../chunk-P3AYBRP6.js";
144
144
  import "../../chunk-PRWIX6UW.js";
145
- import "../../chunk-XWBK3XJK.js";
146
- import "../../chunk-AHV4GDYM.js";
147
- import "../../chunk-YK5JEVLX.js";
145
+ import "../../chunk-SR7F3TJY.js";
146
+ import "../../chunk-EO2QPOKH.js";
148
147
  import "../../chunk-SQDOBLBP.js";
149
- import {
150
- CURSOR_DIVISIBILITY,
151
- DetectionConfigSchema,
152
- isDivisibleCursor
153
- } from "../../chunk-3NMCDN7L.js";
154
- import {
155
- MemoryEntityChangeSourceRegistry
156
- } from "../../chunk-4KNXX6TI.js";
157
- import {
158
- UnknownEntityError
159
- } from "../../chunk-3CJFPU6Q.js";
160
148
  import {
161
149
  ExecuteIntegrationUseCase
162
- } from "../../chunk-TDEHU73T.js";
163
- import {
164
- ENTITY_CHANGE_SOURCE_REGISTRY,
165
- INTEGRATION_CHANGE_SOURCE,
166
- INTEGRATION_SINK
167
- } from "../../chunk-S7C6TIIF.js";
168
- import "../../chunk-MZ6GV4YF.js";
150
+ } from "../../chunk-OGIZXGPY.js";
169
151
  import {
170
152
  IncrementalReadBase,
171
153
  mapConcurrent
172
154
  } from "../../chunk-LG57S2SC.js";
155
+ import "../../chunk-DCCZB4UC.js";
156
+ import "../../chunk-MZ6GV4YF.js";
173
157
  import "../../chunk-HNWZFNKP.js";
158
+ import "../../chunk-AHV4GDYM.js";
174
159
  import {
175
160
  buildChangeSource
176
- } from "../../chunk-WWGYCIJX.js";
161
+ } from "../../chunk-43SBT72G.js";
177
162
  import {
178
163
  PollChangeSource
179
164
  } from "../../chunk-4MF3HKJA.js";
180
165
  import {
181
166
  WebhookChangeSource
182
- } from "../../chunk-YLPAPPLW.js";
167
+ } from "../../chunk-TIZXQU26.js";
183
168
  import "../../chunk-36U5UGIO.js";
169
+ import {
170
+ CURSOR_DIVISIBILITY,
171
+ DetectionConfigSchema,
172
+ isDivisibleCursor
173
+ } from "../../chunk-5TK7MEN4.js";
174
+ import {
175
+ MemoryEntityChangeSourceRegistry
176
+ } from "../../chunk-4KNXX6TI.js";
177
+ import {
178
+ UnknownEntityError
179
+ } from "../../chunk-3CJFPU6Q.js";
180
+ import {
181
+ ENTITY_CHANGE_SOURCE_REGISTRY,
182
+ INTEGRATION_CHANGE_SOURCE,
183
+ INTEGRATION_SINK
184
+ } from "../../chunk-S7C6TIIF.js";
184
185
  import "../../chunk-U64T4YZE.js";
185
- import "../../chunk-ZUKFQL6E.js";
186
186
  import "../../chunk-2E224ZSN.js";
187
187
  export {
188
188
  AUTH_CONNECTION_GRANT_SINK,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  buildChangeSource
3
- } from "../../../chunk-WWGYCIJX.js";
3
+ } from "../../../chunk-43SBT72G.js";
4
4
  import "../../../chunk-4MF3HKJA.js";
5
- import "../../../chunk-YLPAPPLW.js";
5
+ import "../../../chunk-TIZXQU26.js";
6
6
  import "../../../chunk-2E224ZSN.js";
7
7
  export {
8
8
  buildChangeSource
@@ -24,8 +24,10 @@ import { z } from 'zod';
24
24
  * primitive while emitting `Change<T>.source = 'cdc'`. Long-lived
25
25
  * streaming CDC (SFDC Pub-Sub, Debezium) is a separate primitive
26
26
  * deferred to #226-8.
27
- * - `webhook` mode requires `eventIdField` so `WebhookChangeSource<T>`
28
- * can populate `Change<T>.dedupKey` from the inbound staging row.
27
+ * - `webhook` mode's `eventIdField` is optional: `WebhookChangeSource<T>`
28
+ * prefers an `eventId` yielded by the queue iterator and falls back to the
29
+ * `eventIdField` record extraction (precedence: yielded eventId >
30
+ * eventIdField extraction > undefined dedupKey).
29
31
  */
30
32
 
31
33
  /**
@@ -138,9 +140,9 @@ type CursorStrategy = z.infer<typeof CursorStrategySchema>;
138
140
  * `eventId` is classified atomic conservatively: a generic opaque id is treated
139
141
  * all-or-nothing unless a concrete strategy proves it monotonically resumable.
140
142
  */
141
- declare const CURSOR_DIVISIBILITY: Readonly<Record<CursorStrategy['kind'], boolean>>;
143
+ declare const CURSOR_DIVISIBILITY: Readonly<Record<CursorStrategy["kind"], boolean>>;
142
144
  /** Predicate form of {@link CURSOR_DIVISIBILITY}. */
143
- declare function isDivisibleCursor(kind: CursorStrategy['kind']): boolean;
145
+ declare function isDivisibleCursor(kind: CursorStrategy["kind"]): boolean;
144
146
  /**
145
147
  * Poll-mode block. `provenance: 'cdc'` opts the poll primitive into stamping
146
148
  * `Change<T>.source = 'cdc'` and populating `dedupKey` from the cursor's
@@ -248,16 +250,22 @@ declare const PollDetectionSchema: z.ZodObject<{
248
250
  }>;
249
251
  type PollDetection = z.infer<typeof PollDetectionSchema>;
250
252
  /**
251
- * Webhook-mode block. `eventIdField` names the column in the consumer-owned
252
- * inbound staging row that `WebhookChangeSource<T>` reads to set
253
- * `Change<T>.dedupKey`.
253
+ * Webhook-mode block. `eventIdField`, when present, names the field on the
254
+ * emitted canonical record that `WebhookChangeSource<T>` reads to set
255
+ * `Change<T>.dedupKey` — used only as the fallback when the queue iterator
256
+ * does NOT yield an `eventId` alongside the record.
257
+ *
258
+ * `eventIdField` is **optional**: a queue iterator that always yields an
259
+ * `eventId` (vendor delivery metadata, the preferred channel) need not declare
260
+ * a record field for it. dedupKey precedence is: yielded `eventId` >
261
+ * `eventIdField` record extraction > undefined.
254
262
  */
255
263
  declare const WebhookDetectionSchema: z.ZodObject<{
256
- eventIdField: z.ZodString;
264
+ eventIdField: z.ZodOptional<z.ZodString>;
257
265
  }, "strip", z.ZodTypeAny, {
258
- eventIdField: string;
266
+ eventIdField?: string | undefined;
259
267
  }, {
260
- eventIdField: string;
268
+ eventIdField?: string | undefined;
261
269
  }>;
262
270
  type WebhookDetection = z.infer<typeof WebhookDetectionSchema>;
263
271
  /**
@@ -466,11 +474,11 @@ declare const DetectionConfigSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodObjec
466
474
  }>, z.ZodObject<{
467
475
  mode: z.ZodLiteral<"webhook">;
468
476
  webhook: z.ZodObject<{
469
- eventIdField: z.ZodString;
477
+ eventIdField: z.ZodOptional<z.ZodString>;
470
478
  }, "strip", z.ZodTypeAny, {
471
- eventIdField: string;
479
+ eventIdField?: string | undefined;
472
480
  }, {
473
- eventIdField: string;
481
+ eventIdField?: string | undefined;
474
482
  }>;
475
483
  mapping: z.ZodArray<z.ZodObject<{
476
484
  source: z.ZodString;
@@ -500,7 +508,7 @@ declare const DetectionConfigSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodObjec
500
508
  }>, "many">>;
501
509
  }, "strip", z.ZodTypeAny, {
502
510
  webhook: {
503
- eventIdField: string;
511
+ eventIdField?: string | undefined;
504
512
  };
505
513
  mode: "webhook";
506
514
  mapping: {
@@ -515,7 +523,7 @@ declare const DetectionConfigSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodObjec
515
523
  }[];
516
524
  }, {
517
525
  webhook: {
518
- eventIdField: string;
526
+ eventIdField?: string | undefined;
519
527
  };
520
528
  mode: "webhook";
521
529
  mapping: {
@@ -7,7 +7,7 @@ import {
7
7
  ResolvedFilterSchema,
8
8
  WebhookDetectionSchema,
9
9
  isDivisibleCursor
10
- } from "../../../chunk-3NMCDN7L.js";
10
+ } from "../../../chunk-5TK7MEN4.js";
11
11
  import "../../../chunk-2E224ZSN.js";
12
12
  export {
13
13
  CURSOR_DIVISIBILITY,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ExecuteIntegrationUseCase
3
- } from "../../../chunk-TDEHU73T.js";
4
- import "../../../chunk-S7C6TIIF.js";
3
+ } from "../../../chunk-OGIZXGPY.js";
5
4
  import "../../../chunk-MZ6GV4YF.js";
5
+ import "../../../chunk-S7C6TIIF.js";
6
6
  import "../../../chunk-2E224ZSN.js";
7
7
  export {
8
8
  ExecuteIntegrationUseCase
@@ -1,63 +1,34 @@
1
1
  import "../../../chunk-KVOWSC5S.js";
2
2
  import {
3
3
  IntegrationModule
4
- } from "../../../chunk-24WXSC3C.js";
5
- import {
6
- MemoryRunRecorder
7
- } from "../../../chunk-EO2QPOKH.js";
4
+ } from "../../../chunk-P3AYBRP6.js";
8
5
  import {
9
6
  createLoopbackMiddleware
10
7
  } from "../../../chunk-PRWIX6UW.js";
11
- import {
12
- PostgresCursorStore
13
- } from "../../../chunk-XWBK3XJK.js";
14
- import {
15
- MemoryCursorStore
16
- } from "../../../chunk-AHV4GDYM.js";
17
8
  import {
18
9
  DrizzleIntegrationRunRecorder
19
- } from "../../../chunk-YK5JEVLX.js";
10
+ } from "../../../chunk-SR7F3TJY.js";
11
+ import {
12
+ MemoryRunRecorder
13
+ } from "../../../chunk-EO2QPOKH.js";
20
14
  import {
21
15
  FieldDiffSchema,
22
16
  FieldDiffValueSchema
23
17
  } from "../../../chunk-SQDOBLBP.js";
24
- import {
25
- CURSOR_DIVISIBILITY,
26
- CursorStrategySchema,
27
- DetectionConfigSchema,
28
- FieldMappingSchema,
29
- PollDetectionSchema,
30
- ResolvedFilterSchema,
31
- WebhookDetectionSchema,
32
- isDivisibleCursor
33
- } from "../../../chunk-3NMCDN7L.js";
34
- import {
35
- MemoryEntityChangeSourceRegistry
36
- } from "../../../chunk-4KNXX6TI.js";
37
- import {
38
- UnknownEntityError
39
- } from "../../../chunk-3CJFPU6Q.js";
40
18
  import {
41
19
  ExecuteIntegrationUseCase
42
- } from "../../../chunk-TDEHU73T.js";
20
+ } from "../../../chunk-OGIZXGPY.js";
43
21
  import {
44
- ENTITY_CHANGE_SOURCE_REGISTRY,
45
- INTEGRATION_CHANGE_SOURCE,
46
- INTEGRATION_CURSOR_STORE,
47
- INTEGRATION_FIELD_DIFFER,
48
- INTEGRATION_MODULE_OPTIONS,
49
- INTEGRATION_MULTI_TENANT,
50
- INTEGRATION_RUN_RECORDER,
51
- INTEGRATION_SINK
52
- } from "../../../chunk-S7C6TIIF.js";
22
+ IncrementalReadBase,
23
+ mapConcurrent
24
+ } from "../../../chunk-LG57S2SC.js";
25
+ import {
26
+ PostgresCursorStore
27
+ } from "../../../chunk-DCCZB4UC.js";
53
28
  import {
54
29
  MissingTenantIdError,
55
30
  assertTenantId
56
31
  } from "../../../chunk-MZ6GV4YF.js";
57
- import {
58
- IncrementalReadBase,
59
- mapConcurrent
60
- } from "../../../chunk-LG57S2SC.js";
61
32
  import {
62
33
  integrationRunActionEnum,
63
34
  integrationRunDirectionEnum,
@@ -68,18 +39,47 @@ import {
68
39
  integrationRuns,
69
40
  integrationSubscriptions
70
41
  } from "../../../chunk-HNWZFNKP.js";
42
+ import {
43
+ MemoryCursorStore
44
+ } from "../../../chunk-AHV4GDYM.js";
71
45
  import {
72
46
  buildChangeSource
73
- } from "../../../chunk-WWGYCIJX.js";
47
+ } from "../../../chunk-43SBT72G.js";
74
48
  import {
75
49
  PollChangeSource
76
50
  } from "../../../chunk-4MF3HKJA.js";
77
51
  import {
78
52
  WebhookChangeSource
79
- } from "../../../chunk-YLPAPPLW.js";
53
+ } from "../../../chunk-TIZXQU26.js";
80
54
  import {
81
55
  DeepEqualDiffer
82
56
  } from "../../../chunk-36U5UGIO.js";
57
+ import {
58
+ CURSOR_DIVISIBILITY,
59
+ CursorStrategySchema,
60
+ DetectionConfigSchema,
61
+ FieldMappingSchema,
62
+ PollDetectionSchema,
63
+ ResolvedFilterSchema,
64
+ WebhookDetectionSchema,
65
+ isDivisibleCursor
66
+ } from "../../../chunk-5TK7MEN4.js";
67
+ import {
68
+ MemoryEntityChangeSourceRegistry
69
+ } from "../../../chunk-4KNXX6TI.js";
70
+ import {
71
+ UnknownEntityError
72
+ } from "../../../chunk-3CJFPU6Q.js";
73
+ import {
74
+ ENTITY_CHANGE_SOURCE_REGISTRY,
75
+ INTEGRATION_CHANGE_SOURCE,
76
+ INTEGRATION_CURSOR_STORE,
77
+ INTEGRATION_FIELD_DIFFER,
78
+ INTEGRATION_MODULE_OPTIONS,
79
+ INTEGRATION_MULTI_TENANT,
80
+ INTEGRATION_RUN_RECORDER,
81
+ INTEGRATION_SINK
82
+ } from "../../../chunk-S7C6TIIF.js";
83
83
  import "../../../chunk-U64T4YZE.js";
84
84
  import "../../../chunk-2E224ZSN.js";
85
85
  export {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  PostgresCursorStore
3
- } from "../../../chunk-XWBK3XJK.js";
4
- import "../../../chunk-S7C6TIIF.js";
3
+ } from "../../../chunk-DCCZB4UC.js";
5
4
  import "../../../chunk-MZ6GV4YF.js";
6
5
  import "../../../chunk-HNWZFNKP.js";
6
+ import "../../../chunk-S7C6TIIF.js";
7
7
  import "../../../chunk-U64T4YZE.js";
8
8
  import "../../../chunk-2E224ZSN.js";
9
9
  export {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DrizzleIntegrationRunRecorder
3
- } from "../../../chunk-YK5JEVLX.js";
3
+ } from "../../../chunk-SR7F3TJY.js";
4
4
  import "../../../chunk-SQDOBLBP.js";
5
- import "../../../chunk-S7C6TIIF.js";
6
5
  import "../../../chunk-MZ6GV4YF.js";
7
6
  import "../../../chunk-HNWZFNKP.js";
7
+ import "../../../chunk-S7C6TIIF.js";
8
8
  import "../../../chunk-U64T4YZE.js";
9
9
  import "../../../chunk-2E224ZSN.js";
10
10
  export {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  IntegrationModule
3
- } from "../../../chunk-24WXSC3C.js";
3
+ } from "../../../chunk-P3AYBRP6.js";
4
+ import "../../../chunk-SR7F3TJY.js";
4
5
  import "../../../chunk-EO2QPOKH.js";
5
- import "../../../chunk-XWBK3XJK.js";
6
- import "../../../chunk-AHV4GDYM.js";
7
- import "../../../chunk-YK5JEVLX.js";
8
6
  import "../../../chunk-SQDOBLBP.js";
9
- import "../../../chunk-S7C6TIIF.js";
7
+ import "../../../chunk-DCCZB4UC.js";
10
8
  import "../../../chunk-MZ6GV4YF.js";
11
9
  import "../../../chunk-HNWZFNKP.js";
10
+ import "../../../chunk-AHV4GDYM.js";
12
11
  import "../../../chunk-36U5UGIO.js";
12
+ import "../../../chunk-S7C6TIIF.js";
13
13
  import "../../../chunk-U64T4YZE.js";
14
14
  import "../../../chunk-2E224ZSN.js";
15
15
  export {
@@ -12,8 +12,11 @@ import 'zod';
12
12
  * queue. The primitive owns:
13
13
  *
14
14
  * - canonical `Change<T>.source = 'webhook'` stamping;
15
- * - `dedupKey` derivation from the configured `webhook.eventIdField` on
16
- * the emitted record;
15
+ * - `dedupKey` derivation, preferring the `eventId` yielded alongside the
16
+ * record by the queue iterator, and falling back to the configured
17
+ * `webhook.eventIdField` on the emitted record when no `eventId` is yielded
18
+ * (precedence: yielded `eventId` > `eventIdField` record extraction >
19
+ * undefined `dedupKey`);
17
20
  * - `externalId` derivation: the mapping entry whose `target === 'external_id'`
18
21
  * names — via its `source` — the field on the emitted record that carries
19
22
  * the canonical external id (mirrors `PollChangeSource`);
@@ -60,10 +63,22 @@ interface WebhookFetchContext {
60
63
  }
61
64
  /**
62
65
  * Consumer-supplied queue iterator. Returns an async iterable of
63
- * `{ record }` pairs — the consumer drains the inbound staging queue and
64
- * emits already-mapped canonical records `T`. The primitive stamps
65
- * `source: 'webhook'` and `dedupKey` from the record's configured
66
- * `webhook.eventIdField`; the consumer is the one who decided when a
66
+ * `{ record, eventId?, cursor? }` tuples — the consumer drains the inbound
67
+ * staging queue and emits already-mapped canonical records `T`. The primitive
68
+ * stamps `source: 'webhook'` and derives `dedupKey` with this precedence:
69
+ *
70
+ * 1. the yielded `eventId` (vendor delivery metadata — the queue is the
71
+ * right channel for it: a vendor's event id should never need a field
72
+ * on the vendor-neutral canonical record);
73
+ * 2. else the record field named by `webhook.eventIdField`, when configured;
74
+ * 3. else `undefined`.
75
+ *
76
+ * Yielding `eventId` is the safe channel when one canonical record identity
77
+ * (the `external_id`) can recur across distinct vendor events in a single
78
+ * drain batch — e.g. a message create and its later edit share an
79
+ * `external_id` but are different events. Reading dedup identity off the
80
+ * record (`eventIdField`) collapses those into one `dedupKey`; the yielded
81
+ * `eventId` keeps them distinct. The consumer is the one who decided when a
67
82
  * staging row is "ready" to drain.
68
83
  *
69
84
  * Webhook mode has no per-record cursor advance — the staging-row drain
@@ -73,6 +88,7 @@ interface WebhookFetchContext {
73
88
  */
74
89
  type WebhookFetchCallback<T> = (ctx: WebhookFetchContext) => AsyncIterable<{
75
90
  record: T;
91
+ eventId?: string;
76
92
  cursor?: WebhookCursor;
77
93
  }>;
78
94
  interface WebhookChangeSourceOptions<T> {
@@ -100,11 +116,25 @@ declare class WebhookChangeSource<T> implements IChangeSource<T> {
100
116
  readonly label: string;
101
117
  private readonly queue;
102
118
  private readonly externalIdSourceField;
119
+ /**
120
+ * Record field carrying the event id, when `webhook.eventIdField` is
121
+ * configured. Used only as the fallback when the queue iterator does NOT
122
+ * yield an `eventId` — see {@link WebhookFetchCallback} for the precedence.
123
+ */
103
124
  private readonly eventIdSourceField;
104
125
  private readonly composed;
105
126
  constructor(opts: WebhookChangeSourceOptions<T>);
106
127
  listChanges(subscription: IntegrationSubscriptionView, cursor: unknown | null): AsyncIterable<Change<T>>;
107
128
  private fetch;
129
+ /**
130
+ * Resolve `Change<T>.dedupKey` with the precedence: yielded `eventId` >
131
+ * `webhook.eventIdField` record extraction > `undefined`. A non-empty
132
+ * yielded `eventId` always wins; otherwise the configured field is read off
133
+ * the record (and must be a non-empty string when the field is configured);
134
+ * with neither, `dedupKey` is `undefined` (the orchestrator then has no
135
+ * delivery-level dedup signal for this change).
136
+ */
137
+ private deriveDedupKey;
108
138
  }
109
139
 
110
140
  export { WebhookChangeSource, type WebhookChangeSourceOptions, type WebhookCursor, type WebhookFetchCallback, type WebhookFetchContext };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  WebhookChangeSource
3
- } from "../../../chunk-YLPAPPLW.js";
3
+ } from "../../../chunk-TIZXQU26.js";
4
4
  import "../../../chunk-2E224ZSN.js";
5
5
  export {
6
6
  WebhookChangeSource