@abloatai/transaction 0.56.0 → 0.58.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 (769) hide show
  1. package/CONVENTIONS.md +54 -10
  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} +6 -15
  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 +92 -77
  106. package/dist/client/resources/httpResources.d.ts.map +1 -0
  107. package/dist/client/resources/httpResources.js +94 -0
  108. package/dist/client/resources/httpResources.js.map +1 -0
  109. package/dist/client/resources/modelCreate.d.ts +21 -0
  110. package/dist/client/resources/modelCreate.d.ts.map +1 -0
  111. package/dist/client/resources/modelCreate.js +49 -0
  112. package/dist/client/resources/modelCreate.js.map +1 -0
  113. package/dist/{resources → client/resources}/modelOperations.d.ts +57 -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 +16 -35
  124. package/dist/client/resources/writeOptionsSchema.d.ts.map +1 -0
  125. package/dist/{resources → client/resources}/writeOptionsSchema.js +25 -18
  126. package/dist/client/resources/writeOptionsSchema.js.map +1 -0
  127. package/dist/{transactions → commit}/confirmation/commitEnvelope.d.ts +1 -37
  128. package/dist/commit/confirmation/commitEnvelope.d.ts.map +1 -0
  129. package/dist/{transactions → commit}/confirmation/commitEnvelope.js +2 -7
  130. package/dist/commit/confirmation/commitEnvelope.js.map +1 -0
  131. package/dist/commit/confirmation/httpCommitEnvelope.d.ts.map +1 -0
  132. package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.js +1 -1
  133. package/dist/commit/confirmation/httpCommitEnvelope.js.map +1 -0
  134. package/dist/commit/confirmation/idempotencyKey.d.ts.map +1 -0
  135. package/dist/commit/confirmation/idempotencyKey.js.map +1 -0
  136. package/dist/{transactions → commit}/confirmation/pendingWrite.d.ts +2 -33
  137. package/dist/commit/confirmation/pendingWrite.d.ts.map +1 -0
  138. package/dist/{transactions → commit}/confirmation/pendingWrite.js +1 -1
  139. package/dist/commit/confirmation/pendingWrite.js.map +1 -0
  140. package/dist/commit/contract.d.ts +1404 -0
  141. package/dist/commit/contract.d.ts.map +1 -0
  142. package/dist/{wire/commit.js → commit/contract.js} +26 -21
  143. package/dist/commit/contract.js.map +1 -0
  144. package/dist/{durableWrites.d.ts → commit/durableWrites.d.ts} +6 -6
  145. package/dist/commit/durableWrites.d.ts.map +1 -0
  146. package/dist/{durableWrites.js → commit/durableWrites.js} +5 -5
  147. package/dist/commit/durableWrites.js.map +1 -0
  148. package/dist/commit/httpRequest.d.ts +45 -0
  149. package/dist/commit/httpRequest.d.ts.map +1 -0
  150. package/dist/commit/httpRequest.js +66 -0
  151. package/dist/commit/httpRequest.js.map +1 -0
  152. package/dist/commit/index.d.ts +17 -0
  153. package/dist/commit/index.d.ts.map +1 -0
  154. package/dist/commit/index.js +17 -0
  155. package/dist/commit/index.js.map +1 -0
  156. package/dist/{readSetContext.d.ts → commit/readSetContext.d.ts} +7 -15
  157. package/dist/commit/readSetContext.d.ts.map +1 -0
  158. package/dist/{readSetContext.js → commit/readSetContext.js} +18 -28
  159. package/dist/commit/readSetContext.js.map +1 -0
  160. package/dist/{commitRecordRuntime.d.ts → commit/recordRuntime.d.ts} +3 -5
  161. package/dist/commit/recordRuntime.d.ts.map +1 -0
  162. package/dist/{commitRecordRuntime.js → commit/recordRuntime.js} +13 -54
  163. package/dist/commit/recordRuntime.js.map +1 -0
  164. package/dist/coordination/index.d.ts +6 -8
  165. package/dist/coordination/index.d.ts.map +1 -1
  166. package/dist/coordination/index.js +3 -9
  167. package/dist/coordination/index.js.map +1 -1
  168. package/dist/coordination/schema.d.ts +11 -466
  169. package/dist/coordination/schema.d.ts.map +1 -1
  170. package/dist/coordination/schema.js +13 -265
  171. package/dist/coordination/schema.js.map +1 -1
  172. package/dist/errorCodes.d.ts +16 -9
  173. package/dist/errorCodes.d.ts.map +1 -1
  174. package/dist/errorCodes.js +14 -6
  175. package/dist/errorCodes.js.map +1 -1
  176. package/dist/errorObservation.d.ts +2 -2
  177. package/dist/errors.d.ts +3 -2
  178. package/dist/errors.d.ts.map +1 -1
  179. package/dist/errors.js +27 -11
  180. package/dist/errors.js.map +1 -1
  181. package/dist/index.d.ts +7 -7
  182. package/dist/index.d.ts.map +1 -1
  183. package/dist/index.js +3 -3
  184. package/dist/index.js.map +1 -1
  185. package/dist/internal/read-set.d.ts +3 -3
  186. package/dist/internal/read-set.d.ts.map +1 -1
  187. package/dist/internal/read-set.js +2 -2
  188. package/dist/internal/read-set.js.map +1 -1
  189. package/dist/observability.d.ts +4 -4
  190. package/dist/observability.d.ts.map +1 -1
  191. package/dist/observability.js +2 -2
  192. package/dist/{wire/delta.d.ts → observation/contract.d.ts} +8 -8
  193. package/dist/observation/contract.d.ts.map +1 -0
  194. package/dist/{wire/delta.js → observation/contract.js} +3 -3
  195. package/dist/observation/contract.js.map +1 -0
  196. package/dist/{wire/feedCursor.d.ts → observation/cursor.d.ts} +1 -1
  197. package/dist/observation/cursor.d.ts.map +1 -0
  198. package/dist/{wire/feedCursor.js → observation/cursor.js} +1 -1
  199. package/dist/observation/cursor.js.map +1 -0
  200. package/dist/{wire/deltaDelivery.d.ts → observation/deliveryContract.d.ts} +1 -1
  201. package/dist/observation/deliveryContract.d.ts.map +1 -0
  202. package/dist/{wire/deltaDelivery.js → observation/deliveryContract.js} +1 -1
  203. package/dist/observation/deliveryContract.js.map +1 -0
  204. package/dist/{wire/feedEvent.d.ts → observation/feedContract.d.ts} +10 -10
  205. package/dist/observation/feedContract.d.ts.map +1 -0
  206. package/dist/{wire/feedEvent.js → observation/feedContract.js} +4 -4
  207. package/dist/observation/feedContract.js.map +1 -0
  208. package/dist/observation/httpFeed.d.ts +4 -0
  209. package/dist/observation/httpFeed.d.ts.map +1 -0
  210. package/dist/{transport → observation}/httpFeed.js +1 -1
  211. package/dist/{transport → observation}/httpFeed.js.map +1 -1
  212. package/dist/observation/index.d.ts +13 -0
  213. package/dist/observation/index.d.ts.map +1 -0
  214. package/dist/observation/index.js +13 -0
  215. package/dist/observation/index.js.map +1 -0
  216. package/dist/{log → observation/persistence}/syncDeltaRow.d.ts +8 -8
  217. package/dist/observation/persistence/syncDeltaRow.d.ts.map +1 -0
  218. package/dist/{log → observation/persistence}/syncDeltaRow.js +4 -4
  219. package/dist/observation/persistence/syncDeltaRow.js.map +1 -0
  220. package/dist/pricing.d.ts +20 -12
  221. package/dist/pricing.d.ts.map +1 -1
  222. package/dist/pricing.js +46 -26
  223. package/dist/pricing.js.map +1 -1
  224. package/dist/schema/audit.d.ts +15 -0
  225. package/dist/schema/audit.d.ts.map +1 -0
  226. package/dist/schema/audit.js +90 -0
  227. package/dist/schema/audit.js.map +1 -0
  228. package/dist/schema/ddl.d.ts.map +1 -1
  229. package/dist/schema/ddl.js +68 -1
  230. package/dist/schema/ddl.js.map +1 -1
  231. package/dist/schema/index.d.ts +7 -6
  232. package/dist/schema/index.d.ts.map +1 -1
  233. package/dist/schema/index.js +6 -7
  234. package/dist/schema/index.js.map +1 -1
  235. package/dist/schema/model.d.ts +14 -27
  236. package/dist/schema/model.d.ts.map +1 -1
  237. package/dist/schema/model.js +2 -2
  238. package/dist/schema/model.js.map +1 -1
  239. package/dist/schema/openapi.d.ts.map +1 -1
  240. package/dist/schema/openapi.js +149 -8
  241. package/dist/schema/openapi.js.map +1 -1
  242. package/dist/schema/roles.d.ts +27 -0
  243. package/dist/schema/roles.d.ts.map +1 -1
  244. package/dist/schema/roles.js +40 -0
  245. package/dist/schema/roles.js.map +1 -1
  246. package/dist/schema/schema.d.ts +34 -7
  247. package/dist/schema/schema.d.ts.map +1 -1
  248. package/dist/schema/schema.js +39 -3
  249. package/dist/schema/schema.js.map +1 -1
  250. package/dist/schema/serialize.d.ts +5 -5
  251. package/dist/schema/serialize.d.ts.map +1 -1
  252. package/dist/schema/serialize.js +5 -5
  253. package/dist/schema/serialize.js.map +1 -1
  254. package/dist/schema/subject.d.ts +18 -0
  255. package/dist/schema/subject.d.ts.map +1 -0
  256. package/dist/schema/subject.js +27 -0
  257. package/dist/schema/subject.js.map +1 -0
  258. package/dist/schema/tenancy.d.ts +1 -1
  259. package/dist/server/adapter.d.ts +3 -1
  260. package/dist/server/adapter.d.ts.map +1 -1
  261. package/dist/server/commit.d.ts +6 -14
  262. package/dist/server/commit.d.ts.map +1 -1
  263. package/dist/server/index.d.ts +1 -1
  264. package/dist/server/index.d.ts.map +1 -1
  265. package/dist/server/index.js +1 -1
  266. package/dist/server/index.js.map +1 -1
  267. package/dist/server/readConfig.d.ts +3 -0
  268. package/dist/server/readConfig.d.ts.map +1 -1
  269. package/dist/server/readConfig.js +0 -21
  270. package/dist/server/readConfig.js.map +1 -1
  271. package/dist/server/storageMode.d.ts +1 -1
  272. package/dist/source/{adapter.d.ts → adapters/adapter.d.ts} +10 -4
  273. package/dist/source/adapters/adapter.d.ts.map +1 -0
  274. package/dist/source/adapters/adapter.js.map +1 -0
  275. package/dist/source/adapters/adapterFactory.d.ts.map +1 -0
  276. package/dist/source/{adapterFactory.js → adapters/adapterFactory.js} +1 -1
  277. package/dist/source/adapters/adapterFactory.js.map +1 -0
  278. package/dist/source/adapters/adapterProfile.d.ts.map +1 -0
  279. package/dist/source/adapters/adapterProfile.js.map +1 -0
  280. package/dist/source/{conformance.d.ts → adapters/conformance.d.ts} +1 -1
  281. package/dist/source/adapters/conformance.d.ts.map +1 -0
  282. package/dist/source/{conformance.js → adapters/conformance.js} +1 -1
  283. package/dist/source/adapters/conformance.js.map +1 -0
  284. package/dist/source/{contract.d.ts → adapters/contract.d.ts} +20 -75
  285. package/dist/source/adapters/contract.d.ts.map +1 -0
  286. package/dist/source/{contract.js → adapters/contract.js} +20 -55
  287. package/dist/source/adapters/contract.js.map +1 -0
  288. package/dist/source/adapters/drizzle.d.ts +1 -1
  289. package/dist/source/adapters/drizzle.d.ts.map +1 -1
  290. package/dist/source/adapters/drizzle.js +54 -25
  291. package/dist/source/adapters/drizzle.js.map +1 -1
  292. package/dist/source/adapters/idempotency.d.ts.map +1 -0
  293. package/dist/source/{idempotency.js → adapters/idempotency.js} +2 -2
  294. package/dist/source/adapters/idempotency.js.map +1 -0
  295. package/dist/source/adapters/index.d.ts +21 -0
  296. package/dist/source/adapters/index.d.ts.map +1 -0
  297. package/dist/source/adapters/index.js +21 -0
  298. package/dist/source/adapters/index.js.map +1 -0
  299. package/dist/source/adapters/kysely.d.ts +3 -1
  300. package/dist/source/adapters/kysely.d.ts.map +1 -1
  301. package/dist/source/adapters/kysely.js +49 -23
  302. package/dist/source/adapters/kysely.js.map +1 -1
  303. package/dist/source/adapters/kyselyMutationCore.d.ts +6 -3
  304. package/dist/source/adapters/kyselyMutationCore.d.ts.map +1 -1
  305. package/dist/source/adapters/kyselyMutationCore.js +17 -8
  306. package/dist/source/adapters/kyselyMutationCore.js.map +1 -1
  307. package/dist/source/adapters/memory.d.ts +3 -3
  308. package/dist/source/adapters/memory.d.ts.map +1 -1
  309. package/dist/source/adapters/memory.js +20 -7
  310. package/dist/source/adapters/memory.js.map +1 -1
  311. package/dist/source/adapters/migration.d.ts +8 -0
  312. package/dist/source/adapters/migration.d.ts.map +1 -0
  313. package/dist/source/adapters/migration.js +9 -0
  314. package/dist/source/adapters/migration.js.map +1 -0
  315. package/dist/source/{migrations.d.ts → adapters/migrations.d.ts} +3 -4
  316. package/dist/source/adapters/migrations.d.ts.map +1 -0
  317. package/dist/source/{migrations.js → adapters/migrations.js} +4 -31
  318. package/dist/source/adapters/migrations.js.map +1 -0
  319. package/dist/source/adapters/prisma.d.ts +1 -1
  320. package/dist/source/adapters/prisma.d.ts.map +1 -1
  321. package/dist/source/adapters/prisma.js +75 -30
  322. package/dist/source/adapters/prisma.js.map +1 -1
  323. package/dist/source/adapters/subjectAuthorization.d.ts +16 -0
  324. package/dist/source/adapters/subjectAuthorization.d.ts.map +1 -0
  325. package/dist/source/adapters/subjectAuthorization.js +126 -0
  326. package/dist/source/adapters/subjectAuthorization.js.map +1 -0
  327. package/dist/source/{connector.d.ts → connector/client.d.ts} +6 -1
  328. package/dist/source/connector/client.d.ts.map +1 -0
  329. package/dist/source/{connector.js → connector/client.js} +28 -11
  330. package/dist/source/connector/client.js.map +1 -0
  331. package/dist/source/connector/index.d.ts +4 -0
  332. package/dist/source/connector/index.d.ts.map +1 -0
  333. package/dist/source/connector/index.js +4 -0
  334. package/dist/source/connector/index.js.map +1 -0
  335. package/dist/source/{connectorProtocol.d.ts → connector/protocol.d.ts} +8 -1
  336. package/dist/source/connector/protocol.d.ts.map +1 -0
  337. package/dist/source/{connectorProtocol.js → connector/protocol.js} +10 -3
  338. package/dist/source/connector/protocol.js.map +1 -0
  339. package/dist/source/delivery/index.d.ts +3 -0
  340. package/dist/source/delivery/index.d.ts.map +1 -0
  341. package/dist/source/delivery/index.js +3 -0
  342. package/dist/source/delivery/index.js.map +1 -0
  343. package/dist/source/{pushQueue.d.ts → delivery/pushQueue.d.ts} +1 -1
  344. package/dist/source/delivery/pushQueue.d.ts.map +1 -0
  345. package/dist/source/{pushQueue.js → delivery/pushQueue.js} +1 -1
  346. package/dist/source/delivery/pushQueue.js.map +1 -0
  347. package/dist/source/{factory.d.ts → endpoint/factory.d.ts} +9 -3
  348. package/dist/source/endpoint/factory.d.ts.map +1 -0
  349. package/dist/source/{factory.js → endpoint/factory.js} +122 -6
  350. package/dist/source/endpoint/factory.js.map +1 -0
  351. package/dist/source/endpoint/index.d.ts +5 -0
  352. package/dist/source/endpoint/index.d.ts.map +1 -0
  353. package/dist/source/endpoint/index.js +5 -0
  354. package/dist/source/endpoint/index.js.map +1 -0
  355. package/dist/source/{next.d.ts → endpoint/next.d.ts} +2 -2
  356. package/dist/source/endpoint/next.d.ts.map +1 -0
  357. package/dist/source/{next.js → endpoint/next.js} +1 -1
  358. package/dist/source/endpoint/next.js.map +1 -0
  359. package/dist/source/{signing.d.ts → endpoint/signing.d.ts} +1 -1
  360. package/dist/source/endpoint/signing.d.ts.map +1 -0
  361. package/dist/source/{signing.js → endpoint/signing.js} +1 -1
  362. package/dist/source/endpoint/signing.js.map +1 -0
  363. package/dist/source/index.d.ts +15 -12
  364. package/dist/source/index.d.ts.map +1 -1
  365. package/dist/source/index.js +13 -10
  366. package/dist/source/index.js.map +1 -1
  367. package/dist/source/outbox/contract.d.ts +50 -0
  368. package/dist/source/outbox/contract.d.ts.map +1 -0
  369. package/dist/source/outbox/contract.js +50 -0
  370. package/dist/source/outbox/contract.js.map +1 -0
  371. package/dist/source/outbox/envelope.d.ts +9 -0
  372. package/dist/source/outbox/envelope.d.ts.map +1 -0
  373. package/dist/source/outbox/envelope.js +36 -0
  374. package/dist/source/outbox/envelope.js.map +1 -0
  375. package/dist/source/outbox/index.d.ts +11 -0
  376. package/dist/source/outbox/index.d.ts.map +1 -0
  377. package/dist/source/outbox/index.js +11 -0
  378. package/dist/source/outbox/index.js.map +1 -0
  379. package/dist/source/outbox/migrations.d.ts +4 -0
  380. package/dist/source/outbox/migrations.d.ts.map +1 -0
  381. package/dist/source/outbox/migrations.js +67 -0
  382. package/dist/source/outbox/migrations.js.map +1 -0
  383. package/dist/source/outbox/retention.d.ts +3 -0
  384. package/dist/source/outbox/retention.d.ts.map +1 -0
  385. package/dist/source/outbox/retention.js +3 -0
  386. package/dist/source/outbox/retention.js.map +1 -0
  387. package/dist/source/types.d.ts +59 -10
  388. package/dist/source/types.d.ts.map +1 -1
  389. package/dist/source/types.js +2 -0
  390. package/dist/source/types.js.map +1 -1
  391. package/dist/syncLog/contract.d.ts +19 -8
  392. package/dist/syncLog/contract.d.ts.map +1 -1
  393. package/dist/syncLog/contract.js +19 -6
  394. package/dist/syncLog/contract.js.map +1 -1
  395. package/dist/testing/fixtures/httpResponses.d.ts +6 -0
  396. package/dist/testing/fixtures/httpResponses.d.ts.map +1 -1
  397. package/dist/testing/fixtures/httpResponses.js +1 -0
  398. package/dist/testing/fixtures/httpResponses.js.map +1 -1
  399. package/dist/transport/{credentialLifecycle.d.ts → connection/credentialLifecycle.d.ts} +3 -3
  400. package/dist/transport/connection/credentialLifecycle.d.ts.map +1 -0
  401. package/dist/transport/{credentialLifecycle.js → connection/credentialLifecycle.js} +2 -2
  402. package/dist/transport/connection/credentialLifecycle.js.map +1 -0
  403. package/dist/transport/connection/index.d.ts +5 -0
  404. package/dist/transport/connection/index.d.ts.map +1 -0
  405. package/dist/transport/connection/index.js +5 -0
  406. package/dist/transport/connection/index.js.map +1 -0
  407. package/dist/transport/{connectionManager.d.ts → connection/manager.d.ts} +13 -5
  408. package/dist/transport/connection/manager.d.ts.map +1 -0
  409. package/dist/transport/{connectionManager.js → connection/manager.js} +6 -4
  410. package/dist/transport/connection/manager.js.map +1 -0
  411. package/dist/transport/{networkProbe.d.ts → connection/networkProbe.d.ts} +2 -2
  412. package/dist/transport/connection/networkProbe.d.ts.map +1 -0
  413. package/dist/transport/{networkProbe.js → connection/networkProbe.js} +4 -4
  414. package/dist/transport/connection/networkProbe.js.map +1 -0
  415. package/dist/transport/{httpClient.d.ts → http/client.d.ts} +32 -44
  416. package/dist/transport/http/client.d.ts.map +1 -0
  417. package/dist/transport/{httpClient.js → http/client.js} +96 -105
  418. package/dist/transport/http/client.js.map +1 -0
  419. package/dist/transport/http/helpers.d.ts +10 -0
  420. package/dist/transport/http/helpers.d.ts.map +1 -0
  421. package/dist/transport/http/helpers.js +46 -0
  422. package/dist/transport/http/helpers.js.map +1 -0
  423. package/dist/transport/http/index.d.ts +6 -0
  424. package/dist/transport/http/index.d.ts.map +1 -0
  425. package/dist/transport/http/index.js +6 -0
  426. package/dist/transport/http/index.js.map +1 -0
  427. package/dist/transport/{httpOptions.d.ts → http/options.d.ts} +7 -7
  428. package/dist/transport/{httpOptions.d.ts.map → http/options.d.ts.map} +1 -1
  429. package/dist/transport/{httpOptions.js → http/options.js} +1 -1
  430. package/dist/transport/http/options.js.map +1 -0
  431. package/dist/transport/http/subscription.d.ts +16 -0
  432. package/dist/transport/http/subscription.d.ts.map +1 -0
  433. package/dist/transport/http/subscription.js +146 -0
  434. package/dist/transport/http/subscription.js.map +1 -0
  435. package/dist/transport/{httpTransport.d.ts → http/transport.d.ts} +9 -6
  436. package/dist/transport/http/transport.d.ts.map +1 -0
  437. package/dist/transport/{httpTransport.js → http/transport.js} +153 -188
  438. package/dist/transport/http/transport.js.map +1 -0
  439. package/dist/transport/index.d.ts +8 -0
  440. package/dist/transport/index.d.ts.map +1 -0
  441. package/dist/transport/index.js +8 -0
  442. package/dist/transport/index.js.map +1 -0
  443. package/dist/transport/{commitFrames.d.ts → websocket/commitFrames.d.ts} +8 -20
  444. package/dist/transport/websocket/commitFrames.d.ts.map +1 -0
  445. package/dist/transport/{commitFrames.js → websocket/commitFrames.js} +6 -25
  446. package/dist/transport/websocket/commitFrames.js.map +1 -0
  447. package/dist/transport/{wsFrameHandlers.d.ts → websocket/frameHandlers.d.ts} +5 -5
  448. package/dist/transport/websocket/frameHandlers.d.ts.map +1 -0
  449. package/dist/transport/{wsFrameHandlers.js → websocket/frameHandlers.js} +10 -51
  450. package/dist/transport/websocket/frameHandlers.js.map +1 -0
  451. package/dist/transport/{heartbeat.d.ts → websocket/heartbeat.d.ts} +1 -1
  452. package/dist/transport/websocket/heartbeat.d.ts.map +1 -0
  453. package/dist/transport/{heartbeat.js → websocket/heartbeat.js} +2 -2
  454. package/dist/transport/websocket/heartbeat.js.map +1 -0
  455. package/dist/transport/websocket/index.d.ts +6 -0
  456. package/dist/transport/websocket/index.d.ts.map +1 -0
  457. package/dist/transport/websocket/index.js +6 -0
  458. package/dist/transport/websocket/index.js.map +1 -0
  459. package/dist/transport/{wsTransport.d.ts → websocket/transport.d.ts} +13 -25
  460. package/dist/transport/websocket/transport.d.ts.map +1 -0
  461. package/dist/transport/{wsTransport.js → websocket/transport.js} +14 -14
  462. package/dist/transport/websocket/transport.js.map +1 -0
  463. package/dist/types/index.d.ts +1 -1
  464. package/dist/types/index.d.ts.map +1 -1
  465. package/dist/types/streams.d.ts +8 -48
  466. package/dist/types/streams.d.ts.map +1 -1
  467. package/dist/types/streams.js +2 -2
  468. package/dist/wire/accountResponses.d.ts +4 -72
  469. package/dist/wire/accountResponses.d.ts.map +1 -1
  470. package/dist/wire/accountResponses.js +2 -10
  471. package/dist/wire/accountResponses.js.map +1 -1
  472. package/dist/wire/apiLifecycle.d.ts +63 -0
  473. package/dist/wire/apiLifecycle.d.ts.map +1 -0
  474. package/dist/wire/apiLifecycle.js +89 -0
  475. package/dist/wire/apiLifecycle.js.map +1 -0
  476. package/dist/wire/frames.d.ts +6 -83
  477. package/dist/wire/frames.d.ts.map +1 -1
  478. package/dist/wire/frames.js +4 -11
  479. package/dist/wire/frames.js.map +1 -1
  480. package/dist/wire/inboundFrames.d.ts +6 -131
  481. package/dist/wire/inboundFrames.d.ts.map +1 -1
  482. package/dist/wire/inboundFrames.js +3 -3
  483. package/dist/wire/inboundFrames.js.map +1 -1
  484. package/dist/wire/index.d.ts +20 -15
  485. package/dist/wire/index.d.ts.map +1 -1
  486. package/dist/wire/index.js +22 -8
  487. package/dist/wire/index.js.map +1 -1
  488. package/dist/wire/modelMutations.d.ts +1 -32
  489. package/dist/wire/modelMutations.d.ts.map +1 -1
  490. package/dist/wire/modelMutations.js +1 -8
  491. package/dist/wire/modelMutations.js.map +1 -1
  492. package/dist/wire/rateLimit.d.ts +82 -0
  493. package/dist/wire/rateLimit.d.ts.map +1 -0
  494. package/dist/wire/rateLimit.js +142 -0
  495. package/dist/wire/rateLimit.js.map +1 -0
  496. package/package.json +130 -10
  497. package/src/ai-sdk/modelTools.ts +5 -5
  498. package/src/ai-sdk/updateTool.ts +5 -7
  499. package/src/auth/capability.ts +5 -0
  500. package/src/auth/capabilityLifecycle.ts +1 -1
  501. package/src/auth/credentialPolicy.ts +1 -1
  502. package/src/auth/identity.ts +7 -7
  503. package/src/auth/index.ts +4 -663
  504. package/src/auth/runtime.ts +669 -0
  505. package/src/auth/sessionMint.ts +3 -2
  506. package/src/branches.ts +3 -0
  507. package/src/{coordination/awaitClaimGrant.ts → claims/awaitGrant.ts} +4 -4
  508. package/src/{wire/claims.ts → claims/contract.ts} +1 -1
  509. package/src/{coordination → claims}/events.ts +7 -11
  510. package/src/claims/index.ts +21 -0
  511. package/src/claims/lifetime.ts +78 -0
  512. package/src/{coordination → claims}/locator.ts +3 -3
  513. package/src/claims/routes.ts +81 -0
  514. package/src/{coordination → claims}/trace.ts +5 -5
  515. package/src/{ablo.ts → client/ablo.ts} +8 -20
  516. package/src/{transactionLayer.ts → client/contract.ts} +11 -13
  517. package/src/{headlessClient.ts → client/headless.ts} +13 -15
  518. package/src/client/index.ts +10 -0
  519. package/src/{resources → client/resources}/functionalUpdate.ts +4 -4
  520. package/src/{resources → client/resources}/httpResources.ts +163 -92
  521. package/src/client/resources/modelCreate.ts +73 -0
  522. package/src/{resources → client/resources}/modelOperations.ts +73 -55
  523. package/src/{resources → client/resources}/mutationOptions.ts +4 -17
  524. package/src/{resources → client/resources}/where.ts +1 -1
  525. package/src/{resources → client/resources}/writeOptionsSchema.ts +35 -27
  526. package/src/{transactions → commit}/confirmation/commitEnvelope.ts +2 -12
  527. package/src/{transactions → commit}/confirmation/httpCommitEnvelope.ts +1 -1
  528. package/src/{transactions → commit}/confirmation/pendingWrite.ts +1 -1
  529. package/src/{wire/commit.ts → commit/contract.ts} +27 -26
  530. package/src/{durableWrites.ts → commit/durableWrites.ts} +7 -7
  531. package/src/commit/httpRequest.ts +103 -0
  532. package/src/commit/index.ts +16 -0
  533. package/src/{readSetContext.ts → commit/readSetContext.ts} +24 -43
  534. package/src/{commitRecordRuntime.ts → commit/recordRuntime.ts} +12 -67
  535. package/src/coordination/index.ts +4 -54
  536. package/src/coordination/schema.ts +15 -309
  537. package/src/errorCodes.ts +62 -10
  538. package/src/errors.ts +32 -10
  539. package/src/index.ts +8 -8
  540. package/src/internal/read-set.ts +3 -6
  541. package/src/observability.ts +4 -4
  542. package/src/{wire/delta.ts → observation/contract.ts} +2 -2
  543. package/src/{wire/feedEvent.ts → observation/feedContract.ts} +3 -4
  544. package/src/{transport → observation}/httpFeed.ts +3 -3
  545. package/src/observation/index.ts +12 -0
  546. package/src/{log → observation/persistence}/syncDeltaRow.ts +6 -7
  547. package/src/pricing.ts +46 -25
  548. package/src/schema/audit.ts +121 -0
  549. package/src/schema/ddl.ts +71 -1
  550. package/src/schema/index.ts +20 -20
  551. package/src/schema/model.ts +17 -33
  552. package/src/schema/openapi.ts +170 -9
  553. package/src/schema/roles.ts +53 -0
  554. package/src/schema/schema.ts +91 -6
  555. package/src/schema/serialize.ts +8 -9
  556. package/src/schema/subject.ts +43 -0
  557. package/src/server/adapter.ts +3 -1
  558. package/src/server/commit.ts +6 -14
  559. package/src/server/index.ts +1 -1
  560. package/src/server/readConfig.ts +4 -0
  561. package/src/source/{adapter.ts → adapters/adapter.ts} +9 -5
  562. package/src/source/{adapterFactory.ts → adapters/adapterFactory.ts} +1 -1
  563. package/src/source/{conformance.ts → adapters/conformance.ts} +1 -1
  564. package/src/source/{contract.ts → adapters/contract.ts} +24 -61
  565. package/src/source/adapters/drizzle.ts +75 -29
  566. package/src/source/{idempotency.ts → adapters/idempotency.ts} +2 -2
  567. package/src/source/adapters/index.ts +20 -0
  568. package/src/source/adapters/kysely.ts +77 -27
  569. package/src/source/adapters/kyselyMutationCore.ts +23 -11
  570. package/src/source/adapters/memory.ts +26 -9
  571. package/src/source/adapters/migration.ts +11 -0
  572. package/src/source/{migrations.ts → adapters/migrations.ts} +6 -33
  573. package/src/source/adapters/prisma.ts +98 -34
  574. package/src/source/adapters/subjectAuthorization.ts +182 -0
  575. package/src/source/{connector.ts → connector/client.ts} +35 -12
  576. package/src/source/connector/index.ts +3 -0
  577. package/src/source/{connectorProtocol.ts → connector/protocol.ts} +10 -2
  578. package/src/source/delivery/index.ts +2 -0
  579. package/src/source/{pushQueue.ts → delivery/pushQueue.ts} +2 -2
  580. package/src/source/{factory.ts → endpoint/factory.ts} +150 -9
  581. package/src/source/endpoint/index.ts +4 -0
  582. package/src/source/{next.ts → endpoint/next.ts} +2 -2
  583. package/src/source/{signing.ts → endpoint/signing.ts} +1 -1
  584. package/src/source/index.ts +27 -18
  585. package/src/source/outbox/contract.ts +56 -0
  586. package/src/source/outbox/envelope.ts +47 -0
  587. package/src/source/outbox/index.ts +15 -0
  588. package/src/source/outbox/migrations.ts +71 -0
  589. package/src/source/outbox/retention.ts +2 -0
  590. package/src/source/types.ts +64 -10
  591. package/src/syncLog/contract.ts +19 -9
  592. package/src/testing/fixtures/httpResponses.ts +7 -0
  593. package/src/transport/{credentialLifecycle.ts → connection/credentialLifecycle.ts} +3 -3
  594. package/src/transport/connection/index.ts +4 -0
  595. package/src/transport/{connectionManager.ts → connection/manager.ts} +13 -4
  596. package/src/transport/{networkProbe.ts → connection/networkProbe.ts} +4 -4
  597. package/src/transport/{httpClient.ts → http/client.ts} +165 -184
  598. package/src/transport/http/helpers.ts +63 -0
  599. package/src/transport/http/index.ts +5 -0
  600. package/src/transport/{httpOptions.ts → http/options.ts} +6 -6
  601. package/src/transport/http/subscription.ts +174 -0
  602. package/src/transport/{httpTransport.ts → http/transport.ts} +210 -246
  603. package/src/transport/index.ts +7 -0
  604. package/src/transport/{commitFrames.ts → websocket/commitFrames.ts} +14 -46
  605. package/src/transport/{wsFrameHandlers.ts → websocket/frameHandlers.ts} +11 -54
  606. package/src/transport/{heartbeat.ts → websocket/heartbeat.ts} +2 -2
  607. package/src/transport/websocket/index.ts +5 -0
  608. package/src/transport/{wsTransport.ts → websocket/transport.ts} +16 -30
  609. package/src/types/index.ts +2 -6
  610. package/src/types/streams.ts +7 -61
  611. package/src/webhooks/events.ts +1 -1
  612. package/src/wire/accountResponses.ts +3 -12
  613. package/src/wire/apiLifecycle.ts +94 -0
  614. package/src/wire/frames.ts +5 -15
  615. package/src/wire/inboundFrames.ts +3 -3
  616. package/src/wire/index.ts +50 -15
  617. package/src/wire/modelMutations.ts +1 -14
  618. package/src/wire/rateLimit.ts +155 -0
  619. package/dist/ablo.d.ts.map +0 -1
  620. package/dist/ablo.js.map +0 -1
  621. package/dist/commitRecordRuntime.d.ts.map +0 -1
  622. package/dist/commitRecordRuntime.js.map +0 -1
  623. package/dist/coordination/awaitClaimGrant.d.ts.map +0 -1
  624. package/dist/coordination/awaitClaimGrant.js.map +0 -1
  625. package/dist/coordination/claimHeartbeatLoop.d.ts.map +0 -1
  626. package/dist/coordination/claimHeartbeatLoop.js.map +0 -1
  627. package/dist/coordination/claimMeta.d.ts.map +0 -1
  628. package/dist/coordination/claimMeta.js.map +0 -1
  629. package/dist/coordination/events.d.ts.map +0 -1
  630. package/dist/coordination/events.js +0 -8
  631. package/dist/coordination/events.js.map +0 -1
  632. package/dist/coordination/locator.d.ts.map +0 -1
  633. package/dist/coordination/locator.js.map +0 -1
  634. package/dist/coordination/targetConflict.d.ts.map +0 -1
  635. package/dist/coordination/targetConflict.js.map +0 -1
  636. package/dist/coordination/trace.d.ts.map +0 -1
  637. package/dist/coordination/trace.js.map +0 -1
  638. package/dist/durableWrites.d.ts.map +0 -1
  639. package/dist/durableWrites.js.map +0 -1
  640. package/dist/headlessClient.d.ts.map +0 -1
  641. package/dist/log/syncDeltaRow.d.ts.map +0 -1
  642. package/dist/log/syncDeltaRow.js.map +0 -1
  643. package/dist/policy/types.d.ts +0 -226
  644. package/dist/policy/types.d.ts.map +0 -1
  645. package/dist/policy/types.js +0 -127
  646. package/dist/policy/types.js.map +0 -1
  647. package/dist/readSetContext.d.ts.map +0 -1
  648. package/dist/readSetContext.js.map +0 -1
  649. package/dist/resources/functionalUpdate.d.ts.map +0 -1
  650. package/dist/resources/functionalUpdate.js.map +0 -1
  651. package/dist/resources/httpResources.d.ts.map +0 -1
  652. package/dist/resources/httpResources.js +0 -17
  653. package/dist/resources/httpResources.js.map +0 -1
  654. package/dist/resources/modelOperations.d.ts.map +0 -1
  655. package/dist/resources/modelOperations.js.map +0 -1
  656. package/dist/resources/mutationOptions.d.ts.map +0 -1
  657. package/dist/resources/mutationOptions.js.map +0 -1
  658. package/dist/resources/where.d.ts.map +0 -1
  659. package/dist/resources/where.js.map +0 -1
  660. package/dist/resources/writeOptionsSchema.d.ts.map +0 -1
  661. package/dist/resources/writeOptionsSchema.js.map +0 -1
  662. package/dist/schema/coordination.d.ts +0 -113
  663. package/dist/schema/coordination.d.ts.map +0 -1
  664. package/dist/schema/coordination.js +0 -134
  665. package/dist/schema/coordination.js.map +0 -1
  666. package/dist/source/adapter.d.ts.map +0 -1
  667. package/dist/source/adapter.js.map +0 -1
  668. package/dist/source/adapterFactory.d.ts.map +0 -1
  669. package/dist/source/adapterFactory.js.map +0 -1
  670. package/dist/source/adapterProfile.d.ts.map +0 -1
  671. package/dist/source/adapterProfile.js.map +0 -1
  672. package/dist/source/conformance.d.ts.map +0 -1
  673. package/dist/source/conformance.js.map +0 -1
  674. package/dist/source/connector.d.ts.map +0 -1
  675. package/dist/source/connector.js.map +0 -1
  676. package/dist/source/connectorProtocol.d.ts.map +0 -1
  677. package/dist/source/connectorProtocol.js.map +0 -1
  678. package/dist/source/contract.d.ts.map +0 -1
  679. package/dist/source/contract.js.map +0 -1
  680. package/dist/source/drizzle.d.ts +0 -2
  681. package/dist/source/drizzle.d.ts.map +0 -1
  682. package/dist/source/drizzle.js +0 -2
  683. package/dist/source/drizzle.js.map +0 -1
  684. package/dist/source/factory.d.ts.map +0 -1
  685. package/dist/source/factory.js.map +0 -1
  686. package/dist/source/idempotency.d.ts.map +0 -1
  687. package/dist/source/idempotency.js.map +0 -1
  688. package/dist/source/kysely.d.ts +0 -3
  689. package/dist/source/kysely.d.ts.map +0 -1
  690. package/dist/source/kysely.js +0 -3
  691. package/dist/source/kysely.js.map +0 -1
  692. package/dist/source/migrations.d.ts.map +0 -1
  693. package/dist/source/migrations.js.map +0 -1
  694. package/dist/source/next.d.ts.map +0 -1
  695. package/dist/source/next.js.map +0 -1
  696. package/dist/source/pushQueue.d.ts.map +0 -1
  697. package/dist/source/pushQueue.js.map +0 -1
  698. package/dist/source/signing.d.ts.map +0 -1
  699. package/dist/source/signing.js.map +0 -1
  700. package/dist/transactionLayer.d.ts.map +0 -1
  701. package/dist/transactionLayer.js.map +0 -1
  702. package/dist/transactions/confirmation/commitEnvelope.d.ts.map +0 -1
  703. package/dist/transactions/confirmation/commitEnvelope.js.map +0 -1
  704. package/dist/transactions/confirmation/httpCommitEnvelope.d.ts.map +0 -1
  705. package/dist/transactions/confirmation/httpCommitEnvelope.js.map +0 -1
  706. package/dist/transactions/confirmation/idempotencyKey.d.ts.map +0 -1
  707. package/dist/transactions/confirmation/idempotencyKey.js.map +0 -1
  708. package/dist/transactions/confirmation/pendingWrite.d.ts.map +0 -1
  709. package/dist/transactions/confirmation/pendingWrite.js.map +0 -1
  710. package/dist/transport/commitFrames.d.ts.map +0 -1
  711. package/dist/transport/commitFrames.js.map +0 -1
  712. package/dist/transport/connectionManager.d.ts.map +0 -1
  713. package/dist/transport/connectionManager.js.map +0 -1
  714. package/dist/transport/credentialLifecycle.d.ts.map +0 -1
  715. package/dist/transport/credentialLifecycle.js.map +0 -1
  716. package/dist/transport/heartbeat.d.ts.map +0 -1
  717. package/dist/transport/heartbeat.js.map +0 -1
  718. package/dist/transport/httpClient.d.ts.map +0 -1
  719. package/dist/transport/httpClient.js.map +0 -1
  720. package/dist/transport/httpFeed.d.ts +0 -4
  721. package/dist/transport/httpFeed.d.ts.map +0 -1
  722. package/dist/transport/httpOptions.js.map +0 -1
  723. package/dist/transport/httpTransport.d.ts.map +0 -1
  724. package/dist/transport/httpTransport.js.map +0 -1
  725. package/dist/transport/networkProbe.d.ts.map +0 -1
  726. package/dist/transport/networkProbe.js.map +0 -1
  727. package/dist/transport/wsFrameHandlers.d.ts.map +0 -1
  728. package/dist/transport/wsFrameHandlers.js.map +0 -1
  729. package/dist/transport/wsTransport.d.ts.map +0 -1
  730. package/dist/transport/wsTransport.js.map +0 -1
  731. package/dist/wire/claimEvent.d.ts.map +0 -1
  732. package/dist/wire/claimEvent.js.map +0 -1
  733. package/dist/wire/claims.d.ts.map +0 -1
  734. package/dist/wire/claims.js.map +0 -1
  735. package/dist/wire/commit.d.ts +0 -2801
  736. package/dist/wire/commit.d.ts.map +0 -1
  737. package/dist/wire/commit.js.map +0 -1
  738. package/dist/wire/delta.d.ts.map +0 -1
  739. package/dist/wire/delta.js.map +0 -1
  740. package/dist/wire/deltaDelivery.d.ts.map +0 -1
  741. package/dist/wire/deltaDelivery.js.map +0 -1
  742. package/dist/wire/feedCursor.d.ts.map +0 -1
  743. package/dist/wire/feedCursor.js.map +0 -1
  744. package/dist/wire/feedEvent.d.ts.map +0 -1
  745. package/dist/wire/feedEvent.js.map +0 -1
  746. package/src/policy/types.ts +0 -300
  747. package/src/schema/coordination.ts +0 -161
  748. package/src/source/drizzle.ts +0 -1
  749. package/src/source/kysely.ts +0 -2
  750. /package/dist/{coordination → claims}/targetConflict.d.ts +0 -0
  751. /package/dist/{coordination → claims}/targetConflict.js +0 -0
  752. /package/dist/{resources → client/resources}/mutationOptions.js +0 -0
  753. /package/dist/{resources → client/resources}/where.d.ts +0 -0
  754. /package/dist/{transactions → commit}/confirmation/httpCommitEnvelope.d.ts +0 -0
  755. /package/dist/{transactions → commit}/confirmation/idempotencyKey.d.ts +0 -0
  756. /package/dist/{transactions → commit}/confirmation/idempotencyKey.js +0 -0
  757. /package/dist/source/{adapter.js → adapters/adapter.js} +0 -0
  758. /package/dist/source/{adapterFactory.d.ts → adapters/adapterFactory.d.ts} +0 -0
  759. /package/dist/source/{adapterProfile.d.ts → adapters/adapterProfile.d.ts} +0 -0
  760. /package/dist/source/{adapterProfile.js → adapters/adapterProfile.js} +0 -0
  761. /package/dist/source/{idempotency.d.ts → adapters/idempotency.d.ts} +0 -0
  762. /package/src/{wire/claimEvent.ts → claims/eventContract.ts} +0 -0
  763. /package/src/{coordination/claimHeartbeatLoop.ts → claims/heartbeat.ts} +0 -0
  764. /package/src/{coordination/claimMeta.ts → claims/meta.ts} +0 -0
  765. /package/src/{coordination → claims}/targetConflict.ts +0 -0
  766. /package/src/{transactions → commit}/confirmation/idempotencyKey.ts +0 -0
  767. /package/src/{wire/feedCursor.ts → observation/cursor.ts} +0 -0
  768. /package/src/{wire/deltaDelivery.ts → observation/deliveryContract.ts} +0 -0
  769. /package/src/source/{adapterProfile.ts → adapters/adapterProfile.ts} +0 -0
