@pattern-stack/codegen 0.10.1 → 0.12.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 (279) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/README.md +5 -5
  3. package/consumer-skills/codegen/SKILL.md +2 -2
  4. package/consumer-skills/{sync → integration}/SKILL.md +29 -29
  5. package/consumer-skills/{sync → integration}/audit-and-detection.md +22 -22
  6. package/consumer-skills/{sync → integration}/change-sources-and-sinks.md +60 -60
  7. package/consumer-skills/subsystems/SKILL.md +8 -8
  8. package/consumer-skills/subsystems/wiring-and-order.md +7 -7
  9. package/dist/runtime/base-classes/index.d.ts +4 -4
  10. package/dist/runtime/base-classes/index.js +35 -35
  11. package/dist/runtime/base-classes/index.js.map +1 -1
  12. package/dist/runtime/base-classes/{synced-entity-repository.d.ts → integrated-entity-repository.d.ts} +15 -15
  13. package/dist/runtime/base-classes/{synced-entity-repository.js → integrated-entity-repository.js} +21 -21
  14. package/dist/runtime/base-classes/integrated-entity-repository.js.map +1 -0
  15. package/dist/runtime/base-classes/{synced-entity-service.d.ts → integrated-entity-service.d.ts} +6 -6
  16. package/dist/runtime/base-classes/{synced-entity-service.js → integrated-entity-service.js} +4 -4
  17. package/dist/runtime/base-classes/integrated-entity-service.js.map +1 -0
  18. package/dist/runtime/base-classes/{sync-upsert-config.d.ts → integration-upsert-config.d.ts} +13 -13
  19. package/dist/runtime/base-classes/integration-upsert-config.js +1 -0
  20. package/dist/runtime/base-classes/{junction-sync-repository.d.ts → junction-integration-repository.d.ts} +11 -11
  21. package/dist/runtime/base-classes/{junction-sync-repository.js → junction-integration-repository.js} +15 -15
  22. package/dist/runtime/base-classes/junction-integration-repository.js.map +1 -0
  23. package/dist/runtime/subsystems/auth/auth-oauth-state.schema.js.map +1 -1
  24. package/dist/runtime/subsystems/auth/auth.module.d.ts +4 -4
  25. package/dist/runtime/subsystems/auth/auth.module.js +3 -3
  26. package/dist/runtime/subsystems/auth/auth.module.js.map +1 -1
  27. package/dist/runtime/subsystems/auth/auth.tokens.d.ts +8 -8
  28. package/dist/runtime/subsystems/auth/auth.tokens.js +6 -6
  29. package/dist/runtime/subsystems/auth/auth.tokens.js.map +1 -1
  30. package/dist/runtime/subsystems/auth/backends/state-store.drizzle-backend.js.map +1 -1
  31. package/dist/runtime/subsystems/auth/controllers/auth.controller.d.ts +2 -2
  32. package/dist/runtime/subsystems/auth/controllers/auth.controller.js +3 -3
  33. package/dist/runtime/subsystems/auth/controllers/auth.controller.js.map +1 -1
  34. package/dist/runtime/subsystems/auth/index.d.ts +3 -3
  35. package/dist/runtime/subsystems/auth/index.js +40 -40
  36. package/dist/runtime/subsystems/auth/index.js.map +1 -1
  37. package/dist/runtime/subsystems/auth/middleware/requester-context.js.map +1 -1
  38. package/dist/runtime/subsystems/auth/protocols/auth-strategy.d.ts +3 -3
  39. package/dist/runtime/subsystems/auth/protocols/{integration-store.d.ts → connection-store.d.ts} +20 -20
  40. package/dist/runtime/subsystems/auth/protocols/connection-store.js +1 -0
  41. package/dist/runtime/subsystems/auth/protocols/provider-strategy.d.ts +3 -3
  42. package/dist/runtime/subsystems/auth/runtime/{integration-broken.error.d.ts → connection-broken.error.d.ts} +5 -5
  43. package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js +19 -0
  44. package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js.map +1 -0
  45. package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.d.ts +10 -10
  46. package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js +28 -28
  47. package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js.map +1 -1
  48. package/dist/runtime/subsystems/auth/runtime/with-auth-retry.d.ts +1 -1
  49. package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js +3 -3
  50. package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js.map +1 -1
  51. package/dist/runtime/subsystems/index.d.ts +11 -7
  52. package/dist/runtime/subsystems/index.js +1041 -67
  53. package/dist/runtime/subsystems/index.js.map +1 -1
  54. package/dist/runtime/subsystems/{sync → integration}/build-change-source.d.ts +3 -3
  55. package/dist/runtime/subsystems/{sync → integration}/build-change-source.js +3 -3
  56. package/dist/runtime/subsystems/integration/build-change-source.js.map +1 -0
  57. package/dist/runtime/subsystems/{sync → integration}/deep-equal.differ.d.ts +2 -2
  58. package/dist/runtime/subsystems/{sync → integration}/deep-equal.differ.js +1 -1
  59. package/dist/runtime/subsystems/integration/deep-equal.differ.js.map +1 -0
  60. package/dist/runtime/subsystems/{sync → integration}/detection-config.schema.d.ts +3 -3
  61. package/dist/runtime/subsystems/{sync → integration}/detection-config.schema.js +1 -1
  62. package/dist/runtime/subsystems/integration/detection-config.schema.js.map +1 -0
  63. package/dist/runtime/subsystems/integration/entity-change-source-registry.memory.d.ts +25 -0
  64. package/dist/runtime/subsystems/integration/entity-change-source-registry.memory.js +34 -0
  65. package/dist/runtime/subsystems/integration/entity-change-source-registry.memory.js.map +1 -0
  66. package/dist/runtime/subsystems/integration/entity-change-source-registry.protocol.d.ts +53 -0
  67. package/dist/runtime/subsystems/integration/entity-change-source-registry.protocol.js +13 -0
  68. package/dist/runtime/subsystems/integration/entity-change-source-registry.protocol.js.map +1 -0
  69. package/dist/runtime/subsystems/{sync/execute-sync.use-case.d.ts → integration/execute-integration.use-case.d.ts} +13 -13
  70. package/dist/runtime/subsystems/{sync/execute-sync.use-case.js → integration/execute-integration.use-case.js} +30 -30
  71. package/dist/runtime/subsystems/integration/execute-integration.use-case.js.map +1 -0
  72. package/dist/runtime/subsystems/integration/index.d.ts +30 -0
  73. package/dist/runtime/subsystems/{sync → integration}/index.js +206 -171
  74. package/dist/runtime/subsystems/integration/index.js.map +1 -0
  75. package/dist/runtime/subsystems/{sync/sync-audit.schema.d.ts → integration/integration-audit.schema.d.ts} +64 -64
  76. package/dist/runtime/subsystems/{sync/sync-audit.schema.js → integration/integration-audit.schema.js} +47 -47
  77. package/dist/runtime/subsystems/integration/integration-audit.schema.js.map +1 -0
  78. package/dist/runtime/subsystems/{sync/sync-change-source.protocol.d.ts → integration/integration-change-source.protocol.d.ts} +10 -10
  79. package/dist/runtime/subsystems/integration/integration-change-source.protocol.js +1 -0
  80. package/dist/runtime/subsystems/{sync/sync-cursor-store.drizzle-backend.d.ts → integration/integration-cursor-store.drizzle-backend.d.ts} +1 -1
  81. package/dist/runtime/subsystems/{sync/sync-cursor-store.drizzle-backend.js → integration/integration-cursor-store.drizzle-backend.js} +65 -65
  82. package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js.map +1 -0
  83. package/dist/runtime/subsystems/{sync/sync-cursor-store.memory-backend.d.ts → integration/integration-cursor-store.memory-backend.d.ts} +6 -6
  84. package/dist/runtime/subsystems/{sync/sync-cursor-store.memory-backend.js → integration/integration-cursor-store.memory-backend.js} +5 -5
  85. package/dist/runtime/subsystems/integration/integration-cursor-store.memory-backend.js.map +1 -0
  86. package/dist/runtime/subsystems/{sync/sync-cursor-store.protocol.d.ts → integration/integration-cursor-store.protocol.d.ts} +13 -13
  87. package/dist/runtime/subsystems/integration/integration-cursor-store.protocol.js +1 -0
  88. package/dist/runtime/subsystems/{sync/sync-errors.d.ts → integration/integration-errors.d.ts} +2 -2
  89. package/dist/runtime/subsystems/{sync/sync-errors.js → integration/integration-errors.js} +3 -3
  90. package/dist/runtime/subsystems/integration/integration-errors.js.map +1 -0
  91. package/dist/runtime/subsystems/{sync/sync-field-diff.protocol.d.ts → integration/integration-field-diff.protocol.d.ts} +2 -2
  92. package/dist/runtime/subsystems/{sync/sync-field-diff.protocol.js → integration/integration-field-diff.protocol.js} +2 -2
  93. package/dist/runtime/subsystems/integration/integration-field-diff.protocol.js.map +1 -0
  94. package/dist/runtime/subsystems/{sync/sync-loopback.protocol.d.ts → integration/integration-loopback.protocol.d.ts} +2 -2
  95. package/dist/runtime/subsystems/integration/integration-loopback.protocol.js +1 -0
  96. package/dist/runtime/subsystems/{sync/sync-middleware.protocol.d.ts → integration/integration-middleware.protocol.d.ts} +5 -5
  97. package/dist/runtime/subsystems/integration/integration-middleware.protocol.js +1 -0
  98. package/dist/runtime/subsystems/{sync/sync-run-recorder.drizzle-backend.d.ts → integration/integration-run-recorder.drizzle-backend.d.ts} +5 -5
  99. package/dist/runtime/subsystems/{sync/sync-run-recorder.drizzle-backend.js → integration/integration-run-recorder.drizzle-backend.js} +73 -73
  100. package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js.map +1 -0
  101. package/dist/runtime/subsystems/{sync/sync-run-recorder.memory-backend.d.ts → integration/integration-run-recorder.memory-backend.d.ts} +15 -15
  102. package/dist/runtime/subsystems/{sync/sync-run-recorder.memory-backend.js → integration/integration-run-recorder.memory-backend.js} +11 -11
  103. package/dist/runtime/subsystems/integration/integration-run-recorder.memory-backend.js.map +1 -0
  104. package/dist/runtime/subsystems/{sync/sync-run-recorder.protocol.d.ts → integration/integration-run-recorder.protocol.d.ts} +25 -25
  105. package/dist/runtime/subsystems/integration/integration-run-recorder.protocol.js +1 -0
  106. package/dist/runtime/subsystems/{sync/sync-sink.protocol.d.ts → integration/integration-sink.protocol.d.ts} +5 -5
  107. package/dist/runtime/subsystems/integration/integration-sink.protocol.js +1 -0
  108. package/dist/runtime/subsystems/{sync/sync.module.d.ts → integration/integration.module.d.ts} +24 -24
  109. package/dist/runtime/subsystems/{sync/sync.module.js → integration/integration.module.js} +132 -132
  110. package/dist/runtime/subsystems/integration/integration.module.js.map +1 -0
  111. package/dist/runtime/subsystems/integration/integration.tokens.d.ts +60 -0
  112. package/dist/runtime/subsystems/integration/integration.tokens.js +20 -0
  113. package/dist/runtime/subsystems/integration/integration.tokens.js.map +1 -0
  114. package/dist/runtime/subsystems/{sync → integration}/loopback.middleware.d.ts +5 -5
  115. package/dist/runtime/subsystems/{sync → integration}/loopback.middleware.js +1 -1
  116. package/dist/runtime/subsystems/integration/loopback.middleware.js.map +1 -0
  117. package/dist/runtime/subsystems/{sync → integration}/poll-change-source.d.ts +5 -5
  118. package/dist/runtime/subsystems/{sync → integration}/poll-change-source.js +1 -1
  119. package/dist/runtime/subsystems/integration/poll-change-source.js.map +1 -0
  120. package/dist/runtime/subsystems/{sync → integration}/webhook-change-source.d.ts +5 -5
  121. package/dist/runtime/subsystems/{sync → integration}/webhook-change-source.js +1 -1
  122. package/dist/runtime/subsystems/integration/webhook-change-source.js.map +1 -0
  123. package/dist/runtime/subsystems/jobs/job-worker.module.d.ts +1 -1
  124. package/dist/runtime/subsystems/observability/index.d.ts +4 -4
  125. package/dist/runtime/subsystems/observability/index.js +11 -11
  126. package/dist/runtime/subsystems/observability/index.js.map +1 -1
  127. package/dist/runtime/subsystems/observability/observability.module.d.ts +2 -2
  128. package/dist/runtime/subsystems/observability/observability.module.js +11 -11
  129. package/dist/runtime/subsystems/observability/observability.module.js.map +1 -1
  130. package/dist/runtime/subsystems/observability/observability.protocol.d.ts +11 -11
  131. package/dist/runtime/subsystems/observability/observability.service.d.ts +6 -6
  132. package/dist/runtime/subsystems/observability/observability.service.js +11 -11
  133. package/dist/runtime/subsystems/observability/observability.service.js.map +1 -1
  134. package/dist/runtime/subsystems/observability/observability.tokens.d.ts +1 -1
  135. package/dist/runtime/subsystems/observability/observability.tokens.js.map +1 -1
  136. package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.d.ts +3 -3
  137. package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js.map +1 -1
  138. package/dist/runtime/subsystems/observability/reporters/index.d.ts +3 -3
  139. package/dist/runtime/subsystems/observability/reporters/index.js.map +1 -1
  140. package/dist/src/cli/index.js +1336 -376
  141. package/dist/src/cli/index.js.map +1 -1
  142. package/dist/src/index.d.ts +70 -22
  143. package/dist/src/index.js +290 -194
  144. package/dist/src/index.js.map +1 -1
  145. package/examples/auth-integrations/README.md +32 -32
  146. package/examples/auth-integrations/definitions/entities/{integration.yaml → connection.yaml} +10 -10
  147. package/examples/auth-integrations/runtime/{integrations/adapters/integration-grant-sink.adapter.ts → connections/adapters/connection-grant-sink.adapter.ts} +7 -7
  148. package/examples/auth-integrations/runtime/{integrations/adapters/integration-reader.adapter.ts → connections/adapters/connection-reader.adapter.ts} +10 -10
  149. package/examples/auth-integrations/runtime/{integrations/adapters/integration-token-writer.adapter.ts → connections/adapters/connection-token-writer.adapter.ts} +11 -11
  150. package/examples/auth-integrations/runtime/connections/connections-auth.module.ts +81 -0
  151. package/examples/auth-integrations/runtime/{integrations/facade/integrations.service.ts → connections/facade/connections.service.ts} +35 -35
  152. package/examples/auth-integrations/runtime/{integrations → connections}/oauth/use-cases/create-or-update-from-oauth-grant.use-case.ts +11 -11
  153. package/examples/auth-integrations/runtime/{integrations/oauth/use-cases/disconnect-integration.use-case.ts → connections/oauth/use-cases/disconnect-connection.use-case.ts} +6 -6
  154. package/examples/auth-integrations/runtime/connections/oauth/use-cases/list-user-connections.use-case.ts +21 -0
  155. package/examples/auth-integrations/runtime/connections/oauth/use-cases/mark-connection-requires-reauth.use-case.ts +21 -0
  156. package/package.json +9 -1
  157. package/runtime/base-classes/index.ts +8 -8
  158. package/runtime/base-classes/{synced-entity-repository.ts → integrated-entity-repository.ts} +36 -36
  159. package/runtime/base-classes/{synced-entity-service.ts → integrated-entity-service.ts} +6 -6
  160. package/runtime/base-classes/{sync-upsert-config.ts → integration-upsert-config.ts} +12 -12
  161. package/runtime/base-classes/{junction-sync-repository.ts → junction-integration-repository.ts} +28 -28
  162. package/runtime/subsystems/auth/auth-oauth-state.schema.ts +1 -1
  163. package/runtime/subsystems/auth/auth.module.ts +4 -4
  164. package/runtime/subsystems/auth/auth.tokens.ts +7 -7
  165. package/runtime/subsystems/auth/controllers/auth.controller.ts +7 -7
  166. package/runtime/subsystems/auth/index.ts +19 -19
  167. package/runtime/subsystems/auth/protocols/auth-strategy.ts +3 -3
  168. package/runtime/subsystems/auth/protocols/{integration-store.ts → connection-store.ts} +19 -19
  169. package/runtime/subsystems/auth/protocols/provider-strategy.ts +2 -2
  170. package/runtime/subsystems/auth/runtime/{integration-broken.error.ts → connection-broken.error.ts} +5 -5
  171. package/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.ts +35 -35
  172. package/runtime/subsystems/auth/runtime/with-auth-retry.ts +3 -3
  173. package/runtime/subsystems/index.ts +26 -11
  174. package/runtime/subsystems/{sync → integration}/build-change-source.ts +3 -3
  175. package/runtime/subsystems/{sync → integration}/deep-equal.differ.ts +7 -7
  176. package/runtime/subsystems/{sync → integration}/detection-config.schema.ts +3 -3
  177. package/runtime/subsystems/integration/entity-change-source-registry.memory.ts +40 -0
  178. package/runtime/subsystems/integration/entity-change-source-registry.protocol.ts +59 -0
  179. package/runtime/subsystems/{sync/execute-sync.use-case.ts → integration/execute-integration.use-case.ts} +40 -40
  180. package/runtime/subsystems/{sync → integration}/index.ts +56 -47
  181. package/runtime/subsystems/{sync/sync-audit.schema.ts → integration/integration-audit.schema.ts} +61 -61
  182. package/runtime/subsystems/{sync/sync-change-source.protocol.ts → integration/integration-change-source.protocol.ts} +9 -9
  183. package/runtime/subsystems/{sync/sync-cursor-store.drizzle-backend.ts → integration/integration-cursor-store.drizzle-backend.ts} +30 -30
  184. package/runtime/subsystems/{sync/sync-cursor-store.memory-backend.ts → integration/integration-cursor-store.memory-backend.ts} +9 -9
  185. package/runtime/subsystems/{sync/sync-cursor-store.protocol.ts → integration/integration-cursor-store.protocol.ts} +13 -13
  186. package/runtime/subsystems/{sync/sync-errors.ts → integration/integration-errors.ts} +3 -3
  187. package/runtime/subsystems/{sync/sync-field-diff.protocol.ts → integration/integration-field-diff.protocol.ts} +2 -2
  188. package/runtime/subsystems/{sync/sync-loopback.protocol.ts → integration/integration-loopback.protocol.ts} +2 -2
  189. package/runtime/subsystems/{sync/sync-middleware.protocol.ts → integration/integration-middleware.protocol.ts} +6 -6
  190. package/runtime/subsystems/{sync/sync-run-recorder.drizzle-backend.ts → integration/integration-run-recorder.drizzle-backend.ts} +39 -39
  191. package/runtime/subsystems/{sync/sync-run-recorder.memory-backend.ts → integration/integration-run-recorder.memory-backend.ts} +23 -23
  192. package/runtime/subsystems/{sync/sync-run-recorder.protocol.ts → integration/integration-run-recorder.protocol.ts} +25 -25
  193. package/runtime/subsystems/{sync/sync-sink.protocol.ts → integration/integration-sink.protocol.ts} +4 -4
  194. package/runtime/subsystems/{sync/sync.module.ts → integration/integration.module.ts} +48 -48
  195. package/runtime/subsystems/integration/integration.tokens.ts +63 -0
  196. package/runtime/subsystems/{sync → integration}/loopback.middleware.ts +5 -5
  197. package/runtime/subsystems/{sync → integration}/poll-change-source.ts +7 -7
  198. package/runtime/subsystems/{sync → integration}/webhook-change-source.ts +7 -7
  199. package/runtime/subsystems/observability/index.ts +1 -1
  200. package/runtime/subsystems/observability/observability.module.ts +2 -2
  201. package/runtime/subsystems/observability/observability.protocol.ts +11 -11
  202. package/runtime/subsystems/observability/observability.service.ts +13 -13
  203. package/runtime/subsystems/observability/observability.tokens.ts +1 -1
  204. package/src/patterns/library/index.ts +4 -4
  205. package/src/patterns/library/{synced.pattern.ts → integrated.pattern.ts} +12 -12
  206. package/src/patterns/library/junction.pattern.ts +1 -1
  207. package/src/patterns/pattern-definition.ts +3 -3
  208. package/templates/entity/new/backend/modules/core/{sync-source.ejs.t → integration-source.ejs.t} +6 -6
  209. package/templates/entity/new/clean-lite-ps/entity.ejs.t +12 -3
  210. package/templates/entity/new/clean-lite-ps/module.ejs.t +1 -1
  211. package/templates/entity/new/clean-lite-ps/prompt-extension.js +243 -60
  212. package/templates/entity/new/clean-lite-ps/repository.ejs.t +27 -27
  213. package/templates/entity/new/frontend/collections/collection.ejs.t +26 -1
  214. package/templates/entity/new/frontend/collections/collections-base.ejs.t +11 -0
  215. package/templates/entity/new/frontend/entity/combined.ejs.t +31 -1
  216. package/templates/entity/new/prompt.js +27 -15
  217. package/templates/junction/new/entity.ejs.t +1 -1
  218. package/templates/junction/new/prompt.js +24 -24
  219. package/templates/junction/new/repository.ejs.t +19 -19
  220. package/templates/subsystem/auth/auth-oauth-state.schema.ejs.t +2 -2
  221. package/templates/subsystem/auth-config/prompt.js +1 -1
  222. package/templates/subsystem/auth-integrations/app-module-hook.ejs.t +5 -5
  223. package/templates/subsystem/bridge/prompt.js +1 -1
  224. package/templates/subsystem/integration/integration-audit.schema.ejs.t +192 -0
  225. package/templates/subsystem/{sync → integration}/prompt.js +12 -12
  226. package/templates/subsystem/{sync-config/codegen-config-sync-block.ejs.t → integration-config/codegen-config-integration-block.ejs.t} +7 -7
  227. package/templates/subsystem/integration-config/prompt.js +22 -0
  228. package/templates/subsystem/jobs/worker.ejs.t +2 -2
  229. package/templates/subsystem/observability/main-hook.ejs.t +1 -1
  230. package/templates/subsystem/observability/prompt.js +1 -1
  231. package/templates/subsystem/openapi-config/prompt.js +1 -1
  232. package/dist/runtime/base-classes/junction-sync-repository.js.map +0 -1
  233. package/dist/runtime/base-classes/sync-upsert-config.js +0 -1
  234. package/dist/runtime/base-classes/synced-entity-repository.js.map +0 -1
  235. package/dist/runtime/base-classes/synced-entity-service.js.map +0 -1
  236. package/dist/runtime/subsystems/auth/protocols/integration-store.js +0 -1
  237. package/dist/runtime/subsystems/auth/runtime/integration-broken.error.js +0 -19
  238. package/dist/runtime/subsystems/auth/runtime/integration-broken.error.js.map +0 -1
  239. package/dist/runtime/subsystems/sync/build-change-source.js.map +0 -1
  240. package/dist/runtime/subsystems/sync/deep-equal.differ.js.map +0 -1
  241. package/dist/runtime/subsystems/sync/detection-config.schema.js.map +0 -1
  242. package/dist/runtime/subsystems/sync/execute-sync.use-case.js.map +0 -1
  243. package/dist/runtime/subsystems/sync/index.d.ts +0 -28
  244. package/dist/runtime/subsystems/sync/index.js.map +0 -1
  245. package/dist/runtime/subsystems/sync/loopback.middleware.js.map +0 -1
  246. package/dist/runtime/subsystems/sync/poll-change-source.js.map +0 -1
  247. package/dist/runtime/subsystems/sync/sync-audit.schema.js.map +0 -1
  248. package/dist/runtime/subsystems/sync/sync-change-source.protocol.js +0 -1
  249. package/dist/runtime/subsystems/sync/sync-cursor-store.drizzle-backend.js.map +0 -1
  250. package/dist/runtime/subsystems/sync/sync-cursor-store.memory-backend.js.map +0 -1
  251. package/dist/runtime/subsystems/sync/sync-cursor-store.protocol.js +0 -1
  252. package/dist/runtime/subsystems/sync/sync-errors.js.map +0 -1
  253. package/dist/runtime/subsystems/sync/sync-field-diff.protocol.js.map +0 -1
  254. package/dist/runtime/subsystems/sync/sync-loopback.protocol.js +0 -1
  255. package/dist/runtime/subsystems/sync/sync-middleware.protocol.js +0 -1
  256. package/dist/runtime/subsystems/sync/sync-run-recorder.drizzle-backend.js.map +0 -1
  257. package/dist/runtime/subsystems/sync/sync-run-recorder.memory-backend.js.map +0 -1
  258. package/dist/runtime/subsystems/sync/sync-run-recorder.protocol.js +0 -1
  259. package/dist/runtime/subsystems/sync/sync-sink.protocol.js +0 -1
  260. package/dist/runtime/subsystems/sync/sync.module.js.map +0 -1
  261. package/dist/runtime/subsystems/sync/sync.tokens.d.ts +0 -47
  262. package/dist/runtime/subsystems/sync/sync.tokens.js +0 -18
  263. package/dist/runtime/subsystems/sync/sync.tokens.js.map +0 -1
  264. package/dist/runtime/subsystems/sync/webhook-change-source.js.map +0 -1
  265. package/examples/auth-integrations/runtime/integrations/integrations-auth.module.ts +0 -81
  266. package/examples/auth-integrations/runtime/integrations/oauth/use-cases/list-user-integrations.use-case.ts +0 -21
  267. package/examples/auth-integrations/runtime/integrations/oauth/use-cases/mark-integration-requires-reauth.use-case.ts +0 -21
  268. package/runtime/subsystems/sync/sync.tokens.ts +0 -49
  269. package/templates/entity/new/backend/modules/core/sync-source.providers.ejs.t +0 -18
  270. package/templates/subsystem/sync/sync-audit.schema.ejs.t +0 -192
  271. package/templates/subsystem/sync-config/prompt.js +0 -22
  272. /package/dist/runtime/base-classes/{sync-upsert-config.js.map → integration-upsert-config.js.map} +0 -0
  273. /package/dist/runtime/subsystems/auth/protocols/{integration-store.js.map → connection-store.js.map} +0 -0
  274. /package/dist/runtime/subsystems/{sync/sync-change-source.protocol.js.map → integration/integration-change-source.protocol.js.map} +0 -0
  275. /package/dist/runtime/subsystems/{sync/sync-cursor-store.protocol.js.map → integration/integration-cursor-store.protocol.js.map} +0 -0
  276. /package/dist/runtime/subsystems/{sync/sync-loopback.protocol.js.map → integration/integration-loopback.protocol.js.map} +0 -0
  277. /package/dist/runtime/subsystems/{sync/sync-middleware.protocol.js.map → integration/integration-middleware.protocol.js.map} +0 -0
  278. /package/dist/runtime/subsystems/{sync/sync-run-recorder.protocol.js.map → integration/integration-run-recorder.protocol.js.map} +0 -0
  279. /package/dist/runtime/subsystems/{sync/sync-sink.protocol.js.map → integration/integration-sink.protocol.js.map} +0 -0
