@earendil-works/chord 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (820) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +79 -14
  3. package/dist/cell.d.ts +7 -7
  4. package/dist/cell.d.ts.map +1 -1
  5. package/dist/cell.js.map +1 -1
  6. package/dist/context/index.d.ts +1 -1
  7. package/dist/context/index.d.ts.map +1 -1
  8. package/dist/context/index.js +1 -1
  9. package/dist/context/index.js.map +1 -1
  10. package/dist/contract.d.ts +51 -52
  11. package/dist/contract.d.ts.map +1 -1
  12. package/dist/contract.js +19 -24
  13. package/dist/contract.js.map +1 -1
  14. package/dist/delta/apply-immutable-trusted.js +3 -4
  15. package/dist/delta/apply-immutable-trusted.js.map +1 -1
  16. package/dist/delta/diff.d.ts.map +1 -1
  17. package/dist/delta/diff.js +5 -3
  18. package/dist/delta/diff.js.map +1 -1
  19. package/dist/delta/index.d.ts +9 -1
  20. package/dist/delta/index.d.ts.map +1 -1
  21. package/dist/delta/index.js +15 -11
  22. package/dist/delta/index.js.map +1 -1
  23. package/dist/delta/pending.d.ts +36 -0
  24. package/dist/delta/pending.d.ts.map +1 -0
  25. package/dist/delta/pending.js +143 -0
  26. package/dist/delta/pending.js.map +1 -0
  27. package/dist/delta/tracker.d.ts +12 -0
  28. package/dist/delta/tracker.d.ts.map +1 -1
  29. package/dist/delta/tracker.js +109 -39
  30. package/dist/delta/tracker.js.map +1 -1
  31. package/dist/host.d.ts.map +1 -1
  32. package/dist/host.js +9 -7
  33. package/dist/host.js.map +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +1 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/next/contracts/accepts.d.ts +81 -0
  39. package/dist/next/contracts/accepts.d.ts.map +1 -0
  40. package/dist/next/contracts/accepts.js +123 -0
  41. package/dist/next/contracts/accepts.js.map +1 -0
  42. package/dist/next/contracts/contract.d.ts +121 -0
  43. package/dist/next/contracts/contract.d.ts.map +1 -0
  44. package/dist/next/contracts/contract.js +50 -0
  45. package/dist/next/contracts/contract.js.map +1 -0
  46. package/dist/next/contracts/declare.d.ts +107 -0
  47. package/dist/next/contracts/declare.d.ts.map +1 -0
  48. package/dist/next/contracts/declare.js +136 -0
  49. package/dist/next/contracts/declare.js.map +1 -0
  50. package/dist/next/contracts/evolve.d.ts +92 -0
  51. package/dist/next/contracts/evolve.d.ts.map +1 -0
  52. package/dist/next/contracts/evolve.js +179 -0
  53. package/dist/next/contracts/evolve.js.map +1 -0
  54. package/dist/next/contracts/fingerprint.d.ts +16 -0
  55. package/dist/next/contracts/fingerprint.d.ts.map +1 -0
  56. package/dist/next/contracts/fingerprint.js +50 -0
  57. package/dist/next/contracts/fingerprint.js.map +1 -0
  58. package/dist/next/contracts/history.d.ts +71 -0
  59. package/dist/next/contracts/history.d.ts.map +1 -0
  60. package/dist/next/contracts/history.js +3 -0
  61. package/dist/next/contracts/history.js.map +1 -0
  62. package/dist/next/contracts/host-kind.d.ts +40 -0
  63. package/dist/next/contracts/host-kind.d.ts.map +1 -0
  64. package/dist/next/contracts/host-kind.js +37 -0
  65. package/dist/next/contracts/host-kind.js.map +1 -0
  66. package/dist/next/contracts/index.d.ts +7 -0
  67. package/dist/next/contracts/index.d.ts.map +1 -0
  68. package/dist/next/contracts/index.js +6 -0
  69. package/dist/next/contracts/index.js.map +1 -0
  70. package/dist/next/contracts/internal.d.ts +10 -0
  71. package/dist/next/contracts/internal.d.ts.map +1 -0
  72. package/dist/next/contracts/internal.js +9 -0
  73. package/dist/next/contracts/internal.js.map +1 -0
  74. package/dist/next/contracts/names.d.ts +3 -0
  75. package/dist/next/contracts/names.d.ts.map +1 -0
  76. package/dist/next/contracts/names.js +13 -0
  77. package/dist/next/contracts/names.js.map +1 -0
  78. package/dist/next/contracts/params.d.ts +28 -0
  79. package/dist/next/contracts/params.d.ts.map +1 -0
  80. package/dist/next/contracts/params.js +50 -0
  81. package/dist/next/contracts/params.js.map +1 -0
  82. package/dist/next/contracts/schema.d.ts +102 -0
  83. package/dist/next/contracts/schema.d.ts.map +1 -0
  84. package/dist/next/contracts/schema.js +103 -0
  85. package/dist/next/contracts/schema.js.map +1 -0
  86. package/dist/next/contracts/snapshot.d.ts +16 -0
  87. package/dist/next/contracts/snapshot.d.ts.map +1 -0
  88. package/dist/next/contracts/snapshot.js +167 -0
  89. package/dist/next/contracts/snapshot.js.map +1 -0
  90. package/dist/next/data/args.d.ts +50 -0
  91. package/dist/next/data/args.d.ts.map +1 -0
  92. package/dist/next/data/args.js +83 -0
  93. package/dist/next/data/args.js.map +1 -0
  94. package/dist/next/data/errors.d.ts +73 -0
  95. package/dist/next/data/errors.d.ts.map +1 -0
  96. package/dist/next/data/errors.js +107 -0
  97. package/dist/next/data/errors.js.map +1 -0
  98. package/dist/next/data/failure.d.ts +26 -0
  99. package/dist/next/data/failure.d.ts.map +1 -0
  100. package/dist/next/data/failure.js +72 -0
  101. package/dist/next/data/failure.js.map +1 -0
  102. package/dist/next/data/index.d.ts +4 -0
  103. package/dist/next/data/index.d.ts.map +1 -0
  104. package/dist/next/data/index.js +4 -0
  105. package/dist/next/data/index.js.map +1 -0
  106. package/dist/next/data/internal.d.ts +7 -0
  107. package/dist/next/data/internal.d.ts.map +1 -0
  108. package/dist/next/data/internal.js +8 -0
  109. package/dist/next/data/internal.js.map +1 -0
  110. package/dist/next/data/params.d.ts +20 -0
  111. package/dist/next/data/params.d.ts.map +1 -0
  112. package/dist/next/data/params.js +31 -0
  113. package/dist/next/data/params.js.map +1 -0
  114. package/dist/next/data/principal.d.ts +17 -0
  115. package/dist/next/data/principal.d.ts.map +1 -0
  116. package/dist/next/data/principal.js +41 -0
  117. package/dist/next/data/principal.js.map +1 -0
  118. package/dist/next/data/validator.d.ts +12 -0
  119. package/dist/next/data/validator.d.ts.map +1 -0
  120. package/dist/next/data/validator.js +34 -0
  121. package/dist/next/data/validator.js.map +1 -0
  122. package/dist/next/documents/address-source.d.ts +20 -0
  123. package/dist/next/documents/address-source.d.ts.map +1 -0
  124. package/dist/next/documents/address-source.js +44 -0
  125. package/dist/next/documents/address-source.js.map +1 -0
  126. package/dist/next/documents/definition.d.ts +84 -0
  127. package/dist/next/documents/definition.d.ts.map +1 -0
  128. package/dist/next/documents/definition.js +73 -0
  129. package/dist/next/documents/definition.js.map +1 -0
  130. package/dist/next/documents/documents.d.ts +106 -0
  131. package/dist/next/documents/documents.d.ts.map +1 -0
  132. package/dist/next/documents/documents.js +224 -0
  133. package/dist/next/documents/documents.js.map +1 -0
  134. package/dist/next/documents/fence.d.ts +9 -0
  135. package/dist/next/documents/fence.d.ts.map +1 -0
  136. package/dist/next/documents/fence.js +15 -0
  137. package/dist/next/documents/fence.js.map +1 -0
  138. package/dist/next/documents/handles.d.ts +76 -0
  139. package/dist/next/documents/handles.d.ts.map +1 -0
  140. package/dist/next/documents/handles.js +66 -0
  141. package/dist/next/documents/handles.js.map +1 -0
  142. package/dist/next/documents/index.d.ts +4 -0
  143. package/dist/next/documents/index.d.ts.map +1 -0
  144. package/dist/next/documents/index.js +3 -0
  145. package/dist/next/documents/index.js.map +1 -0
  146. package/dist/next/documents/internal.d.ts +9 -0
  147. package/dist/next/documents/internal.d.ts.map +1 -0
  148. package/dist/next/documents/internal.js +9 -0
  149. package/dist/next/documents/internal.js.map +1 -0
  150. package/dist/next/documents/keyed-slot.d.ts +103 -0
  151. package/dist/next/documents/keyed-slot.d.ts.map +1 -0
  152. package/dist/next/documents/keyed-slot.js +395 -0
  153. package/dist/next/documents/keyed-slot.js.map +1 -0
  154. package/dist/next/documents/line.d.ts +7 -0
  155. package/dist/next/documents/line.d.ts.map +1 -0
  156. package/dist/next/documents/line.js +14 -0
  157. package/dist/next/documents/line.js.map +1 -0
  158. package/dist/next/documents/persistence.d.ts +104 -0
  159. package/dist/next/documents/persistence.d.ts.map +1 -0
  160. package/dist/next/documents/persistence.js +128 -0
  161. package/dist/next/documents/persistence.js.map +1 -0
  162. package/dist/next/documents/residency.d.ts +31 -0
  163. package/dist/next/documents/residency.d.ts.map +1 -0
  164. package/dist/next/documents/residency.js +93 -0
  165. package/dist/next/documents/residency.js.map +1 -0
  166. package/dist/next/documents/slot.d.ts +109 -0
  167. package/dist/next/documents/slot.d.ts.map +1 -0
  168. package/dist/next/documents/slot.js +181 -0
  169. package/dist/next/documents/slot.js.map +1 -0
  170. package/dist/next/documents/transaction.d.ts +133 -0
  171. package/dist/next/documents/transaction.d.ts.map +1 -0
  172. package/dist/next/documents/transaction.js +409 -0
  173. package/dist/next/documents/transaction.js.map +1 -0
  174. package/dist/next/host/activity.d.ts +31 -0
  175. package/dist/next/host/activity.d.ts.map +1 -0
  176. package/dist/next/host/activity.js +40 -0
  177. package/dist/next/host/activity.js.map +1 -0
  178. package/dist/next/host/adapted.d.ts +49 -0
  179. package/dist/next/host/adapted.d.ts.map +1 -0
  180. package/dist/next/host/adapted.js +214 -0
  181. package/dist/next/host/adapted.js.map +1 -0
  182. package/dist/next/host/attempt.d.ts +278 -0
  183. package/dist/next/host/attempt.d.ts.map +1 -0
  184. package/dist/next/host/attempt.js +1072 -0
  185. package/dist/next/host/attempt.js.map +1 -0
  186. package/dist/next/host/backoff.d.ts +29 -0
  187. package/dist/next/host/backoff.d.ts.map +1 -0
  188. package/dist/next/host/backoff.js +69 -0
  189. package/dist/next/host/backoff.js.map +1 -0
  190. package/dist/next/host/ctx.d.ts +47 -0
  191. package/dist/next/host/ctx.d.ts.map +1 -0
  192. package/dist/next/host/ctx.js +108 -0
  193. package/dist/next/host/ctx.js.map +1 -0
  194. package/dist/next/host/deadline.d.ts +12 -0
  195. package/dist/next/host/deadline.d.ts.map +1 -0
  196. package/dist/next/host/deadline.js +40 -0
  197. package/dist/next/host/deadline.js.map +1 -0
  198. package/dist/next/host/dependencies.d.ts +65 -0
  199. package/dist/next/host/dependencies.d.ts.map +1 -0
  200. package/dist/next/host/dependencies.js +115 -0
  201. package/dist/next/host/dependencies.js.map +1 -0
  202. package/dist/next/host/destination.d.ts +48 -0
  203. package/dist/next/host/destination.d.ts.map +1 -0
  204. package/dist/next/host/destination.js +101 -0
  205. package/dist/next/host/destination.js.map +1 -0
  206. package/dist/next/host/facet.d.ts +79 -0
  207. package/dist/next/host/facet.d.ts.map +1 -0
  208. package/dist/next/host/facet.js +55 -0
  209. package/dist/next/host/facet.js.map +1 -0
  210. package/dist/next/host/follow.d.ts +52 -0
  211. package/dist/next/host/follow.d.ts.map +1 -0
  212. package/dist/next/host/follow.js +207 -0
  213. package/dist/next/host/follow.js.map +1 -0
  214. package/dist/next/host/host.d.ts +495 -0
  215. package/dist/next/host/host.d.ts.map +1 -0
  216. package/dist/next/host/host.js +1075 -0
  217. package/dist/next/host/host.js.map +1 -0
  218. package/dist/next/host/index.d.ts +17 -0
  219. package/dist/next/host/index.d.ts.map +1 -0
  220. package/dist/next/host/index.js +6 -0
  221. package/dist/next/host/index.js.map +1 -0
  222. package/dist/next/host/internal.d.ts +10 -0
  223. package/dist/next/host/internal.d.ts.map +1 -0
  224. package/dist/next/host/internal.js +8 -0
  225. package/dist/next/host/internal.js.map +1 -0
  226. package/dist/next/host/members.d.ts +50 -0
  227. package/dist/next/host/members.d.ts.map +1 -0
  228. package/dist/next/host/members.js +107 -0
  229. package/dist/next/host/members.js.map +1 -0
  230. package/dist/next/host/native.d.ts +55 -0
  231. package/dist/next/host/native.d.ts.map +1 -0
  232. package/dist/next/host/native.js +92 -0
  233. package/dist/next/host/native.js.map +1 -0
  234. package/dist/next/host/object.d.ts +290 -0
  235. package/dist/next/host/object.d.ts.map +1 -0
  236. package/dist/next/host/object.js +1127 -0
  237. package/dist/next/host/object.js.map +1 -0
  238. package/dist/next/host/parked.d.ts +23 -0
  239. package/dist/next/host/parked.d.ts.map +1 -0
  240. package/dist/next/host/parked.js +79 -0
  241. package/dist/next/host/parked.js.map +1 -0
  242. package/dist/next/host/presence.d.ts +34 -0
  243. package/dist/next/host/presence.d.ts.map +1 -0
  244. package/dist/next/host/presence.js +117 -0
  245. package/dist/next/host/presence.js.map +1 -0
  246. package/dist/next/host/ref-state.d.ts +53 -0
  247. package/dist/next/host/ref-state.d.ts.map +1 -0
  248. package/dist/next/host/ref-state.js +83 -0
  249. package/dist/next/host/ref-state.js.map +1 -0
  250. package/dist/next/host/reference-keys.d.ts +36 -0
  251. package/dist/next/host/reference-keys.d.ts.map +1 -0
  252. package/dist/next/host/reference-keys.js +168 -0
  253. package/dist/next/host/reference-keys.js.map +1 -0
  254. package/dist/next/host/reference-source.d.ts +65 -0
  255. package/dist/next/host/reference-source.d.ts.map +1 -0
  256. package/dist/next/host/reference-source.js +285 -0
  257. package/dist/next/host/reference-source.js.map +1 -0
  258. package/dist/next/host/reference.d.ts +308 -0
  259. package/dist/next/host/reference.d.ts.map +1 -0
  260. package/dist/next/host/reference.js +775 -0
  261. package/dist/next/host/reference.js.map +1 -0
  262. package/dist/next/host/retry-on.d.ts +28 -0
  263. package/dist/next/host/retry-on.d.ts.map +1 -0
  264. package/dist/next/host/retry-on.js +52 -0
  265. package/dist/next/host/retry-on.js.map +1 -0
  266. package/dist/next/host/revocation.d.ts +16 -0
  267. package/dist/next/host/revocation.d.ts.map +1 -0
  268. package/dist/next/host/revocation.js +27 -0
  269. package/dist/next/host/revocation.js.map +1 -0
  270. package/dist/next/host/root.d.ts +27 -0
  271. package/dist/next/host/root.d.ts.map +1 -0
  272. package/dist/next/host/root.js +68 -0
  273. package/dist/next/host/root.js.map +1 -0
  274. package/dist/next/host/route.d.ts +64 -0
  275. package/dist/next/host/route.d.ts.map +1 -0
  276. package/dist/next/host/route.js +190 -0
  277. package/dist/next/host/route.js.map +1 -0
  278. package/dist/next/host/routines.d.ts +76 -0
  279. package/dist/next/host/routines.d.ts.map +1 -0
  280. package/dist/next/host/routines.js +350 -0
  281. package/dist/next/host/routines.js.map +1 -0
  282. package/dist/next/host/sleep.d.ts +9 -0
  283. package/dist/next/host/sleep.d.ts.map +1 -0
  284. package/dist/next/host/sleep.js +40 -0
  285. package/dist/next/host/sleep.js.map +1 -0
  286. package/dist/next/host/staging.d.ts +94 -0
  287. package/dist/next/host/staging.d.ts.map +1 -0
  288. package/dist/next/host/staging.js +302 -0
  289. package/dist/next/host/staging.js.map +1 -0
  290. package/dist/next/host/unbound.d.ts +30 -0
  291. package/dist/next/host/unbound.d.ts.map +1 -0
  292. package/dist/next/host/unbound.js +67 -0
  293. package/dist/next/host/unbound.js.map +1 -0
  294. package/dist/next/host/uuid.d.ts +3 -0
  295. package/dist/next/host/uuid.d.ts.map +1 -0
  296. package/dist/next/host/uuid.js +38 -0
  297. package/dist/next/host/uuid.js.map +1 -0
  298. package/dist/next/index.d.ts +28 -0
  299. package/dist/next/index.d.ts.map +1 -0
  300. package/dist/next/index.js +18 -0
  301. package/dist/next/index.js.map +1 -0
  302. package/dist/next/jobs/definition.d.ts +96 -0
  303. package/dist/next/jobs/definition.d.ts.map +1 -0
  304. package/dist/next/jobs/definition.js +83 -0
  305. package/dist/next/jobs/definition.js.map +1 -0
  306. package/dist/next/jobs/index.d.ts +5 -0
  307. package/dist/next/jobs/index.d.ts.map +1 -0
  308. package/dist/next/jobs/index.js +3 -0
  309. package/dist/next/jobs/index.js.map +1 -0
  310. package/dist/next/jobs/internal.d.ts +3 -0
  311. package/dist/next/jobs/internal.d.ts.map +1 -0
  312. package/dist/next/jobs/internal.js +4 -0
  313. package/dist/next/jobs/internal.js.map +1 -0
  314. package/dist/next/jobs/job.d.ts +152 -0
  315. package/dist/next/jobs/job.d.ts.map +1 -0
  316. package/dist/next/jobs/job.js +320 -0
  317. package/dist/next/jobs/job.js.map +1 -0
  318. package/dist/next/jobs/persisted.d.ts +38 -0
  319. package/dist/next/jobs/persisted.d.ts.map +1 -0
  320. package/dist/next/jobs/persisted.js +95 -0
  321. package/dist/next/jobs/persisted.js.map +1 -0
  322. package/dist/next/jobs/records.d.ts +231 -0
  323. package/dist/next/jobs/records.d.ts.map +1 -0
  324. package/dist/next/jobs/records.js +869 -0
  325. package/dist/next/jobs/records.js.map +1 -0
  326. package/dist/next/jobs/run-states.d.ts +69 -0
  327. package/dist/next/jobs/run-states.d.ts.map +1 -0
  328. package/dist/next/jobs/run-states.js +228 -0
  329. package/dist/next/jobs/run-states.js.map +1 -0
  330. package/dist/next/jobs/run.d.ts +113 -0
  331. package/dist/next/jobs/run.d.ts.map +1 -0
  332. package/dist/next/jobs/run.js +200 -0
  333. package/dist/next/jobs/run.js.map +1 -0
  334. package/dist/next/jobs/running.d.ts +44 -0
  335. package/dist/next/jobs/running.d.ts.map +1 -0
  336. package/dist/next/jobs/running.js +117 -0
  337. package/dist/next/jobs/running.js.map +1 -0
  338. package/dist/next/jobs/stored.d.ts +63 -0
  339. package/dist/next/jobs/stored.d.ts.map +1 -0
  340. package/dist/next/jobs/stored.js +55 -0
  341. package/dist/next/jobs/stored.js.map +1 -0
  342. package/dist/next/link/binary.d.ts +4 -0
  343. package/dist/next/link/binary.d.ts.map +1 -0
  344. package/dist/next/link/binary.js +534 -0
  345. package/dist/next/link/binary.js.map +1 -0
  346. package/dist/next/link/channel.d.ts +63 -0
  347. package/dist/next/link/channel.d.ts.map +1 -0
  348. package/dist/next/link/channel.js +202 -0
  349. package/dist/next/link/channel.js.map +1 -0
  350. package/dist/next/link/errors.d.ts +7 -0
  351. package/dist/next/link/errors.d.ts.map +1 -0
  352. package/dist/next/link/errors.js +21 -0
  353. package/dist/next/link/errors.js.map +1 -0
  354. package/dist/next/link/index.d.ts +8 -0
  355. package/dist/next/link/index.d.ts.map +1 -0
  356. package/dist/next/link/index.js +8 -0
  357. package/dist/next/link/index.js.map +1 -0
  358. package/dist/next/link/internal.d.ts +9 -0
  359. package/dist/next/link/internal.d.ts.map +1 -0
  360. package/dist/next/link/internal.js +10 -0
  361. package/dist/next/link/internal.js.map +1 -0
  362. package/dist/next/link/ipc.d.ts +22 -0
  363. package/dist/next/link/ipc.d.ts.map +1 -0
  364. package/dist/next/link/ipc.js +64 -0
  365. package/dist/next/link/ipc.js.map +1 -0
  366. package/dist/next/link/link.d.ts +34 -0
  367. package/dist/next/link/link.d.ts.map +1 -0
  368. package/dist/next/link/link.js +87 -0
  369. package/dist/next/link/link.js.map +1 -0
  370. package/dist/next/link/message.d.ts +249 -0
  371. package/dist/next/link/message.d.ts.map +1 -0
  372. package/dist/next/link/message.js +123 -0
  373. package/dist/next/link/message.js.map +1 -0
  374. package/dist/next/link/part.d.ts +80 -0
  375. package/dist/next/link/part.d.ts.map +1 -0
  376. package/dist/next/link/part.js +164 -0
  377. package/dist/next/link/part.js.map +1 -0
  378. package/dist/next/link/text.d.ts +6 -0
  379. package/dist/next/link/text.d.ts.map +1 -0
  380. package/dist/next/link/text.js +335 -0
  381. package/dist/next/link/text.js.map +1 -0
  382. package/dist/next/link/values.d.ts +40 -0
  383. package/dist/next/link/values.d.ts.map +1 -0
  384. package/dist/next/link/values.js +117 -0
  385. package/dist/next/link/values.js.map +1 -0
  386. package/dist/next/link/websocket.d.ts +26 -0
  387. package/dist/next/link/websocket.d.ts.map +1 -0
  388. package/dist/next/link/websocket.js +91 -0
  389. package/dist/next/link/websocket.js.map +1 -0
  390. package/dist/next/registries/contribution.d.ts +50 -0
  391. package/dist/next/registries/contribution.d.ts.map +1 -0
  392. package/dist/next/registries/contribution.js +129 -0
  393. package/dist/next/registries/contribution.js.map +1 -0
  394. package/dist/next/registries/entries.d.ts +18 -0
  395. package/dist/next/registries/entries.d.ts.map +1 -0
  396. package/dist/next/registries/entries.js +42 -0
  397. package/dist/next/registries/entries.js.map +1 -0
  398. package/dist/next/registries/index.d.ts +3 -0
  399. package/dist/next/registries/index.d.ts.map +1 -0
  400. package/dist/next/registries/index.js +5 -0
  401. package/dist/next/registries/index.js.map +1 -0
  402. package/dist/next/registries/internal.d.ts +4 -0
  403. package/dist/next/registries/internal.d.ts.map +1 -0
  404. package/dist/next/registries/internal.js +5 -0
  405. package/dist/next/registries/internal.js.map +1 -0
  406. package/dist/next/registries/record.d.ts +94 -0
  407. package/dist/next/registries/record.d.ts.map +1 -0
  408. package/dist/next/registries/record.js +253 -0
  409. package/dist/next/registries/record.js.map +1 -0
  410. package/dist/next/registries/registry.d.ts +74 -0
  411. package/dist/next/registries/registry.d.ts.map +1 -0
  412. package/dist/next/registries/registry.js +14 -0
  413. package/dist/next/registries/registry.js.map +1 -0
  414. package/dist/next/registries/value.d.ts +48 -0
  415. package/dist/next/registries/value.d.ts.map +1 -0
  416. package/dist/next/registries/value.js +199 -0
  417. package/dist/next/registries/value.js.map +1 -0
  418. package/dist/next/remote/calls.d.ts +25 -0
  419. package/dist/next/remote/calls.d.ts.map +1 -0
  420. package/dist/next/remote/calls.js +62 -0
  421. package/dist/next/remote/calls.js.map +1 -0
  422. package/dist/next/remote/consumer.d.ts +42 -0
  423. package/dist/next/remote/consumer.d.ts.map +1 -0
  424. package/dist/next/remote/consumer.js +343 -0
  425. package/dist/next/remote/consumer.js.map +1 -0
  426. package/dist/next/remote/hold.d.ts +130 -0
  427. package/dist/next/remote/hold.d.ts.map +1 -0
  428. package/dist/next/remote/hold.js +537 -0
  429. package/dist/next/remote/hold.js.map +1 -0
  430. package/dist/next/remote/host-link.d.ts +77 -0
  431. package/dist/next/remote/host-link.d.ts.map +1 -0
  432. package/dist/next/remote/host-link.js +182 -0
  433. package/dist/next/remote/host-link.js.map +1 -0
  434. package/dist/next/remote/internal.d.ts +6 -0
  435. package/dist/next/remote/internal.d.ts.map +1 -0
  436. package/dist/next/remote/internal.js +6 -0
  437. package/dist/next/remote/internal.js.map +1 -0
  438. package/dist/next/remote/path.d.ts +46 -0
  439. package/dist/next/remote/path.d.ts.map +1 -0
  440. package/dist/next/remote/path.js +73 -0
  441. package/dist/next/remote/path.js.map +1 -0
  442. package/dist/next/remote/provider.d.ts +76 -0
  443. package/dist/next/remote/provider.d.ts.map +1 -0
  444. package/dist/next/remote/provider.js +506 -0
  445. package/dist/next/remote/provider.js.map +1 -0
  446. package/dist/next/remote/relay.d.ts +58 -0
  447. package/dist/next/remote/relay.d.ts.map +1 -0
  448. package/dist/next/remote/relay.js +117 -0
  449. package/dist/next/remote/relay.js.map +1 -0
  450. package/dist/next/remote/remote-object.d.ts +133 -0
  451. package/dist/next/remote/remote-object.d.ts.map +1 -0
  452. package/dist/next/remote/remote-object.js +411 -0
  453. package/dist/next/remote/remote-object.js.map +1 -0
  454. package/dist/next/remote/replica.d.ts +59 -0
  455. package/dist/next/remote/replica.d.ts.map +1 -0
  456. package/dist/next/remote/replica.js +125 -0
  457. package/dist/next/remote/replica.js.map +1 -0
  458. package/dist/next/state/batch.d.ts +64 -0
  459. package/dist/next/state/batch.d.ts.map +1 -0
  460. package/dist/next/state/batch.js +163 -0
  461. package/dist/next/state/batch.js.map +1 -0
  462. package/dist/next/state/derive.d.ts +52 -0
  463. package/dist/next/state/derive.d.ts.map +1 -0
  464. package/dist/next/state/derive.js +182 -0
  465. package/dist/next/state/derive.js.map +1 -0
  466. package/dist/next/state/index.d.ts +6 -0
  467. package/dist/next/state/index.d.ts.map +1 -0
  468. package/dist/next/state/index.js +4 -0
  469. package/dist/next/state/index.js.map +1 -0
  470. package/dist/next/state/internal.d.ts +6 -0
  471. package/dist/next/state/internal.d.ts.map +1 -0
  472. package/dist/next/state/internal.js +8 -0
  473. package/dist/next/state/internal.js.map +1 -0
  474. package/dist/next/state/native-source.d.ts +106 -0
  475. package/dist/next/state/native-source.d.ts.map +1 -0
  476. package/dist/next/state/native-source.js +240 -0
  477. package/dist/next/state/native-source.js.map +1 -0
  478. package/dist/next/state/watchable.d.ts +114 -0
  479. package/dist/next/state/watchable.d.ts.map +1 -0
  480. package/dist/next/state/watchable.js +156 -0
  481. package/dist/next/state/watchable.js.map +1 -0
  482. package/dist/next/state/writable.d.ts +32 -0
  483. package/dist/next/state/writable.d.ts.map +1 -0
  484. package/dist/next/state/writable.js +49 -0
  485. package/dist/next/state/writable.js.map +1 -0
  486. package/dist/next/store/adapter.d.ts +67 -0
  487. package/dist/next/store/adapter.d.ts.map +1 -0
  488. package/dist/next/store/adapter.js +118 -0
  489. package/dist/next/store/adapter.js.map +1 -0
  490. package/dist/next/store/allocator.d.ts +17 -0
  491. package/dist/next/store/allocator.d.ts.map +1 -0
  492. package/dist/next/store/allocator.js +30 -0
  493. package/dist/next/store/allocator.js.map +1 -0
  494. package/dist/next/store/applier.d.ts +8 -0
  495. package/dist/next/store/applier.d.ts.map +1 -0
  496. package/dist/next/store/applier.js +375 -0
  497. package/dist/next/store/applier.js.map +1 -0
  498. package/dist/next/store/apply-batch.d.ts +12 -0
  499. package/dist/next/store/apply-batch.d.ts.map +1 -0
  500. package/dist/next/store/apply-batch.js +83 -0
  501. package/dist/next/store/apply-batch.js.map +1 -0
  502. package/dist/next/store/archive.d.ts +32 -0
  503. package/dist/next/store/archive.d.ts.map +1 -0
  504. package/dist/next/store/archive.js +129 -0
  505. package/dist/next/store/archive.js.map +1 -0
  506. package/dist/next/store/backend.d.ts +10 -0
  507. package/dist/next/store/backend.d.ts.map +1 -0
  508. package/dist/next/store/backend.js +15 -0
  509. package/dist/next/store/backend.js.map +1 -0
  510. package/dist/next/store/catalog.d.ts +24 -0
  511. package/dist/next/store/catalog.d.ts.map +1 -0
  512. package/dist/next/store/catalog.js +17 -0
  513. package/dist/next/store/catalog.js.map +1 -0
  514. package/dist/next/store/claims.d.ts +23 -0
  515. package/dist/next/store/claims.d.ts.map +1 -0
  516. package/dist/next/store/claims.js +65 -0
  517. package/dist/next/store/claims.js.map +1 -0
  518. package/dist/next/store/columns.d.ts +77 -0
  519. package/dist/next/store/columns.d.ts.map +1 -0
  520. package/dist/next/store/columns.js +77 -0
  521. package/dist/next/store/columns.js.map +1 -0
  522. package/dist/next/store/engine.d.ts +176 -0
  523. package/dist/next/store/engine.d.ts.map +1 -0
  524. package/dist/next/store/engine.js +283 -0
  525. package/dist/next/store/engine.js.map +1 -0
  526. package/dist/next/store/evaluate.d.ts +17 -0
  527. package/dist/next/store/evaluate.d.ts.map +1 -0
  528. package/dist/next/store/evaluate.js +128 -0
  529. package/dist/next/store/evaluate.js.map +1 -0
  530. package/dist/next/store/export.d.ts +17 -0
  531. package/dist/next/store/export.d.ts.map +1 -0
  532. package/dist/next/store/export.js +200 -0
  533. package/dist/next/store/export.js.map +1 -0
  534. package/dist/next/store/expression.d.ts +150 -0
  535. package/dist/next/store/expression.d.ts.map +1 -0
  536. package/dist/next/store/expression.js +268 -0
  537. package/dist/next/store/expression.js.map +1 -0
  538. package/dist/next/store/import.d.ts +10 -0
  539. package/dist/next/store/import.d.ts.map +1 -0
  540. package/dist/next/store/import.js +276 -0
  541. package/dist/next/store/import.js.map +1 -0
  542. package/dist/next/store/index.d.ts +16 -0
  543. package/dist/next/store/index.d.ts.map +1 -0
  544. package/dist/next/store/index.js +13 -0
  545. package/dist/next/store/index.js.map +1 -0
  546. package/dist/next/store/json-column.d.ts +33 -0
  547. package/dist/next/store/json-column.d.ts.map +1 -0
  548. package/dist/next/store/json-column.js +61 -0
  549. package/dist/next/store/json-column.js.map +1 -0
  550. package/dist/next/store/jsonl.d.ts +9 -0
  551. package/dist/next/store/jsonl.d.ts.map +1 -0
  552. package/dist/next/store/jsonl.js +61 -0
  553. package/dist/next/store/jsonl.js.map +1 -0
  554. package/dist/next/store/outbox.d.ts +26 -0
  555. package/dist/next/store/outbox.d.ts.map +1 -0
  556. package/dist/next/store/outbox.js +80 -0
  557. package/dist/next/store/outbox.js.map +1 -0
  558. package/dist/next/store/query.d.ts +39 -0
  559. package/dist/next/store/query.d.ts.map +1 -0
  560. package/dist/next/store/query.js +97 -0
  561. package/dist/next/store/query.js.map +1 -0
  562. package/dist/next/store/refusal.d.ts +15 -0
  563. package/dist/next/store/refusal.d.ts.map +1 -0
  564. package/dist/next/store/refusal.js +36 -0
  565. package/dist/next/store/refusal.js.map +1 -0
  566. package/dist/next/store/rows.d.ts +80 -0
  567. package/dist/next/store/rows.d.ts.map +1 -0
  568. package/dist/next/store/rows.js +183 -0
  569. package/dist/next/store/rows.js.map +1 -0
  570. package/dist/next/store/schema.d.ts +25 -0
  571. package/dist/next/store/schema.d.ts.map +1 -0
  572. package/dist/next/store/schema.js +115 -0
  573. package/dist/next/store/schema.js.map +1 -0
  574. package/dist/next/store/sql.d.ts +73 -0
  575. package/dist/next/store/sql.d.ts.map +1 -0
  576. package/dist/next/store/sql.js +234 -0
  577. package/dist/next/store/sql.js.map +1 -0
  578. package/dist/next/store/step.d.ts +48 -0
  579. package/dist/next/store/step.d.ts.map +1 -0
  580. package/dist/next/store/step.js +50 -0
  581. package/dist/next/store/step.js.map +1 -0
  582. package/dist/next/store/store.d.ts +161 -0
  583. package/dist/next/store/store.d.ts.map +1 -0
  584. package/dist/next/store/store.js +627 -0
  585. package/dist/next/store/store.js.map +1 -0
  586. package/dist/next/store/table-changes.d.ts +29 -0
  587. package/dist/next/store/table-changes.d.ts.map +1 -0
  588. package/dist/next/store/table-changes.js +102 -0
  589. package/dist/next/store/table-changes.js.map +1 -0
  590. package/dist/next/store/table-evolve.d.ts +74 -0
  591. package/dist/next/store/table-evolve.d.ts.map +1 -0
  592. package/dist/next/store/table-evolve.js +201 -0
  593. package/dist/next/store/table-evolve.js.map +1 -0
  594. package/dist/next/store/table-handle.d.ts +67 -0
  595. package/dist/next/store/table-handle.d.ts.map +1 -0
  596. package/dist/next/store/table-handle.js +101 -0
  597. package/dist/next/store/table-handle.js.map +1 -0
  598. package/dist/next/store/table-history.d.ts +75 -0
  599. package/dist/next/store/table-history.d.ts.map +1 -0
  600. package/dist/next/store/table-history.js +42 -0
  601. package/dist/next/store/table-history.js.map +1 -0
  602. package/dist/next/store/table-migration.d.ts +16 -0
  603. package/dist/next/store/table-migration.d.ts.map +1 -0
  604. package/dist/next/store/table-migration.js +202 -0
  605. package/dist/next/store/table-migration.js.map +1 -0
  606. package/dist/next/store/table-writes.d.ts +125 -0
  607. package/dist/next/store/table-writes.d.ts.map +1 -0
  608. package/dist/next/store/table-writes.js +165 -0
  609. package/dist/next/store/table-writes.js.map +1 -0
  610. package/dist/next/store/table.d.ts +80 -0
  611. package/dist/next/store/table.d.ts.map +1 -0
  612. package/dist/next/store/table.js +103 -0
  613. package/dist/next/store/table.js.map +1 -0
  614. package/dist/next/store/text.d.ts +14 -0
  615. package/dist/next/store/text.d.ts.map +1 -0
  616. package/dist/next/store/text.js +51 -0
  617. package/dist/next/store/text.js.map +1 -0
  618. package/dist/next/store/writes.d.ts +5 -0
  619. package/dist/next/store/writes.d.ts.map +1 -0
  620. package/dist/next/store/writes.js +4 -0
  621. package/dist/next/store/writes.js.map +1 -0
  622. package/dist/next-node/compression.d.ts +7 -0
  623. package/dist/next-node/compression.d.ts.map +1 -0
  624. package/dist/next-node/compression.js +24 -0
  625. package/dist/next-node/compression.js.map +1 -0
  626. package/dist/next-node/http/admission.d.ts +63 -0
  627. package/dist/next-node/http/admission.d.ts.map +1 -0
  628. package/dist/next-node/http/admission.js +134 -0
  629. package/dist/next-node/http/admission.js.map +1 -0
  630. package/dist/next-node/http/authenticate.d.ts +21 -0
  631. package/dist/next-node/http/authenticate.d.ts.map +1 -0
  632. package/dist/next-node/http/authenticate.js +34 -0
  633. package/dist/next-node/http/authenticate.js.map +1 -0
  634. package/dist/next-node/http/cookies.d.ts +24 -0
  635. package/dist/next-node/http/cookies.d.ts.map +1 -0
  636. package/dist/next-node/http/cookies.js +62 -0
  637. package/dist/next-node/http/cookies.js.map +1 -0
  638. package/dist/next-node/http/file.d.ts +23 -0
  639. package/dist/next-node/http/file.d.ts.map +1 -0
  640. package/dist/next-node/http/file.js +94 -0
  641. package/dist/next-node/http/file.js.map +1 -0
  642. package/dist/next-node/http/headers.d.ts +37 -0
  643. package/dist/next-node/http/headers.d.ts.map +1 -0
  644. package/dist/next-node/http/headers.js +129 -0
  645. package/dist/next-node/http/headers.js.map +1 -0
  646. package/dist/next-node/http/http.d.ts +100 -0
  647. package/dist/next-node/http/http.d.ts.map +1 -0
  648. package/dist/next-node/http/http.js +462 -0
  649. package/dist/next-node/http/http.js.map +1 -0
  650. package/dist/next-node/http/incoming.d.ts +19 -0
  651. package/dist/next-node/http/incoming.d.ts.map +1 -0
  652. package/dist/next-node/http/incoming.js +31 -0
  653. package/dist/next-node/http/incoming.js.map +1 -0
  654. package/dist/next-node/http/index.d.ts +11 -0
  655. package/dist/next-node/http/index.d.ts.map +1 -0
  656. package/dist/next-node/http/index.js +12 -0
  657. package/dist/next-node/http/index.js.map +1 -0
  658. package/dist/next-node/http/node.d.ts +78 -0
  659. package/dist/next-node/http/node.d.ts.map +1 -0
  660. package/dist/next-node/http/node.js +291 -0
  661. package/dist/next-node/http/node.js.map +1 -0
  662. package/dist/next-node/http/request.d.ts +54 -0
  663. package/dist/next-node/http/request.d.ts.map +1 -0
  664. package/dist/next-node/http/request.js +116 -0
  665. package/dist/next-node/http/request.js.map +1 -0
  666. package/dist/next-node/http/response.d.ts +63 -0
  667. package/dist/next-node/http/response.d.ts.map +1 -0
  668. package/dist/next-node/http/response.js +202 -0
  669. package/dist/next-node/http/response.js.map +1 -0
  670. package/dist/next-node/http/router.d.ts +114 -0
  671. package/dist/next-node/http/router.d.ts.map +1 -0
  672. package/dist/next-node/http/router.js +261 -0
  673. package/dist/next-node/http/router.js.map +1 -0
  674. package/dist/next-node/http/upgrades.d.ts +58 -0
  675. package/dist/next-node/http/upgrades.d.ts.map +1 -0
  676. package/dist/next-node/http/upgrades.js +184 -0
  677. package/dist/next-node/http/upgrades.js.map +1 -0
  678. package/dist/next-node/plugins/build.d.ts +57 -0
  679. package/dist/next-node/plugins/build.d.ts.map +1 -0
  680. package/dist/next-node/plugins/build.js +334 -0
  681. package/dist/next-node/plugins/build.js.map +1 -0
  682. package/dist/next-node/plugins/discover.d.ts +36 -0
  683. package/dist/next-node/plugins/discover.d.ts.map +1 -0
  684. package/dist/next-node/plugins/discover.js +91 -0
  685. package/dist/next-node/plugins/discover.js.map +1 -0
  686. package/dist/next-node/plugins/evaluate.d.ts +33 -0
  687. package/dist/next-node/plugins/evaluate.d.ts.map +1 -0
  688. package/dist/next-node/plugins/evaluate.js +98 -0
  689. package/dist/next-node/plugins/evaluate.js.map +1 -0
  690. package/dist/next-node/plugins/index.d.ts +9 -0
  691. package/dist/next-node/plugins/index.d.ts.map +1 -0
  692. package/dist/next-node/plugins/index.js +11 -0
  693. package/dist/next-node/plugins/index.js.map +1 -0
  694. package/dist/next-node/plugins/install.d.ts +13 -0
  695. package/dist/next-node/plugins/install.d.ts.map +1 -0
  696. package/dist/next-node/plugins/install.js +37 -0
  697. package/dist/next-node/plugins/install.js.map +1 -0
  698. package/dist/next-node/plugins/plugins.d.ts +135 -0
  699. package/dist/next-node/plugins/plugins.d.ts.map +1 -0
  700. package/dist/next-node/plugins/plugins.js +206 -0
  701. package/dist/next-node/plugins/plugins.js.map +1 -0
  702. package/dist/next-node/plugins/runtime.d.ts +41 -0
  703. package/dist/next-node/plugins/runtime.d.ts.map +1 -0
  704. package/dist/next-node/plugins/runtime.js +136 -0
  705. package/dist/next-node/plugins/runtime.js.map +1 -0
  706. package/dist/next-node/plugins/stack.d.ts +16 -0
  707. package/dist/next-node/plugins/stack.d.ts.map +1 -0
  708. package/dist/next-node/plugins/stack.js +61 -0
  709. package/dist/next-node/plugins/stack.js.map +1 -0
  710. package/dist/next-node/plugins/watcher.d.ts +58 -0
  711. package/dist/next-node/plugins/watcher.d.ts.map +1 -0
  712. package/dist/next-node/plugins/watcher.js +281 -0
  713. package/dist/next-node/plugins/watcher.js.map +1 -0
  714. package/dist/next-node/workers/control.d.ts +83 -0
  715. package/dist/next-node/workers/control.d.ts.map +1 -0
  716. package/dist/next-node/workers/control.js +77 -0
  717. package/dist/next-node/workers/control.js.map +1 -0
  718. package/dist/next-node/workers/index.d.ts +5 -0
  719. package/dist/next-node/workers/index.d.ts.map +1 -0
  720. package/dist/next-node/workers/index.js +7 -0
  721. package/dist/next-node/workers/index.js.map +1 -0
  722. package/dist/next-node/workers/lock.d.ts +21 -0
  723. package/dist/next-node/workers/lock.d.ts.map +1 -0
  724. package/dist/next-node/workers/lock.js +137 -0
  725. package/dist/next-node/workers/lock.js.map +1 -0
  726. package/dist/next-node/workers/main.d.ts +46 -0
  727. package/dist/next-node/workers/main.d.ts.map +1 -0
  728. package/dist/next-node/workers/main.js +230 -0
  729. package/dist/next-node/workers/main.js.map +1 -0
  730. package/dist/next-node/workers/process.d.ts +42 -0
  731. package/dist/next-node/workers/process.d.ts.map +1 -0
  732. package/dist/next-node/workers/process.js +125 -0
  733. package/dist/next-node/workers/process.js.map +1 -0
  734. package/dist/next-node/workers/workers.d.ts +80 -0
  735. package/dist/next-node/workers/workers.d.ts.map +1 -0
  736. package/dist/next-node/workers/workers.js +572 -0
  737. package/dist/next-node/workers/workers.js.map +1 -0
  738. package/dist/object.d.ts +4 -4
  739. package/dist/object.d.ts.map +1 -1
  740. package/dist/object.js +3 -4
  741. package/dist/object.js.map +1 -1
  742. package/dist/output.d.ts +1 -1
  743. package/dist/output.d.ts.map +1 -1
  744. package/dist/output.js +4 -2
  745. package/dist/output.js.map +1 -1
  746. package/dist/remote.d.ts.map +1 -1
  747. package/dist/remote.js +2 -2
  748. package/dist/remote.js.map +1 -1
  749. package/dist/schema.d.ts +8 -4
  750. package/dist/schema.d.ts.map +1 -1
  751. package/dist/schema.js +180 -5
  752. package/dist/schema.js.map +1 -1
  753. package/dist/sqlite/cloudflare.d.ts +2 -0
  754. package/dist/sqlite/cloudflare.d.ts.map +1 -1
  755. package/dist/sqlite/cloudflare.js +10 -0
  756. package/dist/sqlite/cloudflare.js.map +1 -1
  757. package/dist/sqlite/database.d.ts +5 -2
  758. package/dist/sqlite/database.d.ts.map +1 -1
  759. package/dist/sqlite/database.js.map +1 -1
  760. package/dist/sqlite/node.d.ts +4 -1
  761. package/dist/sqlite/node.d.ts.map +1 -1
  762. package/dist/sqlite/node.js +22 -5
  763. package/dist/sqlite/node.js.map +1 -1
  764. package/dist/watch.d.ts +194 -0
  765. package/dist/watch.d.ts.map +1 -0
  766. package/dist/watch.js +383 -0
  767. package/dist/watch.js.map +1 -0
  768. package/dist/wire.d.ts +174 -193
  769. package/dist/wire.d.ts.map +1 -1
  770. package/dist/wire.js +81 -80
  771. package/dist/wire.js.map +1 -1
  772. package/docs/guide.md +15 -15
  773. package/docs/next/benchmarks.md +959 -0
  774. package/docs/next/decisions.md +2957 -0
  775. package/docs/next/dependencies/book.md +1671 -0
  776. package/docs/next/dependencies/index.html +2641 -0
  777. package/docs/next/dependencies/model.md +330 -0
  778. package/docs/next/design.md +2554 -0
  779. package/docs/next/durable-observers/book.md +432 -0
  780. package/docs/next/durable-observers/index.html +517 -0
  781. package/docs/next/flow-control/book.md +333 -0
  782. package/docs/next/flow-control/fold/index.html +265 -0
  783. package/docs/next/flow-control/index.html +548 -0
  784. package/docs/next/flow-control/window/index.html +228 -0
  785. package/docs/next/guide-plugins-hosts/book.md +607 -0
  786. package/docs/next/guide-plugins-hosts/index.html +652 -0
  787. package/docs/next/http-workers/book.md +378 -0
  788. package/docs/next/http-workers/index.html +515 -0
  789. package/docs/next/layer-1.md +311 -0
  790. package/docs/next/layer-2.md +216 -0
  791. package/docs/next/plugin-model/book.md +186 -0
  792. package/docs/next/plugin-model/index.html +310 -0
  793. package/docs/next/plugin-primer/book.md +273 -0
  794. package/docs/next/plugin-primer/index.html +430 -0
  795. package/docs/next/slice-1.md +236 -0
  796. package/docs/next/slice-10.md +285 -0
  797. package/docs/next/slice-11.md +93 -0
  798. package/docs/next/slice-2.md +174 -0
  799. package/docs/next/slice-3a.md +296 -0
  800. package/docs/next/slice-3b.md +197 -0
  801. package/docs/next/slice-4.md +146 -0
  802. package/docs/next/slice-4a.md +418 -0
  803. package/docs/next/slice-4b.md +208 -0
  804. package/docs/next/slice-5.md +281 -0
  805. package/docs/next/slice-6a.md +676 -0
  806. package/docs/next/slice-6b.md +332 -0
  807. package/docs/next/slice-7a.md +130 -0
  808. package/docs/next/slice-7b/book.md +608 -0
  809. package/docs/next/slice-7b/index.html +842 -0
  810. package/docs/next/slice-7b.md +255 -0
  811. package/docs/next/slice-7c.md +165 -0
  812. package/docs/next/slice-8.md +194 -0
  813. package/docs/next/slices.md +230 -0
  814. package/docs/next/store/book.md +665 -0
  815. package/docs/next/store/index.html +861 -0
  816. package/docs/next/store/walkthrough.md +193 -0
  817. package/docs/spec.md +9 -9
  818. package/docs/tutorial.md +26 -25
  819. package/package.json +22 -6
  820. package/src/delta/README.md +69 -0
