@abloatai/transaction 0.57.0 → 0.59.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 (781) hide show
  1. package/CONVENTIONS.md +51 -41
  2. package/README.md +3 -1
  3. package/dist/ai-sdk/modelTools.d.ts +3 -3
  4. package/dist/ai-sdk/modelTools.d.ts.map +1 -1
  5. package/dist/ai-sdk/modelTools.js +1 -1
  6. package/dist/ai-sdk/modelTools.js.map +1 -1
  7. package/dist/ai-sdk/updateTool.d.ts +5 -7
  8. package/dist/ai-sdk/updateTool.d.ts.map +1 -1
  9. package/dist/ai-sdk/updateTool.js +3 -5
  10. package/dist/ai-sdk/updateTool.js.map +1 -1
  11. package/dist/auth/capability.d.ts +5 -0
  12. package/dist/auth/capability.d.ts.map +1 -1
  13. package/dist/auth/capability.js +5 -0
  14. package/dist/auth/capability.js.map +1 -1
  15. package/dist/auth/capabilityLifecycle.d.ts +1 -1
  16. package/dist/auth/capabilityLifecycle.d.ts.map +1 -1
  17. package/dist/auth/credentialPolicy.d.ts +1 -1
  18. package/dist/auth/credentialPolicy.d.ts.map +1 -1
  19. package/dist/auth/identity.d.ts +3 -3
  20. package/dist/auth/identity.d.ts.map +1 -1
  21. package/dist/auth/identity.js +5 -5
  22. package/dist/auth/identity.js.map +1 -1
  23. package/dist/auth/index.d.ts +4 -208
  24. package/dist/auth/index.d.ts.map +1 -1
  25. package/dist/auth/index.js +4 -330
  26. package/dist/auth/index.js.map +1 -1
  27. package/dist/auth/runtime.d.ts +218 -0
  28. package/dist/auth/runtime.d.ts.map +1 -0
  29. package/dist/auth/runtime.js +336 -0
  30. package/dist/auth/runtime.js.map +1 -0
  31. package/dist/auth/sessionMint.d.ts +1 -1
  32. package/dist/auth/sessionMint.d.ts.map +1 -1
  33. package/dist/auth/sessionMint.js +2 -1
  34. package/dist/auth/sessionMint.js.map +1 -1
  35. package/dist/branches.d.ts +25 -21
  36. package/dist/branches.d.ts.map +1 -1
  37. package/dist/branches.js +3 -0
  38. package/dist/branches.js.map +1 -1
  39. package/dist/{coordination/awaitClaimGrant.d.ts → claims/awaitGrant.d.ts} +1 -1
  40. package/dist/claims/awaitGrant.d.ts.map +1 -0
  41. package/dist/{coordination/awaitClaimGrant.js → claims/awaitGrant.js} +4 -4
  42. package/dist/claims/awaitGrant.js.map +1 -0
  43. package/dist/{wire/claims.d.ts → claims/contract.d.ts} +1 -1
  44. package/dist/claims/contract.d.ts.map +1 -0
  45. package/dist/{wire/claims.js → claims/contract.js} +2 -2
  46. package/dist/claims/contract.js.map +1 -0
  47. package/dist/{wire/claimEvent.d.ts → claims/eventContract.d.ts} +1 -1
  48. package/dist/claims/eventContract.d.ts.map +1 -0
  49. package/dist/{wire/claimEvent.js → claims/eventContract.js} +1 -1
  50. package/dist/claims/eventContract.js.map +1 -0
  51. package/dist/{coordination → claims}/events.d.ts +7 -11
  52. package/dist/claims/events.d.ts.map +1 -0
  53. package/dist/claims/events.js +8 -0
  54. package/dist/claims/events.js.map +1 -0
  55. package/dist/{coordination/claimHeartbeatLoop.d.ts → claims/heartbeat.d.ts} +1 -1
  56. package/dist/claims/heartbeat.d.ts.map +1 -0
  57. package/dist/{coordination/claimHeartbeatLoop.js → claims/heartbeat.js} +1 -1
  58. package/dist/claims/heartbeat.js.map +1 -0
  59. package/dist/claims/index.d.ts +17 -0
  60. package/dist/claims/index.d.ts.map +1 -0
  61. package/dist/claims/index.js +16 -0
  62. package/dist/claims/index.js.map +1 -0
  63. package/dist/claims/lifetime.d.ts +26 -0
  64. package/dist/claims/lifetime.d.ts.map +1 -0
  65. package/dist/claims/lifetime.js +62 -0
  66. package/dist/claims/lifetime.js.map +1 -0
  67. package/dist/{coordination → claims}/locator.d.ts +1 -1
  68. package/dist/claims/locator.d.ts.map +1 -0
  69. package/dist/{coordination → claims}/locator.js +2 -2
  70. package/dist/claims/locator.js.map +1 -0
  71. package/dist/{coordination/claimMeta.d.ts → claims/meta.d.ts} +1 -1
  72. package/dist/claims/meta.d.ts.map +1 -0
  73. package/dist/{coordination/claimMeta.js → claims/meta.js} +1 -1
  74. package/dist/claims/meta.js.map +1 -0
  75. package/dist/claims/routes.d.ts +59 -0
  76. package/dist/claims/routes.d.ts.map +1 -0
  77. package/dist/claims/routes.js +69 -0
  78. package/dist/claims/routes.js.map +1 -0
  79. package/dist/claims/targetConflict.d.ts.map +1 -0
  80. package/dist/claims/targetConflict.js.map +1 -0
  81. package/dist/{coordination → claims}/trace.d.ts +2 -2
  82. package/dist/claims/trace.d.ts.map +1 -0
  83. package/dist/{coordination → claims}/trace.js +5 -5
  84. package/dist/claims/trace.js.map +1 -0
  85. package/dist/{ablo.d.ts → client/ablo.d.ts} +8 -18
  86. package/dist/client/ablo.d.ts.map +1 -0
  87. package/dist/{ablo.js → client/ablo.js} +2 -2
  88. package/dist/client/ablo.js.map +1 -0
  89. package/dist/{transactionLayer.d.ts → client/contract.d.ts} +12 -14
  90. package/dist/client/contract.d.ts.map +1 -0
  91. package/dist/{transactionLayer.js → client/contract.js} +4 -5
  92. package/dist/client/contract.js.map +1 -0
  93. package/dist/{headlessClient.d.ts → client/headless.d.ts} +4 -4
  94. package/dist/client/headless.d.ts.map +1 -0
  95. package/dist/{headlessClient.js → client/headless.js} +8 -10
  96. package/dist/{headlessClient.js.map → client/headless.js.map} +1 -1
  97. package/dist/client/index.d.ts +11 -0
  98. package/dist/client/index.d.ts.map +1 -0
  99. package/dist/client/index.js +11 -0
  100. package/dist/client/index.js.map +1 -0
  101. package/dist/{resources → client/resources}/functionalUpdate.d.ts +4 -4
  102. package/dist/client/resources/functionalUpdate.d.ts.map +1 -0
  103. package/dist/{resources → client/resources}/functionalUpdate.js +3 -3
  104. package/dist/client/resources/functionalUpdate.js.map +1 -0
  105. package/dist/{resources → client/resources}/httpResources.d.ts +51 -57
  106. package/dist/client/resources/httpResources.d.ts.map +1 -0
  107. package/dist/{resources → client/resources}/httpResources.js +1 -1
  108. package/dist/client/resources/httpResources.js.map +1 -0
  109. package/dist/{resources → client/resources}/modelCreate.d.ts +1 -1
  110. package/dist/client/resources/modelCreate.d.ts.map +1 -0
  111. package/dist/{resources → client/resources}/modelCreate.js +1 -1
  112. package/dist/client/resources/modelCreate.js.map +1 -0
  113. package/dist/{resources → client/resources}/modelOperations.d.ts +35 -51
  114. package/dist/client/resources/modelOperations.d.ts.map +1 -0
  115. package/dist/{resources → client/resources}/modelOperations.js +1 -1
  116. package/dist/client/resources/modelOperations.js.map +1 -0
  117. package/dist/{resources → client/resources}/mutationOptions.d.ts +4 -17
  118. package/dist/client/resources/mutationOptions.d.ts.map +1 -0
  119. package/dist/client/resources/mutationOptions.js.map +1 -0
  120. package/dist/client/resources/where.d.ts.map +1 -0
  121. package/dist/{resources → client/resources}/where.js +1 -1
  122. package/dist/client/resources/where.js.map +1 -0
  123. package/dist/{resources → client/resources}/writeOptionsSchema.d.ts +2 -35
  124. package/dist/client/resources/writeOptionsSchema.d.ts.map +1 -0
  125. package/dist/{resources → client/resources}/writeOptionsSchema.js +5 -18
  126. package/dist/client/resources/writeOptionsSchema.js.map +1 -0
  127. package/dist/client/surface.d.ts +15 -0
  128. package/dist/client/surface.d.ts.map +1 -0
  129. package/dist/client/surface.js +29 -0
  130. package/dist/client/surface.js.map +1 -0
  131. package/dist/{transactions → commit}/confirmation/commitEnvelope.d.ts +1 -37
  132. package/dist/commit/confirmation/commitEnvelope.d.ts.map +1 -0
  133. package/dist/{transactions → commit}/confirmation/commitEnvelope.js +2 -7
  134. package/dist/commit/confirmation/commitEnvelope.js.map +1 -0
  135. package/dist/commit/confirmation/httpCommitEnvelope.d.ts.map +1 -0
  136. package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.js +1 -1
  137. package/dist/commit/confirmation/httpCommitEnvelope.js.map +1 -0
  138. package/dist/commit/confirmation/idempotencyKey.d.ts.map +1 -0
  139. package/dist/commit/confirmation/idempotencyKey.js.map +1 -0
  140. package/dist/{transactions → commit}/confirmation/pendingWrite.d.ts +2 -33
  141. package/dist/commit/confirmation/pendingWrite.d.ts.map +1 -0
  142. package/dist/{transactions → commit}/confirmation/pendingWrite.js +1 -1
  143. package/dist/commit/confirmation/pendingWrite.js.map +1 -0
  144. package/dist/commit/contract.d.ts +1404 -0
  145. package/dist/commit/contract.d.ts.map +1 -0
  146. package/dist/{wire/commit.js → commit/contract.js} +13 -20
  147. package/dist/commit/contract.js.map +1 -0
  148. package/dist/{durableWrites.d.ts → commit/durableWrites.d.ts} +6 -6
  149. package/dist/commit/durableWrites.d.ts.map +1 -0
  150. package/dist/{durableWrites.js → commit/durableWrites.js} +5 -5
  151. package/dist/commit/durableWrites.js.map +1 -0
  152. package/dist/{transport/httpCommitRequest.d.ts → commit/httpRequest.d.ts} +6 -6
  153. package/dist/commit/httpRequest.d.ts.map +1 -0
  154. package/dist/{transport/httpCommitRequest.js → commit/httpRequest.js} +2 -3
  155. package/dist/commit/httpRequest.js.map +1 -0
  156. package/dist/commit/index.d.ts +17 -0
  157. package/dist/commit/index.d.ts.map +1 -0
  158. package/dist/commit/index.js +17 -0
  159. package/dist/commit/index.js.map +1 -0
  160. package/dist/{readSetContext.d.ts → commit/readSetContext.d.ts} +7 -15
  161. package/dist/commit/readSetContext.d.ts.map +1 -0
  162. package/dist/{readSetContext.js → commit/readSetContext.js} +10 -25
  163. package/dist/commit/readSetContext.js.map +1 -0
  164. package/dist/{commitRecordRuntime.d.ts → commit/recordRuntime.d.ts} +3 -5
  165. package/dist/commit/recordRuntime.d.ts.map +1 -0
  166. package/dist/{commitRecordRuntime.js → commit/recordRuntime.js} +13 -54
  167. package/dist/commit/recordRuntime.js.map +1 -0
  168. package/dist/coordination/index.d.ts +6 -8
  169. package/dist/coordination/index.d.ts.map +1 -1
  170. package/dist/coordination/index.js +3 -9
  171. package/dist/coordination/index.js.map +1 -1
  172. package/dist/coordination/schema.d.ts +11 -459
  173. package/dist/coordination/schema.d.ts.map +1 -1
  174. package/dist/coordination/schema.js +13 -261
  175. package/dist/coordination/schema.js.map +1 -1
  176. package/dist/errorCodes.d.ts +15 -9
  177. package/dist/errorCodes.d.ts.map +1 -1
  178. package/dist/errorCodes.js +13 -6
  179. package/dist/errorCodes.js.map +1 -1
  180. package/dist/errorObservation.d.ts +2 -2
  181. package/dist/errors.d.ts +3 -2
  182. package/dist/errors.d.ts.map +1 -1
  183. package/dist/errors.js +27 -11
  184. package/dist/errors.js.map +1 -1
  185. package/dist/index.d.ts +7 -7
  186. package/dist/index.d.ts.map +1 -1
  187. package/dist/index.js +3 -3
  188. package/dist/index.js.map +1 -1
  189. package/dist/internal/read-set.d.ts +3 -3
  190. package/dist/internal/read-set.d.ts.map +1 -1
  191. package/dist/internal/read-set.js +2 -2
  192. package/dist/internal/read-set.js.map +1 -1
  193. package/dist/observability.d.ts +4 -4
  194. package/dist/observability.d.ts.map +1 -1
  195. package/dist/observability.js +2 -2
  196. package/dist/{wire/delta.d.ts → observation/contract.d.ts} +8 -8
  197. package/dist/observation/contract.d.ts.map +1 -0
  198. package/dist/{wire/delta.js → observation/contract.js} +3 -3
  199. package/dist/observation/contract.js.map +1 -0
  200. package/dist/{wire/feedCursor.d.ts → observation/cursor.d.ts} +1 -1
  201. package/dist/observation/cursor.d.ts.map +1 -0
  202. package/dist/{wire/feedCursor.js → observation/cursor.js} +1 -1
  203. package/dist/observation/cursor.js.map +1 -0
  204. package/dist/{wire/deltaDelivery.d.ts → observation/deliveryContract.d.ts} +1 -1
  205. package/dist/observation/deliveryContract.d.ts.map +1 -0
  206. package/dist/{wire/deltaDelivery.js → observation/deliveryContract.js} +1 -1
  207. package/dist/observation/deliveryContract.js.map +1 -0
  208. package/dist/{wire/feedEvent.d.ts → observation/feedContract.d.ts} +10 -10
  209. package/dist/observation/feedContract.d.ts.map +1 -0
  210. package/dist/{wire/feedEvent.js → observation/feedContract.js} +4 -4
  211. package/dist/observation/feedContract.js.map +1 -0
  212. package/dist/observation/httpFeed.d.ts +4 -0
  213. package/dist/observation/httpFeed.d.ts.map +1 -0
  214. package/dist/{transport → observation}/httpFeed.js +1 -1
  215. package/dist/{transport → observation}/httpFeed.js.map +1 -1
  216. package/dist/observation/index.d.ts +13 -0
  217. package/dist/observation/index.d.ts.map +1 -0
  218. package/dist/observation/index.js +13 -0
  219. package/dist/observation/index.js.map +1 -0
  220. package/dist/{log → observation/persistence}/syncDeltaRow.d.ts +8 -8
  221. package/dist/observation/persistence/syncDeltaRow.d.ts.map +1 -0
  222. package/dist/{log → observation/persistence}/syncDeltaRow.js +4 -4
  223. package/dist/observation/persistence/syncDeltaRow.js.map +1 -0
  224. package/dist/pricing.d.ts +26 -12
  225. package/dist/pricing.d.ts.map +1 -1
  226. package/dist/pricing.js +61 -27
  227. package/dist/pricing.js.map +1 -1
  228. package/dist/schema/ddl.d.ts.map +1 -1
  229. package/dist/schema/ddl.js +1 -1
  230. package/dist/schema/ddl.js.map +1 -1
  231. package/dist/schema/deployment/backfill.d.ts +44 -0
  232. package/dist/schema/deployment/backfill.d.ts.map +1 -0
  233. package/dist/schema/deployment/backfill.js +57 -0
  234. package/dist/schema/deployment/backfill.js.map +1 -0
  235. package/dist/schema/deployment/contracts.d.ts +526 -0
  236. package/dist/schema/deployment/contracts.d.ts.map +1 -0
  237. package/dist/schema/deployment/contracts.js +77 -0
  238. package/dist/schema/deployment/contracts.js.map +1 -0
  239. package/dist/schema/deployment/fingerprint.d.ts +3 -0
  240. package/dist/schema/deployment/fingerprint.d.ts.map +1 -0
  241. package/dist/schema/deployment/fingerprint.js +18 -0
  242. package/dist/schema/deployment/fingerprint.js.map +1 -0
  243. package/dist/schema/deployment/index.d.ts +18 -0
  244. package/dist/schema/deployment/index.d.ts.map +1 -0
  245. package/dist/schema/deployment/index.js +71 -0
  246. package/dist/schema/deployment/index.js.map +1 -0
  247. package/dist/schema/deployment/postgresCatalog.d.ts +39 -0
  248. package/dist/schema/deployment/postgresCatalog.d.ts.map +1 -0
  249. package/dist/schema/deployment/postgresCatalog.js +86 -0
  250. package/dist/schema/deployment/postgresCatalog.js.map +1 -0
  251. package/dist/schema/deployment/reconcile.d.ts +20 -0
  252. package/dist/schema/deployment/reconcile.d.ts.map +1 -0
  253. package/dist/schema/deployment/reconcile.js +226 -0
  254. package/dist/schema/deployment/reconcile.js.map +1 -0
  255. package/dist/schema/deployment/sequence.d.ts +4 -0
  256. package/dist/schema/deployment/sequence.d.ts.map +1 -0
  257. package/dist/schema/deployment/sequence.js +71 -0
  258. package/dist/schema/deployment/sequence.js.map +1 -0
  259. package/dist/schema/index.d.ts +6 -6
  260. package/dist/schema/index.d.ts.map +1 -1
  261. package/dist/schema/index.js +8 -7
  262. package/dist/schema/index.js.map +1 -1
  263. package/dist/schema/model.d.ts +0 -27
  264. package/dist/schema/model.d.ts.map +1 -1
  265. package/dist/schema/model.js +0 -2
  266. package/dist/schema/model.js.map +1 -1
  267. package/dist/schema/openapi.d.ts.map +1 -1
  268. package/dist/schema/openapi.js +45 -6
  269. package/dist/schema/openapi.js.map +1 -1
  270. package/dist/schema/schema.d.ts +11 -3
  271. package/dist/schema/schema.d.ts.map +1 -1
  272. package/dist/schema/schema.js +9 -2
  273. package/dist/schema/schema.js.map +1 -1
  274. package/dist/schema/serialize.d.ts +1 -4
  275. package/dist/schema/serialize.d.ts.map +1 -1
  276. package/dist/schema/serialize.js +0 -4
  277. package/dist/schema/serialize.js.map +1 -1
  278. package/dist/schema/tenancy.d.ts +1 -1
  279. package/dist/server/adapter.d.ts +1 -1
  280. package/dist/server/adapter.d.ts.map +1 -1
  281. package/dist/server/commit.d.ts +6 -14
  282. package/dist/server/commit.d.ts.map +1 -1
  283. package/dist/server/index.d.ts +1 -1
  284. package/dist/server/index.d.ts.map +1 -1
  285. package/dist/server/index.js +1 -1
  286. package/dist/server/index.js.map +1 -1
  287. package/dist/server/storageMode.d.ts +1 -1
  288. package/dist/source/{adapter.d.ts → adapters/adapter.d.ts} +10 -4
  289. package/dist/source/adapters/adapter.d.ts.map +1 -0
  290. package/dist/source/adapters/adapter.js.map +1 -0
  291. package/dist/source/adapters/adapterFactory.d.ts.map +1 -0
  292. package/dist/source/{adapterFactory.js → adapters/adapterFactory.js} +1 -1
  293. package/dist/source/adapters/adapterFactory.js.map +1 -0
  294. package/dist/source/adapters/adapterProfile.d.ts.map +1 -0
  295. package/dist/source/adapters/adapterProfile.js.map +1 -0
  296. package/dist/source/{conformance.d.ts → adapters/conformance.d.ts} +1 -1
  297. package/dist/source/adapters/conformance.d.ts.map +1 -0
  298. package/dist/source/{conformance.js → adapters/conformance.js} +1 -1
  299. package/dist/source/adapters/conformance.js.map +1 -0
  300. package/dist/source/{contract.d.ts → adapters/contract.d.ts} +8 -77
  301. package/dist/source/adapters/contract.d.ts.map +1 -0
  302. package/dist/source/{contract.js → adapters/contract.js} +12 -57
  303. package/dist/source/adapters/contract.js.map +1 -0
  304. package/dist/source/adapters/drizzle.d.ts +1 -1
  305. package/dist/source/adapters/drizzle.d.ts.map +1 -1
  306. package/dist/source/adapters/drizzle.js +21 -23
  307. package/dist/source/adapters/drizzle.js.map +1 -1
  308. package/dist/source/adapters/idempotency.d.ts.map +1 -0
  309. package/dist/source/{idempotency.js → adapters/idempotency.js} +2 -2
  310. package/dist/source/adapters/idempotency.js.map +1 -0
  311. package/dist/source/adapters/index.d.ts +21 -0
  312. package/dist/source/adapters/index.d.ts.map +1 -0
  313. package/dist/source/adapters/index.js +21 -0
  314. package/dist/source/adapters/index.js.map +1 -0
  315. package/dist/source/adapters/kysely.d.ts +1 -1
  316. package/dist/source/adapters/kysely.d.ts.map +1 -1
  317. package/dist/source/adapters/kysely.js +18 -20
  318. package/dist/source/adapters/kysely.js.map +1 -1
  319. package/dist/source/adapters/kyselyMutationCore.d.ts +2 -2
  320. package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -1
  321. package/dist/source/adapters/kyselyMutationCore.js +1 -1
  322. package/dist/source/adapters/kyselyMutationCore.js.map +1 -1
  323. package/dist/source/adapters/memory.d.ts +3 -3
  324. package/dist/source/adapters/memory.d.ts.map +1 -1
  325. package/dist/source/adapters/memory.js +19 -7
  326. package/dist/source/adapters/memory.js.map +1 -1
  327. package/dist/source/adapters/migration.d.ts +8 -0
  328. package/dist/source/adapters/migration.d.ts.map +1 -0
  329. package/dist/source/adapters/migration.js +9 -0
  330. package/dist/source/adapters/migration.js.map +1 -0
  331. package/dist/source/{migrations.d.ts → adapters/migrations.d.ts} +3 -4
  332. package/dist/source/adapters/migrations.d.ts.map +1 -0
  333. package/dist/source/{migrations.js → adapters/migrations.js} +4 -52
  334. package/dist/source/adapters/migrations.js.map +1 -0
  335. package/dist/source/adapters/prisma.d.ts +1 -1
  336. package/dist/source/adapters/prisma.d.ts.map +1 -1
  337. package/dist/source/adapters/prisma.js +21 -28
  338. package/dist/source/adapters/prisma.js.map +1 -1
  339. package/dist/source/{subjectAuthorization.d.ts → adapters/subjectAuthorization.d.ts} +1 -1
  340. package/dist/source/adapters/subjectAuthorization.d.ts.map +1 -0
  341. package/dist/source/{subjectAuthorization.js → adapters/subjectAuthorization.js} +2 -2
  342. package/dist/source/adapters/subjectAuthorization.js.map +1 -0
  343. package/dist/source/{connector.d.ts → connector/client.d.ts} +6 -1
  344. package/dist/source/connector/client.d.ts.map +1 -0
  345. package/dist/source/{connector.js → connector/client.js} +28 -11
  346. package/dist/source/connector/client.js.map +1 -0
  347. package/dist/source/connector/index.d.ts +4 -0
  348. package/dist/source/connector/index.d.ts.map +1 -0
  349. package/dist/source/connector/index.js +4 -0
  350. package/dist/source/connector/index.js.map +1 -0
  351. package/dist/source/{connectorProtocol.d.ts → connector/protocol.d.ts} +8 -1
  352. package/dist/source/connector/protocol.d.ts.map +1 -0
  353. package/dist/source/{connectorProtocol.js → connector/protocol.js} +10 -3
  354. package/dist/source/connector/protocol.js.map +1 -0
  355. package/dist/source/delivery/index.d.ts +3 -0
  356. package/dist/source/delivery/index.d.ts.map +1 -0
  357. package/dist/source/delivery/index.js +3 -0
  358. package/dist/source/delivery/index.js.map +1 -0
  359. package/dist/source/{pushQueue.d.ts → delivery/pushQueue.d.ts} +1 -1
  360. package/dist/source/delivery/pushQueue.d.ts.map +1 -0
  361. package/dist/source/{pushQueue.js → delivery/pushQueue.js} +1 -1
  362. package/dist/source/delivery/pushQueue.js.map +1 -0
  363. package/dist/source/{factory.d.ts → endpoint/factory.d.ts} +3 -3
  364. package/dist/source/endpoint/factory.d.ts.map +1 -0
  365. package/dist/source/{factory.js → endpoint/factory.js} +9 -4
  366. package/dist/source/endpoint/factory.js.map +1 -0
  367. package/dist/source/endpoint/index.d.ts +5 -0
  368. package/dist/source/endpoint/index.d.ts.map +1 -0
  369. package/dist/source/endpoint/index.js +5 -0
  370. package/dist/source/endpoint/index.js.map +1 -0
  371. package/dist/source/{next.d.ts → endpoint/next.d.ts} +2 -2
  372. package/dist/source/endpoint/next.d.ts.map +1 -0
  373. package/dist/source/{next.js → endpoint/next.js} +1 -1
  374. package/dist/source/endpoint/next.js.map +1 -0
  375. package/dist/source/{signing.d.ts → endpoint/signing.d.ts} +1 -1
  376. package/dist/source/endpoint/signing.d.ts.map +1 -0
  377. package/dist/source/{signing.js → endpoint/signing.js} +1 -1
  378. package/dist/source/endpoint/signing.js.map +1 -0
  379. package/dist/source/index.d.ts +14 -12
  380. package/dist/source/index.d.ts.map +1 -1
  381. package/dist/source/index.js +13 -11
  382. package/dist/source/index.js.map +1 -1
  383. package/dist/source/outbox/contract.d.ts +50 -0
  384. package/dist/source/outbox/contract.d.ts.map +1 -0
  385. package/dist/source/outbox/contract.js +50 -0
  386. package/dist/source/outbox/contract.js.map +1 -0
  387. package/dist/source/outbox/envelope.d.ts +9 -0
  388. package/dist/source/outbox/envelope.d.ts.map +1 -0
  389. package/dist/source/outbox/envelope.js +36 -0
  390. package/dist/source/outbox/envelope.js.map +1 -0
  391. package/dist/source/outbox/index.d.ts +11 -0
  392. package/dist/source/outbox/index.d.ts.map +1 -0
  393. package/dist/source/outbox/index.js +11 -0
  394. package/dist/source/outbox/index.js.map +1 -0
  395. package/dist/source/outbox/migrations.d.ts +4 -0
  396. package/dist/source/outbox/migrations.d.ts.map +1 -0
  397. package/dist/source/outbox/migrations.js +67 -0
  398. package/dist/source/outbox/migrations.js.map +1 -0
  399. package/dist/source/outbox/retention.d.ts +3 -0
  400. package/dist/source/outbox/retention.d.ts.map +1 -0
  401. package/dist/source/outbox/retention.js +3 -0
  402. package/dist/source/outbox/retention.js.map +1 -0
  403. package/dist/source/types.d.ts +16 -17
  404. package/dist/source/types.d.ts.map +1 -1
  405. package/dist/source/types.js +1 -0
  406. package/dist/source/types.js.map +1 -1
  407. package/dist/syncLog/contract.d.ts +19 -2
  408. package/dist/syncLog/contract.d.ts.map +1 -1
  409. package/dist/syncLog/contract.js +19 -2
  410. package/dist/syncLog/contract.js.map +1 -1
  411. package/dist/transport/{credentialLifecycle.d.ts → connection/credentialLifecycle.d.ts} +3 -3
  412. package/dist/transport/connection/credentialLifecycle.d.ts.map +1 -0
  413. package/dist/transport/{credentialLifecycle.js → connection/credentialLifecycle.js} +2 -2
  414. package/dist/transport/connection/credentialLifecycle.js.map +1 -0
  415. package/dist/transport/connection/index.d.ts +5 -0
  416. package/dist/transport/connection/index.d.ts.map +1 -0
  417. package/dist/transport/connection/index.js +5 -0
  418. package/dist/transport/connection/index.js.map +1 -0
  419. package/dist/transport/{connectionManager.d.ts → connection/manager.d.ts} +13 -5
  420. package/dist/transport/connection/manager.d.ts.map +1 -0
  421. package/dist/transport/{connectionManager.js → connection/manager.js} +6 -4
  422. package/dist/transport/connection/manager.js.map +1 -0
  423. package/dist/transport/{networkProbe.d.ts → connection/networkProbe.d.ts} +2 -2
  424. package/dist/transport/connection/networkProbe.d.ts.map +1 -0
  425. package/dist/transport/{networkProbe.js → connection/networkProbe.js} +4 -4
  426. package/dist/transport/connection/networkProbe.js.map +1 -0
  427. package/dist/transport/{httpClient.d.ts → http/client.d.ts} +26 -45
  428. package/dist/transport/http/client.d.ts.map +1 -0
  429. package/dist/transport/{httpClient.js → http/client.js} +84 -124
  430. package/dist/transport/http/client.js.map +1 -0
  431. package/dist/transport/{httpTransportHelpers.d.ts → http/helpers.d.ts} +5 -5
  432. package/dist/transport/http/helpers.d.ts.map +1 -0
  433. package/dist/transport/{httpTransportHelpers.js → http/helpers.js} +5 -5
  434. package/dist/transport/http/helpers.js.map +1 -0
  435. package/dist/transport/http/index.d.ts +6 -0
  436. package/dist/transport/http/index.d.ts.map +1 -0
  437. package/dist/transport/http/index.js +6 -0
  438. package/dist/transport/http/index.js.map +1 -0
  439. package/dist/transport/{httpOptions.d.ts → http/options.d.ts} +7 -7
  440. package/dist/transport/{httpOptions.d.ts.map → http/options.d.ts.map} +1 -1
  441. package/dist/transport/{httpOptions.js → http/options.js} +1 -1
  442. package/dist/transport/http/options.js.map +1 -0
  443. package/dist/transport/http/subscription.d.ts +16 -0
  444. package/dist/transport/http/subscription.d.ts.map +1 -0
  445. package/dist/transport/http/subscription.js +146 -0
  446. package/dist/transport/http/subscription.js.map +1 -0
  447. package/dist/transport/{httpTransport.d.ts → http/transport.d.ts} +9 -6
  448. package/dist/transport/http/transport.d.ts.map +1 -0
  449. package/dist/transport/{httpTransport.js → http/transport.js} +95 -93
  450. package/dist/transport/http/transport.js.map +1 -0
  451. package/dist/transport/index.d.ts +8 -0
  452. package/dist/transport/index.d.ts.map +1 -0
  453. package/dist/transport/index.js +8 -0
  454. package/dist/transport/index.js.map +1 -0
  455. package/dist/transport/{commitFrames.d.ts → websocket/commitFrames.d.ts} +8 -20
  456. package/dist/transport/websocket/commitFrames.d.ts.map +1 -0
  457. package/dist/transport/{commitFrames.js → websocket/commitFrames.js} +6 -25
  458. package/dist/transport/websocket/commitFrames.js.map +1 -0
  459. package/dist/transport/{wsFrameHandlers.d.ts → websocket/frameHandlers.d.ts} +5 -5
  460. package/dist/transport/websocket/frameHandlers.d.ts.map +1 -0
  461. package/dist/transport/{wsFrameHandlers.js → websocket/frameHandlers.js} +10 -51
  462. package/dist/transport/websocket/frameHandlers.js.map +1 -0
  463. package/dist/transport/{heartbeat.d.ts → websocket/heartbeat.d.ts} +1 -1
  464. package/dist/transport/websocket/heartbeat.d.ts.map +1 -0
  465. package/dist/transport/{heartbeat.js → websocket/heartbeat.js} +2 -2
  466. package/dist/transport/websocket/heartbeat.js.map +1 -0
  467. package/dist/transport/websocket/index.d.ts +6 -0
  468. package/dist/transport/websocket/index.d.ts.map +1 -0
  469. package/dist/transport/websocket/index.js +6 -0
  470. package/dist/transport/websocket/index.js.map +1 -0
  471. package/dist/transport/{wsTransport.d.ts → websocket/transport.d.ts} +13 -25
  472. package/dist/transport/websocket/transport.d.ts.map +1 -0
  473. package/dist/transport/{wsTransport.js → websocket/transport.js} +14 -14
  474. package/dist/transport/websocket/transport.js.map +1 -0
  475. package/dist/types/index.d.ts +1 -1
  476. package/dist/types/index.d.ts.map +1 -1
  477. package/dist/types/streams.d.ts +8 -48
  478. package/dist/types/streams.d.ts.map +1 -1
  479. package/dist/types/streams.js +2 -2
  480. package/dist/wire/accountResponses.d.ts +4 -72
  481. package/dist/wire/accountResponses.d.ts.map +1 -1
  482. package/dist/wire/accountResponses.js +2 -10
  483. package/dist/wire/accountResponses.js.map +1 -1
  484. package/dist/wire/frames.d.ts +6 -83
  485. package/dist/wire/frames.d.ts.map +1 -1
  486. package/dist/wire/frames.js +4 -11
  487. package/dist/wire/frames.js.map +1 -1
  488. package/dist/wire/inboundFrames.d.ts +6 -131
  489. package/dist/wire/inboundFrames.d.ts.map +1 -1
  490. package/dist/wire/inboundFrames.js +3 -3
  491. package/dist/wire/inboundFrames.js.map +1 -1
  492. package/dist/wire/index.d.ts +17 -15
  493. package/dist/wire/index.d.ts.map +1 -1
  494. package/dist/wire/index.js +11 -8
  495. package/dist/wire/index.js.map +1 -1
  496. package/dist/wire/modelMutations.d.ts +1 -32
  497. package/dist/wire/modelMutations.d.ts.map +1 -1
  498. package/dist/wire/modelMutations.js +1 -8
  499. package/dist/wire/modelMutations.js.map +1 -1
  500. package/package.json +130 -10
  501. package/src/ai-sdk/modelTools.ts +5 -5
  502. package/src/ai-sdk/updateTool.ts +5 -7
  503. package/src/auth/capability.ts +5 -0
  504. package/src/auth/capabilityLifecycle.ts +1 -1
  505. package/src/auth/credentialPolicy.ts +1 -1
  506. package/src/auth/identity.ts +7 -7
  507. package/src/auth/index.ts +4 -663
  508. package/src/auth/runtime.ts +669 -0
  509. package/src/auth/sessionMint.ts +3 -2
  510. package/src/branches.ts +3 -0
  511. package/src/{coordination/awaitClaimGrant.ts → claims/awaitGrant.ts} +4 -4
  512. package/src/{wire/claims.ts → claims/contract.ts} +1 -1
  513. package/src/{coordination → claims}/events.ts +7 -11
  514. package/src/claims/index.ts +21 -0
  515. package/src/claims/lifetime.ts +78 -0
  516. package/src/{coordination → claims}/locator.ts +3 -3
  517. package/src/claims/routes.ts +81 -0
  518. package/src/{coordination → claims}/trace.ts +5 -5
  519. package/src/{ablo.ts → client/ablo.ts} +10 -22
  520. package/src/{transactionLayer.ts → client/contract.ts} +11 -13
  521. package/src/{headlessClient.ts → client/headless.ts} +13 -15
  522. package/src/client/index.ts +10 -0
  523. package/src/{resources → client/resources}/functionalUpdate.ts +4 -4
  524. package/src/{resources → client/resources}/httpResources.ts +48 -68
  525. package/src/{resources → client/resources}/modelCreate.ts +2 -2
  526. package/src/{resources → client/resources}/modelOperations.ts +46 -55
  527. package/src/{resources → client/resources}/mutationOptions.ts +4 -17
  528. package/src/{resources → client/resources}/where.ts +1 -1
  529. package/src/{resources → client/resources}/writeOptionsSchema.ts +7 -27
  530. package/src/client/surface.ts +50 -0
  531. package/src/{transactions → commit}/confirmation/commitEnvelope.ts +2 -12
  532. package/src/{transactions → commit}/confirmation/httpCommitEnvelope.ts +1 -1
  533. package/src/{transactions → commit}/confirmation/pendingWrite.ts +1 -1
  534. package/src/{wire/commit.ts → commit/contract.ts} +11 -25
  535. package/src/{durableWrites.ts → commit/durableWrites.ts} +7 -7
  536. package/src/{transport/httpCommitRequest.ts → commit/httpRequest.ts} +6 -7
  537. package/src/commit/index.ts +16 -0
  538. package/src/{readSetContext.ts → commit/readSetContext.ts} +16 -41
  539. package/src/{commitRecordRuntime.ts → commit/recordRuntime.ts} +12 -67
  540. package/src/coordination/index.ts +4 -52
  541. package/src/coordination/schema.ts +15 -302
  542. package/src/errorCodes.ts +56 -10
  543. package/src/errors.ts +32 -10
  544. package/src/index.ts +8 -8
  545. package/src/internal/read-set.ts +3 -6
  546. package/src/observability.ts +4 -4
  547. package/src/{wire/delta.ts → observation/contract.ts} +2 -2
  548. package/src/{wire/feedEvent.ts → observation/feedContract.ts} +3 -4
  549. package/src/{transport → observation}/httpFeed.ts +3 -3
  550. package/src/observation/index.ts +12 -0
  551. package/src/{log → observation/persistence}/syncDeltaRow.ts +6 -7
  552. package/src/pricing.ts +61 -26
  553. package/src/schema/ddl.ts +3 -1
  554. package/src/schema/deployment/backfill.ts +88 -0
  555. package/src/schema/deployment/contracts.ts +119 -0
  556. package/src/schema/deployment/fingerprint.ts +13 -0
  557. package/src/schema/deployment/index.ts +81 -0
  558. package/src/schema/deployment/postgresCatalog.ts +131 -0
  559. package/src/schema/deployment/reconcile.ts +219 -0
  560. package/src/schema/deployment/sequence.ts +85 -0
  561. package/src/schema/index.ts +9 -20
  562. package/src/schema/model.ts +0 -33
  563. package/src/schema/openapi.ts +47 -7
  564. package/src/schema/schema.ts +23 -3
  565. package/src/schema/serialize.ts +0 -8
  566. package/src/server/adapter.ts +1 -1
  567. package/src/server/commit.ts +6 -14
  568. package/src/server/index.ts +1 -1
  569. package/src/source/{adapter.ts → adapters/adapter.ts} +9 -5
  570. package/src/source/{adapterFactory.ts → adapters/adapterFactory.ts} +1 -1
  571. package/src/source/{conformance.ts → adapters/conformance.ts} +1 -1
  572. package/src/source/{contract.ts → adapters/contract.ts} +16 -64
  573. package/src/source/adapters/drizzle.ts +29 -27
  574. package/src/source/{idempotency.ts → adapters/idempotency.ts} +2 -2
  575. package/src/source/adapters/index.ts +20 -0
  576. package/src/source/adapters/kysely.ts +32 -25
  577. package/src/source/adapters/kyselyMutationCore.ts +3 -3
  578. package/src/source/adapters/memory.ts +25 -9
  579. package/src/source/adapters/migration.ts +11 -0
  580. package/src/source/{migrations.ts → adapters/migrations.ts} +6 -54
  581. package/src/source/adapters/prisma.ts +33 -32
  582. package/src/source/{subjectAuthorization.ts → adapters/subjectAuthorization.ts} +2 -2
  583. package/src/source/{connector.ts → connector/client.ts} +35 -12
  584. package/src/source/connector/index.ts +3 -0
  585. package/src/source/{connectorProtocol.ts → connector/protocol.ts} +10 -2
  586. package/src/source/delivery/index.ts +2 -0
  587. package/src/source/{pushQueue.ts → delivery/pushQueue.ts} +2 -2
  588. package/src/source/{factory.ts → endpoint/factory.ts} +13 -8
  589. package/src/source/endpoint/index.ts +4 -0
  590. package/src/source/{next.ts → endpoint/next.ts} +2 -2
  591. package/src/source/{signing.ts → endpoint/signing.ts} +1 -1
  592. package/src/source/index.ts +22 -19
  593. package/src/source/outbox/contract.ts +56 -0
  594. package/src/source/outbox/envelope.ts +47 -0
  595. package/src/source/outbox/index.ts +15 -0
  596. package/src/source/outbox/migrations.ts +71 -0
  597. package/src/source/outbox/retention.ts +2 -0
  598. package/src/source/types.ts +17 -17
  599. package/src/syncLog/contract.ts +19 -2
  600. package/src/transport/{credentialLifecycle.ts → connection/credentialLifecycle.ts} +3 -3
  601. package/src/transport/connection/index.ts +4 -0
  602. package/src/transport/{connectionManager.ts → connection/manager.ts} +13 -4
  603. package/src/transport/{networkProbe.ts → connection/networkProbe.ts} +4 -4
  604. package/src/transport/{httpClient.ts → http/client.ts} +128 -209
  605. package/src/transport/{httpTransportHelpers.ts → http/helpers.ts} +7 -7
  606. package/src/transport/http/index.ts +5 -0
  607. package/src/transport/{httpOptions.ts → http/options.ts} +6 -6
  608. package/src/transport/http/subscription.ts +174 -0
  609. package/src/transport/{httpTransport.ts → http/transport.ts} +127 -113
  610. package/src/transport/index.ts +7 -0
  611. package/src/transport/{commitFrames.ts → websocket/commitFrames.ts} +14 -46
  612. package/src/transport/{wsFrameHandlers.ts → websocket/frameHandlers.ts} +11 -54
  613. package/src/transport/{heartbeat.ts → websocket/heartbeat.ts} +2 -2
  614. package/src/transport/websocket/index.ts +5 -0
  615. package/src/transport/{wsTransport.ts → websocket/transport.ts} +16 -30
  616. package/src/types/index.ts +2 -6
  617. package/src/types/streams.ts +7 -61
  618. package/src/webhooks/events.ts +1 -1
  619. package/src/wire/accountResponses.ts +3 -12
  620. package/src/wire/frames.ts +5 -15
  621. package/src/wire/inboundFrames.ts +3 -3
  622. package/src/wire/index.ts +19 -15
  623. package/src/wire/modelMutations.ts +1 -14
  624. package/dist/ablo.d.ts.map +0 -1
  625. package/dist/ablo.js.map +0 -1
  626. package/dist/commitRecordRuntime.d.ts.map +0 -1
  627. package/dist/commitRecordRuntime.js.map +0 -1
  628. package/dist/coordination/awaitClaimGrant.d.ts.map +0 -1
  629. package/dist/coordination/awaitClaimGrant.js.map +0 -1
  630. package/dist/coordination/claimHeartbeatLoop.d.ts.map +0 -1
  631. package/dist/coordination/claimHeartbeatLoop.js.map +0 -1
  632. package/dist/coordination/claimMeta.d.ts.map +0 -1
  633. package/dist/coordination/claimMeta.js.map +0 -1
  634. package/dist/coordination/events.d.ts.map +0 -1
  635. package/dist/coordination/events.js +0 -8
  636. package/dist/coordination/events.js.map +0 -1
  637. package/dist/coordination/locator.d.ts.map +0 -1
  638. package/dist/coordination/locator.js.map +0 -1
  639. package/dist/coordination/targetConflict.d.ts.map +0 -1
  640. package/dist/coordination/targetConflict.js.map +0 -1
  641. package/dist/coordination/trace.d.ts.map +0 -1
  642. package/dist/coordination/trace.js.map +0 -1
  643. package/dist/durableWrites.d.ts.map +0 -1
  644. package/dist/durableWrites.js.map +0 -1
  645. package/dist/headlessClient.d.ts.map +0 -1
  646. package/dist/log/syncDeltaRow.d.ts.map +0 -1
  647. package/dist/log/syncDeltaRow.js.map +0 -1
  648. package/dist/policy/types.d.ts +0 -226
  649. package/dist/policy/types.d.ts.map +0 -1
  650. package/dist/policy/types.js +0 -127
  651. package/dist/policy/types.js.map +0 -1
  652. package/dist/readSetContext.d.ts.map +0 -1
  653. package/dist/readSetContext.js.map +0 -1
  654. package/dist/resources/functionalUpdate.d.ts.map +0 -1
  655. package/dist/resources/functionalUpdate.js.map +0 -1
  656. package/dist/resources/httpResources.d.ts.map +0 -1
  657. package/dist/resources/httpResources.js.map +0 -1
  658. package/dist/resources/modelCreate.d.ts.map +0 -1
  659. package/dist/resources/modelCreate.js.map +0 -1
  660. package/dist/resources/modelOperations.d.ts.map +0 -1
  661. package/dist/resources/modelOperations.js.map +0 -1
  662. package/dist/resources/mutationOptions.d.ts.map +0 -1
  663. package/dist/resources/mutationOptions.js.map +0 -1
  664. package/dist/resources/where.d.ts.map +0 -1
  665. package/dist/resources/where.js.map +0 -1
  666. package/dist/resources/writeOptionsSchema.d.ts.map +0 -1
  667. package/dist/resources/writeOptionsSchema.js.map +0 -1
  668. package/dist/schema/coordination.d.ts +0 -113
  669. package/dist/schema/coordination.d.ts.map +0 -1
  670. package/dist/schema/coordination.js +0 -134
  671. package/dist/schema/coordination.js.map +0 -1
  672. package/dist/source/adapter.d.ts.map +0 -1
  673. package/dist/source/adapter.js.map +0 -1
  674. package/dist/source/adapterFactory.d.ts.map +0 -1
  675. package/dist/source/adapterFactory.js.map +0 -1
  676. package/dist/source/adapterProfile.d.ts.map +0 -1
  677. package/dist/source/adapterProfile.js.map +0 -1
  678. package/dist/source/conformance.d.ts.map +0 -1
  679. package/dist/source/conformance.js.map +0 -1
  680. package/dist/source/connector.d.ts.map +0 -1
  681. package/dist/source/connector.js.map +0 -1
  682. package/dist/source/connectorProtocol.d.ts.map +0 -1
  683. package/dist/source/connectorProtocol.js.map +0 -1
  684. package/dist/source/contract.d.ts.map +0 -1
  685. package/dist/source/contract.js.map +0 -1
  686. package/dist/source/drizzle.d.ts +0 -2
  687. package/dist/source/drizzle.d.ts.map +0 -1
  688. package/dist/source/drizzle.js +0 -2
  689. package/dist/source/drizzle.js.map +0 -1
  690. package/dist/source/factory.d.ts.map +0 -1
  691. package/dist/source/factory.js.map +0 -1
  692. package/dist/source/idempotency.d.ts.map +0 -1
  693. package/dist/source/idempotency.js.map +0 -1
  694. package/dist/source/kysely.d.ts +0 -3
  695. package/dist/source/kysely.d.ts.map +0 -1
  696. package/dist/source/kysely.js +0 -3
  697. package/dist/source/kysely.js.map +0 -1
  698. package/dist/source/migrations.d.ts.map +0 -1
  699. package/dist/source/migrations.js.map +0 -1
  700. package/dist/source/next.d.ts.map +0 -1
  701. package/dist/source/next.js.map +0 -1
  702. package/dist/source/pushQueue.d.ts.map +0 -1
  703. package/dist/source/pushQueue.js.map +0 -1
  704. package/dist/source/signing.d.ts.map +0 -1
  705. package/dist/source/signing.js.map +0 -1
  706. package/dist/source/subjectAuthorization.d.ts.map +0 -1
  707. package/dist/source/subjectAuthorization.js.map +0 -1
  708. package/dist/transactionLayer.d.ts.map +0 -1
  709. package/dist/transactionLayer.js.map +0 -1
  710. package/dist/transactions/confirmation/commitEnvelope.d.ts.map +0 -1
  711. package/dist/transactions/confirmation/commitEnvelope.js.map +0 -1
  712. package/dist/transactions/confirmation/httpCommitEnvelope.d.ts.map +0 -1
  713. package/dist/transactions/confirmation/httpCommitEnvelope.js.map +0 -1
  714. package/dist/transactions/confirmation/idempotencyKey.d.ts.map +0 -1
  715. package/dist/transactions/confirmation/idempotencyKey.js.map +0 -1
  716. package/dist/transactions/confirmation/pendingWrite.d.ts.map +0 -1
  717. package/dist/transactions/confirmation/pendingWrite.js.map +0 -1
  718. package/dist/transport/commitFrames.d.ts.map +0 -1
  719. package/dist/transport/commitFrames.js.map +0 -1
  720. package/dist/transport/connectionManager.d.ts.map +0 -1
  721. package/dist/transport/connectionManager.js.map +0 -1
  722. package/dist/transport/credentialLifecycle.d.ts.map +0 -1
  723. package/dist/transport/credentialLifecycle.js.map +0 -1
  724. package/dist/transport/heartbeat.d.ts.map +0 -1
  725. package/dist/transport/heartbeat.js.map +0 -1
  726. package/dist/transport/httpClient.d.ts.map +0 -1
  727. package/dist/transport/httpClient.js.map +0 -1
  728. package/dist/transport/httpCommitRequest.d.ts.map +0 -1
  729. package/dist/transport/httpCommitRequest.js.map +0 -1
  730. package/dist/transport/httpFeed.d.ts +0 -4
  731. package/dist/transport/httpFeed.d.ts.map +0 -1
  732. package/dist/transport/httpOptions.js.map +0 -1
  733. package/dist/transport/httpTransport.d.ts.map +0 -1
  734. package/dist/transport/httpTransport.js.map +0 -1
  735. package/dist/transport/httpTransportHelpers.d.ts.map +0 -1
  736. package/dist/transport/httpTransportHelpers.js.map +0 -1
  737. package/dist/transport/networkProbe.d.ts.map +0 -1
  738. package/dist/transport/networkProbe.js.map +0 -1
  739. package/dist/transport/wsFrameHandlers.d.ts.map +0 -1
  740. package/dist/transport/wsFrameHandlers.js.map +0 -1
  741. package/dist/transport/wsTransport.d.ts.map +0 -1
  742. package/dist/transport/wsTransport.js.map +0 -1
  743. package/dist/wire/claimEvent.d.ts.map +0 -1
  744. package/dist/wire/claimEvent.js.map +0 -1
  745. package/dist/wire/claims.d.ts.map +0 -1
  746. package/dist/wire/claims.js.map +0 -1
  747. package/dist/wire/commit.d.ts +0 -2866
  748. package/dist/wire/commit.d.ts.map +0 -1
  749. package/dist/wire/commit.js.map +0 -1
  750. package/dist/wire/delta.d.ts.map +0 -1
  751. package/dist/wire/delta.js.map +0 -1
  752. package/dist/wire/deltaDelivery.d.ts.map +0 -1
  753. package/dist/wire/deltaDelivery.js.map +0 -1
  754. package/dist/wire/feedCursor.d.ts.map +0 -1
  755. package/dist/wire/feedCursor.js.map +0 -1
  756. package/dist/wire/feedEvent.d.ts.map +0 -1
  757. package/dist/wire/feedEvent.js.map +0 -1
  758. package/src/policy/types.ts +0 -300
  759. package/src/schema/coordination.ts +0 -161
  760. package/src/source/drizzle.ts +0 -1
  761. package/src/source/kysely.ts +0 -2
  762. /package/dist/{coordination → claims}/targetConflict.d.ts +0 -0
  763. /package/dist/{coordination → claims}/targetConflict.js +0 -0
  764. /package/dist/{resources → client/resources}/mutationOptions.js +0 -0
  765. /package/dist/{resources → client/resources}/where.d.ts +0 -0
  766. /package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.d.ts +0 -0
  767. /package/dist/{transactions → commit}/confirmation/idempotencyKey.d.ts +0 -0
  768. /package/dist/{transactions → commit}/confirmation/idempotencyKey.js +0 -0
  769. /package/dist/source/{adapter.js → adapters/adapter.js} +0 -0
  770. /package/dist/source/{adapterFactory.d.ts → adapters/adapterFactory.d.ts} +0 -0
  771. /package/dist/source/{adapterProfile.d.ts → adapters/adapterProfile.d.ts} +0 -0
  772. /package/dist/source/{adapterProfile.js → adapters/adapterProfile.js} +0 -0
  773. /package/dist/source/{idempotency.d.ts → adapters/idempotency.d.ts} +0 -0
  774. /package/src/{wire/claimEvent.ts → claims/eventContract.ts} +0 -0
  775. /package/src/{coordination/claimHeartbeatLoop.ts → claims/heartbeat.ts} +0 -0
  776. /package/src/{coordination/claimMeta.ts → claims/meta.ts} +0 -0
  777. /package/src/{coordination → claims}/targetConflict.ts +0 -0
  778. /package/src/{transactions → commit}/confirmation/idempotencyKey.ts +0 -0
  779. /package/src/{wire/feedCursor.ts → observation/cursor.ts} +0 -0
  780. /package/src/{wire/deltaDelivery.ts → observation/deliveryContract.ts} +0 -0
  781. /package/src/source/{adapterProfile.ts → adapters/adapterProfile.ts} +0 -0