@@ -1,31 +1,31 @@
1
1
  /**
2
- * SyncModule — `DynamicModule.forRoot({ backend, multiTenant? })` factory
3
- * wiring the sync subsystem's substrate (SYNC-6, ADR-008 subsystem pattern).
2
+ * IntegrationModule — `DynamicModule.forRoot({ backend, multiTenant? })` factory
3
+ * wiring the integration subsystem's substrate (SYNC-6, ADR-008 subsystem pattern).
4
4
  *
5
5
  * ## What this module provides
6
6
  *
7
- * - `SYNC_CURSOR_STORE` — Drizzle or Memory cursor store
8
- * - `SYNC_RUN_RECORDER` — Drizzle or Memory run recorder
9
- * - `SYNC_FIELD_DIFFER` — default `DeepEqualDiffer`
10
- * - `SYNC_MULTI_TENANT` — resolved boolean flag (defaults to false)
11
- * - `SYNC_MODULE_OPTIONS` — the options object itself, for backends
7
+ * - `INTEGRATION_CURSOR_STORE` — Drizzle or Memory cursor store
8
+ * - `INTEGRATION_RUN_RECORDER` — Drizzle or Memory run recorder
9
+ * - `INTEGRATION_FIELD_DIFFER` — default `DeepEqualDiffer`
10
+ * - `INTEGRATION_MULTI_TENANT` — resolved boolean flag (defaults to false)
11
+ * - `INTEGRATION_MODULE_OPTIONS` — the options object itself, for backends
12
12
  * that need to inspect config at construction time
13
13
  *
14
14
  * ## What this module does NOT provide
15
15
  *
16
- * - `SYNC_CHANGE_SOURCE` — per-provider per-entity; consumer binds in
17
- * their feature module (e.g. `OpportunitySyncModule` provides a
16
+ * - `INTEGRATION_CHANGE_SOURCE` — per-provider per-entity; consumer binds in
17
+ * their feature module (e.g. `OpportunityIntegrationModule` provides a
18
18
  * `SalesforceOpportunityChangeSource`). Loopback suppression — when
19
19
  * needed — is composed into the primitive's middleware chain via
20
20
  * `createLoopbackMiddleware(store)` (#226-5 / ADR-033); the
21
21
  * orchestrator no longer accepts a fingerprint store directly.
22
- * - `SYNC_SINK` — per canonical entity; consumer binds in their feature
22
+ * - `INTEGRATION_SINK` — per canonical entity; consumer binds in their feature
23
23
  * module.
24
- * - `ExecuteSyncUseCase` — registered by the feature module alongside
24
+ * - `ExecuteIntegrationUseCase` — registered by the feature module alongside
25
25
  * its source + sink bindings. Providing the orchestrator here would
26
- * force Nest to resolve SYNC_CHANGE_SOURCE + SYNC_SINK at module
26
+ * force Nest to resolve INTEGRATION_CHANGE_SOURCE + INTEGRATION_SINK at module
27
27
  * compile time, which fails when the feature module hasn't been
28
- * imported yet. Consumers register `ExecuteSyncUseCase` in the same
28
+ * imported yet. Consumers register `ExecuteIntegrationUseCase` in the same
29
29
  * `providers` array as their source + sink so resolution is local
30
30
  * to where all three are bound.
31
31
  *
@@ -38,7 +38,7 @@
38
38
  * ```ts
39
39
  * // AppModule — single source of truth for backend + multi-tenancy.
40
40
  * @Module({
41
- * imports: [SyncModule.forRoot({ backend: 'drizzle' })],
41
+ * imports: [IntegrationModule.forRoot({ backend: 'drizzle' })],
42
42
  * })
43
43
  * export class AppModule {}
44
44
  *
@@ -46,36 +46,36 @@
46
46
  * // orchestrator for free.
47
47
  * @Module({
48
48
  * providers: [
49
- * { provide: SYNC_CHANGE_SOURCE, useClass: SalesforceOpportunitySource },
50
- * { provide: SYNC_SINK, useClass: OpportunitySyncSink },
51
- * ExecuteSyncUseCase,
49
+ * { provide: INTEGRATION_CHANGE_SOURCE, useClass: SalesforceOpportunitySource },
50
+ * { provide: INTEGRATION_SINK, useClass: OpportunityIntegrationSink },
51
+ * ExecuteIntegrationUseCase,
52
52
  * ],
53
53
  * })
54
- * export class OpportunitySyncModule {
54
+ * export class OpportunityIntegrationModule {
55
55
  * constructor(
56
- * private readonly execute: ExecuteSyncUseCase<CanonicalOpportunity>,
56
+ * private readonly execute: ExecuteIntegrationUseCase<CanonicalOpportunity>,
57
57
  * ) {}
58
58
  * }
59
59
  * ```
60
60
  *
61
61
  * `global: true` means feature modules do not need to re-import
62
- * `SyncModule` — the substrate tokens are available project-wide.
62
+ * `IntegrationModule` — the substrate tokens are available project-wide.
63
63
  */