@@ -5,19 +5,18 @@
5
5
  * These types describe the *change or the query being requested*, never a local
6
6
  * copy of the rows it touches, so they sit in the commit core and are shared
7
7
  * by every transport and every caller (ADR 0013 §4, ADR 0016). The factory that
8
- * binds them to reactive model instances — `createModelProxy` — stays with the
8
+ * binds them to reactive model instances — `createModelOperations` — stays with the
9
9
  * reactive consumer, along with `ModelOperations` and `ModelCollaboration`,
10
10
  * which reference the live participant handle.
11
11
  */
12
12
 
13
- import type { ModelScope } from '../types/index.js';
14
- import type { ResolveClaimMeta } from '../types/global.js';
15
- import type { AbloError } from '../errors.js';
16
- import type { StaleNotification, TrackDependency } from '../coordination/schema.js';
17
- import type { FieldRef, FieldSelector } from '../schema/fieldRef.js';
18
- import type { BaseModelFields } from '../schema/schema.js';
19
- import type { ClaimHeartbeatPlan } from '../coordination/claimHeartbeatLoop.js';
20
- import type { Duration } from '../utils/duration.js';
13
+ import type { ModelScope } from '../../types/index.js';
14
+ import type { ResolveClaimMeta } from '../../types/global.js';
15
+ import type { AbloError } from '../../errors.js';
16
+ import type { FieldRef, FieldSelector } from '../../schema/fieldRef.js';
17
+ import type { BaseModelFields, Clearable } from '../../schema/schema.js';
18
+ import type { ClaimHeartbeatPlan } from '../../claims/heartbeat.js';
19
+ import type { Duration } from '../../utils/duration.js';
21
20
  import type {
22
21
  Claim,
23
22
  ClaimHeartbeat,
@@ -25,7 +24,7 @@ import type {
25
24
  HeldClaim,
26
25
  HeldLease,
27
26
  Peer,
28
- } from '../types/streams.js';
27
+ } from '../../types/streams.js';
29
28
  import type { MutationOptions } from './mutationOptions.js';
