@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
@@ -2,32 +2,106 @@
2
2
  * Copyright (c) 2025 Elara AI Pty Ltd
3
3
  * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
4
  */
5
- /** Warehouse fixture transcribed from docs/proposals/Roster Spec.html. */
6
- import { ArrayType, BooleanType, DictType, FloatType, OptionType, SetType, StringType, StructType, SortedMap, SortedSet, DateTimeType, compareFor, none, some, variant } from "@elaraai/east";
7
- import { Roster } from "@elaraai/e3-ui";
5
+ /**
6
+ * The warehouse, transcribed from docs/proposals/Roster Spec.html into records
7
+ * of its own (#1368, `Builder Interfaces Spec.md` §5.7): its duties, the weeks
8
+ * of its rota, its cover targets and suggestions, its pay rates, its staff and
9
+ * agencies, and its shift times, teams, positions and activities. Every name
10
+ * and figure is generated. Beside them, the Roster's reading of the two seeded
11
+ * weeks (`Roster.Types.Week(WarehouseDuty)`), which the Roster's own reading
12
+ * of the duties is held to on e3 (e3-ui-components' `test/roster-payload.spec.ts`).
13
+ */
14
+ import { BooleanType, DateTimeType, DictType, FloatType, IntegerType, NullType, OptionType, SetType, SortedMap, SortedSet, StringType, StructType, VariantType, compareFor, none, some, variant, } from "@elaraai/east";
15
+ import { Roster, Schedule } from "@elaraai/e3-ui";
16
+ /** One of the warehouse's staff. */
8
17
  export const WarehousePerson = StructType({ name: StringType, team: StringType, position: StringType, skills: SetType(StringType), contract: FloatType, agency: BooleanType, trainer: BooleanType, trainee: BooleanType, usual: OptionType(StringType) });
9
- export const WarehouseConfig = StructType({ groups: ArrayType(Roster.Types.Group), shifts: ArrayType(Roster.Types.Shift), duties: ArrayType(Roster.Types.Skill), positions: DictType(StringType, Roster.Types.Position), agencies: ArrayType(Roster.Types.Agency), rules: Roster.Types.Rules, costs: Roster.Types.Costs });
10
- export const StaffScope = StructType({ key: StringType, name: StringType, team: StringType, position: StringType, agency: BooleanType, trainer: BooleanType });
18
+ /** A warehouse activity: Roster.Types.Activity's label, code and group, and where it shows among the activities. */
19
+ export const WarehouseActivity = StructType({ label: StringType, code: StringType, group: OptionType(StringType), order: IntegerType });
20
+ /**
21
+ * A duty, the warehouse's own: who — one of its staff, or an agency asked to
22
+ * send someone — its own times, worth what its pay rules say, its shift and
23
+ * team, its role and task, and the warehouse's fields beside them, which its
24
+ * pay, its check and its inspector read.
25
+ */
26
+ export const WarehouseDuty = StructType({
27
+ who: VariantType({ staff: StringType, agency: StringType }),
28
+ start: DateTimeType, end: DateTimeType,
29
+ shift: StringType, team: StringType, role: StringType, task: OptionType(StringType),
30
+ unpaidBreak: FloatType, agreed: OptionType(BooleanType),
31
+ costCentre: StringType, note: StringType,
32
+ });
33
+ /** A week of the rota: open, or issued and when; the suggestions it dismissed; who approved it. */
34
+ export const WarehouseWeek = StructType({
35
+ state: VariantType({ open: NullType, issued: StructType({ at: DateTimeType }) }),
36
+ dismissed: SetType(StringType), approver: OptionType(StringType),
37
+ });
38
+ /** A cover target: a day's team and shift, the heads it needs and the hours each activity needs, and what it rests on — the forecast's run, or a planner. */
39
+ export const WarehouseCover = StructType({ day: DateTimeType, team: StringType, shift: StringType, heads: IntegerType, hours: DictType(StringType, FloatType), basis: StringType });
40
+ /** A suggestion: someone for a day's team and shift, and why. */
41
+ export const WarehouseSuggestion = StructType({ person: StringType, day: DateTimeType, team: StringType, shift: StringType, why: StringType });
42
+ /** An agency the warehouse asks for staff. */
43
+ export const WarehouseAgency = StructType({ name: StringType });
44
+ /** A shift: its name, its code, when it starts and its hours, and where it shows. */
45
+ export const WarehouseShift = StructType({ label: StringType, code: StringType, start: Schedule.Types.Clock, hours: FloatType, order: IntegerType });
46
+ /** A team, and where it shows. */
47
+ export const WarehouseTeam = StructType({ label: StringType, order: IntegerType });
48
+ /** A position: its name, its badge, whether it leads, and where it shows. */
49
+ export const WarehousePosition = StructType({ label: StringType, code: StringType, lead: BooleanType, order: IntegerType });
50
+ /** The Roster's reading of a week of the warehouse's duties. */
51
+ export const WarehouseRosterWeek = Roster.Types.Week(WarehouseDuty);
52
+ /** This week: Sunday 5 March 2028. */
11
53
  export const warehouseStart = new Date("2028-03-05T00:00:00Z");
