@abloatai/ablo 0.26.0 → 0.28.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 (418) hide show
  1. package/CHANGELOG.md +42 -2
  2. package/README.md +102 -86
  3. package/dist/BaseSyncedStore.d.ts +85 -88
  4. package/dist/BaseSyncedStore.js +134 -151
  5. package/dist/Database.d.ts +68 -69
  6. package/dist/Database.js +316 -135
  7. package/dist/{ObjectPool.d.ts → InstanceCache.d.ts} +10 -13
  8. package/dist/{ObjectPool.js → InstanceCache.js} +85 -83
  9. package/dist/LazyReferenceCollection.d.ts +11 -15
  10. package/dist/LazyReferenceCollection.js +12 -16
  11. package/dist/Model.d.ts +54 -52
  12. package/dist/Model.js +78 -62
  13. package/dist/ModelRegistry.d.ts +21 -19
  14. package/dist/ModelRegistry.js +23 -27
  15. package/dist/NetworkMonitor.d.ts +5 -6
  16. package/dist/NetworkMonitor.js +5 -6
  17. package/dist/SyncClient.d.ts +122 -118
  18. package/dist/SyncClient.js +541 -245
  19. package/dist/adapters/alwaysOnline.d.ts +6 -8
  20. package/dist/adapters/alwaysOnline.js +6 -8
  21. package/dist/adapters/inMemoryStorage.d.ts +10 -9
  22. package/dist/adapters/inMemoryStorage.js +21 -9
  23. package/dist/agent/Agent.d.ts +27 -32
  24. package/dist/agent/Agent.js +18 -19
  25. package/dist/agent/index.d.ts +4 -4
  26. package/dist/agent/index.js +5 -5
  27. package/dist/agent/session.d.ts +47 -44
  28. package/dist/agent/session.js +37 -48
  29. package/dist/agent/types.d.ts +26 -31
  30. package/dist/agent/types.js +6 -7
  31. package/dist/ai-sdk/coordinatedTool.d.ts +108 -0
  32. package/dist/ai-sdk/{coordinated-tool.js → coordinatedTool.js} +44 -38
  33. package/dist/ai-sdk/coordinationContext.d.ts +46 -0
  34. package/dist/ai-sdk/{coordination-context.js → coordinationContext.js} +26 -33
  35. package/dist/ai-sdk/index.d.ts +25 -22
  36. package/dist/ai-sdk/index.js +25 -22
  37. package/dist/ai-sdk/wrap.d.ts +6 -7
  38. package/dist/ai-sdk/wrap.js +1 -1
  39. package/dist/auth/credentialPolicy.d.ts +69 -74
  40. package/dist/auth/credentialPolicy.js +51 -56
  41. package/dist/auth/credentialSource.d.ts +6 -5
  42. package/dist/auth/credentialSource.js +9 -10
  43. package/dist/auth/index.d.ts +59 -58
  44. package/dist/auth/index.js +31 -37
  45. package/dist/auth/schemas.d.ts +5 -4
  46. package/dist/auth/schemas.js +5 -4
  47. package/dist/batching/index.d.ts +19 -21
  48. package/dist/batching/index.js +14 -17
  49. package/dist/cli.cjs +173 -121
  50. package/dist/client/Ablo.d.ts +97 -74
  51. package/dist/client/Ablo.js +129 -163
  52. package/dist/client/ApiClient.d.ts +30 -19
  53. package/dist/client/ApiClient.js +442 -81
  54. package/dist/client/auth.d.ts +47 -47
  55. package/dist/client/auth.js +108 -117
  56. package/dist/client/claimHeartbeatLoop.d.ts +50 -0
  57. package/dist/client/claimHeartbeatLoop.js +88 -0
  58. package/dist/client/consoleLogger.d.ts +5 -6
  59. package/dist/client/consoleLogger.js +5 -6
  60. package/dist/client/createInternalComponents.d.ts +16 -17
  61. package/dist/client/createInternalComponents.js +26 -31
  62. package/dist/client/createModelProxy.d.ts +130 -120
  63. package/dist/client/createModelProxy.js +152 -122
  64. package/dist/client/credentialEndpoint.d.ts +40 -42
  65. package/dist/client/credentialEndpoint.js +35 -36
  66. package/dist/client/functionalUpdate.d.ts +29 -27
  67. package/dist/client/functionalUpdate.js +21 -21
  68. package/dist/client/hostedEndpoints.d.ts +9 -12
  69. package/dist/client/hostedEndpoints.js +9 -12
  70. package/dist/client/httpClient.d.ts +59 -53
  71. package/dist/client/httpClient.js +29 -31
  72. package/dist/client/identity.d.ts +15 -20
  73. package/dist/client/identity.js +47 -58
  74. package/dist/client/modelRegistration.d.ts +5 -9
  75. package/dist/client/modelRegistration.js +78 -87
  76. package/dist/client/options.d.ts +157 -157
  77. package/dist/client/options.js +3 -7
  78. package/dist/client/registerDataSource.d.ts +9 -9
  79. package/dist/client/registerDataSource.js +15 -16
  80. package/dist/client/resourceTypes.d.ts +64 -75
  81. package/dist/client/resourceTypes.js +4 -10
  82. package/dist/client/schemaConfig.d.ts +31 -43
  83. package/dist/client/schemaConfig.js +38 -50
  84. package/dist/client/sessionMint.d.ts +16 -12
  85. package/dist/client/sessionMint.js +26 -31
  86. package/dist/client/validateAbloOptions.d.ts +12 -14
  87. package/dist/client/validateAbloOptions.js +8 -9
  88. package/dist/client/writeOptionsSchema.d.ts +18 -16
  89. package/dist/client/writeOptionsSchema.js +23 -20
  90. package/dist/client/wsMutationExecutor.d.ts +16 -20
  91. package/dist/client/wsMutationExecutor.js +18 -23
  92. package/dist/commit/contract.d.ts +493 -0
  93. package/dist/commit/contract.js +187 -0
  94. package/dist/commit/index.d.ts +6 -0
  95. package/dist/commit/index.js +5 -0
  96. package/dist/context.d.ts +6 -4
  97. package/dist/context.js +6 -4
  98. package/dist/coordination/index.d.ts +10 -8
  99. package/dist/coordination/index.js +14 -12
  100. package/dist/coordination/schema.d.ts +176 -128
  101. package/dist/coordination/schema.js +197 -133
  102. package/dist/coordination/trace.d.ts +9 -10
  103. package/dist/coordination/trace.js +13 -14
  104. package/dist/core/DatabaseManager.d.ts +5 -7
  105. package/dist/core/DatabaseManager.js +15 -19
  106. package/dist/core/QueryProcessor.d.ts +7 -9
  107. package/dist/core/QueryProcessor.js +22 -28
  108. package/dist/core/QueryView.d.ts +8 -8
  109. package/dist/core/QueryView.js +2 -2
  110. package/dist/core/StoreManager.d.ts +14 -14
  111. package/dist/core/StoreManager.js +33 -24
  112. package/dist/core/ViewRegistry.d.ts +5 -5
  113. package/dist/core/ViewRegistry.js +4 -4
  114. package/dist/core/index.d.ts +17 -12
  115. package/dist/core/index.js +32 -26
  116. package/dist/core/openIDBWithTimeout.d.ts +38 -36
  117. package/dist/core/openIDBWithTimeout.js +42 -43
  118. package/dist/core/queryUtils.d.ts +45 -0
  119. package/dist/core/queryUtils.js +69 -0
  120. package/dist/core/storeContract.d.ts +63 -61
  121. package/dist/core/storeContract.js +8 -12
  122. package/dist/environment.d.ts +28 -0
  123. package/dist/environment.js +21 -0
  124. package/dist/errorCodes.d.ts +107 -99
  125. package/dist/errorCodes.js +137 -134
  126. package/dist/errors.d.ts +160 -166
  127. package/dist/errors.js +155 -158
  128. package/dist/index.d.ts +36 -27
  129. package/dist/index.js +91 -86
  130. package/dist/interfaces/index.d.ts +102 -113
  131. package/dist/interfaces/index.js +5 -4
  132. package/dist/keys/index.d.ts +27 -29
  133. package/dist/keys/index.js +41 -40
  134. package/dist/mutators/RecordingTransaction.d.ts +16 -16
  135. package/dist/mutators/RecordingTransaction.js +31 -37
  136. package/dist/mutators/Transaction.d.ts +18 -26
  137. package/dist/mutators/Transaction.js +14 -20
  138. package/dist/mutators/UndoManager.d.ts +124 -131
  139. package/dist/mutators/UndoManager.js +177 -156
  140. package/dist/mutators/defineMutators.d.ts +23 -34
  141. package/dist/mutators/defineMutators.js +14 -20
  142. package/dist/mutators/inverseOp.d.ts +12 -15
  143. package/dist/mutators/inverseOp.js +12 -15
  144. package/dist/mutators/mutateActions.d.ts +10 -9
  145. package/dist/mutators/mutateActions.js +1 -1
  146. package/dist/mutators/readerActions.d.ts +9 -8
  147. package/dist/mutators/readerActions.js +2 -2
  148. package/dist/mutators/undoApply.d.ts +31 -27
  149. package/dist/mutators/undoApply.js +26 -24
  150. package/dist/policy/index.d.ts +5 -3
  151. package/dist/policy/index.js +5 -3
  152. package/dist/policy/types.d.ts +104 -100
  153. package/dist/policy/types.js +67 -66
  154. package/dist/query/client.d.ts +28 -23
  155. package/dist/query/client.js +45 -43
  156. package/dist/query/types.d.ts +37 -60
  157. package/dist/query/types.js +13 -33
  158. package/dist/react/AbloProvider.d.ts +1 -1
  159. package/dist/react/AbloProvider.js +2 -2
  160. package/dist/react/context.d.ts +25 -28
  161. package/dist/react/context.js +9 -10
  162. package/dist/react/index.d.ts +41 -42
  163. package/dist/react/index.js +37 -38
  164. package/dist/react/internalContext.d.ts +17 -19
  165. package/dist/react/useAblo.d.ts +28 -25
  166. package/dist/react/useAblo.js +41 -17
  167. package/dist/react/useCurrentUserId.d.ts +8 -7
  168. package/dist/react/useCurrentUserId.js +8 -7
  169. package/dist/react/useErrorListener.d.ts +7 -7
  170. package/dist/react/useErrorListener.js +10 -11
  171. package/dist/react/useMutationFailureListener.d.ts +8 -8
  172. package/dist/react/useMutationFailureListener.js +8 -8
  173. package/dist/react/useMutators.d.ts +11 -11
  174. package/dist/react/useMutators.js +3 -3
  175. package/dist/react/useReactive.js +2 -2
  176. package/dist/react/useSyncStatus.d.ts +4 -6
  177. package/dist/react/useUndoScope.d.ts +7 -9
  178. package/dist/react/useUndoScope.js +1 -1
  179. package/dist/schema/coordination.d.ts +21 -25
  180. package/dist/schema/coordination.js +21 -25
  181. package/dist/schema/ddl.d.ts +43 -39
  182. package/dist/schema/ddl.js +75 -68
  183. package/dist/schema/ddlLock.d.ts +20 -24
  184. package/dist/schema/ddlLock.js +18 -23
  185. package/dist/schema/diff.d.ts +99 -61
  186. package/dist/schema/diff.js +43 -34
  187. package/dist/schema/field.d.ts +37 -42
  188. package/dist/schema/field.js +35 -48
  189. package/dist/schema/generate.d.ts +12 -12
  190. package/dist/schema/generate.js +12 -12
  191. package/dist/schema/index.d.ts +3 -3
  192. package/dist/schema/index.js +21 -23
  193. package/dist/schema/model.d.ts +118 -143
  194. package/dist/schema/model.js +22 -33
  195. package/dist/schema/openapi.d.ts +10 -9
  196. package/dist/schema/openapi.js +5 -3
  197. package/dist/schema/queries.d.ts +29 -31
  198. package/dist/schema/queries.js +23 -25
  199. package/dist/schema/relation.d.ts +89 -99
  200. package/dist/schema/relation.js +13 -13
  201. package/dist/schema/residency.d.ts +16 -13
  202. package/dist/schema/residency.js +16 -13
  203. package/dist/schema/roles.d.ts +36 -43
  204. package/dist/schema/roles.js +31 -37
  205. package/dist/schema/schema.d.ts +64 -43
  206. package/dist/schema/schema.js +31 -32
  207. package/dist/schema/select.d.ts +13 -13
  208. package/dist/schema/select.js +13 -13
  209. package/dist/schema/serialize.d.ts +28 -31
  210. package/dist/schema/serialize.js +27 -31
  211. package/dist/schema/sugar.d.ts +17 -32
  212. package/dist/schema/sugar.js +14 -29
  213. package/dist/schema/{sync-delta-row.d.ts → syncDeltaRow.d.ts} +26 -49
  214. package/dist/schema/syncDeltaRow.js +89 -0
  215. package/dist/schema/tenancy.d.ts +44 -46
  216. package/dist/schema/tenancy.js +46 -48
  217. package/dist/server/adapter.d.ts +58 -58
  218. package/dist/server/adapter.js +13 -14
  219. package/dist/server/commit.d.ts +60 -64
  220. package/dist/server/index.d.ts +9 -10
  221. package/dist/server/index.js +1 -1
  222. package/dist/server/readConfig.d.ts +70 -0
  223. package/dist/server/readConfig.js +8 -0
  224. package/dist/server/storageMode.d.ts +23 -0
  225. package/dist/server/storageMode.js +17 -0
  226. package/dist/source/adapter.d.ts +30 -25
  227. package/dist/source/adapter.js +10 -10
  228. package/dist/source/adapters/drizzle.d.ts +28 -23
  229. package/dist/source/adapters/drizzle.js +30 -25
  230. package/dist/source/adapters/kysely.d.ts +27 -25
  231. package/dist/source/adapters/kysely.js +24 -23
  232. package/dist/source/adapters/memory.d.ts +8 -7
  233. package/dist/source/adapters/memory.js +9 -8
  234. package/dist/source/adapters/prisma.d.ts +13 -12
  235. package/dist/source/adapters/prisma.js +22 -25
  236. package/dist/source/conformance.d.ts +18 -11
  237. package/dist/source/conformance.js +17 -11
  238. package/dist/source/connector.d.ts +31 -32
  239. package/dist/source/connector.js +28 -28
  240. package/dist/source/connectorProtocol.d.ts +160 -0
  241. package/dist/source/connectorProtocol.js +162 -0
  242. package/dist/source/contract.d.ts +26 -27
  243. package/dist/source/contract.js +28 -29
  244. package/dist/source/factory.d.ts +46 -58
  245. package/dist/source/factory.js +22 -27
  246. package/dist/source/index.d.ts +7 -9
  247. package/dist/source/index.js +12 -14
  248. package/dist/source/migrations.d.ts +9 -9
  249. package/dist/source/migrations.js +9 -9
  250. package/dist/source/next.d.ts +9 -10
  251. package/dist/source/next.js +6 -7
  252. package/dist/source/pushQueue.d.ts +69 -47
  253. package/dist/source/pushQueue.js +32 -28
  254. package/dist/source/signing.d.ts +46 -17
  255. package/dist/source/signing.js +28 -11
  256. package/dist/source/types.d.ts +121 -104
  257. package/dist/source/types.js +13 -14
  258. package/dist/stores/ObjectStore.d.ts +24 -12
  259. package/dist/stores/ObjectStore.js +38 -16
  260. package/dist/stores/ObjectStoreContract.d.ts +14 -15
  261. package/dist/stores/SyncActionStore.d.ts +7 -11
  262. package/dist/stores/SyncActionStore.js +13 -17
  263. package/dist/surface.d.ts +28 -21
  264. package/dist/surface.js +29 -20
  265. package/dist/sync/{BootstrapHelper.d.ts → BootstrapFetcher.d.ts} +36 -42
  266. package/dist/sync/{BootstrapHelper.js → BootstrapFetcher.js} +76 -76
  267. package/dist/sync/ConnectionManager.d.ts +39 -50
  268. package/dist/sync/ConnectionManager.js +55 -66
  269. package/dist/sync/NetworkProbe.d.ts +24 -29
  270. package/dist/sync/NetworkProbe.js +63 -69
  271. package/dist/sync/{HydrationCoordinator.d.ts → OnDemandLoader.d.ts} +42 -41
  272. package/dist/sync/{HydrationCoordinator.js → OnDemandLoader.js} +59 -54
  273. package/dist/sync/{AreaOfInterestManager.d.ts → SubscriptionManager.d.ts} +43 -57
  274. package/dist/sync/{AreaOfInterestManager.js → SubscriptionManager.js} +43 -51
  275. package/dist/sync/SyncWebSocket.d.ts +141 -166
  276. package/dist/sync/SyncWebSocket.js +191 -223
  277. package/dist/sync/awaitClaimGrant.d.ts +18 -18
  278. package/dist/sync/awaitClaimGrant.js +11 -11
  279. package/dist/sync/bootstrapApply.d.ts +34 -24
  280. package/dist/sync/bootstrapApply.js +27 -19
  281. package/dist/sync/commitFrames.d.ts +21 -20
  282. package/dist/sync/commitFrames.js +18 -18
  283. package/dist/sync/createClaimStream.d.ts +23 -22
  284. package/dist/sync/createClaimStream.js +105 -23
  285. package/dist/sync/createPresenceStream.d.ts +19 -18
  286. package/dist/sync/createPresenceStream.js +25 -26
  287. package/dist/sync/createSnapshot.d.ts +12 -14
  288. package/dist/sync/createSnapshot.js +20 -26
  289. package/dist/sync/credentialLifecycle.d.ts +104 -104
  290. package/dist/sync/credentialLifecycle.js +140 -147
  291. package/dist/sync/deltaPipeline.d.ts +36 -34
  292. package/dist/sync/deltaPipeline.js +64 -65
  293. package/dist/sync/groupChange.d.ts +63 -61
  294. package/dist/sync/groupChange.js +74 -78
  295. package/dist/sync/heartbeat.d.ts +34 -33
  296. package/dist/sync/heartbeat.js +31 -31
  297. package/dist/sync/participants.d.ts +19 -19
  298. package/dist/sync/persistedPrefix.d.ts +12 -0
  299. package/dist/sync/persistedPrefix.js +22 -0
  300. package/dist/sync/schemas.d.ts +3 -2
  301. package/dist/sync/schemas.js +14 -10
  302. package/dist/sync/syncCursor.d.ts +17 -21
  303. package/dist/sync/syncCursor.js +17 -21
  304. package/dist/sync/syncPlan.d.ts +28 -36
  305. package/dist/sync/syncPlan.js +18 -19
  306. package/dist/sync/syncPosition.d.ts +54 -49
  307. package/dist/sync/syncPosition.js +57 -52
  308. package/dist/sync/wsFrameHandlers.d.ts +35 -36
  309. package/dist/sync/wsFrameHandlers.js +63 -67
  310. package/dist/testing/fixtures/bootstrap.d.ts +12 -6
  311. package/dist/testing/fixtures/bootstrap.js +12 -6
  312. package/dist/testing/fixtures/deltas.d.ts +30 -33
  313. package/dist/testing/fixtures/deltas.js +30 -33
  314. package/dist/testing/fixtures/models.d.ts +11 -10
  315. package/dist/testing/fixtures/models.js +11 -10
  316. package/dist/testing/helpers/{react-wrapper.d.ts → reactWrapper.d.ts} +13 -10
  317. package/dist/testing/helpers/{react-wrapper.js → reactWrapper.js} +15 -12
  318. package/dist/testing/helpers/{sync-engine-harness.d.ts → syncEngineHarness.d.ts} +17 -15
  319. package/dist/testing/helpers/{sync-engine-harness.js → syncEngineHarness.js} +12 -10
  320. package/dist/testing/helpers/wait.d.ts +13 -8
  321. package/dist/testing/helpers/wait.js +13 -8
  322. package/dist/testing/index.d.ts +5 -3
  323. package/dist/testing/index.js +3 -2
  324. package/dist/testing/mocks/FakeDatabase.d.ts +18 -0
  325. package/dist/testing/mocks/FakeDatabase.js +10 -0
  326. package/dist/testing/mocks/MockMutationExecutor.d.ts +18 -17
  327. package/dist/testing/mocks/MockMutationExecutor.js +15 -14
  328. package/dist/testing/mocks/MockNetworkMonitor.d.ts +8 -8
  329. package/dist/testing/mocks/MockNetworkMonitor.js +8 -8
  330. package/dist/testing/mocks/MockSyncContext.d.ts +20 -17
  331. package/dist/testing/mocks/MockSyncContext.js +15 -13
  332. package/dist/testing/mocks/MockSyncStore.d.ts +10 -10
  333. package/dist/testing/mocks/MockSyncStore.js +11 -11
  334. package/dist/testing/mocks/MockWebSocket.d.ts +28 -23
  335. package/dist/testing/mocks/MockWebSocket.js +22 -21
  336. package/dist/transactions/TransactionQueue.d.ts +244 -181
  337. package/dist/transactions/TransactionQueue.js +929 -423
  338. package/dist/transactions/TransactionStore.d.ts +6 -4
  339. package/dist/transactions/TransactionStore.js +6 -4
  340. package/dist/transactions/UnconfirmedWrites.d.ts +82 -0
  341. package/dist/transactions/UnconfirmedWrites.js +104 -0
  342. package/dist/transactions/coalesceRules.d.ts +41 -17
  343. package/dist/transactions/coalesceRules.js +40 -17
  344. package/dist/transactions/commitEnvelope.d.ts +132 -0
  345. package/dist/transactions/commitEnvelope.js +139 -0
  346. package/dist/transactions/commitOutboxStore.d.ts +32 -0
  347. package/dist/transactions/commitOutboxStore.js +26 -0
  348. package/dist/transactions/commitPayload.d.ts +63 -52
  349. package/dist/transactions/commitPayload.js +54 -57
  350. package/dist/transactions/deltaConfirmation.d.ts +20 -22
  351. package/dist/transactions/deltaConfirmation.js +37 -45
  352. package/dist/transactions/httpCommitEnvelope.d.ts +43 -0
  353. package/dist/transactions/httpCommitEnvelope.js +179 -0
  354. package/dist/transactions/optimisticApply.d.ts +49 -0
  355. package/dist/transactions/optimisticApply.js +65 -0
  356. package/dist/transactions/replayValidation.d.ts +182 -0
  357. package/dist/transactions/replayValidation.js +156 -0
  358. package/dist/types/global.d.ts +46 -41
  359. package/dist/types/global.js +20 -19
  360. package/dist/types/index.d.ts +71 -77
  361. package/dist/types/index.js +22 -22
  362. package/dist/types/modelData.d.ts +6 -8
  363. package/dist/types/modelData.js +5 -7
  364. package/dist/types/participant.d.ts +10 -11
  365. package/dist/types/participant.js +6 -8
  366. package/dist/types/streams.d.ts +208 -195
  367. package/dist/types/streams.js +7 -7
  368. package/dist/utils/asyncIterator.d.ts +25 -32
  369. package/dist/utils/asyncIterator.js +25 -32
  370. package/dist/utils/duration.d.ts +12 -15
  371. package/dist/utils/duration.js +12 -15
  372. package/dist/utils/mobxSetup.d.ts +53 -0
  373. package/dist/utils/{mobx-setup.js → mobxSetup.js} +42 -98
  374. package/dist/webhooks/events.d.ts +21 -16
  375. package/dist/webhooks/events.js +10 -8
  376. package/dist/webhooks/index.d.ts +5 -7
  377. package/dist/webhooks/index.js +5 -7
  378. package/dist/wire/bootstrapReason.d.ts +9 -0
  379. package/dist/wire/bootstrapReason.js +8 -0
  380. package/dist/{schema/sync-delta-wire.d.ts → wire/delta.d.ts} +58 -41
  381. package/dist/wire/delta.js +114 -0
  382. package/dist/wire/errorEnvelope.d.ts +30 -31
  383. package/dist/wire/errorEnvelope.js +34 -40
  384. package/dist/wire/frames.d.ts +315 -86
  385. package/dist/wire/frames.js +47 -33
  386. package/dist/wire/index.d.ts +18 -14
  387. package/dist/wire/index.js +32 -27
  388. package/dist/wire/listEnvelope.d.ts +16 -23
  389. package/dist/wire/listEnvelope.js +7 -6
  390. package/dist/wire/protocol.d.ts +25 -32
  391. package/dist/wire/protocol.js +25 -32
  392. package/dist/wire/protocolVersion.d.ts +44 -40
  393. package/dist/wire/protocolVersion.js +44 -40
  394. package/docs/api.md +10 -10
  395. package/docs/coordination.md +59 -0
  396. package/docs/mcp.md +1 -1
  397. package/package.json +17 -11
  398. package/dist/ai-sdk/coordinated-tool.d.ts +0 -101
  399. package/dist/ai-sdk/coordination-context.d.ts +0 -52
  400. package/dist/core/query-utils.d.ts +0 -34
  401. package/dist/core/query-utils.js +0 -59
  402. package/dist/schema/sync-delta-row.js +0 -103
  403. package/dist/schema/sync-delta-wire.js +0 -102
  404. package/dist/server/read-config.d.ts +0 -67
  405. package/dist/server/read-config.js +0 -8
  406. package/dist/server/storage-mode.d.ts +0 -8
  407. package/dist/server/storage-mode.js +0 -28
  408. package/dist/source/connector-protocol.d.ts +0 -159
  409. package/dist/source/connector-protocol.js +0 -161
  410. package/dist/transactions/OptimisticEchoTracker.d.ts +0 -82
  411. package/dist/transactions/OptimisticEchoTracker.js +0 -104
  412. package/dist/transactions/mutation-error-handler.d.ts +0 -5
  413. package/dist/transactions/mutation-error-handler.js +0 -39
  414. package/dist/transactions/optimistic.d.ts +0 -24
  415. package/dist/transactions/optimistic.js +0 -45
  416. package/dist/transactions/persistedReplay.d.ts +0 -93
  417. package/dist/transactions/persistedReplay.js +0 -105
  418. package/dist/utils/mobx-setup.d.ts +0 -42
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Schema Query Definitions
2
+ * Query definitions for a schema.
3
3
  *
