@elaraai/e3-ui 1.0.94 → 1.0.95

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 (303) hide show
  1. package/dist/src/allocation/adapters.d.ts +159 -0
  2. package/dist/src/allocation/adapters.d.ts.map +1 -0
  3. package/dist/src/allocation/adapters.js +241 -0
  4. package/dist/src/allocation/adapters.js.map +1 -0
  5. package/dist/src/allocation/functions.d.ts +664 -0
  6. package/dist/src/allocation/functions.d.ts.map +1 -0
  7. package/dist/src/allocation/functions.js +782 -0
  8. package/dist/src/allocation/functions.js.map +1 -0
  9. package/dist/src/allocation/index.d.ts +2985 -0
  10. package/dist/src/allocation/index.d.ts.map +1 -0
  11. package/dist/src/allocation/index.js +499 -0
  12. package/dist/src/allocation/index.js.map +1 -0
  13. package/dist/src/allocation/types.d.ts +832 -0
  14. package/dist/src/allocation/types.d.ts.map +1 -0
  15. package/dist/src/allocation/types.js +360 -0
  16. package/dist/src/allocation/types.js.map +1 -0
  17. package/dist/src/bind/func.d.ts +14 -0
  18. package/dist/src/bind/func.d.ts.map +1 -1
  19. package/dist/src/bind/func.js +22 -1
  20. package/dist/src/bind/func.js.map +1 -1
  21. package/dist/src/calendar/index.d.ts +510 -1639
  22. package/dist/src/calendar/index.d.ts.map +1 -1
  23. package/dist/src/calendar/index.js +56 -29
  24. package/dist/src/calendar/index.js.map +1 -1
  25. package/dist/src/flowchart/canvas.d.ts +9 -21
  26. package/dist/src/flowchart/canvas.d.ts.map +1 -1
  27. package/dist/src/flowchart/canvas.js +10 -22
  28. package/dist/src/flowchart/canvas.js.map +1 -1
  29. package/dist/src/flowchart/flowchart.d.ts +19 -13
  30. package/dist/src/flowchart/flowchart.d.ts.map +1 -1
  31. package/dist/src/flowchart/flowchart.js.map +1 -1
  32. package/dist/src/flowchart/index.d.ts +44 -21
  33. package/dist/src/flowchart/index.d.ts.map +1 -1
  34. package/dist/src/flowchart/index.js +43 -20
  35. package/dist/src/flowchart/index.js.map +1 -1
  36. package/dist/src/flowchart/library.d.ts +166 -81
  37. package/dist/src/flowchart/library.d.ts.map +1 -1
  38. package/dist/src/flowchart/library.js +232 -105
  39. package/dist/src/flowchart/library.js.map +1 -1
  40. package/dist/src/flowchart/over.d.ts +9 -16
  41. package/dist/src/flowchart/over.d.ts.map +1 -1
  42. package/dist/src/flowchart/over.js +9 -16
  43. package/dist/src/flowchart/over.js.map +1 -1
  44. package/dist/src/flowchart/payload.d.ts +710 -508
  45. package/dist/src/flowchart/payload.d.ts.map +1 -1
  46. package/dist/src/flowchart/payload.js +128 -74
  47. package/dist/src/flowchart/payload.js.map +1 -1
  48. package/dist/src/flowchart/window.d.ts +132 -347
  49. package/dist/src/flowchart/window.d.ts.map +1 -1
  50. package/dist/src/flowchart/window.js +48 -55
  51. package/dist/src/flowchart/window.js.map +1 -1
  52. package/dist/src/index.d.ts +11 -7
  53. package/dist/src/index.d.ts.map +1 -1
  54. package/dist/src/index.js +14 -6
  55. package/dist/src/index.js.map +1 -1
  56. package/dist/src/internal.d.ts +18 -7
  57. package/dist/src/internal.d.ts.map +1 -1
  58. package/dist/src/internal.js +28 -9
  59. package/dist/src/internal.js.map +1 -1
  60. package/dist/src/plan/event-rows.d.ts +26 -10
  61. package/dist/src/plan/event-rows.d.ts.map +1 -1
  62. package/dist/src/plan/event-rows.js +39 -13
  63. package/dist/src/plan/event-rows.js.map +1 -1
  64. package/dist/src/plan/ir.d.ts +244 -815
  65. package/dist/src/plan/ir.d.ts.map +1 -1
  66. package/dist/src/plan/ir.js +8 -6
  67. package/dist/src/plan/ir.js.map +1 -1
  68. package/dist/src/plan/library.d.ts +3 -0
  69. package/dist/src/plan/library.d.ts.map +1 -1
  70. package/dist/src/plan/library.js +1 -1
  71. package/dist/src/plan/library.js.map +1 -1
  72. package/dist/src/plan/ordered-source.d.ts +1 -0
  73. package/dist/src/plan/ordered-source.d.ts.map +1 -1
  74. package/dist/src/plan/plan.d.ts +559 -1667
  75. package/dist/src/plan/plan.d.ts.map +1 -1
  76. package/dist/src/plan/plan.js +123 -45
  77. package/dist/src/plan/plan.js.map +1 -1
  78. package/dist/src/plan/root.d.ts +16 -20
  79. package/dist/src/plan/root.d.ts.map +1 -1
  80. package/dist/src/plan/root.js +23 -33
  81. package/dist/src/plan/root.js.map +1 -1
  82. package/dist/src/roster/coverage.d.ts +17 -231
  83. package/dist/src/roster/coverage.d.ts.map +1 -1
  84. package/dist/src/roster/coverage.js +94 -90
  85. package/dist/src/roster/coverage.js.map +1 -1
  86. package/dist/src/roster/fit.d.ts +59 -0
  87. package/dist/src/roster/fit.d.ts.map +1 -0
  88. package/dist/src/roster/fit.js +155 -0
  89. package/dist/src/roster/fit.js.map +1 -0
  90. package/dist/src/roster/index.d.ts +2862 -3662
  91. package/dist/src/roster/index.d.ts.map +1 -1
  92. package/dist/src/roster/index.js +383 -81
  93. package/dist/src/roster/index.js.map +1 -1
  94. package/dist/src/roster/library.d.ts +37 -92
  95. package/dist/src/roster/library.d.ts.map +1 -1
  96. package/dist/src/roster/library.js +25 -64
  97. package/dist/src/roster/library.js.map +1 -1
  98. package/dist/src/roster/lists.d.ts +195 -0
  99. package/dist/src/roster/lists.d.ts.map +1 -0
  100. package/dist/src/roster/lists.js +233 -0
  101. package/dist/src/roster/lists.js.map +1 -0
  102. package/dist/src/roster/rules.d.ts +17 -260
  103. package/dist/src/roster/rules.d.ts.map +1 -1
  104. package/dist/src/roster/rules.js +135 -132
  105. package/dist/src/roster/rules.js.map +1 -1
  106. package/dist/src/roster/targets.d.ts +115 -0
  107. package/dist/src/roster/targets.d.ts.map +1 -0
  108. package/dist/src/roster/targets.js +213 -0
  109. package/dist/src/roster/targets.js.map +1 -0
  110. package/dist/src/roster/times.d.ts +251 -0
  111. package/dist/src/roster/times.d.ts.map +1 -0
  112. package/dist/src/roster/times.js +174 -0
  113. package/dist/src/roster/times.js.map +1 -0
  114. package/dist/src/roster/types.d.ts +828 -183
  115. package/dist/src/roster/types.d.ts.map +1 -1
  116. package/dist/src/roster/types.js +224 -97
  117. package/dist/src/roster/types.js.map +1 -1
  118. package/dist/src/schedule/accessor.d.ts +28 -0
  119. package/dist/src/schedule/accessor.d.ts.map +1 -0
  120. package/dist/src/schedule/accessor.js +39 -0
  121. package/dist/src/schedule/accessor.js.map +1 -0
  122. package/dist/src/schedule/events.d.ts +170 -42
  123. package/dist/src/schedule/events.d.ts.map +1 -1
  124. package/dist/src/schedule/events.js +431 -171
  125. package/dist/src/schedule/events.js.map +1 -1
  126. package/dist/src/schedule/index.d.ts +41 -4
  127. package/dist/src/schedule/index.d.ts.map +1 -1
  128. package/dist/src/schedule/index.js +35 -3
  129. package/dist/src/schedule/index.js.map +1 -1
  130. package/dist/src/schedule/library.d.ts +13 -3
  131. package/dist/src/schedule/library.d.ts.map +1 -1
  132. package/dist/src/schedule/library.js +11 -4
  133. package/dist/src/schedule/library.js.map +1 -1
  134. package/dist/src/schedule/periods.d.ts +115 -0
  135. package/dist/src/schedule/periods.d.ts.map +1 -0
  136. package/dist/src/schedule/periods.js +215 -0
  137. package/dist/src/schedule/periods.js.map +1 -0
  138. package/dist/src/schedule/record-window.d.ts +25 -3
  139. package/dist/src/schedule/record-window.d.ts.map +1 -1
  140. package/dist/src/schedule/record-window.js +31 -18
  141. package/dist/src/schedule/record-window.js.map +1 -1
  142. package/dist/src/schedule/resources.d.ts +82 -4
  143. package/dist/src/schedule/resources.d.ts.map +1 -1
  144. package/dist/src/schedule/resources.js +44 -14
  145. package/dist/src/schedule/resources.js.map +1 -1
  146. package/dist/src/schedule/session.d.ts +69 -0
  147. package/dist/src/schedule/session.d.ts.map +1 -0
  148. package/dist/src/schedule/session.js +121 -0
  149. package/dist/src/schedule/session.js.map +1 -0
  150. package/dist/src/schedule/templates.d.ts +14 -2
  151. package/dist/src/schedule/templates.d.ts.map +1 -1
  152. package/dist/src/schedule/templates.js +5 -3
  153. package/dist/src/schedule/templates.js.map +1 -1
  154. package/dist/src/schedule/types.d.ts +1671 -37
  155. package/dist/src/schedule/types.d.ts.map +1 -1
  156. package/dist/src/schedule/types.js +196 -5
  157. package/dist/src/schedule/types.js.map +1 -1
  158. package/dist/src/schedule/window.d.ts +14 -0
  159. package/dist/src/schedule/window.d.ts.map +1 -1
  160. package/dist/src/schedule/window.js +14 -4
  161. package/dist/src/schedule/window.js.map +1 -1
  162. package/dist/src/schedule/words.d.ts +22 -0
  163. package/dist/src/schedule/words.d.ts.map +1 -0
  164. package/dist/src/schedule/words.js +25 -0
  165. package/dist/src/schedule/words.js.map +1 -0
  166. package/dist/src/sheet/index.d.ts +61 -27
  167. package/dist/src/sheet/index.d.ts.map +1 -1
  168. package/dist/src/sheet/index.js +59 -25
  169. package/dist/src/sheet/index.js.map +1 -1
  170. package/dist/src/sheet/library.d.ts +21 -3
  171. package/dist/src/sheet/library.d.ts.map +1 -1
  172. package/dist/src/sheet/library.js +23 -6
  173. package/dist/src/sheet/library.js.map +1 -1
  174. package/dist/src/sheet/registers.d.ts +100 -85
  175. package/dist/src/sheet/registers.d.ts.map +1 -1
  176. package/dist/src/sheet/registers.js +100 -85
  177. package/dist/src/sheet/registers.js.map +1 -1
  178. package/dist/src/sheet/root.d.ts +8 -12
  179. package/dist/src/sheet/root.d.ts.map +1 -1
  180. package/dist/src/sheet/root.js +6 -40
  181. package/dist/src/sheet/root.js.map +1 -1
  182. package/dist/src/sheet/sheet.d.ts +598 -2349
  183. package/dist/src/sheet/sheet.d.ts.map +1 -1
  184. package/dist/src/sheet/sheet.js +124 -37
  185. package/dist/src/sheet/sheet.js.map +1 -1
  186. package/dist/src/sheet/sub-rows.d.ts +74 -28
  187. package/dist/src/sheet/sub-rows.d.ts.map +1 -1
  188. package/dist/src/sheet/sub-rows.js +74 -28
  189. package/dist/src/sheet/sub-rows.js.map +1 -1
  190. package/dist/src/sheet/templates.d.ts +98 -34
  191. package/dist/src/sheet/templates.d.ts.map +1 -1
  192. package/dist/src/sheet/templates.js +102 -58
  193. package/dist/src/sheet/templates.js.map +1 -1
  194. package/dist/src/sheet/types.d.ts +289 -1359
  195. package/dist/src/sheet/types.d.ts.map +1 -1
  196. package/dist/src/sheet/types.js +20 -26
  197. package/dist/src/sheet/types.js.map +1 -1
  198. package/dist/src/sheet/views.d.ts +10 -11
  199. package/dist/src/sheet/views.d.ts.map +1 -1
  200. package/dist/src/sheet/views.js +15 -20
  201. package/dist/src/sheet/views.js.map +1 -1
  202. package/dist/src/{roster/visibility.d.ts → utils/key-visibility.d.ts} +42 -7
  203. package/dist/src/utils/key-visibility.d.ts.map +1 -0
  204. package/dist/src/utils/key-visibility.js +36 -0
  205. package/dist/src/utils/key-visibility.js.map +1 -0
  206. package/dist/src/utils/ordered-source.d.ts +1 -0
  207. package/dist/src/utils/ordered-source.d.ts.map +1 -1
  208. package/dist/src/utils/ordered-source.js +8 -3
  209. package/dist/src/utils/ordered-source.js.map +1 -1
  210. package/dist/src/utils/record-sources.d.ts +107 -0
  211. package/dist/src/utils/record-sources.d.ts.map +1 -0
  212. package/dist/src/utils/record-sources.js +132 -0
  213. package/dist/src/utils/record-sources.js.map +1 -0
  214. package/dist/test/allocation/allocation.examples.d.ts +2902 -0
  215. package/dist/test/allocation/allocation.examples.d.ts.map +1 -0
  216. package/dist/test/allocation/allocation.examples.js +643 -0
  217. package/dist/test/allocation/allocation.examples.js.map +1 -0
  218. package/dist/test/allocation/fit.examples.d.ts +546 -0
  219. package/dist/test/allocation/fit.examples.d.ts.map +1 -0
  220. package/dist/test/allocation/fit.examples.js +171 -0
  221. package/dist/test/allocation/fit.examples.js.map +1 -0
  222. package/dist/test/allocation/kiln-yard.d.ts +181 -0
  223. package/dist/test/allocation/kiln-yard.d.ts.map +1 -0
  224. package/dist/test/allocation/kiln-yard.js +228 -0
  225. package/dist/test/allocation/kiln-yard.js.map +1 -0
  226. package/dist/test/bind/data/data.examples.d.ts +651 -1
  227. package/dist/test/bind/data/data.examples.d.ts.map +1 -1
  228. package/dist/test/bind/data/data.examples.js +140 -2
  229. package/dist/test/bind/data/data.examples.js.map +1 -1
  230. package/dist/test/bind/func/func.examples.d.ts +10 -1
  231. package/dist/test/bind/func/func.examples.d.ts.map +1 -1
  232. package/dist/test/bind/func/func.examples.js +8 -1
  233. package/dist/test/bind/func/func.examples.js.map +1 -1
  234. package/dist/test/bind/record/record.examples.d.ts +633 -1
  235. package/dist/test/bind/record/record.examples.d.ts.map +1 -1
  236. package/dist/test/bind/record/record.examples.js +26 -2
  237. package/dist/test/bind/record/record.examples.js.map +1 -1
  238. package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -1
  239. package/dist/test/calendar/calendar-records.examples.js +18 -14
  240. package/dist/test/calendar/calendar-records.examples.js.map +1 -1
  241. package/dist/test/calendar/calendar.examples.d.ts +521 -16
  242. package/dist/test/calendar/calendar.examples.d.ts.map +1 -1
  243. package/dist/test/calendar/calendar.examples.js +182 -135
  244. package/dist/test/calendar/calendar.examples.js.map +1 -1
  245. package/dist/test/examples-package.d.ts +75 -0
  246. package/dist/test/examples-package.d.ts.map +1 -0
  247. package/dist/test/examples-package.js +263 -0
  248. package/dist/test/examples-package.js.map +1 -0
  249. package/dist/test/flowchart/flowchart.examples.d.ts +211 -19
  250. package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -1
  251. package/dist/test/flowchart/flowchart.examples.js +102 -75
  252. package/dist/test/flowchart/flowchart.examples.js.map +1 -1
  253. package/dist/test/plan/plan-events.examples.d.ts +1439 -209
  254. package/dist/test/plan/plan-events.examples.d.ts.map +1 -1
  255. package/dist/test/plan/plan-events.examples.js +199 -59
  256. package/dist/test/plan/plan-events.examples.js.map +1 -1
  257. package/dist/test/plan/plan-records.examples.d.ts +420 -0
  258. package/dist/test/plan/plan-records.examples.d.ts.map +1 -1
  259. package/dist/test/plan/plan-records.examples.js +70 -19
  260. package/dist/test/plan/plan-records.examples.js.map +1 -1
  261. package/dist/test/plan/plan-windows.examples.d.ts +636 -55
  262. package/dist/test/plan/plan-windows.examples.d.ts.map +1 -1
  263. package/dist/test/plan/plan-windows.examples.js +69 -33
  264. package/dist/test/plan/plan-windows.examples.js.map +1 -1
  265. package/dist/test/plan/plan.examples.d.ts +153 -31
  266. package/dist/test/plan/plan.examples.d.ts.map +1 -1
  267. package/dist/test/plan/plan.examples.js +178 -101
  268. package/dist/test/plan/plan.examples.js.map +1 -1
  269. package/dist/test/roster/domain.examples.d.ts +467 -250
  270. package/dist/test/roster/domain.examples.d.ts.map +1 -1
  271. package/dist/test/roster/domain.examples.js +92 -29
  272. package/dist/test/roster/domain.examples.js.map +1 -1
  273. package/dist/test/roster/roster-records.examples.d.ts +430 -586
  274. package/dist/test/roster/roster-records.examples.d.ts.map +1 -1
  275. package/dist/test/roster/roster-records.examples.js +102 -43
  276. package/dist/test/roster/roster-records.examples.js.map +1 -1
  277. package/dist/test/roster/roster.examples.d.ts +2319 -606
  278. package/dist/test/roster/roster.examples.d.ts.map +1 -1
  279. package/dist/test/roster/roster.examples.js +456 -148
  280. package/dist/test/roster/roster.examples.js.map +1 -1
  281. package/dist/test/roster/warehouse.d.ts +172 -63
  282. package/dist/test/roster/warehouse.d.ts.map +1 -1
  283. package/dist/test/roster/warehouse.js +172 -39
  284. package/dist/test/roster/warehouse.js.map +1 -1
  285. package/dist/test/schedule/schedule.examples.d.ts +3499 -0
  286. package/dist/test/schedule/schedule.examples.d.ts.map +1 -0
  287. package/dist/test/schedule/schedule.examples.js +192 -0
  288. package/dist/test/schedule/schedule.examples.js.map +1 -0
  289. package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -1
  290. package/dist/test/sheet/sheet-records.examples.js +22 -18
  291. package/dist/test/sheet/sheet-records.examples.js.map +1 -1
  292. package/dist/test/sheet/sheet.examples.d.ts +715 -26
  293. package/dist/test/sheet/sheet.examples.d.ts.map +1 -1
  294. package/dist/test/sheet/sheet.examples.js +204 -130
  295. package/dist/test/sheet/sheet.examples.js.map +1 -1
  296. package/package.json +17 -10
  297. package/dist/src/roster/people.d.ts +0 -50
  298. package/dist/src/roster/people.d.ts.map +0 -1
  299. package/dist/src/roster/people.js +0 -32
  300. package/dist/src/roster/people.js.map +0 -1
  301. package/dist/src/roster/visibility.d.ts.map +0 -1
  302. package/dist/src/roster/visibility.js +0 -25
  303. package/dist/src/roster/visibility.js.map +0 -1
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * The Allocation's adapters (#1371, `Builder Interfaces Spec.md` §6.1, §6.4):
7
+ * what the board books from, the app's keyed rows read as arrivals through
8
+ * accessors, `(row, key) => …`, each reified once into one East function and
9
+ * called per row, as `Schedule.resources` reifies its own; and the board's
10
+ * lanes and resources, built from their `Schedule.resources` kinds' accessors
11
+ * the same way. The board writes none of them: it writes the app's bins
12
+ * (`Schedule.events`) and its days (`Schedule.periods`).
13
+ *
14
+ * An arrival's `values` gives a bin booked from it the fields no role maps
15
+ * (B13). Those are the bin kind's, which only the tag holds, so `values` is
16
+ * reified there, at the bin kind's own fields (`allocationInitial`).
17
+ *
18
+ * @packageDocumentation
19
+ */
20
+ import { ArrayType, BlobType, DateTimeType, FloatType, FunctionType, OptionType, StringType, type DictType, type EastType, type ExprType, type StructType, type SubtypeExprOrValue } from "@elaraai/east";
21
+ import { TimeStepType } from "@elaraai/east-ui";
22
+ import type { ScheduleResourceKind } from "../schedule/resources.js";
23
+ import { AllocationArrivalType, AllocationDetailType, AllocationIntervalType, AllocationLaneType, AllocationResourceType } from "./types.js";
24
+ /** Brands an arrivals declaration, so the tag knows one from any other value. @internal */
25
+ export declare const ALLOCATION_ARRIVALS: unique symbol;
26
+ /**
27
+ * One of an arrival's accessors: what it reads from the app's row and its key.
28
+ *
29
+ * @typeParam R - The app's row type
30
+ * @typeParam T - What it returns
31
+ */
32
+ export type AllocationArrivalAccessor<R extends EastType, T extends EastType> = (row: ExprType<R>, key: ExprType<StringType>) => SubtypeExprOrValue<T>;
33
+ /**
34
+ * Accessors reading an app's rows as arrivals, what the board books from
35
+ * (§6.4).
36
+ *
37
+ * @typeParam R - The app's row type
38
+ */
39
+ export interface AllocationArrivalsConfig<R extends EastType> {
40
+ /** Its code on cards, chips, captions and lists (`LD-2231`). */
41
+ label: AllocationArrivalAccessor<R, StringType>;
42
+ /** Its quantity, booked whole unless split: a bin booked from it takes it as its own. */
43
+ quantity: AllocationArrivalAccessor<R, FloatType>;
44
+ /** How long a resource holds a bin of it (`variant("days", 8)`): a bin booked from it keeps it. */
45
+ hold: AllocationArrivalAccessor<R, TimeStepType>;
46
+ /** What it goes with: a resource holding the same kind ranks it higher in `Allocation.fit`, and a bin booked from it keeps it. Omitted, none. */
47
+ kind?: AllocationArrivalAccessor<R, OptionType<StringType>>;
48
+ /** Its card's second line and the Table chip's tail (`BRK · R2 · spec MC12`). */
49
+ meta?: AllocationArrivalAccessor<R, OptionType<StringType>>;
50
+ /** When it is due: overdue before the plan day. */
51
+ due?: AllocationArrivalAccessor<R, OptionType<DateTimeType>>;
52
+ /** Its ready window, `[from, to)`. */
53
+ window?: AllocationArrivalAccessor<R, OptionType<AllocationIntervalType>>;
54
+ /** Read-only lines in a bin's inspector (`Settings`). */
55
+ details?: AllocationArrivalAccessor<R, ArrayType<AllocationDetailType>>;
56
+ /**
57
+ * A booked bin's own fields: the fields of the bin kind's row that no role maps, which a bin booked from it starts
58
+ * with (`(l) => ({ specBooked: l.spec, … })`). Omitted, each takes its type's default, as a reservation's always do.
59
+ */
60
+ values?: (row: ExprType<R>, key: ExprType<StringType>) => unknown;
61
+ }
62
+ /**
63
+ * An arrivals declaration: the app's rows and their accessors, each reified
64
+ * once (`Allocation.arrivals`), and the `values` the tag reifies at the bin
65
+ * kind's own fields.
66
+ */
67
+ export interface AllocationArrivals {
68
+ /** The brand. */
69
+ readonly [ALLOCATION_ARRIVALS]: true;
70
+ /** Every arrival's row, by key. Erased, so arrivals of any rows are one declaration. */
71
+ readonly rows: ExprType<DictType<StringType, EastType>>;
72
+ /** The rows' type. */
73
+ readonly rowType: EastType;
74
+ /** One arrival from its row and its key: its accessors, each reified once and called once. */
75
+ readonly arrival: ExprType<FunctionType<[EastType, StringType], AllocationArrivalType>>;
76
+ /** The author's `values`, reified by the tag at the bin kind's own fields; `undefined` without one. */
77
+ readonly values: ((row: ExprType<EastType>, key: ExprType<StringType>) => unknown) | undefined;
78
+ }
79
+ /**
80
+ * Declares what the board books from: the arrivals, read from the app's keyed
81
+ * rows (§6.4).
82
+ *
83
+ * @typeParam R - The app's row type
84
+ * @param rows - Every arrival's row, by key — usually a record's `read()`: fits, checks and the library read every one
85
+ * @param config - The accessors; `values`, a booked bin's own fields
86
+ * @returns The declaration `<Allocation arrivals>` takes
87
+ * @throws {Error} When the rows are not a Dict keyed by String, or an accessor returns another type than it takes, naming what it returns
88
+ *
89
+ * @remarks
90
+ * Booking an arrival writes the bin's roles — `arrival` its key, `quantity`,
91
+ * `kind` and `hold` from these accessors, `parts` empty, `at` and `resource`
92
+ * where it is booked — and `values`' struct into the row's other fields.
93
+ *
94
+ * @example
95
+ * ```tsx
96
+ * import { DictType, FloatType, StringType, StructType, variant } from "@elaraai/east";
97
+ * import { Allocation, Data } from "@elaraai/e3-ui";
98
+ * import e3 from "@elaraai/e3";
99
+ *
100
+ * const Load = StructType({ code: StringType, m3: FloatType, dryingDays: FloatType });
101
+ * const loads = e3.record("loads", DictType(StringType, Load), new Map());
102
+ *
103
+ * // Inside the board's Reactive body: every load the day may book.
104
+ * const arrivals = Allocation.arrivals(Data.bind(loads).read(), { label: (l) => l.code, quantity: (l) => l.m3, hold: (l) => variant("days", l.dryingDays) });
105
+ * ```
106
+ */
107
+ export declare function allocationArrivals<R extends EastType>(rows: ExprType<DictType<StringType, R>>, config: AllocationArrivalsConfig<R>): AllocationArrivals;
108
+ /**
109
+ * Whether a value is an arrivals declaration (`Allocation.arrivals`).
110
+ *
111
+ * @param value - What an app passed as `arrivals`
112
+ * @returns Whether it is one
113
+ * @internal
114
+ */
115
+ export declare function isAllocationArrivals(value: unknown): value is AllocationArrivals;
116
+ /**
117
+ * Every arrival, read from the app's rows through the declaration's
118
+ * accessors, each called once per row, in the rows' key order.
119
+ *
120
+ * @param arrivals - The declaration
121
+ * @returns Every arrival
122
+ * @internal
123
+ */
124
+ export declare function allocationArrivalsOf(arrivals: AllocationArrivals): ExprType<ArrayType<AllocationArrivalType>>;
125
+ /**
126
+ * The fields a bin booked from an arrival starts with, by the arrival's key:
127
+ * its `values`, as bytes at the bin kind's own fields (B13) — what the bin
128
+ * kind's `create` takes beside the bin's roles.
129
+ *
130
+ * @param arrivals - The declaration
131
+ * @param values - The bin kind's own fields, the ones no role maps (`allocationValues`)
132
+ * @returns An East function from an arrival's key to its starting fields as bytes at `values`; `none` for a key the arrivals do not hold, and for every key without `values`, so each field takes its type's default
133
+ * @throws {Error} When `values` returns another struct than `values`: a field missing, one the bin kind's own fields lack, or one of another type, naming both
134
+ * @internal
135
+ */
136
+ export declare function allocationInitial(arrivals: AllocationArrivals, values: StructType): ExprType<FunctionType<[StringType], OptionType<BlobType>>>;
137
+ /**
138
+ * The lanes, built from the lanes' resource kind's accessors, each called
139
+ * once per row, in key order (§6.2): each takes a bin each `every`, at its
140
+ * `offset` past the slot's start — on the slot itself without one.
141
+ *
142
+ * @param kind - The lanes' resource kind, read whole and keyed by String
143
+ * @returns Every lane
144
+ * @throws {Error} For a kind read a window at a time, which the tag refuses before it builds the lanes
145
+ * @internal
146
+ */
147
+ export declare function allocationLanesOf(kind: ScheduleResourceKind<EastType, EastType>): ExprType<ArrayType<AllocationLaneType>>;
148
+ /**
149
+ * The resources, built from the resources' kind's accessors, each called once
150
+ * per row, in key order (§6.2): every resource, whatever the narrowing shows,
151
+ * as fits, checks and totals read them.
152
+ *
153
+ * @param kind - The resources' kind, read whole and keyed by String, with `min` and `max`
154
+ * @returns Every resource; one with no `group` has none, no `note` none, no `hold` no time, and no `jobs` none
155
+ * @throws {Error} For a kind read a window at a time, or with no `min` or `max`, which the tag refuses before it builds the resources
156
+ * @internal
157
+ */
158
+ export declare function allocationResourcesOf(kind: ScheduleResourceKind<EastType, EastType>): ExprType<ArrayType<AllocationResourceType>>;
159
+ //# sourceMappingURL=adapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../../src/allocation/adapters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACH,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAc,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAE9F,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,KAAK,kBAAkB,EACxF,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE7I,2FAA2F;AAC3F,eAAO,MAAM,mBAAmB,EAAE,OAAO,MAAsC,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAEvJ;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,QAAQ;IACxD,gEAAgE;IAChE,KAAK,EAAE,yBAAyB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAChD,yFAAyF;IACzF,QAAQ,EAAE,yBAAyB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAClD,mGAA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ces Spec.md` §6.1, §6.4):
7
+ * what the board books from, the app's keyed rows read as arrivals through
8
+ * accessors, `(row, key) => …`, each reified once into one East function and
9
+ * called per row, as `Schedule.resources` reifies its own; and the board's
10
+ * lanes and resources, built from their `Schedule.resources` kinds' accessors
11
+ * the same way. The board writes none of them: it writes the app's bins
12
+ * (`Schedule.events`) and its days (`Schedule.periods`).
13
+ *
14
+ * An arrival's `values` gives a bin booked from it the fields no role maps
15
+ * (B13). Those are the bin kind's, which only the tag holds, so `values` is
16
+ * reified there, at the bin kind's own fields (`allocationInitial`).
17
+ *
18
+ * @packageDocumentation
19
+ */
20
+ import { ArrayType, BlobType, DateTimeType, East, Expr, FloatType, FunctionType, OptionType, StringType, isSubtype, isTypeEqual, none, printType, some, variant, } from "@elaraai/east";
21
+ import { TimeStepType } from "@elaraai/east-ui";
22
+ import { scheduleAccessor } from "../schedule/accessor.js";
23
+ import { AllocationArrivalType, AllocationDetailType, AllocationIntervalType, AllocationLaneType, AllocationResourceType } from "./types.js";
24
+ /** Brands an arrivals declaration, so the tag knows one from any other value. @internal */
25
+ export const ALLOCATION_ARRIVALS = Symbol("Allocation.arrivals");
26
+ /**
27
+ * Declares what the board books from: the arrivals, read from the app's keyed
28
+ * rows (§6.4).
29
+ *
30
+ * @typeParam R - The app's row type
31
+ * @param rows - Every arrival's row, by key — usually a record's `read()`: fits, checks and the library read every one
32
+ * @param config - The accessors; `values`, a booked bin's own fields
33
+ * @returns The declaration `<Allocation arrivals>` takes
34
+ * @throws {Error} When the rows are not a Dict keyed by String, or an accessor returns another type than it takes, naming what it returns
35
+ *
36
+ * @remarks
37
+ * Booking an arrival writes the bin's roles — `arrival` its key, `quantity`,
38
+ * `kind` and `hold` from these accessors, `parts` empty, `at` and `resource`
39
+ * where it is booked — and `values`' struct into the row's other fields.
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * import { DictType, FloatType, StringType, StructType, variant } from "@elaraai/east";
44
+ * import { Allocation, Data } from "@elaraai/e3-ui";
45
+ * import e3 from "@elaraai/e3";
46
+ *
47
+ * const Load = StructType({ code: StringType, m3: FloatType, dryingDays: FloatType });
48
+ * const loads = e3.record("loads", DictType(StringType, Load), new Map());
49
+ *
50
+ * // Inside the board's Reactive body: every load the day may book.
51
+ * const arrivals = Allocation.arrivals(Data.bind(loads).read(), { label: (l) => l.code, quantity: (l) => l.m3, hold: (l) => variant("days", l.dryingDays) });
52
+ * ```
53
+ */
54
+ export function allocationArrivals(rows, config) {
55
+ const where = "Allocation.arrivals";
56
+ const type = rows instanceof Expr ? Expr.type(rows) : undefined;
57
+ if (type === undefined || type.type !== "Dict" || !isTypeEqual(type.key, StringType)) {
58
+ throw new Error(`${where}: arrivals are a Dict keyed by String — a record's read() — and these are ${type === undefined ? "no East value" : printType(type)}`);
59
+ }
60
+ const rowType = type.value;
61
+ const given = config;
62
+ for (const prop of ["label", "quantity", "hold"]) {
63
+ if (typeof given[prop] !== "function")
64
+ throw new Error(`${where}: \`${prop}\` is an accessor, (row, key) => …, which the board reads of every arrival — give it`);
65
+ }
66
+ // Each accessor, one East function, called per row (`shared/reify.ts`' rule), held to the type it returns.
67
+ const accessor = (prop, out, what, fn) => fn === undefined ? undefined
68
+ : scheduleAccessor(rowType, StringType, out, fn, (returns) => `${where}: \`${prop}\` returns ${what} — and this one returns ${returns}`);
69
+ const optString = OptionType(StringType);
70
+ const label = accessor("label", StringType, "a String, an arrival's code", given.label);
71
+ const quantity = accessor("quantity", FloatType, "a Float, an arrival's quantity", given.quantity);
72
+ const hold = accessor("hold", TimeStepType, "a TimeStep, how long a resource holds a bin of it", given.hold);
73
+ const kind = accessor("kind", optString, "an Option of a String, what an arrival goes with on a resource", given.kind);
74
+ const meta = accessor("meta", optString, "an Option of a String, an arrival's second line", given.meta);
75
+ const due = accessor("due", OptionType(DateTimeType), "an Option of a DateTime, when an arrival is due", given.due);
76
+ const window = accessor("window", OptionType(AllocationIntervalType), "an Option of an Allocation.Types.Interval, an arrival's ready window", given.window);
77
+ const details = accessor("details", ArrayType(AllocationDetailType), "an Array of Allocation.Types.Detail, the lines a bin's inspector shows", given.details);
78
+ // One arrival from its row: each accessor called once.
79
+ const arrival = East.function([rowType, StringType], AllocationArrivalType, ($, row, key) => {
80
+ const call = (fn, otherwise) => {
81
+ if (fn === undefined)
82
+ return otherwise;
83
+ const bound = $.const(fn);
84
+ return bound(row, key);
85
+ };
86
+ const labelOf = $.const(label);
87
+ const quantityOf = $.const(quantity);
88
+ const holdOf = $.const(hold);
89
+ return {
90
+ key, label: labelOf(row, key), meta: call(meta, East.value(none, optString)),
91
+ quantity: quantityOf(row, key), hold: holdOf(row, key), kind: call(kind, East.value(none, optString)),
92
+ due: call(due, East.value(none, OptionType(DateTimeType))), window: call(window, East.value(none, OptionType(AllocationIntervalType))),
93
+ details: call(details, East.value([], ArrayType(AllocationDetailType))),
94
+ };
95
+ });
96
+ return {
97
+ [ALLOCATION_ARRIVALS]: true,
98
+ rows: rows,
99
+ rowType,
100
+ arrival: arrival,
101
+ values: given.values,
102
+ };
103
+ }
104
+ /**
105
+ * Whether a value is an arrivals declaration (`Allocation.arrivals`).
106
+ *
107
+ * @param value - What an app passed as `arrivals`
108
+ * @returns Whether it is one
109
+ * @internal
110
+ */
111
+ export function isAllocationArrivals(value) {
112
+ return typeof value === "object" && value !== null && !(value instanceof Expr) && value[ALLOCATION_ARRIVALS] === true;
113
+ }
114
+ /**
115
+ * Every arrival, read from the app's rows through the declaration's
116
+ * accessors, each called once per row, in the rows' key order.
117
+ *
118
+ * @param arrivals - The declaration
119
+ * @returns Every arrival
120
+ * @internal
121
+ */
122
+ export function allocationArrivalsOf(arrivals) {
123
+ const make = arrivals.arrival;
124
+ return arrivals.rows.toArray(($, row, key) => {
125
+ const arrivalOf = $.const(make);
126
+ return arrivalOf(row, key);
127
+ });
128
+ }
129
+ /**
130
+ * The fields a bin booked from an arrival starts with, by the arrival's key:
131
+ * its `values`, as bytes at the bin kind's own fields (B13) — what the bin
132
+ * kind's `create` takes beside the bin's roles.
133
+ *
134
+ * @param arrivals - The declaration
135
+ * @param values - The bin kind's own fields, the ones no role maps (`allocationValues`)
136
+ * @returns An East function from an arrival's key to its starting fields as bytes at `values`; `none` for a key the arrivals do not hold, and for every key without `values`, so each field takes its type's default
137
+ * @throws {Error} When `values` returns another struct than `values`: a field missing, one the bin kind's own fields lack, or one of another type, naming both
138
+ * @internal
139
+ */
140
+ export function allocationInitial(arrivals, values) {
141
+ const given = arrivals.values;
142
+ if (given === undefined) {
143
+ return East.function([StringType], OptionType(BlobType), (_$, _key) => East.value(none, OptionType(BlobType)));
144
+ }
145
+ // What `values` returns, as East infers it from its own body: an object literal missing a field, or holding one the
146
+ // struct lacks, is a struct of another shape, refused naming both rather than read as East would convert it.
147
+ const inferred = Expr.type(East.function([arrivals.rowType, StringType], undefined, (_$, row, key) => given(row, key))).output;
148
+ if (!isSubtype(inferred, values)) {
149
+ throw new Error(`Allocation.arrivals: \`values\` returns a booked bin's own fields, the bin kind's fields no role maps — ${printType(values)} — ` +
150
+ `and this one returns ${printType(inferred)}`);
151
+ }
152
+ const start = East.function([arrivals.rowType, StringType], values, (_$, row, key) => given(row, key));
153
+ const rows = arrivals.rows;
154
+ return East.function([StringType], OptionType(BlobType), ($, key) => {
155
+ const all = $.const(rows);
156
+ const startOf = $.const(start);
157
+ const result = $.let(none, OptionType(BlobType));
158
+ $.match(all.tryGet(key), {
159
+ some: ($2, row) => { $2.assign(result, some(East.Blob.encodeBeast(startOf(row, key), "v2"))); },
160
+ });
161
+ return result;
162
+ });
163
+ }
164
+ /**
165
+ * The lanes, built from the lanes' resource kind's accessors, each called
166
+ * once per row, in key order (§6.2): each takes a bin each `every`, at its
167
+ * `offset` past the slot's start — on the slot itself without one.
168
+ *
169
+ * @param kind - The lanes' resource kind, read whole and keyed by String
170
+ * @returns Every lane
171
+ * @throws {Error} For a kind read a window at a time, which the tag refuses before it builds the lanes
172
+ * @internal
173
+ */
174
+ export function allocationLanesOf(kind) {
175
+ if (kind.source === undefined)
176
+ throw new Error("Allocation: the lanes' kind is read whole — give its rows as a Dict, usually a record's read()");
177
+ const { label, offset } = kind.accessors;
178
+ const lane = East.function([kind.rowType, kind.keyType], AllocationLaneType, ($, row, key) => {
179
+ const labelOf = $.const(label);
180
+ let at;
181
+ if (offset === undefined) {
182
+ at = variant("minutes", 0.0);
183
+ }
184
+ else {
185
+ const offsetOf = $.const(offset);
186
+ at = offsetOf(row, key);
187
+ }
188
+ return { key: key, label: labelOf(row, key), offset: at };
189
+ });
190
+ return kind.source.toArray(($, row, key) => {
191
+ const make = $.const(lane);
192
+ return make(row, key);
193
+ });
194
+ }
195
+ /**
196
+ * The resources, built from the resources' kind's accessors, each called once
197
+ * per row, in key order (§6.2): every resource, whatever the narrowing shows,
198
+ * as fits, checks and totals read them.
199
+ *
200
+ * @param kind - The resources' kind, read whole and keyed by String, with `min` and `max`
201
+ * @returns Every resource; one with no `group` has none, no `note` none, no `hold` no time, and no `jobs` none
202
+ * @throws {Error} For a kind read a window at a time, or with no `min` or `max`, which the tag refuses before it builds the resources
203
+ * @internal
204
+ */
205
+ export function allocationResourcesOf(kind) {
206
+ const a = kind.accessors;
207
+ const { min, max } = a;
208
+ if (kind.source === undefined || min === undefined || max === undefined) {
209
+ throw new Error("Allocation: the resources' kind is read whole and gives each resource's `min` and `max` — Schedule.resources(rows, { …, min, max })");
210
+ }
211
+ const resource = East.function([kind.rowType, kind.keyType], AllocationResourceType, ($, row, key) => {
212
+ const call = (fn, otherwise) => {
213
+ if (fn === undefined)
214
+ return otherwise;
215
+ const bound = $.const(fn);
216
+ return bound(row, key);
217
+ };
218
+ const labelOf = $.const(a.label);
219
+ const metaOf = $.const(a.meta);
220
+ const minOf = $.const(min);
221
+ const maxOf = $.const(max);
222
+ let group;
223
+ if (a.group === undefined) {
224
+ group = none;
225
+ }
226
+ else {
227
+ const groupOf = $.const(a.group);
228
+ group = some(groupOf(row, key));
229
+ }
230
+ return {
231
+ key: key, label: labelOf(row, key), group, meta: metaOf(row, key),
232
+ note: call(a.note, East.value(none, OptionType(StringType))), min: minOf(row, key), max: maxOf(row, key),
233
+ hold: call(a.hold, East.value(variant("days", 0.0), TimeStepType)), jobs: call(a.jobs, East.value([], AllocationResourceType.fields.jobs)),
234
+ };
235
+ });
236
+ return kind.source.toArray(($, row, key) => {
237
+ const make = $.const(resource);
238
+ return make(row, key);
239
+ });
240
+ }
241
+ //# sourceMappingURL=adapters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../../src/allocation/adapters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACH,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EACvI,IAAI,EAAE,OAAO,GAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE7I,2FAA2F;AAC3F,MAAM,CAAC,MAAM,mBAAmB,GAAkB,MAAM,CAAC,qBAAqB,CAAC,CAAC;AA6DhF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,kBAAkB,CAAqB,IAAuC,EAAE,MAAmC;IAC/H,MAAM,KAAK,GAAG,qBAAqB,CAAC;IACpC,MAAM,IAAI,GAAG,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAuB,CAAa,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/F,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAA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