@@ -0,0 +1,73 @@
1
+ // Document definitions: `defineState(name, ...)`, its fingerprint, the one check of a definition's `initial()` (R8),
2
+ // the checked `migrate` of an older value and, for a persisted document, its checkpoint rule (slice 6a §10).
3
+ import { checkName, fingerprintOf } from "../contracts/internal.js";
4
+ import { snapshotSchema } from "../contracts/snapshot.js";
5
+ import { validatorFor } from "../data/internal.js";
6
+ export function defineState(name, options) {
7
+ checkName(name, "A state name");
8
+ const { schema, version, initial, migrate, keyed, persist, checkpointWhen } = options;
9
+ return new StateDefinition(name, schema, version, initial, migrate, keyed ?? false, persist ?? false, checkpointWhen);
10
+ }
11
+ const NEVER = () => false;
12
+ /** A declared document; `T` is its value, `K` whether it is keyed, `P` whether it is persisted. */
13
+ export class StateDefinition {
14
+ name;
15
+ schema;
16
+ version;
17
+ keyed;
18
+ persist;
19
+ /**
20
+ * `hash64` of the schema's normal form (descriptions and titles ignored), computed once: the same version with
21
+ * another fingerprint is a schema changed without a version bump.
22
+ */
23
+ fingerprint;
24
+ #initial;
25
+ #migrate;
26
+ /** Method-typed so that a definition of a narrower `T` still is a `StateDefinition<JsonObject, ...>`. */
27
+ #checkpointWhen;
28
+ #checked = false;
29
+ constructor(name, schema, version, initial, migrate, keyed, persist, checkpointWhen) {
30
+ this.name = name;
31
+ this.schema = schema;
32
+ this.version = version;
33
+ this.#initial = initial;
34
+ this.#migrate = migrate;
35
+ this.keyed = keyed;
36
+ this.persist = persist;
37
+ this.#checkpointWhen = checkpointWhen ?? NEVER;
38
+ this.fingerprint = fingerprintOf(snapshotSchema(schema, name).normal);
39
+ }
40
+ /** Whether a persisted document's change is stored as a new base (its `checkpointWhen`); never asked in memory. */
41
+ checkpointWhen(value, ops, info) {
42
+ return this.#checkpointWhen(value, ops, info);
43
+ }
44
+ /** A fresh `initial()` value; the first is checked against the schema (counted), later ones are not (R8). */
45
+ initial(context) {
46
+ const value = this.#initial();
47
+ if (this.#checked)
48
+ return value;
49
+ this.#check(value, "initial()", context);
50
+ this.#checked = true;
51
+ return value;
52
+ }
53
+ /**
54
+ * `old`, a value of version `from`, migrated to this version and checked against the schema once, as it is
55
+ * produced (R8, counted). Throws without a `migrate` (the access is refused, the data kept) and when the result does
56
+ * not match.
57
+ */
58
+ migrate(old, from, context) {
59
+ if (this.#migrate === undefined) {
60
+ throw new Error(`${this.name}: no migrate from version ${from} to ${this.version}`);
61
+ }
62
+ const value = this.#migrate(old, from);
63
+ this.#check(value, `migrate() from version ${from}`, context);
64
+ return value;
65
+ }
66
+ #check(value, what, context) {
67
+ context.telemetry.metrics?.counter("chord.data.validations").add(1);
68
+ if (!validatorFor(this, context).check(value)) {
69
+ throw new Error(`${this.name}: ${what} does not match the schema`);
70
+ }
71
+ }
72
+ }
73
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/next/documents/definition.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,6GAA6G;AAM7G,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAqDnD,MAAM,UAAU,WAAW,CAC1B,IAAY,EACZ,OAGC;IAED,SAAS,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IACtF,OAAO,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AgB;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAChC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,GAAe,EAAE,IAAY,EAAE,OAAgB;QACtD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,6BAA6B,IAAI,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,0BAA0B,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9D,OAAO,KAAK,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAQ,EAAE,IAAY,EAAE,OAAgB;QAC9C,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACpE,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,4BAA4B,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;CACD","sourcesContent":["// Document definitions: `defineState(name, ...)`, its fingerprint, the one check of a definition's `initial()` (R8),\n// the checked `migrate` of an older value and, for a persisted document, its checkpoint rule (slice 6a §10).\n\nimport type { Context } from \"../../context/index.ts\";\nimport type { Op } from \"../../delta/index.ts\";\nimport type { JsonValue } from \"../../json.ts\";\nimport type { Schema, Static } from \"../contracts/index.ts\";\nimport { checkName, fingerprintOf } from \"../contracts/internal.ts\";\nimport { snapshotSchema } from \"../contracts/snapshot.ts\";\nimport { validatorFor } from \"../data/internal.ts\";\n\n/** A document root: a JSON object. */\nexport type JsonObject = { [key: string]: JsonValue };\n\n/**\n * When a commit reaches the store (Durable's `CommitPersistence`): `immediate`, the default, before the commit\n * resolves; `deferred` (a persisted run's state change, D8): adopted and published at once, stored with the next\n * immediate change, the run's outcome, the object's close, or about `withinMs` (default 1,000 ms) later.\n */\nexport type CommitPersistence =\n\t| { readonly kind: \"immediate\" }\n\t| { readonly kind: \"deferred\"; readonly withinMs?: number };\n\n/** What a persisted document's `checkpointWhen` learns of its stored revisions. */\nexport type CheckpointInfo = {\n\t/** The deltas stored after its newest base, without the change being decided. */\n\treadonly deltasSinceBase: number;\n};\n\n/** Whether a commit's change of a persisted document is stored as a whole new base (`true`) or as a delta. */\nexport type CheckpointWhen<T> = (value: T, ops: readonly Op[], info: CheckpointInfo) => boolean;\n\n/** What `defineState` takes for any document. */\ntype StateOptions<S extends Schema, K extends boolean> = {\n\treadonly schema: S;\n\treadonly version: number;\n\treadonly initial: () => DocumentOf<S>;\n\t/** Maps a value of an older version `from` to this version's shape; pure. Required to read older values. */\n\treadonly migrate?: (old: JsonObject, from: number) => DocumentOf<S>;\n\treadonly keyed?: K;\n};\n\n/** What a persisted document adds (slice 6a §10): `checkpointWhen` is required. */\ntype PersistOptions<S extends Schema> = {\n\t/** Stored in the host's store; only in `local` types with empty params (P3). */\n\treadonly persist: true;\n\t/** Called once per commit per changed document; creations and version changes always store a base. */\n\treadonly checkpointWhen: CheckpointWhen<DocumentOf<S>>;\n};\n\n/**\n * Declares a document: a singleton per object, or with `keyed: true` many per object, each by a string key; with\n * `persist: true` stored in the host's store. Its name is a restricted name (lowercase `[a-z0-9@/._~-]`).\n */\nexport function defineState<S extends Schema, K extends boolean = false>(\n\tname: string,\n\toptions: StateOptions<S, K> & { readonly persist?: false; readonly checkpointWhen?: never },\n): StateDefinition<DocumentOf<S>, K, false>;\nexport function defineState<S extends Schema, K extends boolean = false>(\n\tname: string,\n\toptions: StateOptions<S, K> & PersistOptions<S>,\n): StateDefinition<DocumentOf<S>, K, true>;\nexport function defineState<S extends Schema, K extends boolean>(\n\tname: string,\n\toptions: StateOptions<S, K> & {\n\t\treadonly persist?: boolean;\n\t\treadonly checkpointWhen?: CheckpointWhen<DocumentOf<S>>;\n\t},\n): StateDefinition<DocumentOf<S>, K, boolean> {\n\tcheckName(name, \"A state name\");\n\tconst { schema, version, initial, migrate, keyed, persist, checkpointWhen } = options;\n\treturn new StateDefinition(\n\t\tname,\n\t\tschema,\n\t\tversion,\n\t\tinitial,\n\t\tmigrate,\n\t\tkeyed ?? false,\n\t\tpersist ?? false,\n\t\tcheckpointWhen,\n\t);\n}\n\n/** The value of a document whose schema is `S`: its static type, which must be a JSON object. */\ntype DocumentOf<S extends Schema> = Static<S> extends JsonObject ? Static<S> : never;\n\nconst NEVER: CheckpointWhen<JsonObject> = () => false;\n\n/** A declared document; `T` is its value, `K` whether it is keyed, `P` whether it is persisted. */\nexport class StateDefinition<T extends JsonObject, K extends boolean, P extends boolean = false> {\n\treadonly name: string;\n\treadonly schema: Schema;\n\treadonly version: number;\n\treadonly keyed: boolean;\n\treadonly persist: boolean;\n\t/**\n\t * `hash64` of the schema's normal form (descriptions and titles ignored), computed once: the same version with\n\t * another fingerprint is a schema changed without a version bump.\n\t */\n\treadonly fingerprint: string;\n\t/** Type only: whether the definition is keyed. */\n\tdeclare readonly \"~keyed\"?: K;\n\t/** Type only: whether the definition is persisted. */\n\tdeclare readonly \"~persist\"?: P;\n\treadonly #initial: () => T;\n\treadonly #migrate: ((old: JsonObject, from: number) => T) | undefined;\n\t/** Method-typed so that a definition of a narrower `T` still is a `StateDefinition<JsonObject, ...>`. */\n\treadonly #checkpointWhen: { rule(value: T, ops: readonly Op[], info: CheckpointInfo): boolean }[\"rule\"];\n\t#checked = false;\n\n\tconstructor(\n\t\tname: string,\n\t\tschema: Schema,\n\t\tversion: number,\n\t\tinitial: () => T,\n\t\tmigrate: ((old: JsonObject, from: number) => T) | undefined,\n\t\tkeyed: boolean,\n\t\tpersist: boolean,\n\t\tcheckpointWhen: CheckpointWhen<T> | undefined,\n\t) {\n\t\tthis.name = name;\n\t\tthis.schema = schema;\n\t\tthis.version = version;\n\t\tthis.#initial = initial;\n\t\tthis.#migrate = migrate;\n\t\tthis.keyed = keyed;\n\t\tthis.persist = persist;\n\t\tthis.#checkpointWhen = checkpointWhen ?? NEVER;\n\t\tthis.fingerprint = fingerprintOf(snapshotSchema(schema, name).normal);\n\t}\n\n\t/** Whether a persisted document's change is stored as a new base (its `checkpointWhen`); never asked in memory. */\n\tcheckpointWhen(value: T, ops: readonly Op[], info: CheckpointInfo): boolean {\n\t\treturn this.#checkpointWhen(value, ops, info);\n\t}\n\n\t/** A fresh `initial()` value; the first is checked against the schema (counted), later ones are not (R8). */\n\tinitial(context: Context): T {\n\t\tconst value = this.#initial();\n\t\tif (this.#checked) return value;\n\t\tthis.#check(value, \"initial()\", context);\n\t\tthis.#checked = true;\n\t\treturn value;\n\t}\n\n\t/**\n\t * `old`, a value of version `from`, migrated to this version and checked against the schema once, as it is\n\t * produced (R8, counted). Throws without a `migrate` (the access is refused, the data kept) and when the result does\n\t * not match.\n\t */\n\tmigrate(old: JsonObject, from: number, context: Context): T {\n\t\tif (this.#migrate === undefined) {\n\t\t\tthrow new Error(`${this.name}: no migrate from version ${from} to ${this.version}`);\n\t\t}\n\t\tconst value = this.#migrate(old, from);\n\t\tthis.#check(value, `migrate() from version ${from}`, context);\n\t\treturn value;\n\t}\n\n\t#check(value: T, what: string, context: Context): void {\n\t\tcontext.telemetry.metrics?.counter(\"chord.data.validations\").add(1);\n\t\tif (!validatorFor(this, context).check(value)) {\n\t\t\tthrow new Error(`${this.name}: ${what} does not match the schema`);\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,106 @@
1
+ import type { Context } from "../../context/index.ts";
2
+ import { ChordError } from "../data/index.ts";
3
+ import type { Batch } from "../state/internal.ts";
4
+ import type { ChordStore } from "../store/store.ts";
5
+ import type { CommitPersistence, JsonObject, StateDefinition } from "./definition.ts";
6
+ import { SealToken } from "./fence.ts";
7
+ import { type HandleOf, type KeyDeclarer } from "./handles.ts";
8
+ import { Line } from "./line.ts";
9
+ import { Residency } from "./residency.ts";
10
+ import { type AnyDefinition } from "./slot.ts";
11
+ import { Transaction } from "./transaction.ts";
12
+ /** Who owns an object's documents: the object's name, batch and context, its store address, its live failure. */
13
+ export type DocumentsOwner = {
14
+ /** The owner's name in errors. */
15
+ readonly label: string;
16
+ readonly batch: Batch;
17
+ /** The object's context: shared cold loads run under it (rule 11). */
18
+ readonly context: Context;
19
+ /** The host's store and the object's owner name in it (its type, R2), when it has one. */
20
+ readonly store: {
21
+ readonly store: ChordStore;
22
+ readonly owner: string;
23
+ } | undefined;
24
+ /** A document the code cannot read fails the live object `broken` (slice 6a §1.4); ignored when it is not live. */
25
+ fail(error: ChordError): void;
26
+ };
27
+ /**
28
+ * The documents of one object, from its first activation to its end: one slot per declared name, kept across
29
+ * attempts, and the line. Each attempt declares its handles under its own seal token; the object's own transactions
30
+ * (job outcomes) run under `own`, sealed only by the object's end.
31
+ */
32
+ export declare class Documents {
33
+ #private;
34
+ /** The owner's name in errors. */
35
+ readonly label: string;
36
+ readonly batch: Batch;
37
+ /** The object's context. */
38
+ readonly context: Context;
39
+ readonly line: Line;
40
+ /**
41
+ * The idle persisted keyed documents and their eviction. A sweep's only rejection is `onLine`'s `released` once
42
+ * the object ended (a sweep itself drops trackers in memory and does not throw): nothing to report.
43
+ */
44
+ readonly residency: Residency;
45
+ /** The token of the object's own transactions: sealed with the object (`seal`). */
46
+ readonly own: SealToken;
47
+ constructor(owner: DocumentsOwner);
48
+ /**
49
+ * A handle to `definition`'s slot for an attempt sealed by `token`, whose `at(key)` pins `declarer` takes: the slot
50
+ * made by the first declaration of its name, checked against the values for later ones (`SlotDefinition.check`).
51
+ * "Declared twice" is the attempt's check.
52
+ */
53
+ declare<D extends StateDefinition<JsonObject, boolean, boolean>>(definition: D, token: SealToken, declarer: KeyDeclarer): HandleOf<D>;
54
+ /**
55
+ * Checks a declaration of `definition` as `declare` would, changing nothing (a reload's staging: a recording factory
56
+ * declares against the documents the object has).
57
+ */
58
+ check(definition: AnyDefinition): void;
59
+ /**
60
+ * Takes an attempt's declarations once its factory returned: its `at(key)` pins replace the previous factory's, the
61
+ * slots it no longer declares are dropped (their watches end; persisted ones load again when declared again), every
62
+ * declared one hydrated (`initial()`, migrations; a throw fails the activation).
63
+ */
64
+ hydrate(declared: ReadonlyMap<string, AnyDefinition>, pins: readonly (() => void)[], context: Context): void;
65
+ /**
66
+ * Loads, in one line job, every persisted singleton not loaded yet and every pinned key not loaded since it was
67
+ * pinned (an attempt's activation, before it goes live, rule 6); `undefined` when nothing is persisted. A failure
68
+ * fails the activation.
69
+ */
70
+ load(context: Context): Promise<void> | undefined;
71
+ /**
72
+ * Runs `job` on the line (a cold load, a page of keys, an eviction sweep); refused `released` once the object is
73
+ * ending or `token` (the handle's that asks, when the job is one handle's) is sealed, a job queued before either
74
+ * included (anything taking the line after the seal is refused, rule 4).
75
+ */
76
+ onLine<T>(job: () => Promise<T>, token?: SealToken): Promise<T>;
77
+ /**
78
+ * Runs `fn` as one transaction on the line under `token` and commits what it drafted (§9): a throw, an abort of
79
+ * `context`, the token's seal or the object's end discards everything. `persistence` defers storing a run state's
80
+ * change (D8).
81
+ */
82
+ tx<R>(fn: (tx: Transaction) => R | Promise<R>, token: SealToken, context: Context, persistence?: CommitPersistence): Promise<R>;
83
+ /**
84
+ * Seals `token` (the seal fence): its transactions are refused from now on, and the one holding the line is
85
+ * discarded and the line released.
86
+ */
87
+ fence(token: SealToken): void;
88
+ /** Throws `released` once the object ended. */
89
+ assertLive(): void;
90
+ /** Throws `released` once `token` is sealed or the object is ending: no new work takes the line. */
91
+ assertAdmitted(token: SealToken): void;
92
+ /** The live object fails `broken` with `error` (a document the code cannot read); ignored when it is not live. */
93
+ fail(error: ChordError): void;
94
+ /** The object is ending: every transaction is refused, the one holding the line discarded; documents stay readable. */
95
+ seal(): void;
96
+ /**
97
+ * Resolves once the line is free. After `seal` only an admitted step can hold it (every other holder was cut):
98
+ * the object's teardown waits here, so the step adopts into documents that still exist (slice 6a §1.3).
99
+ */
100
+ settled(): Promise<void>;
101
+ /** Drops every document and pin; watches end `ended`, and every later use throws `released`. */
102
+ end(): void;
103
+ /** The `released` error of this object's documents. */
104
+ released(): ChordError;
105
+ }
106
+ //# sourceMappingURL=documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../src/next/documents/documents.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAoB,MAAM,cAAc,CAAC;AAEjF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,iHAAiH;AACjH,MAAM,MAAM,cAAc,GAAG;IAC5B,kCAAkC;IAClC,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O,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAOhD;IAED;;;;OAIG;IACG,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CASpE;IAED;;;;OAIG;IACG,EAAE,CAAC,CAAC,EACT,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACvC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,OAAO,EAChB,WAAW,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,CAAC,CAAC,CAqBZ;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAG5B;IAED,+CAA+C;IAC/C,UAAU,IAAI,IAAI,CAEjB;IAED,oGAAoG;IACpG,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAErC;IAED,kHAAkH;IAClH,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAE5B;IAED,uHAAuH;IACvH,IAAI,IAAI,IAAI,CAKX;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAG7B;IAED,gGAAgG;IAChG,GAAG,IAAI,IAAI,CAMV;IAED,uDAAuD;IACvD,QAAQ,IAAI,UAAU,CAErB;CAmBD"}
@@ -0,0 +1,224 @@
1
+ // An object's documents (§9, P2, slice 6a §1.2, §10): its slots across attempts, its line (its transactions and line
2
+ // jobs run one at a time), the seal fence over the transaction holding the line, the factory's pins between attempts,
3
+ // the activation's loads and the residency of keyed documents.
4
+ import { ChordError } from "../data/index.js";
5
+ import { SealToken } from "./fence.js";
6
+ import { Keyed, Singleton } from "./handles.js";
7
+ import { KeyedSlot } from "./keyed-slot.js";
8
+ import { Line } from "./line.js";
9
+ import { Persistence } from "./persistence.js";
10
+ import { Residency } from "./residency.js";
11
+ import { SingletonSlot } from "./slot.js";
12
+ import { Transaction } from "./transaction.js";
13
+ /**
14
+ * The documents of one object, from its first activation to its end: one slot per declared name, kept across
15
+ * attempts, and the line. Each attempt declares its handles under its own seal token; the object's own transactions
16
+ * (job outcomes) run under `own`, sealed only by the object's end.
17
+ */
18
+ export class Documents {
19
+ /** The owner's name in errors. */
20
+ label;
21
+ batch;
22
+ /** The object's context. */
23
+ context;
24
+ line = new Line();
25
+ /**
26
+ * The idle persisted keyed documents and their eviction. A sweep's only rejection is `onLine`'s `released` once
27
+ * the object ended (a sweep itself drops trackers in memory and does not throw): nothing to report.
28
+ */
29
+ residency = new Residency((sweep) => void this.onLine(async () => sweep()).catch(() => { }));
30
+ #owner;
31
+ /** The token of the object's own transactions: sealed with the object (`seal`). */
32
+ own = new SealToken();
33
+ #slots = new Map();
34
+ /** The transaction holding the line, until it settles or its token is sealed. */
35
+ #holder;
36
+ /** `sealed`: the object is ending; its documents stay readable, its transactions throw `released`. */
37
+ #state = "open";
38
+ /** The pins the last factory that returned declared (`at(key)`): held until the next one returns (rule 6). */
39
+ #pins = [];
40
+ constructor(owner) {
41
+ this.label = owner.label;
42
+ this.batch = owner.batch;
43
+ this.context = owner.context;
44
+ this.#owner = owner;
45
+ }
46
+ /**
47
+ * A handle to `definition`'s slot for an attempt sealed by `token`, whose `at(key)` pins `declarer` takes: the slot
48
+ * made by the first declaration of its name, checked against the values for later ones (`SlotDefinition.check`).
49
+ * "Declared twice" is the attempt's check.
50
+ */
51
+ declare(definition, token, declarer) {
52
+ const slot = this.#slots.get(definition.name);
53
+ if (slot !== undefined)
54
+ slot.definition.check(definition);
55
+ const persistence = slot === undefined && definition.persist ? this.#persistence(definition.name) : undefined;
56
+ // The definition's `keyed` decides the slot's class and the handle's; its documents are the definition's `T`.
57
+ if (definition.keyed) {
58
+ const keyed = slot ?? this.#add(new KeyedSlot(this, definition, persistence));
59
+ return new Keyed(keyed, token, definition.version, declarer);
60
+ }
61
+ const singleton = slot ?? this.#add(new SingletonSlot(this, definition, persistence));
62
+ return new Singleton(singleton, token, definition.version);
63
+ }
64
+ /**
65
+ * Checks a declaration of `definition` as `declare` would, changing nothing (a reload's staging: a recording factory
66
+ * declares against the documents the object has).
67
+ */
68
+ check(definition) {
69
+ this.#slots.get(definition.name)?.definition.check(definition);
70
+ }
71
+ /**
72
+ * Takes an attempt's declarations once its factory returned: its `at(key)` pins replace the previous factory's, the
73
+ * slots it no longer declares are dropped (their watches end; persisted ones load again when declared again), every
74
+ * declared one hydrated (`initial()`, migrations; a throw fails the activation).
75
+ */
76
+ hydrate(declared, pins, context) {
77
+ const previous = this.#pins;
78
+ this.#pins = pins;
79
+ for (const release of previous)
80
+ release();
81
+ // A dropped persisted slot goes whole, its loaded documents too: observably the same as keeping them, since
82
+ // every committed write is in the store and a later declaration reloads from there.
83
+ for (const [name, slot] of this.#slots) {
84
+ if (declared.has(name))
85
+ continue;
86
+ this.#slots.delete(name);
87
+ slot.drop();
88
+ }
89
+ for (const [name, definition] of declared)
90
+ this.#slots.get(name).hydrate(definition, context);
91
+ }
92
+ /**
93
+ * Loads, in one line job, every persisted singleton not loaded yet and every pinned key not loaded since it was
94
+ * pinned (an attempt's activation, before it goes live, rule 6); `undefined` when nothing is persisted. A failure
95
+ * fails the activation.
96
+ */
97
+ load(context) {
98
+ const persisted = [...this.#slots.values()].filter((slot) => slot.persisted !== undefined);
99
+ // In memory only: nothing to wait for (an activation without persisted documents takes no extra turn).
100
+ if (persisted.length === 0)
101
+ return undefined;
102
+ return this.onLine(async () => {
103
+ for (const slot of persisted)
104
+ await slot.loadDeclared(context);
105
+ });
106
+ }
107
+ /**
108
+ * Runs `job` on the line (a cold load, a page of keys, an eviction sweep); refused `released` once the object is
109
+ * ending or `token` (the handle's that asks, when the job is one handle's) is sealed, a job queued before either
110
+ * included (anything taking the line after the seal is refused, rule 4).
111
+ */
112
+ async onLine(job, token) {
113
+ if (this.#state !== "open" || token?.sealed)
114
+ throw this.released();
115
+ const release = await this.line.acquire();
116
+ try {
117
+ if (this.#state !== "open" || token?.sealed)
118
+ throw this.released();
119
+ return await job();
120
+ }
121
+ finally {
122
+ release();
123
+ }
124
+ }
125
+ /**
126
+ * Runs `fn` as one transaction on the line under `token` and commits what it drafted (§9): a throw, an abort of
127
+ * `context`, the token's seal or the object's end discards everything. `persistence` defers storing a run state's
128
+ * change (D8).
129
+ */
130
+ async tx(fn, token, context, persistence) {
131
+ this.batch.assertOutside("tx");
132
+ this.assertAdmitted(token);
133
+ const release = await this.line.acquire();
134
+ const tx = new Transaction(this, token, release, context, persistence);
135
+ try {
136
+ this.assertAdmitted(token);
137
+ this.#holder = tx;
138
+ const result = await fn(tx);
139
+ // In-memory-only commits are synchronous (W12): no await unless the store's step is taken.
140
+ const step = tx.commit();
141
+ if (step !== undefined)
142
+ await step;
143
+ return result;
144
+ }
145
+ catch (error) {
146
+ tx.discard();
147
+ throw error;
148
+ }
149
+ finally {
150
+ if (this.#holder === tx)
151
+ this.#holder = undefined;
152
+ release();
153
+ tx.settle();
154
+ }
155
+ }
156
+ /**
157
+ * Seals `token` (the seal fence): its transactions are refused from now on, and the one holding the line is
158
+ * discarded and the line released.
159
+ */
160
+ fence(token) {
161
+ token.seal();
162
+ if (this.#holder?.token === token)
163
+ this.#cut();
164
+ }
165
+ /** Throws `released` once the object ended. */
166
+ assertLive() {
167
+ if (this.#state === "ended")
168
+ throw this.released();
169
+ }
170
+ /** Throws `released` once `token` is sealed or the object is ending: no new work takes the line. */
171
+ assertAdmitted(token) {
172
+ if (token.sealed || this.#state !== "open")
173
+ throw this.released();
174
+ }
175
+ /** The live object fails `broken` with `error` (a document the code cannot read); ignored when it is not live. */
176
+ fail(error) {
177
+ this.#owner.fail(error);
178
+ }
179
+ /** The object is ending: every transaction is refused, the one holding the line discarded; documents stay readable. */
180
+ seal() {
181
+ if (this.#state !== "open")
182
+ return;
183
+ this.#state = "sealed";
184
+ this.own.seal();
185
+ this.#cut();
186
+ }
187
+ /**
188
+ * Resolves once the line is free. After `seal` only an admitted step can hold it (every other holder was cut):
189
+ * the object's teardown waits here, so the step adopts into documents that still exist (slice 6a §1.3).
190
+ */
191
+ async settled() {
192
+ const release = await this.line.acquire();
193
+ release();
194
+ }
195
+ /** Drops every document and pin; watches end `ended`, and every later use throws `released`. */
196
+ end() {
197
+ this.#state = "ended";
198
+ this.residency.end();
199
+ for (const slot of this.#slots.values())
200
+ slot.drop();
201
+ this.#slots.clear();
202
+ this.#pins = [];
203
+ }
204
+ /** The `released` error of this object's documents. */
205
+ released() {
206
+ return new ChordError({ code: "released", reason: "ended", message: `${this.label}: ended` });
207
+ }
208
+ /** Discards the transaction holding the line and releases the line. */
209
+ #cut() {
210
+ const holder = this.#holder;
211
+ this.#holder = undefined;
212
+ holder?.cut();
213
+ }
214
+ #add(slot) {
215
+ this.#slots.set(slot.definition.current.name, slot);
216
+ return slot;
217
+ }
218
+ /** The store side of persisted documents named `name`; the attempt checked the store first (P3). */
219
+ #persistence(name) {
220
+ const { store, owner } = this.#owner.store;
221
+ return new Persistence(store, owner, "chord", name);
222
+ }
223
+ }
224
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.js","sourceRoot":"","sources":["../../../src/next/documents/documents.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,sHAAsH;AACtH,+DAA+D;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAmC,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAsB,aAAa,EAAE,M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5B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,MAAM,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,IAAI,CAAsC,IAAO;QAChD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,oGAAoG;IACpG,YAAY,CAAC,IAAY;QACxB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAM,CAAC;QAC5C,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;CACD","sourcesContent":["// An object's documents (§9, P2, slice 6a §1.2, §10): its slots across attempts, its line (its transactions and line\n// jobs run one at a time), the seal fence over the transaction holding the line, the factory's pins between attempts,\n// the activation's loads and the residency of keyed documents.\n\nimport type { Context } from \"../../context/index.ts\";\nimport { ChordError } from \"../data/index.ts\";\nimport type { Batch } from \"../state/internal.ts\";\nimport type { ChordStore } from \"../store/store.ts\";\nimport type { CommitPersistence, JsonObject, StateDefinition } from \"./definition.ts\";\nimport { SealToken } from \"./fence.ts\";\nimport { type HandleOf, type KeyDeclarer, Keyed, Singleton } from \"./handles.ts\";\nimport { KeyedSlot } from \"./keyed-slot.ts\";\nimport { Line } from \"./line.ts\";\nimport { Persistence } from \"./persistence.ts\";\nimport { Residency } from \"./residency.ts\";\nimport { type AnyDefinition, SingletonSlot } from \"./slot.ts\";\nimport { Transaction } from \"./transaction.ts\";\n\n/** Who owns an object's documents: the object's name, batch and context, its store address, its live failure. */\nexport type DocumentsOwner = {\n\t/** The owner's name in errors. */\n\treadonly label: string;\n\treadonly batch: Batch;\n\t/** The object's context: shared cold loads run under it (rule 11). */\n\treadonly context: Context;\n\t/** The host's store and the object's owner name in it (its type, R2), when it has one. */\n\treadonly store: { readonly store: ChordStore; readonly owner: string } | undefined;\n\t/** A document the code cannot read fails the live object `broken` (slice 6a §1.4); ignored when it is not live. */\n\tfail(error: ChordError): void;\n};\n\n/**\n * The documents of one object, from its first activation to its end: one slot per declared name, kept across\n * attempts, and the line. Each attempt declares its handles under its own seal token; the object's own transactions\n * (job outcomes) run under `own`, sealed only by the object's end.\n */\nexport class Documents {\n\t/** The owner's name in errors. */\n\treadonly label: string;\n\treadonly batch: Batch;\n\t/** The object's context. */\n\treadonly context: Context;\n\treadonly line = new Line();\n\t/**\n\t * The idle persisted keyed documents and their eviction. A sweep's only rejection is `onLine`'s `released` once\n\t * the object ended (a sweep itself drops trackers in memory and does not throw): nothing to report.\n\t */\n\treadonly residency = new Residency((sweep) => void this.onLine(async () => sweep()).catch(() => {}));\n\treadonly #owner: DocumentsOwner;\n\t/** The token of the object's own transactions: sealed with the object (`seal`). */\n\treadonly own = new SealToken();\n\treadonly #slots = new Map<string, SingletonSlot | KeyedSlot>();\n\t/** The transaction holding the line, until it settles or its token is sealed. */\n\t#holder: Transaction | undefined;\n\t/** `sealed`: the object is ending; its documents stay readable, its transactions throw `released`. */\n\t#state: \"open\" | \"sealed\" | \"ended\" = \"open\";\n\t/** The pins the last factory that returned declared (`at(key)`): held until the next one returns (rule 6). */\n\t#pins: readonly (() => void)[] = [];\n\n\tconstructor(owner: DocumentsOwner) {\n\t\tthis.label = owner.label;\n\t\tthis.batch = owner.batch;\n\t\tthis.context = owner.context;\n\t\tthis.#owner = owner;\n\t}\n\n\t/**\n\t * A handle to `definition`'s slot for an attempt sealed by `token`, whose `at(key)` pins `declarer` takes: the slot\n\t * made by the first declaration of its name, checked against the values for later ones (`SlotDefinition.check`).\n\t * \"Declared twice\" is the attempt's check.\n\t */\n\tdeclare<D extends StateDefinition<JsonObject, boolean, boolean>>(\n\t\tdefinition: D,\n\t\ttoken: SealToken,\n\t\tdeclarer: KeyDeclarer,\n\t): HandleOf<D> {\n\t\tconst slot = this.#slots.get(definition.name);\n\t\tif (slot !== undefined) slot.definition.check(definition);\n\t\tconst persistence = slot === undefined && definition.persist ? this.#persistence(definition.name) : undefined;\n\t\t// The definition's `keyed` decides the slot's class and the handle's; its documents are the definition's `T`.\n\t\tif (definition.keyed) {\n\t\t\tconst keyed = slot ?? this.#add(new KeyedSlot(this, definition, persistence));\n\t\t\treturn new Keyed(keyed as KeyedSlot, token, definition.version, declarer) as unknown as HandleOf<D>;\n\t\t}\n\t\tconst singleton = slot ?? this.#add(new SingletonSlot(this, definition, persistence));\n\t\treturn new Singleton(singleton as SingletonSlot, token, definition.version) as unknown as HandleOf<D>;\n\t}\n\n\t/**\n\t * Checks a declaration of `definition` as `declare` would, changing nothing (a reload's staging: a recording factory\n\t * declares against the documents the object has).\n\t */\n\tcheck(definition: AnyDefinition): void {\n\t\tthis.#slots.get(definition.name)?.definition.check(definition);\n\t}\n\n\t/**\n\t * Takes an attempt's declarations once its factory returned: its `at(key)` pins replace the previous factory's, the\n\t * slots it no longer declares are dropped (their watches end; persisted ones load again when declared again), every\n\t * declared one hydrated (`initial()`, migrations; a throw fails the activation).\n\t */\n\thydrate(declared: ReadonlyMap<string, AnyDefinition>, pins: readonly (() => void)[], context: Context): void {\n\t\tconst previous = this.#pins;\n\t\tthis.#pins = pins;\n\t\tfor (const release of previous) release();\n\t\t// A dropped persisted slot goes whole, its loaded documents too: observably the same as keeping them, since\n\t\t// every committed write is in the store and a later declaration reloads from there.\n\t\tfor (const [name, slot] of this.#slots) {\n\t\t\tif (declared.has(name)) continue;\n\t\t\tthis.#slots.delete(name);\n\t\t\tslot.drop();\n\t\t}\n\t\tfor (const [name, definition] of declared) this.#slots.get(name)!.hydrate(definition, context);\n\t}\n\n\t/**\n\t * Loads, in one line job, every persisted singleton not loaded yet and every pinned key not loaded since it was\n\t * pinned (an attempt's activation, before it goes live, rule 6); `undefined` when nothing is persisted. A failure\n\t * fails the activation.\n\t */\n\tload(context: Context): Promise<void> | undefined {\n\t\tconst persisted = [...this.#slots.values()].filter((slot) => slot.persisted !== undefined);\n\t\t// In memory only: nothing to wait for (an activation without persisted documents takes no extra turn).\n\t\tif (persisted.length === 0) return undefined;\n\t\treturn this.onLine(async () => {\n\t\t\tfor (const slot of persisted) await slot.loadDeclared(context);\n\t\t});\n\t}\n\n\t/**\n\t * Runs `job` on the line (a cold load, a page of keys, an eviction sweep); refused `released` once the object is\n\t * ending or `token` (the handle's that asks, when the job is one handle's) is sealed, a job queued before either\n\t * included (anything taking the line after the seal is refused, rule 4).\n\t */\n\tasync onLine<T>(job: () => Promise<T>, token?: SealToken): Promise<T> {\n\t\tif (this.#state !== \"open\" || token?.sealed) throw this.released();\n\t\tconst release = await this.line.acquire();\n\t\ttry {\n\t\t\tif (this.#state !== \"open\" || token?.sealed) throw this.released();\n\t\t\treturn await job();\n\t\t} finally {\n\t\t\trelease();\n\t\t}\n\t}\n\n\t/**\n\t * Runs `fn` as one transaction on the line under `token` and commits what it drafted (§9): a throw, an abort of\n\t * `context`, the token's seal or the object's end discards everything. `persistence` defers storing a run state's\n\t * change (D8).\n\t */\n\tasync tx<R>(\n\t\tfn: (tx: Transaction) => R | Promise<R>,\n\t\ttoken: SealToken,\n\t\tcontext: Context,\n\t\tpersistence?: CommitPersistence,\n\t): Promise<R> {\n\t\tthis.batch.assertOutside(\"tx\");\n\t\tthis.assertAdmitted(token);\n\t\tconst release = await this.line.acquire();\n\t\tconst tx = new Transaction(this, token, release, context, persistence);\n\t\ttry {\n\t\t\tthis.assertAdmitted(token);\n\t\t\tthis.#holder = tx;\n\t\t\tconst result = await fn(tx);\n\t\t\t// In-memory-only commits are synchronous (W12): no await unless the store's step is taken.\n\t\t\tconst step = tx.commit();\n\t\t\tif (step !== undefined) await step;\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\ttx.discard();\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (this.#holder === tx) this.#holder = undefined;\n\t\t\trelease();\n\t\t\ttx.settle();\n\t\t}\n\t}\n\n\t/**\n\t * Seals `token` (the seal fence): its transactions are refused from now on, and the one holding the line is\n\t * discarded and the line released.\n\t */\n\tfence(token: SealToken): void {\n\t\ttoken.seal();\n\t\tif (this.#holder?.token === token) this.#cut();\n\t}\n\n\t/** Throws `released` once the object ended. */\n\tassertLive(): void {\n\t\tif (this.#state === \"ended\") throw this.released();\n\t}\n\n\t/** Throws `released` once `token` is sealed or the object is ending: no new work takes the line. */\n\tassertAdmitted(token: SealToken): void {\n\t\tif (token.sealed || this.#state !== \"open\") throw this.released();\n\t}\n\n\t/** The live object fails `broken` with `error` (a document the code cannot read); ignored when it is not live. */\n\tfail(error: ChordError): void {\n\t\tthis.#owner.fail(error);\n\t}\n\n\t/** The object is ending: every transaction is refused, the one holding the line discarded; documents stay readable. */\n\tseal(): void {\n\t\tif (this.#state !== \"open\") return;\n\t\tthis.#state = \"sealed\";\n\t\tthis.own.seal();\n\t\tthis.#cut();\n\t}\n\n\t/**\n\t * Resolves once the line is free. After `seal` only an admitted step can hold it (every other holder was cut):\n\t * the object's teardown waits here, so the step adopts into documents that still exist (slice 6a §1.3).\n\t */\n\tasync settled(): Promise<void> {\n\t\tconst release = await this.line.acquire();\n\t\trelease();\n\t}\n\n\t/** Drops every document and pin; watches end `ended`, and every later use throws `released`. */\n\tend(): void {\n\t\tthis.#state = \"ended\";\n\t\tthis.residency.end();\n\t\tfor (const slot of this.#slots.values()) slot.drop();\n\t\tthis.#slots.clear();\n\t\tthis.#pins = [];\n\t}\n\n\t/** The `released` error of this object's documents. */\n\treleased(): ChordError {\n\t\treturn new ChordError({ code: \"released\", reason: \"ended\", message: `${this.label}: ended` });\n\t}\n\n\t/** Discards the transaction holding the line and releases the line. */\n\t#cut(): void {\n\t\tconst holder = this.#holder;\n\t\tthis.#holder = undefined;\n\t\tholder?.cut();\n\t}\n\n\t#add<S extends SingletonSlot | KeyedSlot>(slot: S): S {\n\t\tthis.#slots.set(slot.definition.current.name, slot);\n\t\treturn slot;\n\t}\n\n\t/** The store side of persisted documents named `name`; the attempt checked the store first (P3). */\n\t#persistence(name: string): Persistence {\n\t\tconst { store, owner } = this.#owner.store!;\n\t\treturn new Persistence(store, owner, \"chord\", name);\n\t}\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /** One seal token; sealed once, never unsealed. */
2
+ export declare class SealToken {
3
+ #private;
4
+ /** Whether work under this token is refused. */
5
+ get sealed(): boolean;
6
+ /** Seals the token; `Documents.fence` also discards the transaction it holds open. */
7
+ seal(): void;
8
+ }
9
+ //# sourceMappingURL=fence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../../../src/next/documents/fence.ts"],"names":[],"mappings":"AAGA,mDAAmD;AACnD,qBAAa,SAAS;;IAGrB,gDAAgD;IAChD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,sFAAsF;IACtF,IAAI,IAAI,IAAI,CAEX;CACD"}
@@ -0,0 +1,15 @@
1
+ // The seal fence (slice 6a §1.3): the token an attempt, a job run's invocation or the object itself hands its
2
+ // transactions. Once sealed, new transactions under it are refused `released` and the open one is discarded.
3
+ /** One seal token; sealed once, never unsealed. */
4
+ export class SealToken {
5
+ #sealed = false;
6
+ /** Whether work under this token is refused. */
7
+ get sealed() {
8
+ return this.#sealed;
9
+ }
10
+ /** Seals the token; `Documents.fence` also discards the transaction it holds open. */
11
+ seal() {
12
+ this.#sealed = true;
13
+ }
14
+ }
15
+ //# sourceMappingURL=fence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fence.js","sourceRoot":"","sources":["../../../src/next/documents/fence.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,6GAA6G;AAE7G,mDAAmD;AACnD,MAAM,OAAO,SAAS;IACrB,OAAO,GAAG,KAAK,CAAC;IAEhB,gDAAgD;IAChD,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAED,sFAAsF;IACtF,IAAI;QACH,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACrB,CAAC;CACD","sourcesContent":["// The seal fence (slice 6a §1.3): the token an attempt, a job run's invocation or the object itself hands its\n// transactions. Once sealed, new transactions under it are refused `released` and the open one is discarded.\n\n/** One seal token; sealed once, never unsealed. */\nexport class SealToken {\n\t#sealed = false;\n\n\t/** Whether work under this token is refused. */\n\tget sealed(): boolean {\n\t\treturn this.#sealed;\n\t}\n\n\t/** Seals the token; `Documents.fence` also discards the transaction it holds open. */\n\tseal(): void {\n\t\tthis.#sealed = true;\n\t}\n}\n"]}
@@ -0,0 +1,76 @@
1
+ import type { Context } from "../../context/index.ts";
2
+ import type { Draft } from "../../delta/index.ts";
3
+ import type { Watch, Watchable, WatchHandle } from "../../watch.ts";
4
+ import type { JsonObject, StateDefinition } from "./definition.ts";
5
+ import type { SealToken } from "./fence.ts";
6
+ import type { KeyedSlot, KeySource } from "./keyed-slot.ts";
7
+ import type { SingletonSlot } from "./slot.ts";
8
+ /** A singleton document: a watchable that always has a value (`initial()` until written, and after a retire). */
9
+ export interface SingletonHandle<T extends JsonObject> extends Watchable<T> {
10
+ /** One transaction that drafts this document and passes the draft to `fn`. */
11
+ change<R>(fn: (draft: Draft<T>) => R, context: Context): Promise<R>;
12
+ /** One transaction that retires this document: back to `initial()`. */
13
+ retire(context: Context): Promise<void>;
14
+ }
15
+ /**
16
+ * Keyed documents: many per object, by string key. Not a watchable itself: each key is, through `watch(key)` and
17
+ * `at(key)`; a live collection is a singleton holding it.
18
+ */
19
+ export interface KeyedHandle<T extends JsonObject> {
20
+ /** The document's value, `undefined` when absent (persisted and not in memory: loaded on the object's line). */
21
+ get(key: string, context: Context): Promise<T | undefined>;
22
+ /** The keys of the present documents, in code point order. */
23
+ keys(context: Context): AsyncIterable<string>;
24
+ /**
25
+ * A watch of the document at `key`, `undefined` when absent. It follows the address: a retirement is one frame with
26
+ * `retired: true` and `initial()`, a later creation a root replacement; it ends with the object.
27
+ */
28
+ watch(key: string, context: Context): Promise<WatchHandle<T> | undefined>;
29
+ /**
30
+ * In the factory only: the document at `key` as a watchable (a state member, a derive source, an `on` source),
31
+ * `initial()` while absent, loaded before the object goes live and pinned while this attempt lives.
32
+ */
33
+ at(key: string): Watchable<T>;
34
+ /** One transaction that drafts the document at `key` and passes the draft to `fn`. */
35
+ change<R>(key: string, fn: (draft: Draft<T>) => R, context: Context): Promise<R>;
36
+ /** One transaction that retires the document at `key` (a no-op when absent). */
37
+ retire(key: string, context: Context): Promise<void>;
38
+ }
39
+ /** The handle `self.state(definition)` returns. */
40
+ export type HandleOf<D> = D extends StateDefinition<infer T, infer K, boolean> ? K extends true ? KeyedHandle<T> : SingletonHandle<T> : never;
41
+ /**
42
+ * A singleton's handle. Reads go to the slot (allowed after the seal); `change` and `retire` take the line under the
43
+ * attempt's token. Exposed as a member or read by a derive, it resolves to the slot itself.
44
+ */
45
+ export declare class Singleton implements SingletonHandle<JsonObject> {
46
+ readonly slot: SingletonSlot;
47
+ readonly token: SealToken;
48
+ /** The version of the definition it was declared with: the slot refuses it once its values are newer (R15). */
49
+ readonly version: number;
50
+ constructor(slot: SingletonSlot, token: SealToken, version: number);
51
+ get value(): JsonObject;
52
+ watch(context: Context): Promise<Watch<JsonObject>>;
53
+ change<R>(fn: (draft: Draft<JsonObject>) => R, context: Context): Promise<R>;
54
+ retire(context: Context): Promise<void>;
55
+ }
56
+ /** Who declares an attempt's `at(key)` pins: its factory, which alone may (the attempt). */
57
+ export interface KeyDeclarer {
58
+ /** Pins `key` of `slot` for the attempt and returns its source; throws outside the factory. */
59
+ at(slot: KeyedSlot, key: string): KeySource;
60
+ }
61
+ /** A keyed handle: reads go to the slot; `change`, `retire` and cold reads take the line under the attempt's token. */
62
+ export declare class Keyed implements KeyedHandle<JsonObject> {
63
+ #private;
64
+ readonly slot: KeyedSlot;
65
+ readonly token: SealToken;
66
+ /** As `Singleton.version`. */
67
+ readonly version: number;
68
+ constructor(slot: KeyedSlot, token: SealToken, version: number, declarer: KeyDeclarer);
69
+ get(key: string, context: Context): Promise<JsonObject | undefined>;
70
+ keys(context: Context): AsyncIterable<string>;
71
+ watch(key: string, context: Context): Promise<Watch<JsonObject> | undefined>;
72
+ at(key: string): Watchable<JsonObject>;
73
+ change<R>(key: string, fn: (draft: Draft<JsonObject>) => R, context: Context): Promise<R>;
74
+ retire(key: string, context: Context): Promise<void>;
75
+ }
76
+ //# sourceMappingURL=handles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../../src/next/documents/handles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,iHAAiH;AACjH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,UAAU,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAC1E,8EAA8E;IAC9E,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACpE,uEAAuE;IACvE,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,UAAU;IAChD,gHAAgH;IAChH,GAAG,CAAC,GAAG,EAAE,M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