4
- * A query is a zod input schema + a string reference to a schema model
5
- * that the query returns. Types flow via `z.infer` for inputs and
6
- * `InferModel` for results — the same inference path `model` and
7
- * `relation` already use. No second type system.
4
+ * A query pairs a Zod input schema with the name of the model it returns.
5
+ * Input types flow through `z.infer` and result types through `InferModel`,
6
+ * the same inference path `model` and `relation` use, so there is no separate
7
+ * type system to learn.
8
8
  *
9
9
  * Usage:
10
10
  * import { z } from 'zod';
@@ -37,23 +37,21 @@
37
37
  *
38
38
  * Design notes:
39
39
  *
40
- * - `query()` accepts any string for `returns`. The constraint that it
41
- * must reference a real schema model is applied when the query is
42
- * passed to `defineQueries(schema, ...)`. This mirrors how
43
- * `relation.belongsTo('projects', 'projectId')` accepts a plain
44
- * string at the factory and defers the cross-reference check to
45
- * schema assembly time.
46
- *
47
- * - Queries do NOT carry a `name` until they pass through
48
- * `defineQueries()`. The name is assigned from the record key
49
- * same pattern as `defineSchema({ tasks: model(...) })` where the
50
- * model name is the record key, not a field on the model factory.
51
- *
52
- * - All queries return an array of a single model type. Multi-model
53
- * fetches (e.g., files + folders) are expressed as multiple queries
54
- * in a single batch at dispatch time, not as "bundle" shapes in the
55
- * schema. This keeps each `QueryDef` pointed at exactly one model
56
- * and lets the generic loader hydrate via a single
40
+ * - `query()` accepts any string for `returns`. The check that the string
41
+ * names a real model runs when the query passes through
42
+ * `defineQueries(schema, ...)`, the same way
43
+ * `relation.belongsTo('projects', 'projectId')` takes a plain string at
44
+ * the factory and defers the cross-reference check to schema assembly.
45
+ *
46
+ * - A query carries no `name` until `defineQueries()` assigns one from its
47
+ * record key the same pattern `defineSchema({ tasks: model(...) })`
48
+ * uses, where the model's name is the record key rather than a field on
49
+ * the factory.
50
+ *
51
+ * - Every query returns an array of a single model type. To fetch several
52
+ * model types at once, run several queries in one batch rather than
53
+ * declaring a combined shape. Each `QueryDef` therefore points at exactly
54
+ * one model, and the loader hydrates results through a single
57
55
  * `schema.models[queryDef.returns]` lookup.
