@elaraai/e3-ui 1.0.98 → 1.0.99

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 (381) hide show
  1. package/README.md +0 -2
  2. package/dist/src/allocation/adapters.d.ts +1 -1
  3. package/dist/src/allocation/adapters.js +1 -1
  4. package/dist/src/allocation/index.d.ts +46 -90
  5. package/dist/src/allocation/index.d.ts.map +1 -1
  6. package/dist/src/allocation/index.js +5 -5
  7. package/dist/src/allocation/index.js.map +1 -1
  8. package/dist/src/bind/data-indexed.d.ts +273 -51
  9. package/dist/src/bind/data-indexed.d.ts.map +1 -1
  10. package/dist/src/bind/data-indexed.js +233 -56
  11. package/dist/src/bind/data-indexed.js.map +1 -1
  12. package/dist/src/bind/data.d.ts +48 -9
  13. package/dist/src/bind/data.d.ts.map +1 -1
  14. package/dist/src/bind/data.js +48 -3
  15. package/dist/src/bind/data.js.map +1 -1
  16. package/dist/src/bind/record.d.ts +61 -24
  17. package/dist/src/bind/record.d.ts.map +1 -1
  18. package/dist/src/bind/record.js +17 -57
  19. package/dist/src/bind/record.js.map +1 -1
  20. package/dist/src/calendar/index.d.ts +55 -95
  21. package/dist/src/calendar/index.d.ts.map +1 -1
  22. package/dist/src/calendar/index.js +10 -6
  23. package/dist/src/calendar/index.js.map +1 -1
  24. package/dist/src/flowchart/index.d.ts +35 -31
  25. package/dist/src/flowchart/index.d.ts.map +1 -1
  26. package/dist/src/flowchart/index.js +35 -31
  27. package/dist/src/flowchart/index.js.map +1 -1
  28. package/dist/src/flowchart/library.d.ts +108 -84
  29. package/dist/src/flowchart/library.d.ts.map +1 -1
  30. package/dist/src/flowchart/library.js +108 -84
  31. package/dist/src/flowchart/library.js.map +1 -1
  32. package/dist/src/flowchart/payload.d.ts +39 -107
  33. package/dist/src/flowchart/payload.d.ts.map +1 -1
  34. package/dist/src/flowchart/payload.js +3 -3
  35. package/dist/src/flowchart/payload.js.map +1 -1
  36. package/dist/src/flowchart/values.d.ts +35 -31
  37. package/dist/src/flowchart/values.d.ts.map +1 -1
  38. package/dist/src/flowchart/values.js +35 -31
  39. package/dist/src/flowchart/values.js.map +1 -1
  40. package/dist/src/flowchart/window.d.ts +0 -12
  41. package/dist/src/flowchart/window.d.ts.map +1 -1
  42. package/dist/src/flowchart/window.js +3 -2
  43. package/dist/src/flowchart/window.js.map +1 -1
  44. package/dist/src/index.d.ts +2 -2
  45. package/dist/src/index.d.ts.map +1 -1
  46. package/dist/src/index.js +1 -1
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/internal.d.ts +7 -3
  49. package/dist/src/internal.d.ts.map +1 -1
  50. package/dist/src/internal.js +12 -3
  51. package/dist/src/internal.js.map +1 -1
  52. package/dist/src/plan/assemble.d.ts +8 -0
  53. package/dist/src/plan/assemble.d.ts.map +1 -1
  54. package/dist/src/plan/assemble.js +1 -1
  55. package/dist/src/plan/assemble.js.map +1 -1
  56. package/dist/src/plan/builders.d.ts +1518 -2
  57. package/dist/src/plan/builders.d.ts.map +1 -1
  58. package/dist/src/plan/builders.js +248 -114
  59. package/dist/src/plan/builders.js.map +1 -1
  60. package/dist/src/plan/event-rows.d.ts +9 -14
  61. package/dist/src/plan/event-rows.d.ts.map +1 -1
  62. package/dist/src/plan/event-rows.js +6 -46
  63. package/dist/src/plan/event-rows.js.map +1 -1
  64. package/dist/src/plan/factories.d.ts +72 -4
  65. package/dist/src/plan/factories.d.ts.map +1 -1
  66. package/dist/src/plan/factories.js +147 -1
  67. package/dist/src/plan/factories.js.map +1 -1
  68. package/dist/src/plan/index.d.ts +147 -125
  69. package/dist/src/plan/index.d.ts.map +1 -1
  70. package/dist/src/plan/index.js +135 -122
  71. package/dist/src/plan/index.js.map +1 -1
  72. package/dist/src/plan/ir.d.ts +1105 -44
  73. package/dist/src/plan/ir.d.ts.map +1 -1
  74. package/dist/src/plan/ir.js +5 -0
  75. package/dist/src/plan/ir.js.map +1 -1
  76. package/dist/src/plan/library.d.ts +65 -42
  77. package/dist/src/plan/library.d.ts.map +1 -1
  78. package/dist/src/plan/library.js +65 -42
  79. package/dist/src/plan/library.js.map +1 -1
  80. package/dist/src/plan/nested-checks.d.ts +146 -0
  81. package/dist/src/plan/nested-checks.d.ts.map +1 -0
  82. package/dist/src/plan/nested-checks.js +468 -0
  83. package/dist/src/plan/nested-checks.js.map +1 -0
  84. package/dist/src/plan/nested-patch.d.ts +35 -0
  85. package/dist/src/plan/nested-patch.d.ts.map +1 -0
  86. package/dist/src/plan/nested-patch.js +143 -0
  87. package/dist/src/plan/nested-patch.js.map +1 -0
  88. package/dist/src/plan/nested-read.d.ts +3250 -0
  89. package/dist/src/plan/nested-read.d.ts.map +1 -0
  90. package/dist/src/plan/nested-read.js +163 -0
  91. package/dist/src/plan/nested-read.js.map +1 -0
  92. package/dist/src/plan/nested.d.ts +280 -0
  93. package/dist/src/plan/nested.d.ts.map +1 -0
  94. package/dist/src/plan/nested.js +6 -0
  95. package/dist/src/plan/nested.js.map +1 -0
  96. package/dist/src/plan/ordered-source.d.ts +1030 -1
  97. package/dist/src/plan/ordered-source.d.ts.map +1 -1
  98. package/dist/src/plan/ordered-source.js +48 -6
  99. package/dist/src/plan/ordered-source.js.map +1 -1
  100. package/dist/src/plan/over.d.ts +111 -75
  101. package/dist/src/plan/over.d.ts.map +1 -1
  102. package/dist/src/plan/over.js +111 -75
  103. package/dist/src/plan/over.js.map +1 -1
  104. package/dist/src/plan/pick.d.ts +15 -3
  105. package/dist/src/plan/pick.d.ts.map +1 -1
  106. package/dist/src/plan/pick.js +75 -36
  107. package/dist/src/plan/pick.js.map +1 -1
  108. package/dist/src/plan/plan.d.ts +2719 -558
  109. package/dist/src/plan/plan.d.ts.map +1 -1
  110. package/dist/src/plan/plan.js +14 -2
  111. package/dist/src/plan/plan.js.map +1 -1
  112. package/dist/src/plan/reads.d.ts +421 -0
  113. package/dist/src/plan/reads.d.ts.map +1 -0
  114. package/dist/src/plan/reads.js +143 -0
  115. package/dist/src/plan/reads.js.map +1 -0
  116. package/dist/src/plan/refs.d.ts +111 -75
  117. package/dist/src/plan/refs.d.ts.map +1 -1
  118. package/dist/src/plan/refs.js +111 -75
  119. package/dist/src/plan/refs.js.map +1 -1
  120. package/dist/src/plan/root.d.ts +10 -5
  121. package/dist/src/plan/root.d.ts.map +1 -1
  122. package/dist/src/plan/root.js +76 -13
  123. package/dist/src/plan/root.js.map +1 -1
  124. package/dist/src/plan/series.d.ts +5140 -4331
  125. package/dist/src/plan/series.d.ts.map +1 -1
  126. package/dist/src/plan/series.js +1026 -264
  127. package/dist/src/plan/series.js.map +1 -1
  128. package/dist/src/plan/shade.d.ts +981 -0
  129. package/dist/src/plan/shade.d.ts.map +1 -0
  130. package/dist/src/plan/shade.js +60 -0
  131. package/dist/src/plan/shade.js.map +1 -0
  132. package/dist/src/plan/types.d.ts +178 -18
  133. package/dist/src/plan/types.d.ts.map +1 -1
  134. package/dist/src/plan/types.js +69 -19
  135. package/dist/src/plan/types.js.map +1 -1
  136. package/dist/src/query/builder.d.ts +3 -3
  137. package/dist/src/query/builder.d.ts.map +1 -1
  138. package/dist/src/query/builder.js +1 -1
  139. package/dist/src/query/library.d.ts +3 -3
  140. package/dist/src/query/library.d.ts.map +1 -1
  141. package/dist/src/query/library.js +1 -1
  142. package/dist/src/query/queries.d.ts +2 -2
  143. package/dist/src/query/queries.js +1 -1
  144. package/dist/src/query/saved.d.ts +8 -4
  145. package/dist/src/query/saved.d.ts.map +1 -1
  146. package/dist/src/query/saved.js +8 -4
  147. package/dist/src/query/saved.js.map +1 -1
  148. package/dist/src/query/types.d.ts +8 -3
  149. package/dist/src/query/types.d.ts.map +1 -1
  150. package/dist/src/query/types.js +8 -3
  151. package/dist/src/query/types.js.map +1 -1
  152. package/dist/src/roster/index.d.ts +47 -91
  153. package/dist/src/roster/index.d.ts.map +1 -1
  154. package/dist/src/roster/index.js +6 -6
  155. package/dist/src/roster/index.js.map +1 -1
  156. package/dist/src/roster/targets.d.ts +8 -4
  157. package/dist/src/roster/targets.d.ts.map +1 -1
  158. package/dist/src/roster/targets.js +9 -5
  159. package/dist/src/roster/targets.js.map +1 -1
  160. package/dist/src/schedule/cell-checks.js +3 -3
  161. package/dist/src/schedule/cell-checks.js.map +1 -1
  162. package/dist/src/schedule/days.d.ts +1 -1
  163. package/dist/src/schedule/days.js +1 -1
  164. package/dist/src/schedule/events.d.ts +10 -6
  165. package/dist/src/schedule/events.d.ts.map +1 -1
  166. package/dist/src/schedule/events.js +252 -228
  167. package/dist/src/schedule/events.js.map +1 -1
  168. package/dist/src/schedule/patch.d.ts +1 -1
  169. package/dist/src/schedule/patch.js +1 -1
  170. package/dist/src/schedule/periods.d.ts +8 -4
  171. package/dist/src/schedule/periods.d.ts.map +1 -1
  172. package/dist/src/schedule/periods.js +1 -1
  173. package/dist/src/schedule/periods.js.map +1 -1
  174. package/dist/src/schedule/record-window.d.ts +38 -58
  175. package/dist/src/schedule/record-window.d.ts.map +1 -1
  176. package/dist/src/schedule/record-window.js +15 -16
  177. package/dist/src/schedule/record-window.js.map +1 -1
  178. package/dist/src/schedule/resources.d.ts +1 -1
  179. package/dist/src/schedule/session.d.ts +1 -1
  180. package/dist/src/schedule/session.js +1 -1
  181. package/dist/src/schedule/types.d.ts +29 -1
  182. package/dist/src/schedule/types.d.ts.map +1 -1
  183. package/dist/src/schedule/types.js +16 -1
  184. package/dist/src/schedule/types.js.map +1 -1
  185. package/dist/src/schematic/index.d.ts +19 -9
  186. package/dist/src/schematic/index.d.ts.map +1 -1
  187. package/dist/src/schematic/index.js +19 -9
  188. package/dist/src/schematic/index.js.map +1 -1
  189. package/dist/src/schematic/kinds.d.ts +4 -4
  190. package/dist/src/schematic/kinds.js +9 -9
  191. package/dist/src/schematic/kinds.js.map +1 -1
  192. package/dist/src/schematic/payload.d.ts +38 -88
  193. package/dist/src/schematic/payload.d.ts.map +1 -1
  194. package/dist/src/schematic/payload.js +4 -4
  195. package/dist/src/schematic/payload.js.map +1 -1
  196. package/dist/src/schematic/window.d.ts +8 -7
  197. package/dist/src/schematic/window.d.ts.map +1 -1
  198. package/dist/src/schematic/window.js +22 -19
  199. package/dist/src/schematic/window.js.map +1 -1
  200. package/dist/src/sheet/bridge.d.ts +19 -0
  201. package/dist/src/sheet/bridge.d.ts.map +1 -1
  202. package/dist/src/sheet/bridge.js +28 -21
  203. package/dist/src/sheet/bridge.js.map +1 -1
  204. package/dist/src/sheet/index.d.ts +66 -46
  205. package/dist/src/sheet/index.d.ts.map +1 -1
  206. package/dist/src/sheet/index.js +66 -46
  207. package/dist/src/sheet/index.js.map +1 -1
  208. package/dist/src/sheet/library.d.ts +13 -8
  209. package/dist/src/sheet/library.d.ts.map +1 -1
  210. package/dist/src/sheet/library.js +13 -8
  211. package/dist/src/sheet/library.js.map +1 -1
  212. package/dist/src/sheet/record.d.ts +1 -1
  213. package/dist/src/sheet/record.js +2 -2
  214. package/dist/src/sheet/record.js.map +1 -1
  215. package/dist/src/sheet/registers.d.ts +152 -128
  216. package/dist/src/sheet/registers.d.ts.map +1 -1
  217. package/dist/src/sheet/registers.js +152 -128
  218. package/dist/src/sheet/registers.js.map +1 -1
  219. package/dist/src/sheet/root.d.ts +4 -1
  220. package/dist/src/sheet/root.d.ts.map +1 -1
  221. package/dist/src/sheet/root.js +15 -3
  222. package/dist/src/sheet/root.js.map +1 -1
  223. package/dist/src/sheet/sheet.d.ts +39 -113
  224. package/dist/src/sheet/sheet.d.ts.map +1 -1
  225. package/dist/src/sheet/sheet.js +7 -5
  226. package/dist/src/sheet/sheet.js.map +1 -1
  227. package/dist/src/sheet/sub-rows.d.ts +106 -76
  228. package/dist/src/sheet/sub-rows.d.ts.map +1 -1
  229. package/dist/src/sheet/sub-rows.js +106 -76
  230. package/dist/src/sheet/sub-rows.js.map +1 -1
  231. package/dist/src/sheet/types.d.ts +19 -62
  232. package/dist/src/sheet/types.d.ts.map +1 -1
  233. package/dist/src/studio/builder.d.ts +3 -153
  234. package/dist/src/studio/builder.d.ts.map +1 -1
  235. package/dist/src/studio/builder.js +1 -1
  236. package/dist/src/studio/canvas.d.ts +5 -4
  237. package/dist/src/studio/canvas.d.ts.map +1 -1
  238. package/dist/src/studio/canvas.js +8 -7
  239. package/dist/src/studio/canvas.js.map +1 -1
  240. package/dist/src/studio/component.d.ts +30 -20
  241. package/dist/src/studio/component.d.ts.map +1 -1
  242. package/dist/src/studio/component.js +26 -61
  243. package/dist/src/studio/component.js.map +1 -1
  244. package/dist/src/studio/index.d.ts +2 -2
  245. package/dist/src/studio/index.d.ts.map +1 -1
  246. package/dist/src/studio/index.js +1 -1
  247. package/dist/src/studio/index.js.map +1 -1
  248. package/dist/src/studio/inspector.d.ts +10 -39
  249. package/dist/src/studio/inspector.d.ts.map +1 -1
  250. package/dist/src/studio/inspector.js +11 -31
  251. package/dist/src/studio/inspector.js.map +1 -1
  252. package/dist/src/studio/library.d.ts +3 -169
  253. package/dist/src/studio/library.d.ts.map +1 -1
  254. package/dist/src/studio/library.js +1 -1
  255. package/dist/src/studio/page.d.ts +0 -8
  256. package/dist/src/studio/page.d.ts.map +1 -1
  257. package/dist/src/studio/pages.d.ts +17 -591
  258. package/dist/src/studio/pages.d.ts.map +1 -1
  259. package/dist/src/studio/pages.js +17 -44
  260. package/dist/src/studio/pages.js.map +1 -1
  261. package/dist/src/studio/palette.d.ts +2 -7
  262. package/dist/src/studio/palette.d.ts.map +1 -1
  263. package/dist/src/studio/palette.js +4 -5
  264. package/dist/src/studio/palette.js.map +1 -1
  265. package/dist/src/studio/publish.d.ts +8 -18
  266. package/dist/src/studio/publish.d.ts.map +1 -1
  267. package/dist/src/studio/publish.js +10 -36
  268. package/dist/src/studio/publish.js.map +1 -1
  269. package/dist/src/utils/derive.d.ts +12 -12
  270. package/dist/src/utils/derive.d.ts.map +1 -1
  271. package/dist/src/utils/derive.js +5 -2
  272. package/dist/src/utils/derive.js.map +1 -1
  273. package/dist/src/utils/ordered-source.d.ts.map +1 -1
  274. package/dist/src/utils/ordered-source.js +14 -5
  275. package/dist/src/utils/ordered-source.js.map +1 -1
  276. package/dist/test/allocation/allocation.examples.d.ts +1900 -1598
  277. package/dist/test/allocation/allocation.examples.d.ts.map +1 -1
  278. package/dist/test/allocation/allocation.examples.js +179 -89
  279. package/dist/test/allocation/allocation.examples.js.map +1 -1
  280. package/dist/test/allocation/optimise.examples.d.ts.map +1 -1
  281. package/dist/test/allocation/optimise.examples.js +7 -7
  282. package/dist/test/allocation/optimise.examples.js.map +1 -1
  283. package/dist/test/bind/data/data.examples.d.ts +1057 -903
  284. package/dist/test/bind/data/data.examples.d.ts.map +1 -1
  285. package/dist/test/bind/data/data.examples.js +260 -204
  286. package/dist/test/bind/data/data.examples.js.map +1 -1
  287. package/dist/test/bind/record/record.examples.d.ts +457 -426
  288. package/dist/test/bind/record/record.examples.d.ts.map +1 -1
  289. package/dist/test/bind/record/record.examples.js +41 -21
  290. package/dist/test/bind/record/record.examples.js.map +1 -1
  291. package/dist/test/calendar/calendar-records.examples.d.ts +162 -170
  292. package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -1
  293. package/dist/test/calendar/calendar-records.examples.js +20 -12
  294. package/dist/test/calendar/calendar-records.examples.js.map +1 -1
  295. package/dist/test/calendar/calendar-windows.examples.d.ts.map +1 -1
  296. package/dist/test/calendar/calendar-windows.examples.js +12 -12
  297. package/dist/test/calendar/calendar-windows.examples.js.map +1 -1
  298. package/dist/test/calendar/calendar.examples.d.ts +1172 -901
  299. package/dist/test/calendar/calendar.examples.d.ts.map +1 -1
  300. package/dist/test/calendar/calendar.examples.js +211 -124
  301. package/dist/test/calendar/calendar.examples.js.map +1 -1
  302. package/dist/test/calendar/optimise.examples.js +2 -2
  303. package/dist/test/calendar/optimise.examples.js.map +1 -1
  304. package/dist/test/examples-package.d.ts +6 -9
  305. package/dist/test/examples-package.d.ts.map +1 -1
  306. package/dist/test/examples-package.js +11 -32
  307. package/dist/test/examples-package.js.map +1 -1
  308. package/dist/test/flowchart/flowchart.examples.d.ts +3841 -2820
  309. package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -1
  310. package/dist/test/flowchart/flowchart.examples.js +211 -121
  311. package/dist/test/flowchart/flowchart.examples.js.map +1 -1
  312. package/dist/test/plan/optimise.examples.js +2 -2
  313. package/dist/test/plan/optimise.examples.js.map +1 -1
  314. package/dist/test/plan/plan-events.examples.d.ts +4055 -3263
  315. package/dist/test/plan/plan-events.examples.d.ts.map +1 -1
  316. package/dist/test/plan/plan-events.examples.js +492 -319
  317. package/dist/test/plan/plan-events.examples.js.map +1 -1
  318. package/dist/test/plan/plan-nested.examples.d.ts +1829 -0
  319. package/dist/test/plan/plan-nested.examples.d.ts.map +1 -0
  320. package/dist/test/plan/plan-nested.examples.js +321 -0
  321. package/dist/test/plan/plan-nested.examples.js.map +1 -0
  322. package/dist/test/plan/plan-records.examples.d.ts +328 -362
  323. package/dist/test/plan/plan-records.examples.d.ts.map +1 -1
  324. package/dist/test/plan/plan-records.examples.js +81 -57
  325. package/dist/test/plan/plan-records.examples.js.map +1 -1
  326. package/dist/test/plan/plan-windows.examples.d.ts +1756 -1398
  327. package/dist/test/plan/plan-windows.examples.d.ts.map +1 -1
  328. package/dist/test/plan/plan-windows.examples.js +161 -128
  329. package/dist/test/plan/plan-windows.examples.js.map +1 -1
  330. package/dist/test/plan/plan.examples.d.ts +2238 -5712
  331. package/dist/test/plan/plan.examples.d.ts.map +1 -1
  332. package/dist/test/plan/plan.examples.js +839 -968
  333. package/dist/test/plan/plan.examples.js.map +1 -1
  334. package/dist/test/query/query.examples.d.ts +5221 -3005
  335. package/dist/test/query/query.examples.d.ts.map +1 -1
  336. package/dist/test/query/query.examples.js +169 -118
  337. package/dist/test/query/query.examples.js.map +1 -1
  338. package/dist/test/roster/optimise.examples.d.ts.map +1 -1
  339. package/dist/test/roster/optimise.examples.js +7 -7
  340. package/dist/test/roster/optimise.examples.js.map +1 -1
  341. package/dist/test/roster/roster-records.examples.d.ts +364 -392
  342. package/dist/test/roster/roster-records.examples.d.ts.map +1 -1
  343. package/dist/test/roster/roster-records.examples.js +40 -26
  344. package/dist/test/roster/roster-records.examples.js.map +1 -1
  345. package/dist/test/roster/roster.examples.d.ts +4605 -4308
  346. package/dist/test/roster/roster.examples.d.ts.map +1 -1
  347. package/dist/test/roster/roster.examples.js +212 -113
  348. package/dist/test/roster/roster.examples.js.map +1 -1
  349. package/dist/test/schedule/schedule.examples.d.ts +2646 -2471
  350. package/dist/test/schedule/schedule.examples.d.ts.map +1 -1
  351. package/dist/test/schedule/schedule.examples.js +144 -88
  352. package/dist/test/schedule/schedule.examples.js.map +1 -1
  353. package/dist/test/schematic/schematic-records.examples.d.ts +286 -276
  354. package/dist/test/schematic/schematic-records.examples.d.ts.map +1 -1
  355. package/dist/test/schematic/schematic-records.examples.js +52 -38
  356. package/dist/test/schematic/schematic-records.examples.js.map +1 -1
  357. package/dist/test/schematic/schematic.examples.d.ts +1842 -1491
  358. package/dist/test/schematic/schematic.examples.d.ts.map +1 -1
  359. package/dist/test/schematic/schematic.examples.js +240 -134
  360. package/dist/test/schematic/schematic.examples.js.map +1 -1
  361. package/dist/test/sheet/optimise.examples.d.ts +102 -95
  362. package/dist/test/sheet/optimise.examples.d.ts.map +1 -1
  363. package/dist/test/sheet/optimise.examples.js +7 -3
  364. package/dist/test/sheet/optimise.examples.js.map +1 -1
  365. package/dist/test/sheet/sheet-records.examples.d.ts +175 -214
  366. package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -1
  367. package/dist/test/sheet/sheet-records.examples.js +29 -17
  368. package/dist/test/sheet/sheet-records.examples.js.map +1 -1
  369. package/dist/test/sheet/sheet.examples.d.ts +3642 -3353
  370. package/dist/test/sheet/sheet.examples.d.ts.map +1 -1
  371. package/dist/test/sheet/sheet.examples.js +389 -282
  372. package/dist/test/sheet/sheet.examples.js.map +1 -1
  373. package/dist/test/studio/component.examples.js +2 -2
  374. package/dist/test/studio/component.examples.js.map +1 -1
  375. package/dist/test/studio/page.examples.js +6 -6
  376. package/dist/test/studio/page.examples.js.map +1 -1
  377. package/dist/test/studio/studio.examples.d.ts +2329 -873
  378. package/dist/test/studio/studio.examples.d.ts.map +1 -1
  379. package/dist/test/studio/studio.examples.js +155 -107
  380. package/dist/test/studio/studio.examples.js.map +1 -1
  381. package/package.json +15 -11