64
64
  import { Module, type DynamicModule, type Provider } from '@nestjs/common';
65
65
  import {
66
- SYNC_CURSOR_STORE,
67
- SYNC_FIELD_DIFFER,
68
- SYNC_MODULE_OPTIONS,
69
- SYNC_MULTI_TENANT,
70
- SYNC_RUN_RECORDER,
71
- } from './sync.tokens';
72
- import { MemoryCursorStore } from './sync-cursor-store.memory-backend';
73
- import { MemoryRunRecorder } from './sync-run-recorder.memory-backend';
74
- import { PostgresCursorStore } from './sync-cursor-store.drizzle-backend';
75
- import { DrizzleSyncRunRecorder } from './sync-run-recorder.drizzle-backend';
66
+ INTEGRATION_CURSOR_STORE,
67
+ INTEGRATION_FIELD_DIFFER,
68
+ INTEGRATION_MODULE_OPTIONS,
69
+ INTEGRATION_MULTI_TENANT,
70
+ INTEGRATION_RUN_RECORDER,
71
+ } from './integration.tokens';
72
+ import { MemoryCursorStore } from './integration-cursor-store.memory-backend';
73
+ import { MemoryRunRecorder } from './integration-run-recorder.memory-backend';
74
+ import { PostgresCursorStore } from './integration-cursor-store.drizzle-backend';
75
+ import { DrizzleIntegrationRunRecorder } from './integration-run-recorder.drizzle-backend';
76
76
  import { DeepEqualDiffer } from './deep-equal.differ';