58
56
  */
59
57
  import { z } from 'zod';
@@ -79,11 +77,11 @@ export interface QueryDef<TInput extends z.ZodType = z.ZodType, TReturns extends
79
77
  */
80
78
  readonly returns: TReturns;
81
79
  /**
82
- * Name under which the query is registered. Populated by
83
- * `defineQueries()` from the record key do not set directly.
84
- * Present so wire-dispatch code (`client.runNamed(queryDef.name,
85
- * ...)`) and the Go registry lookup can read it straight off the
86
- * def without needing the surrounding `Queries` object.
80
+ * The name under which the query is registered. {@link defineQueries}
81
+ * fills this in from the record key; you do not set it directly. It lives
82
+ * on the definition itself so dispatch and lookup code can read the name
83
+ * straight off a {@link QueryDef} without carrying the surrounding
84
+ * {@link Queries} object.
87
85
  */
88
86
  readonly name?: string;
89
87
  }
@@ -123,7 +121,7 @@ export declare function query<TInput extends z.ZodType, const TReturns extends s
123
121
  export type QueryRecord<S extends Schema> = Record<string, QueryDef<z.ZodType, InferModelNames<S>>>;
124
122
  /**
125
123
  * The object returned by `defineQueries()`. Holds a reference back to
126
- * the schema (so the generic loader can resolve `queryDef.returns` to
124
+ * the schema (so the loader can resolve `queryDef.returns` to
127
125
  * a `ModelDef` at runtime via `schema.models[def.returns]`) and the
128
126
  * resolved record of queries, each with its `name` field filled in.
129
127
  */