@@ -0,0 +1,131 @@
1
+ import type { DatabaseTableSnapshot } from './contracts.js';
2
+
3
+ export interface PostgresColumnCatalogRow {
4
+ tableName: string;
5
+ columnName: string;
6
+ dataType: string;
7
+ nullable: boolean;
8
+ defaultValue: string | null;
9
+ primary: boolean;
10
+ uniqueColumn: boolean;
11
+ rowLevelSecurity: boolean;
12
+ forceRowLevelSecurity: boolean;
13
+ replicaIdentity: string;
14
+ publicationMember: boolean;
15
+ }
16
+
17
+ export interface PostgresIndexCatalogRow {
18
+ tableName: string;
19
+ indexName: string;
20
+ columns: string[];
21
+ uniqueIndex: boolean;
22
+ valid: boolean;
23
+ ready: boolean;
24
+ predicate: string | null;
25
+ }
26
+
27
+ export interface PostgresForeignKeyCatalogRow {
28
+ tableName: string;
29
+ constraintName: string;
30
+ columns: string[];
31
+ referencedSchema: string;
32
+ referencedTable: string;
33
+ referencedColumns: string[];
34
+ validated: boolean;
35
+ }
36
+
37
+ export const POSTGRES_COLUMN_CATALOG_SQL = `
38
+ SELECT c.relname AS "tableName", a.attname AS "columnName",
39
+ format_type(a.atttypid, a.atttypmod) AS "dataType", NOT a.attnotnull AS nullable,
40
+ pg_get_expr(d.adbin, d.adrelid) AS "defaultValue",
41
+ EXISTS (SELECT 1 FROM pg_constraint k WHERE k.conrelid = c.oid AND k.contype = 'p' AND cardinality(k.conkey) = 1 AND a.attnum = ANY(k.conkey)) AS primary,
42
+ EXISTS (SELECT 1 FROM pg_constraint k WHERE k.conrelid = c.oid AND k.contype IN ('p','u') AND cardinality(k.conkey) = 1 AND a.attnum = ANY(k.conkey)) AS "uniqueColumn",
43
+ c.relrowsecurity AS "rowLevelSecurity", c.relforcerowsecurity AS "forceRowLevelSecurity",
44
+ c.relreplident::text AS "replicaIdentity",
45
+ EXISTS (SELECT 1 FROM pg_publication_tables p WHERE p.schemaname = n.nspname AND p.tablename = c.relname) AS "publicationMember"
46
+ FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace
47
+ JOIN pg_attribute a ON a.attrelid = c.oid AND a.attnum > 0 AND NOT a.attisdropped
48
+ LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = a.attnum
49
+ WHERE n.nspname = $1 AND c.relkind IN ('r','p') ORDER BY c.relname, a.attnum
50
+ `;
51
+
52
+ export const POSTGRES_INDEX_CATALOG_SQL = `
53
+ SELECT t.relname AS "tableName", i.relname AS "indexName",
54
+ ARRAY(SELECT a.attname FROM unnest(ix.indkey) WITH ORDINALITY keys(attnum, ord) JOIN pg_attribute a ON a.attrelid = t.oid AND a.attnum = keys.attnum ORDER BY keys.ord) AS columns,
55
+ ix.indisunique AS "uniqueIndex", ix.indisvalid AS valid, ix.indisready AS ready,
56
+ pg_get_expr(ix.indpred, ix.indrelid) AS predicate
57
+ FROM pg_index ix JOIN pg_class t ON t.oid = ix.indrelid JOIN pg_class i ON i.oid = ix.indexrelid
58
+ JOIN pg_namespace n ON n.oid = t.relnamespace WHERE n.nspname = $1 ORDER BY t.relname, i.relname
59
+ `;
60
+
61
+ export const POSTGRES_FOREIGN_KEY_CATALOG_SQL = `
62
+ SELECT t.relname AS "tableName", c.conname AS "constraintName",
63
+ ARRAY(SELECT a.attname FROM unnest(c.conkey) WITH ORDINALITY keys(attnum, ord) JOIN pg_attribute a ON a.attrelid = c.conrelid AND a.attnum = keys.attnum ORDER BY keys.ord) AS columns,
64
+ rn.nspname AS "referencedSchema", rt.relname AS "referencedTable",
65
+ ARRAY(SELECT a.attname FROM unnest(c.confkey) WITH ORDINALITY keys(attnum, ord) JOIN pg_attribute a ON a.attrelid = c.confrelid AND a.attnum = keys.attnum ORDER BY keys.ord) AS "referencedColumns",
66
+ c.convalidated AS validated
67
+ FROM pg_constraint c JOIN pg_class t ON t.oid = c.conrelid JOIN pg_namespace n ON n.oid = t.relnamespace
68
+ JOIN pg_class rt ON rt.oid = c.confrelid JOIN pg_namespace rn ON rn.oid = rt.relnamespace
69
+ WHERE c.contype = 'f' AND n.nspname = $1 ORDER BY t.relname, c.conname
70
+ `;
71
+
72
+ export function quotePostgresIdentifier(value: string): string {
73
+ return `"${value.replace(/"/g, '""')}"`;
74
+ }
75
+
76
+ export function postgresNullCountSql(appSchema: string, table: string, column: string): string {
77
+ const qualified = `${quotePostgresIdentifier(appSchema)}.${quotePostgresIdentifier(table)}`;
78
+ return `SELECT count(*)::int AS n FROM (SELECT 1 FROM ${qualified} WHERE ${quotePostgresIdentifier(column)} IS NULL LIMIT 501) unstamped`;
79
+ }
80
+
81
+ export function foldPostgresCatalog(
82
+ appSchema: string,
83
+ columns: readonly PostgresColumnCatalogRow[],
84
+ indexes: readonly PostgresIndexCatalogRow[],
85
+ foreignKeys: readonly PostgresForeignKeyCatalogRow[],
86
+ ): Record<string, DatabaseTableSnapshot> {
87
+ const tables: Record<string, DatabaseTableSnapshot> = {};
88
+ for (const row of columns) {
89
+ const table = tables[row.tableName] ?? {
90
+ schema: appSchema,
91
+ name: row.tableName,
92
+ columns: {},
93
+ indexes: [],
94
+ foreignKeys: [],
95
+ rowLevelSecurity: row.rowLevelSecurity,
96
+ forceRowLevelSecurity: row.forceRowLevelSecurity,
97
+ replicaIdentity: row.replicaIdentity,
98
+ publicationMember: row.publicationMember,
99
+ };
100
+ table.columns[row.columnName] = {
101
+ name: row.columnName,
102
+ dataType: row.dataType,
103
+ nullable: row.nullable,
104
+ default: row.defaultValue,
105
+ primary: row.primary,
106
+ unique: row.uniqueColumn,
107
+ };
108
+ tables[row.tableName] = table;
109
+ }
110
+ for (const row of indexes) {
111
+ tables[row.tableName]?.indexes?.push({
112
+ name: row.indexName,
113
+ columns: row.columns,
114
+ unique: row.uniqueIndex,
115
+ valid: row.valid,
116
+ ready: row.ready,
117
+ predicate: row.predicate,
118
+ });
119
+ }
120
+ for (const row of foreignKeys) {
121
+ tables[row.tableName]?.foreignKeys?.push({
122
+ name: row.constraintName,
123
+ columns: row.columns,
124
+ referencedSchema: row.referencedSchema,
125
+ referencedTable: row.referencedTable,
126
+ referencedColumns: row.referencedColumns,
127
+ validated: row.validated,
128
+ });
129
+ }
130
+ return tables;
131
+ }
@@ -0,0 +1,219 @@
1
+ import { auditSchemaAccessPolicies } from '../audit.js';
2
+ import { camelToSnake, sqlType } from '../ddl.js';
3
+ import { classifyMigration, diffSchema, unresolvedBlockers, type BackfillValue, type MigrationSignal, type MigrationStep, type RenameHints } from '../diff.js';
4
+ import type { ModelJSON, SchemaJSON } from '../serialize.js';
5
+ import { resolveTenancy, tenancyColumn } from '../tenancy.js';
6
+ import type { DatabaseSnapshot, DeploymentDirection, DeploymentFinding, DeploymentManifest } from './contracts.js';
7
+
8
+ const id = (...parts: readonly (string | undefined)[]): string => parts.filter(Boolean).join(':');
9
+
10
+ function signalFinding(signal: MigrationSignal, direction: DeploymentDirection): DeploymentFinding {
11
+ const destructive = ['drop_model', 'drop_field', 'risky_cast', 'lossy_recreate', 'enum_value_removed'].includes(signal.code);
12
+ return {
13
+ id: id(direction, signal.code, signal.model, signal.field), code: signal.code,
14
+ category: destructive ? 'destructive_contract' : 'data_movement', severity: destructive ? 'error' : 'blocker',
15
+ direction, phase: destructive ? 'contract' : 'backfill', owner: 'application_migration', model: signal.model,
16
+ ...(signal.field ? { field: signal.field } : {}), message: signal.detail,
17
+ action: destructive ? 'Schedule this contract change after compatibility and data verification pass.' : 'Provide and verify a backfill before making this field required.',
18
+ };
19
+ }
20
+
21
+ function stepFinding(step: MigrationStep): DeploymentFinding | null {
22
+ if (step.kind === 'drop_field' || step.kind === 'drop_model') return null;
23
+ if (step.kind === 'create_model') return {
24
+ id: id('source_to_active', step.kind, step.model), code: step.kind, category: 'compatibility', severity: 'info', direction: 'source_to_active',
25
+ phase: 'expand', owner: 'ablo', model: step.model, from: null, to: step.tableName,
26
+ message: `Model "${step.model}" is not active on the target plane.`, action: 'Expand its physical contract, then activate the candidate schema.',
27
+ };
28
+ if (step.kind === 'add_field') return {
29
+ id: id('source_to_active', step.kind, step.model, step.field), code: step.kind, category: 'compatibility', severity: step.meta.isOptional ? 'info' : 'blocker', direction: 'source_to_active',
30
+ phase: 'expand', owner: step.meta.isOptional ? 'ablo' : 'application_migration', model: step.model, field: step.field,
31
+ column: step.meta.column ?? camelToSnake(step.field), from: null, to: step.meta.type,
32
+ message: `Field "${step.model}.${step.field}" is not active on the target plane.`,
33
+ action: step.meta.isOptional ? 'Add the nullable column before activating the candidate schema.' : 'Add the column, backfill existing rows, verify it, then enforce the required contract.',
34
+ };
35
+ if (step.kind === 'rename_model') return {
36
+ id: id('source_to_active', step.kind, step.from, step.to), code: step.kind, category: 'compatibility', severity: 'warning', direction: 'source_to_active',
37
+ phase: 'dual_write', owner: 'application', model: step.to, from: step.from, to: step.to,
38
+ message: `Model "${step.from}" is renamed to "${step.to}".`, action: 'Verify the rename mapping and compatibility window before activation.',
39
+ };
40
+ if (step.kind === 'rename_field') return {
41
+ id: id('source_to_active', step.kind, step.model, step.from, step.to), code: step.kind, category: 'compatibility', severity: 'warning', direction: 'source_to_active',
42
+ phase: 'dual_write', owner: 'application', model: step.model, field: step.to, from: step.from, to: step.to,
43
+ message: `Field "${step.model}.${step.from}" is renamed to "${step.to}".`, action: 'Keep old and new readers/writers compatible through the rename window.',
44
+ };
45
+ return {
46
+ id: id('source_to_active', step.kind, step.model, step.field), code: step.kind, category: 'compatibility', severity: 'warning', direction: 'source_to_active',
47
+ phase: 'dual_write', owner: 'application_migration', model: step.model, field: step.field, from: step.changes,
48
+ message: `Field "${step.model}.${step.field}" changes shape.`, action: 'Apply the ordered physical and compatibility changes, then verify old and current clients.',
49
+ };
50
+ }
51
+
52
+ export function reconcileSourceToActive(active: SchemaJSON | null, source: SchemaJSON, hints: RenameHints = {}, backfills: readonly BackfillValue[] = []): readonly DeploymentFinding[] {
53
+ return reconcileSourceToActiveResult(active, source, hints, backfills).findings;
54
+ }
55
+
56
+ export function reconcileSourceToActiveResult(active: SchemaJSON | null, source: SchemaJSON, hints: RenameHints = {}, backfills: readonly BackfillValue[] = []): { operations: readonly MigrationStep[]; findings: readonly DeploymentFinding[] } {
57
+ const steps = diffSchema(active, source, hints);
58
+ const classification = classifyMigration(steps);
59
+ const signals = [...unresolvedBlockers(classification, backfills), ...classification.warnings].map((signal) => signalFinding(signal, 'source_to_active'));
60
+ const signalLocations = new Set(signals.map(({ model, field }) => `${model}:${field ?? ''}`));
61
+ const ordinary = steps
62
+ .map(stepFinding)
63
+ .filter((finding): finding is DeploymentFinding => finding !== null)
64
+ .filter((finding) => !signalLocations.has(`${finding.model}:${finding.field ?? ''}`))
65
+ .map((finding) => {
66
+ const hasBackfill = finding.model !== undefined && finding.field !== undefined &&
67
+ backfills.some((backfill) => backfill.model === finding.model && backfill.field === finding.field);
68
+ return hasBackfill && finding.code === 'add_field' && finding.severity === 'blocker'
69
+ ? {
70
+ ...finding,
71
+ severity: 'info' as const,
72
+ phase: 'backfill' as const,
73
+ action: 'Run the declared backfill, verify it completed, then enforce the required contract.',
74
+ }
75
+ : finding;
76
+ });
77
+ return { operations: steps, findings: [...signals, ...ordinary] };
78
+ }
79
+
80
+ export function reconcilePolicyIntent(source: SchemaJSON): readonly DeploymentFinding[] {
81
+ return auditSchemaAccessPolicies(source).map((finding) => ({
82
+ id: id('policy', finding.code, finding.model), code: finding.code, category: 'policy_intent', severity: 'blocker', direction: 'source_to_active',
83
+ phase: 'intent', owner: 'application', model: finding.model, message: finding.message, action: finding.fix,
84
+ }));
85
+ }
86
+
87
+ function normalizePgType(value: string): string {
88
+ const type = value.toLowerCase();
89
+ if (type.includes('timestamp')) return 'TIMESTAMPTZ';
90
+ if (type === 'double precision' || type === 'numeric' || type === 'real' || type.includes('int')) return 'DOUBLE PRECISION';
91
+ if (type === 'boolean') return 'BOOLEAN';
92
+ if (type === 'json' || type === 'jsonb') return 'JSONB';
93
+ return 'TEXT';
94
+ }
95
+
96
+ function requiredColumns(model: ModelJSON): readonly { field?: string; column: string; type: string; nullable: boolean; primary: boolean }[] {
97
+ const orgColumn = tenancyColumn(resolveTenancy(model));
98
+ return [
99
+ { column: 'id', type: 'TEXT', nullable: false, primary: true },
100
+ ...(orgColumn ? [{ column: orgColumn, type: 'TEXT', nullable: false, primary: false }] : []),
101
+ ...Object.entries(model.fields).map(([field, meta]) => ({ field, column: meta.column ?? camelToSnake(field), type: sqlType(meta.type), nullable: meta.isOptional, primary: false })),
102
+ ];
103
+ }
104
+
105
+ function physicalFindings(schema: SchemaJSON, database: DatabaseSnapshot, direction: 'source_to_database' | 'active_to_database'): DeploymentFinding[] {
106
+ const findings: DeploymentFinding[] = [];
107
+ const physicalOwner = database.ownership === 'ablo' ? 'ablo' : 'application_migration';
108
+ for (const [modelKey, model] of Object.entries(schema.models)) {
109
+ if ((model.plane ?? 'tenant') === 'control') continue;
110
+ const tableName = model.tableName ?? modelKey;
111
+ const table = database.tables[tableName];
112
+ if (!table) {
113
+ findings.push({ id: id(direction, 'missing_table', modelKey), code: 'missing_table', category: 'physical_contract', severity: database.ownership === 'ablo' ? 'info' : 'blocker', direction, phase: 'expand', owner: physicalOwner, model: modelKey, from: null, to: tableName, message: `Table "${database.appSchema}.${tableName}" is missing.`, action: database.ownership === 'ablo' ? 'Create it through the reviewed Ablo expand plan.' : 'Create it through the application migration owner, then re-run the plan.' });
114
+ continue;
115
+ }
116
+ for (const expected of requiredColumns(model)) {
117
+ const actual = table.columns[expected.column];
118
+ const base = [direction, modelKey, expected.field, expected.column];
119
+ if (!actual) {
120
+ findings.push({ id: id(...base, 'missing_column'), code: expected.primary ? 'missing_identity_column' : 'missing_column', category: 'physical_contract', severity: database.ownership === 'ablo' ? 'info' : 'blocker', direction, phase: 'expand', owner: physicalOwner, model: modelKey, ...(expected.field ? { field: expected.field } : {}), column: expected.column, from: null, to: expected.type, message: `Column "${tableName}.${expected.column}" is missing.`, action: database.ownership === 'ablo' ? 'Create it through the reviewed Ablo expand plan.' : expected.primary ? 'Add or explicitly map a stable row identity and enforce uniqueness and non-nullness.' : 'Add the column through the application migration owner, then re-run the plan.' });
121
+ continue;
122
+ }
123
+ if (expected.primary && !actual.primary && !actual.unique) findings.push({ id: id(...base, 'identity_not_unique'), code: 'identity_not_unique', category: 'physical_contract', severity: 'blocker', direction, phase: 'expand', owner: physicalOwner, model: modelKey, column: expected.column, from: { primary: actual.primary, unique: actual.unique }, to: { primary: true }, message: `Column "${tableName}.${expected.column}" is present but is not a usable unique row identity.`, action: 'Verify uniqueness and non-nullness, then add a primary-key or unique constraint.' });
124
+ const actualType = normalizePgType(actual.dataType);
125
+ if (actualType !== expected.type) findings.push({ id: id(...base, 'column_type_mismatch'), code: 'column_type_mismatch', category: 'physical_contract', severity: 'blocker', direction, phase: 'expand', owner: physicalOwner, model: modelKey, ...(expected.field ? { field: expected.field } : {}), column: expected.column, from: actualType, to: expected.type, message: `Column "${tableName}.${expected.column}" is ${actualType}; the schema expects ${expected.type}.`, action: 'Review and apply a safe type migration before activation.' });
126
+ if (!expected.nullable && actual.nullable) findings.push({ id: id(...base, 'column_nullable'), code: 'column_nullable', category: 'data_movement', severity: 'blocker', direction, phase: 'backfill', owner: physicalOwner, model: modelKey, ...(expected.field ? { field: expected.field } : {}), column: expected.column, from: 'nullable', to: 'required', message: `Column "${tableName}.${expected.column}" is nullable; the schema requires a value.`, action: 'Backfill NULL rows, verify none remain, then enforce NOT NULL.' });
127
+ if (expected.column === tenancyColumn(resolveTenancy(model)) && actual.nullCount !== undefined && actual.nullCount !== null && actual.nullCount > 0) {
128
+ findings.push({ id: id(...base, 'unstamped_tenancy_rows'), code: 'unstamped_tenancy_rows', category: 'data_movement', severity: 'blocker', direction, phase: 'backfill', owner: 'application_migration', model: modelKey, column: expected.column, from: actual.nullCount, to: 0, message: `Table "${tableName}" has ${actual.nullCount >= 501 ? '500+' : actual.nullCount} row(s) with no "${expected.column}" routing value.`, action: 'Backfill the routing value, verify zero NULL rows, then run `ablo connect resnapshot`.' });
129
+ }
130
+ }
131
+ for (const column of ['created_by', 'created_at', 'updated_at']) if (!table.columns[column]) findings.push({ id: id(direction, modelKey, column, 'base_column_degraded'), code: 'base_column_degraded', category: 'advisory', severity: 'warning', direction, phase: 'intent', owner: 'application', model: modelKey, column, message: `Table "${tableName}" has no "${column}"; audit or ordering metadata may be reduced.`, action: 'Declare and add this field only if the application needs that metadata.' });
132
+ for (const [field, meta] of Object.entries(model.fields)) if (meta.isIndexed) {
133
+ const column = meta.column ?? camelToSnake(field);
134
+ const index = table.indexes?.find((candidate) => candidate.columns.length === 1 && candidate.columns[0] === column && candidate.valid && candidate.ready);
135
+ if (!index) findings.push({ id: id(direction, modelKey, field, 'declared_index_missing'), code: 'declared_index_missing', category: 'physical_contract', severity: 'blocker', direction, phase: 'expand', owner: physicalOwner, model: modelKey, field, column, message: `Field "${modelKey}.${field}" is declared indexed, but "${tableName}.${column}" has no ready, valid index.`, action: 'Create the index concurrently, wait until it is ready and valid, then re-run the plan.' });
136
+ }
137
+ for (const relation of Object.values(model.relations)) if (relation.type === 'belongsTo') {
138
+ const target = schema.models[relation.target];
139
+ const expectedTable = target?.tableName ?? relation.target;
140
+ const constraint = table.foreignKeys?.find((foreignKey) => foreignKey.columns.length === 1 && foreignKey.columns[0] === relation.foreignKeyColumn && foreignKey.referencedTable === expectedTable);
141
+ if (!constraint) findings.push({ id: id(direction, modelKey, relation.foreignKey, 'foreign_key_unverified'), code: 'foreign_key_unverified', category: 'advisory', severity: 'warning', direction, phase: 'verify', owner: physicalOwner, model: modelKey, field: relation.foreignKey, column: relation.foreignKeyColumn, message: `Relation "${modelKey}.${relation.foreignKey}" has no observed PostgreSQL foreign key to "${expectedTable}".`, action: 'If the application database owns relational integrity, add the foreign key NOT VALID and validate it after existing rows are clean.' });
142
+ else if (!constraint.validated) findings.push({ id: id(direction, modelKey, relation.foreignKey, 'foreign_key_not_validated'), code: 'foreign_key_not_validated', category: 'physical_contract', severity: 'warning', direction, phase: 'verify', owner: physicalOwner, model: modelKey, field: relation.foreignKey, column: relation.foreignKeyColumn, message: `Foreign key "${constraint.name}" exists but has not validated existing rows.`, action: 'Run VALIDATE CONSTRAINT under the verification gate before relying on it.' });
143
+ }
144
+ if (database.ownership === 'application' && table.publicationMember === false) findings.push({ id: id(direction, modelKey, 'publication_missing'), code: 'publication_missing', category: 'physical_contract', severity: 'blocker', direction, phase: 'expand', owner: 'application_migration', model: modelKey, message: `Table "${tableName}" is not a member of the connected logical-replication publication.`, action: 'Add the table to the publication through the database owner, then verify replication before activation.' });
145
+ if (table.rowLevelSecurity === true && table.forceRowLevelSecurity !== true) findings.push({ id: id(direction, modelKey, 'rls_not_forced'), code: 'rls_not_forced', category: 'advisory', severity: 'warning', direction, phase: 'verify', owner: physicalOwner, model: modelKey, message: `Table "${tableName}" enables RLS but does not force it for the table owner.`, action: 'Confirm the runtime role cannot bypass the intended policy, or FORCE ROW LEVEL SECURITY.' });
146
+ }
147
+ return findings;
148
+ }
149
+
150
+ export function reconcileSchemaToDatabase(schema: SchemaJSON, database: DatabaseSnapshot | null, direction: 'source_to_database' | 'active_to_database'): readonly DeploymentFinding[] {
151
+ if (!database) return [{ id: `${direction}:database_unobserved`, code: 'database_unobserved', category: 'observation', severity: 'blocker', direction, phase: 'verify', owner: 'application_migration', message: 'The connected PostgreSQL shape was not observed.', action: 'Provide the application migration credential and re-run the plan against the confirmed database.' }];
152
+ return physicalFindings(schema, database, direction);
153
+ }
154
+
155
+ /** Client-runtime projection of the same compatibility finding contract. */
156
+ export function reconcileClientToActive(
157
+ changed: readonly string[],
158
+ unpushed: readonly string[],
159
+ serverLabel: string,
160
+ fieldDifferences: readonly { model: string; field: string; direction: 'client_only' | 'active_only' | 'changed'; detail: string }[] = [],
161
+ ): readonly DeploymentFinding[] {
162
+ return [
163
+ ...fieldDifferences.map((difference): DeploymentFinding => ({
164
+ id: id('client_to_active', `field_${difference.direction}`, difference.model, difference.field), code: `field_${difference.direction}`,
165
+ category: 'compatibility', severity: difference.direction === 'active_only' ? 'warning' : 'error', direction: 'client_to_active',
166
+ phase: difference.direction === 'active_only' ? 'verify' : 'dual_write', owner: 'application', model: difference.model, field: difference.field,
167
+ message: `Field "${difference.model}.${difference.field}" is ${difference.detail} at ${serverLabel}.`,
168
+ action: 'Run `ablo plan` for the ordered compatibility action before deploying this build.',
169
+ })),
170
+ ...changed.map((model): DeploymentFinding => ({
171
+ id: id('client_to_active', 'model_changed', model), code: 'model_changed', category: 'compatibility', severity: 'warning',
172
+ direction: 'client_to_active', phase: 'verify', owner: 'application', model,
173
+ message: `Model "${model}" differs between this build and the active schema at ${serverLabel}.`,
174
+ action: 'Run `ablo plan` to see field direction; use `ablo status` to confirm the deployed target.',
175
+ })),
176
+ ...unpushed.map((model): DeploymentFinding => ({
177
+ id: id('client_to_active', 'model_unpushed', model), code: 'model_unpushed', category: 'compatibility', severity: 'error',
178
+ direction: 'client_to_active', phase: 'dual_write', owner: 'ablo', model,
179
+ message: `Model "${model}" is declared by this build but is not active at ${serverLabel}.`,
180
+ action: 'Run `ablo plan`, resolve its gates, then run `ablo push` with the reviewed schema.',
181
+ })),
182
+ ];
183
+ }
184
+
185
+ /** Turns an explicit lifecycle manifest into the same findings consumed by every surface. */
186
+ export function reconcileDeploymentManifest(manifest: DeploymentManifest | undefined): readonly DeploymentFinding[] {
187
+ if (!manifest) return [];
188
+ const findings: DeploymentFinding[] = [];
189
+ const gates = new Map(manifest.gates.map((gate) => [gate.id, gate]));
190
+ const phases = ['expand', 'dual_write', 'backfill', 'verify', 'switch', 'contract'] as const;
191
+ const targetIndex = phases.indexOf(manifest.targetPhase);
192
+ for (const gate of manifest.gates) {
193
+ const unmet = gate.dependsOn.filter((dependency) => gates.get(dependency)?.status !== 'satisfied');
194
+ const contractWithoutApproval = gate.phase === 'contract' && !gate.approval;
195
+ const future = phases.indexOf(gate.phase) > targetIndex;
196
+ const blocked = !future && (gate.status === 'pending' || unmet.length > 0 || contractWithoutApproval);
197
+ findings.push({
198
+ id: id('manifest', manifest.id, gate.id), code: future ? 'lifecycle_future' : contractWithoutApproval ? 'contract_approval_required' : unmet.length > 0 ? 'lifecycle_dependency_unsatisfied' : `lifecycle_${gate.status}`,
199
+ category: gate.phase === 'contract' ? 'destructive_contract' : gate.phase === 'backfill' ? 'data_movement' : 'compatibility',
200
+ severity: blocked ? 'blocker' : future || gate.status === 'satisfied' ? 'info' : 'warning', direction: 'source_to_active', phase: gate.phase,
201
+ owner: gate.owner, model: gate.resource.split('.')[0], ...(gate.resource.includes('.') ? { field: gate.resource.split('.').slice(1).join('.') } : {}),
202
+ message: future ? `Lifecycle gate "${gate.title}" is visible but belongs after this ${manifest.targetPhase} deployment.` : blocked ? `Lifecycle gate "${gate.title}" is not satisfied${unmet.length ? `; waiting for ${unmet.join(', ')}` : ''}.` : `Lifecycle gate "${gate.title}" is ${gate.status}.`,
203
+ action: contractWithoutApproval ? 'Approve contract as a separate reviewed deployment and record the approval identifier.' : gate.action,
204
+ dependsOn: gate.dependsOn.map((dependency) => id('manifest', manifest.id, dependency)),
205
+ });
206
+ }
207
+ if (manifest.live) {
208
+ const phasesByResource = new Map<string, Set<string>>();
209
+ for (const gate of manifest.gates) {
210
+ const phases = phasesByResource.get(gate.resource) ?? new Set<string>();
211
+ phases.add(gate.phase);
212
+ phasesByResource.set(gate.resource, phases);
213
+ }
214
+ for (const [resource, phases] of phasesByResource) if (phases.has('expand') && phases.has('contract')) {
215
+ findings.push({ id: id('manifest', manifest.id, resource, 'mixed_expand_contract'), code: 'mixed_expand_contract', category: 'destructive_contract', severity: 'blocker', direction: 'source_to_active', phase: 'contract', owner: 'application', model: resource.split('.')[0], ...(resource.includes('.') ? { field: resource.split('.').slice(1).join('.') } : {}), message: `Live resource "${resource}" combines expand and contract in one deployment manifest.`, action: 'Remove contract from this manifest; deploy and verify expand first, then submit a separately approved contract manifest.' });
216
+ }
217
+ }
218
+ return findings;
219
+ }
@@ -0,0 +1,85 @@
1
+ import type { DeploymentFinding, DeploymentPhase, DeploymentStep } from './contracts.js';
2
+
3
+ const PHASES: readonly DeploymentPhase[] = [
4
+ 'intent',
5
+ 'expand',
6
+ 'dual_write',
7
+ 'backfill',
8
+ 'verify',
9
+ 'switch',
10
+ 'contract',
11
+ 'recover',
12
+ ];
13
+
14
+ function statusOf(findings: readonly DeploymentFinding[]): DeploymentStep['status'] {
15
+ if (findings.some(({ severity }) => severity === 'blocker' || severity === 'error')) {
16
+ return 'blocked';
17
+ }
18
+ if (findings.some(({ code }) => code === 'lifecycle_ready')) return 'ready';
19
+ return findings.every(({ severity }) => severity === 'warning' || severity === 'info')
20
+ ? 'advisory'
21
+ : 'ready';
22
+ }
23
+
24
+ function manifestStep(finding: DeploymentFinding): DeploymentStep {
25
+ const status = statusOf([finding]);
26
+ return {
27
+ id: finding.id,
28
+ phase: finding.phase,
29
+ owner: finding.owner,
30
+ title: finding.message,
31
+ action: finding.action,
32
+ dependsOn: finding.dependsOn ?? [],
33
+ findingIds: [finding.id],
34
+ status,
35
+ executableByAblo: finding.owner === 'ablo' && status === 'ready',
36
+ };
37
+ }
38
+
39
+ function groupedStep(
40
+ phase: DeploymentPhase,
41
+ owner: DeploymentFinding['owner'],
42
+ findings: readonly DeploymentFinding[],
43
+ ): DeploymentStep {
44
+ const status = statusOf(findings);
45
+ return {
46
+ id: `${phase}:${owner}`,
47
+ phase,
48
+ owner,
49
+ title: `${phase} — ${owner.replaceAll('_', ' ')}`,
50
+ action: [...new Set(findings.map(({ action }) => action))].join(' '),
51
+ dependsOn: [],
52
+ findingIds: findings.map(({ id }) => id),
53
+ status,
54
+ executableByAblo: owner === 'ablo' && status === 'ready',
55
+ };
56
+ }
57
+
58
+ /** Preserve manifest gates while grouping ordinary diagnostics by phase/owner. */
59
+ export function sequenceDeployment(findings: readonly DeploymentFinding[]): readonly DeploymentStep[] {
60
+ const steps: DeploymentStep[] = [];
61
+ let previousPhase: readonly string[] = [];
62
+
63
+ for (const phase of PHASES) {
64
+ const phaseFindings = findings.filter((finding) => finding.phase === phase);
65
+ const manifest = phaseFindings.filter(({ id }) => id.startsWith('manifest:'));
66
+ const ordinary = phaseFindings.filter(({ id }) => !id.startsWith('manifest:'));
67
+ const phaseSteps = manifest.map(manifestStep);
68
+
69
+ for (const owner of [...new Set(ordinary.map(({ owner }) => owner))]) {
70
+ phaseSteps.push(groupedStep(
71
+ phase,
72
+ owner,
73
+ ordinary.filter((finding) => finding.owner === owner),
74
+ ));
75
+ }
76
+
77
+ for (const step of phaseSteps) {
78
+ const explicit = step.dependsOn;
79
+ const barrier = explicit.length === 0 ? previousPhase : [];
80
+ steps.push({ ...step, dependsOn: [...new Set([...explicit, ...barrier])] });
81
+ }
82
+ if (phaseSteps.length > 0) previousPhase = phaseSteps.map(({ id }) => id);
83
+ }
84
+ return steps;
85
+ }
@@ -13,7 +13,7 @@
13
13
  * status: z.enum(['todo', 'doing', 'done']).default('todo'),
