@earendil-works/chord 1.5.0 → 1.5.1

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 (1853) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +50 -90
  3. package/dist/contracts/accepts.d.ts +81 -0
  4. package/dist/contracts/accepts.d.ts.map +1 -0
  5. package/dist/contracts/accepts.js.map +1 -0
  6. package/dist/contracts/contract.d.ts +121 -0
  7. package/dist/contracts/contract.d.ts.map +1 -0
  8. package/dist/contracts/contract.js.map +1 -0
  9. package/dist/contracts/declare.d.ts.map +1 -0
  10. package/dist/contracts/declare.js.map +1 -0
  11. package/dist/contracts/evolve.d.ts.map +1 -0
  12. package/dist/contracts/evolve.js.map +1 -0
  13. package/dist/contracts/fingerprint.d.ts +16 -0
  14. package/dist/contracts/fingerprint.d.ts.map +1 -0
  15. package/dist/contracts/fingerprint.js.map +1 -0
  16. package/dist/contracts/history.d.ts.map +1 -0
  17. package/dist/contracts/history.js.map +1 -0
  18. package/dist/contracts/host-kind.d.ts.map +1 -0
  19. package/dist/contracts/host-kind.js.map +1 -0
  20. package/dist/contracts/index.d.ts.map +1 -0
  21. package/dist/contracts/index.js.map +1 -0
  22. package/dist/contracts/internal.d.ts.map +1 -0
  23. package/dist/contracts/internal.js.map +1 -0
  24. package/dist/contracts/names.d.ts.map +1 -0
  25. package/dist/contracts/names.js.map +1 -0
  26. package/dist/contracts/params.d.ts +28 -0
  27. package/dist/contracts/params.d.ts.map +1 -0
  28. package/dist/contracts/params.js.map +1 -0
  29. package/dist/contracts/schema.d.ts.map +1 -0
  30. package/dist/contracts/schema.js.map +1 -0
  31. package/dist/contracts/snapshot.d.ts +16 -0
  32. package/dist/contracts/snapshot.d.ts.map +1 -0
  33. package/dist/contracts/snapshot.js +167 -0
  34. package/dist/contracts/snapshot.js.map +1 -0
  35. package/dist/data/args.d.ts +50 -0
  36. package/dist/data/args.d.ts.map +1 -0
  37. package/dist/data/args.js.map +1 -0
  38. package/dist/data/errors.d.ts +80 -0
  39. package/dist/data/errors.d.ts.map +1 -0
  40. package/dist/data/errors.js +116 -0
  41. package/dist/data/errors.js.map +1 -0
  42. package/dist/data/failure.d.ts.map +1 -0
  43. package/dist/data/failure.js +77 -0
  44. package/dist/data/failure.js.map +1 -0
  45. package/dist/data/index.d.ts +4 -0
  46. package/dist/data/index.d.ts.map +1 -0
  47. package/dist/data/index.js +5 -0
  48. package/dist/data/index.js.map +1 -0
  49. package/dist/data/internal.d.ts +7 -0
  50. package/dist/data/internal.d.ts.map +1 -0
  51. package/dist/data/internal.js +8 -0
  52. package/dist/data/internal.js.map +1 -0
  53. package/dist/data/params.d.ts +20 -0
  54. package/dist/data/params.d.ts.map +1 -0
  55. package/dist/data/params.js.map +1 -0
  56. package/dist/data/principal.d.ts +22 -0
  57. package/dist/data/principal.d.ts.map +1 -0
  58. package/dist/data/principal.js +49 -0
  59. package/dist/data/principal.js.map +1 -0
  60. package/dist/data/validator.d.ts +12 -0
  61. package/dist/data/validator.d.ts.map +1 -0
  62. package/dist/data/validator.js +35 -0
  63. package/dist/data/validator.js.map +1 -0
  64. package/dist/documents/address-source.d.ts +20 -0
  65. package/dist/documents/address-source.d.ts.map +1 -0
  66. package/dist/documents/address-source.js.map +1 -0
  67. package/dist/documents/definition.d.ts +84 -0
  68. package/dist/documents/definition.d.ts.map +1 -0
  69. package/dist/documents/definition.js +74 -0
  70. package/dist/documents/definition.js.map +1 -0
  71. package/dist/documents/documents.d.ts +126 -0
  72. package/dist/documents/documents.d.ts.map +1 -0
  73. package/dist/documents/documents.js +248 -0
  74. package/dist/documents/documents.js.map +1 -0
  75. package/dist/documents/fence.d.ts.map +1 -0
  76. package/dist/documents/fence.js.map +1 -0
  77. package/dist/documents/handles.d.ts +76 -0
  78. package/dist/documents/handles.d.ts.map +1 -0
  79. package/dist/documents/handles.js.map +1 -0
  80. package/dist/documents/index.d.ts.map +1 -0
  81. package/dist/documents/index.js.map +1 -0
  82. package/dist/documents/internal.d.ts +9 -0
  83. package/dist/documents/internal.d.ts.map +1 -0
  84. package/dist/documents/internal.js.map +1 -0
  85. package/dist/documents/keyed-slot.d.ts +103 -0
  86. package/dist/documents/keyed-slot.d.ts.map +1 -0
  87. package/dist/documents/keyed-slot.js +395 -0
  88. package/dist/documents/keyed-slot.js.map +1 -0
  89. package/dist/documents/line.d.ts.map +1 -0
  90. package/dist/documents/line.js.map +1 -0
  91. package/dist/documents/persistence.d.ts +104 -0
  92. package/dist/documents/persistence.d.ts.map +1 -0
  93. package/dist/documents/persistence.js +129 -0
  94. package/dist/documents/persistence.js.map +1 -0
  95. package/dist/documents/residency.d.ts +31 -0
  96. package/dist/documents/residency.d.ts.map +1 -0
  97. package/dist/documents/residency.js.map +1 -0
  98. package/dist/documents/slot.d.ts +109 -0
  99. package/dist/documents/slot.d.ts.map +1 -0
  100. package/dist/documents/slot.js +181 -0
  101. package/dist/documents/slot.js.map +1 -0
  102. package/dist/documents/transaction.d.ts +143 -0
  103. package/dist/documents/transaction.d.ts.map +1 -0
  104. package/dist/documents/transaction.js +442 -0
  105. package/dist/documents/transaction.js.map +1 -0
  106. package/dist/host/activity.d.ts +31 -0
  107. package/dist/host/activity.d.ts.map +1 -0
  108. package/dist/host/activity.js +40 -0
  109. package/dist/host/activity.js.map +1 -0
  110. package/dist/host/adapted.d.ts +49 -0
  111. package/dist/host/adapted.d.ts.map +1 -0
  112. package/dist/host/adapted.js.map +1 -0
  113. package/dist/host/attempt.d.ts +308 -0
  114. package/dist/host/attempt.d.ts.map +1 -0
  115. package/dist/host/attempt.js +1199 -0
  116. package/dist/host/attempt.js.map +1 -0
  117. package/dist/host/backoff.d.ts.map +1 -0
  118. package/dist/host/backoff.js.map +1 -0
  119. package/dist/host/ctx.d.ts +94 -0
  120. package/dist/host/ctx.d.ts.map +1 -0
  121. package/dist/host/ctx.js +200 -0
  122. package/dist/host/ctx.js.map +1 -0
  123. package/dist/host/deadline.d.ts.map +1 -0
  124. package/dist/host/deadline.js.map +1 -0
  125. package/dist/host/dependencies.d.ts.map +1 -0
  126. package/dist/host/dependencies.js.map +1 -0
  127. package/dist/host/destination.d.ts +48 -0
  128. package/dist/host/destination.d.ts.map +1 -0
  129. package/dist/host/destination.js.map +1 -0
  130. package/dist/host/facet.d.ts +84 -0
  131. package/dist/host/facet.d.ts.map +1 -0
  132. package/dist/host/facet.js.map +1 -0
  133. package/dist/host/follow.d.ts +52 -0
  134. package/dist/host/follow.d.ts.map +1 -0
  135. package/dist/host/follow.js.map +1 -0
  136. package/dist/host/host.d.ts +571 -0
  137. package/dist/host/host.d.ts.map +1 -0
  138. package/dist/host/host.js +1318 -0
  139. package/dist/host/host.js.map +1 -0
  140. package/dist/host/index.d.ts +17 -0
  141. package/dist/host/index.d.ts.map +1 -0
  142. package/dist/host/index.js.map +1 -0
  143. package/dist/host/internal.d.ts +11 -0
  144. package/dist/host/internal.d.ts.map +1 -0
  145. package/dist/host/internal.js +9 -0
  146. package/dist/host/internal.js.map +1 -0
  147. package/dist/host/members.d.ts +50 -0
  148. package/dist/host/members.d.ts.map +1 -0
  149. package/dist/host/members.js.map +1 -0
  150. package/dist/host/native.d.ts +64 -0
  151. package/dist/host/native.d.ts.map +1 -0
  152. package/dist/host/native.js +126 -0
  153. package/dist/host/native.js.map +1 -0
  154. package/dist/host/object.d.ts +331 -0
  155. package/dist/host/object.d.ts.map +1 -0
  156. package/dist/host/object.js +1296 -0
  157. package/dist/host/object.js.map +1 -0
  158. package/dist/host/old-work.d.ts +34 -0
  159. package/dist/host/old-work.d.ts.map +1 -0
  160. package/dist/host/old-work.js +52 -0
  161. package/dist/host/old-work.js.map +1 -0
  162. package/dist/host/parked.d.ts +23 -0
  163. package/dist/host/parked.d.ts.map +1 -0
  164. package/dist/host/parked.js.map +1 -0
  165. package/dist/host/presence.d.ts +34 -0
  166. package/dist/host/presence.d.ts.map +1 -0
  167. package/dist/host/presence.js.map +1 -0
  168. package/dist/host/readiness.d.ts +27 -0
  169. package/dist/host/readiness.d.ts.map +1 -0
  170. package/dist/host/readiness.js +134 -0
  171. package/dist/host/readiness.js.map +1 -0
  172. package/dist/host/ref-state.d.ts +53 -0
  173. package/dist/host/ref-state.d.ts.map +1 -0
  174. package/dist/host/ref-state.js +83 -0
  175. package/dist/host/ref-state.js.map +1 -0
  176. package/dist/host/reference-keys.d.ts +36 -0
  177. package/dist/host/reference-keys.d.ts.map +1 -0
  178. package/dist/host/reference-keys.js +168 -0
  179. package/dist/host/reference-keys.js.map +1 -0
  180. package/dist/host/reference-source.d.ts +65 -0
  181. package/dist/host/reference-source.d.ts.map +1 -0
  182. package/dist/host/reference-source.js +285 -0
  183. package/dist/host/reference-source.js.map +1 -0
  184. package/dist/host/reference.d.ts +321 -0
  185. package/dist/host/reference.d.ts.map +1 -0
  186. package/dist/host/reference.js +797 -0
  187. package/dist/host/reference.js.map +1 -0
  188. package/dist/host/reload-cycle.d.ts +16 -0
  189. package/dist/host/reload-cycle.d.ts.map +1 -0
  190. package/dist/host/reload-cycle.js +81 -0
  191. package/dist/host/reload-cycle.js.map +1 -0
  192. package/dist/host/retry-on.d.ts.map +1 -0
  193. package/dist/host/retry-on.js.map +1 -0
  194. package/dist/host/revocation.d.ts +16 -0
  195. package/dist/host/revocation.d.ts.map +1 -0
  196. package/dist/host/revocation.js.map +1 -0
  197. package/dist/host/root.d.ts +37 -0
  198. package/dist/host/root.d.ts.map +1 -0
  199. package/dist/host/root.js +68 -0
  200. package/dist/host/root.js.map +1 -0
  201. package/dist/host/route.d.ts +64 -0
  202. package/dist/host/route.d.ts.map +1 -0
  203. package/dist/host/route.js +227 -0
  204. package/dist/host/route.js.map +1 -0
  205. package/dist/host/routines.d.ts +78 -0
  206. package/dist/host/routines.d.ts.map +1 -0
  207. package/dist/host/routines.js +398 -0
  208. package/dist/host/routines.js.map +1 -0
  209. package/dist/host/sleep.d.ts +9 -0
  210. package/dist/host/sleep.d.ts.map +1 -0
  211. package/dist/host/sleep.js.map +1 -0
  212. package/dist/host/staging.d.ts +94 -0
  213. package/dist/host/staging.d.ts.map +1 -0
  214. package/dist/host/staging.js +304 -0
  215. package/dist/host/staging.js.map +1 -0
  216. package/dist/host/unbound-clock.d.ts +23 -0
  217. package/dist/host/unbound-clock.d.ts.map +1 -0
  218. package/dist/host/unbound-clock.js +58 -0
  219. package/dist/host/unbound-clock.js.map +1 -0
  220. package/dist/host/unbound.d.ts +37 -0
  221. package/dist/host/unbound.d.ts.map +1 -0
  222. package/dist/host/unbound.js +88 -0
  223. package/dist/host/unbound.js.map +1 -0
  224. package/dist/host/uuid.d.ts.map +1 -0
  225. package/dist/host/uuid.js.map +1 -0
  226. package/dist/index.d.ts +29 -19
  227. package/dist/index.d.ts.map +1 -1
  228. package/dist/index.js +20 -10
  229. package/dist/index.js.map +1 -1
  230. package/dist/jobs/definition.d.ts.map +1 -0
  231. package/dist/jobs/definition.js.map +1 -0
  232. package/dist/jobs/index.d.ts.map +1 -0
  233. package/dist/jobs/index.js.map +1 -0
  234. package/dist/jobs/internal.d.ts.map +1 -0
  235. package/dist/jobs/internal.js.map +1 -0
  236. package/dist/jobs/job.d.ts +149 -0
  237. package/dist/jobs/job.d.ts.map +1 -0
  238. package/dist/jobs/job.js +387 -0
  239. package/dist/jobs/job.js.map +1 -0
  240. package/dist/jobs/persisted.d.ts +38 -0
  241. package/dist/jobs/persisted.d.ts.map +1 -0
  242. package/dist/jobs/persisted.js.map +1 -0
  243. package/dist/jobs/records.d.ts +231 -0
  244. package/dist/jobs/records.d.ts.map +1 -0
  245. package/dist/jobs/records.js +871 -0
  246. package/dist/jobs/records.js.map +1 -0
  247. package/dist/jobs/run-states.d.ts +69 -0
  248. package/dist/jobs/run-states.d.ts.map +1 -0
  249. package/dist/jobs/run-states.js +228 -0
  250. package/dist/jobs/run-states.js.map +1 -0
  251. package/dist/jobs/run.d.ts +117 -0
  252. package/dist/jobs/run.d.ts.map +1 -0
  253. package/dist/jobs/run.js +204 -0
  254. package/dist/jobs/run.js.map +1 -0
  255. package/dist/jobs/running.d.ts +44 -0
  256. package/dist/jobs/running.d.ts.map +1 -0
  257. package/dist/jobs/running.js.map +1 -0
  258. package/dist/jobs/stored.d.ts +63 -0
  259. package/dist/jobs/stored.d.ts.map +1 -0
  260. package/dist/jobs/stored.js.map +1 -0
  261. package/dist/link/binary.d.ts.map +1 -0
  262. package/dist/link/binary.js +544 -0
  263. package/dist/link/binary.js.map +1 -0
  264. package/dist/link/channel.d.ts +68 -0
  265. package/dist/link/channel.d.ts.map +1 -0
  266. package/dist/link/channel.js +215 -0
  267. package/dist/link/channel.js.map +1 -0
  268. package/dist/link/errors.d.ts.map +1 -0
  269. package/dist/link/errors.js.map +1 -0
  270. package/dist/link/index.d.ts.map +1 -0
  271. package/dist/link/index.js.map +1 -0
  272. package/dist/link/internal.d.ts.map +1 -0
  273. package/dist/link/internal.js.map +1 -0
  274. package/dist/link/ipc.d.ts.map +1 -0
  275. package/dist/link/ipc.js.map +1 -0
  276. package/dist/link/link.d.ts.map +1 -0
  277. package/dist/link/link.js.map +1 -0
  278. package/dist/link/message.d.ts +262 -0
  279. package/dist/link/message.d.ts.map +1 -0
  280. package/dist/link/message.js +156 -0
  281. package/dist/link/message.js.map +1 -0
  282. package/dist/link/part.d.ts +80 -0
  283. package/dist/link/part.d.ts.map +1 -0
  284. package/dist/link/part.js +165 -0
  285. package/dist/link/part.js.map +1 -0
  286. package/dist/link/text.d.ts.map +1 -0
  287. package/dist/link/text.js +355 -0
  288. package/dist/link/text.js.map +1 -0
  289. package/dist/link/values.d.ts.map +1 -0
  290. package/dist/link/values.js +121 -0
  291. package/dist/link/values.js.map +1 -0
  292. package/dist/link/websocket.d.ts.map +1 -0
  293. package/dist/link/websocket.js.map +1 -0
  294. package/dist/node/app/app.d.ts +269 -0
  295. package/dist/node/app/app.d.ts.map +1 -0
  296. package/dist/node/app/app.js +513 -0
  297. package/dist/node/app/app.js.map +1 -0
  298. package/dist/node/app/archive.d.ts +37 -0
  299. package/dist/node/app/archive.d.ts.map +1 -0
  300. package/dist/node/app/archive.js +204 -0
  301. package/dist/node/app/archive.js.map +1 -0
  302. package/dist/node/app/blobs.d.ts +23 -0
  303. package/dist/node/app/blobs.d.ts.map +1 -0
  304. package/dist/node/app/blobs.js +64 -0
  305. package/dist/node/app/blobs.js.map +1 -0
  306. package/dist/node/app/data.d.ts +35 -0
  307. package/dist/node/app/data.d.ts.map +1 -0
  308. package/dist/node/app/data.js +44 -0
  309. package/dist/node/app/data.js.map +1 -0
  310. package/dist/node/app/ephemeral-sessions.d.ts +20 -0
  311. package/dist/node/app/ephemeral-sessions.d.ts.map +1 -0
  312. package/dist/node/app/ephemeral-sessions.js +69 -0
  313. package/dist/node/app/ephemeral-sessions.js.map +1 -0
  314. package/dist/node/app/ephemeral.d.ts +11 -0
  315. package/dist/node/app/ephemeral.d.ts.map +1 -0
  316. package/dist/node/app/ephemeral.js +34 -0
  317. package/dist/node/app/ephemeral.js.map +1 -0
  318. package/dist/node/app/files-copy.d.ts +13 -0
  319. package/dist/node/app/files-copy.d.ts.map +1 -0
  320. package/dist/node/app/files-copy.js +86 -0
  321. package/dist/node/app/files-copy.js.map +1 -0
  322. package/dist/node/app/files-entry.d.ts +4 -0
  323. package/dist/node/app/files-entry.d.ts.map +1 -0
  324. package/dist/node/app/files-entry.js +7 -0
  325. package/dist/node/app/files-entry.js.map +1 -0
  326. package/dist/node/app/files-index.d.ts +180 -0
  327. package/dist/node/app/files-index.d.ts.map +1 -0
  328. package/dist/node/app/files-index.js +535 -0
  329. package/dist/node/app/files-index.js.map +1 -0
  330. package/dist/node/app/files.d.ts +363 -0
  331. package/dist/node/app/files.d.ts.map +1 -0
  332. package/dist/node/app/files.js +368 -0
  333. package/dist/node/app/files.js.map +1 -0
  334. package/dist/node/app/folder-views.d.ts +21 -0
  335. package/dist/node/app/folder-views.d.ts.map +1 -0
  336. package/dist/node/app/folder-views.js +55 -0
  337. package/dist/node/app/folder-views.js.map +1 -0
  338. package/dist/node/app/index.d.ts +12 -0
  339. package/dist/node/app/index.d.ts.map +1 -0
  340. package/dist/node/app/index.js +15 -0
  341. package/dist/node/app/index.js.map +1 -0
  342. package/dist/node/app/info.d.ts +66 -0
  343. package/dist/node/app/info.d.ts.map +1 -0
  344. package/dist/node/app/info.js +37 -0
  345. package/dist/node/app/info.js.map +1 -0
  346. package/dist/node/app/invite.d.ts +5 -0
  347. package/dist/node/app/invite.d.ts.map +1 -0
  348. package/dist/node/app/invite.js +64 -0
  349. package/dist/node/app/invite.js.map +1 -0
  350. package/dist/node/app/layout.d.ts +36 -0
  351. package/dist/node/app/layout.d.ts.map +1 -0
  352. package/dist/node/app/layout.js +87 -0
  353. package/dist/node/app/layout.js.map +1 -0
  354. package/dist/node/app/owner.d.ts +31 -0
  355. package/dist/node/app/owner.d.ts.map +1 -0
  356. package/dist/node/app/owner.js +104 -0
  357. package/dist/node/app/owner.js.map +1 -0
  358. package/dist/node/app/pairing.d.ts +55 -0
  359. package/dist/node/app/pairing.d.ts.map +1 -0
  360. package/dist/node/app/pairing.js +183 -0
  361. package/dist/node/app/pairing.js.map +1 -0
  362. package/dist/node/app/secrets.d.ts +16 -0
  363. package/dist/node/app/secrets.d.ts.map +1 -0
  364. package/dist/node/app/secrets.js +72 -0
  365. package/dist/node/app/secrets.js.map +1 -0
  366. package/dist/node/app/sessions.d.ts +72 -0
  367. package/dist/node/app/sessions.d.ts.map +1 -0
  368. package/dist/node/app/sessions.js +222 -0
  369. package/dist/node/app/sessions.js.map +1 -0
  370. package/dist/node/app/tar.d.ts +24 -0
  371. package/dist/node/app/tar.d.ts.map +1 -0
  372. package/dist/node/app/tar.js +167 -0
  373. package/dist/node/app/tar.js.map +1 -0
  374. package/dist/node/app/uploads.d.ts +37 -0
  375. package/dist/node/app/uploads.d.ts.map +1 -0
  376. package/dist/node/app/uploads.js +157 -0
  377. package/dist/node/app/uploads.js.map +1 -0
  378. package/dist/node/app/users.d.ts +37 -0
  379. package/dist/node/app/users.d.ts.map +1 -0
  380. package/dist/node/app/users.js +62 -0
  381. package/dist/node/app/users.js.map +1 -0
  382. package/dist/node/app/worker.d.ts +18 -0
  383. package/dist/node/app/worker.d.ts.map +1 -0
  384. package/dist/node/app/worker.js +84 -0
  385. package/dist/node/app/worker.js.map +1 -0
  386. package/dist/node/compression.d.ts +7 -0
  387. package/dist/node/compression.d.ts.map +1 -0
  388. package/dist/node/compression.js +25 -0
  389. package/dist/node/compression.js.map +1 -0
  390. package/dist/node/http/admission.d.ts.map +1 -0
  391. package/dist/node/http/admission.js.map +1 -0
  392. package/dist/node/http/authenticate.d.ts +21 -0
  393. package/dist/node/http/authenticate.d.ts.map +1 -0
  394. package/dist/node/http/authenticate.js +34 -0
  395. package/dist/node/http/authenticate.js.map +1 -0
  396. package/dist/node/http/cookies.d.ts +32 -0
  397. package/dist/node/http/cookies.d.ts.map +1 -0
  398. package/dist/node/http/cookies.js +70 -0
  399. package/dist/node/http/cookies.js.map +1 -0
  400. package/dist/node/http/file.d.ts.map +1 -0
  401. package/dist/node/http/file.js.map +1 -0
  402. package/dist/node/http/headers.d.ts.map +1 -0
  403. package/dist/node/http/headers.js +136 -0
  404. package/dist/node/http/headers.js.map +1 -0
  405. package/dist/node/http/http.d.ts +111 -0
  406. package/dist/node/http/http.d.ts.map +1 -0
  407. package/dist/node/http/http.js +524 -0
  408. package/dist/node/http/http.js.map +1 -0
  409. package/dist/node/http/incoming.d.ts.map +1 -0
  410. package/dist/node/http/incoming.js.map +1 -0
  411. package/dist/node/http/index.d.ts +11 -0
  412. package/dist/node/http/index.d.ts.map +1 -0
  413. package/dist/node/http/index.js +12 -0
  414. package/dist/node/http/index.js.map +1 -0
  415. package/dist/node/http/node.d.ts.map +1 -0
  416. package/dist/node/http/node.js.map +1 -0
  417. package/dist/node/http/request.d.ts +60 -0
  418. package/dist/node/http/request.d.ts.map +1 -0
  419. package/dist/node/http/request.js +118 -0
  420. package/dist/node/http/request.js.map +1 -0
  421. package/dist/node/http/response.d.ts +63 -0
  422. package/dist/node/http/response.d.ts.map +1 -0
  423. package/dist/node/http/response.js.map +1 -0
  424. package/dist/node/http/router.d.ts +132 -0
  425. package/dist/node/http/router.d.ts.map +1 -0
  426. package/dist/node/http/router.js +267 -0
  427. package/dist/node/http/router.js.map +1 -0
  428. package/dist/node/http/upgrades.d.ts +61 -0
  429. package/dist/node/http/upgrades.d.ts.map +1 -0
  430. package/dist/node/http/upgrades.js +192 -0
  431. package/dist/node/http/upgrades.js.map +1 -0
  432. package/dist/node/plugins/base-inputs.d.ts +14 -0
  433. package/dist/node/plugins/base-inputs.d.ts.map +1 -0
  434. package/dist/node/plugins/base-inputs.js +33 -0
  435. package/dist/node/plugins/base-inputs.js.map +1 -0
  436. package/dist/node/plugins/build.d.ts +77 -0
  437. package/dist/node/plugins/build.d.ts.map +1 -0
  438. package/dist/node/plugins/build.js +576 -0
  439. package/dist/node/plugins/build.js.map +1 -0
  440. package/dist/node/plugins/css-modules.d.ts +13 -0
  441. package/dist/node/plugins/css-modules.d.ts.map +1 -0
  442. package/dist/node/plugins/css-modules.js +58 -0
  443. package/dist/node/plugins/css-modules.js.map +1 -0
  444. package/dist/node/plugins/discover.d.ts +67 -0
  445. package/dist/node/plugins/discover.d.ts.map +1 -0
  446. package/dist/node/plugins/discover.js +369 -0
  447. package/dist/node/plugins/discover.js.map +1 -0
  448. package/dist/node/plugins/evaluate.d.ts +33 -0
  449. package/dist/node/plugins/evaluate.d.ts.map +1 -0
  450. package/dist/node/plugins/evaluate.js +121 -0
  451. package/dist/node/plugins/evaluate.js.map +1 -0
  452. package/dist/node/plugins/index.d.ts +11 -0
  453. package/dist/node/plugins/index.d.ts.map +1 -0
  454. package/dist/node/plugins/index.js +13 -0
  455. package/dist/node/plugins/index.js.map +1 -0
  456. package/dist/node/plugins/install.d.ts +38 -0
  457. package/dist/node/plugins/install.d.ts.map +1 -0
  458. package/dist/node/plugins/install.js +213 -0
  459. package/dist/node/plugins/install.js.map +1 -0
  460. package/dist/node/plugins/plugins.d.ts +162 -0
  461. package/dist/node/plugins/plugins.d.ts.map +1 -0
  462. package/dist/node/plugins/plugins.js +244 -0
  463. package/dist/node/plugins/plugins.js.map +1 -0
  464. package/dist/node/plugins/runtime.d.ts +57 -0
  465. package/dist/node/plugins/runtime.d.ts.map +1 -0
  466. package/dist/node/plugins/runtime.js +92 -0
  467. package/dist/node/plugins/runtime.js.map +1 -0
  468. package/dist/node/plugins/stack.d.ts.map +1 -0
  469. package/dist/node/plugins/stack.js.map +1 -0
  470. package/dist/node/plugins/testing.d.ts +58 -0
  471. package/dist/node/plugins/testing.d.ts.map +1 -0
  472. package/dist/node/plugins/testing.js +210 -0
  473. package/dist/node/plugins/testing.js.map +1 -0
  474. package/dist/node/plugins/watcher.d.ts +69 -0
  475. package/dist/node/plugins/watcher.d.ts.map +1 -0
  476. package/dist/node/plugins/watcher.js +622 -0
  477. package/dist/node/plugins/watcher.js.map +1 -0
  478. package/dist/node/surfaces/bundle.d.ts +31 -0
  479. package/dist/node/surfaces/bundle.d.ts.map +1 -0
  480. package/dist/node/surfaces/bundle.js +118 -0
  481. package/dist/node/surfaces/bundle.js.map +1 -0
  482. package/dist/node/surfaces/current.d.ts +17 -0
  483. package/dist/node/surfaces/current.d.ts.map +1 -0
  484. package/dist/node/surfaces/current.js +54 -0
  485. package/dist/node/surfaces/current.js.map +1 -0
  486. package/dist/node/surfaces/index.d.ts +6 -0
  487. package/dist/node/surfaces/index.d.ts.map +1 -0
  488. package/dist/node/surfaces/index.js +6 -0
  489. package/dist/node/surfaces/index.js.map +1 -0
  490. package/dist/node/surfaces/published.d.ts +27 -0
  491. package/dist/node/surfaces/published.d.ts.map +1 -0
  492. package/dist/node/surfaces/published.js +142 -0
  493. package/dist/node/surfaces/published.js.map +1 -0
  494. package/dist/node/surfaces/served.d.ts +15 -0
  495. package/dist/node/surfaces/served.d.ts.map +1 -0
  496. package/dist/node/surfaces/served.js +42 -0
  497. package/dist/node/surfaces/served.js.map +1 -0
  498. package/dist/node/surfaces/surface-build.d.ts +53 -0
  499. package/dist/node/surfaces/surface-build.d.ts.map +1 -0
  500. package/dist/node/surfaces/surface-build.js +105 -0
  501. package/dist/node/surfaces/surface-build.js.map +1 -0
  502. package/dist/node/surfaces/tui.d.ts +40 -0
  503. package/dist/node/surfaces/tui.d.ts.map +1 -0
  504. package/dist/node/surfaces/tui.js +55 -0
  505. package/dist/node/surfaces/tui.js.map +1 -0
  506. package/dist/node/surfaces/web.d.ts +56 -0
  507. package/dist/node/surfaces/web.d.ts.map +1 -0
  508. package/dist/node/surfaces/web.js +108 -0
  509. package/dist/node/surfaces/web.js.map +1 -0
  510. package/dist/node/tui/actions.d.ts +49 -0
  511. package/dist/node/tui/actions.d.ts.map +1 -0
  512. package/dist/node/tui/actions.js +195 -0
  513. package/dist/node/tui/actions.js.map +1 -0
  514. package/dist/node/tui/credentials.d.ts +17 -0
  515. package/dist/node/tui/credentials.d.ts.map +1 -0
  516. package/dist/node/tui/credentials.js +54 -0
  517. package/dist/node/tui/credentials.js.map +1 -0
  518. package/dist/node/tui/filter.d.ts +5 -0
  519. package/dist/node/tui/filter.d.ts.map +1 -0
  520. package/dist/node/tui/filter.js +79 -0
  521. package/dist/node/tui/filter.js.map +1 -0
  522. package/dist/node/tui/index.d.ts +6 -0
  523. package/dist/node/tui/index.d.ts.map +1 -0
  524. package/dist/node/tui/index.js +6 -0
  525. package/dist/node/tui/index.js.map +1 -0
  526. package/dist/node/tui/launcher.d.ts +40 -0
  527. package/dist/node/tui/launcher.d.ts.map +1 -0
  528. package/dist/node/tui/launcher.js +439 -0
  529. package/dist/node/tui/launcher.js.map +1 -0
  530. package/dist/node/tui/pipe.d.ts +18 -0
  531. package/dist/node/tui/pipe.d.ts.map +1 -0
  532. package/dist/node/tui/pipe.js +134 -0
  533. package/dist/node/tui/pipe.js.map +1 -0
  534. package/dist/node/tui/sandbox.d.ts +54 -0
  535. package/dist/node/tui/sandbox.d.ts.map +1 -0
  536. package/dist/node/tui/sandbox.js +431 -0
  537. package/dist/node/tui/sandbox.js.map +1 -0
  538. package/dist/node/workers/base.d.ts +30 -0
  539. package/dist/node/workers/base.d.ts.map +1 -0
  540. package/dist/node/workers/base.js +255 -0
  541. package/dist/node/workers/base.js.map +1 -0
  542. package/dist/node/workers/child.d.ts +4 -0
  543. package/dist/node/workers/child.d.ts.map +1 -0
  544. package/dist/node/workers/child.js +6 -0
  545. package/dist/node/workers/child.js.map +1 -0
  546. package/dist/node/workers/control.d.ts +83 -0
  547. package/dist/node/workers/control.d.ts.map +1 -0
  548. package/dist/node/workers/control.js +77 -0
  549. package/dist/node/workers/control.js.map +1 -0
  550. package/dist/node/workers/index.d.ts +4 -0
  551. package/dist/node/workers/index.d.ts.map +1 -0
  552. package/dist/node/workers/index.js +7 -0
  553. package/dist/node/workers/index.js.map +1 -0
  554. package/dist/node/workers/lock.d.ts +30 -0
  555. package/dist/node/workers/lock.d.ts.map +1 -0
  556. package/dist/node/workers/lock.js +180 -0
  557. package/dist/node/workers/lock.js.map +1 -0
  558. package/dist/node/workers/main.d.ts +46 -0
  559. package/dist/node/workers/main.d.ts.map +1 -0
  560. package/dist/node/workers/main.js +230 -0
  561. package/dist/node/workers/main.js.map +1 -0
  562. package/dist/node/workers/process.d.ts +42 -0
  563. package/dist/node/workers/process.d.ts.map +1 -0
  564. package/dist/node/workers/process.js +125 -0
  565. package/dist/node/workers/process.js.map +1 -0
  566. package/dist/node/workers/workers.d.ts +122 -0
  567. package/dist/node/workers/workers.d.ts.map +1 -0
  568. package/dist/node/workers/workers.js +677 -0
  569. package/dist/node/workers/workers.js.map +1 -0
  570. package/dist/react/hooks.d.ts +43 -0
  571. package/dist/react/hooks.d.ts.map +1 -0
  572. package/dist/react/hooks.js +82 -0
  573. package/dist/react/hooks.js.map +1 -0
  574. package/dist/react/index.d.ts +3 -0
  575. package/dist/react/index.d.ts.map +1 -0
  576. package/dist/react/index.js +4 -0
  577. package/dist/react/index.js.map +1 -0
  578. package/dist/react/stores.d.ts +9 -0
  579. package/dist/react/stores.d.ts.map +1 -0
  580. package/dist/react/stores.js +37 -0
  581. package/dist/react/stores.js.map +1 -0
  582. package/dist/registries/contribution.d.ts.map +1 -0
  583. package/dist/registries/contribution.js.map +1 -0
  584. package/dist/registries/entries.d.ts.map +1 -0
  585. package/dist/registries/entries.js.map +1 -0
  586. package/dist/registries/index.d.ts.map +1 -0
  587. package/dist/registries/index.js.map +1 -0
  588. package/dist/registries/internal.d.ts.map +1 -0
  589. package/dist/registries/internal.js.map +1 -0
  590. package/dist/registries/record.d.ts +115 -0
  591. package/dist/registries/record.d.ts.map +1 -0
  592. package/dist/registries/record.js +283 -0
  593. package/dist/registries/record.js.map +1 -0
  594. package/dist/registries/registry.d.ts +74 -0
  595. package/dist/registries/registry.d.ts.map +1 -0
  596. package/dist/registries/registry.js.map +1 -0
  597. package/dist/registries/value.d.ts.map +1 -0
  598. package/dist/registries/value.js +224 -0
  599. package/dist/registries/value.js.map +1 -0
  600. package/dist/remote/calls.d.ts.map +1 -0
  601. package/dist/remote/calls.js.map +1 -0
  602. package/dist/remote/consumer.d.ts +43 -0
  603. package/dist/remote/consumer.d.ts.map +1 -0
  604. package/dist/remote/consumer.js +350 -0
  605. package/dist/remote/consumer.js.map +1 -0
  606. package/dist/remote/hold.d.ts +141 -0
  607. package/dist/remote/hold.d.ts.map +1 -0
  608. package/dist/remote/hold.js +579 -0
  609. package/dist/remote/hold.js.map +1 -0
  610. package/dist/remote/host-link.d.ts +77 -0
  611. package/dist/remote/host-link.d.ts.map +1 -0
  612. package/dist/remote/host-link.js +184 -0
  613. package/dist/remote/host-link.js.map +1 -0
  614. package/dist/remote/internal.d.ts.map +1 -0
  615. package/dist/remote/internal.js.map +1 -0
  616. package/dist/remote/path.d.ts.map +1 -0
  617. package/dist/remote/path.js.map +1 -0
  618. package/dist/remote/provider.d.ts +89 -0
  619. package/dist/remote/provider.d.ts.map +1 -0
  620. package/dist/remote/provider.js +597 -0
  621. package/dist/remote/provider.js.map +1 -0
  622. package/dist/remote/relay.d.ts +69 -0
  623. package/dist/remote/relay.d.ts.map +1 -0
  624. package/dist/remote/relay.js +219 -0
  625. package/dist/remote/relay.js.map +1 -0
  626. package/dist/remote/remote-object.d.ts +138 -0
  627. package/dist/remote/remote-object.d.ts.map +1 -0
  628. package/dist/remote/remote-object.js +492 -0
  629. package/dist/remote/remote-object.js.map +1 -0
  630. package/dist/remote/replica.d.ts +59 -0
  631. package/dist/remote/replica.d.ts.map +1 -0
  632. package/dist/remote/replica.js +125 -0
  633. package/dist/remote/replica.js.map +1 -0
  634. package/dist/sqlite/node.d.ts +9 -1
  635. package/dist/sqlite/node.d.ts.map +1 -1
  636. package/dist/sqlite/node.js +9 -3
  637. package/dist/sqlite/node.js.map +1 -1
  638. package/dist/state/batch.d.ts +64 -0
  639. package/dist/state/batch.d.ts.map +1 -0
  640. package/dist/state/batch.js +164 -0
  641. package/dist/state/batch.js.map +1 -0
  642. package/dist/state/derive.d.ts +52 -0
  643. package/dist/state/derive.d.ts.map +1 -0
  644. package/dist/state/derive.js +182 -0
  645. package/dist/state/derive.js.map +1 -0
  646. package/dist/state/index.d.ts +6 -0
  647. package/dist/state/index.d.ts.map +1 -0
  648. package/dist/state/index.js.map +1 -0
  649. package/dist/state/internal.d.ts.map +1 -0
  650. package/dist/state/internal.js.map +1 -0
  651. package/dist/state/native-source.d.ts +106 -0
  652. package/dist/state/native-source.d.ts.map +1 -0
  653. package/dist/state/native-source.js +240 -0
  654. package/dist/state/native-source.js.map +1 -0
  655. package/dist/state/watchable.d.ts +114 -0
  656. package/dist/state/watchable.d.ts.map +1 -0
  657. package/dist/state/watchable.js +156 -0
  658. package/dist/state/watchable.js.map +1 -0
  659. package/dist/state/writable.d.ts +32 -0
  660. package/dist/state/writable.d.ts.map +1 -0
  661. package/dist/state/writable.js.map +1 -0
  662. package/dist/store/adapter.d.ts +67 -0
  663. package/dist/store/adapter.d.ts.map +1 -0
  664. package/dist/store/adapter.js.map +1 -0
  665. package/dist/store/allocator.d.ts.map +1 -0
  666. package/dist/store/allocator.js.map +1 -0
  667. package/dist/store/applier.d.ts.map +1 -0
  668. package/dist/store/applier.js.map +1 -0
  669. package/dist/store/apply-batch.d.ts +12 -0
  670. package/dist/store/apply-batch.d.ts.map +1 -0
  671. package/dist/store/apply-batch.js.map +1 -0
  672. package/dist/store/archive.d.ts +32 -0
  673. package/dist/store/archive.d.ts.map +1 -0
  674. package/dist/store/archive.js +130 -0
  675. package/dist/store/archive.js.map +1 -0
  676. package/dist/store/backend.d.ts +10 -0
  677. package/dist/store/backend.d.ts.map +1 -0
  678. package/dist/store/backend.js.map +1 -0
  679. package/dist/store/catalog.d.ts +24 -0
  680. package/dist/store/catalog.d.ts.map +1 -0
  681. package/dist/store/catalog.js.map +1 -0
  682. package/dist/store/claims.d.ts.map +1 -0
  683. package/dist/store/claims.js.map +1 -0
  684. package/dist/store/columns.d.ts.map +1 -0
  685. package/dist/store/columns.js.map +1 -0
  686. package/dist/store/engine.d.ts +176 -0
  687. package/dist/store/engine.d.ts.map +1 -0
  688. package/dist/store/engine.js +283 -0
  689. package/dist/store/engine.js.map +1 -0
  690. package/dist/store/evaluate.d.ts +17 -0
  691. package/dist/store/evaluate.d.ts.map +1 -0
  692. package/dist/store/evaluate.js.map +1 -0
  693. package/dist/store/export.d.ts +17 -0
  694. package/dist/store/export.d.ts.map +1 -0
  695. package/dist/store/export.js +200 -0
  696. package/dist/store/export.js.map +1 -0
  697. package/dist/store/expression.d.ts +150 -0
  698. package/dist/store/expression.d.ts.map +1 -0
  699. package/dist/store/expression.js.map +1 -0
  700. package/dist/store/import.d.ts +10 -0
  701. package/dist/store/import.d.ts.map +1 -0
  702. package/dist/store/import.js +276 -0
  703. package/dist/store/import.js.map +1 -0
  704. package/dist/store/index.d.ts.map +1 -0
  705. package/dist/store/index.js.map +1 -0
  706. package/dist/store/json-column.d.ts +33 -0
  707. package/dist/store/json-column.d.ts.map +1 -0
  708. package/dist/store/json-column.js +62 -0
  709. package/dist/store/json-column.js.map +1 -0
  710. package/dist/store/jsonl.d.ts.map +1 -0
  711. package/dist/store/jsonl.js.map +1 -0
  712. package/dist/store/live-query.d.ts +108 -0
  713. package/dist/store/live-query.d.ts.map +1 -0
  714. package/dist/store/live-query.js +254 -0
  715. package/dist/store/live-query.js.map +1 -0
  716. package/dist/store/outbox.d.ts +26 -0
  717. package/dist/store/outbox.d.ts.map +1 -0
  718. package/dist/store/outbox.js.map +1 -0
  719. package/dist/store/query.d.ts +39 -0
  720. package/dist/store/query.d.ts.map +1 -0
  721. package/dist/store/query.js.map +1 -0
  722. package/dist/store/refusal.d.ts.map +1 -0
  723. package/dist/store/refusal.js.map +1 -0
  724. package/dist/store/rows.d.ts +80 -0
  725. package/dist/store/rows.d.ts.map +1 -0
  726. package/dist/store/rows.js.map +1 -0
  727. package/dist/store/schema.d.ts +25 -0
  728. package/dist/store/schema.d.ts.map +1 -0
  729. package/dist/store/schema.js +115 -0
  730. package/dist/store/schema.js.map +1 -0
  731. package/dist/store/sql.d.ts +73 -0
  732. package/dist/store/sql.d.ts.map +1 -0
  733. package/dist/store/sql.js.map +1 -0
  734. package/dist/store/step.d.ts +50 -0
  735. package/dist/store/step.d.ts.map +1 -0
  736. package/dist/store/step.js +52 -0
  737. package/dist/store/step.js.map +1 -0
  738. package/dist/store/store.d.ts +171 -0
  739. package/dist/store/store.d.ts.map +1 -0
  740. package/dist/store/store.js +818 -0
  741. package/dist/store/store.js.map +1 -0
  742. package/dist/store/table-changes.d.ts +29 -0
  743. package/dist/store/table-changes.d.ts.map +1 -0
  744. package/dist/store/table-changes.js.map +1 -0
  745. package/dist/store/table-evolve.d.ts.map +1 -0
  746. package/dist/store/table-evolve.js.map +1 -0
  747. package/dist/store/table-handle.d.ts +73 -0
  748. package/dist/store/table-handle.d.ts.map +1 -0
  749. package/dist/store/table-handle.js +101 -0
  750. package/dist/store/table-handle.js.map +1 -0
  751. package/dist/store/table-history.d.ts.map +1 -0
  752. package/dist/store/table-history.js.map +1 -0
  753. package/dist/store/table-migration.d.ts +16 -0
  754. package/dist/store/table-migration.d.ts.map +1 -0
  755. package/dist/store/table-migration.js +202 -0
  756. package/dist/store/table-migration.js.map +1 -0
  757. package/dist/store/table-writes.d.ts.map +1 -0
  758. package/dist/store/table-writes.js +170 -0
  759. package/dist/store/table-writes.js.map +1 -0
  760. package/dist/store/table.d.ts +80 -0
  761. package/dist/store/table.d.ts.map +1 -0
  762. package/dist/store/table.js.map +1 -0
  763. package/dist/store/text.d.ts.map +1 -0
  764. package/dist/store/text.js.map +1 -0
  765. package/dist/store/writes.d.ts.map +1 -0
  766. package/dist/store/writes.js.map +1 -0
  767. package/dist/surfaces/active-language.d.ts +20 -0
  768. package/dist/surfaces/active-language.d.ts.map +1 -0
  769. package/dist/surfaces/active-language.js +78 -0
  770. package/dist/surfaces/active-language.js.map +1 -0
  771. package/dist/surfaces/active-theme.d.ts +16 -0
  772. package/dist/surfaces/active-theme.d.ts.map +1 -0
  773. package/dist/surfaces/active-theme.js +47 -0
  774. package/dist/surfaces/active-theme.js.map +1 -0
  775. package/dist/surfaces/client.d.ts +96 -0
  776. package/dist/surfaces/client.d.ts.map +1 -0
  777. package/dist/surfaces/client.js +264 -0
  778. package/dist/surfaces/client.js.map +1 -0
  779. package/dist/surfaces/connection.d.ts +49 -0
  780. package/dist/surfaces/connection.d.ts.map +1 -0
  781. package/dist/surfaces/connection.js +142 -0
  782. package/dist/surfaces/connection.js.map +1 -0
  783. package/dist/surfaces/format.d.ts +5 -0
  784. package/dist/surfaces/format.d.ts.map +1 -0
  785. package/dist/surfaces/format.js +37 -0
  786. package/dist/surfaces/format.js.map +1 -0
  787. package/dist/surfaces/index.d.ts +15 -0
  788. package/dist/surfaces/index.d.ts.map +1 -0
  789. package/dist/surfaces/index.js +18 -0
  790. package/dist/surfaces/index.js.map +1 -0
  791. package/dist/surfaces/language.d.ts +53 -0
  792. package/dist/surfaces/language.d.ts.map +1 -0
  793. package/dist/surfaces/language.js +74 -0
  794. package/dist/surfaces/language.js.map +1 -0
  795. package/dist/surfaces/loaded.d.ts +42 -0
  796. package/dist/surfaces/loaded.d.ts.map +1 -0
  797. package/dist/surfaces/loaded.js +116 -0
  798. package/dist/surfaces/loaded.js.map +1 -0
  799. package/dist/surfaces/locale-choice.d.ts +25 -0
  800. package/dist/surfaces/locale-choice.d.ts.map +1 -0
  801. package/dist/surfaces/locale-choice.js +14 -0
  802. package/dist/surfaces/locale-choice.js.map +1 -0
  803. package/dist/surfaces/messages.d.ts +67 -0
  804. package/dist/surfaces/messages.d.ts.map +1 -0
  805. package/dist/surfaces/messages.js +112 -0
  806. package/dist/surfaces/messages.js.map +1 -0
  807. package/dist/surfaces/page-state.d.ts +14 -0
  808. package/dist/surfaces/page-state.d.ts.map +1 -0
  809. package/dist/surfaces/page-state.js +43 -0
  810. package/dist/surfaces/page-state.js.map +1 -0
  811. package/dist/surfaces/preference.d.ts +32 -0
  812. package/dist/surfaces/preference.d.ts.map +1 -0
  813. package/dist/surfaces/preference.js +72 -0
  814. package/dist/surfaces/preference.js.map +1 -0
  815. package/dist/surfaces/registered.d.ts +33 -0
  816. package/dist/surfaces/registered.d.ts.map +1 -0
  817. package/dist/surfaces/registered.js +51 -0
  818. package/dist/surfaces/registered.js.map +1 -0
  819. package/dist/surfaces/scripts.d.ts +84 -0
  820. package/dist/surfaces/scripts.d.ts.map +1 -0
  821. package/dist/surfaces/scripts.js +28 -0
  822. package/dist/surfaces/scripts.js.map +1 -0
  823. package/dist/surfaces/theme-choice.d.ts +31 -0
  824. package/dist/surfaces/theme-choice.d.ts.map +1 -0
  825. package/dist/surfaces/theme-choice.js +18 -0
  826. package/dist/surfaces/theme-choice.js.map +1 -0
  827. package/dist/surfaces/themes.d.ts +43 -0
  828. package/dist/surfaces/themes.d.ts.map +1 -0
  829. package/dist/surfaces/themes.js +110 -0
  830. package/dist/surfaces/themes.js.map +1 -0
  831. package/dist/surfaces/translations.d.ts +29 -0
  832. package/dist/surfaces/translations.d.ts.map +1 -0
  833. package/dist/surfaces/translations.js +57 -0
  834. package/dist/surfaces/translations.js.map +1 -0
  835. package/dist/sync/batch.d.ts +18 -0
  836. package/dist/sync/batch.d.ts.map +1 -0
  837. package/dist/sync/batch.js +125 -0
  838. package/dist/sync/batch.js.map +1 -0
  839. package/dist/sync/client.d.ts +166 -0
  840. package/dist/sync/client.d.ts.map +1 -0
  841. package/dist/sync/client.js +438 -0
  842. package/dist/sync/client.js.map +1 -0
  843. package/dist/sync/files.d.ts +46 -0
  844. package/dist/sync/files.d.ts.map +1 -0
  845. package/dist/sync/files.js +13 -0
  846. package/dist/sync/files.js.map +1 -0
  847. package/dist/sync/filesystem.d.ts +37 -0
  848. package/dist/sync/filesystem.d.ts.map +1 -0
  849. package/dist/sync/filesystem.js +185 -0
  850. package/dist/sync/filesystem.js.map +1 -0
  851. package/dist/sync/index.d.ts +8 -0
  852. package/dist/sync/index.d.ts.map +1 -0
  853. package/dist/sync/index.js +9 -0
  854. package/dist/sync/index.js.map +1 -0
  855. package/dist/sync/lines.d.ts +18 -0
  856. package/dist/sync/lines.d.ts.map +1 -0
  857. package/dist/sync/lines.js +46 -0
  858. package/dist/sync/lines.js.map +1 -0
  859. package/dist/sync/remote.d.ts +130 -0
  860. package/dist/sync/remote.d.ts.map +1 -0
  861. package/dist/sync/remote.js +46 -0
  862. package/dist/sync/remote.js.map +1 -0
  863. package/dist/sync/state.d.ts +17 -0
  864. package/dist/sync/state.d.ts.map +1 -0
  865. package/dist/sync/state.js +40 -0
  866. package/dist/sync/state.js.map +1 -0
  867. package/dist/telemetry-ingest/batch.d.ts +70 -0
  868. package/dist/telemetry-ingest/batch.d.ts.map +1 -0
  869. package/dist/telemetry-ingest/batch.js +110 -0
  870. package/dist/telemetry-ingest/batch.js.map +1 -0
  871. package/dist/telemetry-ingest/facet.d.ts +21 -0
  872. package/dist/telemetry-ingest/facet.d.ts.map +1 -0
  873. package/dist/telemetry-ingest/facet.js +96 -0
  874. package/dist/telemetry-ingest/facet.js.map +1 -0
  875. package/dist/telemetry-ingest/index.d.ts +5 -0
  876. package/dist/telemetry-ingest/index.d.ts.map +1 -0
  877. package/dist/telemetry-ingest/index.js +8 -0
  878. package/dist/telemetry-ingest/index.js.map +1 -0
  879. package/dist/telemetry-ingest/recorder.d.ts +50 -0
  880. package/dist/telemetry-ingest/recorder.d.ts.map +1 -0
  881. package/dist/telemetry-ingest/recorder.js +298 -0
  882. package/dist/telemetry-ingest/recorder.js.map +1 -0
  883. package/dist/telemetry-ingest/sender.d.ts +14 -0
  884. package/dist/telemetry-ingest/sender.d.ts.map +1 -0
  885. package/dist/telemetry-ingest/sender.js +64 -0
  886. package/dist/telemetry-ingest/sender.js.map +1 -0
  887. package/dist/telemetry-sqlite/index.d.ts +13 -4
  888. package/dist/telemetry-sqlite/index.d.ts.map +1 -1
  889. package/dist/telemetry-sqlite/index.js +81 -241
  890. package/dist/telemetry-sqlite/index.js.map +1 -1
  891. package/dist/telemetry-sqlite/node.d.ts +13 -0
  892. package/dist/telemetry-sqlite/node.d.ts.map +1 -0
  893. package/dist/telemetry-sqlite/node.js +27 -0
  894. package/dist/telemetry-sqlite/node.js.map +1 -0
  895. package/dist/telemetry-sqlite/schema.d.ts +9 -0
  896. package/dist/telemetry-sqlite/schema.d.ts.map +1 -0
  897. package/dist/telemetry-sqlite/schema.js +61 -0
  898. package/dist/telemetry-sqlite/schema.js.map +1 -0
  899. package/dist/telemetry-sqlite/store.d.ts +3 -0
  900. package/dist/telemetry-sqlite/store.d.ts.map +1 -1
  901. package/dist/telemetry-sqlite/store.js +24 -13
  902. package/dist/telemetry-sqlite/store.js.map +1 -1
  903. package/dist/telemetry.d.ts +937 -0
  904. package/dist/telemetry.d.ts.map +1 -0
  905. package/dist/telemetry.js +470 -0
  906. package/dist/telemetry.js.map +1 -0
  907. package/dist/tui/bridge.d.ts +112 -0
  908. package/dist/tui/bridge.d.ts.map +1 -0
  909. package/dist/tui/bridge.js +9 -0
  910. package/dist/tui/bridge.js.map +1 -0
  911. package/dist/tui/channel.d.ts +44 -0
  912. package/dist/tui/channel.d.ts.map +1 -0
  913. package/dist/tui/channel.js +150 -0
  914. package/dist/tui/channel.js.map +1 -0
  915. package/dist/tui/frames.d.ts +5 -0
  916. package/dist/tui/frames.d.ts.map +1 -0
  917. package/dist/tui/frames.js +52 -0
  918. package/dist/tui/frames.js.map +1 -0
  919. package/dist/tui/index.d.ts +7 -0
  920. package/dist/tui/index.d.ts.map +1 -0
  921. package/dist/tui/index.js +8 -0
  922. package/dist/tui/index.js.map +1 -0
  923. package/dist/tui/runtime.d.ts +46 -0
  924. package/dist/tui/runtime.d.ts.map +1 -0
  925. package/dist/tui/runtime.js +101 -0
  926. package/dist/tui/runtime.js.map +1 -0
  927. package/dist/tui/scope.d.ts +46 -0
  928. package/dist/tui/scope.d.ts.map +1 -0
  929. package/dist/tui/scope.js +141 -0
  930. package/dist/tui/scope.js.map +1 -0
  931. package/dist/tui/terminal.d.ts +15 -0
  932. package/dist/tui/terminal.d.ts.map +1 -0
  933. package/dist/tui/terminal.js +37 -0
  934. package/dist/tui/terminal.js.map +1 -0
  935. package/dist/tui/theme.d.ts +17 -0
  936. package/dist/tui/theme.d.ts.map +1 -0
  937. package/dist/tui/theme.js +38 -0
  938. package/dist/tui/theme.js.map +1 -0
  939. package/dist/web/environment.d.ts +4 -0
  940. package/dist/web/environment.d.ts.map +1 -0
  941. package/dist/web/environment.js +37 -0
  942. package/dist/web/environment.js.map +1 -0
  943. package/dist/web/index.d.ts +5 -0
  944. package/dist/web/index.d.ts.map +1 -0
  945. package/dist/web/index.js +7 -0
  946. package/dist/web/index.js.map +1 -0
  947. package/dist/web/language.d.ts +7 -0
  948. package/dist/web/language.d.ts.map +1 -0
  949. package/dist/web/language.js +21 -0
  950. package/dist/web/language.js.map +1 -0
  951. package/dist/web/page.d.ts +29 -0
  952. package/dist/web/page.d.ts.map +1 -0
  953. package/dist/web/page.js +92 -0
  954. package/dist/web/page.js.map +1 -0
  955. package/dist/web/scripts.d.ts +23 -0
  956. package/dist/web/scripts.d.ts.map +1 -0
  957. package/dist/web/scripts.js +50 -0
  958. package/dist/web/scripts.js.map +1 -0
  959. package/dist/web/styles.d.ts +17 -0
  960. package/dist/web/styles.d.ts.map +1 -0
  961. package/dist/web/styles.js +218 -0
  962. package/dist/web/styles.js.map +1 -0
  963. package/dist/web/themes.d.ts +6 -0
  964. package/dist/web/themes.d.ts.map +1 -0
  965. package/dist/web/themes.js +31 -0
  966. package/dist/web/themes.js.map +1 -0
  967. package/docs/benchmarks.md +1036 -0
  968. package/docs/decisions.md +3436 -0
  969. package/docs/dependencies/book.md +1671 -0
  970. package/docs/dependencies/index.html +2641 -0
  971. package/docs/design.md +3065 -0
  972. package/docs/durable-observers/book.md +432 -0
  973. package/docs/durable-observers/index.html +517 -0
  974. package/docs/guide-plugins-hosts/book.md +957 -0
  975. package/docs/guide-plugins-hosts/index.html +952 -0
  976. package/docs/http-workers/book.md +378 -0
  977. package/docs/http-workers/index.html +515 -0
  978. package/docs/i18n/book.md +217 -0
  979. package/docs/i18n/index.html +344 -0
  980. package/docs/layer-1.md +311 -0
  981. package/docs/layer-2.md +216 -0
  982. package/docs/p3-features/README.md +6 -0
  983. package/docs/p3-features/book.md +478 -0
  984. package/docs/plugin-authoring.md +276 -0
  985. package/docs/plugin-model/book.md +186 -0
  986. package/docs/plugin-model/index.html +310 -0
  987. package/docs/plugin-primer/book.md +273 -0
  988. package/docs/plugin-primer/index.html +430 -0
  989. package/docs/slice-1.md +236 -0
  990. package/docs/slice-10.md +288 -0
  991. package/docs/slice-11.md +114 -0
  992. package/docs/slice-12.md +132 -0
  993. package/docs/slice-13.md +121 -0
  994. package/docs/slice-2.md +174 -0
  995. package/docs/slice-3a.md +296 -0
  996. package/docs/slice-3b.md +197 -0
  997. package/docs/slice-4a.md +418 -0
  998. package/docs/slice-4b.md +208 -0
  999. package/docs/slice-6a.md +676 -0
  1000. package/docs/slice-6b.md +332 -0
  1001. package/docs/slice-7b/book.md +608 -0
  1002. package/docs/slice-7b/index.html +842 -0
  1003. package/docs/slice-7b.md +255 -0
  1004. package/docs/slice-7c.md +165 -0
  1005. package/docs/slice-9.md +110 -0
  1006. package/docs/slices.md +241 -0
  1007. package/docs/store/book.md +670 -0
  1008. package/docs/store/index.html +861 -0
  1009. package/docs/store/walkthrough.md +193 -0
  1010. package/docs/theming/book.md +223 -0
  1011. package/docs/theming/index.html +371 -0
  1012. package/docs/tutorial/book.md +2169 -0
  1013. package/docs/tutorial/index.html +2112 -0
  1014. package/docs/tutorial/screens/click-after.png +0 -0
  1015. package/docs/tutorial/screens/click-before.png +0 -0
  1016. package/docs/tutorial/screens/edited.png +0 -0
  1017. package/docs/tutorial/screens/french.png +0 -0
  1018. package/docs/tutorial/screens/harbor.png +0 -0
  1019. package/docs/tutorial/screens/page.png +0 -0
  1020. package/docs/tutorial/screens/traces-ada.png +0 -0
  1021. package/docs/tutorial/screens/traces.png +0 -0
  1022. package/package.json +99 -21
  1023. package/dist/cell.d.ts +0 -122
  1024. package/dist/cell.d.ts.map +0 -1
  1025. package/dist/cell.js +0 -356
  1026. package/dist/cell.js.map +0 -1
  1027. package/dist/cluster.d.ts +0 -27
  1028. package/dist/cluster.d.ts.map +0 -1
  1029. package/dist/cluster.js +0 -230
  1030. package/dist/cluster.js.map +0 -1
  1031. package/dist/connection.d.ts +0 -270
  1032. package/dist/connection.d.ts.map +0 -1
  1033. package/dist/connection.js +0 -1216
  1034. package/dist/connection.js.map +0 -1
  1035. package/dist/contract.d.ts +0 -207
  1036. package/dist/contract.d.ts.map +0 -1
  1037. package/dist/contract.js +0 -241
  1038. package/dist/contract.js.map +0 -1
  1039. package/dist/declare.d.ts +0 -33
  1040. package/dist/declare.d.ts.map +0 -1
  1041. package/dist/declare.js +0 -2
  1042. package/dist/declare.js.map +0 -1
  1043. package/dist/errors.d.ts +0 -28
  1044. package/dist/errors.d.ts.map +0 -1
  1045. package/dist/errors.js +0 -59
  1046. package/dist/errors.js.map +0 -1
  1047. package/dist/host.d.ts +0 -348
  1048. package/dist/host.d.ts.map +0 -1
  1049. package/dist/host.js +0 -1002
  1050. package/dist/host.js.map +0 -1
  1051. package/dist/link.d.ts +0 -107
  1052. package/dist/link.d.ts.map +0 -1
  1053. package/dist/link.js +0 -355
  1054. package/dist/link.js.map +0 -1
  1055. package/dist/loader.d.ts +0 -4
  1056. package/dist/loader.d.ts.map +0 -1
  1057. package/dist/loader.js +0 -73
  1058. package/dist/loader.js.map +0 -1
  1059. package/dist/manager.d.ts +0 -115
  1060. package/dist/manager.d.ts.map +0 -1
  1061. package/dist/manager.js +0 -345
  1062. package/dist/manager.js.map +0 -1
  1063. package/dist/next/contracts/accepts.d.ts +0 -81
  1064. package/dist/next/contracts/accepts.d.ts.map +0 -1
  1065. package/dist/next/contracts/accepts.js.map +0 -1
  1066. package/dist/next/contracts/contract.d.ts +0 -121
  1067. package/dist/next/contracts/contract.d.ts.map +0 -1
  1068. package/dist/next/contracts/contract.js.map +0 -1
  1069. package/dist/next/contracts/declare.d.ts.map +0 -1
  1070. package/dist/next/contracts/declare.js.map +0 -1
  1071. package/dist/next/contracts/evolve.d.ts.map +0 -1
  1072. package/dist/next/contracts/evolve.js.map +0 -1
  1073. package/dist/next/contracts/fingerprint.d.ts +0 -16
  1074. package/dist/next/contracts/fingerprint.d.ts.map +0 -1
  1075. package/dist/next/contracts/fingerprint.js.map +0 -1
  1076. package/dist/next/contracts/history.d.ts.map +0 -1
  1077. package/dist/next/contracts/history.js.map +0 -1
  1078. package/dist/next/contracts/host-kind.d.ts.map +0 -1
  1079. package/dist/next/contracts/host-kind.js.map +0 -1
  1080. package/dist/next/contracts/index.d.ts.map +0 -1
  1081. package/dist/next/contracts/index.js.map +0 -1
  1082. package/dist/next/contracts/internal.d.ts.map +0 -1
  1083. package/dist/next/contracts/internal.js.map +0 -1
  1084. package/dist/next/contracts/names.d.ts.map +0 -1
  1085. package/dist/next/contracts/names.js.map +0 -1
  1086. package/dist/next/contracts/params.d.ts +0 -28
  1087. package/dist/next/contracts/params.d.ts.map +0 -1
  1088. package/dist/next/contracts/params.js.map +0 -1
  1089. package/dist/next/contracts/schema.d.ts.map +0 -1
  1090. package/dist/next/contracts/schema.js.map +0 -1
  1091. package/dist/next/contracts/snapshot.d.ts +0 -16
  1092. package/dist/next/contracts/snapshot.d.ts.map +0 -1
  1093. package/dist/next/contracts/snapshot.js +0 -167
  1094. package/dist/next/contracts/snapshot.js.map +0 -1
  1095. package/dist/next/data/args.d.ts +0 -50
  1096. package/dist/next/data/args.d.ts.map +0 -1
  1097. package/dist/next/data/args.js.map +0 -1
  1098. package/dist/next/data/errors.d.ts +0 -73
  1099. package/dist/next/data/errors.d.ts.map +0 -1
  1100. package/dist/next/data/errors.js +0 -107
  1101. package/dist/next/data/errors.js.map +0 -1
  1102. package/dist/next/data/failure.d.ts.map +0 -1
  1103. package/dist/next/data/failure.js +0 -72
  1104. package/dist/next/data/failure.js.map +0 -1
  1105. package/dist/next/data/index.d.ts +0 -4
  1106. package/dist/next/data/index.d.ts.map +0 -1
  1107. package/dist/next/data/index.js +0 -4
  1108. package/dist/next/data/index.js.map +0 -1
  1109. package/dist/next/data/internal.d.ts +0 -7
  1110. package/dist/next/data/internal.d.ts.map +0 -1
  1111. package/dist/next/data/internal.js +0 -8
  1112. package/dist/next/data/internal.js.map +0 -1
  1113. package/dist/next/data/params.d.ts +0 -20
  1114. package/dist/next/data/params.d.ts.map +0 -1
  1115. package/dist/next/data/params.js.map +0 -1
  1116. package/dist/next/data/principal.d.ts +0 -17
  1117. package/dist/next/data/principal.d.ts.map +0 -1
  1118. package/dist/next/data/principal.js +0 -41
  1119. package/dist/next/data/principal.js.map +0 -1
  1120. package/dist/next/data/validator.d.ts +0 -12
  1121. package/dist/next/data/validator.d.ts.map +0 -1
  1122. package/dist/next/data/validator.js +0 -34
  1123. package/dist/next/data/validator.js.map +0 -1
  1124. package/dist/next/documents/address-source.d.ts +0 -20
  1125. package/dist/next/documents/address-source.d.ts.map +0 -1
  1126. package/dist/next/documents/address-source.js.map +0 -1
  1127. package/dist/next/documents/definition.d.ts +0 -84
  1128. package/dist/next/documents/definition.d.ts.map +0 -1
  1129. package/dist/next/documents/definition.js +0 -73
  1130. package/dist/next/documents/definition.js.map +0 -1
  1131. package/dist/next/documents/documents.d.ts +0 -106
  1132. package/dist/next/documents/documents.d.ts.map +0 -1
  1133. package/dist/next/documents/documents.js +0 -224
  1134. package/dist/next/documents/documents.js.map +0 -1
  1135. package/dist/next/documents/fence.d.ts.map +0 -1
  1136. package/dist/next/documents/fence.js.map +0 -1
  1137. package/dist/next/documents/handles.d.ts +0 -76
  1138. package/dist/next/documents/handles.d.ts.map +0 -1
  1139. package/dist/next/documents/handles.js.map +0 -1
  1140. package/dist/next/documents/index.d.ts.map +0 -1
  1141. package/dist/next/documents/index.js.map +0 -1
  1142. package/dist/next/documents/internal.d.ts +0 -9
  1143. package/dist/next/documents/internal.d.ts.map +0 -1
  1144. package/dist/next/documents/internal.js.map +0 -1
  1145. package/dist/next/documents/keyed-slot.d.ts +0 -103
  1146. package/dist/next/documents/keyed-slot.d.ts.map +0 -1
  1147. package/dist/next/documents/keyed-slot.js +0 -395
  1148. package/dist/next/documents/keyed-slot.js.map +0 -1
  1149. package/dist/next/documents/line.d.ts.map +0 -1
  1150. package/dist/next/documents/line.js.map +0 -1
  1151. package/dist/next/documents/persistence.d.ts +0 -104
  1152. package/dist/next/documents/persistence.d.ts.map +0 -1
  1153. package/dist/next/documents/persistence.js +0 -128
  1154. package/dist/next/documents/persistence.js.map +0 -1
  1155. package/dist/next/documents/residency.d.ts +0 -31
  1156. package/dist/next/documents/residency.d.ts.map +0 -1
  1157. package/dist/next/documents/residency.js.map +0 -1
  1158. package/dist/next/documents/slot.d.ts +0 -109
  1159. package/dist/next/documents/slot.d.ts.map +0 -1
  1160. package/dist/next/documents/slot.js +0 -181
  1161. package/dist/next/documents/slot.js.map +0 -1
  1162. package/dist/next/documents/transaction.d.ts +0 -133
  1163. package/dist/next/documents/transaction.d.ts.map +0 -1
  1164. package/dist/next/documents/transaction.js +0 -409
  1165. package/dist/next/documents/transaction.js.map +0 -1
  1166. package/dist/next/host/activity.d.ts +0 -31
  1167. package/dist/next/host/activity.d.ts.map +0 -1
  1168. package/dist/next/host/activity.js +0 -40
  1169. package/dist/next/host/activity.js.map +0 -1
  1170. package/dist/next/host/adapted.d.ts +0 -49
  1171. package/dist/next/host/adapted.d.ts.map +0 -1
  1172. package/dist/next/host/adapted.js.map +0 -1
  1173. package/dist/next/host/attempt.d.ts +0 -278
  1174. package/dist/next/host/attempt.d.ts.map +0 -1
  1175. package/dist/next/host/attempt.js +0 -1072
  1176. package/dist/next/host/attempt.js.map +0 -1
  1177. package/dist/next/host/backoff.d.ts.map +0 -1
  1178. package/dist/next/host/backoff.js.map +0 -1
  1179. package/dist/next/host/ctx.d.ts +0 -47
  1180. package/dist/next/host/ctx.d.ts.map +0 -1
  1181. package/dist/next/host/ctx.js +0 -108
  1182. package/dist/next/host/ctx.js.map +0 -1
  1183. package/dist/next/host/deadline.d.ts.map +0 -1
  1184. package/dist/next/host/deadline.js.map +0 -1
  1185. package/dist/next/host/dependencies.d.ts.map +0 -1
  1186. package/dist/next/host/dependencies.js.map +0 -1
  1187. package/dist/next/host/destination.d.ts +0 -48
  1188. package/dist/next/host/destination.d.ts.map +0 -1
  1189. package/dist/next/host/destination.js.map +0 -1
  1190. package/dist/next/host/facet.d.ts +0 -79
  1191. package/dist/next/host/facet.d.ts.map +0 -1
  1192. package/dist/next/host/facet.js.map +0 -1
  1193. package/dist/next/host/follow.d.ts +0 -52
  1194. package/dist/next/host/follow.d.ts.map +0 -1
  1195. package/dist/next/host/follow.js.map +0 -1
  1196. package/dist/next/host/host.d.ts +0 -495
  1197. package/dist/next/host/host.d.ts.map +0 -1
  1198. package/dist/next/host/host.js +0 -1075
  1199. package/dist/next/host/host.js.map +0 -1
  1200. package/dist/next/host/index.d.ts +0 -17
  1201. package/dist/next/host/index.d.ts.map +0 -1
  1202. package/dist/next/host/index.js.map +0 -1
  1203. package/dist/next/host/internal.d.ts +0 -10
  1204. package/dist/next/host/internal.d.ts.map +0 -1
  1205. package/dist/next/host/internal.js +0 -8
  1206. package/dist/next/host/internal.js.map +0 -1
  1207. package/dist/next/host/members.d.ts +0 -50
  1208. package/dist/next/host/members.d.ts.map +0 -1
  1209. package/dist/next/host/members.js.map +0 -1
  1210. package/dist/next/host/native.d.ts +0 -55
  1211. package/dist/next/host/native.d.ts.map +0 -1
  1212. package/dist/next/host/native.js +0 -92
  1213. package/dist/next/host/native.js.map +0 -1
  1214. package/dist/next/host/object.d.ts +0 -290
  1215. package/dist/next/host/object.d.ts.map +0 -1
  1216. package/dist/next/host/object.js +0 -1127
  1217. package/dist/next/host/object.js.map +0 -1
  1218. package/dist/next/host/parked.d.ts +0 -23
  1219. package/dist/next/host/parked.d.ts.map +0 -1
  1220. package/dist/next/host/parked.js.map +0 -1
  1221. package/dist/next/host/presence.d.ts +0 -34
  1222. package/dist/next/host/presence.d.ts.map +0 -1
  1223. package/dist/next/host/presence.js.map +0 -1
  1224. package/dist/next/host/ref-state.d.ts +0 -53
  1225. package/dist/next/host/ref-state.d.ts.map +0 -1
  1226. package/dist/next/host/ref-state.js +0 -83
  1227. package/dist/next/host/ref-state.js.map +0 -1
  1228. package/dist/next/host/reference-keys.d.ts +0 -36
  1229. package/dist/next/host/reference-keys.d.ts.map +0 -1
  1230. package/dist/next/host/reference-keys.js +0 -168
  1231. package/dist/next/host/reference-keys.js.map +0 -1
  1232. package/dist/next/host/reference-source.d.ts +0 -65
  1233. package/dist/next/host/reference-source.d.ts.map +0 -1
  1234. package/dist/next/host/reference-source.js +0 -285
  1235. package/dist/next/host/reference-source.js.map +0 -1
  1236. package/dist/next/host/reference.d.ts +0 -308
  1237. package/dist/next/host/reference.d.ts.map +0 -1
  1238. package/dist/next/host/reference.js +0 -775
  1239. package/dist/next/host/reference.js.map +0 -1
  1240. package/dist/next/host/retry-on.d.ts.map +0 -1
  1241. package/dist/next/host/retry-on.js.map +0 -1
  1242. package/dist/next/host/revocation.d.ts +0 -16
  1243. package/dist/next/host/revocation.d.ts.map +0 -1
  1244. package/dist/next/host/revocation.js.map +0 -1
  1245. package/dist/next/host/root.d.ts +0 -27
  1246. package/dist/next/host/root.d.ts.map +0 -1
  1247. package/dist/next/host/root.js +0 -68
  1248. package/dist/next/host/root.js.map +0 -1
  1249. package/dist/next/host/route.d.ts +0 -64
  1250. package/dist/next/host/route.d.ts.map +0 -1
  1251. package/dist/next/host/route.js +0 -190
  1252. package/dist/next/host/route.js.map +0 -1
  1253. package/dist/next/host/routines.d.ts +0 -76
  1254. package/dist/next/host/routines.d.ts.map +0 -1
  1255. package/dist/next/host/routines.js +0 -350
  1256. package/dist/next/host/routines.js.map +0 -1
  1257. package/dist/next/host/sleep.d.ts +0 -9
  1258. package/dist/next/host/sleep.d.ts.map +0 -1
  1259. package/dist/next/host/sleep.js.map +0 -1
  1260. package/dist/next/host/staging.d.ts +0 -94
  1261. package/dist/next/host/staging.d.ts.map +0 -1
  1262. package/dist/next/host/staging.js +0 -302
  1263. package/dist/next/host/staging.js.map +0 -1
  1264. package/dist/next/host/unbound.d.ts +0 -30
  1265. package/dist/next/host/unbound.d.ts.map +0 -1
  1266. package/dist/next/host/unbound.js +0 -67
  1267. package/dist/next/host/unbound.js.map +0 -1
  1268. package/dist/next/host/uuid.d.ts.map +0 -1
  1269. package/dist/next/host/uuid.js.map +0 -1
  1270. package/dist/next/index.d.ts +0 -28
  1271. package/dist/next/index.d.ts.map +0 -1
  1272. package/dist/next/index.js +0 -18
  1273. package/dist/next/index.js.map +0 -1
  1274. package/dist/next/jobs/definition.d.ts.map +0 -1
  1275. package/dist/next/jobs/definition.js.map +0 -1
  1276. package/dist/next/jobs/index.d.ts.map +0 -1
  1277. package/dist/next/jobs/index.js.map +0 -1
  1278. package/dist/next/jobs/internal.d.ts.map +0 -1
  1279. package/dist/next/jobs/internal.js.map +0 -1
  1280. package/dist/next/jobs/job.d.ts +0 -152
  1281. package/dist/next/jobs/job.d.ts.map +0 -1
  1282. package/dist/next/jobs/job.js +0 -320
  1283. package/dist/next/jobs/job.js.map +0 -1
  1284. package/dist/next/jobs/persisted.d.ts +0 -38
  1285. package/dist/next/jobs/persisted.d.ts.map +0 -1
  1286. package/dist/next/jobs/persisted.js.map +0 -1
  1287. package/dist/next/jobs/records.d.ts +0 -231
  1288. package/dist/next/jobs/records.d.ts.map +0 -1
  1289. package/dist/next/jobs/records.js +0 -869
  1290. package/dist/next/jobs/records.js.map +0 -1
  1291. package/dist/next/jobs/run-states.d.ts +0 -69
  1292. package/dist/next/jobs/run-states.d.ts.map +0 -1
  1293. package/dist/next/jobs/run-states.js +0 -228
  1294. package/dist/next/jobs/run-states.js.map +0 -1
  1295. package/dist/next/jobs/run.d.ts +0 -113
  1296. package/dist/next/jobs/run.d.ts.map +0 -1
  1297. package/dist/next/jobs/run.js +0 -200
  1298. package/dist/next/jobs/run.js.map +0 -1
  1299. package/dist/next/jobs/running.d.ts +0 -44
  1300. package/dist/next/jobs/running.d.ts.map +0 -1
  1301. package/dist/next/jobs/running.js.map +0 -1
  1302. package/dist/next/jobs/stored.d.ts +0 -63
  1303. package/dist/next/jobs/stored.d.ts.map +0 -1
  1304. package/dist/next/jobs/stored.js.map +0 -1
  1305. package/dist/next/link/binary.d.ts.map +0 -1
  1306. package/dist/next/link/binary.js +0 -534
  1307. package/dist/next/link/binary.js.map +0 -1
  1308. package/dist/next/link/channel.d.ts +0 -63
  1309. package/dist/next/link/channel.d.ts.map +0 -1
  1310. package/dist/next/link/channel.js +0 -202
  1311. package/dist/next/link/channel.js.map +0 -1
  1312. package/dist/next/link/errors.d.ts.map +0 -1
  1313. package/dist/next/link/errors.js.map +0 -1
  1314. package/dist/next/link/index.d.ts.map +0 -1
  1315. package/dist/next/link/index.js.map +0 -1
  1316. package/dist/next/link/internal.d.ts.map +0 -1
  1317. package/dist/next/link/internal.js.map +0 -1
  1318. package/dist/next/link/ipc.d.ts.map +0 -1
  1319. package/dist/next/link/ipc.js.map +0 -1
  1320. package/dist/next/link/link.d.ts.map +0 -1
  1321. package/dist/next/link/link.js.map +0 -1
  1322. package/dist/next/link/message.d.ts +0 -249
  1323. package/dist/next/link/message.d.ts.map +0 -1
  1324. package/dist/next/link/message.js +0 -123
  1325. package/dist/next/link/message.js.map +0 -1
  1326. package/dist/next/link/part.d.ts +0 -80
  1327. package/dist/next/link/part.d.ts.map +0 -1
  1328. package/dist/next/link/part.js +0 -164
  1329. package/dist/next/link/part.js.map +0 -1
  1330. package/dist/next/link/text.d.ts.map +0 -1
  1331. package/dist/next/link/text.js +0 -335
  1332. package/dist/next/link/text.js.map +0 -1
  1333. package/dist/next/link/values.d.ts.map +0 -1
  1334. package/dist/next/link/values.js +0 -117
  1335. package/dist/next/link/values.js.map +0 -1
  1336. package/dist/next/link/websocket.d.ts.map +0 -1
  1337. package/dist/next/link/websocket.js.map +0 -1
  1338. package/dist/next/registries/contribution.d.ts.map +0 -1
  1339. package/dist/next/registries/contribution.js.map +0 -1
  1340. package/dist/next/registries/entries.d.ts.map +0 -1
  1341. package/dist/next/registries/entries.js.map +0 -1
  1342. package/dist/next/registries/index.d.ts.map +0 -1
  1343. package/dist/next/registries/index.js.map +0 -1
  1344. package/dist/next/registries/internal.d.ts.map +0 -1
  1345. package/dist/next/registries/internal.js.map +0 -1
  1346. package/dist/next/registries/record.d.ts +0 -94
  1347. package/dist/next/registries/record.d.ts.map +0 -1
  1348. package/dist/next/registries/record.js +0 -253
  1349. package/dist/next/registries/record.js.map +0 -1
  1350. package/dist/next/registries/registry.d.ts +0 -74
  1351. package/dist/next/registries/registry.d.ts.map +0 -1
  1352. package/dist/next/registries/registry.js.map +0 -1
  1353. package/dist/next/registries/value.d.ts.map +0 -1
  1354. package/dist/next/registries/value.js +0 -199
  1355. package/dist/next/registries/value.js.map +0 -1
  1356. package/dist/next/remote/calls.d.ts.map +0 -1
  1357. package/dist/next/remote/calls.js.map +0 -1
  1358. package/dist/next/remote/consumer.d.ts +0 -42
  1359. package/dist/next/remote/consumer.d.ts.map +0 -1
  1360. package/dist/next/remote/consumer.js +0 -343
  1361. package/dist/next/remote/consumer.js.map +0 -1
  1362. package/dist/next/remote/hold.d.ts +0 -130
  1363. package/dist/next/remote/hold.d.ts.map +0 -1
  1364. package/dist/next/remote/hold.js +0 -537
  1365. package/dist/next/remote/hold.js.map +0 -1
  1366. package/dist/next/remote/host-link.d.ts +0 -77
  1367. package/dist/next/remote/host-link.d.ts.map +0 -1
  1368. package/dist/next/remote/host-link.js +0 -182
  1369. package/dist/next/remote/host-link.js.map +0 -1
  1370. package/dist/next/remote/internal.d.ts.map +0 -1
  1371. package/dist/next/remote/internal.js.map +0 -1
  1372. package/dist/next/remote/path.d.ts.map +0 -1
  1373. package/dist/next/remote/path.js.map +0 -1
  1374. package/dist/next/remote/provider.d.ts +0 -76
  1375. package/dist/next/remote/provider.d.ts.map +0 -1
  1376. package/dist/next/remote/provider.js +0 -506
  1377. package/dist/next/remote/provider.js.map +0 -1
  1378. package/dist/next/remote/relay.d.ts +0 -58
  1379. package/dist/next/remote/relay.d.ts.map +0 -1
  1380. package/dist/next/remote/relay.js +0 -117
  1381. package/dist/next/remote/relay.js.map +0 -1
  1382. package/dist/next/remote/remote-object.d.ts +0 -133
  1383. package/dist/next/remote/remote-object.d.ts.map +0 -1
  1384. package/dist/next/remote/remote-object.js +0 -411
  1385. package/dist/next/remote/remote-object.js.map +0 -1
  1386. package/dist/next/remote/replica.d.ts +0 -59
  1387. package/dist/next/remote/replica.d.ts.map +0 -1
  1388. package/dist/next/remote/replica.js +0 -125
  1389. package/dist/next/remote/replica.js.map +0 -1
  1390. package/dist/next/state/batch.d.ts +0 -64
  1391. package/dist/next/state/batch.d.ts.map +0 -1
  1392. package/dist/next/state/batch.js +0 -163
  1393. package/dist/next/state/batch.js.map +0 -1
  1394. package/dist/next/state/derive.d.ts +0 -52
  1395. package/dist/next/state/derive.d.ts.map +0 -1
  1396. package/dist/next/state/derive.js +0 -182
  1397. package/dist/next/state/derive.js.map +0 -1
  1398. package/dist/next/state/index.d.ts +0 -6
  1399. package/dist/next/state/index.d.ts.map +0 -1
  1400. package/dist/next/state/index.js.map +0 -1
  1401. package/dist/next/state/internal.d.ts.map +0 -1
  1402. package/dist/next/state/internal.js.map +0 -1
  1403. package/dist/next/state/native-source.d.ts +0 -106
  1404. package/dist/next/state/native-source.d.ts.map +0 -1
  1405. package/dist/next/state/native-source.js +0 -240
  1406. package/dist/next/state/native-source.js.map +0 -1
  1407. package/dist/next/state/watchable.d.ts +0 -114
  1408. package/dist/next/state/watchable.d.ts.map +0 -1
  1409. package/dist/next/state/watchable.js +0 -156
  1410. package/dist/next/state/watchable.js.map +0 -1
  1411. package/dist/next/state/writable.d.ts +0 -32
  1412. package/dist/next/state/writable.d.ts.map +0 -1
  1413. package/dist/next/state/writable.js.map +0 -1
  1414. package/dist/next/store/adapter.d.ts +0 -67
  1415. package/dist/next/store/adapter.d.ts.map +0 -1
  1416. package/dist/next/store/adapter.js.map +0 -1
  1417. package/dist/next/store/allocator.d.ts.map +0 -1
  1418. package/dist/next/store/allocator.js.map +0 -1
  1419. package/dist/next/store/applier.d.ts.map +0 -1
  1420. package/dist/next/store/applier.js.map +0 -1
  1421. package/dist/next/store/apply-batch.d.ts +0 -12
  1422. package/dist/next/store/apply-batch.d.ts.map +0 -1
  1423. package/dist/next/store/apply-batch.js.map +0 -1
  1424. package/dist/next/store/archive.d.ts +0 -32
  1425. package/dist/next/store/archive.d.ts.map +0 -1
  1426. package/dist/next/store/archive.js +0 -129
  1427. package/dist/next/store/archive.js.map +0 -1
  1428. package/dist/next/store/backend.d.ts +0 -10
  1429. package/dist/next/store/backend.d.ts.map +0 -1
  1430. package/dist/next/store/backend.js.map +0 -1
  1431. package/dist/next/store/catalog.d.ts +0 -24
  1432. package/dist/next/store/catalog.d.ts.map +0 -1
  1433. package/dist/next/store/catalog.js.map +0 -1
  1434. package/dist/next/store/claims.d.ts.map +0 -1
  1435. package/dist/next/store/claims.js.map +0 -1
  1436. package/dist/next/store/columns.d.ts.map +0 -1
  1437. package/dist/next/store/columns.js.map +0 -1
  1438. package/dist/next/store/engine.d.ts +0 -176
  1439. package/dist/next/store/engine.d.ts.map +0 -1
  1440. package/dist/next/store/engine.js +0 -283
  1441. package/dist/next/store/engine.js.map +0 -1
  1442. package/dist/next/store/evaluate.d.ts +0 -17
  1443. package/dist/next/store/evaluate.d.ts.map +0 -1
  1444. package/dist/next/store/evaluate.js.map +0 -1
  1445. package/dist/next/store/export.d.ts +0 -17
  1446. package/dist/next/store/export.d.ts.map +0 -1
  1447. package/dist/next/store/export.js +0 -200
  1448. package/dist/next/store/export.js.map +0 -1
  1449. package/dist/next/store/expression.d.ts +0 -150
  1450. package/dist/next/store/expression.d.ts.map +0 -1
  1451. package/dist/next/store/expression.js.map +0 -1
  1452. package/dist/next/store/import.d.ts +0 -10
  1453. package/dist/next/store/import.d.ts.map +0 -1
  1454. package/dist/next/store/import.js +0 -276
  1455. package/dist/next/store/import.js.map +0 -1
  1456. package/dist/next/store/index.d.ts.map +0 -1
  1457. package/dist/next/store/index.js.map +0 -1
  1458. package/dist/next/store/json-column.d.ts +0 -33
  1459. package/dist/next/store/json-column.d.ts.map +0 -1
  1460. package/dist/next/store/json-column.js +0 -61
  1461. package/dist/next/store/json-column.js.map +0 -1
  1462. package/dist/next/store/jsonl.d.ts.map +0 -1
  1463. package/dist/next/store/jsonl.js.map +0 -1
  1464. package/dist/next/store/outbox.d.ts +0 -26
  1465. package/dist/next/store/outbox.d.ts.map +0 -1
  1466. package/dist/next/store/outbox.js.map +0 -1
  1467. package/dist/next/store/query.d.ts +0 -39
  1468. package/dist/next/store/query.d.ts.map +0 -1
  1469. package/dist/next/store/query.js.map +0 -1
  1470. package/dist/next/store/refusal.d.ts.map +0 -1
  1471. package/dist/next/store/refusal.js.map +0 -1
  1472. package/dist/next/store/rows.d.ts +0 -80
  1473. package/dist/next/store/rows.d.ts.map +0 -1
  1474. package/dist/next/store/rows.js.map +0 -1
  1475. package/dist/next/store/schema.d.ts +0 -25
  1476. package/dist/next/store/schema.d.ts.map +0 -1
  1477. package/dist/next/store/schema.js +0 -115
  1478. package/dist/next/store/schema.js.map +0 -1
  1479. package/dist/next/store/sql.d.ts +0 -73
  1480. package/dist/next/store/sql.d.ts.map +0 -1
  1481. package/dist/next/store/sql.js.map +0 -1
  1482. package/dist/next/store/step.d.ts +0 -48
  1483. package/dist/next/store/step.d.ts.map +0 -1
  1484. package/dist/next/store/step.js +0 -50
  1485. package/dist/next/store/step.js.map +0 -1
  1486. package/dist/next/store/store.d.ts +0 -161
  1487. package/dist/next/store/store.d.ts.map +0 -1
  1488. package/dist/next/store/store.js +0 -627
  1489. package/dist/next/store/store.js.map +0 -1
  1490. package/dist/next/store/table-changes.d.ts +0 -29
  1491. package/dist/next/store/table-changes.d.ts.map +0 -1
  1492. package/dist/next/store/table-changes.js.map +0 -1
  1493. package/dist/next/store/table-evolve.d.ts.map +0 -1
  1494. package/dist/next/store/table-evolve.js.map +0 -1
  1495. package/dist/next/store/table-handle.d.ts +0 -67
  1496. package/dist/next/store/table-handle.d.ts.map +0 -1
  1497. package/dist/next/store/table-handle.js +0 -101
  1498. package/dist/next/store/table-handle.js.map +0 -1
  1499. package/dist/next/store/table-history.d.ts.map +0 -1
  1500. package/dist/next/store/table-history.js.map +0 -1
  1501. package/dist/next/store/table-migration.d.ts +0 -16
  1502. package/dist/next/store/table-migration.d.ts.map +0 -1
  1503. package/dist/next/store/table-migration.js +0 -202
  1504. package/dist/next/store/table-migration.js.map +0 -1
  1505. package/dist/next/store/table-writes.d.ts.map +0 -1
  1506. package/dist/next/store/table-writes.js +0 -165
  1507. package/dist/next/store/table-writes.js.map +0 -1
  1508. package/dist/next/store/table.d.ts +0 -80
  1509. package/dist/next/store/table.d.ts.map +0 -1
  1510. package/dist/next/store/table.js.map +0 -1
  1511. package/dist/next/store/text.d.ts.map +0 -1
  1512. package/dist/next/store/text.js.map +0 -1
  1513. package/dist/next/store/writes.d.ts.map +0 -1
  1514. package/dist/next/store/writes.js.map +0 -1
  1515. package/dist/next-node/compression.d.ts +0 -7
  1516. package/dist/next-node/compression.d.ts.map +0 -1
  1517. package/dist/next-node/compression.js +0 -24
  1518. package/dist/next-node/compression.js.map +0 -1
  1519. package/dist/next-node/http/admission.d.ts.map +0 -1
  1520. package/dist/next-node/http/admission.js.map +0 -1
  1521. package/dist/next-node/http/authenticate.d.ts +0 -21
  1522. package/dist/next-node/http/authenticate.d.ts.map +0 -1
  1523. package/dist/next-node/http/authenticate.js +0 -34
  1524. package/dist/next-node/http/authenticate.js.map +0 -1
  1525. package/dist/next-node/http/cookies.d.ts +0 -24
  1526. package/dist/next-node/http/cookies.d.ts.map +0 -1
  1527. package/dist/next-node/http/cookies.js +0 -62
  1528. package/dist/next-node/http/cookies.js.map +0 -1
  1529. package/dist/next-node/http/file.d.ts.map +0 -1
  1530. package/dist/next-node/http/file.js.map +0 -1
  1531. package/dist/next-node/http/headers.d.ts.map +0 -1
  1532. package/dist/next-node/http/headers.js +0 -129
  1533. package/dist/next-node/http/headers.js.map +0 -1
  1534. package/dist/next-node/http/http.d.ts +0 -100
  1535. package/dist/next-node/http/http.d.ts.map +0 -1
  1536. package/dist/next-node/http/http.js +0 -462
  1537. package/dist/next-node/http/http.js.map +0 -1
  1538. package/dist/next-node/http/incoming.d.ts.map +0 -1
  1539. package/dist/next-node/http/incoming.js.map +0 -1
  1540. package/dist/next-node/http/index.d.ts +0 -11
  1541. package/dist/next-node/http/index.d.ts.map +0 -1
  1542. package/dist/next-node/http/index.js +0 -12
  1543. package/dist/next-node/http/index.js.map +0 -1
  1544. package/dist/next-node/http/node.d.ts.map +0 -1
  1545. package/dist/next-node/http/node.js.map +0 -1
  1546. package/dist/next-node/http/request.d.ts +0 -54
  1547. package/dist/next-node/http/request.d.ts.map +0 -1
  1548. package/dist/next-node/http/request.js +0 -116
  1549. package/dist/next-node/http/request.js.map +0 -1
  1550. package/dist/next-node/http/response.d.ts +0 -63
  1551. package/dist/next-node/http/response.d.ts.map +0 -1
  1552. package/dist/next-node/http/response.js.map +0 -1
  1553. package/dist/next-node/http/router.d.ts +0 -114
  1554. package/dist/next-node/http/router.d.ts.map +0 -1
  1555. package/dist/next-node/http/router.js +0 -261
  1556. package/dist/next-node/http/router.js.map +0 -1
  1557. package/dist/next-node/http/upgrades.d.ts +0 -58
  1558. package/dist/next-node/http/upgrades.d.ts.map +0 -1
  1559. package/dist/next-node/http/upgrades.js +0 -184
  1560. package/dist/next-node/http/upgrades.js.map +0 -1
  1561. package/dist/next-node/plugins/build.d.ts +0 -57
  1562. package/dist/next-node/plugins/build.d.ts.map +0 -1
  1563. package/dist/next-node/plugins/build.js +0 -334
  1564. package/dist/next-node/plugins/build.js.map +0 -1
  1565. package/dist/next-node/plugins/discover.d.ts +0 -36
  1566. package/dist/next-node/plugins/discover.d.ts.map +0 -1
  1567. package/dist/next-node/plugins/discover.js +0 -91
  1568. package/dist/next-node/plugins/discover.js.map +0 -1
  1569. package/dist/next-node/plugins/evaluate.d.ts +0 -33
  1570. package/dist/next-node/plugins/evaluate.d.ts.map +0 -1
  1571. package/dist/next-node/plugins/evaluate.js +0 -98
  1572. package/dist/next-node/plugins/evaluate.js.map +0 -1
  1573. package/dist/next-node/plugins/index.d.ts +0 -9
  1574. package/dist/next-node/plugins/index.d.ts.map +0 -1
  1575. package/dist/next-node/plugins/index.js +0 -11
  1576. package/dist/next-node/plugins/index.js.map +0 -1
  1577. package/dist/next-node/plugins/install.d.ts +0 -13
  1578. package/dist/next-node/plugins/install.d.ts.map +0 -1
  1579. package/dist/next-node/plugins/install.js +0 -37
  1580. package/dist/next-node/plugins/install.js.map +0 -1
  1581. package/dist/next-node/plugins/plugins.d.ts +0 -135
  1582. package/dist/next-node/plugins/plugins.d.ts.map +0 -1
  1583. package/dist/next-node/plugins/plugins.js +0 -206
  1584. package/dist/next-node/plugins/plugins.js.map +0 -1
  1585. package/dist/next-node/plugins/runtime.d.ts +0 -41
  1586. package/dist/next-node/plugins/runtime.d.ts.map +0 -1
  1587. package/dist/next-node/plugins/runtime.js +0 -136
  1588. package/dist/next-node/plugins/runtime.js.map +0 -1
  1589. package/dist/next-node/plugins/stack.d.ts.map +0 -1
  1590. package/dist/next-node/plugins/stack.js.map +0 -1
  1591. package/dist/next-node/plugins/watcher.d.ts +0 -58
  1592. package/dist/next-node/plugins/watcher.d.ts.map +0 -1
  1593. package/dist/next-node/plugins/watcher.js +0 -281
  1594. package/dist/next-node/plugins/watcher.js.map +0 -1
  1595. package/dist/next-node/workers/control.d.ts +0 -83
  1596. package/dist/next-node/workers/control.d.ts.map +0 -1
  1597. package/dist/next-node/workers/control.js +0 -77
  1598. package/dist/next-node/workers/control.js.map +0 -1
  1599. package/dist/next-node/workers/index.d.ts +0 -5
  1600. package/dist/next-node/workers/index.d.ts.map +0 -1
  1601. package/dist/next-node/workers/index.js +0 -7
  1602. package/dist/next-node/workers/index.js.map +0 -1
  1603. package/dist/next-node/workers/lock.d.ts +0 -21
  1604. package/dist/next-node/workers/lock.d.ts.map +0 -1
  1605. package/dist/next-node/workers/lock.js +0 -137
  1606. package/dist/next-node/workers/lock.js.map +0 -1
  1607. package/dist/next-node/workers/main.d.ts +0 -46
  1608. package/dist/next-node/workers/main.d.ts.map +0 -1
  1609. package/dist/next-node/workers/main.js +0 -230
  1610. package/dist/next-node/workers/main.js.map +0 -1
  1611. package/dist/next-node/workers/process.d.ts +0 -42
  1612. package/dist/next-node/workers/process.d.ts.map +0 -1
  1613. package/dist/next-node/workers/process.js +0 -125
  1614. package/dist/next-node/workers/process.js.map +0 -1
  1615. package/dist/next-node/workers/workers.d.ts +0 -80
  1616. package/dist/next-node/workers/workers.d.ts.map +0 -1
  1617. package/dist/next-node/workers/workers.js +0 -572
  1618. package/dist/next-node/workers/workers.js.map +0 -1
  1619. package/dist/node.d.ts +0 -4
  1620. package/dist/node.d.ts.map +0 -1
  1621. package/dist/node.js +0 -4
  1622. package/dist/node.js.map +0 -1
  1623. package/dist/object.d.ts +0 -438
  1624. package/dist/object.d.ts.map +0 -1
  1625. package/dist/object.js +0 -1570
  1626. package/dist/object.js.map +0 -1
  1627. package/dist/publish.d.ts +0 -5
  1628. package/dist/publish.d.ts.map +0 -1
  1629. package/dist/publish.js +0 -40
  1630. package/dist/publish.js.map +0 -1
  1631. package/dist/registry.d.ts +0 -25
  1632. package/dist/registry.d.ts.map +0 -1
  1633. package/dist/registry.js +0 -6
  1634. package/dist/registry.js.map +0 -1
  1635. package/dist/reload.d.ts +0 -126
  1636. package/dist/reload.d.ts.map +0 -1
  1637. package/dist/reload.js +0 -653
  1638. package/dist/reload.js.map +0 -1
  1639. package/dist/remote.d.ts +0 -165
  1640. package/dist/remote.d.ts.map +0 -1
  1641. package/dist/remote.js +0 -612
  1642. package/dist/remote.js.map +0 -1
  1643. package/dist/schema.d.ts +0 -25
  1644. package/dist/schema.d.ts.map +0 -1
  1645. package/dist/schema.js +0 -403
  1646. package/dist/schema.js.map +0 -1
  1647. package/dist/state.d.ts +0 -92
  1648. package/dist/state.d.ts.map +0 -1
  1649. package/dist/state.js +0 -287
  1650. package/dist/state.js.map +0 -1
  1651. package/dist/types.d.ts +0 -88
  1652. package/dist/types.d.ts.map +0 -1
  1653. package/dist/types.js +0 -2
  1654. package/dist/types.js.map +0 -1
  1655. package/dist/websocket.d.ts +0 -15
  1656. package/dist/websocket.d.ts.map +0 -1
  1657. package/dist/websocket.js +0 -16
  1658. package/dist/websocket.js.map +0 -1
  1659. package/dist/wire.d.ts +0 -197
  1660. package/dist/wire.d.ts.map +0 -1
  1661. package/dist/wire.js +0 -166
  1662. package/dist/wire.js.map +0 -1
  1663. package/docs/guide.md +0 -814
  1664. package/docs/next/benchmarks.md +0 -959
  1665. package/docs/next/decisions.md +0 -2957
  1666. package/docs/next/dependencies/book.md +0 -1671
  1667. package/docs/next/dependencies/index.html +0 -2641
  1668. package/docs/next/design.md +0 -2554
  1669. package/docs/next/durable-observers/book.md +0 -432
  1670. package/docs/next/durable-observers/index.html +0 -517
  1671. package/docs/next/guide-plugins-hosts/book.md +0 -607
  1672. package/docs/next/guide-plugins-hosts/index.html +0 -652
  1673. package/docs/next/http-workers/book.md +0 -378
  1674. package/docs/next/http-workers/index.html +0 -515
  1675. package/docs/next/layer-1.md +0 -311
  1676. package/docs/next/layer-2.md +0 -216
  1677. package/docs/next/plugin-model/book.md +0 -186
  1678. package/docs/next/plugin-model/index.html +0 -310
  1679. package/docs/next/plugin-primer/book.md +0 -273
  1680. package/docs/next/plugin-primer/index.html +0 -430
  1681. package/docs/next/slice-1.md +0 -236
  1682. package/docs/next/slice-10.md +0 -285
  1683. package/docs/next/slice-11.md +0 -93
  1684. package/docs/next/slice-2.md +0 -174
  1685. package/docs/next/slice-3a.md +0 -296
  1686. package/docs/next/slice-3b.md +0 -197
  1687. package/docs/next/slice-4a.md +0 -418
  1688. package/docs/next/slice-4b.md +0 -208
  1689. package/docs/next/slice-6a.md +0 -676
  1690. package/docs/next/slice-6b.md +0 -332
  1691. package/docs/next/slice-7b/book.md +0 -608
  1692. package/docs/next/slice-7b/index.html +0 -842
  1693. package/docs/next/slice-7b.md +0 -255
  1694. package/docs/next/slice-7c.md +0 -165
  1695. package/docs/next/slices.md +0 -230
  1696. package/docs/next/store/book.md +0 -665
  1697. package/docs/next/store/index.html +0 -861
  1698. package/docs/next/store/walkthrough.md +0 -193
  1699. package/docs/spec.md +0 -288
  1700. package/docs/tutorial.md +0 -932
  1701. /package/dist/{next/contracts → contracts}/accepts.js +0 -0
  1702. /package/dist/{next/contracts → contracts}/contract.js +0 -0
  1703. /package/dist/{next/contracts → contracts}/declare.d.ts +0 -0
  1704. /package/dist/{next/contracts → contracts}/declare.js +0 -0
  1705. /package/dist/{next/contracts → contracts}/evolve.d.ts +0 -0
  1706. /package/dist/{next/contracts → contracts}/evolve.js +0 -0
  1707. /package/dist/{next/contracts → contracts}/fingerprint.js +0 -0
  1708. /package/dist/{next/contracts → contracts}/history.d.ts +0 -0
  1709. /package/dist/{next/contracts → contracts}/history.js +0 -0
  1710. /package/dist/{next/contracts → contracts}/host-kind.d.ts +0 -0
  1711. /package/dist/{next/contracts → contracts}/host-kind.js +0 -0
  1712. /package/dist/{next/contracts → contracts}/index.d.ts +0 -0
  1713. /package/dist/{next/contracts → contracts}/index.js +0 -0
  1714. /package/dist/{next/contracts → contracts}/internal.d.ts +0 -0
  1715. /package/dist/{next/contracts → contracts}/internal.js +0 -0
  1716. /package/dist/{next/contracts → contracts}/names.d.ts +0 -0
  1717. /package/dist/{next/contracts → contracts}/names.js +0 -0
  1718. /package/dist/{next/contracts → contracts}/params.js +0 -0
  1719. /package/dist/{next/contracts → contracts}/schema.d.ts +0 -0
  1720. /package/dist/{next/contracts → contracts}/schema.js +0 -0
  1721. /package/dist/{next/data → data}/args.js +0 -0
  1722. /package/dist/{next/data → data}/failure.d.ts +0 -0
  1723. /package/dist/{next/data → data}/params.js +0 -0
  1724. /package/dist/{next/documents → documents}/address-source.js +0 -0
  1725. /package/dist/{next/documents → documents}/fence.d.ts +0 -0
  1726. /package/dist/{next/documents → documents}/fence.js +0 -0
  1727. /package/dist/{next/documents → documents}/handles.js +0 -0
  1728. /package/dist/{next/documents → documents}/index.d.ts +0 -0
  1729. /package/dist/{next/documents → documents}/index.js +0 -0
  1730. /package/dist/{next/documents → documents}/internal.js +0 -0
  1731. /package/dist/{next/documents → documents}/line.d.ts +0 -0
  1732. /package/dist/{next/documents → documents}/line.js +0 -0
  1733. /package/dist/{next/documents → documents}/residency.js +0 -0
  1734. /package/dist/{next/host → host}/adapted.js +0 -0
  1735. /package/dist/{next/host → host}/backoff.d.ts +0 -0
  1736. /package/dist/{next/host → host}/backoff.js +0 -0
  1737. /package/dist/{next/host → host}/deadline.d.ts +0 -0
  1738. /package/dist/{next/host → host}/deadline.js +0 -0
  1739. /package/dist/{next/host → host}/dependencies.d.ts +0 -0
  1740. /package/dist/{next/host → host}/dependencies.js +0 -0
  1741. /package/dist/{next/host → host}/destination.js +0 -0
  1742. /package/dist/{next/host → host}/facet.js +0 -0
  1743. /package/dist/{next/host → host}/follow.js +0 -0
  1744. /package/dist/{next/host → host}/index.js +0 -0
  1745. /package/dist/{next/host → host}/members.js +0 -0
  1746. /package/dist/{next/host → host}/parked.js +0 -0
  1747. /package/dist/{next/host → host}/presence.js +0 -0
  1748. /package/dist/{next/host → host}/retry-on.d.ts +0 -0
  1749. /package/dist/{next/host → host}/retry-on.js +0 -0
  1750. /package/dist/{next/host → host}/revocation.js +0 -0
  1751. /package/dist/{next/host → host}/sleep.js +0 -0
  1752. /package/dist/{next/host → host}/uuid.d.ts +0 -0
  1753. /package/dist/{next/host → host}/uuid.js +0 -0
  1754. /package/dist/{next/jobs → jobs}/definition.d.ts +0 -0
  1755. /package/dist/{next/jobs → jobs}/definition.js +0 -0
  1756. /package/dist/{next/jobs → jobs}/index.d.ts +0 -0
  1757. /package/dist/{next/jobs → jobs}/index.js +0 -0
  1758. /package/dist/{next/jobs → jobs}/internal.d.ts +0 -0
  1759. /package/dist/{next/jobs → jobs}/internal.js +0 -0
  1760. /package/dist/{next/jobs → jobs}/persisted.js +0 -0
  1761. /package/dist/{next/jobs → jobs}/running.js +0 -0
  1762. /package/dist/{next/jobs → jobs}/stored.js +0 -0
  1763. /package/dist/{next/link → link}/binary.d.ts +0 -0
  1764. /package/dist/{next/link → link}/errors.d.ts +0 -0
  1765. /package/dist/{next/link → link}/errors.js +0 -0
  1766. /package/dist/{next/link → link}/index.d.ts +0 -0
  1767. /package/dist/{next/link → link}/index.js +0 -0
  1768. /package/dist/{next/link → link}/internal.d.ts +0 -0
  1769. /package/dist/{next/link → link}/internal.js +0 -0
  1770. /package/dist/{next/link → link}/ipc.d.ts +0 -0
  1771. /package/dist/{next/link → link}/ipc.js +0 -0
  1772. /package/dist/{next/link → link}/link.d.ts +0 -0
  1773. /package/dist/{next/link → link}/link.js +0 -0
  1774. /package/dist/{next/link → link}/text.d.ts +0 -0
  1775. /package/dist/{next/link → link}/values.d.ts +0 -0
  1776. /package/dist/{next/link → link}/websocket.d.ts +0 -0
  1777. /package/dist/{next/link → link}/websocket.js +0 -0
  1778. /package/dist/{next-node → node}/http/admission.d.ts +0 -0
  1779. /package/dist/{next-node → node}/http/admission.js +0 -0
  1780. /package/dist/{next-node → node}/http/file.d.ts +0 -0
  1781. /package/dist/{next-node → node}/http/file.js +0 -0
  1782. /package/dist/{next-node → node}/http/headers.d.ts +0 -0
  1783. /package/dist/{next-node → node}/http/incoming.d.ts +0 -0
  1784. /package/dist/{next-node → node}/http/incoming.js +0 -0
  1785. /package/dist/{next-node → node}/http/node.d.ts +0 -0
  1786. /package/dist/{next-node → node}/http/node.js +0 -0
  1787. /package/dist/{next-node → node}/http/response.js +0 -0
  1788. /package/dist/{next-node → node}/plugins/stack.d.ts +0 -0
  1789. /package/dist/{next-node → node}/plugins/stack.js +0 -0
  1790. /package/dist/{next/registries → registries}/contribution.d.ts +0 -0
  1791. /package/dist/{next/registries → registries}/contribution.js +0 -0
  1792. /package/dist/{next/registries → registries}/entries.d.ts +0 -0
  1793. /package/dist/{next/registries → registries}/entries.js +0 -0
  1794. /package/dist/{next/registries → registries}/index.d.ts +0 -0
  1795. /package/dist/{next/registries → registries}/index.js +0 -0
  1796. /package/dist/{next/registries → registries}/internal.d.ts +0 -0
  1797. /package/dist/{next/registries → registries}/internal.js +0 -0
  1798. /package/dist/{next/registries → registries}/registry.js +0 -0
  1799. /package/dist/{next/registries → registries}/value.d.ts +0 -0
  1800. /package/dist/{next/remote → remote}/calls.d.ts +0 -0
  1801. /package/dist/{next/remote → remote}/calls.js +0 -0
  1802. /package/dist/{next/remote → remote}/internal.d.ts +0 -0
  1803. /package/dist/{next/remote → remote}/internal.js +0 -0
  1804. /package/dist/{next/remote → remote}/path.d.ts +0 -0
  1805. /package/dist/{next/remote → remote}/path.js +0 -0
  1806. /package/dist/{next/state → state}/index.js +0 -0
  1807. /package/dist/{next/state → state}/internal.d.ts +0 -0
  1808. /package/dist/{next/state → state}/internal.js +0 -0
  1809. /package/dist/{next/state → state}/writable.js +0 -0
  1810. /package/dist/{next/store → store}/adapter.js +0 -0
  1811. /package/dist/{next/store → store}/allocator.d.ts +0 -0
  1812. /package/dist/{next/store → store}/allocator.js +0 -0
  1813. /package/dist/{next/store → store}/applier.d.ts +0 -0
  1814. /package/dist/{next/store → store}/applier.js +0 -0
  1815. /package/dist/{next/store → store}/apply-batch.js +0 -0
  1816. /package/dist/{next/store → store}/backend.js +0 -0
  1817. /package/dist/{next/store → store}/catalog.js +0 -0
  1818. /package/dist/{next/store → store}/claims.d.ts +0 -0
  1819. /package/dist/{next/store → store}/claims.js +0 -0
  1820. /package/dist/{next/store → store}/columns.d.ts +0 -0
  1821. /package/dist/{next/store → store}/columns.js +0 -0
  1822. /package/dist/{next/store → store}/evaluate.js +0 -0
  1823. /package/dist/{next/store → store}/expression.js +0 -0
  1824. /package/dist/{next/store → store}/index.d.ts +0 -0
  1825. /package/dist/{next/store → store}/index.js +0 -0
  1826. /package/dist/{next/store → store}/jsonl.d.ts +0 -0
  1827. /package/dist/{next/store → store}/jsonl.js +0 -0
  1828. /package/dist/{next/store → store}/outbox.js +0 -0
  1829. /package/dist/{next/store → store}/query.js +0 -0
  1830. /package/dist/{next/store → store}/refusal.d.ts +0 -0
  1831. /package/dist/{next/store → store}/refusal.js +0 -0
  1832. /package/dist/{next/store → store}/rows.js +0 -0
  1833. /package/dist/{next/store → store}/sql.js +0 -0
  1834. /package/dist/{next/store → store}/table-changes.js +0 -0
  1835. /package/dist/{next/store → store}/table-evolve.d.ts +0 -0
  1836. /package/dist/{next/store → store}/table-evolve.js +0 -0
  1837. /package/dist/{next/store → store}/table-history.d.ts +0 -0
  1838. /package/dist/{next/store → store}/table-history.js +0 -0
  1839. /package/dist/{next/store → store}/table-writes.d.ts +0 -0
  1840. /package/dist/{next/store → store}/table.js +0 -0
  1841. /package/dist/{next/store → store}/text.d.ts +0 -0
  1842. /package/dist/{next/store → store}/text.js +0 -0
  1843. /package/dist/{next/store → store}/writes.d.ts +0 -0
  1844. /package/dist/{next/store → store}/writes.js +0 -0
  1845. /package/docs/{next/dependencies → dependencies}/model.md +0 -0
  1846. /package/docs/{next/flow-control → flow-control}/book.md +0 -0
  1847. /package/docs/{next/flow-control → flow-control}/fold/index.html +0 -0
  1848. /package/docs/{next/flow-control → flow-control}/index.html +0 -0
  1849. /package/docs/{next/flow-control → flow-control}/window/index.html +0 -0
  1850. /package/docs/{next/slice-4.md → slice-4.md} +0 -0
  1851. /package/docs/{next/slice-5.md → slice-5.md} +0 -0
  1852. /package/docs/{next/slice-7a.md → slice-7a.md} +0 -0
  1853. /package/docs/{next/slice-8.md → slice-8.md} +0 -0
