@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.
- package/README.md +0 -2
- package/dist/src/allocation/adapters.d.ts +1 -1
- package/dist/src/allocation/adapters.js +1 -1
- package/dist/src/allocation/index.d.ts +46 -90
- package/dist/src/allocation/index.d.ts.map +1 -1
- package/dist/src/allocation/index.js +5 -5
- package/dist/src/allocation/index.js.map +1 -1
- package/dist/src/bind/data-indexed.d.ts +273 -51
- package/dist/src/bind/data-indexed.d.ts.map +1 -1
- package/dist/src/bind/data-indexed.js +233 -56
- package/dist/src/bind/data-indexed.js.map +1 -1
- package/dist/src/bind/data.d.ts +48 -9
- package/dist/src/bind/data.d.ts.map +1 -1
- package/dist/src/bind/data.js +48 -3
- package/dist/src/bind/data.js.map +1 -1
- package/dist/src/bind/record.d.ts +61 -24
- package/dist/src/bind/record.d.ts.map +1 -1
- package/dist/src/bind/record.js +17 -57
- package/dist/src/bind/record.js.map +1 -1
- package/dist/src/calendar/index.d.ts +55 -95
- package/dist/src/calendar/index.d.ts.map +1 -1
- package/dist/src/calendar/index.js +10 -6
- package/dist/src/calendar/index.js.map +1 -1
- package/dist/src/flowchart/index.d.ts +35 -31
- package/dist/src/flowchart/index.d.ts.map +1 -1
- package/dist/src/flowchart/index.js +35 -31
- package/dist/src/flowchart/index.js.map +1 -1
- package/dist/src/flowchart/library.d.ts +108 -84
- package/dist/src/flowchart/library.d.ts.map +1 -1
- package/dist/src/flowchart/library.js +108 -84
- package/dist/src/flowchart/library.js.map +1 -1
- package/dist/src/flowchart/payload.d.ts +39 -107
- package/dist/src/flowchart/payload.d.ts.map +1 -1
- package/dist/src/flowchart/payload.js +3 -3
- package/dist/src/flowchart/payload.js.map +1 -1
- package/dist/src/flowchart/values.d.ts +35 -31
- package/dist/src/flowchart/values.d.ts.map +1 -1
- package/dist/src/flowchart/values.js +35 -31
- package/dist/src/flowchart/values.js.map +1 -1
- package/dist/src/flowchart/window.d.ts +0 -12
- package/dist/src/flowchart/window.d.ts.map +1 -1
- package/dist/src/flowchart/window.js +3 -2
- package/dist/src/flowchart/window.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +7 -3
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +12 -3
- package/dist/src/internal.js.map +1 -1
- package/dist/src/plan/assemble.d.ts +8 -0
- package/dist/src/plan/assemble.d.ts.map +1 -1
- package/dist/src/plan/assemble.js +1 -1
- package/dist/src/plan/assemble.js.map +1 -1
- package/dist/src/plan/builders.d.ts +1518 -2
- package/dist/src/plan/builders.d.ts.map +1 -1
- package/dist/src/plan/builders.js +248 -114
- package/dist/src/plan/builders.js.map +1 -1
- package/dist/src/plan/event-rows.d.ts +9 -14
- package/dist/src/plan/event-rows.d.ts.map +1 -1
- package/dist/src/plan/event-rows.js +6 -46
- package/dist/src/plan/event-rows.js.map +1 -1
- package/dist/src/plan/factories.d.ts +72 -4
- package/dist/src/plan/factories.d.ts.map +1 -1
- package/dist/src/plan/factories.js +147 -1
- package/dist/src/plan/factories.js.map +1 -1
- package/dist/src/plan/index.d.ts +147 -125
- package/dist/src/plan/index.d.ts.map +1 -1
- package/dist/src/plan/index.js +135 -122
- package/dist/src/plan/index.js.map +1 -1
- package/dist/src/plan/ir.d.ts +1105 -44
- package/dist/src/plan/ir.d.ts.map +1 -1
- package/dist/src/plan/ir.js +5 -0
- package/dist/src/plan/ir.js.map +1 -1
- package/dist/src/plan/library.d.ts +65 -42
- package/dist/src/plan/library.d.ts.map +1 -1
- package/dist/src/plan/library.js +65 -42
- package/dist/src/plan/library.js.map +1 -1
- package/dist/src/plan/nested-checks.d.ts +146 -0
- package/dist/src/plan/nested-checks.d.ts.map +1 -0
- package/dist/src/plan/nested-checks.js +468 -0
- package/dist/src/plan/nested-checks.js.map +1 -0
- package/dist/src/plan/nested-patch.d.ts +35 -0
- package/dist/src/plan/nested-patch.d.ts.map +1 -0
- package/dist/src/plan/nested-patch.js +143 -0
- package/dist/src/plan/nested-patch.js.map +1 -0
- package/dist/src/plan/nested-read.d.ts +3250 -0
- package/dist/src/plan/nested-read.d.ts.map +1 -0
- package/dist/src/plan/nested-read.js +163 -0
- package/dist/src/plan/nested-read.js.map +1 -0
- package/dist/src/plan/nested.d.ts +280 -0
- package/dist/src/plan/nested.d.ts.map +1 -0
- package/dist/src/plan/nested.js +6 -0
- package/dist/src/plan/nested.js.map +1 -0
- package/dist/src/plan/ordered-source.d.ts +1030 -1
- package/dist/src/plan/ordered-source.d.ts.map +1 -1
- package/dist/src/plan/ordered-source.js +48 -6
- package/dist/src/plan/ordered-source.js.map +1 -1
- package/dist/src/plan/over.d.ts +111 -75
- package/dist/src/plan/over.d.ts.map +1 -1
- package/dist/src/plan/over.js +111 -75
- package/dist/src/plan/over.js.map +1 -1
- package/dist/src/plan/pick.d.ts +15 -3
- package/dist/src/plan/pick.d.ts.map +1 -1
- package/dist/src/plan/pick.js +75 -36
- package/dist/src/plan/pick.js.map +1 -1
- package/dist/src/plan/plan.d.ts +2719 -558
- package/dist/src/plan/plan.d.ts.map +1 -1
- package/dist/src/plan/plan.js +14 -2
- package/dist/src/plan/plan.js.map +1 -1
- package/dist/src/plan/reads.d.ts +421 -0
- package/dist/src/plan/reads.d.ts.map +1 -0
- package/dist/src/plan/reads.js +143 -0
- package/dist/src/plan/reads.js.map +1 -0
- package/dist/src/plan/refs.d.ts +111 -75
- package/dist/src/plan/refs.d.ts.map +1 -1
- package/dist/src/plan/refs.js +111 -75
- package/dist/src/plan/refs.js.map +1 -1
- package/dist/src/plan/root.d.ts +10 -5
- package/dist/src/plan/root.d.ts.map +1 -1
- package/dist/src/plan/root.js +76 -13
- package/dist/src/plan/root.js.map +1 -1
- package/dist/src/plan/series.d.ts +5140 -4331
- package/dist/src/plan/series.d.ts.map +1 -1
- package/dist/src/plan/series.js +1026 -264
- package/dist/src/plan/series.js.map +1 -1
- package/dist/src/plan/shade.d.ts +981 -0
- package/dist/src/plan/shade.d.ts.map +1 -0
- package/dist/src/plan/shade.js +60 -0
- package/dist/src/plan/shade.js.map +1 -0
- package/dist/src/plan/types.d.ts +178 -18
- package/dist/src/plan/types.d.ts.map +1 -1
- package/dist/src/plan/types.js +69 -19
- package/dist/src/plan/types.js.map +1 -1
- package/dist/src/query/builder.d.ts +3 -3
- package/dist/src/query/builder.d.ts.map +1 -1
- package/dist/src/query/builder.js +1 -1
- package/dist/src/query/library.d.ts +3 -3
- package/dist/src/query/library.d.ts.map +1 -1
- package/dist/src/query/library.js +1 -1
- package/dist/src/query/queries.d.ts +2 -2
- package/dist/src/query/queries.js +1 -1
- package/dist/src/query/saved.d.ts +8 -4
- package/dist/src/query/saved.d.ts.map +1 -1
- package/dist/src/query/saved.js +8 -4
- package/dist/src/query/saved.js.map +1 -1
- package/dist/src/query/types.d.ts +8 -3
- package/dist/src/query/types.d.ts.map +1 -1
- package/dist/src/query/types.js +8 -3
- package/dist/src/query/types.js.map +1 -1
- package/dist/src/roster/index.d.ts +47 -91
- package/dist/src/roster/index.d.ts.map +1 -1
- package/dist/src/roster/index.js +6 -6
- package/dist/src/roster/index.js.map +1 -1
- package/dist/src/roster/targets.d.ts +8 -4
- package/dist/src/roster/targets.d.ts.map +1 -1
- package/dist/src/roster/targets.js +9 -5
- package/dist/src/roster/targets.js.map +1 -1
- package/dist/src/schedule/cell-checks.js +3 -3
- package/dist/src/schedule/cell-checks.js.map +1 -1
- package/dist/src/schedule/days.d.ts +1 -1
- package/dist/src/schedule/days.js +1 -1
- package/dist/src/schedule/events.d.ts +10 -6
- package/dist/src/schedule/events.d.ts.map +1 -1
- package/dist/src/schedule/events.js +252 -228
- package/dist/src/schedule/events.js.map +1 -1
- package/dist/src/schedule/patch.d.ts +1 -1
- package/dist/src/schedule/patch.js +1 -1
- package/dist/src/schedule/periods.d.ts +8 -4
- package/dist/src/schedule/periods.d.ts.map +1 -1
- package/dist/src/schedule/periods.js +1 -1
- package/dist/src/schedule/periods.js.map +1 -1
- package/dist/src/schedule/record-window.d.ts +38 -58
- package/dist/src/schedule/record-window.d.ts.map +1 -1
- package/dist/src/schedule/record-window.js +15 -16
- package/dist/src/schedule/record-window.js.map +1 -1
- package/dist/src/schedule/resources.d.ts +1 -1
- package/dist/src/schedule/session.d.ts +1 -1
- package/dist/src/schedule/session.js +1 -1
- package/dist/src/schedule/types.d.ts +29 -1
- package/dist/src/schedule/types.d.ts.map +1 -1
- package/dist/src/schedule/types.js +16 -1
- package/dist/src/schedule/types.js.map +1 -1
- package/dist/src/schematic/index.d.ts +19 -9
- package/dist/src/schematic/index.d.ts.map +1 -1
- package/dist/src/schematic/index.js +19 -9
- package/dist/src/schematic/index.js.map +1 -1
- package/dist/src/schematic/kinds.d.ts +4 -4
- package/dist/src/schematic/kinds.js +9 -9
- package/dist/src/schematic/kinds.js.map +1 -1
- package/dist/src/schematic/payload.d.ts +38 -88
- package/dist/src/schematic/payload.d.ts.map +1 -1
- package/dist/src/schematic/payload.js +4 -4
- package/dist/src/schematic/payload.js.map +1 -1
- package/dist/src/schematic/window.d.ts +8 -7
- package/dist/src/schematic/window.d.ts.map +1 -1
- package/dist/src/schematic/window.js +22 -19
- package/dist/src/schematic/window.js.map +1 -1
- package/dist/src/sheet/bridge.d.ts +19 -0
- package/dist/src/sheet/bridge.d.ts.map +1 -1
- package/dist/src/sheet/bridge.js +28 -21
- package/dist/src/sheet/bridge.js.map +1 -1
- package/dist/src/sheet/index.d.ts +66 -46
- package/dist/src/sheet/index.d.ts.map +1 -1
- package/dist/src/sheet/index.js +66 -46
- package/dist/src/sheet/index.js.map +1 -1
- package/dist/src/sheet/library.d.ts +13 -8
- package/dist/src/sheet/library.d.ts.map +1 -1
- package/dist/src/sheet/library.js +13 -8
- package/dist/src/sheet/library.js.map +1 -1
- package/dist/src/sheet/record.d.ts +1 -1
- package/dist/src/sheet/record.js +2 -2
- package/dist/src/sheet/record.js.map +1 -1
- package/dist/src/sheet/registers.d.ts +152 -128
- package/dist/src/sheet/registers.d.ts.map +1 -1
- package/dist/src/sheet/registers.js +152 -128
- package/dist/src/sheet/registers.js.map +1 -1
- package/dist/src/sheet/root.d.ts +4 -1
- package/dist/src/sheet/root.d.ts.map +1 -1
- package/dist/src/sheet/root.js +15 -3
- package/dist/src/sheet/root.js.map +1 -1
- package/dist/src/sheet/sheet.d.ts +39 -113
- package/dist/src/sheet/sheet.d.ts.map +1 -1
- package/dist/src/sheet/sheet.js +7 -5
- package/dist/src/sheet/sheet.js.map +1 -1
- package/dist/src/sheet/sub-rows.d.ts +106 -76
- package/dist/src/sheet/sub-rows.d.ts.map +1 -1
- package/dist/src/sheet/sub-rows.js +106 -76
- package/dist/src/sheet/sub-rows.js.map +1 -1
- package/dist/src/sheet/types.d.ts +19 -62
- package/dist/src/sheet/types.d.ts.map +1 -1
- package/dist/src/studio/builder.d.ts +3 -153
- package/dist/src/studio/builder.d.ts.map +1 -1
- package/dist/src/studio/builder.js +1 -1
- package/dist/src/studio/canvas.d.ts +5 -4
- package/dist/src/studio/canvas.d.ts.map +1 -1
- package/dist/src/studio/canvas.js +8 -7
- package/dist/src/studio/canvas.js.map +1 -1
- package/dist/src/studio/component.d.ts +30 -20
- package/dist/src/studio/component.d.ts.map +1 -1
- package/dist/src/studio/component.js +26 -61
- package/dist/src/studio/component.js.map +1 -1
- package/dist/src/studio/index.d.ts +2 -2
- package/dist/src/studio/index.d.ts.map +1 -1
- package/dist/src/studio/index.js +1 -1
- package/dist/src/studio/index.js.map +1 -1
- package/dist/src/studio/inspector.d.ts +10 -39
- package/dist/src/studio/inspector.d.ts.map +1 -1
- package/dist/src/studio/inspector.js +11 -31
- package/dist/src/studio/inspector.js.map +1 -1
- package/dist/src/studio/library.d.ts +3 -169
- package/dist/src/studio/library.d.ts.map +1 -1
- package/dist/src/studio/library.js +1 -1
- package/dist/src/studio/page.d.ts +0 -8
- package/dist/src/studio/page.d.ts.map +1 -1
- package/dist/src/studio/pages.d.ts +17 -591
- package/dist/src/studio/pages.d.ts.map +1 -1
- package/dist/src/studio/pages.js +17 -44
- package/dist/src/studio/pages.js.map +1 -1
- package/dist/src/studio/palette.d.ts +2 -7
- package/dist/src/studio/palette.d.ts.map +1 -1
- package/dist/src/studio/palette.js +4 -5
- package/dist/src/studio/palette.js.map +1 -1
- package/dist/src/studio/publish.d.ts +8 -18
- package/dist/src/studio/publish.d.ts.map +1 -1
- package/dist/src/studio/publish.js +10 -36
- package/dist/src/studio/publish.js.map +1 -1
- package/dist/src/utils/derive.d.ts +12 -12
- package/dist/src/utils/derive.d.ts.map +1 -1
- package/dist/src/utils/derive.js +5 -2
- package/dist/src/utils/derive.js.map +1 -1
- package/dist/src/utils/ordered-source.d.ts.map +1 -1
- package/dist/src/utils/ordered-source.js +14 -5
- package/dist/src/utils/ordered-source.js.map +1 -1
- package/dist/test/allocation/allocation.examples.d.ts +1900 -1598
- package/dist/test/allocation/allocation.examples.d.ts.map +1 -1
- package/dist/test/allocation/allocation.examples.js +179 -89
- package/dist/test/allocation/allocation.examples.js.map +1 -1
- package/dist/test/allocation/optimise.examples.d.ts.map +1 -1
- package/dist/test/allocation/optimise.examples.js +7 -7
- package/dist/test/allocation/optimise.examples.js.map +1 -1
- package/dist/test/bind/data/data.examples.d.ts +1057 -903
- package/dist/test/bind/data/data.examples.d.ts.map +1 -1
- package/dist/test/bind/data/data.examples.js +260 -204
- package/dist/test/bind/data/data.examples.js.map +1 -1
- package/dist/test/bind/record/record.examples.d.ts +457 -426
- package/dist/test/bind/record/record.examples.d.ts.map +1 -1
- package/dist/test/bind/record/record.examples.js +41 -21
- package/dist/test/bind/record/record.examples.js.map +1 -1
- package/dist/test/calendar/calendar-records.examples.d.ts +162 -170
- package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -1
- package/dist/test/calendar/calendar-records.examples.js +20 -12
- package/dist/test/calendar/calendar-records.examples.js.map +1 -1
- package/dist/test/calendar/calendar-windows.examples.d.ts.map +1 -1
- package/dist/test/calendar/calendar-windows.examples.js +12 -12
- package/dist/test/calendar/calendar-windows.examples.js.map +1 -1
- package/dist/test/calendar/calendar.examples.d.ts +1172 -901
- package/dist/test/calendar/calendar.examples.d.ts.map +1 -1
- package/dist/test/calendar/calendar.examples.js +211 -124
- package/dist/test/calendar/calendar.examples.js.map +1 -1
- package/dist/test/calendar/optimise.examples.js +2 -2
- package/dist/test/calendar/optimise.examples.js.map +1 -1
- package/dist/test/examples-package.d.ts +6 -9
- package/dist/test/examples-package.d.ts.map +1 -1
- package/dist/test/examples-package.js +11 -32
- package/dist/test/examples-package.js.map +1 -1
- package/dist/test/flowchart/flowchart.examples.d.ts +3841 -2820
- package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -1
- package/dist/test/flowchart/flowchart.examples.js +211 -121
- package/dist/test/flowchart/flowchart.examples.js.map +1 -1
- package/dist/test/plan/optimise.examples.js +2 -2
- package/dist/test/plan/optimise.examples.js.map +1 -1
- package/dist/test/plan/plan-events.examples.d.ts +4055 -3263
- package/dist/test/plan/plan-events.examples.d.ts.map +1 -1
- package/dist/test/plan/plan-events.examples.js +492 -319
- package/dist/test/plan/plan-events.examples.js.map +1 -1
- package/dist/test/plan/plan-nested.examples.d.ts +1829 -0
- package/dist/test/plan/plan-nested.examples.d.ts.map +1 -0
- package/dist/test/plan/plan-nested.examples.js +321 -0
- package/dist/test/plan/plan-nested.examples.js.map +1 -0
- package/dist/test/plan/plan-records.examples.d.ts +328 -362
- package/dist/test/plan/plan-records.examples.d.ts.map +1 -1
- package/dist/test/plan/plan-records.examples.js +81 -57
- package/dist/test/plan/plan-records.examples.js.map +1 -1
- package/dist/test/plan/plan-windows.examples.d.ts +1756 -1398
- package/dist/test/plan/plan-windows.examples.d.ts.map +1 -1
- package/dist/test/plan/plan-windows.examples.js +161 -128
- package/dist/test/plan/plan-windows.examples.js.map +1 -1
- package/dist/test/plan/plan.examples.d.ts +2238 -5712
- package/dist/test/plan/plan.examples.d.ts.map +1 -1
- package/dist/test/plan/plan.examples.js +839 -968
- package/dist/test/plan/plan.examples.js.map +1 -1
- package/dist/test/query/query.examples.d.ts +5221 -3005
- package/dist/test/query/query.examples.d.ts.map +1 -1
- package/dist/test/query/query.examples.js +169 -118
- package/dist/test/query/query.examples.js.map +1 -1
- package/dist/test/roster/optimise.examples.d.ts.map +1 -1
- package/dist/test/roster/optimise.examples.js +7 -7
- package/dist/test/roster/optimise.examples.js.map +1 -1
- package/dist/test/roster/roster-records.examples.d.ts +364 -392
- package/dist/test/roster/roster-records.examples.d.ts.map +1 -1
- package/dist/test/roster/roster-records.examples.js +40 -26
- package/dist/test/roster/roster-records.examples.js.map +1 -1
- package/dist/test/roster/roster.examples.d.ts +4605 -4308
- package/dist/test/roster/roster.examples.d.ts.map +1 -1
- package/dist/test/roster/roster.examples.js +212 -113
- package/dist/test/roster/roster.examples.js.map +1 -1
- package/dist/test/schedule/schedule.examples.d.ts +2646 -2471
- package/dist/test/schedule/schedule.examples.d.ts.map +1 -1
- package/dist/test/schedule/schedule.examples.js +144 -88
- package/dist/test/schedule/schedule.examples.js.map +1 -1
- package/dist/test/schematic/schematic-records.examples.d.ts +286 -276
- package/dist/test/schematic/schematic-records.examples.d.ts.map +1 -1
- package/dist/test/schematic/schematic-records.examples.js +52 -38
- package/dist/test/schematic/schematic-records.examples.js.map +1 -1
- package/dist/test/schematic/schematic.examples.d.ts +1842 -1491
- package/dist/test/schematic/schematic.examples.d.ts.map +1 -1
- package/dist/test/schematic/schematic.examples.js +240 -134
- package/dist/test/schematic/schematic.examples.js.map +1 -1
- package/dist/test/sheet/optimise.examples.d.ts +102 -95
- package/dist/test/sheet/optimise.examples.d.ts.map +1 -1
- package/dist/test/sheet/optimise.examples.js +7 -3
- package/dist/test/sheet/optimise.examples.js.map +1 -1
- package/dist/test/sheet/sheet-records.examples.d.ts +175 -214
- package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -1
- package/dist/test/sheet/sheet-records.examples.js +29 -17
- package/dist/test/sheet/sheet-records.examples.js.map +1 -1
- package/dist/test/sheet/sheet.examples.d.ts +3642 -3353
- package/dist/test/sheet/sheet.examples.d.ts.map +1 -1
- package/dist/test/sheet/sheet.examples.js +389 -282
- package/dist/test/sheet/sheet.examples.js.map +1 -1
- package/dist/test/studio/component.examples.js +2 -2
- package/dist/test/studio/component.examples.js.map +1 -1
- package/dist/test/studio/page.examples.js +6 -6
- package/dist/test/studio/page.examples.js.map +1 -1
- package/dist/test/studio/studio.examples.d.ts +2329 -873
- package/dist/test/studio/studio.examples.d.ts.map +1 -1
- package/dist/test/studio/studio.examples.js +155 -107
- package/dist/test/studio/studio.examples.js.map +1 -1
- 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,
|
|
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
|
|
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
|
|
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
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
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
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
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
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
|
|
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
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
["
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
: f ===
|
|
1218
|
-
: f ===
|
|
1219
|
-
: f ===
|
|
1220
|
-
: f ===
|
|
1221
|
-
: f ===
|
|
1222
|
-
:
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
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
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
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
|
-
...
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
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
|
}
|