14
14
  * projectId: z.string().optional(),
15
15
  * }, {
16
- * project: relation.belongsTo('projects', 'projectId'),
16
+ * relations: { project: relation.belongsTo('projects', 'projectId') },
17
17
  * }),
18
18
  * });
19
19
  *
@@ -80,7 +80,7 @@ export {
80
80
  type ParticipantKind,
81
81
  type ConfirmationState,
82
82
  type BackfillProvenance,
83
- } from '../log/syncDeltaRow.js';
83
+ } from '../observation/persistence/syncDeltaRow.js';
84
84
 
85
85
  // The wire delta contract — the server-to-client projection of the stored row.
86
86
  // Both the client SDK and the server derive their `SyncDelta` type from these with
@@ -98,7 +98,7 @@ export {
98
98
  type SyncDeltaWireCore,
99
99
  type ClientSyncDelta,
100
100
  type ServerSyncDelta,
101
- } from '../wire/delta.js';
101
+ } from '../observation/contract.js';
102
102
 
103
103
  // Model builder
104
104
  export {
@@ -115,25 +115,8 @@ export {
115
115
  type PersistOptions,
116
116
  type RelationRecord,
117
117
  type GrantsRef,
118
- type ConflictAxis,
119
118
  } from './model.js';
120
119
 
121
- // Coordination authoring helpers for the `conflict` axis — composable disposition
122
- // functions plus a combinator that merges them.
123
- export {
124
- coordination,
125
- humansOverwrite,
126
- humansReject,
127
- humansNotify,
128
- agentsOverwrite,
129
- agentsReject,
130
- agentsNotify,
131
- systemOverwrite,
132
- systemReject,
133
- systemNotify,
134
- type ConflictRule,
135
- } from './coordination.js';
136
-
137
120
  // Claim-first shorthand for common model options: `mutable.lazy({...})` and friends
138
121
  // encode a model's write-safety and load strategy in the verb, and fall back to
139
122
  // sensible defaults for everything else.
@@ -145,6 +128,7 @@ export {
145
128
  composeIdentitySyncGroups,
146
129
  type Schema,
147
130
  type SchemaRecord,
131
+ BASE_FIELDS,
148
132
  type Model,
149
133
  type Row,
150
134
  type InferCreate,
@@ -278,6 +262,11 @@ export {
278
262
  type BlockerCode,
279
263
  } from './diff.js';
280
264
 
265
+ // One source/active/database deployment skeleton. CLI check/plan/push/migrate,
266
+ // server activation, and runtime drift project this contract instead of
267
+ // maintaining lateral planners.
268
+ export * from './deployment/index.js';
269
+
281
270
  // Schema → TypeScript type emission.
282
271
  export { generateTypes } from './generate.js';
283
272
 
@@ -29,11 +29,6 @@ import { getFieldMeta, inferFieldMetaFromZod, type FieldMeta } from './field.js'
29
29
  import { resolvePolicy, type Tenancy, type ScopedViaRef, type PolicyInput } from './tenancy.js';
30
30
  export type { ScopedViaRef, Tenancy, PolicyInput } from './tenancy.js';
31
31
  import { DEFAULT_RESIDENCY, type ModelResidency } from './residency.js';
32
- // The write-conflict disposition. It is plain data (the `onStale` vocabulary) so it
33
- // round-trips through schema serialization, and the engine interprets it when a
34
- // commit is applied.
35
- import type { ConflictAxis } from '../policy/types.js';
36
- export type { ConflictAxis } from '../policy/types.js';
37
32
 
38
33
  /** Normalize the `entityRoles` option (single | array | undefined) to an array. */
39
34
  function normalizeEntityRoles(
@@ -197,29 +192,6 @@ export interface ModelOptions {
197
192
  */
198
193
  groups?: GroupsInput;
199
194
 
200
- /**
201
- * Write-conflict disposition, set per committer kind — decides what happens when a
202
- * commit collides with another participant's claim or with a stale snapshot of this
203
- * model. This is independent of {@link policy} (read access) and {@link groups}
204
- * (delta routing). It is a map keyed by the committer's kind (`user`, `agent`, or
205
- * `system`), with these outcomes as values:
206
- *
207
- * - `'overwrite'` — the write wins; that committer is never blocked.
208
- * - `'reject'` — the write is refused; that committer yields.
209
- * - `'notify'` — hold the write and hand the current value back so the committer
210
- * re-reads and re-applies (for stale writes only).
211
- *
212
- * A kind you omit falls back to the engine default: reject, while honoring
213
- * `onStale: 'notify'`. The value is plain data that travels with the schema to the
214
- * server, where the engine interprets it. For example:
215
- *
216
- * ```ts
217
- * // "a human's edit always wins (never blocked); an agent yields"
218
- * conflict: { user: 'overwrite', agent: 'reject' }
219
- * ```
220
- */
221
- conflict?: ConflictAxis;
222
-
223
195
  /**
224
196
  * Whether clients may create, update, and delete this model's rows through the
225
197
  * commit protocol. Defaults to true: declaring a model in your schema is the
@@ -377,9 +349,6 @@ export interface ModelDef<
377
349
  readonly entityRoles?: readonly EntityRole[];
378
350
  /** Explicit acknowledgement that sync groups are routing, not row access. */
379
351
  readonly routingOnly?: true;
380
- /** The write-conflict disposition per committer kind, carried as plain data. See
381
- * {@link ModelOptions.conflict}. */
382
- readonly conflict?: ConflictAxis;
383
352
  /** Whether wire-level CREATE/UPDATE/DELETE is allowed. See {@link ModelOptions.mutable}. */
384
353
  readonly mutable?: boolean;
385
354
  /** Defer MobX setup until first observer access. See {@link ModelOptions.lazyObservable}. */
@@ -467,8 +436,6 @@ export function model<
467
436
  grants: options?.groups?.grants,
468
437
  entityRoles: normalizeEntityRoles(options?.groups?.roles),
469
438
  routingOnly: options?.groups?.routingOnly,
470
- // The conflict disposition is already plain data, so it passes through unchanged.
471
- conflict: options?.conflict,
472
439
  mutable: options?.mutable ?? true,
473
440
  lazyObservable: options?.lazyObservable,
474
441
  computed: options?.computed,