@@ -109,6 +109,18 @@ const ROSTER_ROLES = ["shift", "group", "position", "activity", "hours"];
109
109
  const ALLOCATION_ROLES = ["arrival", "parts", "hold", "kind"];
110
110
  /** The ways a kind draws. */
111
111
  const DRAWS = ["span", "buckets", "cards", "marks"];
112
+ /**
113
+ * A kind built in a block of its own, which holds each function its parts
114
+ * share once ({@link Once}): a kind built for a view is a struct of functions,
115
+ * and each of them calling the kind's reads and its item would otherwise
116
+ * write them again.
117
+ *
118
+ * @param build - The kind's build, given what holds its shared functions
119
+ * @returns The kind
120
+ */
121
+ function heldKind(build) {
122
+ return Expr.block(($) => build((value) => $.const(value)));
123
+ }
112
124
  export function scheduleEvents(record, input) {
113
125
  const config = input;
114
126
  const where = `Schedule.events: "${config.name}"`;
@@ -124,7 +136,7 @@ export function scheduleEvents(record, input) {
124
136
  const read = handleType.type === "Struct" ? handleType.fields["read"] : undefined;
125
137
  if (handleType.type !== "Struct" || read === undefined || read.type !== "Function"
126
138
  || handleType.fields["binding"] === undefined) {
127
- throw new Error(`${where}: \`record\` is a record bound with its patch mutation — Record.bind(record, [e3.mutation.patch(record)])`);
139
+ throw new Error(`${where}: \`record\` is a record bound with its patch mutation — Record.bind(record), its record declaring patch: mutation.patch()`);
128
140
  }
129
141
  const recordType = read.output;
130
142
  if (recordType.type !== "Dict" || recordType.value.type !== "Struct") {
@@ -440,22 +452,23 @@ export function scheduleEvents(record, input) {
440
452
  * read only within `cap`, its backlog whole. Given `pagedBacklog` (#1424, the Calendar's), a kind with a backlog
441
453
  * narrowed through its source reads its window's rows alone: its builder pages the backlog through the source itself.
442
454
  */
443
- const readsOf = (slot, part, cap, pagedBacklog = false) => {
455
+ const readsOf = (once, slot, part, cap, pagedBacklog = false) => {
444
456
  if (part === undefined) {
445
457
  if (entries !== undefined && dayWindow === undefined) {
446
458
  throw new Error(`${where}: \`entries\` reads one event by its key beside \`window\`, or beside the kind's source of its builder's ` +
447
459
  `Slice.bindRecords (one named "${slot}") — give one of those with it`);
448
460
  }
449
- const unscheduled = backlogWindow === undefined ? undefined : scheduleBacklogWindow(backlogWindow, keyType, rowType, where);
461
+ const unscheduled = backlogWindow === undefined ? undefined
462
+ : once(scheduleBacklogWindow(backlogWindow, keyType, rowType, where));
450
463
  // A backlog index's read takes no window: the window is given, and read past.
451
- const backlog = unscheduled === undefined ? undefined : East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, _from, _to) => {
464
+ const backlog = unscheduled === undefined ? undefined : once(East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, _from, _to) => {
452
465
  const read = $.const(unscheduled);
453
466
  return read();
454
- });
467
+ }));
455
468
  // A record read whole under a cap (#1039): its window counted in memory first, and drawn only within the cap —
456
469
  // past it the window answers none, and none of its events draws.
457
470
  const capped = cap === undefined || dayWindow !== undefined ? undefined
458
- : East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, from, to) => {
471
+ : once(East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, from, to) => {
459
472
  const count = $.const(countWhole);
460
473
  const result = $.let(East.value(none, OptionType(HeldType)), OptionType(HeldType));
461
474
  $.match(count(from, to), {
@@ -464,13 +477,13 @@ export function scheduleEvents(record, input) {
464
477
  },
465
478
  });
466
479
  return result;
467
- });
480
+ }));
468
481
  return {
469
482
  // A day index under a cap counts the days' entries first, and past it reads no page (#1039).
470
- days: dayWindow === undefined ? capped : scheduleDayWindow(dayWindow, keyType, rowType, where, cap),
483
+ days: dayWindow === undefined ? capped : once(scheduleDayWindow(dayWindow, keyType, rowType, where, cap)),
471
484
  backlog,
472
485
  alone: backlog,
473
- withDrafts: withDraftsFor(false),
486
+ withDrafts: once(withDraftsFor(false)),
474
487
  pagedBacklog: false,
475
488
  };