77
77
 
78
- export interface SyncModuleOptions {
78
+ export interface IntegrationModuleOptions {
79
79
  /**
80
80
  * Backend selection. `drizzle` wires the Postgres cursor store +
81
81
  * run-log recorder; `memory` wires in-memory doubles suitable for
@@ -103,16 +103,16 @@ export interface SyncModuleOptions {
103
103
  }
104
104
 
105
105
  @Module({})
106
- export class SyncModule {
107
- static forRoot(options: SyncModuleOptions): DynamicModule {
106
+ export class IntegrationModule {
107
+ static forRoot(options: IntegrationModuleOptions): DynamicModule {
108
108
  const multiTenant = options.multiTenant ?? false;
109
109
 
110
110
  const sharedProviders: Provider[] = [
111
- { provide: SYNC_MODULE_OPTIONS, useValue: options },
112
- { provide: SYNC_MULTI_TENANT, useValue: multiTenant },
111
+ { provide: INTEGRATION_MODULE_OPTIONS, useValue: options },
112
+ { provide: INTEGRATION_MULTI_TENANT, useValue: multiTenant },
113
113
  // Default differ — consumers can override by binding a different
114
- // `IFieldDiffer<T>` to `SYNC_FIELD_DIFFER` in their feature module.
115
- { provide: SYNC_FIELD_DIFFER, useValue: new DeepEqualDiffer() },
114
+ // `IFieldDiffer<T>` to `INTEGRATION_FIELD_DIFFER` in their feature module.
115
+ { provide: INTEGRATION_FIELD_DIFFER, useValue: new DeepEqualDiffer() },
116
116
  ];
117
117
 
118
118
  const backendProviders: Provider[] =
@@ -123,33 +123,33 @@ export class SyncModule {
123
123
  // direct assertions. Matches JOB-4 / MemoryJobStore shape.
124
124
  { provide: MemoryCursorStore, useValue: new MemoryCursorStore() },
125
125
  {
126
- provide: SYNC_CURSOR_STORE,
126
+ provide: INTEGRATION_CURSOR_STORE,
127
127
  useExisting: MemoryCursorStore,
128
128
  },
129
129
  { provide: MemoryRunRecorder, useValue: new MemoryRunRecorder() },
130
130
  {
131
- provide: SYNC_RUN_RECORDER,
131
+ provide: INTEGRATION_RUN_RECORDER,
132
132
  useExisting: MemoryRunRecorder,
133
133
  },
134
134
  ]
135
135
  : [
136
136
  // Drizzle backends — injected with DRIZZLE (provided by the
137
- // consumer's DrizzleModule) + the SYNC_MULTI_TENANT flag
137
+ // consumer's DrizzleModule) + the INTEGRATION_MULTI_TENANT flag
138
138
  // we bound above.
139
- { provide: SYNC_CURSOR_STORE, useClass: PostgresCursorStore },
140
- { provide: SYNC_RUN_RECORDER, useClass: DrizzleSyncRunRecorder },
139
+ { provide: INTEGRATION_CURSOR_STORE, useClass: PostgresCursorStore },
140
+ { provide: INTEGRATION_RUN_RECORDER, useClass: DrizzleIntegrationRunRecorder },
141
141
  ];
142
142
 
143
143
  return {
144
- module: SyncModule,
144
+ module: IntegrationModule,
145
145
  global: true,
146
146
  providers: [...sharedProviders, ...backendProviders],
147
147
  exports: [
148
- SYNC_MODULE_OPTIONS,
149
- SYNC_MULTI_TENANT,
150
- SYNC_FIELD_DIFFER,
151
- SYNC_CURSOR_STORE,
152
- SYNC_RUN_RECORDER,
148
+ INTEGRATION_MODULE_OPTIONS,
149
+ INTEGRATION_MULTI_TENANT,
150
+ INTEGRATION_FIELD_DIFFER,
151
+ INTEGRATION_CURSOR_STORE,
152
+ INTEGRATION_RUN_RECORDER,
153
153
  ],
154
154
  };
155
155
  }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Integration subsystem — DI tokens
3
+ *
4
+ * String constants (not Symbols) so they match by value across import
5
+ * boundaries — same convention as the events subsystem (`EVENT_BUS`). The
6
+ * jobs subsystem uses Symbols for its analogous tokens; events and integration
7
+ * stay internally consistent with strings.
8
+ *
9
+ * Usage in use cases:
10
+ * ```ts
11
+ * constructor(
12
+ * @Inject(INTEGRATION_CHANGE_SOURCE) private readonly source: IChangeSource<CanonicalOpportunity>,
13
+ * @Inject(INTEGRATION_CURSOR_STORE) private readonly cursors: ICursorStore,
14
+ * @Inject(INTEGRATION_FIELD_DIFFER) private readonly differ: IFieldDiffer<CanonicalOpportunity>,
15
+ * @Inject(INTEGRATION_SINK) private readonly sink: IIntegrationSink<CanonicalOpportunity>,
16
+ * @Inject(INTEGRATION_RUN_RECORDER) private readonly recorder: IIntegrationRunRecorder,
17
+ * ) {}
18
+ * ```
19
+ *
20
+ * Concrete bindings are registered by `IntegrationModule.forRoot(...)` (SYNC-6).
21
+ */
22
+
23
+ export const INTEGRATION_CHANGE_SOURCE = 'INTEGRATION_CHANGE_SOURCE' as const;
24
+ export const INTEGRATION_CURSOR_STORE = 'INTEGRATION_CURSOR_STORE' as const;
25
+ export const INTEGRATION_FIELD_DIFFER = 'INTEGRATION_FIELD_DIFFER' as const;
26
+ export const INTEGRATION_SINK = 'INTEGRATION_SINK' as const;
27
+
28
+ /**
29
+ * Run-recorder token (SYNC-5). Backed by `IIntegrationRunRecorder`. Drizzle impl
30
+ * lands in SYNC-4; tests provide inline fakes.
31
+ */
32
+ export const INTEGRATION_RUN_RECORDER = 'INTEGRATION_RUN_RECORDER' as const;
33
+
34
+ /**
35
+ * Injection token for the resolved `IntegrationModuleOptions` object (SYNC-6).
36
+ *
37
+ * Backends that need to observe module configuration (e.g. `multiTenant`
38
+ * flag, pool filters) inject via this token. Provided automatically by
39
+ * `IntegrationModule.forRoot(...)` / `IntegrationModule.forRootAsync(...)`.
40
+ */
41
+ export const INTEGRATION_MODULE_OPTIONS = 'INTEGRATION_MODULE_OPTIONS' as const;
42
+
43
+ /**
44
+ * Injection token for the resolved multi-tenancy flag (SYNC-6).
45
+ *
46
+ * Provided by `IntegrationModule.forRoot(...)` as `options.multiTenant ?? false`.
47
+ * Consumed by `ExecuteIntegrationUseCase` to enforce the tenantId-is-required rule.
48
+ */
49
+ export const INTEGRATION_MULTI_TENANT = 'INTEGRATION_MULTI_TENANT' as const;
50
+
51
+ /**
52
+ * Injection token for the entity-keyed `IEntityChangeSourceRegistry` (C7,
53
+ * #336). Bound to the codegen-emitted aggregator that folds per-provider
54
+ * adapter contributions into one registry (RFC-0001 §3, emitted by Track D
55
+ * D3/D4).
56
+ *
57
+ * A string constant, not `Symbol.for(...)`, to match this subsystem's token
58
+ * convention (see file header). The originating issue's code block proposed a
59
+ * `Symbol.for('@pattern-stack/codegen.entity-change-source-registry')` key,
60
+ * predating the sync→integration consolidation onto string tokens; kept as a
61
+ * string here for internal consistency with the other INTEGRATION_* tokens.
62
+ */
63
+ export const ENTITY_CHANGE_SOURCE_REGISTRY = 'ENTITY_CHANGE_SOURCE_REGISTRY' as const;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Sync subsystem — loopback `ChangeMiddleware` factory (#226-5, ADR-033).
2
+ * Integration subsystem — loopback `ChangeMiddleware` factory (#226-5, ADR-033).
3
3
  *
4
- * Replaces the prior orchestrator-side `@Optional() SYNC_LOOPBACK_FINGERPRINT_STORE`
4
+ * Replaces the prior orchestrator-side `@Optional() INTEGRATION_LOOPBACK_FINGERPRINT_STORE`
5
5
  * branch. Consumers that need to suppress echoes of their own outbound
6
6
  * writes compose `createLoopbackMiddleware(store)` into a primitive's
7
7
  * middleware chain — typically alongside `PollChangeSource<T>` — instead
@@ -28,12 +28,12 @@
28
28
  * their store or layer a counting middleware alongside this one.
29
29
  */
30
30
 
31
- import type { Change } from './sync-change-source.protocol';
31
+ import type { Change } from './integration-change-source.protocol';
32
32
  import type {
33
33
  ChangeIterator,
34
34
  ChangeMiddleware,
35
- } from './sync-middleware.protocol';
36
- import type { ILoopbackFingerprintStore } from './sync-loopback.protocol';
35
+ } from './integration-middleware.protocol';
36
+ import type { ILoopbackFingerprintStore } from './integration-loopback.protocol';
37
37
 
38
38
  /**
39
39
  * Build a `ChangeMiddleware<T>` that suppresses changes whose fingerprint
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Sync subsystem — `PollChangeSource<T>` primitive (#226-3, ADR-033).
2
+ * Integration subsystem — `PollChangeSource<T>` primitive (#226-3, ADR-033).
3
3
  *
4
4
  * Generic poll-mode `IChangeSource<T>` implementation parameterized by a
5
5
  * parsed `DetectionConfig` (poll mode) and a consumer-supplied
@@ -36,12 +36,12 @@ import type {
36
36
  Change,
37
37
  ChangeSource,
38
38
  IChangeSource,
39
- SyncSubscriptionView,
40
- } from './sync-change-source.protocol';
39
+ IntegrationSubscriptionView,
40
+ } from './integration-change-source.protocol';
41
41
  import type {
42
42
  ChangeIterator,
43
43
  ChangeMiddleware,
44
- } from './sync-middleware.protocol';
44
+ } from './integration-middleware.protocol';
45
45
 
46
46
  // ============================================================================
47
47
  // Cursor + adapter callback shapes
@@ -60,7 +60,7 @@ export type PollCursor = unknown;
60
60
  * NOT here on purpose.
61
61
  */
62
62
  export interface PollFetchContext {
63
- readonly subscription: SyncSubscriptionView;
63
+ readonly subscription: IntegrationSubscriptionView;
64
64
  readonly cursor: PollCursor | null;
65
65
  readonly filters: readonly ResolvedFilter[];
66
66
  }
@@ -174,14 +174,14 @@ export class PollChangeSource<T> implements IChangeSource<T> {
174
174
  }
175
175
 
176
176
  listChanges(
177
- subscription: SyncSubscriptionView,
177
+ subscription: IntegrationSubscriptionView,
178
178
  cursor: unknown | null,
179
179
  ): AsyncIterable<Change<T>> {
180
180
  return this.composed(subscription, cursor);
181
181
  }
182
182
 
183
183
  private async *fetch(
184
- subscription: SyncSubscriptionView,
184
+ subscription: IntegrationSubscriptionView,
185
185
  cursor: unknown | null,
186
186
  ): AsyncIterable<Change<T>> {
187
187
  const ctx: PollFetchContext = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Sync subsystem — `WebhookChangeSource<T>` primitive (#226-4, ADR-033).
2
+ * Integration subsystem — `WebhookChangeSource<T>` primitive (#226-4, ADR-033).
3
3
  *
4
4
  * Generic webhook-mode `IChangeSource<T>` implementation parameterized by a
5
5
  * parsed `DetectionConfig` (webhook mode) and a consumer-supplied
@@ -40,12 +40,12 @@ import type { DetectionConfig } from './detection-config.schema';
40
40
  import type {
41
41
  Change,
42
42
  IChangeSource,
43
- SyncSubscriptionView,
44
- } from './sync-change-source.protocol';
43
+ IntegrationSubscriptionView,
44
+ } from './integration-change-source.protocol';
45
45
  import type {
46
46
  ChangeIterator,
47
47
  ChangeMiddleware,
48
- } from './sync-middleware.protocol';
48
+ } from './integration-middleware.protocol';
49
49
 
50
50
  // ============================================================================
51
51
  // Cursor + queue callback shapes
@@ -65,7 +65,7 @@ export type WebhookCursor = unknown;
65
65
  * `userId` / `tenantId`.
66
66
  */
67
67
  export interface WebhookFetchContext {
68
- readonly subscription: SyncSubscriptionView;
68
+ readonly subscription: IntegrationSubscriptionView;
69
69
  readonly cursor: WebhookCursor | null;
70
70
  }
71
71
 
@@ -162,14 +162,14 @@ export class WebhookChangeSource<T> implements IChangeSource<T> {
162
162
  }
163
163
 
164
164
  listChanges(
165
- subscription: SyncSubscriptionView,
165
+ subscription: IntegrationSubscriptionView,
166
166
  cursor: unknown | null,
167
167
  ): AsyncIterable<Change<T>> {
168
168
  return this.composed(subscription, cursor);
169
169
  }
170
170
 
171
171
  private async *fetch(
172
- subscription: SyncSubscriptionView,
172
+ subscription: IntegrationSubscriptionView,
173
173
  cursor: unknown | null,
174
174
  ): AsyncIterable<Change<T>> {
175
175
  const ctx: WebhookFetchContext = {
@@ -39,7 +39,7 @@ export type {
39
39
  CorrelationTimeline,
40
40
  CorrelationTimelineEntry,
41
41
  StatusHistogram,
42
- SyncRunSummary,
42
+ IntegrationRunSummary,
43
43
  CursorSnapshot,
44
44
  } from './observability.protocol';
45
45
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * ObservabilityModule — combiner subsystem (ADR-025, OBS-5, OBS-6).
3
3
  *
4
- * Composes the jobs, bridge, and sync read ports into a single
4
+ * Composes the jobs, bridge, and integration read ports into a single
5
5
  * `IObservability` facade. Owned by no sibling subsystem; it consumes
6
6
  * their tokens via DI, which the consumer app wires by registering the
7
7
  * sibling modules in the right order (like BridgeModule — the named
@@ -14,7 +14,7 @@
14
14
  * EventsModule.forRoot({ backend: 'drizzle' }),
15
15
  * JobsDomainModule.forRoot({ backend: 'drizzle' }),
16
16
  * BridgeModule.forRoot({ backend: 'drizzle' }),
17
- * SyncModule.forRoot({ backend: 'drizzle' }),
17
+ * IntegrationModule.forRoot({ backend: 'drizzle' }),
18
18
  * ObservabilityModule.forRoot({
19
19
  * reporters: {
20
20
  * bridgeMetrics: {
@@ -5,7 +5,7 @@
5
5
  * Every method:
6
6
  * - Accepts an optional `tenantId`, passed VERBATIM to the owning sibling
7
7
  * port. Observability never re-implements tenant filtering — that is
8
- * the owning subsystem's job (jobs / bridge / sync). See
8
+ * the owning subsystem's job (jobs / bridge / integration). See
9
9
  * `.claude/skills/observability/SKILL.md` §3.
10
10
  * - `undefined` — "not provided"; sibling default semantics apply.
11
11
  * - `null` — explicit cross-tenant match (sibling-specific).
@@ -32,8 +32,8 @@ import type {
32
32
  ListEventsQuery,
33
33
  } from '../events/event-read.protocol';
34
34
  import type { StatusHistogram } from '../bridge/bridge.protocol';
35
- import type { SyncRunSummary } from '../sync/sync-run-recorder.protocol';
36
- import type { CursorSnapshot } from '../sync/sync-cursor-store.protocol';
35
+ import type { IntegrationRunSummary } from '../integration/integration-run-recorder.protocol';
36
+ import type { CursorSnapshot } from '../integration/integration-cursor-store.protocol';
37
37
 
38
38
  /**
39
39
  * One chronological entry in a correlation timeline (OBS-LIST-1). Either a
@@ -98,22 +98,22 @@ export interface IObservability {
98
98
  ): Promise<StatusHistogram>;
99
99
 
100
100
  /**
101
- * Recent `sync_runs` (optionally filtered by subscription). Delegates to
102
- * `ISyncRunRecorder.listRecent`.
101
+ * Recent `integration_runs` (optionally filtered by subscription). Delegates to
102
+ * `IIntegrationRunRecorder.listRecent`.
103
103
  *
104
- * Empty array when the sync subsystem is not installed.
104
+ * Empty array when the integration subsystem is not installed.
105
105
  */
106
- getRecentSyncRuns(
106
+ getRecentIntegrationRuns(
107
107
  limit: number,
108
108
  subscriptionId?: string,
109
109
  tenantId?: string | null,
110
- ): Promise<SyncRunSummary[]>;
110
+ ): Promise<IntegrationRunSummary[]>;
111
111
 
112
112
  /**
113
- * Cursor state per enabled `sync_subscriptions` row. Delegates to
113
+ * Cursor state per enabled `integration_subscriptions` row. Delegates to
114
114
  * `ICursorStore.listAll`.
115
115
  *
116
- * Empty array when the sync subsystem is not installed.
116
+ * Empty array when the integration subsystem is not installed.
117
117
  */
118
118
  getCursors(tenantId?: string | null): Promise<CursorSnapshot[]>;
119
119
 
@@ -163,6 +163,6 @@ export type {
163
163
  EventPage,
164
164
  ListEventsQuery,
165
165
  StatusHistogram,
166
- SyncRunSummary,
166
+ IntegrationRunSummary,
167
167
  CursorSnapshot,
168
168
  };
@@ -2,7 +2,7 @@
2
2
  * ObservabilityService — `IObservability` combiner implementation
3
3
  * (ADR-025, OBS-5).
4
4
  *
5
- * Composes read methods across the jobs, bridge, and sync subsystems via
5
+ * Composes read methods across the jobs, bridge, and integration subsystems via
6
6
  * DI. Owns no state, no schema, no SQL. Every method is a one-line
7
7
  * delegation to the sibling port that already encodes the semantics.
8
8
  *
@@ -50,15 +50,15 @@ import type {
50
50
  import { BRIDGE_DELIVERY_REPO } from '../bridge/bridge.tokens';
51
51
  import type { IJobBridge, StatusHistogram } from '../bridge/bridge.protocol';
52
52
 
53
- import { SYNC_CURSOR_STORE, SYNC_RUN_RECORDER } from '../sync/sync.tokens';
53
+ import { INTEGRATION_CURSOR_STORE, INTEGRATION_RUN_RECORDER } from '../integration/integration.tokens';
54
54
  import type {
55
- ISyncRunRecorder,
56
- SyncRunSummary,
57
- } from '../sync/sync-run-recorder.protocol';
55
+ IIntegrationRunRecorder,
56
+ IntegrationRunSummary,
57
+ } from '../integration/integration-run-recorder.protocol';
58
58
  import type {
59
59
  CursorSnapshot,
60
60
  ICursorStore,
61
- } from '../sync/sync-cursor-store.protocol';
61
+ } from '../integration/integration-cursor-store.protocol';
62
62
 
63
63
  import type {
64
64
  CorrelationTimeline,
@@ -106,10 +106,10 @@ export class ObservabilityService implements IObservability {
106
106
  @Inject(BRIDGE_DELIVERY_REPO)
107
107
  private readonly bridge?: IJobBridge,
108
108
  @Optional()
109
- @Inject(SYNC_RUN_RECORDER)
110
- private readonly syncRuns?: ISyncRunRecorder,
109
+ @Inject(INTEGRATION_RUN_RECORDER)
110
+ private readonly integrationRuns?: IIntegrationRunRecorder,
111
111
  @Optional()
112
- @Inject(SYNC_CURSOR_STORE)
112
+ @Inject(INTEGRATION_CURSOR_STORE)
113
113
  private readonly cursors?: ICursorStore,
114
114
  @Optional()
115
115
  @Inject(EVENT_READ_PORT)
@@ -137,13 +137,13 @@ export class ObservabilityService implements IObservability {
137
137
  return this.bridge.getStatusHistogram(windowHours, tenantId);
138
138
  }
139
139
 
140
- async getRecentSyncRuns(
140
+ async getRecentIntegrationRuns(
141
141
  limit: number,
142
142
  subscriptionId?: string,
143
143
  tenantId?: string | null,
144
- ): Promise<SyncRunSummary[]> {
145
- if (!this.syncRuns) return [];
146
- return this.syncRuns.listRecent(limit, subscriptionId, tenantId);
144
+ ): Promise<IntegrationRunSummary[]> {
145
+ if (!this.integrationRuns) return [];
146
+ return this.integrationRuns.listRecent(limit, subscriptionId, tenantId);
147
147
  }
148
148
 
149
149
  async getCursors(tenantId?: string | null): Promise<CursorSnapshot[]> {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Observability combiner subsystem — DI tokens (ADR-025, OBS-5).
3
3
  *
4
- * String constants (not Symbols), matching the events / bridge / sync
4
+ * String constants (not Symbols), matching the events / bridge / integration
5
5
  * convention. The jobs subsystem uses Symbols for its analogous tokens;
6
6
  * observability stays internally consistent with its sibling combiner
7
7
  * (bridge) because the two are structurally paired (ADR-025).
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Library pattern bootstrap — imports every shipped pattern and registers
3
3
  * it with the shared library registry. Side-effect-only module: importing
4
- * this barrel is what pre-registers `Base`, `Synced`, `Activity`,
4
+ * this barrel is what pre-registers `Base`, `Integrated`, `Activity`,
5
5
  * `Knowledge`, and `Metadata`.
6
6
  *
7
7
  * Adding a new library pattern is two edits: create the `*.pattern.ts`
@@ -14,10 +14,10 @@ import { BasePattern } from './base.pattern.js';
14
14
  import { JunctionPattern } from './junction.pattern.js';
15
15
  import { KnowledgePattern } from './knowledge.pattern.js';
16
16
  import { MetadataPattern } from './metadata.pattern.js';
17
- import { SyncedPattern } from './synced.pattern.js';
17
+ import { IntegratedPattern } from './integrated.pattern.js';
18
18
 
19
19
  registerLibraryPattern(BasePattern);
20
- registerLibraryPattern(SyncedPattern);
20
+ registerLibraryPattern(IntegratedPattern);
21
21
  registerLibraryPattern(ActivityPattern);
22
22
  registerLibraryPattern(KnowledgePattern);
23
23
  registerLibraryPattern(MetadataPattern);
@@ -29,7 +29,7 @@ export {
29
29
  JunctionPattern,
30
30
  KnowledgePattern,
31
31
  MetadataPattern,
32
- SyncedPattern,
32
+ IntegratedPattern,
33
33
  };
34
34
  export {
35
35
  BaseJunctionFields,
@@ -1,35 +1,35 @@
1
1
  /**
2
- * SyncedPattern — adds external-system sync columns and methods.
2
+ * IntegratedPattern — adds external-system integration columns and methods.
3
3
  *
4
- * Replaces the legacy `family: synced` entry in
4
+ * Replaces the legacy `family: integrated` entry in
5
5
  * `templates/entity/new/clean-lite-ps/prompt-extension.js`. Class names,
6
6
  * import paths, and inherited-method comment lines are preserved verbatim
7
7
  * so PATTERN-5's template swap produces byte-identical output for
8
- * pre-existing `family: synced` fixtures.
8
+ * pre-existing `family: integrated` fixtures.
9
9
  *
10
10
  * Implies `external_id_tracking` — the behavior that contributes the
11
11
  * `external_id`, `provider`, and `provider_metadata` columns to the table.
12
- * An entity declaring `pattern: Synced` need not re-declare the behavior.
12
+ * An entity declaring `pattern: Integrated` need not re-declare the behavior.
13
13
  */
14
14
 
15
15
  import { definePattern } from '../pattern-definition.js';
16
16
 
17
- export const SyncedPattern = definePattern({
18
- name: 'Synced',
17
+ export const IntegratedPattern = definePattern({
18
+ name: 'Integrated',
19
19
  extends: ['Base'],
20
- repositoryClass: 'SyncedEntityRepository',
21
- serviceClass: 'SyncedEntityService',
22
- repositoryImport: '@shared/base-classes/synced-entity-repository',
23
- serviceImport: '@shared/base-classes/synced-entity-service',
20
+ repositoryClass: 'IntegratedEntityRepository',
21
+ serviceClass: 'IntegratedEntityService',
22
+ repositoryImport: '@shared/base-classes/integrated-entity-repository',
23
+ serviceImport: '@shared/base-classes/integrated-entity-service',
24
24
  repositoryInheritedMethods: [
25
25
  'findById, findByIds, list, count, exists, create, update, delete, upsertMany',
26
26
  'findByExternalId, findManyByExternalIds, findAllByUserId, findVisibleByUserId',
27
- 'syncUpsertOne, findByExternalIdProjected, softDeleteByExternalId, syncUpsert',
27
+ 'integrationUpsertOne, findByExternalIdProjected, softDeleteByExternalId, integrationUpsert',
28
28
  ],
29
29
  serviceInheritedMethods: [
30
30
  'findById, findByIds, list, count, exists, create, update, delete',
31
31
  'findByExternalId, findAllByUserId, findVisibleByUserId',
32
32
  ],
33
33
  impliedBehaviors: ['external_id_tracking'],
34
- description: 'External CRM/system sync columns and syncUpsert methods',
34
+ description: 'External CRM/system integration columns and integrationUpsert methods',
35
35
  });
@@ -2,7 +2,7 @@
2
2
  * JunctionPattern — top-level discriminator for explicit many-to-many
3
3
  * junction YAML files.
4
4
  *
5
- * Unlike `Activity` / `Synced` / `Metadata` (which attach to an entity via
5
+ * Unlike `Activity` / `Integrated` / `Metadata` (which attach to an entity via
6
6
  * `pattern:` / `patterns:`), `Junction` IS the top-level YAML shape — a
7
7
  * junction file's discriminator is `pattern: Junction`, not `entity:`.
8
8
  * It therefore does not declare `repositoryClass` / `serviceClass`: the
@@ -52,7 +52,7 @@ export type PatternKind = 'domain' | 'orchestration';
52
52
  * store these and look them up by `name`.
53
53
  */
54
54
  export interface PatternDefinition<TConfig = unknown> {
55
- /** Unique name used in YAML — e.g. `pattern: Synced` */
55
+ /** Unique name used in YAML — e.g. `pattern: Integrated` */
56
56
  name: string;
57
57
 
58
58
  /**
@@ -65,7 +65,7 @@ export interface PatternDefinition<TConfig = unknown> {
65
65
 
66
66
  /**
67
67
  * Built-in patterns this extends, by name. Phase 1 supports single-depth
68
- * chains only — a pattern may `extends: ['Synced']` but the transitive
68
+ * chains only — a pattern may `extends: ['Integrated']` but the transitive
69
69
  * chain is not yet resolved. Multi-depth inheritance is deferred until
70
70
  * a real consumer asks.
71
71
  */
@@ -79,7 +79,7 @@ export interface PatternDefinition<TConfig = unknown> {
79
79
  /**
80
80
  * Fully-qualified TypeScript path alias the consumer's tsconfig resolves.
81
81
  * Library patterns use the consumer-installed runtime base class path
82
- * (e.g. `@shared/base-classes/synced-entity-repository`); app patterns
82
+ * (e.g. `@shared/base-classes/integrated-entity-repository`); app patterns
83
83
  * use whatever alias the consumer has configured (e.g. `@/patterns/...`).
84
84
  */
85
85
  repositoryImport?: string;