30
29
  import type { LoadWhere } from './where.js';
31
30
 
@@ -142,34 +141,6 @@ export function claimAttemptFailure(
142
141
  */
143
142
  export type ModelListScope = ModelScope | `${ModelScope}`;
144
143
 
145
- /**
146
- * Options for `track({ id })` — register a durable premise on a row.
147
- *
148
- * Derived from the wire's row-form {@link TrackDependency} rather than restated
149
- * beside it: the caller names the row and, optionally, the watermark it is
150
- * premised on, while `model` comes from the proxy the call was made on. Adding
151
- * a field to the dependency therefore reaches this surface automatically, and
152
- * removing one stops the callers compiling.
153
- *
154
- * On `readAt`: omit it to baseline at the current head — "tell me about
155
- * anything from here on". Pass a known watermark (the one you read the row at)
156
- * to also catch a change that landed between that read and this call.
157
- */
158
- export type ModelTrackParams = Omit<
159
- Extract<TrackDependency, { model: string }>,
160
- 'model'
161
- >;
162
-
163
- /** The result of `track({ id })`. */
164
- export interface ModelTrackResult {
165
- /**
166
- * Tracks that had ALREADY fired at registration time — a change matching an
167
- * open track that landed before this call. Present only when something was
168
- * already stale; the ongoing signal arrives on the receipts of later commits.
169
- */
170
- notifications?: StaleNotification[];
171
- }
172
-
173
144
  /** Options for the synchronous local-graph reads `local.list` and `onChange` —
174
145
  * a JavaScript `filter`, an equality `where`, and a lifecycle `state`. This is
175
146
  * the local, reactive axis; contrast {@link ServerReadOptions}, the
@@ -191,7 +162,7 @@ export type LocalCountOptions<T> = Pick<
191
162
  'where' | 'filter' | 'state'
192
163
  >;
193
164
 
194
- /** Options for the asynchronous server reads `get` and `list` — the
165
+ /** Options for the asynchronous server reads `read` and `list` — the
195
166
  * operator `where` filter, `type`, and `expand`. This is the server axis;
196
167
  * contrast {@link LocalReadOptions}, the local, reactive axis. */
197
168
  export interface ServerReadOptions<T> {
@@ -232,11 +203,17 @@ export interface ServerReadOptions<T> {
232
203
  expand?: readonly string[];
233
204
  }
234
205
 
235
- /** Options for the single-row async server read `get({ id })`. A subset of
206
+ /** Options for an explicit complete collection traversal. */
207
+ export interface ListAllOptions<T> extends Omit<ServerReadOptions<T>, 'cursor'> {
208
+ /** Maximum pages to read before refusing an unexpectedly broad traversal. @default 100 */
209
+ maxPages?: number;
210
+ /** Stops traversal between page requests and row yields. */
211
+ signal?: AbortSignal;
212
+ }
213
+
214
+ /** Options for the single-row async server `read({ id })`. A subset of
236
215
  * {@link ServerReadOptions} — `where`/`limit`/`orderBy` are fixed by the id. */
237
- export type ServerRetrieveOptions = Pick<ServerReadOptions<unknown>, 'type' | 'expand'>;
238
- /** Canonical point-lookup options; retained separately for compatibility naming. */
239
- export type ServerGetOptions = ServerRetrieveOptions;
216
+ export type ServerPointReadOptions = Pick<ServerReadOptions<unknown>, 'type' | 'expand'>;
240
217
  /**
241
218
  * A claimable part of a row is a field declared by that model's Zod shape.
242
219
  *
@@ -527,15 +504,26 @@ export interface ClaimReadApi<T = Record<string, unknown>> {
527
504
  * stateless HTTP claim surface from the reactive {@link ClaimReadApi}.
528
505
  */
529
506
  export type AwaitedClaimMethod<F> = F extends (...args: infer A) => infer R
530
- ? R extends Promise<unknown>
507
+ // `[R]` keeps the check non-distributive. `state` returns `Claim | null`, and
508
+ // a bare `R extends …` split that into two function types, one per union
509
+ // member, so the HTTP `state` was typed as a union of functions rather than
510
+ // one function returning the union. The cast that hid it is gone.
511
+ ? [R] extends [Promise<unknown>]
531
512
  ? (...args: A) => R
532
513
  : (...args: A) => Promise<R>
533
514
  : F;
534
515
 
535
- export interface ClaimApi<
516
+ /**
517
+ * The four ways to take a claim. Already async on every transport, so this is
518
+ * the ONE definition of the callable half of a claim namespace: the reactive
519
+ * {@link ClaimApi} and the stateless {@link HttpClaimApi} both extend it, and an
520
+ * overload added here reaches both. (The two used to restate these by hand, and
521
+ * the row-free pair below existed on one surface and not the other.)
522
+ */
523
+ export interface ClaimCall<
536
524
  T,
537
525
  Fields = T,
538
- > extends ClaimReadApi<T> {
526
+ > {
539
527
  /**
540
528
  * The try-claim: `contention: { mode: 'skip' }` (or `queue: false`)
541
529
  * treats a held target as an expected outcome, not an error — it resolves
@@ -550,23 +538,31 @@ export interface ClaimApi<
550
538
  * Takes a claim and returns an explicit held-work handle — a {@link HeldClaim}.
551
539
  * `data`, `release`, `revoke`, and the async disposer are always present (this
552
540
  * call re-reads the row under the lease), so callers can use `handle.data`
553
- * directly and `await using` works without a guard.
541
+ * directly and `await using` works without a guard. A row that does not
542
+ * exist rejects with `AbloNotFoundError` after the lease is given back; to
543
+ * hold a key before its row exists, use the id-only form below.
554
544
  */
555
545
  (params: ClaimParams<Fields>): Promise<HeldClaim<T>>;
556
546
  /** The row-free try-claim — `null` when the key is already held. */
557
547
  (id: string, opts: ClaimSkipOptions<Fields>): Promise<HeldLease | null>;
558
548
  /**
559
549
  * Takes a claim by id alone, for a row that lives only in the customer's own
560
- * database Ablo has never seen it, so there is nothing to re-read. Returns a
561
- * {@link HeldLease}: the same lease controls as {@link HeldClaim}
562
- * (`release`, `revoke`, `heartbeat`, `await using`) but no `.data`. Locking a
563
- * key you know by id is exactly this — serialize writers without first
564
- * syncing the row into Ablo.
550
+ * database or does not exist yet Ablo has nothing to re-read, so no read is
551
+ * made after the grant. Returns a {@link HeldLease}: the same lease controls
552
+ * as {@link HeldClaim} (`release`, `revoke`, `heartbeat`, `await using`) but
553
+ * no `.data`. Locking a key you know by id is exactly this — serialize
554
+ * writers without first syncing the row into Ablo, or claim an id before
555
+ * creating its row so two actors cannot both create it.
565
556
  */
566
557
  (id: string, opts?: ClaimOptions<Fields>): Promise<HeldLease>;
567
558
  }
568
559
 
569
- export interface ModelRetrieveParams extends ServerRetrieveOptions {
560
+ export interface ClaimApi<
561
+ T,
562
+ Fields = T,
563
+ > extends ClaimReadApi<T>, ClaimCall<T, Fields> {}
564
+
565
+ export interface ModelReadParams extends ServerPointReadOptions {
570
566
  readonly id: string;
571
567
  }
572
568
 
@@ -579,7 +575,10 @@ export interface ModelRetrieveParams extends ServerRetrieveOptions {
579
575
  * confirmation. Callers that need an earlier queued receipt use the lower-level
580
576
  * `commits.create` resource instead.
581
577
  */
582
- export type ModelWriteOptions = Omit<MutationOptions, 'wait'>;
578
+ export type ModelWriteOptions = Omit<
579
+ MutationOptions,
580
+ 'wait' | 'readAt' | 'fenceToken' | 'claimRef'
581
+ >;
583
582
 
584
583
  export interface ModelCreateParams<T, CreateInput>
585
584
  extends ModelWriteOptions {
@@ -588,6 +587,21 @@ export interface ModelCreateParams<T, CreateInput>
588
587
  readonly claim?: Claim<T> | ClaimTargetOptions<CreateInput> | null;
589
588
  }
590
589
 
590
+ /**
591
+ * Creating many rows at once: the same verb, handed a list.
592
+ *
593
+ * One atomic commit, so the batch lands whole or not at all, and the rows come
594
+ * back in the order they were given. There is no `id` beside `data` here the
595
+ * way there is for a single create, since one id cannot address many rows;
596
+ * write it into each row instead, which the create input has always allowed.
597
+ */
598
+ export type ModelCreateManyParams<CreateInput> = Pick<
599
+ ModelWriteOptions,
600
+ 'idempotencyKey' | 'reads'
601
+ > & {
602
+ readonly data: readonly CreateInput[];
603
+ };
604
+
591
605
  export interface ModelUpdateParams<T, Fields = T>
592
606
  extends ModelWriteOptions {
593
607
  readonly id: string;
@@ -595,8 +609,12 @@ export interface ModelUpdateParams<T, Fields = T>
595
609
  * Patch only fields declared by the model's Zod input shape. Hydrated rows
596
610
  * also carry framework fields, relations, methods, and computed values; none
597
611
  * of those are writable data.
612
+ *
613
+ * Send a field to change it, omit it to leave it, send `null` to clear it —
614
+ * see {@link Clearable}. `undefined` is not a clear: it is dropped from the
615
+ * payload and the old value survives.
598
616
  */
599
- readonly data: Partial<ClaimableFields<Fields>>;
617
+ readonly data: Clearable<ClaimableFields<Fields>>;
600
618
  readonly claim?: Claim<T> | ClaimTargetOptions<Fields> | null;
601
619
  }
602
620
 
@@ -7,8 +7,8 @@
7
7
  * core rather than the reactive consumer (ADR 0013 §4, ADR 0016).
8
8
  */
9
9
 
10
- import type { CommitWait } from '../wire/commit.js';
11
- import type { OnStaleMode, ReadDependency, TrackDependency } from '../coordination/schema.js';
10
+ import type { CommitWait } from '../../commit/contract.js';
11
+ import type { ReadDependency } from '../../coordination/schema.js';
12
12
 
13
13
  /**
14
14
  * Per-call options accepted by any mutation, passed as the last argument.
@@ -27,7 +27,6 @@ export interface MutationOptions {
27
27
  label?: string;
28
28
  wait?: CommitWait;
29
29
  readAt?: number | null;
30
- onStale?: OnStaleMode | null;
31
30
  /**
32
31
  * The fencing token (Option B) of the held claim this write belongs to. The
33
32
  * server validates it against the entity's persisted high-water and rejects a
@@ -43,24 +42,12 @@ export interface MutationOptions {
43
42
  * The batch premise — the answer to "did anything I looked at change?" Each
44
43
  * entry is a row (`{ model, id, readAt, fields? }`) or a sync group
45
44
  * (`{ group, readAt }`) that this write was premised on. The server checks
46
- * that none of them moved since their `readAt` and applies the entry's
47
- * `onStale` behavior to the whole batch. This is distinct from the per-operation
45
+ * that none of them moved since their `readAt`; a stale dependency rejects the
46
+ * whole batch. This is distinct from the per-operation
48
47
  * `readAt`, which guards only the row being written.
49
48
  *
50
49
  * See `packages/ablo/docs/concurrency-convention.md` (§3 the two
51
50
  * premises, §4 the batch premise) for the governing convention.
52
51
  */
53
52
  reads?: ReadDependency[] | null;
54
- /**
55
- * Durable premises — what this write (or the record it produces) should
56
- * keep watching. Unlike `reads`, which is checked once at commit and discarded,
57
- * each `track` entry is persisted and re-checked against every future delta; a
58
- * later matching change opens a `StaleNotification` for the tracking participant,
59
- * delivered at their next commit or live to a held claim. Each entry is a row
60
- * (`{ model, id }`) or a sync group (`{ group }`), optionally pinned to a `readAt`
61
- * baseline (defaults to this commit's watermark).
62
- *
63
- * See `packages/ablo/docs/groups.md` for how `track` drives propagation.
64
- */
65
- track?: TrackDependency[] | null;
66
53
  }
@@ -15,7 +15,7 @@
15
15
 
16
16
  import { z } from 'zod';
17
17
 
18
- import { AbloValidationError } from '../errors.js';
18
+ import { AbloValidationError } from '../../errors.js';
19
19
 
20
20
  /** Primitive operand types allowed in a where clause. */
21
21
  export const wherePrimitiveSchema = z.union([
@@ -2,7 +2,7 @@
2
2
  * The Zod schema for write options — the settings accepted by every write
3
3
  * entry point, including `ablo.<model>.create/update/delete`, `commits.create`,
4
4
  * and the HTTP write routes. Each of those boundaries validates against this
5
- * one schema, so a caller who passes, say, `onStale: 'rejct'` fails right away
5
+ * one schema, so a caller who passes a malformed option fails right away
6
6
  * with a typed {@link AbloValidationError} at the call site instead of silently
7
7
  * or with a 400 from the server.
8
8
  *
@@ -17,25 +17,12 @@
17
17
  */
18
18
 
19
19
  import { z } from 'zod';
20
- import { logPositionSchema } from '../syncLog/contract.js';
21
- import type { MutationOptions } from '../resources/mutationOptions.js';
22
- import { AbloValidationError } from '../errors.js';
23
- import { commitWaitSchema } from '../wire/commit.js';
24
- import {
25
- onStaleModeSchema,
26
- MAX_READ_SET_ENTRIES,
27
- readDependencyListSchema,
28
- readSetProjectionEntryCount,
29
- trackDependencyListSchema,
30
- } from '../coordination/schema.js';
31
- import type { AssertExact } from '../types/assertExact.js';
32
-
33
- // Re-exported, not redeclared. `coordination/schema.ts` owns this enum — it is
34
- // what the wire schemas and the server validate against — while the published
35
- // SDK barrel exports the name from this module. Declaring it twice put a second
36
- // object behind the public export that agreed with the canonical one only by
37
- // both happening to list the same three strings.
38
- export { onStaleModeSchema };
20
+ import { logPositionSchema } from '../../syncLog/contract.js';
21
+ import type { MutationOptions } from './mutationOptions.js';
22
+ import { AbloValidationError } from '../../errors.js';
23
+ import { commitWaitSchema } from '../../commit/contract.js';
24
+ import { readDependencyListSchema } from '../../coordination/schema.js';
25
+ import type { AssertExact } from '../../types/assertExact.js';
39
26
 
40
27
  export const writeOptionsSchema = z.object({
41
28
  /** Idempotency key the server records in `mutation_log` to make retries
@@ -47,8 +34,6 @@ export const writeOptionsSchema = z.object({
47
34
  wait: commitWaitSchema.optional(),
48
35
  /** Stale guard: the sync watermark the caller's reasoning was based on. */
49
36
  readAt: logPositionSchema.nullish(),
50
- /** What the server does when the target moved past `readAt`. */
51
- onStale: onStaleModeSchema.nullish(),
52
37
  /** The held claim's fencing token (Option B), sourced from the claim handle
53
38
  * rather than set by hand; the server validates it against the entity's
54
39
  * high-water. Kept in the schema so it stays aligned with `MutationOptions`
@@ -61,11 +46,6 @@ export const writeOptionsSchema = z.object({
61
46
  claimRef: z.union([z.string(), z.object({ id: z.string() })]).nullish(),
62
47
  /** Commit-lifetime entries in the write's ReadSet. */
63
48
  reads: readDependencyListSchema.nullish(),
64
- /** Persisted entries projected from the write's ReadSet. */
65
- track: trackDependencyListSchema.nullish(),
66
- }).refine((value) => readSetProjectionEntryCount(value) <= MAX_READ_SET_ENTRIES, {
67
- path: ['reads'],
68
- message: `reads and track may contain at most ${MAX_READ_SET_ENTRIES} entries combined`,
69
49
  });
70
50
 
71
51
  export type WriteOptionsInput = z.infer<typeof writeOptionsSchema>;
@@ -107,3 +87,31 @@ const _writeOptionsContractInSync: AssertExact<
107
87
  keyof WriteOptionsContract
108
88
  > = true;
109
89
  void _writeOptionsContractInSync;
90
+
91
+ /**
92
+ * Refuse a per-model write that does not name its row.
93
+ *
94
+ * `update` and `delete` address the row through the URL, so an absent `id`
95
+ * used to be spelled into the path by `encodeURIComponent` as the literal
96
+ * string `"undefined"`. The request was well-formed, it matched no row, and it
97
+ * came back as an ordinary receipt: `delete({ where: { id } })` reported
98
+ * success and deleted nothing. `{ where }` is the shape the commit protocol
99
+ * takes one layer down, so reaching for it here is an easy and quiet mistake.
100
+ *
101
+ * The typed surface already rejects it at compile time. This is the same
102
+ * refusal for callers who reach the transport without those types.
103
+ */
104
+ export function assertWriteTarget(
105
+ action: 'update' | 'delete',
106
+ modelName: string,
107
+ id: unknown,
108
+ ): void {
109
+ if (typeof id === 'string' && id.length > 0) return;
110
+ const namedAFilter =
111
+ typeof id === 'object' && id !== null && 'where' in (id as Record<string, unknown>);
112
+ throw new AbloValidationError(
113
+ `A ${modelName} ${action} has to name the row it acts on: ${action}({ id })` +
114
+ (namedAFilter ? ', not a `where` filter.' : '.'),
115
+ { code: 'invalid_body', param: 'id' },
116
+ );
117
+ }
@@ -8,14 +8,9 @@
8
8
  */
9
9
 
10
10
  import { z } from 'zod';
11
- import {
12
- MAX_READ_SET_ENTRIES,
13
- readDependencyListSchema,
14
- readSetProjectionEntryCount,
15
- trackDependencyListSchema,
16
- } from '../../coordination/schema.js';
11
+ import { readDependencyListSchema } from '../../coordination/schema.js';
17
12
  import { wireCommitOperationSchema } from '../../wire/frames.js';
18
- import { correlationIdSchema } from '../../wire/commit.js';
13
+ import { correlationIdSchema } from '../contract.js';
19
14
  import { idempotencyKeySchema } from './idempotencyKey.js';
20
15
  import { snapshotJsonValue } from '../../utils/json.js';
21
16
 
@@ -48,7 +43,6 @@ export const durableCommitOperationSchema = wireCommitOperationSchema
48
43
  transactionId: true,
49
44
  claimId: true,
50
45
  readAt: true,
51
- onStale: true,
52
46
  fenceToken: true,
53
47
  })
54
48
  .extend({
@@ -70,10 +64,6 @@ export type DurableCommitOperationInput = z.input<typeof durableCommitOperationS
70
64
 
71
65
  const durableCommitOptionsSchema = z.strictObject({
72
66
  reads: readDependencyListSchema.nullable().optional(),
73
- track: trackDependencyListSchema.nullable().optional(),
74
- }).refine((value) => readSetProjectionEntryCount(value) <= MAX_READ_SET_ENTRIES, {
75
- path: ['reads'],
76
- message: `reads and track may contain at most ${MAX_READ_SET_ENTRIES} entries combined`,
77
67
  });
78
68
 
79
69
  export const commitOutboxScopeSchema = z.strictObject({
@@ -3,7 +3,7 @@
3
3
  import { z } from 'zod';
4
4
  import { v5 as uuidv5 } from 'uuid';
5
5
  import { snapshotJsonValue, stableStringify } from '../../utils/json.js';
6
- import { correlationIdSchema } from '../../wire/commit.js';
6
+ import { correlationIdSchema } from '../contract.js';
7
7
  import { PROTOCOL_VERSION } from '../../wire/protocolVersion.js';
8
8
  import { idempotencyKeySchema } from './idempotencyKey.js';
9
9
 
@@ -8,7 +8,7 @@
8
8
  * this module only unions them.
9
9
  *
10
10
  * The port that persists these records is a behavior contract, not a persisted
11
- * shape, so it lives outside this directory in `src/durableWrites.ts`.
11
+ * shape, so it lives outside this directory in `src/commit/durableWrites.ts`.
12
12
  */
13
13
 
14
14
  import { z } from 'zod';
@@ -20,15 +20,8 @@
20
20
  import { z } from 'zod';
21
21
  import { logPositionSchema } from '../syncLog/contract.js';
22
22
  import {
23
- onStaleModeSchema,
24
- MAX_READ_SET_ENTRIES,
25
23
  readDependencyListSchema,
26
- readSetRowTargetSchema,
27
- readSetProjectionEntryCount,
28
- readSetSchema,
29
24
  participantKindSchema,
30
- staleNotificationSchema,
31
- trackDependencyListSchema,
32
25
  } from '../coordination/schema.js';
33
26
  import type { ErrorCode } from '../errorCodes.js';
34
27
  import { requiredCapabilityWireSchema } from '../errors.js';
@@ -100,7 +93,6 @@ export const commitWaitSchema = z.union([queuedStatusSchema, confirmedStatusSche
100
93
  export type CommitWait = z.infer<typeof commitWaitSchema>;
101
94
 
102
95
  const missingIdsSchema = z.array(z.string().min(1));
103
- const notificationsSchema = z.array(staleNotificationSchema);
104
96
 
105
97
  export const commitOperationOutcomeSchema = z.enum([
106
98
  'created',
@@ -143,7 +135,12 @@ export type CommitAttempt = z.infer<typeof commitAttemptSchema>;
143
135
 
144
136
  export const commitClaimReferenceSchema = z.strictObject({
145
137
  id: z.string().min(1),
146
- target: readSetRowTargetSchema,
138
+ target: z.strictObject({
139
+ scope: z.literal('row'),
140
+ model: z.string(),
141
+ id: z.string(),
142
+ fields: z.array(z.string()).readonly().optional(),
143
+ }),
147
144
  fenceToken: z.number().int().nonnegative(),
148
145
  });
149
146
  export type CommitClaimReference = z.infer<typeof commitClaimReferenceSchema>;
@@ -178,7 +175,6 @@ const successfulReceiptCommonShape = {
178
175
  success: z.literal(true),
179
176
  ops: z.number().int().nonnegative(),
180
177
  authority: effectiveAuthoritySchema,
181
- notifications: notificationsSchema.optional(),
182
178
  missingIds: missingIdsSchema.optional(),
183
179
  /** Exact rows returned by the writing transaction; absent on durable replay. */
184
180
  operationResults: operationResultsSchema.optional(),
@@ -266,7 +262,6 @@ const executionEvidenceShape = {
266
262
  firstSyncId: z.number().int().nonnegative(),
267
263
  createdAt: commitTimestampSchema,
268
264
  confirmationTransactionIds: confirmationTransactionIdsSchema.optional(),
269
- notifications: notificationsSchema.optional(),
270
265
  missingIds: missingIdsSchema.optional(),
271
266
  } as const;
272
267
 
@@ -341,7 +336,6 @@ export type CommitExecutionResultInput = z.input<typeof commitExecutionResultSch
341
336
  export type CommitExecutionResult = z.infer<typeof commitExecutionResultSchema>;
342
337
 
343
338
  const ackCommonShape = {
344
- notifications: notificationsSchema.optional(),
345
339
  missingIds: missingIdsSchema.optional(),
346
340
  operationResults: operationResultsSchema.optional(),
347
341
  } as const;
@@ -376,7 +370,6 @@ export const clientCommitReceiptSchema = z.strictObject({
376
370
  id: z.string().min(1),
377
371
  status: z.union([queuedStatusSchema, confirmedStatusSchema]),
378
372
  lastSyncId: logPositionSchema.optional(),
379
- notifications: notificationsSchema.optional(),
380
373
  missingIds: missingIdsSchema.optional(),
381
374
  operationResults: operationResultsSchema.optional(),
382
375
  });
@@ -401,14 +394,28 @@ export const commitOperationControlShape = {
401
394
  transactionId: z.string().nullish(),
402
395
  claimId: z.string().min(1).nullish(),
403
396
  readAt: logPositionSchema.nullish(),
404
- onStale: onStaleModeSchema.nullish(),
405
397
  fenceToken: z.number().nullish(),
406
398
  };
407
399
 
400
+ /** Canonical public spelling of a model operation. */
401
+ export const modelOperationActionSchema = z.enum([
402
+ 'create',
403
+ 'update',
404
+ 'delete',
405
+ 'archive',
406
+ 'unarchive',
407
+ ]);
408
+ export type ModelOperationAction = z.infer<typeof modelOperationActionSchema>;
409
+
410
+ /** Convert a storage operation verb into the canonical lowercase commit action. */
411
+ export function normalizeStorageOperationAction(value: string): ModelOperationAction {
412
+ return modelOperationActionSchema.parse(value.toLowerCase());
413
+ }
414
+
408
415
  /** One write inside a commit, in the canonical spelling. */
409
416
  export const commitOperationBodySchema = z.object({
410
417
  ...commitOperationControlShape,
411
- action: z.string(),
418
+ action: modelOperationActionSchema,
412
419
  model: z.string(),
413
420
  data: z.record(z.string(), z.unknown()).nullish(),
414
421
  where: z.record(z.string().min(1), z.unknown()).nullish(),
@@ -427,7 +434,6 @@ export const commitReceiptEvidenceSchema = z.strictObject({
427
434
  clientTxId: z.string().min(1),
428
435
  serverTxId: z.string(),
429
436
  ops: z.number().int().nonnegative().optional(),
430
- notifications: notificationsSchema.optional(),
431
437
  missingIds: missingIdsSchema.optional(),
432
438
  error: commitErrorSchema.optional(),
433
439
  });
@@ -436,18 +442,13 @@ export type CommitReceiptEvidence = z.infer<typeof commitReceiptEvidenceSchema>;
436
442
  /**
437
443
  * The `POST /v1/commits` request body.
438
444
  *
439
- * `operations` carries the writes; `track` registers durable premises.
440
- * Neither is required on its own, because a body with `track` and no
441
- * `operations` is how a caller starts watching a row without writing to it.
442
- * Request identity travels in the `Idempotency-Key` header.
445
+ * `operations` carries the writes and `reads` carries the compact row evidence
446
+ * those writes were based on. Request identity travels in the
447
+ * `Idempotency-Key` header.
443
448
  */
444
449
  export const commitRequestSchema = z.strictObject({
445
- operations: z.array(commitOperationBodySchema).min(1).optional(),
450
+ operations: z.array(commitOperationBodySchema).min(1),
446
451
  reads: readDependencyListSchema.nullish(),
447
- track: trackDependencyListSchema.nullish(),
448
- }).refine((value) => readSetProjectionEntryCount(value) <= MAX_READ_SET_ENTRIES, {
449
- path: ['reads'],
450
- message: `reads and track may contain at most ${MAX_READ_SET_ENTRIES} entries combined`,
451
452
  });
452
453
  export type CommitRequest = z.infer<typeof commitRequestSchema>;
453
454
 
@@ -459,7 +460,7 @@ const commitRecordEvidenceShape = {
459
460
  id: z.string().min(1),
460
461
  ...commitEvidenceShape,
461
462
  createdAt: commitTimestampSchema,
462
- readSet: readSetSchema,
463
+ reads: readDependencyListSchema.readonly(),
463
464
  operations: z.array(commitRecordOperationSchema).readonly(),
464
465
  receipt: commitReceiptEvidenceSchema,
465
466
  } as const;
@@ -2,18 +2,18 @@
2
2
  * The durable-write port and the option that installs it.
3
3
  *
4
4
  * Owns the persistence contract behind `Ablo({ durableWrites })` — a behavior
5
- * contract of methods, not a serialized shape, which is why it lives here
6
- * rather than in `transactions/confirmation/`. The records that cross this port
7
- * are owned by `pendingWriteSchema` there; this module never redescribes them.
5
+ * contract of methods, not a serialized shape, which is why it lives beside
6
+ * rather than inside `confirmation/`. The records that cross this port
7
+ * are owned by `confirmation/pendingWrite.ts`; this module never redescribes them.
8
8
  *
9
9
  * The engine consumes the port through `commitOutboxStore`, and the HTTP client
10
- * accepts the same option through `transport/httpOptions`.
10
+ * accepts the same option through `transport/http/options`.
11
11
  */
12
12
 
13
13
  import { z } from 'zod';
14
- import { AbloValidationError } from './errors.js';
15
- import type { CommitOutboxScope } from './transactions/confirmation/commitEnvelope.js';
16
- import type { PendingWrite } from './transactions/confirmation/pendingWrite.js';
14
+ import { AbloValidationError } from '../errors.js';
15
+ import type { CommitOutboxScope } from './confirmation/commitEnvelope.js';
16
+ import type { PendingWrite } from './confirmation/pendingWrite.js';
17
17
 
18
18
  /**
19
19
  * Persistence port used by `Ablo({ durableWrites })`.