@@ -0,0 +1,114 @@
1
+ import type { Context } from "../context/index.ts";
2
+ import type { Op } from "../delta/index.ts";
3
+ import type { JsonValue } from "../json.ts";
4
+ import { Watch, type Watchable, type WatchCall, type WatchEnd } from "../watch.ts";
5
+ import type { Batch } from "./batch.ts";
6
+ /**
7
+ * A synchronous subscriber of a source (a hold over a link, a reference's member): fed the source's call inside the batch
8
+ * that made it, before the batch ends, so everything one commit changed can leave in one message. The watch's own sink
9
+ * shape (`Watch.advance`, `Watch.end`).
10
+ */
11
+ export interface Subscriber {
12
+ /**
13
+ * The source's call of this batch, in its batch's `context`: a value (the ops from the previous one, and whether its
14
+ * document was retired in it, or for a derive one of its sources' documents), or a failure it may recover from; the
15
+ * next value after a failure is `[["r", value]]`.
16
+ */
17
+ advance(call: WatchCall<JsonValue>, context: Context): void;
18
+ /** The source ended for good with `end`; nothing follows, and the subscriber is dropped. */
19
+ end(end: WatchEnd): void;
20
+ /**
21
+ * The source ended for good after its last call (a followed runtime ended): a subscriber delivering later (a watch)
22
+ * ends `ended` once it delivered what it was given, others end now.
23
+ */
24
+ endAfterDelivery(): void;
25
+ }
26
+ /**
27
+ * What a new watch of a source starts at (design §11): its value, or, while it is failed, the failure and its last good
28
+ * value (`undefined` when it never had one: a watch cannot start then, there is nothing to start at).
29
+ */
30
+ export type WatchStart = {
31
+ readonly kind: "value";
32
+ readonly value: JsonValue;
33
+ } | {
34
+ readonly kind: "failed";
35
+ readonly error: unknown;
36
+ readonly last: JsonValue | undefined;
37
+ };
38
+ /**
39
+ * An error Chord hands to apps (a failure call, a report), its stack made text first: until then V8 keeps the frames'
40
+ * receivers, which would keep the host behind the throw alive for as long as an app keeps the error.
41
+ */
42
+ export declare function handedOut<E>(error: E): E;
43
+ /**
44
+ * What reads a source and is marked by its changes: a derive, or a reference's member forwarding to derives (`Source.
45
+ * dependents`).
46
+ */
47
+ export interface Dependent {
48
+ /** The source changed in the current batch: flags only, no compute. */
49
+ invalidate(): void;
50
+ /** A source's document was retired in the current batch (rule 21); `visited` keeps a diamond walked once. */
51
+ sourceRetired(visited: Set<Dependent>): void;
52
+ }
53
+ /**
54
+ * A changing value on a host (a singleton document, a derive, a replica): its watches and subscribers get one frame
55
+ * per batch that changed it, and the derives reading it are marked dirty when it changes.
56
+ */
57
+ export declare abstract class Source implements Watchable<JsonValue> {
58
+ #private;
59
+ /** Derives reading this source (and references' members forwarding to some); each removes itself when it stops. */
60
+ readonly dependents: Set<Dependent>;
61
+ protected readonly batch: Batch;
62
+ constructor(batch: Batch);
63
+ abstract get value(): JsonValue;
64
+ /** Whether a watch or a subscriber follows this source. */
65
+ get watched(): boolean;
66
+ watch(context: Context): Promise<Watch<JsonValue>>;
67
+ /**
68
+ * `watch` without the Promise, for references, which must register the watch before anything else runs. On a failed
69
+ * source it opens at the last good value and its first call is the failure; with no value to start at it throws the
70
+ * failure.
71
+ */
72
+ openWatch(context: Context): Watch<JsonValue>;
73
+ /** What a new watch starts at; a source that can fail and recover tells its failure (`WatchStart`). */
74
+ start(): WatchStart;
75
+ /** Feeds `subscriber` every frame from now on, inside each batch; the caller took the current value first. */
76
+ subscribe(subscriber: Subscriber): void;
77
+ unsubscribe(subscriber: Subscriber): void;
78
+ /** Delivers this batch's frame to its watches; called once per batch that listed it with `changed`. */
79
+ abstract deliver(context: Context): void;
80
+ /** Records a change in the current batch: listed for a frame when watched, and every dependent marked dirty. */
81
+ protected changed(): void;
82
+ /**
83
+ * Records a retirement of this source's document in the current batch: every derive reading it, directly or
84
+ * through other derives, carries the flag on in its frame (rule 21). Called after `changed`.
85
+ */
86
+ protected retiredInBatch(): void;
87
+ /** Queues one frame on every watch and feeds it to every subscriber. */
88
+ protected publish(value: JsonValue, ops: readonly Op[], retired: boolean, context: Context): void;
89
+ /** Queues `call` on every watch and feeds it to every subscriber, as it is (a reference's member passes one on). */
90
+ protected forward(call: WatchCall<JsonValue>, context: Context): void;
91
+ /**
92
+ * Gives every watch and subscriber one failure call (design §11): the source cannot compute its value now and may
93
+ * recover; they stay open, and its next value is `[["r", value]]`.
94
+ */
95
+ protected failWatches(error: unknown, context: Context): void;
96
+ /**
97
+ * Ends every watch and subscriber for good once what they were given is delivered (a followed runtime ended after a
98
+ * last call, Durable's `endAfterDelivery`): `ended`; nothing follows.
99
+ */
100
+ protected endWatchesAfterDelivery(): void;
101
+ /** Ends every watch and subscriber for good (its owner ended): `ended`; nothing follows. */
102
+ protected endWatches(): void;
103
+ }
104
+ /** A watchable that never changes (start data, §18); usable as a state member and as a derive source. */
105
+ export declare function constant<const T extends JsonValue>(value: T): Watchable<T>;
106
+ /** The watchable behind `constant(value)`: its watches never get a frame and end only by stop or cancellation. */
107
+ export declare class Constant implements Watchable<JsonValue> {
108
+ readonly value: JsonValue;
109
+ constructor(value: JsonValue);
110
+ watch(context: Context): Promise<Watch<JsonValue>>;
111
+ /** As `Source.openWatch`; nothing is delivered, so nothing is reported. */
112
+ openWatch(context: Context): Watch<JsonValue>;
113
+ }
114
+ //# sourceMappingURL=watchable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchable.d.ts","sourceRoot":"","sources":["../../src/state/watchable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,EAA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AQ,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAG1E;AAED,kHAAkH;AAClH,qBAAa,QAAS,YAAW,SAAS,CAAC,SAAS,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAE1B,YAAY,KAAK,EAAE,SAAS,EAE3B;IAEK,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAEvD;IAED,2EAA2E;IAC3E,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAQ5C;CACD"}
@@ -0,0 +1,156 @@
1
+ // Chord's JSON watchables: sources (documents and derives, with their watches and dependent derives) and constants.
2
+ import { Watch } from "../watch.js";
3
+ /**
4
+ * An error Chord hands to apps (a failure call, a report), its stack made text first: until then V8 keeps the frames'
5
+ * receivers, which would keep the host behind the throw alive for as long as an app keeps the error.
6
+ */
7
+ export function handedOut(error) {
8
+ if (error instanceof Error)
9
+ void error.stack;
10
+ return error;
11
+ }
12
+ const ENDED = { kind: "ended" };
13
+ /**
14
+ * A changing value on a host (a singleton document, a derive, a replica): its watches and subscribers get one frame
15
+ * per batch that changed it, and the derives reading it are marked dirty when it changes.
16
+ */
17
+ export class Source {
18
+ /** Derives reading this source (and references' members forwarding to some); each removes itself when it stops. */
19
+ dependents = new Set();
20
+ batch;
21
+ /** Its watches and subscribers, each made by its first: most sources (a reference's members) never have one. */
22
+ #watches;
23
+ #subscribers;
24
+ constructor(batch) {
25
+ this.batch = batch;
26
+ }
27
+ /** Whether a watch or a subscriber follows this source. */
28
+ get watched() {
29
+ return (this.#watches?.size ?? 0) > 0 || (this.#subscribers?.size ?? 0) > 0;
30
+ }
31
+ async watch(context) {
32
+ return this.openWatch(context);
33
+ }
34
+ /**
35
+ * `watch` without the Promise, for references, which must register the watch before anything else runs. On a failed
36
+ * source it opens at the last good value and its first call is the failure; with no value to start at it throws the
37
+ * failure.
38
+ */
39
+ openWatch(context) {
40
+ this.batch.assertOutside("watch");
41
+ const start = this.start();
42
+ if (start.kind === "failed" && start.last === undefined)
43
+ throw start.error;
44
+ const value = start.kind === "value" ? start.value : start.last;
45
+ this.#watches ??= new Set();
46
+ const watches = this.#watches;
47
+ const watch = new Watch(value, () => watches.delete(watch), this.batch.reportListener);
48
+ watches.add(watch);
49
+ if (context.abortSignal !== undefined)
50
+ watch.observeAbort(context.abortSignal);
51
+ if (start.kind === "failed")
52
+ watch.fail(start.error, context);
53
+ return watch;
54
+ }
55
+ /** What a new watch starts at; a source that can fail and recover tells its failure (`WatchStart`). */
56
+ start() {
57
+ return { kind: "value", value: this.value };
58
+ }
59
+ /** Feeds `subscriber` every frame from now on, inside each batch; the caller took the current value first. */
60
+ subscribe(subscriber) {
61
+ this.#subscribers ??= new Set();
62
+ this.#subscribers.add(subscriber);
63
+ }
64
+ unsubscribe(subscriber) {
65
+ this.#subscribers?.delete(subscriber);
66
+ }
67
+ /** Records a change in the current batch: listed for a frame when watched, and every dependent marked dirty. */
68
+ changed() {
69
+ if (this.watched)
70
+ this.batch.changed(this);
71
+ for (const derive of this.dependents)
72
+ derive.invalidate();
73
+ }
74
+ /**
75
+ * Records a retirement of this source's document in the current batch: every derive reading it, directly or
76
+ * through other derives, carries the flag on in its frame (rule 21). Called after `changed`.
77
+ */
78
+ retiredInBatch() {
79
+ // Allocated only for a retirement, which is rare.
80
+ const visited = new Set();
81
+ for (const derive of this.dependents)
82
+ derive.sourceRetired(visited);
83
+ }
84
+ /** Queues one frame on every watch and feeds it to every subscriber. */
85
+ publish(value, ops, retired, context) {
86
+ this.forward({ kind: "value", value, ops, retired }, context);
87
+ }
88
+ /** Queues `call` on every watch and feeds it to every subscriber, as it is (a reference's member passes one on). */
89
+ forward(call, context) {
90
+ if (this.#watches !== undefined)
91
+ for (const watch of this.#watches)
92
+ watch.advance(call, context);
93
+ if (this.#subscribers !== undefined)
94
+ for (const subscriber of this.#subscribers)
95
+ subscriber.advance(call, context);
96
+ }
97
+ /**
98
+ * Gives every watch and subscriber one failure call (design §11): the source cannot compute its value now and may
99
+ * recover; they stay open, and its next value is `[["r", value]]`.
100
+ */
101
+ failWatches(error, context) {
102
+ this.forward({ kind: "failed", error: handedOut(error) }, context);
103
+ }
104
+ /**
105
+ * Ends every watch and subscriber for good once what they were given is delivered (a followed runtime ended after a
106
+ * last call, Durable's `endAfterDelivery`): `ended`; nothing follows.
107
+ */
108
+ endWatchesAfterDelivery() {
109
+ if (this.#watches !== undefined)
110
+ for (const watch of [...this.#watches])
111
+ watch.endAfterDelivery();
112
+ if (this.#subscribers === undefined || this.#subscribers.size === 0)
113
+ return;
114
+ const subscribers = [...this.#subscribers];
115
+ this.#subscribers.clear();
116
+ for (const subscriber of subscribers)
117
+ subscriber.endAfterDelivery();
118
+ }
119
+ /** Ends every watch and subscriber for good (its owner ended): `ended`; nothing follows. */
120
+ endWatches() {
121
+ // Ending detaches, which deletes the current entry (safe while iterating) and runs no listener.
122
+ if (this.#watches !== undefined)
123
+ for (const watch of this.#watches)
124
+ watch.end(ENDED);
125
+ if (this.#subscribers === undefined || this.#subscribers.size === 0)
126
+ return;
127
+ // A copy: a subscriber may unsubscribe as it ends.
128
+ const subscribers = [...this.#subscribers];
129
+ this.#subscribers.clear();
130
+ for (const subscriber of subscribers)
131
+ subscriber.end(ENDED);
132
+ }
133
+ }
134
+ /** A watchable that never changes (start data, §18); usable as a state member and as a derive source. */
135
+ export function constant(value) {
136
+ // The constant holds `value` as it was given.
137
+ return new Constant(value);
138
+ }
139
+ /** The watchable behind `constant(value)`: its watches never get a frame and end only by stop or cancellation. */
140
+ export class Constant {
141
+ value;
142
+ constructor(value) {
143
+ this.value = value;
144
+ }
145
+ async watch(context) {
146
+ return this.openWatch(context);
147
+ }
148
+ /** As `Source.openWatch`; nothing is delivered, so nothing is reported. */
149
+ openWatch(context) {
150
+ const watch = new Watch(this.value, () => { }, () => { });
151
+ if (context.abortSignal !== undefined)
152
+ watch.observeAbort(context.abortSignal);
153
+ return watch;
154
+ }
155
+ }
156
+ //# sourceMappingURL=watchable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchable.js","sourceRoot":"","sources":["../../src/state/watchable.ts"],"names":[],"mappings":"AAAA,oHAAoH;AAKpH,OAAO,EAAE,KAAK,EAAiD,MAAM,aAAa,CAAC;AAgCnF;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAI,KAAQ;IACpC,IAAI,KAAK,YAAY,KAAK;QAAE,KAAK,KAAK,CAAC,KAAK,CAAC;IAC7C,OAAO,KAAK,CAAC;AACd,CAAC;AAaD,MAAM,KAAK,GAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAE1C;;;GAGG;AACH,MAAM,OAAgB,MAAM;IAC3B,mHAAmH;IAC1G,UAAU,GAAG,IAAI,GAAG,EAAa,CAAC;IACxB,KAAK,CAAQ;IAChC,gHAAgH;IAChH,QAAQ,CAAoC;IAC5C,YAAY,CAA8B;IAE1C,YAAY,KAAY;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;IAID,2DAA2D;IAC3D,IAAI,OAAO;QACV,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7E,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAAgB;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,OAAgB;QACzB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KA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C,CAAC;IAED,2EAA2E;IAC3E,SAAS,CAAC,OAAgB;QACzB,MAAM,KAAK,GAAG,IAAI,KAAK,CACtB,IAAI,CAAC,KAAK,EACV,GAAG,EAAE,GAAE,CAAC,EACR,GAAG,EAAE,GAAE,CAAC,CACR,CAAC;QACF,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS;YAAE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["// Chord's JSON watchables: sources (documents and derives, with their watches and dependent derives) and constants.\n\nimport type { Context } from \"../context/index.ts\";\nimport type { Op } from \"../delta/index.ts\";\nimport type { JsonValue } from \"../json.ts\";\nimport { Watch, type Watchable, type WatchCall, type WatchEnd } from \"../watch.ts\";\nimport type { Batch } from \"./batch.ts\";\n\n/**\n * A synchronous subscriber of a source (a hold over a link, a reference's member): fed the source's call inside the batch\n * that made it, before the batch ends, so everything one commit changed can leave in one message. The watch's own sink\n * shape (`Watch.advance`, `Watch.end`).\n */\nexport interface Subscriber {\n\t/**\n\t * The source's call of this batch, in its batch's `context`: a value (the ops from the previous one, and whether its\n\t * document was retired in it, or for a derive one of its sources' documents), or a failure it may recover from; the\n\t * next value after a failure is `[[\"r\", value]]`.\n\t */\n\tadvance(call: WatchCall<JsonValue>, context: Context): void;\n\t/** The source ended for good with `end`; nothing follows, and the subscriber is dropped. */\n\tend(end: WatchEnd): void;\n\t/**\n\t * The source ended for good after its last call (a followed runtime ended): a subscriber delivering later (a watch)\n\t * ends `ended` once it delivered what it was given, others end now.\n\t */\n\tendAfterDelivery(): void;\n}\n\n/**\n * What a new watch of a source starts at (design §11): its value, or, while it is failed, the failure and its last good\n * value (`undefined` when it never had one: a watch cannot start then, there is nothing to start at).\n */\nexport type WatchStart =\n\t| { readonly kind: \"value\"; readonly value: JsonValue }\n\t| { readonly kind: \"failed\"; readonly error: unknown; readonly last: JsonValue | undefined };\n\n/**\n * An error Chord hands to apps (a failure call, a report), its stack made text first: until then V8 keeps the frames'\n * receivers, which would keep the host behind the throw alive for as long as an app keeps the error.\n */\nexport function handedOut<E>(error: E): E {\n\tif (error instanceof Error) void error.stack;\n\treturn error;\n}\n\n/**\n * What reads a source and is marked by its changes: a derive, or a reference's member forwarding to derives (`Source.\n * dependents`).\n */\nexport interface Dependent {\n\t/** The source changed in the current batch: flags only, no compute. */\n\tinvalidate(): void;\n\t/** A source's document was retired in the current batch (rule 21); `visited` keeps a diamond walked once. */\n\tsourceRetired(visited: Set<Dependent>): void;\n}\n\nconst ENDED: WatchEnd = { kind: \"ended\" };\n\n/**\n * A changing value on a host (a singleton document, a derive, a replica): its watches and subscribers get one frame\n * per batch that changed it, and the derives reading it are marked dirty when it changes.\n */\nexport abstract class Source implements Watchable<JsonValue> {\n\t/** Derives reading this source (and references' members forwarding to some); each removes itself when it stops. */\n\treadonly dependents = new Set<Dependent>();\n\tprotected readonly batch: Batch;\n\t/** Its watches and subscribers, each made by its first: most sources (a reference's members) never have one. */\n\t#watches: Set<Watch<JsonValue>> | undefined;\n\t#subscribers: Set<Subscriber> | undefined;\n\n\tconstructor(batch: Batch) {\n\t\tthis.batch = batch;\n\t}\n\n\tabstract get value(): JsonValue;\n\n\t/** Whether a watch or a subscriber follows this source. */\n\tget watched(): boolean {\n\t\treturn (this.#watches?.size ?? 0) > 0 || (this.#subscribers?.size ?? 0) > 0;\n\t}\n\n\tasync watch(context: Context): Promise<Watch<JsonValue>> {\n\t\treturn this.openWatch(context);\n\t}\n\n\t/**\n\t * `watch` without the Promise, for references, which must register the watch before anything else runs. On a failed\n\t * source it opens at the last good value and its first call is the failure; with no value to start at it throws the\n\t * failure.\n\t */\n\topenWatch(context: Context): Watch<JsonValue> {\n\t\tthis.batch.assertOutside(\"watch\");\n\t\tconst start = this.start();\n\t\tif (start.kind === \"failed\" && start.last === undefined) throw start.error;\n\t\tconst value = start.kind === \"value\" ? start.value : start.last!;\n\t\tthis.#watches ??= new Set();\n\t\tconst watches = this.#watches;\n\t\tconst watch: Watch<JsonValue> = new Watch(value, () => watches.delete(watch), this.batch.reportListener);\n\t\twatches.add(watch);\n\t\tif (context.abortSignal !== undefined) watch.observeAbort(context.abortSignal);\n\t\tif (start.kind === \"failed\") watch.fail(start.error, context);\n\t\treturn watch;\n\t}\n\n\t/** What a new watch starts at; a source that can fail and recover tells its failure (`WatchStart`). */\n\tstart(): WatchStart {\n\t\treturn { kind: \"value\", value: this.value };\n\t}\n\n\t/** Feeds `subscriber` every frame from now on, inside each batch; the caller took the current value first. */\n\tsubscribe(subscriber: Subscriber): void {\n\t\tthis.#subscribers ??= new Set();\n\t\tthis.#subscribers.add(subscriber);\n\t}\n\n\tunsubscribe(subscriber: Subscriber): void {\n\t\tthis.#subscribers?.delete(subscriber);\n\t}\n\n\t/** Delivers this batch's frame to its watches; called once per batch that listed it with `changed`. */\n\tabstract deliver(context: Context): void;\n\n\t/** Records a change in the current batch: listed for a frame when watched, and every dependent marked dirty. */\n\tprotected changed(): void {\n\t\tif (this.watched) this.batch.changed(this);\n\t\tfor (const derive of this.dependents) derive.invalidate();\n\t}\n\n\t/**\n\t * Records a retirement of this source's document in the current batch: every derive reading it, directly or\n\t * through other derives, carries the flag on in its frame (rule 21). Called after `changed`.\n\t */\n\tprotected retiredInBatch(): void {\n\t\t// Allocated only for a retirement, which is rare.\n\t\tconst visited = new Set<Dependent>();\n\t\tfor (const derive of this.dependents) derive.sourceRetired(visited);\n\t}\n\n\t/** Queues one frame on every watch and feeds it to every subscriber. */\n\tprotected publish(value: JsonValue, ops: readonly Op[], retired: boolean, context: Context): void {\n\t\tthis.forward({ kind: \"value\", value, ops, retired }, context);\n\t}\n\n\t/** Queues `call` on every watch and feeds it to every subscriber, as it is (a reference's member passes one on). */\n\tprotected forward(call: WatchCall<JsonValue>, context: Context): void {\n\t\tif (this.#watches !== undefined) for (const watch of this.#watches) watch.advance(call, context);\n\t\tif (this.#subscribers !== undefined)\n\t\t\tfor (const subscriber of this.#subscribers) subscriber.advance(call, context);\n\t}\n\n\t/**\n\t * Gives every watch and subscriber one failure call (design §11): the source cannot compute its value now and may\n\t * recover; they stay open, and its next value is `[[\"r\", value]]`.\n\t */\n\tprotected failWatches(error: unknown, context: Context): void {\n\t\tthis.forward({ kind: \"failed\", error: handedOut(error) }, context);\n\t}\n\n\t/**\n\t * Ends every watch and subscriber for good once what they were given is delivered (a followed runtime ended after a\n\t * last call, Durable's `endAfterDelivery`): `ended`; nothing follows.\n\t */\n\tprotected endWatchesAfterDelivery(): void {\n\t\tif (this.#watches !== undefined) for (const watch of [...this.#watches]) watch.endAfterDelivery();\n\t\tif (this.#subscribers === undefined || this.#subscribers.size === 0) return;\n\t\tconst subscribers = [...this.#subscribers];\n\t\tthis.#subscribers.clear();\n\t\tfor (const subscriber of subscribers) subscriber.endAfterDelivery();\n\t}\n\n\t/** Ends every watch and subscriber for good (its owner ended): `ended`; nothing follows. */\n\tprotected endWatches(): void {\n\t\t// Ending detaches, which deletes the current entry (safe while iterating) and runs no listener.\n\t\tif (this.#watches !== undefined) for (const watch of this.#watches) watch.end(ENDED);\n\t\tif (this.#subscribers === undefined || this.#subscribers.size === 0) return;\n\t\t// A copy: a subscriber may unsubscribe as it ends.\n\t\tconst subscribers = [...this.#subscribers];\n\t\tthis.#subscribers.clear();\n\t\tfor (const subscriber of subscribers) subscriber.end(ENDED);\n\t}\n}\n\n/** A watchable that never changes (start data, §18); usable as a state member and as a derive source. */\nexport function constant<const T extends JsonValue>(value: T): Watchable<T> {\n\t// The constant holds `value` as it was given.\n\treturn new Constant(value) as unknown as Watchable<T>;\n}\n\n/** The watchable behind `constant(value)`: its watches never get a frame and end only by stop or cancellation. */\nexport class Constant implements Watchable<JsonValue> {\n\treadonly value: JsonValue;\n\n\tconstructor(value: JsonValue) {\n\t\tthis.value = value;\n\t}\n\n\tasync watch(context: Context): Promise<Watch<JsonValue>> {\n\t\treturn this.openWatch(context);\n\t}\n\n\t/** As `Source.openWatch`; nothing is delivered, so nothing is reported. */\n\topenWatch(context: Context): Watch<JsonValue> {\n\t\tconst watch = new Watch<JsonValue>(\n\t\t\tthis.value,\n\t\t\t() => {},\n\t\t\t() => {},\n\t\t);\n\t\tif (context.abortSignal !== undefined) watch.observeAbort(context.abortSignal);\n\t\treturn watch;\n\t}\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import type { Context } from "../context/index.ts";
2
+ import type { NativeWatchable } from "../watch.ts";
3
+ import type { Batch } from "./batch.ts";
4
+ import { FollowedSource } from "./native-source.ts";
5
+ /** An in-process value that changes when its owner sets it; `set` of the same value notifies nobody. */
6
+ export interface Writable<T> extends NativeWatchable<T> {
7
+ /**
8
+ * Sets the value: a new value (by identity) is a new frame for its watches and marks the derives and registry
9
+ * tables reading it, in the batch running now or in one of its own. Throws `released` once its attempt ended, and
10
+ * `invalid/reentrant` inside a derive compute or a `compose`.
11
+ */
12
+ set(value: T): void;
13
+ }
14
+ /** Who owns a writable: the context its own batches run in, and the check that its attempt still runs. */
15
+ export type WritableOwner = {
16
+ readonly context: Context;
17
+ /** Throws `released` once the attempt that made it was sealed. */
18
+ assertUsable(): void;
19
+ };
20
+ /** A writable: its value, set by its owner's code, delivered through the host's batch. */
21
+ export declare class WritableSource<T> extends FollowedSource<T> implements Writable<T> {
22
+ #private;
23
+ constructor(initial: T, owner: WritableOwner, batch: Batch);
24
+ get value(): T;
25
+ set(value: T): void;
26
+ /**
27
+ * Its attempt ended with `error`: its watches end `ended`, `set` throws `error`, its value stays readable; it keeps
28
+ * neither its attempt nor the host.
29
+ */
30
+ detach(error: Error): void;
31
+ }
32
+ //# sourceMappingURL=writable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writable.d.ts","sourceRoot":"","sources":["../../src/state/writable.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK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CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,KAAQ;QACX,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,SAAS,CAAC,IAAI,KAAK,OAAO;YAAE,MAAM,SAAS,CAAC,KAAK,CAAC;QACtD,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;QAC/B,qFAAqF;QACrF,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAM,CAAC;QAC1B,KAAK,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,KAAQ,EAAE,KAAY,EAAE,OAAgB;QAC/C,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,OAAO,EAAE,CAAC;QAChB,CAAC,EAAE,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KAAY;QAClB,sFAAsF;QACtF,KAAK,KAAK,CAAC,KAAK,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC3C,IAAI,CAAC,GAAG,EAAE,CAAC;IACZ,CAAC;CACD","sourcesContent":["// Writables (slice 8 §2, design §17): `self.writable(initial)`, an in-process value its attempt sets, identity\n// compared; a contribution, a derive source and an `on` source, never a state member.\n\nimport type { Context } from \"../context/index.ts\";\nimport type { NativeWatchable } from \"../watch.ts\";\nimport type { Batch } from \"./batch.ts\";\nimport { FollowedSource } from \"./native-source.ts\";\n\n/** An in-process value that changes when its owner sets it; `set` of the same value notifies nobody. */\nexport interface Writable<T> extends NativeWatchable<T> {\n\t/**\n\t * Sets the value: a new value (by identity) is a new frame for its watches and marks the derives and registry\n\t * tables reading it, in the batch running now or in one of its own. Throws `released` once its attempt ended, and\n\t * `invalid/reentrant` inside a derive compute or a `compose`.\n\t */\n\tset(value: T): void;\n}\n\n/** Who owns a writable: the context its own batches run in, and the check that its attempt still runs. */\nexport type WritableOwner = {\n\treadonly context: Context;\n\t/** Throws `released` once the attempt that made it was sealed. */\n\tassertUsable(): void;\n};\n\n/** Whom a writable belongs to: its running attempt, or nothing once that attempt ended (its error kept). */\ntype Ownership =\n\t| { readonly kind: \"owned\"; readonly owner: WritableOwner }\n\t| { readonly kind: \"ended\"; readonly error: Error };\n\n/** A writable: its value, set by its owner's code, delivered through the host's batch. */\nexport class WritableSource<T> extends FollowedSource<T> implements Writable<T> {\n\t#value: T;\n\t#ownership: Ownership;\n\n\tconstructor(initial: T, owner: WritableOwner, batch: Batch) {\n\t\tsuper(batch);\n\t\tthis.#value = initial;\n\t\tthis.#ownership = { kind: \"owned\", owner };\n\t}\n\n\tget value(): T {\n\t\treturn this.#value;\n\t}\n\n\tset(value: T): void {\n\t\tconst ownership = this.#ownership;\n\t\tif (ownership.kind === \"ended\") throw ownership.error;\n\t\townership.owner.assertUsable();\n\t\t// The cost guard: setting the value it has costs one comparison past the seal check.\n\t\tif (value === this.#value) return;\n\t\tconst batch = this.batch!;\n\t\tbatch.assertNotComputing(\"writable.set\");\n\t\tthis.#change(value, batch, ownership.owner.context);\n\t}\n\n\t/**\n\t * Adopts `value` in the batch running now, or in one of its own. Apart from `set`: a closure there would make every\n\t * `set` allocate its context, the same value's too.\n\t */\n\t#change(value: T, batch: Batch, context: Context): void {\n\t\tbatch.within(() => {\n\t\t\tthis.#value = value;\n\t\t\tthis.changed();\n\t\t}, context);\n\t}\n\n\t/**\n\t * Its attempt ended with `error`: its watches end `ended`, `set` throws `error`, its value stays readable; it keeps\n\t * neither its attempt nor the host.\n\t */\n\tdetach(error: Error): void {\n\t\t// Kept by `set`: its stack is made text now, so it holds none of the frames' objects.\n\t\tvoid error.stack;\n\t\tthis.#ownership = { kind: \"ended\", error };\n\t\tthis.end();\n\t}\n}\n"]}
@@ -0,0 +1,67 @@
1
+ import type { Context } from "../context/index.ts";
2
+ import type { SqliteExecutor, SqliteValue } from "../sqlite/index.ts";
3
+ import type { Claimant } from "./claims.ts";
4
+ import type { WhereNode } from "./expression.ts";
5
+ import type { EncodedRow } from "./rows.ts";
6
+ import { type Order, TableSql } from "./sql.ts";
7
+ import type { Step } from "./step.ts";
8
+ import type { ChordStore } from "./store.ts";
9
+ import type { TableDefinition } from "./table.ts";
10
+ import type { TableWrite } from "./table-writes.ts";
11
+ /** A stored row as reads decode it. */
12
+ export type DecodedRow = {
13
+ readonly [column: string]: unknown;
14
+ };
15
+ /**
16
+ * The tables of one owner name in a store: each declared once (its SQL name `"<owner>:<table>"` claimed for
17
+ * `claimant`), then prepared together (created at their newest version or migrated, as `self.table`'s are).
18
+ */
19
+ export declare class StoreOwnerTables {
20
+ #private;
21
+ readonly store: ChordStore;
22
+ readonly owner: string;
23
+ /** `owner` is a restricted name (lowercase `[a-z0-9@/._~-]`): it becomes the first part of SQL names. */
24
+ constructor(store: ChordStore, owner: string, claimant: Claimant);
25
+ /** Declares `definition` under the owner, claiming its SQL name (held by another: `invalid/args`). */
26
+ declare(definition: TableDefinition): OwnerTable;
27
+ /** Brings every declared table to its definition: created fresh, or migrated eagerly in their commits. */
28
+ prepare(context: Context): Promise<void>;
29
+ }
30
+ /** One declared table of an owner: its rows encoded and written in a step, its reads by key and by query. */
31
+ export declare class OwnerTable {
32
+ readonly definition: TableDefinition;
33
+ readonly sql: TableSql;
34
+ constructor(definition: TableDefinition, table: string);
35
+ /** `row` checked and encoded for a `put` (a trust boundary, rule 8: at staging, before the queue). */
36
+ encode(row: unknown): EncodedRow;
37
+ /**
38
+ * Writes `encoded` in `step` (an upsert) and returns the `put` as recorded; `stamp` names an `int` column that takes
39
+ * the step's seq (Durable's `entries.commit_seq`), in the row and in the record.
40
+ */
41
+ put(step: Step, encoded: EncodedRow, stamp?: string): Promise<TableWrite>;
42
+ /** The row with the key `params` (in key order), decoded. */
43
+ get(executor: Pick<SqliteExecutor, "get">, params: readonly SqliteValue[], context: Context): Promise<DecodedRow | undefined>;
44
+ /**
45
+ * A read compiled once (the store's query vocabulary rendered to SQL): `columns` of the rows `where` matches in
46
+ * `order`. The values in `where` only shape it: each is a `?` the caller binds in the order the conditions take
47
+ * them, then the limit. Adapters keep their fixed reads so: no SQL is rendered per call.
48
+ */
49
+ prepare(columns: readonly string[], where: WhereNode | undefined, order: Order): string;
50
+ /** `prepare` for the first row only: the limit is a literal `1` (a bound one costs SQLite a plan step per call). */
51
+ prepareFirst(columns: readonly string[], where: WhereNode | undefined, order: Order): string;
52
+ /**
53
+ * The version of `json(...)` column `column`: at 1 every stored cell is at 1 (none is older, a newer one fails the
54
+ * owner when its table is prepared), so a read may leave the version column out.
55
+ */
56
+ jsonVersion(column: string): number;
57
+ /** A point lookup compiled once: `columns` of the row whose key the caller binds, in key order. */
58
+ prepareGet(columns: readonly string[]): string;
59
+ /**
60
+ * The read of `json(...)` column `column`'s stored cells (`text` written at `version`, migrated on access), made
61
+ * once: an adapter selecting the cell itself reads it so.
62
+ */
63
+ reader(column: string): (text: string, version: number, context: Context) => unknown;
64
+ /** Up to `limit` rows matching `where` in `order`, decoded. */
65
+ select(executor: Pick<SqliteExecutor, "all">, where: WhereNode | undefined, order: Order, limit: number, context: Context): Promise<DecodedRow[]>;
66
+ }
67
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/store/adapter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACt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,EAC5B,KAAY,EACZ,KAAa,EACb,OAAgB;QAEhB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAClE,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAoC,SAAS,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QACzG,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,CAAC;CACD","sourcesContent":["// The store for adapters (slice 6b §2.1, D1, D2): what an owner outside Chord's objects (Durable's `StoreStorage`) uses\n// to keep its data in the store as declared tables and engine documents: its tables declared and prepared under its\n// owner name (claimed, the path `self.table` takes), rows encoded at staging and written in a step with what only the\n// step knows, and its reads. Internal for adapters; apps use `openStore` and objects.\n\nimport type { Context } from \"../context/index.ts\";\nimport { checkName } from \"../contracts/internal.ts\";\nimport type { SqliteExecutor, SqliteValue } from \"../sqlite/index.ts\";\nimport type { Claimant } from \"./claims.ts\";\nimport type { WhereNode } from \"./expression.ts\";\nimport type { EncodedRow } from \"./rows.ts\";\nimport { type Order, TableSql, tableSqlName } from \"./sql.ts\";\nimport type { Step } from \"./step.ts\";\nimport type { ChordStore } from \"./store.ts\";\nimport type { TableDefinition } from \"./table.ts\";\nimport { prepareTables } from \"./table-migration.ts\";\nimport type { TableWrite } from \"./table-writes.ts\";\n\n/** A stored row as reads decode it. */\nexport type DecodedRow = { readonly [column: string]: unknown };\n\n/**\n * The tables of one owner name in a store: each declared once (its SQL name `\"<owner>:<table>\"` claimed for\n * `claimant`), then prepared together (created at their newest version or migrated, as `self.table`'s are).\n */\nexport class StoreOwnerTables {\n\treadonly store: ChordStore;\n\treadonly owner: string;\n\treadonly #claimant: Claimant;\n\treadonly #tables: OwnerTable[] = [];\n\n\t/** `owner` is a restricted name (lowercase `[a-z0-9@/._~-]`): it becomes the first part of SQL names. */\n\tconstructor(store: ChordStore, owner: string, claimant: Claimant) {\n\t\tcheckName(owner, \"An owner name\");\n\t\tthis.store = store;\n\t\tthis.owner = owner;\n\t\tthis.#claimant = claimant;\n\t}\n\n\t/** Declares `definition` under the owner, claiming its SQL name (held by another: `invalid/args`). */\n\tdeclare(definition: TableDefinition): OwnerTable {\n\t\tconst table = new OwnerTable(definition, tableSqlName(this.owner, definition.name));\n\t\tthis.store.claims.table(table.sql.table, this.#claimant);\n\t\tthis.#tables.push(table);\n\t\treturn table;\n\t}\n\n\t/** Brings every declared table to its definition: created fresh, or migrated eagerly in their commits. */\n\tprepare(context: Context): Promise<void> {\n\t\tconst tables = this.#tables.map(({ definition, sql }) => ({ definition, table: sql.table }));\n\t\tconst fence = { admit: () => true, adopt: () => {} };\n\t\treturn prepareTables(tables, this.store, fence, this.owner, context);\n\t}\n}\n\n/** One declared table of an owner: its rows encoded and written in a step, its reads by key and by query. */\nexport class OwnerTable {\n\treadonly definition: TableDefinition;\n\treadonly sql: TableSql;\n\n\tconstructor(definition: TableDefinition, table: string) {\n\t\tthis.definition = definition;\n\t\tthis.sql = new TableSql(table, definition.columns, definition.rows.physical, definition.key);\n\t}\n\n\t/** `row` checked and encoded for a `put` (a trust boundary, rule 8: at staging, before the queue). */\n\tencode(row: unknown): EncodedRow {\n\t\treturn this.definition.rows.put(row, this.definition.version);\n\t}\n\n\t/**\n\t * Writes `encoded` in `step` (an upsert) and returns the `put` as recorded; `stamp` names an `int` column that takes\n\t * the step's seq (Durable's `entries.commit_seq`), in the row and in the record.\n\t */\n\tasync put(step: Step, encoded: EncodedRow, stamp?: string): Promise<TableWrite> {\n\t\tconst { version } = this.definition;\n\t\tconst { table } = this.sql;\n\t\tif (stamp === undefined) {\n\t\t\tawait step.run(this.sql.put, ...encoded.params);\n\t\t\treturn { kind: \"put\", table, row: encoded.row, version, columns: encoded.columns };\n\t\t}\n\t\tconst params = [...encoded.params];\n\t\tparams[this.definition.rows.physical.indexOf(stamp)] = step.seq;\n\t\tawait step.run(this.sql.put, ...params);\n\t\treturn { kind: \"put\", table, row: { ...encoded.row, [stamp]: step.seq }, version, columns: encoded.columns };\n\t}\n\n\t/** The row with the key `params` (in key order), decoded. */\n\tasync get(\n\t\texecutor: Pick<SqliteExecutor, \"get\">,\n\t\tparams: readonly SqliteValue[],\n\t\tcontext: Context,\n\t): Promise<DecodedRow | undefined> {\n\t\tconst stored = await executor.get<{ [column: string]: SqliteValue }>(this.sql.get, ...params);\n\t\treturn stored === undefined ? undefined : this.definition.rows.decode(stored, context);\n\t}\n\n\t/**\n\t * A read compiled once (the store's query vocabulary rendered to SQL): `columns` of the rows `where` matches in\n\t * `order`. The values in `where` only shape it: each is a `?` the caller binds in the order the conditions take\n\t * them, then the limit. Adapters keep their fixed reads so: no SQL is rendered per call.\n\t */\n\tprepare(columns: readonly string[], where: WhereNode | undefined, order: Order): string {\n\t\treturn this.sql.select(where, order, undefined, 0, columns).sql;\n\t}\n\n\t/** `prepare` for the first row only: the limit is a literal `1` (a bound one costs SQLite a plan step per call). */\n\tprepareFirst(columns: readonly string[], where: WhereNode | undefined, order: Order): string {\n\t\treturn this.sql.select(where, order, undefined, 1, columns).sql.replace(/LIMIT \\?$/, \"LIMIT 1\");\n\t}\n\n\t/**\n\t * The version of `json(...)` column `column`: at 1 every stored cell is at 1 (none is older, a newer one fails the\n\t * owner when its table is prepared), so a read may leave the version column out.\n\t */\n\tjsonVersion(column: string): number {\n\t\tconst found = this.definition.column(column, \"jsonVersion\");\n\t\tif (found.type !== \"json\") throw new Error(`${this.definition.name}: column \"${column}\" is no json(...) column`);\n\t\treturn found.json.version;\n\t}\n\n\t/** A point lookup compiled once: `columns` of the row whose key the caller binds, in key order. */\n\tprepareGet(columns: readonly string[]): string {\n\t\treturn this.sql.getColumns(columns);\n\t}\n\n\t/**\n\t * The read of `json(...)` column `column`'s stored cells (`text` written at `version`, migrated on access), made\n\t * once: an adapter selecting the cell itself reads it so.\n\t */\n\treader(column: string): (text: string, version: number, context: Context) => unknown {\n\t\tconst found = this.definition.column(column, \"reader\");\n\t\tif (found.type !== \"json\") throw new Error(`${this.definition.name}: column \"${column}\" is no json(...) column`);\n\t\t// At version 1 a cell is the JSON it was written as: no version to compare, nothing to migrate.\n\t\tif (found.json.version === 1) return (text) => JSON.parse(text) as unknown;\n\t\tconst what = `${this.sql.table}.${column}`;\n\t\treturn (text, version, context) => found.json.read(text, version, what, context);\n\t}\n\n\t/** Up to `limit` rows matching `where` in `order`, decoded. */\n\tasync select(\n\t\texecutor: Pick<SqliteExecutor, \"all\">,\n\t\twhere: WhereNode | undefined,\n\t\torder: Order,\n\t\tlimit: number,\n\t\tcontext: Context,\n\t): Promise<DecodedRow[]> {\n\t\tconst statement = this.sql.select(where, order, undefined, limit);\n\t\tconst stored = await executor.all<{ [column: string]: SqliteValue }>(statement.sql, ...statement.params);\n\t\treturn stored.map((row) => this.definition.rows.decode(row, context));\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allocator.d.ts","sourceRoot":"","sources":["../../src/store/allocator.ts"],"names":[],"mappings":"AAGA,6EAA6E;AAC7E,eAAO,MAAM,QAAQ,IAAI,CAAC;AAE1B;;;GAGG;AACH,qBAAa,WAAW;;IAGvB,YAAY,IAAI,EAAE,MAAM,EAEvB;IAED,2DAA2D;IAC3D,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,4FAA4F;IAC5F,IAAI,IAAI,MAAM,CAGb;IAED,iGAAiG;IACjG,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAEtB;CACD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allocator.js","sourceRoot":"","sources":["../../src/store/allocator.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,+FAA+F;AAE/F,6EAA6E;AAC7E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAE1B;;;GAGG;AACH,MAAM,OAAO,WAAW;IACvB,KAAK,CAAS;IAEd,YAAY,IAAY;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,2DAA2D;IAC3D,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,4FAA4F;IAC5F,IAAI;QACH,IAAI,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,gBAAgB;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED,iGAAiG;IACjG,KAAK,CAAC,EAAU;QACf,IAAI,EAAE,IAAI,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC9E,CAAC;CACD","sourcesContent":["// The store's id allocator (slice 6b D3, §1.2): one counter for every id in the store (Durable's `mintId`, Chord's\n// document ids), synchronous, raised by explicit ids, saturating at `Number.MAX_SAFE_INTEGER`.\n\n/** The first id the allocator gives: id 1 is Durable's root conversation. */\nexport const FIRST_ID = 2;\n\n/**\n * The allocator: `value` is the next id it gives. An id raised to `Number.MAX_SAFE_INTEGER` is accepted, the value\n * stays there, and every later `mint` throws: no id past the safe range (it would stop counting exactly and repeat).\n */\nexport class IdAllocator {\n\t#next: number;\n\n\tconstructor(next: number) {\n\t\tthis.#next = next;\n\t}\n\n\t/** The next id `mint` gives; what each commit persists. */\n\tget value(): number {\n\t\treturn this.#next;\n\t}\n\n\t/** Takes the next id; throws \"ID space is exhausted\" once saturated (Durable's message). */\n\tmint(): number {\n\t\tif (this.#next >= Number.MAX_SAFE_INTEGER) throw new Error(\"ID space is exhausted\");\n\t\treturn this.#next++;\n\t}\n\n\t/** Raises the counter above `id`, an id written explicitly (Durable mints ahead), saturating. */\n\traise(id: number): void {\n\t\tif (id >= this.#next) this.#next = Math.min(id + 1, Number.MAX_SAFE_INTEGER);\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applier.d.ts","sourceRoot":"","sources":["../../src/store/applier.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,qHAAqH;AACrH,qBAAa,QAAS,SAAQ,KAAK;CAAG;AAEtC,yHAAyH;AACzH,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC3F"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applier.js","sourceRoot":"","sources":["../../src/store/applier.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,mHAAmH;AACnH,kHAAkH;AAClH,oCAAoC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAC;AAC9D,OAAO,EAIN,cAAc,EACd,cAAc,EAEd,YAAY,EACZ,YAAY,EACZ,YAAY,GACZ,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAmC,MAAM,mBAAmB,CAAC;AAGxH,qHAAqH;AACrH,MAAM,OAAO,QAAS,SAAQ,KAAK;CAAG;AAEtC,yHA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K,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YAClE,SAAS;QACV,CAAC;QACD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,GAAG,MAAM,CAAC,OAAQ;YAAE,MAAM,OAAO,CAAC,MAAM,EAAE,GAAG,KAAK,uBAAuB,CAAC,CAAC;QAC/G,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACpC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;AAC7F,CAAC","sourcesContent":["// The applier (slice 6a §13, slice 6b §1.6): recorded writes applied as they were recorded, inside a backend\n// transaction, checked against the store's own records (a trust boundary: archives, a replica's batches). One code\n// path for import, bootstrap and batch apply, for every write kind; a recorded count the store does not reproduce\n// stops applying (`Diverged`, S17).\n\nimport { checkName } from \"../contracts/internal.ts\";\nimport { invalid } from \"../data/internal.ts\";\nimport type { SqliteValue } from \"../sqlite/index.ts\";\nimport type { TableRecord } from \"./catalog.ts\";\nimport { COLUMN_NAME, type ColumnRecord } from \"./columns.ts\";\nimport {\n\ttype DocumentContent,\n\ttype DocumentRecord,\n\ttype DocumentWrite,\n\tinsertDocument,\n\tinsertRevision,\n\ttype RevisionContent,\n\treadDocument,\n\tretireRecord,\n\twriteContent,\n} from \"./engine.ts\";\nimport type { ExprNode, SetNode, WhereNode } from \"./expression.ts\";\nimport { checkScalar, ROW_VERSION, toSqlite, versionColumn } from \"./rows.ts\";\nimport { recordedPut, TableSql } from \"./sql.ts\";\nimport type { Step } from \"./step.ts\";\nimport { INDEX_NAME } from \"./table.ts\";\nimport { applyAlter, applyDropIndex, applyIndex, applyTable, type StoredKey, type TableWrite } from \"./table-writes.ts\";\nimport type { StoreWrite } from \"./writes.ts\";\n\n/** A recorded write the store does not reproduce (a count, a revision): applying stops, the store diverged (S17). */\nexport class Diverged extends Error {}\n\n/** Applies `write` in `step`; a write the records refuse throws `invalid/args`, one they do not reproduce `Diverged`. */\nexport async function applyWrite(step: Step, write: StoreWrite, what: string): Promise<void> {\n\tswitch (write.kind) {\n\t\tcase \"table\":\n\t\t\tcheckTable(write, what);\n\t\t\tawait applyTable(step, write);\n\t\t\treturn;\n\t\tcase \"index\":\n\t\t\tcheckIndex(recordOf(step, write.table, what), write, what);\n\t\t\tawait applyIndex(step, write);\n\t\t\treturn;\n\t\tcase \"dropIndex\":\n\t\t\tif (!Object.hasOwn(recordOf(step, write.table, what).indexes, write.name)) {\n\t\t\t\tthrow invalid(\"args\", `${what}: no index ${JSON.stringify(write.name)}`);\n\t\t\t}\n\t\t\tawait applyDropIndex(step, write);\n\t\t\treturn;\n\t\tcase \"alter\":\n\t\t\tcheckAlter(recordOf(step, write.table, what), write, what);\n\t\t\tawait applyAlter(step, write);\n\t\t\treturn;\n\t\tcase \"put\": {\n\t\t\tconst record = recordOf(step, write.table, what);\n\t\t\tconst { sql, physical } = recordedPut(write.table, record.columns);\n\t\t\tawait step.run(sql, ...putParams(record, write, physical, what));\n\t\t\treturn;\n\t\t}\n\t\tcase \"update\":\n\t\tcase \"delete\":\n\t\tcase \"updateWhere\":\n\t\tcase \"deleteWhere\":\n\t\t\treturn applyCounted(step, write, what);\n\t\tdefault:\n\t\t\treturn applyDocument(step, write, what);\n\t}\n}\n\n/** Applies a document write: a creation, a change or a retirement on its recorded revision, an archive's revision. */\nasync function applyDocument(step: Step, write: DocumentWrite, what: string): Promise<void> {\n\tswitch (write.kind) {\n\t\tcase \"document.create\":\n\t\t\tawait insertDocument(step, write.record, write.base === undefined ? undefined : json(write.base.value, what));\n\t\t\treturn;\n\t\tcase \"document.revision\": {\n\t\t\tconst { content } = write;\n\t\t\tawait insertRevision(step, write.id, write.seq, content.kind, content.version, contentText(content, what));\n\t\t\treturn;\n\t\t}\n\t\tcase \"document.change\": {\n\t\t\tconst record = await liveAt(step, write.id, write.revision, what);\n\t\t\tconst { content } = write;\n\t\t\tconst text = contentText(content, what);\n\t\t\tawait writeContent(step, write.id, record.history, write.revision, content, text);\n\t\t\treturn;\n\t\t}\n\t\tcase \"document.retire\":\n\t\t\tawait retireRecord(step, await liveAt(step, write.id, write.revision, what));\n\t\t\treturn;\n\t}\n}\n\n/** A content's stored text: a base's value or a delta's ops, checked as JSON. */\nfunction contentText(content: DocumentContent | RevisionContent, what: string): string {\n\treturn json(content.kind === \"base\" ? content.value : content.ops, what);\n}\n\n/** The live record `id` at `revision`; another revision, or none, is a divergence. */\nasync function liveAt(step: Step, id: number, revision: number, what: string): Promise<DocumentRecord> {\n\tconst record = await readDocument(step, id);\n\tif (record === undefined || record.retiredAt !== undefined || record.revision !== revision) {\n\t\tthrow new Diverged(`${what}: document ${id} is not live at revision ${revision}`);\n\t}\n\treturn record;\n}\n\n/** `value` serialized; one `JSON.stringify` cannot encode is refused. */\nfunction json(value: unknown, what: string): string {\n\tlet text: string | undefined;\n\ttry {\n\t\ttext = JSON.stringify(value);\n\t} catch (error) {\n\t\tthrow invalid(\"args\", `${what}: not JSON (${String(error)})`);\n\t}\n\tif (text === undefined) throw invalid(\"args\", `${what}: not JSON`);\n\treturn text;\n}\n\n/**\n * Applies a counted table write: its statement rendered from the record's columns and the recorded `key`, `where` and\n * `set` (checked: only recorded columns, well-formed nodes), and its count compared with the recorded one.\n */\nasync function applyCounted(\n\tstep: Step,\n\twrite: Extract<TableWrite, { readonly kind: \"update\" | \"delete\" | \"updateWhere\" | \"deleteWhere\" }>,\n\twhat: string,\n): Promise<void> {\n\tconst record = recordOf(step, write.table, what);\n\tconst columns = Object.entries(record.columns).map(([name, column]) => ({ name, type: column.type }));\n\tconst sql = new TableSql(write.table, columns, [], record.key);\n\tlet statement: { readonly sql: string; readonly params: SqliteValue[] };\n\tswitch (write.kind) {\n\t\tcase \"update\":\n\t\t\tstatement = sql.update(\n\t\t\t\tsetOf(record, write, what),\n\t\t\t\tkeyParams(record, write.key, what),\n\t\t\t\tversionsOf(record, write, what),\n\t\t\t);\n\t\t\tbreak;\n\t\tcase \"delete\":\n\t\t\tstatement = { sql: sql.delete, params: keyParams(record, write.key, what) };\n\t\t\tbreak;\n\t\tcase \"updateWhere\":\n\t\t\tcheckWhere(record, write.where, what);\n\t\t\tstatement = sql.updateWhere(write.where, setOf(record, write, what), versionsOf(record, write, what));\n\t\t\tbreak;\n\t\tcase \"deleteWhere\":\n\t\t\tcheckWhere(record, write.where, what);\n\t\t\tstatement = sql.deleteWhere(write.where);\n\t\t\tbreak;\n\t}\n\tconst count = await step.runCounted(statement.sql, ...statement.params);\n\tif (count !== write.count) throw new Diverged(`${what}: changed ${count} rows, recorded ${write.count}`);\n}\n\n/** The recorded key as parameters in key order: exactly the key columns, each of its type. */\nfunction keyParams(record: TableRecord, key: StoredKey, what: string): SqliteValue[] {\n\tif (Object.keys(key).length !== record.key.length) throw invalid(\"args\", `${what}: not a key of ${record.table}`);\n\treturn record.key.map((name) => {\n\t\tif (!Object.hasOwn(key, name)) throw invalid(\"args\", `${what}: key column ${JSON.stringify(name)} is missing`);\n\t\treturn toSqlite(checkScalar(scalarType(record.columns[name]!), key[name], `${what}: key`));\n\t});\n}\n\n/** A recorded `set` with the migration stamp `$v` when it carries one; key columns never change (rule 13). */\nfunction setOf(\n\trecord: TableRecord,\n\twrite: Extract<TableWrite, { readonly kind: \"update\" | \"updateWhere\" }>,\n\twhat: string,\n): SetNode {\n\tconst { set } = write;\n\tif (typeof set !== \"object\" || set === null || Object.keys(set).length === 0) {\n\t\tthrow invalid(\"args\", `${what}: an empty or malformed set`);\n\t}\n\tfor (const [column, node] of Object.entries(set)) {\n\t\tif (!Object.hasOwn(record.columns, column) || record.key.includes(column)) {\n\t\t\tthrow invalid(\"args\", `${what}: set writes ${JSON.stringify(column)}, no non-key column`);\n\t\t}\n\t\tcheckExpr(record, node, what);\n\t}\n\treturn write.version === undefined ? set : { ...set, [ROW_VERSION]: write.version };\n}\n\n/** The `json(...)` versions a `set` stamps: the recorded ones, of `json(...)` columns it sets, up to theirs. */\nfunction versionsOf(\n\trecord: TableRecord,\n\twrite: Extract<TableWrite, { readonly kind: \"update\" | \"updateWhere\" }>,\n\twhat: string,\n): Map<string, number> {\n\tconst versions = new Map<string, number>();\n\tfor (const [name, column] of Object.entries(record.columns)) {\n\t\tif (column.type !== \"json\" || !Object.hasOwn(write.set, name)) continue;\n\t\t// A clear stamps `NULL` whatever the version; a value stamps its recorded version.\n\t\tconst version = write.columns[name] ?? column.version!;\n\t\tif (!Number.isSafeInteger(version) || version < 1 || version > column.version!) {\n\t\t\tthrow invalid(\"args\", `${what}: no readable version for ${JSON.stringify(name)}`);\n\t\t}\n\t\tversions.set(name, version);\n\t}\n\treturn versions;\n}\n\n/** A scalar column's type; `json(...)` columns are not scalars. */\nfunction scalarType(column: ColumnRecord): \"str\" | \"int\" | \"num\" | \"bool\" {\n\treturn column.type === \"json\" ? \"str\" : column.type;\n}\n\nconst COMPARISONS = [\"eq\", \"ne\", \"lt\", \"lte\", \"gt\", \"gte\"] as const;\n\n/** A recorded condition: well-formed nodes over recorded scalar columns (and the row's `$v`). */\nfunction checkWhere(record: TableRecord, node: unknown, what: string): asserts node is WhereNode {\n\tconst refuse = (): never => {\n\t\tthrow invalid(\"args\", `${what}: a malformed condition`);\n\t};\n\tif (typeof node !== \"object\" || node === null || Object.keys(node).length !== 1) return refuse();\n\tconst [[op, operand]] = Object.entries(node) as [[string, unknown]];\n\tconst column = (name: unknown): void => {\n\t\tif (name === ROW_VERSION) return;\n\t\tif (typeof name !== \"string\" || record.columns[name] === undefined || record.columns[name]!.type === \"json\") {\n\t\t\trefuse();\n\t\t}\n\t};\n\tif (op === \"and\" || op === \"or\") {\n\t\tif (!Array.isArray(operand)) return refuse();\n\t\tfor (const each of operand) checkWhere(record, each, what);\n\t} else if (op === \"not\") checkWhere(record, operand, what);\n\telse if (op === \"isNull\") column(operand);\n\telse if (op === \"inArray\" || op === \"prefix\" || (COMPARISONS as readonly string[]).includes(op)) {\n\t\tif (!Array.isArray(operand) || operand.length !== 2) return refuse();\n\t\tcolumn(operand[0]);\n\t\tconst values = op === \"inArray\" ? operand[1] : [operand[1]];\n\t\tif (!Array.isArray(values)) return refuse();\n\t\tfor (const value of values) if (!isScalar(value) || (op === \"prefix\" && typeof value !== \"string\")) refuse();\n\t} else refuse();\n}\n\nconst OPERATIONS = [\"add\", \"sub\", \"max\", \"min\", \"concat\", \"coalesce\"] as const;\n\n/** A recorded expression: scalars, `null`, JSON literals, recorded columns and the vocabulary's operations. */\nfunction checkExpr(record: TableRecord, node: unknown, what: string): asserts node is ExprNode {\n\tif (node === null || isScalar(node)) return;\n\tconst refuse = (): never => {\n\t\tthrow invalid(\"args\", `${what}: a malformed expression`);\n\t};\n\tif (typeof node !== \"object\" || Object.keys(node).length !== 1) return refuse();\n\tconst [[op, operand]] = Object.entries(node) as [[string, unknown]];\n\tif (op === \"col\") {\n\t\tif (typeof operand !== \"string\" || !Object.hasOwn(record.columns, operand)) refuse();\n\t\treturn;\n\t}\n\tif (op === \"json\") return;\n\tif (!Array.isArray(operand)) return refuse();\n\tif ((OPERATIONS as readonly string[]).includes(op) && operand.length === 2) {\n\t\tfor (const each of operand) checkExpr(record, each, what);\n\t} else if (op === \"replacePrefix\" && operand.length === 3) {\n\t\tcheckExpr(record, operand[0], what);\n\t\tif (typeof operand[1] !== \"string\" || typeof operand[2] !== \"string\") refuse();\n\t} else if (op === \"when\" && operand.length === 3) {\n\t\tcheckWhere(record, operand[0], what);\n\t\tcheckExpr(record, operand[1], what);\n\t\tcheckExpr(record, operand[2], what);\n\t} else refuse();\n}\n\nfunction isScalar(value: unknown): boolean {\n\treturn (\n\t\ttypeof value === \"string\" || typeof value === \"boolean\" || (typeof value === \"number\" && Number.isFinite(value))\n\t);\n}\n\n/** A recorded table's SQL name (two names joined by `:`, R2), columns, key and json versions, by the name rules. */\nfunction checkTable(write: Extract<TableWrite, { readonly kind: \"table\" }>, what: string): void {\n\tconst parts = write.table.split(\":\");\n\tif (parts.length !== 2) throw invalid(\"args\", `${what}: table ${JSON.stringify(write.table)}: not owner:table`);\n\ttry {\n\t\tfor (const part of parts) checkName(part, `${what}: table name part`);\n\t} catch (error) {\n\t\t// `checkName` throws plain Errors.\n\t\tthrow invalid(\"args\", (error as Error).message);\n\t}\n\tconst folded = new Set<string>();\n\tfor (const [name, column] of Object.entries(write.columns)) {\n\t\tconst where = `${what}: column ${JSON.stringify(name)}`;\n\t\tif (!COLUMN_NAME.test(name) || folded.has(name.toLowerCase()))\n\t\t\tthrow invalid(\"args\", `${where}: not a column name`);\n\t\tfolded.add(name.toLowerCase());\n\t\tcheckColumn(column, where);\n\t}\n\tif (write.key.length === 0) throw invalid(\"args\", `${what}: the key has no column`);\n\tcheckOrderColumns(write.columns, write.key, `${what}: the key`);\n}\n\nfunction checkColumn(column: ColumnRecord, what: string): void {\n\tconst json = column.type === \"json\";\n\tif (json !== (column.version !== undefined) || json !== (column.fingerprint !== undefined)) {\n\t\tthrow invalid(\"args\", `${what}: a json(...) column has a version and a fingerprint, no other column has`);\n\t}\n\tif (column.default === undefined) return;\n\tif (json || column.optional) throw invalid(\"args\", `${what}: only a non-opt scalar column has a default`);\n\tcheckScalar(column.type, column.default, `${what}: the default`);\n}\n\n/** A recorded column edit of `record`'s next version or its own (the edits after a data step). */\nfunction checkAlter(record: TableRecord, write: Extract<TableWrite, { readonly kind: \"alter\" }>, what: string): void {\n\tif (write.version !== record.version && write.version !== record.version + 1) {\n\t\tthrow invalid(\"args\", `${what}: an edit of version ${write.version} on version ${record.version}`);\n\t}\n\tconst { edit } = write;\n\tconst has = (name: string): boolean => Object.hasOwn(record.columns, name);\n\tconst fresh = (name: string): boolean =>\n\t\tCOLUMN_NAME.test(name) && !Object.keys(record.columns).some((each) => each.toLowerCase() === name.toLowerCase());\n\tconst indexed = (name: string): boolean =>\n\t\trecord.key.includes(name) || Object.values(record.indexes).some((columns) => columns.includes(name));\n\tconst valid =\n\t\tedit.kind === \"rename\"\n\t\t\t? has(edit.from) && fresh(edit.to)\n\t\t\t: edit.kind === \"add\"\n\t\t\t\t? fresh(edit.name) && (edit.column.optional === true || edit.column.default !== undefined)\n\t\t\t\t: edit.kind === \"drop\"\n\t\t\t\t\t? has(edit.name) && !indexed(edit.name)\n\t\t\t\t\t: has(edit.name) && record.columns[edit.name]!.type === \"json\" && edit.column.type === \"json\";\n\tif (!valid) throw invalid(\"args\", `${what}: an ${edit.kind} edit the table cannot take`);\n\tif (edit.kind === \"add\" || edit.kind === \"json\")\n\t\tcheckColumn(edit.column, `${what}: column ${JSON.stringify(edit.name)}`);\n}\n\n/** `names` are distinct, recorded, non-`opt` `str` or `int` columns. */\nfunction checkOrderColumns(\n\tcolumns: { readonly [name: string]: ColumnRecord },\n\tnames: readonly string[],\n\twhat: string,\n): void {\n\tif (new Set(names).size !== names.length) throw invalid(\"args\", `${what}: a column occurs twice`);\n\tfor (const name of names) {\n\t\tconst column = Object.hasOwn(columns, name) ? columns[name] : undefined;\n\t\tif (column === undefined || column.optional || (column.type !== \"str\" && column.type !== \"int\")) {\n\t\t\tthrow invalid(\"args\", `${what}: ${JSON.stringify(name)} is not a non-opt str or int column`);\n\t\t}\n\t}\n}\n\nfunction checkIndex(record: TableRecord, write: Extract<TableWrite, { readonly kind: \"index\" }>, what: string): void {\n\tif (!INDEX_NAME.test(write.name) || Object.hasOwn(record.indexes, write.name)) {\n\t\tthrow invalid(\"args\", `${what}: index ${JSON.stringify(write.name)}: not a new index name`);\n\t}\n\tcheckOrderColumns(record.columns, write.columns, `${what}: index ${write.name}`);\n}\n\n/** The record of `table` in `step`; a write for a table not recorded is refused. */\nfunction recordOf(step: Step, table: string, what: string): TableRecord {\n\tconst record = step.table(table);\n\tif (record === undefined) throw invalid(\"args\", `${what}: table ${JSON.stringify(table)} is not recorded`);\n\treturn record;\n}\n\n/**\n * The parameters of a `put` in `physical` order, checked against the recorded columns: every non-`opt` column, no\n * other field, values of their types, `json(...)` cells as JSON (no plugin code runs) with a version up to the\n * column's, and `version` up to the table's.\n */\nfunction putParams(\n\trecord: TableRecord,\n\twrite: Extract<TableWrite, { readonly kind: \"put\" }>,\n\tphysical: readonly string[],\n\twhat: string,\n): SqliteValue[] {\n\tconst { row, columns: versions, version } = write;\n\tfor (const field of Object.keys(row)) {\n\t\tif (!Object.hasOwn(record.columns, field))\n\t\t\tthrow invalid(\"args\", `${what}: unknown column ${JSON.stringify(field)}`);\n\t}\n\tfor (const field of Object.keys(versions)) {\n\t\tif (record.columns[field]?.type !== \"json\" || !Object.hasOwn(row, field)) {\n\t\t\tthrow invalid(\n\t\t\t\t\"args\",\n\t\t\t\t`${what}: a version for ${JSON.stringify(field)}, which is no json(...) cell of the row`,\n\t\t\t);\n\t\t}\n\t}\n\tif (version > record.version) {\n\t\tthrow invalid(\"args\", `${what}: version ${version} is newer than the table's version ${record.version}`);\n\t}\n\tconst cells = new Map<string, SqliteValue>();\n\tfor (const [name, column] of Object.entries(record.columns)) {\n\t\tconst where = `${what}: column ${JSON.stringify(name)}`;\n\t\tconst value = row[name];\n\t\t// A row has no explicit `null`: an absent field is `NULL`; a `json(...)` cell's `null` is the JSON value.\n\t\tif (column.type === \"json\" ? !Object.hasOwn(row, name) : value === undefined) {\n\t\t\tif (!column.optional) throw invalid(\"args\", `${where} is missing`);\n\t\t\tcells.set(name, null);\n\t\t\tcontinue;\n\t\t}\n\t\tif (column.type !== \"json\") {\n\t\t\tcells.set(name, toSqlite(checkScalar(column.type, value, where)));\n\t\t\tcontinue;\n\t\t}\n\t\tconst version = versions[name];\n\t\tif (version === undefined || version > column.version!) throw invalid(\"args\", `${where}: no readable version`);\n\t\tcells.set(name, json(value, where));\n\t\tcells.set(versionColumn(name), version);\n\t}\n\treturn physical.map((name) => (name === ROW_VERSION ? version : (cells.get(name) ?? null)));\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import type { Context } from "../context/index.ts";
2
+ import { type OutboxCommit } from "./outbox.ts";
3
+ import type { ChordStore } from "./store.ts";
4
+ /**
5
+ * Applies `commits` (from an outbox, in seq order) to `store`: refused while an owner holds a claim on it, once it
6
+ * diverged, or when the first commit does not follow its `lastSeq` or one does not follow the one before; a write the
7
+ * store's records refuse rolls the whole batch back (`invalid/args`); a recorded count the store does not reproduce
8
+ * rolls it back and marks the store diverged, so every later batch is refused. Commits written to the store's outbox
9
+ * too when it has one.
10
+ */
11
+ export declare function applyBatch(store: ChordStore, commits: readonly OutboxCommit[], context: Context): Promise<void>;
12
+ //# sourceMappingURL=apply-batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-batch.d.ts","sourceRoot":"","sources":["../../src/store/apply-batch.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAOnD,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,YAAY,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAW/G"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-batch.js","sourceRoot":"","sources":["../../src/store/apply-batch.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,iHAAiH;AACjH,2GAA2G;AAG3G,OAAO,EAAE,OA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AAE,OAAO,EAAE,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,SAAS,YAAY,CAAC,EAAU,EAAE,MAAc,EAAE,IAAY;IAC7D,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,gBAAgB,IAAI,EAAE,KAAK,MAAM,CAAC;QAAE,OAAO;IACjF,MAAM,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,QAAQ,EAAE,sCAAsC,MAAM,EAAE,CAAC,CAAC;AACxF,CAAC","sourcesContent":["// Batch apply (slice 6b §1.6, S5, S17): a replica takes commits `from..to` as an outbox gave them, in one backend\n// transaction through the store's commit queue, each write applied with its commit's seq by the applier (a trust\n// boundary), `lastSeq` and the allocator set from the last commit. Internal: the sync layer's entry point.\n\nimport type { Context } from \"../context/index.ts\";\nimport { invalid } from \"../data/internal.ts\";\nimport type { SqliteExecutor } from \"../sqlite/index.ts\";\nimport { IdAllocator } from \"./allocator.ts\";\nimport { applyWrite, Diverged } from \"./applier.ts\";\nimport { checkWrite } from \"./archive.ts\";\nimport { type TableRecord, writeCatalog } from \"./catalog.ts\";\nimport { OUTBOX_FORMAT, type OutboxCommit } from \"./outbox.ts\";\nimport { TABLES } from \"./schema.ts\";\nimport { Step } from \"./step.ts\";\nimport type { ChordStore, Replayed } from \"./store.ts\";\n\n/**\n * Applies `commits` (from an outbox, in seq order) to `store`: refused while an owner holds a claim on it, once it\n * diverged, or when the first commit does not follow its `lastSeq` or one does not follow the one before; a write the\n * store's records refuse rolls the whole batch back (`invalid/args`); a recorded count the store does not reproduce\n * rolls it back and marks the store diverged, so every later batch is refused. Commits written to the store's outbox\n * too when it has one.\n */\nexport function applyBatch(store: ChordStore, commits: readonly OutboxCommit[], context: Context): Promise<void> {\n\tlet checked: OutboxCommit[];\n\ttry {\n\t\tchecked = commits.map((commit, index) => checkCommit(commit, `batch: commit ${index}`, context));\n\t} catch (error) {\n\t\treturn Promise.reject(error);\n\t}\n\treturn store.replay(\n\t\t(executor, catalog) => replay(store, checked, executor, catalog),\n\t\t(error) => error instanceof Diverged,\n\t);\n}\n\n/** One commit's envelope and writes, checked (a trust boundary). */\nfunction checkCommit(commit: OutboxCommit, what: string, context: Context): OutboxCommit {\n\tconst { seq, nextId, writes } = commit as Partial<OutboxCommit>;\n\tif (!Number.isSafeInteger(seq) || !Number.isSafeInteger(nextId) || !Array.isArray(writes)) {\n\t\tthrow invalid(\"args\", `${what}: not an outbox commit`);\n\t}\n\treturn {\n\t\tseq: seq!,\n\t\tnextId: nextId!,\n\t\twrites: writes.map((write, index) => checkWrite(write, `${what}: write ${index}`, context)),\n\t};\n}\n\n/** The batch inside the store's turn: seqs continuous from `lastSeq`, allocator values never falling. */\nasync function replay(\n\tstore: ChordStore,\n\tcommits: readonly OutboxCommit[],\n\texecutor: SqliteExecutor,\n\tcatalog: ReadonlyMap<string, TableRecord>,\n): Promise<Replayed> {\n\tconst tables = new Map(catalog);\n\tconst changed = new Map<string, TableRecord>();\n\tlet lastSeq = store.lastSeq;\n\tlet nextId = store.nextId;\n\tfor (const [index, commit] of commits.entries()) {\n\t\tconst what = `batch: commit ${index} (seq ${commit.seq})`;\n\t\tif (commit.seq !== lastSeq + 1) throw invalid(\"args\", `${what}: does not follow seq ${lastSeq}`);\n\t\tif (commit.nextId < nextId) throw invalid(\"args\", `${what}: its next id ${commit.nextId} is below ${nextId}`);\n\t\tconst step = new Step(executor, commit.seq, new IdAllocator(commit.nextId), tables);\n\t\tfor (const [position, write] of commit.writes.entries()) {\n\t\t\tconst where = `${what}: write ${position} (${write.kind})`;\n\t\t\tif (write.kind === \"document.create\") checkCreated(write.record.id, commit.nextId, where);\n\t\t\tawait applyWrite(step, write, where);\n\t\t}\n\t\tawait writeCatalog(step);\n\t\tfor (const [name, record] of step.tables) {\n\t\t\ttables.set(name, record);\n\t\t\tchanged.set(name, record);\n\t\t}\n\t\tif (store.recordsOutbox) {\n\t\t\tawait executor.run(\n\t\t\t\t`INSERT INTO ${TABLES.outbox} (seq, format, next_id, writes) VALUES (?, ?, ?, ?)`,\n\t\t\t\tcommit.seq,\n\t\t\t\tOUTBOX_FORMAT,\n\t\t\t\tcommit.nextId,\n\t\t\t\tJSON.stringify(commit.writes),\n\t\t\t);\n\t\t}\n\t\tlastSeq = commit.seq;\n\t\tnextId = commit.nextId;\n\t}\n\tawait executor.run(`UPDATE ${TABLES.meta} SET last_seq = ?, next_id = ? WHERE singleton = 1`, lastSeq, nextId);\n\treturn { lastSeq, nextId, tables: changed };\n}\n\n/**\n * A created document's id is below its commit's next id (the allocator never mints it again), or equal to a saturated\n * next id (`Number.MAX_SAFE_INTEGER` may be written, as import allows).\n */\nfunction checkCreated(id: number, nextId: number, what: string): void {\n\tif (id < nextId || (nextId === Number.MAX_SAFE_INTEGER && id === nextId)) return;\n\tthrow invalid(\"args\", `${what}: id ${id} is not below the commit's next id ${nextId}`);\n}\n"]}