@@ -178,9 +176,9 @@ export type InferQueryResult<S extends Schema, Q extends QueryDef> = Q extends Q
178
176
  * exist" error deep inside the loader.
179
177
  *
180
178
  * Each resolved query gets its `name` populated from the record key:
181
- * `queries.slideLayersByDeck.name === 'slideLayersByDeck'`. Wire
182
- * dispatch, the Go registry, and the loader orchestrator all read
183
- * `queryDef.name` directly rather than re-deriving it.
179
+ * `queries.slideLayersByDeck.name === 'slideLayersByDeck'`. Dispatch and
180
+ * lookup code read `queryDef.name` directly rather than re-deriving it from
181
+ * the surrounding record.
184
182
  *
185
183
  * ```ts
186
184
  * const schema = defineSchema({
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Schema Query Definitions
2
+ * Query definitions for a schema.
3
3
  *
4
- * A query is a zod input schema + a string reference to a schema model
5
- * that the query returns. Types flow via `z.infer` for inputs and
6
- * `InferModel` for results — the same inference path `model` and
7
- * `relation` already use. No second type system.
4
+ * A query pairs a Zod input schema with the name of the model it returns.
5
+ * Input types flow through `z.infer` and result types through `InferModel`,
6
+ * the same inference path `model` and `relation` use, so there is no separate
7
+ * type system to learn.
8
8
  *
9
9
  * Usage:
10
10
  * import { z } from 'zod';
@@ -37,23 +37,21 @@
37
37
  *
38
38
  * Design notes:
39
39
  *
40
- * - `query()` accepts any string for `returns`. The constraint that it
41
- * must reference a real schema model is applied when the query is
42
- * passed to `defineQueries(schema, ...)`. This mirrors how
43
- * `relation.belongsTo('projects', 'projectId')` accepts a plain
44
- * string at the factory and defers the cross-reference check to
45
- * schema assembly time.
46
- *
47
- * - Queries do NOT carry a `name` until they pass through
48
- * `defineQueries()`. The name is assigned from the record key
49
- * same pattern as `defineSchema({ tasks: model(...) })` where the
50
- * model name is the record key, not a field on the model factory.
51
- *
52
- * - All queries return an array of a single model type. Multi-model
53
- * fetches (e.g., files + folders) are expressed as multiple queries
54
- * in a single batch at dispatch time, not as "bundle" shapes in the
55
- * schema. This keeps each `QueryDef` pointed at exactly one model
56
- * and lets the generic loader hydrate via a single
40
+ * - `query()` accepts any string for `returns`. The check that the string
41
+ * names a real model runs when the query passes through
42
+ * `defineQueries(schema, ...)`, the same way
43
+ * `relation.belongsTo('projects', 'projectId')` takes a plain string at
44
+ * the factory and defers the cross-reference check to schema assembly.
45
+ *
46
+ * - A query carries no `name` until `defineQueries()` assigns one from its
47
+ * record key the same pattern `defineSchema({ tasks: model(...) })`
48
+ * uses, where the model's name is the record key rather than a field on
49
+ * the factory.
50
+ *
51
+ * - Every query returns an array of a single model type. To fetch several
52
+ * model types at once, run several queries in one batch rather than
53
+ * declaring a combined shape. Each `QueryDef` therefore points at exactly
54
+ * one model, and the loader hydrates results through a single
57
55
  * `schema.models[queryDef.returns]` lookup.
58
56
  */
59
57
  import { z } from 'zod';
@@ -101,9 +99,9 @@ export function query(spec) {
101
99
  * exist" error deep inside the loader.
102
100
  *
103
101
  * Each resolved query gets its `name` populated from the record key:
104
- * `queries.slideLayersByDeck.name === 'slideLayersByDeck'`. Wire
105
- * dispatch, the Go registry, and the loader orchestrator all read
106
- * `queryDef.name` directly rather than re-deriving it.
102
+ * `queries.slideLayersByDeck.name === 'slideLayersByDeck'`. Dispatch and
103
+ * lookup code read `queryDef.name` directly rather than re-deriving it from
104
+ * the surrounding record.
107
105
  *
108
106
  * ```ts