476
489
  }
@@ -481,21 +494,21 @@ export function scheduleEvents(record, input) {
481
494
  throw new Error(`${where}: the builder's source "${slot}" reads only its narrowing — and one event, the inspector's ` +
482
495
  "or its editing's, is read by its key: give `entries` beside it, Data.bindPaged(record), the record's own entries");
483
496
  }
484
- const scheduled = scheduleRecordWindow(part, slot, keyType, rowType, startField, endField, optional, false, where, cap);
497
+ const scheduled = once(scheduleRecordWindow(part, slot, keyType, rowType, startField, endField, optional, false, where, cap));
485
498
  if (!optional)
486
- return { days: scheduled, backlog: undefined, alone: undefined, withDrafts: withDraftsFor(true), pagedBacklog: false };
487
- const backlogged = scheduleRecordWindow(part, slot, keyType, rowType, startField, endField, optional, true, where);
499
+ return { days: scheduled, backlog: undefined, alone: undefined, withDrafts: once(withDraftsFor(true)), pagedBacklog: false };
500
+ const backlogged = once(scheduleRecordWindow(part, slot, keyType, rowType, startField, endField, optional, true, where));
488
501
  if (pagedBacklog) {
489
502
  // Its builder pages its backlog through the source itself (#1424): the window is its rows alone, and a draft
490
503
  // its host gives draws where it places its event — a backlog event scheduled into the window among them — the
491
504
  // host having left out those of events the narrowing does not hold. Its backlog whole is `unscheduled`'s
492
505
  // alone, which such a builder never asks.
493
- return { days: scheduled, backlog: backlogged, alone: backlogged, withDrafts: withDraftsFor(false), pagedBacklog: true };
506
+ return { days: scheduled, backlog: backlogged, alone: backlogged, withDrafts: once(withDraftsFor(false)), pagedBacklog: true };
494
507
  }