54
+ /** The week before, published. */
55
+ export const warehousePreviousStart = new Date("2028-02-27T00:00:00Z");
56
+ /** The week after, its targets the forecast's alone. */
57
+ export const warehouseNextStart = new Date("2028-03-12T00:00:00Z");
58
+ /** When the week before was issued. */
59
+ export const warehouseIssuedAt = new Date("2028-03-04T12:00:00Z");
12
60
  const stringOrder = compareFor(StringType);
13
- export const warehouseConfig = {
14
- groups: [{ "key": "inbound", "label": "Inbound", "skills": [{ "key": "unload", "label": "Unloading", "code": "UL" }, { "key": "putaway", "label": "Put-away", "code": "PA" }, { "key": "reach", "label": "Reach truck", "code": "RT" }, { "key": "xdock", "label": "Cross-dock", "code": "XD" }, { "key": "rcvqa", "label": "Receiving QA", "code": "QA" }, { "key": "yard", "label": "Yard", "code": "YD" }] }, { "key": "picking", "label": "Picking", "skills": [{ "key": "pick", "label": "Order picking", "code": "OP" }, { "key": "voice", "label": "Voice picking", "code": "VP" }, { "key": "replen", "label": "Replenishment", "code": "RP" }, { "key": "cold", "label": "Cold store · licence", "code": "CS" }] }, { "key": "dispatch", "label": "Dispatch", "skills": [{ "key": "pack", "label": "Packing", "code": "PK" }, { "key": "load", "label": "Loading", "code": "LD" }, { "key": "label", "label": "Labelling", "code": "LB" }, { "key": "returns", "label": "Returns", "code": "RN" }, { "key": "admin", "label": "Dispatch admin", "code": "DA" }, { "key": "hazmat", "label": "Hazmat · licence", "code": "HZ" }] }],
15
- shifts: [
16
- { key: "early", label: "Early", code: "E", start: { hour: 6n, minute: 0n }, hours: 8 },
17
- { key: "late", label: "Late", code: "L", start: { hour: 14n, minute: 0n }, hours: 8 },
18
- { key: "night", label: "Night", code: "N", start: { hour: 22n, minute: 0n }, hours: 8 },
19
- ],
20
- duties: [{ key: "general", label: "General duties", code: "GD" }],
21
- positions: new SortedMap([
22
- ["crew", { key: "crew", label: "Associate", code: "", lead: false }],
23
- ["lead", { key: "lead", label: "Supervisor", code: "SV", lead: true }],
24
- ["deputy", { key: "deputy", label: "Deputy supervisor", code: "DS", lead: true }],
25
- ["acting", { key: "acting", label: "Acting supervisor", code: "ACT", lead: true }],
26
- ], stringOrder),
27
- agencies: [{ key: "northside", name: "Northside Staffing" }],
28
- rules: { rest: 10, lead: true, trainer: true, skill: true, agree: true },
29
- costs: { currency: "AUD", rates: { permanent: 42, overtime: 63, agency: 51 }, budget: some(24800) },
30
- };
61
+ /** The shifts: early, late and night, eight hours each. */
62
+ export const warehouseShifts = new SortedMap([
63
+ ["early", { label: "Early", code: "E", start: { hour: 6n, minute: 0n }, hours: 8, order: 1n }],
64
+ ["late", { label: "Late", code: "L", start: { hour: 14n, minute: 0n }, hours: 8, order: 2n }],
65
+ ["night", { label: "Night", code: "N", start: { hour: 22n, minute: 0n }, hours: 8, order: 3n }],
66
+ ], stringOrder);
67
+ /** The teams, each a group of the roster. */
68
+ export const warehouseTeams = new SortedMap([
69
+ ["inbound", { label: "Inbound", order: 1n }], ["picking", { label: "Picking", order: 2n }], ["dispatch", { label: "Dispatch", order: 3n }],
70
+ ], stringOrder);
71
+ /** The positions, in the mock's order; the supervisors lead. */
72
+ export const warehousePositions = new SortedMap([
73
+ ["acting", { label: "Acting supervisor", code: "ACT", lead: true, order: 1n }],
74
+ ["crew", { label: "Associate", code: "", lead: false, order: 2n }],
75
+ ["deputy", { label: "Deputy supervisor", code: "DS", lead: true, order: 3n }],
76
+ ["lead", { label: "Supervisor", code: "SV", lead: true, order: 4n }],
77
+ ], stringOrder);
78
+ /** The agency the warehouse asks for staff. */
79
+ export const warehouseAgencies = new SortedMap([
80
+ ["northside", { name: "Northside Staffing" }],
81
+ ], stringOrder);
82
+ /** The warehouse's pay rates by its own pay codes, an hour each: ordinary time, the first overtime, and an agency's. */
83
+ export const warehousePayRates = new SortedMap([["AGENCY", 51], ["ORD", 42], ["OT1", 63]], stringOrder);
84
+ /** Every activity by its key: each group's skills, and the one duty of none, General duties, each in the mock's order (#1342). */
85
+ export const warehouseActivities = new SortedMap([
86
+ ["unload", { label: "Unloading", code: "UL", group: some("inbound"), order: 1n }],
87
+ ["putaway", { label: "Put-away", code: "PA", group: some("inbound"), order: 2n }],
88
+ ["reach", { label: "Reach truck", code: "RT", group: some("inbound"), order: 3n }],
89
+ ["xdock", { label: "Cross-dock", code: "XD", group: some("inbound"), order: 4n }],
90
+ ["rcvqa", { label: "Receiving QA", code: "QA", group: some("inbound"), order: 5n }],
91
+ ["yard", { label: "Yard", code: "YD", group: some("inbound"), order: 6n }],
92
+ ["pick", { label: "Order picking", code: "OP", group: some("picking"), order: 7n }],
93
+ ["voice", { label: "Voice picking", code: "VP", group: some("picking"), order: 8n }],
94
+ ["replen", { label: "Replenishment", code: "RP", group: some("picking"), order: 9n }],
95
+ ["cold", { label: "Cold store · licence", code: "CS", group: some("picking"), order: 10n }],
96
+ ["pack", { label: "Packing", code: "PK", group: some("dispatch"), order: 11n }],
97
+ ["load", { label: "Loading", code: "LD", group: some("dispatch"), order: 12n }],
98
+ ["label", { label: "Labelling", code: "LB", group: some("dispatch"), order: 13n }],
99
+ ["returns", { label: "Returns", code: "RN", group: some("dispatch"), order: 14n }],
100
+ ["admin", { label: "Dispatch admin", code: "DA", group: some("dispatch"), order: 15n }],
101
+ ["hazmat", { label: "Hazmat · licence", code: "HZ", group: some("dispatch"), order: 16n }],
102
+ ["general", { label: "General duties", code: "GD", group: none, order: 17n }],
103
+ ], stringOrder);
104
+ /** The staff, by key. */
31
105
  export const warehousePeople = new SortedMap([
32
106
  ["aalder", { name: "A. Alder", team: "inbound", position: "lead", skills: new SortedSet(["unload", "reach", "xdock", "rcvqa", "yard"], stringOrder), contract: 38, agency: false, trainer: false, trainee: false, usual: some("early") }],
33
107
  ["haspen", { name: "H. Aspen", team: "inbound", position: "crew", skills: new SortedSet(["unload", "putaway"], stringOrder), contract: 38, agency: false, trainer: true, trainee: false, usual: some("early") }],
@@ -863,21 +937,80 @@ const currentTargets = [
863
937
  [5, "dispatch", "night", 0, {}],
864
938
  [6, "dispatch", "night", 0, {}],
865
939
  ];
866
- function seededWeek(rows, targets, published) {
867
- return { status: published ? variant("published", { at: new Date("2028-03-04T12:00:00Z") }) : variant("draft", null),
868
- assignments: new SortedMap(rows.map(([id, day, group, shift, person, kind, position, activity, offset, overtime, agreed]) => [id, {
869
- slot: { day: BigInt(day), group, shift }, who: kind === "request" ? variant("request", "northside") : variant("person", person), position,
870
- activity: activity === null ? none : some(activity), offset, overtime, agreed: agreed === null ? none : some(agreed),
871
- }]), stringOrder),
872
- requirements: new SortedMap(targets.map(([day, group, shift, positions, hours]) => [{ day: BigInt(day), group, shift }, { positions: BigInt(positions), hours: new SortedMap(Object.entries(hours), stringOrder) }]), compareFor(Roster.Types.Slot)),
873
- dismissed: new SortedSet([], stringOrder), };
940
+ const HOUR = 3_600_000;
941
+ const DAY = 86_400_000;
942
+ /** Each team's cost centre, which every one of its seeded duties is booked to. */
943
+ const centres = { inbound: "CC-IN", picking: "CC-PK", dispatch: "CC-DS" };
944
+ /** Where a seeded duty's shift starts on its day of the week: the shift's own start, in UTC. */
945
+ function shiftStartOn(weekStart, day, shift) {
946
+ const clock = warehouseShifts.get(shift).start;
947
+ return new Date(weekStart.getTime() + day * DAY + Number(clock.hour) * HOUR + Number(clock.minute) * 60_000);
874
948
  }
875
- export const warehouseWeek = seededWeek(currentRows, currentTargets, false);
876
- export const warehousePrevious = seededWeek(previousRows, previousTargets, true);
877
- export const warehouseWeeks = new SortedMap([[new Date("2028-02-27T00:00:00Z"), warehousePrevious], [warehouseStart, warehouseWeek]], compareFor(DateTimeType));
878
- export const warehouseForecast = new SortedMap([[new Date("2028-03-12T00:00:00Z"), warehouseWeek.requirements]], compareFor(DateTimeType));
879
- export const warehouseProposals = [
880
- { key: "s317", week: warehouseStart, slot: { day: 4n, group: "inbound", shift: "night" }, person: "nochre", reason: "Off Thursday · cover the open night position" },
881
- { key: "s318", week: warehouseStart, slot: { day: 4n, group: "picking", shift: "night" }, person: "bpumice", reason: "Off Thursday · cover the open night position" },
882
- ];
949
+ /**
950
+ * A seeded row's duty, the warehouse's own: who, its own times — its shift's,
951
+ * or a later start or a later finish where the mock has one — its shift and
952
+ * team, its role and task, and the warehouse's fields.
953
+ */
954
+ function dutyOf(weekStart, [id, day, group, shift, person, kind, position, activity, later, longer, agreed]) {
955
+ const start = new Date(shiftStartOn(weekStart, day, shift).getTime() + later * HOUR);
956
+ const end = new Date(start.getTime() + (warehouseShifts.get(shift).hours + longer) * HOUR);
957
+ return [id, {
958
+ who: kind === "request" ? variant("agency", "northside") : variant("staff", person), start, end, shift, team: group, role: position,
959
+ task: activity === null ? none : some(activity), unpaidBreak: 0, agreed: agreed === null ? none : some(agreed),
960
+ costCentre: centres[group], note: "",
961
+ }];
962
+ }
963
+ /** Both weeks' duties, by key: the week before's, and this week's. */
964
+ export const warehouseDuties = new SortedMap([
965
+ ...previousRows.map((row) => dutyOf(warehousePreviousStart, row)), ...currentRows.map((row) => dutyOf(warehouseStart, row)),
966
+ ], stringOrder);
967
+ /** The rota's weeks: the week before issued, this week open. */
968
+ export const warehouseWeeks = new SortedMap([
969
+ [warehousePreviousStart, { state: variant("issued", { at: warehouseIssuedAt }), dismissed: new SortedSet([], stringOrder), approver: some("Ops") }],
970
+ [warehouseStart, { state: variant("open", null), dismissed: new SortedSet([], stringOrder), approver: none }],
971
+ ], compareFor(DateTimeType));
972
+ /** A seeded target's row: its day, its team and shift, the heads it needs and the hours each activity needs, keyed by its week, slot and day. */
973
+ function coverOf(weekStart, [day, group, shift, heads, hours]) {
974
+ const at = new Date(weekStart.getTime() + day * DAY);
975
+ return [`${at.toISOString().slice(0, 10)}-${group}-${shift}`, {
976
+ day: at, team: group, shift, heads: BigInt(heads), hours: new SortedMap(Object.entries(hours), stringOrder), basis: "forecast",
977
+ }];
978
+ }
979
+ /** The cover targets: the week before's, this week's, and the week after's — the forecast's, this week's again. */
980
+ export const warehouseCover = new SortedMap([
981
+ ...previousTargets.map((target) => coverOf(warehousePreviousStart, target)),
982
+ ...currentTargets.map((target) => coverOf(warehouseStart, target)),
983
+ ...currentTargets.map((target) => coverOf(warehouseNextStart, target)),
984
+ ], stringOrder);
985
+ /** The suggestions: two people off on Thursday, for the open night positions. */
986
+ export const warehouseSuggestions = new SortedMap([
987
+ ["s317", { person: "nochre", day: new Date("2028-03-09T00:00:00Z"), team: "inbound", shift: "night", why: "Off Thursday · cover the open night position" }],
988
+ ["s318", { person: "bpumice", day: new Date("2028-03-09T00:00:00Z"), team: "picking", shift: "night", why: "Off Thursday · cover the open night position" }],
989
+ ], stringOrder);
990
+ /**
991
+ * A seeded week as the Roster reads it from the duties and the targets: each
992
+ * duty by its key, in its slot, with its hours — its length — and its row; each
993
+ * target by its slot.
994
+ */
995
+ function rosterWeekOf(weekStart, rows, targets, status) {
996
+ return {
997
+ status,
998
+ assignments: new SortedMap(rows.map((seed) => {
999
+ const [key, duty] = dutyOf(weekStart, seed);
1000
+ const [, day, group, shift, person, kind, position, activity, , longer] = seed;
1001
+ return [key, {
1002
+ slot: { day: BigInt(day), group, shift }, who: kind === "request" ? variant("request", "northside") : variant("person", person), position,
1003
+ activity: activity === null ? none : some(activity), start: duty.start, end: duty.end,
1004
+ hours: warehouseShifts.get(shift).hours + longer, row: duty,
1005
+ }];
1006
+ }), stringOrder),
1007
+ requirements: new SortedMap(targets.map(([day, group, shift, positions, hours]) => [{ day: BigInt(day), group, shift },
1008
+ { positions: BigInt(positions), hours: new SortedMap(Object.entries(hours), stringOrder) }]), compareFor(Roster.Types.Slot)),
1009
+ dismissed: new SortedSet([], stringOrder),
1010
+ };
1011
+ }
1012
+ /** This week, as the Roster reads it: a draft. */
1013
+ export const warehouseWeek = rosterWeekOf(warehouseStart, currentRows, currentTargets, variant("draft", null));
1014
+ /** The week before, as the Roster reads it: published. */
1015
+ export const warehousePrevious = rosterWeekOf(warehousePreviousStart, previousRows, previousTargets, variant("published", { at: some(warehouseIssuedAt) }));
883
1016
  //# sourceMappingURL=warehouse.js.map