109
107
  * const schema = defineSchema({
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Schema Relation Definitions
3
- *
4
- * Declarative relations between models. Used for:
5
- * - FK index registration (ObjectPool.registerForeignKey)
6
- * - Model create priority derivation (parents before children)
7
- * - Query include/join support
2
+ * Declarative relations between your models — the edges that turn a flat set
3
+ * of models into a graph. You attach relations to a model with the
4
+ * {@link relation} factories; the engine reads them to index foreign keys for
5
+ * fast child lookups, to order inserts so a parent row lands before the rows
6
+ * that reference it, and to generate the accessor properties that let you read
7
+ * `task.project` or `project.tasks` directly.
8
8
  *
9
9
  * Usage:
10
10
  * import { relation } from '@abloatai/ablo/schema';
@@ -16,44 +16,38 @@
16
16
  * };
17
17
  */
18
18
  /**
19
- * Options for `relation.belongsTo(...)`. All default to `false` behavior
20
- * is opt-in per relation.
19
+ * Options for `relation.belongsTo`. Each defaults to `false`, so every
20
+ * behavior below is opt-in per relation.
21
21
  *
22
- * When `index: true`, the sync engine registers an O(1) foreign-key index
23
- * on the child model's ObjectPool entry at construction time, so that
24
- * `pool.getByForeignKey(childType, foreignKey, parentId)` becomes constant-
25
- * time instead of a full scan. Use on hot paths like `SlideLayer.slideId`
26
- * where you frequently want "all layers for this slide."
22
+ * `index: true` registers a foreign-key index for the child model when the
23
+ * engine starts, turning "every child that points at this parent" from a full
24
+ * scan into a constant-time lookup. Reach for it on relations you query this
25
+ * way often, such as a slide layer's `slideId`.
27
26
  *
28
- * When `enrich: true`, incoming deltas for the child model have their
29
- * parent reference auto-populated from the ObjectPool before the model
30
- * data lands. I.e., a delta for `Task { teamId: 't1' }` picks up the
31
- * `teams:t1` entity from the pool and attaches it as `data.team`, so
32
- * consumers can read `task.team` directly without a second lookup.
33
- * If the parent isn't in the pool yet, enrichment silently no-ops
34
- * (the child data is still applied) — enrichment is best-effort.
27
+ * `enrich: true` auto-populates the parent reference on an incoming change
28
+ * before the child data lands. A change to `Task { teamId: 't1' }` picks up the
29
+ * already-loaded `teams:t1` record and attaches it as `data.team`, so you can
30
+ * read `task.team` without a second lookup. Enrichment is best-effort: if the
31
+ * parent has not loaded yet it quietly does nothing, and the child data still
32
+ * applies.
35
33
  *
36
- * When `defer: true`, the FK-create-priority computer (Tarjan SCC in
37
- * `client/createSyncEngine.ts`) ignores this edge when building the
38
- * dependency graph. Use on the *soft* side of a real cycle to break it
39
- * deterministically i.e. the side where you're willing to insert the
40
- * child first with the FK left null and patch it in a follow-up
41
- * UPDATE. The other side of the cycle then becomes a strict topological
42
- * predecessor, so the child gets a higher priority than the parent
43
- * instead of being tied with it.
34
+ * `defer: true` tells the engine to ignore this edge when it works out the
35
+ * order in which to insert rows. Use it on the soft side of a genuine reference
36
+ * cycle the side where you are willing to insert the child first with the
37
+ * foreign key left null and fill it in with a later update. The other side of
38
+ * the cycle then becomes a strict predecessor, so the child is ordered after
39
+ * the parent rather than tied with it.
44
40
  *
45
- * `defer` only affects priority computation, not what the engine sends
46
- * on the wire it does NOT auto-rewrite an INSERT to (insert-null +
47
- * update-later). Pair with a Postgres `DEFERRABLE INITIALLY DEFERRED`
48
- * constraint when you actually want the FK check to be relaxed at the
49
- * database level. Example use case:
41
+ * `defer` changes only that ordering, not what the engine sends on the wire; it
42
+ * does not rewrite an insert into an insert-then-update. Pair it with a Postgres
43
+ * `DEFERRABLE INITIALLY DEFERRED` constraint when you also want the database to
44
+ * relax the foreign-key check itself. For example:
50
45
  *
51
46
  * ```ts
52
47
  * layouts: model({ deckId: z.string().nullish() }, {
53
- * // The deck-owns-layout link is nullable AND the consumer always
54
- * // creates the layout first; mark it `defer` so SlideDeck can
55
- * // commit ahead of Layout instead of being trapped in the same
56
- * // SCC priority bucket.
48
+ * // The deck-owns-layout link is nullable and the layout is always
49
+ * // created first; marking it `defer` lets the deck commit ahead of the
50
+ * // layout instead of sharing its insert-order slot.
57
51
  * deck: relation.belongsTo('slideDecks', 'deckId', { defer: true }),
58
52
  * }),
59
53
  * ```
@@ -63,40 +57,39 @@ export interface BelongsToOptions {
63
57
  readonly enrich?: boolean;
64
58
  readonly defer?: boolean;
65
59
  /**
66
- * Marks the relation's target as this record's **parent** in the Zanzibar/
67
- * ReBAC sense the entity it lives in, that scope inherits *from*. Sync-group
68
- * fan-out routes a record into its parent's group (directly, or transitively
69
- * up a chain of `parent` edges), so a write reaches everyone subscribed to the
70
- * owning entity the same "access inherits from parent" rule OpenFGA/Zanzibar
71
- * and filesystems use.
60
+ * Marks the relation's target as this record's parent: the entity the record
61
+ * lives inside and inherits its access scope from. When a record is written,
62
+ * the engine routes it into its parent's sync group following a chain of
63
+ * `parent` edges all the way up — so the change reaches everyone subscribed to
64
+ * the owning entity. This is the familiar rule that access flows down from a
65
+ * container to the things it holds, as a folder does to its files.
72
66
  *
73
- * A reference (provenance/template pointer like `sourceSlideId`, `templateId`)
74
- * must NOT set this, or the record would leak into an unrelated scope.
75
- * Optionality is NOT a proxy many parent FKs are optional (a root folder, an
76
- * inbox task) so the parent edge must be declared, not inferred.
67
+ * Do not set `parent` on a reference that merely points at another record for
68
+ * provenance or as a template, such as `sourceSlideId` or `templateId`; doing
69
+ * so would leak the record into an unrelated scope. The engine also cannot
70
+ * infer the parent from whether a field is optional many real parent keys
71
+ * are optional, like a root folder or an inbox task — so you must declare the
72
+ * parent edge explicitly.
77
73
  *
78
- * Reads on the relation: `belongsTo('deck', 'deckId', { parent: true })` —
79
- * "the deck is the parent."
74
+ * It reads naturally at the call site:
75
+ * `belongsTo('deck', 'deckId', { parent: true })` — the deck is the parent.
80
76
  */
81
77
  readonly parent?: boolean;
82
78
  /**
83
- * Emit a real Postgres FOREIGN KEY for this relation when provisioning a
84
- * customer-owned (BYO / dedicated) database. **Independent of `parent`:**
85
- * `parent` governs sync-group fan-out / visibility (control plane); `fk`
86
- * governs physical referential integrity (data plane). The two are orthogonal
87
- * — a relation may set either, both, or neither (mirrors Drizzle's
88
- * `relations()` vs `references()` split; Zanzibar's `parent` is permission-only
89
- * and "says nothing about data ownership or lifecycle").
79
+ * Emit a real Postgres foreign-key constraint for this relation when the
80
+ * engine provisions tables in a customer-owned database. This is independent
81
+ * of `parent`: `parent` decides which subscribers a change reaches, while
82
+ * `fk` decides whether the database enforces referential integrity. A relation
83
+ * may set either, both, or neither.
90
84
  *
91
- * Set `fk: true` ONLY when the target row is co-located in the SAME database
92
- * AND written in the SAME commit as this row, and the reference is to a
93
- * strong / contained entity. Do NOT set it on provenance / template pointers
94
- * (`sourceSlideId`, `templateId`), cross-tenant refs, or anything that may be
95
- * written in a different transaction than its target — a hard FK there would
96
- * reject the write and break out-of-order sync. Emitted as `DEFERRABLE
97
- * INITIALLY DEFERRED, ON DELETE NO ACTION` a pure integrity guard; cascade /
98
- * nullify is owned by the app-layer mutation pipeline, not the DB. See
99
- * `foreignKeyStatements` in `ddl.ts`.
85
+ * Set `fk: true` only when the target row lives in the same database and is
86
+ * written in the same commit as this row, and points at a strong, contained
87
+ * entity. Leave it off provenance or template pointers (`sourceSlideId`,
88
+ * `templateId`), cross-tenant references, or anything that may be written in a
89
+ * different transaction than its target — a hard constraint there would reject
90
+ * the write and break out-of-order sync. The constraint is emitted as
91
+ * `DEFERRABLE INITIALLY DEFERRED, ON DELETE NO ACTION`: a plain integrity
92
+ * guard, leaving any cascade or null-on-delete behavior to the application.
100
93
  */
101
94
  readonly fk?: boolean;
102
95
  }