495
508
  // A kind with a backlog reads both through its source as one: what its narrowing holds over the window and in
496
509
  // its backlog. A draft then moves an event between the two by its times alone, and a draft the narrowing does
497
510
  // not hold never shows in either (#1343).
498
- const both = East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, from, to) => {
511
+ const both = once(East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, from, to) => {
499
512
  const inWindow = $.const(scheduled);
500
513
  const inBacklog = $.const(backlogged);
501
514
  const result = $.let(East.value(none, OptionType(HeldType)), OptionType(HeldType));
@@ -511,8 +524,8 @@ export function scheduleEvents(record, input) {
511
524
  },
512
525
  });
513
526
  return result;
514
- });
515
- return { days: both, backlog: both, alone: backlogged, withDrafts: withDraftsFor(true), pagedBacklog: false };
527
+ }));
528
+ return { days: both, backlog: both, alone: backlogged, withDrafts: once(withDraftsFor(true)), pagedBacklog: false };
516
529
  };
517
530
  /** An item seam over a window: the events whose items `itemFn` makes that overlap `[from, to)`. */
518
531
  const windowOf = (itemType, itemFn, reads) => East.function([DateTimeType, DateTimeType, ScheduleDraftsType], OptionType(ArrayType(itemType)), ($, from, to, drafts) => {
@@ -581,8 +594,8 @@ export function scheduleEvents(record, input) {
581
594
  return result;
582
595
  });
583
596
  // ── A kind a reader reads by a series index's cells (#1039) ──────────
584
- // The reader gives the entries it read as one beast2 of `CellsType`; a long event its cells repeat, tile by tile,
585
- // is one entry, held once by its key. Every draft it gives shows: it gives a draft of an entry it did not read only
597
+ // The reader gives the entries it read as one beast2 of `CellsType`; an event past a year its cells repeat, year by
598
+ // year, is one entry, held once by its key. Every draft it gives shows: it gives a draft of an entry it did not read only
586
599
  // where its narrowing holds the entry, or the record does not.
587
600
  /** The entries a reader read by cells, as the record's rows by key. */
588
601
  const cellsHeld = East.function([BlobType], HeldType, ($, bytes) => {
@@ -843,10 +856,10 @@ export function scheduleEvents(record, input) {
843
856
  * `pagedBacklog` (#1424, the Calendar's), a kind with a backlog narrowed through its source reads its window's rows
844
857
  * alone, its builder paging the backlog through the source itself.
845
858
  */
846
- const kindParts = (slot, part, form, cap, pagedBacklog = false) => {
847
- const reads = readsOf(slot, part, cap, pagedBacklog);
859
+ const kindParts = (once, slot, part, form, cap, pagedBacklog = false) => {
860
+ const reads = readsOf(once, slot, part, cap, pagedBacklog);
848
861
  // One event, as every view draws it.
849
- const itemOf = East.function([EntryRowType], ScheduleItemType, ($, entry) => {
862
+ const itemOf = once(East.function([EntryRowType], ScheduleItemType, ($, entry) => {
850
863
  const row = entry.row;
851
864
  const ref = $.const(refOf);
852
865
  const start = $.const(instant(row, startField));
@@ -888,7 +901,7 @@ export function scheduleEvents(record, input) {
888
901
  minutes,
889
902
  due,
890
903
  }, ScheduleItemType);
891
- });
904
+ }));
892
905
  const seams = readSeams(ScheduleItemType, itemOf, ScheduleReadType, reads);
893
906
  // How many of its stored events overlap [from, to), counted before one is read (#1039): through its source's
894
907
  // interval index — the count its window's read asks first, so none of its own; through its day index, the days'
@@ -997,7 +1010,12 @@ export function scheduleEvents(record, input) {
997
1010
  // A kind with no title names none: the Calendar and Plan, whose inspectors draw it, refuse one.
998
1011
  schedule: { title: titleField ?? "", start: startField, end: endField,
999
1012
  resource: resource === undefined ? none : some(resource.field),
1000
- status: config.status === undefined ? none : some(config.status.field) },
1013
+ status: config.status === undefined ? none : some(config.status.field),
1014
+ quantity: quantityField === undefined ? none : some(quantityField),
1015
+ parts: partsField === undefined ? none : some(partsField),
1016
+ // A duty's shift and group, which place it on the Roster; a bin's bay, each at its own minute.
1017
+ withTimes: shiftField !== undefined && groupField !== undefined ? [shiftField, groupField]
1018
+ : allocationGiven.length > 0 && resource !== undefined ? [resource.field] : [] },
1001
1019
  overlaps: variant(overlaps, null),
1002
1020
  inspector: inspector === undefined ? none : some(inspector),
1003
1021
  seriesKey,
@@ -1080,225 +1098,231 @@ export function scheduleEvents(record, input) {
1080
1098
  build(slot, part) {
1081
1099
  // Its window counted first, and read only within the cap (#1424): past it, no page is read. The Calendar pages
1082
1100
  // a narrowed kind's backlog through its source itself, so its window reads the window's rows alone.
1083
- return East.value(kindParts(slot, part, formSpecs, SCHEDULE_EVENT_CAP, true).fields, ScheduleKindType);
1101
+ return heldKind((once) => East.value(kindParts(once, slot, part, formSpecs, SCHEDULE_EVENT_CAP, true).fields, ScheduleKindType));
1084
1102
  },
1085
1103
  buildRoster(slot, part) {
1086
- // A duty runs from its start to its end, keyed by String, on its slot's shift and group, rostered to someone.
1087
- if (instantKind) {
1088
- throw new Error(`${where}: the Roster reads a duty's \`start\` and \`end\`; this kind is one instant (\`at\`) — give \`start\` and \`end\` in its place`);
1089
- }
1090
- if (optional)
1091
- throw new Error(`${where}: a duty has its times — \`start\` and \`end\` are DateTime fields, not Options`);
1092
- if (keyType.type !== "String") {
1093
- throw new Error(`${where}: the Roster's duties are keyed by String — a duty is named by its key, and this record is keyed by ${printType(keyType)}`);
1094
- }
1095
- if (shiftField === undefined || groupField === undefined) {
1096
- throw new Error(`${where}: the Roster places a duty by its \`shift\` and its \`group\` — give both`);
1097
- }
1098
- if (resource === undefined || resourceValue === undefined) {
1099
- throw new Error(`${where}: the Roster rosters each duty to a person or an agency, its \`resource\` — give it, resource: { field, of: "people" }`);
1100
- }
1101
- oneFieldEach("Roster", [["start", startField], ["end", endField], ["resource.field", resource.field], ["shift", shiftField],
1102
- ["group", groupField], ["position", positionField], ["activity", activityField]]);
1103
- const shift = shiftField;
1104
- const group = groupField;
1105
- const who = resource.field;
1106
- const whoOf = resourceValue;
1107
- const parts = kindParts(slot, part, formOver([startField, endField, who, shift, group, positionField, activityField]));
1108
- const Roles = ScheduleRosterRolesType;
1109
- // A row with the Roster's roles written from `roles`, the resource field from `value`, and every other field
1110
- // from `source`: the row as it was, or a new row's defaults. A kind with no `position` writes none.
1111
- const rosterRow = (source, roles, value) => East.value(Object.fromEntries(Object.keys(fields).map((f) => [f,
1112
- f === startField ? roles.start
1113
- : f === endField ? roles.end
1114
- : f === who ? value
1115
- : f === shift ? roles.shift
1116
- : f === group ? roles.group
1117
- : f === positionField ? roles.position.match({ some: (_$, held) => held, none: () => fieldOf(source, f) })
1118
- : f === activityField ? roles.activity
1119
- : fieldOf(source, f)])), rowType);
1120
- // A duty's roles, from its row and its key: its times and who, its shift and group, its position and
1121
- // activity, and the hours it counts.
1122
- const rolesOf = East.function([rowType, StringType], Roles, ($, row, key) => {
1123
- const ref = $.const(refOf);
1124
- const start = $.const(fieldOf(row, startField));
1125
- const end = $.const(fieldOf(row, endField));
1126
- let hours;
1127
- if (hoursOf === undefined) {
1128
- // Its length.
1129
- hours = $.const(start.durationMinutes(end).divide(60.0));
1104
+ return heldKind((once) => {
1105
+ // A duty runs from its start to its end, keyed by String, on its slot's shift and group, rostered to someone.
1106
+ if (instantKind) {
1107
+ throw new Error(`${where}: the Roster reads a duty's \`start\` and \`end\`; this kind is one instant (\`at\`) — give \`start\` and \`end\` in its place`);
1130
1108
  }
1131
- else {
1132
- const count = $.const(hoursOf);
1133
- hours = $.const(count(row, key));
1109
+ if (optional)
1110
+ throw new Error(`${where}: a duty has its times — \`start\` and \`end\` are DateTime fields, not Options`);
1111
+ if (keyType.type !== "String") {
1112
+ throw new Error(`${where}: the Roster's duties are keyed by String — a duty is named by its key, and this record is keyed by ${printType(keyType)}`);
1134
1113
  }
1135
- return East.value({
1136
- start, end, resource: ref(row), shift: fieldOf(row, shift), group: fieldOf(row, group),
1137
- position: positionField === undefined ? none : some(fieldOf(row, positionField)),
1138
- activity: activityField === undefined ? none : fieldOf(row, activityField),
1139
- hours,
1140
- }, Roles);
1141
- });
1142
- // A drafted duty's roles, from its bytes: what `rows` gives a stored one in the pass that reads it.
1143
- const read = East.function([BlobType, StringType], Roles, ($, bytes, key) => {
1144
- const of = $.const(rolesOf);
1145
- return of(bytes.decodeBeast(rowType, "v2"), key);
1146
- });
1147
- // The row with its roles written, and every other field as it was (B1); `none` for a resource the kind refuses.
1148
- const write = East.function([BlobType, Roles], OptionType(BlobType), ($, bytes, roles) => {
1149
- const row = $.const(bytes.decodeBeast(rowType, "v2"));
1150
- const resolve = $.const(whoOf);
1151
- const result = $.let(East.value(none, OptionType(BlobType)), OptionType(BlobType));
1152
- $.match(resolve(roles.resource), {
1153
- some: ($2, value) => { $2.assign(result, East.value(some(East.Blob.encodeBeast(rosterRow(row, roles, value), "v2")), OptionType(BlobType))); },
1114
+ if (shiftField === undefined || groupField === undefined) {
1115
+ throw new Error(`${where}: the Roster places a duty by its \`shift\` and its \`group\` — give both`);
1116
+ }
1117
+ if (resource === undefined || resourceValue === undefined) {
1118
+ throw new Error(`${where}: the Roster rosters each duty to a person or an agency, its \`resource\` — give it, resource: { field, of: "people" }`);
1119
+ }
1120
+ oneFieldEach("Roster", [["start", startField], ["end", endField], ["resource.field", resource.field], ["shift", shiftField],
1121
+ ["group", groupField], ["position", positionField], ["activity", activityField]]);
1122
+ const shift = shiftField;
1123
+ const group = groupField;
1124
+ const who = resource.field;
1125
+ const whoOf = resourceValue;
1126
+ const parts = kindParts(once, slot, part, formOver([startField, endField, who, shift, group, positionField, activityField]));
1127
+ const Roles = ScheduleRosterRolesType;
1128
+ // A row with the Roster's roles written from `roles`, the resource field from `value`, and every other field
1129
+ // from `source`: the row as it was, or a new row's defaults. A kind with no `position` writes none.
1130
+ const rosterRow = (source, roles, value) => East.value(Object.fromEntries(Object.keys(fields).map((f) => [f,
1131
+ f === startField ? roles.start
1132
+ : f === endField ? roles.end
1133
+ : f === who ? value
1134
+ : f === shift ? roles.shift
1135
+ : f === group ? roles.group
1136
+ : f === positionField ? roles.position.match({ some: (_$, held) => held, none: () => fieldOf(source, f) })
1137
+ : f === activityField ? roles.activity
1138
+ : fieldOf(source, f)])), rowType);
1139
+ // A duty's roles, from its row and its key: its times and who, its shift and group, its position and
1140
+ // activity, and the hours it counts.
1141
+ const rolesOf = East.function([rowType, StringType], Roles, ($, row, key) => {
1142
+ const ref = $.const(refOf);
1143
+ const start = $.const(fieldOf(row, startField));
1144
+ const end = $.const(fieldOf(row, endField));
1145
+ let hours;
1146
+ if (hoursOf === undefined) {
1147
+ // Its length.
1148
+ hours = $.const(start.durationMinutes(end).divide(60.0));
1149
+ }
1150
+ else {
1151
+ const count = $.const(hoursOf);
1152
+ hours = $.const(count(row, key));
1153
+ }
1154
+ return East.value({
1155
+ start, end, resource: ref(row), shift: fieldOf(row, shift), group: fieldOf(row, group),
1156
+ position: positionField === undefined ? none : some(fieldOf(row, positionField)),
1157
+ activity: activityField === undefined ? none : fieldOf(row, activityField),
1158
+ hours,
1159
+ }, Roles);
1154
1160
  });
1155
- return result;
1156
- });
1157
- // A new duty: its roles written, and every other field its type's default.
1158
- const blank = East.value(defaultValue(rowType), rowType);
1159
- const create = East.function([Roles], OptionType(BlobType), ($, roles) => {
1160
- const row = $.const(blank);
1161
- const resolve = $.const(whoOf);
1162
- const result = $.let(East.value(none, OptionType(BlobType)), OptionType(BlobType));
1163
- $.match(resolve(roles.resource), {
1164
- some: ($2, value) => { $2.assign(result, East.value(some(East.Blob.encodeBeast(rosterRow(row, roles, value), "v2")), OptionType(BlobType))); },
1161
+ // A drafted duty's roles, from its bytes: what `rows` gives a stored one in the pass that reads it.
1162
+ const read = East.function([BlobType, StringType], Roles, ($, bytes, key) => {
1163
+ const of = $.const(rolesOf);
1164
+ return of(bytes.decodeBeast(rowType, "v2"), key);
1165
1165
  });
1166
- return result;
1166
+ // The row with its roles written, and every other field as it was (B1); `none` for a resource the kind refuses.
1167
+ const write = East.function([BlobType, Roles], OptionType(BlobType), ($, bytes, roles) => {
1168
+ const row = $.const(bytes.decodeBeast(rowType, "v2"));
1169
+ const resolve = $.const(whoOf);
1170
+ const result = $.let(East.value(none, OptionType(BlobType)), OptionType(BlobType));
1171
+ $.match(resolve(roles.resource), {
1172
+ some: ($2, value) => { $2.assign(result, East.value(some(East.Blob.encodeBeast(rosterRow(row, roles, value), "v2")), OptionType(BlobType))); },
1173
+ });
1174
+ return result;
1175
+ });
1176
+ // A new duty: its roles written, and every other field its type's default.
1177
+ const blank = East.value(defaultValue(rowType), rowType);
1178
+ const create = East.function([Roles], OptionType(BlobType), ($, roles) => {
1179
+ const row = $.const(blank);
1180
+ const resolve = $.const(whoOf);
1181
+ const result = $.let(East.value(none, OptionType(BlobType)), OptionType(BlobType));
1182
+ $.match(resolve(roles.resource), {
1183
+ some: ($2, value) => { $2.assign(result, East.value(some(East.Blob.encodeBeast(rosterRow(row, roles, value), "v2")), OptionType(BlobType))); },
1184
+ });
1185
+ return result;
1186
+ });
1187
+ return East.value({
1188
+ kind: East.value(parts.fields, ScheduleKindType),
1189
+ rows: storedRows(parts.reads, ScheduleRosterEntryType, rolesOf),
1190
+ read,
1191
+ write,
1192
+ create,
1193
+ roles: { position: positionField !== undefined, activity: activityField !== undefined },
1194
+ rowType: toEastTypeValue(rowType),
1195
+ }, ScheduleRosterKindType);
1167
1196
  });
1168
- return East.value({
1169
- kind: East.value(parts.fields, ScheduleKindType),
1170
- rows: storedRows(parts.reads, ScheduleRosterEntryType, rolesOf),
1171
- read,
1172
- write,
1173
- create,
1174
- roles: { position: positionField !== undefined, activity: activityField !== undefined },
1175
- rowType: toEastTypeValue(rowType),
1176
- }, ScheduleRosterKindType);
1177
1197
  },
1178
1198
  buildAllocation(slot, part) {
1179
- // A bin is one instant, keyed by String, in one lane, booking an arrival, its quantity on its parts for its hold.
1180
- if (!instantKind) {
1181
- throw new Error(`${where}: the Allocation's bins are an instant kind: give \`at\` in place of \`start\` and \`end\``);
1182
- }
1183
- if (keyType.type !== "String") {
1184
- throw new Error(`${where}: the Allocation's bins are keyed by String — a bin is named by its key, and this record is keyed by ${printType(keyType)}`);
1185
- }
1186
- if (resource === undefined)
1187
- throw new Error(`${where}: the Allocation books a bin into a lane, its \`resource\` — give it`);
1188
- if (resource.shape !== "key" || resource.optional) {
1189
- throw new Error(`${where}: the Allocation books each bin into one lane — \`resource\` names a String field, a key of the lanes' kind, ` +
1190
- `and "${resource.field}" holds ${typeText(fields[resource.field])}`);
1191
- }
1192
- if (arrivalField === undefined)
1193
- throw new Error(`${where}: the Allocation books a bin's \`arrival\` — give it`);
1194
- if (quantityField === undefined)
1195
- throw new Error(`${where}: the Allocation reads a bin's \`quantity\` — give it`);
1196
- if (partsField === undefined || config.parts === undefined)
1197
- throw new Error(`${where}: the Allocation allocates a bin's \`parts\` — give it`);
1198
- if (holdField === undefined)
1199
- throw new Error(`${where}: the Allocation holds a bin for its \`hold\` — give it`);
1200
- oneFieldEach("Allocation", [["at", startField], ["resource.field", resource.field], ["arrival", arrivalField], ["quantity.field", quantityField],
1201
- ["parts.field", partsField], ["hold", holdField], ["kind", kindField]]);
1202
- const lane = resource.field;
1203
- const arrival = arrivalField;
1204
- const quantity = quantityField;
1205
- const shares = partsField;
1206
- const hold = holdField;
1207
- // The fields no role maps (`allocationValues`): what an arrival's values give a booked bin, a reservation's their type's default.
1208
- const mapped = allocationMapped;
1209
- const ValuesType = allocationValues;
1210
- const parts = kindParts(slot, part, formOver([...mapped]));
1211
- const Roles = ScheduleAllocationRolesType;
1212
- // A row with the Allocation's roles written from `roles`, and every other field from `source`: the row as it
1213
- // was, or a booked bin's values. A kind with no `kind` writes none.
1214
- const binRow = (source, roles) => East.value(Object.fromEntries(Object.keys(fields).map((f) => [f,
1215
- f === startField ? roles.at
1216
- : f === lane ? roles.lane
1217
- : f === arrival ? roles.arrival
1218
- : f === quantity ? roles.quantity
1219
- : f === shares ? roles.parts
1220
- : f === hold ? roles.hold
1221
- : f === kindField ? roles.kind
1222
- : fieldOf(source, f)])), rowType);
1223
- // A bin's roles, from its row: its time and lane, the arrival it books, its quantity and parts, its hold and kind.
1224
- const rolesOf = East.function([rowType, StringType], Roles, (_$, row, _key) => East.value({
1225
- at: fieldOf(row, startField), lane: fieldOf(row, lane), arrival: fieldOf(row, arrival), quantity: fieldOf(row, quantity),
1226
- parts: fieldOf(row, shares), hold: fieldOf(row, hold), kind: kindField === undefined ? none : fieldOf(row, kindField),
1227
- }, Roles));
1228
- // A drafted bin's roles, from its bytes: what `rows` gives a stored one in the pass that reads it.
1229
- const read = East.function([BlobType], Roles, ($, bytes) => {
1230
- const of = $.const(rolesOf);
1231
- return of(bytes.decodeBeast(rowType, "v2"), "");
1232
- });
1233
- // The row with its roles written, and every other field as it was (B1).
1234
- const write = East.function([BlobType, Roles], BlobType, ($, bytes, roles) => {
1235
- const row = $.const(bytes.decodeBeast(rowType, "v2"));
1236
- return East.Blob.encodeBeast(binRow(row, roles), "v2");
1237
- });
1238
- // A new bin: its roles written, and every other field the arrival's values' — or, with none, its type's default (B13).
1239
- const blank = East.value(defaultValue(ValuesType), ValuesType);
1240
- const create = East.function([Roles, OptionType(BlobType)], BlobType, ($, roles, values) => {
1241
- const given = $.const(values.match({
1242
- some: (_$2, bytes) => bytes.decodeBeast(ValuesType, "v2"),
1243
- none: (_$2) => blank,
1244
- }));
1245
- return East.Blob.encodeBeast(binRow(given, roles), "v2");
1199
+ return heldKind((once) => {
1200
+ // A bin is one instant, keyed by String, in one lane, booking an arrival, its quantity on its parts for its hold.
1201
+ if (!instantKind) {
1202
+ throw new Error(`${where}: the Allocation's bins are an instant kind: give \`at\` in place of \`start\` and \`end\``);
1203
+ }
1204
+ if (keyType.type !== "String") {
1205
+ throw new Error(`${where}: the Allocation's bins are keyed by String — a bin is named by its key, and this record is keyed by ${printType(keyType)}`);
1206
+ }
1207
+ if (resource === undefined)
1208
+ throw new Error(`${where}: the Allocation books a bin into a lane, its \`resource\` — give it`);
1209
+ if (resource.shape !== "key" || resource.optional) {
1210
+ throw new Error(`${where}: the Allocation books each bin into one lane — \`resource\` names a String field, a key of the lanes' kind, ` +
1211
+ `and "${resource.field}" holds ${typeText(fields[resource.field])}`);
1212
+ }
1213
+ if (arrivalField === undefined)
1214
+ throw new Error(`${where}: the Allocation books a bin's \`arrival\` — give it`);
1215
+ if (quantityField === undefined)
1216
+ throw new Error(`${where}: the Allocation reads a bin's \`quantity\` — give it`);
1217
+ if (partsField === undefined || config.parts === undefined)
1218
+ throw new Error(`${where}: the Allocation allocates a bin's \`parts\` — give it`);
1219
+ if (holdField === undefined)
1220
+ throw new Error(`${where}: the Allocation holds a bin for its \`hold\` — give it`);
1221
+ oneFieldEach("Allocation", [["at", startField], ["resource.field", resource.field], ["arrival", arrivalField], ["quantity.field", quantityField],
1222
+ ["parts.field", partsField], ["hold", holdField], ["kind", kindField]]);
1223
+ const lane = resource.field;
1224
+ const arrival = arrivalField;
1225
+ const quantity = quantityField;
1226
+ const shares = partsField;
1227
+ const hold = holdField;
1228
+ // The fields no role maps (`allocationValues`): what an arrival's values give a booked bin, a reservation's their type's default.
1229
+ const mapped = allocationMapped;
1230
+ const ValuesType = allocationValues;
1231
+ const parts = kindParts(once, slot, part, formOver([...mapped]));
1232
+ const Roles = ScheduleAllocationRolesType;
1233
+ // A row with the Allocation's roles written from `roles`, and every other field from `source`: the row as it
1234
+ // was, or a booked bin's values. A kind with no `kind` writes none.
1235
+ const binRow = (source, roles) => East.value(Object.fromEntries(Object.keys(fields).map((f) => [f,
1236
+ f === startField ? roles.at
1237
+ : f === lane ? roles.lane
1238
+ : f === arrival ? roles.arrival
1239
+ : f === quantity ? roles.quantity
1240
+ : f === shares ? roles.parts
1241
+ : f === hold ? roles.hold
1242
+ : f === kindField ? roles.kind
1243
+ : fieldOf(source, f)])), rowType);
1244
+ // A bin's roles, from its row: its time and lane, the arrival it books, its quantity and parts, its hold and kind.
1245
+ const rolesOf = East.function([rowType, StringType], Roles, (_$, row, _key) => East.value({
1246
+ at: fieldOf(row, startField), lane: fieldOf(row, lane), arrival: fieldOf(row, arrival), quantity: fieldOf(row, quantity),
1247
+ parts: fieldOf(row, shares), hold: fieldOf(row, hold), kind: kindField === undefined ? none : fieldOf(row, kindField),
1248
+ }, Roles));
1249
+ // A drafted bin's roles, from its bytes: what `rows` gives a stored one in the pass that reads it.
1250
+ const read = East.function([BlobType], Roles, ($, bytes) => {
1251
+ const of = $.const(rolesOf);
1252
+ return of(bytes.decodeBeast(rowType, "v2"), "");
1253
+ });
1254
+ // The row with its roles written, and every other field as it was (B1).
1255
+ const write = East.function([BlobType, Roles], BlobType, ($, bytes, roles) => {
1256
+ const row = $.const(bytes.decodeBeast(rowType, "v2"));
1257
+ return East.Blob.encodeBeast(binRow(row, roles), "v2");
1258
+ });
1259
+ // A new bin: its roles written, and every other field the arrival's values' — or, with none, its type's default (B13).
1260
+ const blank = East.value(defaultValue(ValuesType), ValuesType);
1261
+ const create = East.function([Roles, OptionType(BlobType)], BlobType, ($, roles, values) => {
1262
+ const given = $.const(values.match({
1263
+ some: (_$2, bytes) => bytes.decodeBeast(ValuesType, "v2"),
1264
+ none: (_$2) => blank,
1265
+ }));
1266
+ return East.Blob.encodeBeast(binRow(given, roles), "v2");
1267
+ });
1268
+ return East.value({
1269
+ kind: East.value(parts.fields, ScheduleKindType),
1270
+ rows: storedRows(parts.reads, ScheduleAllocationEntryType, rolesOf),
1271
+ read,
1272
+ write,
1273
+ create,
1274
+ lanes: resource.of,
1275
+ parts: config.parts.of,
1276
+ kinded: kindField !== undefined,
1277
+ unit: config.quantity?.unit === undefined ? none : some(config.quantity.unit),
1278
+ values: toEastTypeValue(ValuesType),
1279
+ rowType: toEastTypeValue(rowType),
1280
+ }, ScheduleAllocationKindType);
1246
1281
  });
1247
- return East.value({
1248
- kind: East.value(parts.fields, ScheduleKindType),
1249
- rows: storedRows(parts.reads, ScheduleAllocationEntryType, rolesOf),
1250
- read,
1251
- write,
1252
- create,
1253
- lanes: resource.of,
1254
- parts: config.parts.of,
1255
- kinded: kindField !== undefined,
1256
- unit: config.quantity?.unit === undefined ? none : some(config.quantity.unit),
1257
- values: toEastTypeValue(ValuesType),
1258
- rowType: toEastTypeValue(rowType),
1259
- }, ScheduleAllocationKindType);
1260
1282
  },
1261
1283
  buildPlan(slot, part) {
1262
- // Its window through its source counted first, and read only within the cap (#1039): past it, no page is read.
1263
- const parts = kindParts(slot, part, formSpecs, SCHEDULE_EVENT_CAP);
1264
- const quantity = config.quantity;
1265
- const format = quantity?.format === undefined ? undefined : East.value(quantity.format, TickFormatType);
1266
- // One event as Plan draws it: what every view draws, with its roles read from their fields.
1267
- const planItemOf = East.function([EntryRowType], PlanEventItemType, ($, entry) => {
1268
- const make = $.const(parts.itemOf);
1269
- const item = $.const(make(entry));
1270
- const row = entry.row;
1271
- const read = item;
1284
+ return heldKind((once) => {
1285
+ // Its window through its source counted first, and read only within the cap (#1039): past it, no page is read.
1286
+ const parts = kindParts(once, slot, part, formSpecs, SCHEDULE_EVENT_CAP);
1287
+ const quantity = config.quantity;
1288
+ const format = quantity?.format === undefined ? undefined : East.value(quantity.format, TickFormatType);
1289
+ // One event as Plan draws it: what every view draws, with its roles read from their fields.
1290
+ const planItemOf = once(East.function([EntryRowType], PlanEventItemType, ($, entry) => {
1291
+ const make = $.const(parts.itemOf);
1292
+ const item = $.const(make(entry));
1293
+ const row = entry.row;
1294
+ const read = item;
1295
+ return East.value({
1296
+ ...Object.fromEntries(Object.keys(ScheduleItemType.fields).map((f) => [f, read[f]])),
1297
+ state: stateField === undefined ? variant("confirmed", null) : fieldOf(row, stateField),
1298
+ quantity: quantityField === undefined ? none : some({
1299
+ value: fieldOf(row, quantityField),
1300
+ unit: quantity?.unit === undefined ? none : some(quantity.unit),
1301
+ format: format === undefined ? none : some(format),
1302
+ text: none,
1303
+ }),
1304
+ lane: laneField === undefined ? none : some(fieldOf(row, laneField)),
1305
+ }, PlanEventItemType);
1306
+ }));
1307
+ // One event by its id, the drafts in place, as Plan draws it, and its events and its backlog as Plan draws
1308
+ // them: the kind's three read seams over its own item (`readSeams`) — a kind a reader reads by its series
1309
+ // index's cells (#1039) given what it read, and never reading the window.
1310
+ const plan = readSeams(PlanEventItemType, planItemOf, PlanEventReadType, parts.reads);
1311
+ const name = (field) => (field === undefined ? none : some(field));
1272
1312
  return East.value({
1273
- ...Object.fromEntries(Object.keys(ScheduleItemType.fields).map((f) => [f, read[f]])),
1274
- state: stateField === undefined ? variant("confirmed", null) : fieldOf(row, stateField),
1275
- quantity: quantityField === undefined ? none : some({
1276
- value: fieldOf(row, quantityField),
1277
- unit: quantity?.unit === undefined ? none : some(quantity.unit),
1278
- format: format === undefined ? none : some(format),
1279
- text: none,
1280
- }),
1281
- lane: laneField === undefined ? none : some(fieldOf(row, laneField)),
1282
- }, PlanEventItemType);
1313
+ ...parts.fields,
1314
+ draw: variant(draw, null),
1315
+ instant: instantKind,
1316
+ overlaps: variant(overlaps, null),
1317
+ roles: { state: name(stateField), quantity: name(quantityField), lane: name(laneField) },
1318
+ planItems: plan.items,
1319
+ planUnscheduled: plan.unscheduled,
1320
+ planEvent: plan.event,
1321
+ // Every event's row at once, for a run's request (#1409, R24): read once, never once an event.
1322
+ planRows: rowsOver(parts.reads),
1323
+ inspector: inspector === undefined ? East.value(none, OptionType(RowInspectorType)) : East.value(some(inspector), OptionType(RowInspectorType)),
1324
+ }, PlanEventKindType);
1283
1325
  });
1284
- // One event by its id, the drafts in place, as Plan draws it, and its events and its backlog as Plan draws
1285
- // them: the kind's three read seams over its own item (`readSeams`) — a kind a reader reads by its series
1286
- // index's cells (#1039) given what it read, and never reading the window.
1287
- const plan = readSeams(PlanEventItemType, planItemOf, PlanEventReadType, parts.reads);
1288
- const name = (field) => (field === undefined ? none : some(field));
1289
- return East.value({
1290
- ...parts.fields,
1291
- draw: variant(draw, null),
1292
- instant: instantKind,
1293
- overlaps: variant(overlaps, null),
1294
- roles: { state: name(stateField), quantity: name(quantityField), lane: name(laneField) },
1295
- planItems: plan.items,
1296
- planUnscheduled: plan.unscheduled,
1297
- planEvent: plan.event,
1298
- // Every event's row at once, for a run's request (#1409, R24): read once, never once an event.
1299
- planRows: rowsOver(parts.reads),
1300
- inspector: inspector === undefined ? East.value(none, OptionType(RowInspectorType)) : East.value(some(inspector), OptionType(RowInspectorType)),
1301
- }, PlanEventKindType);
1302
1326
  },
1303
1327
  };
1304
1328
  }