@@ -105,20 +98,18 @@ declare const __relationTarget: unique symbol;
105
98
  declare const __relationField: unique symbol;
106
99
  export type RelationType = 'belongsTo' | 'hasMany' | 'hasOne';
107
100
  /**
108
- * A relation definition with embedded type information.
101
+ * A relation definition, carrying its type information at both the type and
102
+ * runtime level.
109
103
  *
110
- * The 4th generic `Options` captures per-relation options at the type
111
- * level (currently only `belongsTo` uses this `hasMany`/`hasOne`
112
- * default to empty). The `const Opts` modifier on the `belongsTo`
113
- * factory preserves literal inference: `{ enrich: true }` narrows to
114
- * `true`, not `boolean`, so future type-level features (like
115
- * `InferModel` auto-adding enriched-parent properties) can read the
116
- * literal value off the relation def at compile time.
104
+ * The `Options` generic captures a relation's options in the type system; only
105
+ * `belongsTo` uses it, while `hasMany` and `hasOne` leave it empty. The `const`
106
+ * modifier on the `belongsTo` factory preserves literal inference, so
107
+ * `{ enrich: true }` is remembered as `true` rather than widened to `boolean`,
108
+ * letting type-level features read the exact option value.
117
109
  *
118
- * `options` is always present at runtime the factory assigns an
119
- * empty object when the caller omits it, which keeps
120
- * `relation.options.index` / `relation.options.enrich` safe to read
121
- * without a null guard downstream.
110
+ * `options` is always present at runtime: the factory substitutes an empty
111
+ * object when you omit it, so reading `options.index` or `options.enrich` needs
112
+ * no null check.
122
113
  */
123
114
  export interface RelationDef<Type extends RelationType = RelationType, Target extends string = string, Field extends string = string, Options extends BelongsToOptions = BelongsToOptions> {
124
115
  readonly [__relationType]: Type;
@@ -128,25 +119,24 @@ export interface RelationDef<Type extends RelationType = RelationType, Target ex
128
119
  readonly type: Type;
129
120
  readonly target: Target;
130
121
  /**
131
- * The child model's JS field that holds the parent's id. Always the
132
- * camelCase schema field name used by the client ObjectPool to read
133
- * `model[foreignKey]`, by `LazyReferenceCollection` for IndexedDB
134
- * index keys, and by `ModelRegistry` for cascade wiring. Never used
135
- * verbatim in raw SQL.
122
+ * The field on the child model that holds the parent's id, as a camelCase
123
+ * schema field name. The engine reads `model[foreignKey]` to resolve the
124
+ * relation and to build client-side index keys; it is never interpolated into
125
+ * raw SQL that is what {@link foreignKeyColumn} is for.
136
126
  */
137
127
  readonly foreignKey: Field;
138
128
  /**
139
- * The same foreign key expressed as a database column identifier. Set
140
- * by `defineSchema` when a `casing` option is configured (e.g.
141
- * `'snake_case'` produces `message_id` from `messageId`). Used by
142
- * server-side SQL compilers to interpolate the real column name into
143
- * queries `postgres.camel`-style data-layer transforms do NOT rewrite
144
- * identifiers embedded in raw SQL, so the translation has to happen
145
- * somewhere, and schema-build time is the one-place-once answer.
129
+ * The same foreign key expressed as a database column identifier.
130
+ * {@link foreignKey} is translated into this when you configure a `casing`
131
+ * option on `defineSchema` for example `'snake_case'` turns `messageId`
132
+ * into `message_id`. The server interpolates this column name into SQL
133
+ * directly, because a driver's automatic camelCase-to-snake_case mapping does
134
+ * not reach identifiers embedded in raw SQL; resolving the name once at
135
+ * schema-build time is what makes it available there.
146
136
  *
147
- * Defaults to {@link foreignKey} when `casing` is unset (identity)
148
- * the SDK stays backward-compatible for consumers whose DB columns
149
- * already match their JS field names.
137
+ * Defaults to {@link foreignKey} when no `casing` option is set, so consumers
138
+ * whose database columns already match their field names need no
139
+ * configuration.
150
140
  */
151
141
  readonly foreignKeyColumn: string;
152
142
  readonly options: Options;
@@ -182,12 +172,12 @@ export declare const relation: {
182
172
  */
183
173
  readonly belongsTo: <Target extends string, Field extends string, const Opts extends BelongsToOptions = Record<string, never>>(target: Target, foreignKey: Field, options?: Opts) => RelationDef<"belongsTo", Target, Field, Opts>;
184
174
  /**
185
- * This model has many of another model.
186
- * e.g., Project has many Tasks (via Task.projectId)
175
+ * This model has many of another model — for example, a project has many
176
+ * tasks via `Task.projectId`.
187
177
  *
188
- * At runtime, generates a getter on the parent model that returns
189
- * all child models matching the FK via ObjectPool.getByForeignKey.
190
- * The FK index on the child model is auto-registered.
178
+ * At runtime the engine adds a getter to the parent model that returns every
179
+ * child whose foreign key matches, and registers the foreign-key index on the
180
+ * child model automatically.
191
181
  *
192
182
  * ```ts
193
183
  * slides: relation.hasMany('slideLayers', 'slideId'),
@@ -201,8 +191,8 @@ export declare const relation: {
201
191
  orderBy?: string;
202
192
  }) => RelationDef<"hasMany", Target, Field>;
203
193
  /**
204
- * This model has one of another model.
205
- * e.g., User has one Profile (via Profile.userId)
194
+ * This model has one of another model — for example, a user has one profile
195
+ * via `Profile.userId`.
206
196
  */
207
197
  readonly hasOne: <Target extends string, Field extends string>(target: Target, foreignKey: Field) => RelationDef<"hasOne", Target, Field>;
208
198
  };
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Schema Relation Definitions
3
- *
4
- * Declarative relations between models. Used for:
5
- * - FK index registration (ObjectPool.registerForeignKey)
6
- * - Model create priority derivation (parents before children)
7
- * - Query include/join support
2
+ * Declarative relations between your models — the edges that turn a flat set
3
+ * of models into a graph. You attach relations to a model with the
4
+ * {@link relation} factories; the engine reads them to index foreign keys for
5
+ * fast child lookups, to order inserts so a parent row lands before the rows
6
+ * that reference it, and to generate the accessor properties that let you read
7
+ * `task.project` or `project.tasks` directly.
8
8
  *
9
9
  * Usage:
10
10
  * import { relation } from '@abloatai/ablo/schema';
@@ -72,12 +72,12 @@ export const relation = {
72
72
  return new RelationBuilder('belongsTo', target, foreignKey, options ?? {});
73
73
  },
74
74
  /**
75
- * This model has many of another model.
76
- * e.g., Project has many Tasks (via Task.projectId)
75
+ * This model has many of another model — for example, a project has many
76
+ * tasks via `Task.projectId`.
77
77
  *
78
- * At runtime, generates a getter on the parent model that returns
79
- * all child models matching the FK via ObjectPool.getByForeignKey.
80
- * The FK index on the child model is auto-registered.
78
+ * At runtime the engine adds a getter to the parent model that returns every
79
+ * child whose foreign key matches, and registers the foreign-key index on the
80
+ * child model automatically.
81
81
  *
82
82
  * ```ts
83
83
  * slides: relation.hasMany('slideLayers', 'slideId'),
@@ -95,8 +95,8 @@ export const relation = {
95
95
  return builder;
96
96
  },
97
97
  /**
98
- * This model has one of another model.
99
- * e.g., User has one Profile (via Profile.userId)
98
+ * This model has one of another model — for example, a user has one profile
99
+ * via `Profile.userId`.
100
100
  */
101
101
  hasOne(target, foreignKey) {
102
102
  return new RelationBuilder('hasOne', target, foreignKey);
@@ -1,20 +1,23 @@
1
1
  /**
2
- * Model RESIDENCY which database a model's rows live in. A sibling axis to
3
- * `tenancy` (which says how rows are isolated *within* a database):
2
+ * A model's residency: which database its rows live in. This is a sibling axis
3
+ * to `tenancy`, which instead describes how rows are isolated within a single
4
+ * database.
4
5
  *
5
- * - `tenant` — the tenant data plane. For a customer-connected database
6
- * this is THEIR database; provisioning emits these tables there.
7
- * - `control` — Ablo's control plane (the sync log, attribution, audit, …).
8
- * Never emitted into a customer DB; lives only in Ablo's own DB.
6
+ * - `tenant` — the tenant data plane. For a customer-connected database this
7
+ * is the customer's own database, and provisioning creates these
8
+ * tables there.
9
+ * - `control` the coordination plane the engine owns: the change log,
10
+ * attribution, audit, and the like. These tables are never
11
+ * created in a customer's database.
9
12
  *
10
- * Named `residency` (not `plane`) because "plane" is the server's tenancy
11
- * scope — (org, environment[, project, sandbox]) — the dominant meaning in the
12
- * engine. The serialized model option is still the `plane` KEY (wire format,
13
- * frozen until the next wire-version bump); only the TS vocabulary moved.
13
+ * The name is `residency` rather than `plane` because "plane" already refers to
14
+ * the server's tenancy scope — organization, environment, and optionally
15
+ * project and sandbox. On the wire the serialized option is still keyed as
16
+ * `plane`, a frozen part of the wire format; only the TypeScript name differs.
14
17
  *
15
- * P1 of the sync-delta decomposition (`docs/plans/sync-delta-zod-decomposition.md`):
16
- * declaring the boundary lets provisioning *derive* "what a customer DB gets"
17
- * (`residency === 'tenant'`) instead of hand-coding it. Defaults to `tenant`.
18
+ * Declaring this boundary lets provisioning derive what a customer's database
19
+ * receives the models whose residency is `tenant` rather than hand-coding
20
+ * that list. Defaults to `tenant`.
18
21
  */
19
22
  import { z } from 'zod';
20
23
  export declare const residencySchema: z.ZodEnum<{
@@ -1,20 +1,23 @@
1
1
  /**
2
- * Model RESIDENCY which database a model's rows live in. A sibling axis to
3
- * `tenancy` (which says how rows are isolated *within* a database):
2
+ * A model's residency: which database its rows live in. This is a sibling axis
3
+ * to `tenancy`, which instead describes how rows are isolated within a single
4
+ * database.
4
5
  *
5
- * - `tenant` — the tenant data plane. For a customer-connected database
6
- * this is THEIR database; provisioning emits these tables there.
7
- * - `control` — Ablo's control plane (the sync log, attribution, audit, …).
8
- * Never emitted into a customer DB; lives only in Ablo's own DB.
6
+ * - `tenant` — the tenant data plane. For a customer-connected database this
7
+ * is the customer's own database, and provisioning creates these
8
+ * tables there.
9
+ * - `control` the coordination plane the engine owns: the change log,
10
+ * attribution, audit, and the like. These tables are never
11
+ * created in a customer's database.
9
12
  *
10
- * Named `residency` (not `plane`) because "plane" is the server's tenancy
11
- * scope — (org, environment[, project, sandbox]) — the dominant meaning in the
12
- * engine. The serialized model option is still the `plane` KEY (wire format,
13
- * frozen until the next wire-version bump); only the TS vocabulary moved.
13
+ * The name is `residency` rather than `plane` because "plane" already refers to
14
+ * the server's tenancy scope — organization, environment, and optionally
15
+ * project and sandbox. On the wire the serialized option is still keyed as
16
+ * `plane`, a frozen part of the wire format; only the TypeScript name differs.
14
17
  *
15
- * P1 of the sync-delta decomposition (`docs/plans/sync-delta-zod-decomposition.md`):
16
- * declaring the boundary lets provisioning *derive* "what a customer DB gets"
17
- * (`residency === 'tenant'`) instead of hand-coding it. Defaults to `tenant`.
18
+ * Declaring this boundary lets provisioning derive what a customer's database
19
+ * receives the models whose residency is `tenant` rather than hand-coding
20
+ * that list. Defaults to `tenant`.
18
21
  */
19
22
  import { z } from 'zod';
20
23
  export const residencySchema = z.enum(['tenant', 'control']);