@elaraai/e3-ui 1.0.97 → 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 +232 -25
- package/dist/src/allocation/index.d.ts.map +1 -1
- package/dist/src/allocation/index.js +35 -6
- package/dist/src/allocation/index.js.map +1 -1
- package/dist/src/allocation/types.d.ts +41 -0
- package/dist/src/allocation/types.d.ts.map +1 -1
- package/dist/src/allocation/types.js +35 -0
- package/dist/src/allocation/types.js.map +1 -1
- package/dist/src/bind/data-indexed.d.ts +286 -37
- package/dist/src/bind/data-indexed.d.ts.map +1 -1
- package/dist/src/bind/data-indexed.js +259 -38
- 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 +522 -36
- package/dist/src/calendar/index.d.ts.map +1 -1
- package/dist/src/calendar/index.js +53 -13
- package/dist/src/calendar/index.js.map +1 -1
- package/dist/src/calendar/paged.d.ts +89 -0
- package/dist/src/calendar/paged.d.ts.map +1 -0
- package/dist/src/calendar/paged.js +148 -0
- package/dist/src/calendar/paged.js.map +1 -0
- 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 +105 -17
- 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.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 +13 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +20 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +18 -8
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +40 -10
- 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 +1530 -10
- package/dist/src/plan/builders.d.ts.map +1 -1
- package/dist/src/plan/builders.js +260 -122
- package/dist/src/plan/builders.js.map +1 -1
- package/dist/src/plan/event-rows.d.ts +224 -157
- package/dist/src/plan/event-rows.d.ts.map +1 -1
- package/dist/src/plan/event-rows.js +201 -56
- 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 +152 -125
- package/dist/src/plan/index.d.ts.map +1 -1
- package/dist/src/plan/index.js +138 -122
- package/dist/src/plan/index.js.map +1 -1
- package/dist/src/plan/ir.d.ts +1139 -8
- 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 +3067 -1
- package/dist/src/plan/ordered-source.d.ts.map +1 -1
- package/dist/src/plan/ordered-source.js +67 -17
- 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 +3143 -501
- package/dist/src/plan/plan.d.ts.map +1 -1
- package/dist/src/plan/plan.js +133 -34
- 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 +14 -7
- package/dist/src/plan/root.d.ts.map +1 -1
- package/dist/src/plan/root.js +82 -17
- package/dist/src/plan/root.js.map +1 -1
- package/dist/src/plan/series.d.ts +5153 -4331
- package/dist/src/plan/series.d.ts.map +1 -1
- package/dist/src/plan/series.js +1082 -266
- 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 +192 -18
- package/dist/src/plan/types.d.ts.map +1 -1
- package/dist/src/plan/types.js +77 -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 +583 -39
- package/dist/src/roster/index.d.ts.map +1 -1
- package/dist/src/roster/index.js +109 -35
- package/dist/src/roster/index.js.map +1 -1
- package/dist/src/roster/library.d.ts +12 -2
- package/dist/src/roster/library.d.ts.map +1 -1
- package/dist/src/roster/library.js +8 -0
- package/dist/src/roster/library.js.map +1 -1
- package/dist/src/roster/lists.d.ts +59 -12
- package/dist/src/roster/lists.d.ts.map +1 -1
- package/dist/src/roster/lists.js +51 -58
- package/dist/src/roster/lists.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/roster/times.d.ts +402 -0
- package/dist/src/roster/times.d.ts.map +1 -1
- package/dist/src/roster/types.d.ts +913 -1
- package/dist/src/roster/types.d.ts.map +1 -1
- package/dist/src/roster/types.js +43 -3
- package/dist/src/roster/types.js.map +1 -1
- package/dist/src/schedule/cell-checks.d.ts +85 -0
- package/dist/src/schedule/cell-checks.d.ts.map +1 -0
- package/dist/src/schedule/cell-checks.js +211 -0
- package/dist/src/schedule/cell-checks.js.map +1 -0
- package/dist/src/schedule/days.d.ts +1 -1
- package/dist/src/schedule/days.js +1 -1
- package/dist/src/schedule/events.d.ts +52 -16
- package/dist/src/schedule/events.d.ts.map +1 -1
- package/dist/src/schedule/events.js +574 -356
- package/dist/src/schedule/events.js.map +1 -1
- package/dist/src/schedule/fields.d.ts +134 -0
- package/dist/src/schedule/fields.d.ts.map +1 -0
- package/dist/src/schedule/fields.js +207 -0
- package/dist/src/schedule/fields.js.map +1 -0
- package/dist/src/schedule/library.d.ts +11 -3
- package/dist/src/schedule/library.d.ts.map +1 -1
- package/dist/src/schedule/library.js +9 -6
- package/dist/src/schedule/library.js.map +1 -1
- package/dist/src/schedule/optimise.d.ts +124 -0
- package/dist/src/schedule/optimise.d.ts.map +1 -0
- package/dist/src/schedule/optimise.js +140 -0
- package/dist/src/schedule/optimise.js.map +1 -0
- package/dist/src/schedule/pages.d.ts +76 -0
- package/dist/src/schedule/pages.d.ts.map +1 -0
- package/dist/src/schedule/pages.js +86 -0
- package/dist/src/schedule/pages.js.map +1 -0
- 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 +115 -22
- package/dist/src/schedule/record-window.d.ts.map +1 -1
- package/dist/src/schedule/record-window.js +140 -62
- package/dist/src/schedule/record-window.js.map +1 -1
- package/dist/src/schedule/resources.d.ts +9 -5
- package/dist/src/schedule/resources.d.ts.map +1 -1
- package/dist/src/schedule/resources.js +35 -15
- package/dist/src/schedule/resources.js.map +1 -1
- package/dist/src/schedule/session.d.ts +15 -1
- package/dist/src/schedule/session.d.ts.map +1 -1
- package/dist/src/schedule/session.js +30 -18
- package/dist/src/schedule/session.js.map +1 -1
- package/dist/src/schedule/types.d.ts +455 -37
- package/dist/src/schedule/types.d.ts.map +1 -1
- package/dist/src/schedule/types.js +79 -18
- package/dist/src/schedule/types.js.map +1 -1
- package/dist/src/schedule/window.d.ts +30 -9
- package/dist/src/schedule/window.d.ts.map +1 -1
- package/dist/src/schedule/window.js +101 -49
- package/dist/src/schedule/window.js.map +1 -1
- package/dist/src/schematic/index.d.ts +287 -0
- package/dist/src/schematic/index.d.ts.map +1 -0
- package/dist/src/schematic/index.js +216 -0
- package/dist/src/schematic/index.js.map +1 -0
- package/dist/src/schematic/kinds.d.ts +501 -0
- package/dist/src/schematic/kinds.d.ts.map +1 -0
- package/dist/src/schematic/kinds.js +1027 -0
- package/dist/src/schematic/kinds.js.map +1 -0
- package/dist/src/schematic/layers.d.ts +74 -0
- package/dist/src/schematic/layers.d.ts.map +1 -0
- package/dist/src/schematic/layers.js +99 -0
- package/dist/src/schematic/layers.js.map +1 -0
- package/dist/src/schematic/library.d.ts +202 -0
- package/dist/src/schematic/library.d.ts.map +1 -0
- package/dist/src/schematic/library.js +244 -0
- package/dist/src/schematic/library.js.map +1 -0
- package/dist/src/schematic/payload.d.ts +8310 -0
- package/dist/src/schematic/payload.d.ts.map +1 -0
- package/dist/src/schematic/payload.js +446 -0
- package/dist/src/schematic/payload.js.map +1 -0
- package/dist/src/schematic/schematic.d.ts +27 -0
- package/dist/src/schematic/schematic.d.ts.map +1 -0
- package/dist/src/schematic/schematic.js +17 -0
- package/dist/src/schematic/schematic.js.map +1 -0
- package/dist/src/schematic/shapes.d.ts +150 -0
- package/dist/src/schematic/shapes.d.ts.map +1 -0
- package/dist/src/schematic/shapes.js +171 -0
- package/dist/src/schematic/shapes.js.map +1 -0
- package/dist/src/schematic/templates.d.ts +96 -0
- package/dist/src/schematic/templates.d.ts.map +1 -0
- package/dist/src/schematic/templates.js +91 -0
- package/dist/src/schematic/templates.js.map +1 -0
- package/dist/src/schematic/types.d.ts +5766 -0
- package/dist/src/schematic/types.d.ts.map +1 -0
- package/dist/src/schematic/types.js +688 -0
- package/dist/src/schematic/types.js.map +1 -0
- package/dist/src/schematic/window.d.ts +213 -0
- package/dist/src/schematic/window.d.ts.map +1 -0
- package/dist/src/schematic/window.js +340 -0
- package/dist/src/schematic/window.js.map +1 -0
- 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/editing-bridge.d.ts +4 -2
- package/dist/src/sheet/editing-bridge.d.ts.map +1 -1
- package/dist/src/sheet/editing-bridge.js +8 -2
- package/dist/src/sheet/editing-bridge.js.map +1 -1
- package/dist/src/sheet/editing-types.d.ts +9 -5
- package/dist/src/sheet/editing-types.d.ts.map +1 -1
- package/dist/src/sheet/editing-types.js +9 -5
- package/dist/src/sheet/editing-types.js.map +1 -1
- package/dist/src/sheet/index.d.ts +84 -54
- package/dist/src/sheet/index.d.ts.map +1 -1
- package/dist/src/sheet/index.js +81 -53
- 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/optimise.d.ts +69 -0
- package/dist/src/sheet/optimise.d.ts.map +1 -0
- package/dist/src/sheet/optimise.js +81 -0
- package/dist/src/sheet/optimise.js.map +1 -0
- 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 +157 -133
- package/dist/src/sheet/registers.d.ts.map +1 -1
- package/dist/src/sheet/registers.js +157 -133
- package/dist/src/sheet/registers.js.map +1 -1
- package/dist/src/sheet/root.d.ts +6 -1
- package/dist/src/sheet/root.d.ts.map +1 -1
- package/dist/src/sheet/root.js +17 -5
- package/dist/src/sheet/root.js.map +1 -1
- package/dist/src/sheet/sheet.d.ts +696 -590
- package/dist/src/sheet/sheet.d.ts.map +1 -1
- package/dist/src/sheet/sheet.js +49 -15
- 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 +57 -20
- package/dist/src/sheet/types.d.ts.map +1 -1
- package/dist/src/sheet/types.js +4 -8
- package/dist/src/sheet/types.js.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/keyed-rows.d.ts +41 -0
- package/dist/src/utils/keyed-rows.d.ts.map +1 -0
- package/dist/src/utils/keyed-rows.js +64 -0
- package/dist/src/utils/keyed-rows.js.map +1 -0
- package/dist/src/utils/optimise.d.ts +79 -0
- package/dist/src/utils/optimise.d.ts.map +1 -0
- package/dist/src/utils/optimise.js +46 -0
- package/dist/src/utils/optimise.js.map +1 -0
- 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 -1610
- 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 +109 -0
- package/dist/test/allocation/optimise.examples.d.ts.map +1 -0
- package/dist/test/allocation/optimise.examples.js +223 -0
- package/dist/test/allocation/optimise.examples.js.map +1 -0
- package/dist/test/bind/data/data.examples.d.ts +1172 -514
- package/dist/test/bind/data/data.examples.d.ts.map +1 -1
- package/dist/test/bind/data/data.examples.js +284 -164
- package/dist/test/bind/data/data.examples.js.map +1 -1
- package/dist/test/bind/record/record.examples.d.ts +457 -428
- 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 +9 -0
- package/dist/test/calendar/calendar-windows.examples.d.ts.map +1 -0
- package/dist/test/calendar/calendar-windows.examples.js +111 -0
- package/dist/test/calendar/calendar-windows.examples.js.map +1 -0
- package/dist/test/calendar/calendar.examples.d.ts +1172 -915
- 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.d.ts +132 -0
- package/dist/test/calendar/optimise.examples.d.ts.map +1 -0
- package/dist/test/calendar/optimise.examples.js +75 -0
- package/dist/test/calendar/optimise.examples.js.map +1 -0
- package/dist/test/examples-package.d.ts +49 -16
- package/dist/test/examples-package.d.ts.map +1 -1
- package/dist/test/examples-package.js +138 -49
- package/dist/test/examples-package.js.map +1 -1
- package/dist/test/flowchart/flowchart.examples.d.ts +3841 -2840
- 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.d.ts +207 -0
- package/dist/test/plan/optimise.examples.d.ts.map +1 -0
- package/dist/test/plan/optimise.examples.js +98 -0
- package/dist/test/plan/optimise.examples.js.map +1 -0
- package/dist/test/plan/plan-events.examples.d.ts +4055 -3279
- 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 +391 -244
- package/dist/test/plan/plan-records.examples.d.ts.map +1 -1
- package/dist/test/plan/plan-records.examples.js +186 -65
- package/dist/test/plan/plan-records.examples.js.map +1 -1
- package/dist/test/plan/plan-windows.examples.d.ts +1978 -803
- package/dist/test/plan/plan-windows.examples.d.ts.map +1 -1
- package/dist/test/plan/plan-windows.examples.js +269 -99
- package/dist/test/plan/plan-windows.examples.js.map +1 -1
- package/dist/test/plan/plan.examples.d.ts +2238 -5726
- package/dist/test/plan/plan.examples.d.ts.map +1 -1
- package/dist/test/plan/plan.examples.js +846 -973
- 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/domain.examples.d.ts +804 -0
- package/dist/test/roster/domain.examples.d.ts.map +1 -1
- package/dist/test/roster/domain.examples.js +3 -3
- package/dist/test/roster/domain.examples.js.map +1 -1
- package/dist/test/roster/optimise.examples.d.ts +485 -0
- package/dist/test/roster/optimise.examples.d.ts.map +1 -0
- package/dist/test/roster/optimise.examples.js +155 -0
- package/dist/test/roster/optimise.examples.js.map +1 -0
- package/dist/test/roster/roster-records.examples.d.ts +364 -404
- 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 +5091 -1424
- package/dist/test/roster/roster.examples.d.ts.map +1 -1
- package/dist/test/roster/roster.examples.js +255 -109
- package/dist/test/roster/roster.examples.js.map +1 -1
- package/dist/test/roster/warehouse.d.ts +150 -7
- package/dist/test/roster/warehouse.d.ts.map +1 -1
- package/dist/test/roster/warehouse.js +36 -11
- package/dist/test/roster/warehouse.js.map +1 -1
- package/dist/test/schedule/schedule.examples.d.ts +2646 -2473
- 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 +454 -0
- package/dist/test/schematic/schematic-records.examples.d.ts.map +1 -0
- package/dist/test/schematic/schematic-records.examples.js +219 -0
- package/dist/test/schematic/schematic-records.examples.js.map +1 -0
- package/dist/test/schematic/schematic.examples.d.ts +2640 -0
- package/dist/test/schematic/schematic.examples.d.ts.map +1 -0
- package/dist/test/schematic/schematic.examples.js +559 -0
- package/dist/test/schematic/schematic.examples.js.map +1 -0
- package/dist/test/sheet/optimise.examples.d.ts +184 -0
- package/dist/test/sheet/optimise.examples.d.ts.map +1 -0
- package/dist/test/sheet/optimise.examples.js +79 -0
- package/dist/test/sheet/optimise.examples.js.map +1 -0
- package/dist/test/sheet/sheet-records.examples.d.ts +208 -356
- package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -1
- package/dist/test/sheet/sheet-records.examples.js +66 -29
- package/dist/test/sheet/sheet-records.examples.js.map +1 -1
- package/dist/test/sheet/sheet.examples.d.ts +3650 -3377
- package/dist/test/sheet/sheet.examples.d.ts.map +1 -1
- package/dist/test/sheet/sheet.examples.js +406 -296
- 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
|
@@ -43,10 +43,22 @@
|
|
|
43
43
|
* part)`, and the kind reads overlap queries through its declared interval
|
|
44
44
|
* indexes (the source's `range` naming the start field). It shares the
|
|
45
45
|
* toolbar's filters and window, counts original events once, and reads backlog
|
|
46
|
-
* through the same choices with an Unset start
|
|
46
|
+
* through the same choices with an Unset start — the Plan's with its window, as
|
|
47
|
+
* one; the Calendar's never, as it pages the backlog through the source itself
|
|
48
|
+
* (#1424), its window reading the window's rows alone. It requires `entries` for
|
|
47
49
|
* original-key inspection and Save. Existing drafts outside a new narrowing
|
|
48
50
|
* remain in the session; Save includes them. A kind narrowed so takes no
|
|
49
|
-
* `window` or `backlogWindow`.
|
|
51
|
+
* `window` or `backlogWindow`. Every kind counts its events before one is read
|
|
52
|
+
* (`count`, #1039) — through its source, the count its window's read asks
|
|
53
|
+
* first; through its day index, the days' entries the search its read asks
|
|
54
|
+
* first answers; its record read whole, in memory — and the Calendar's and the
|
|
55
|
+
* Plan's builds read its window only within `SCHEDULE_EVENT_CAP`, counted
|
|
56
|
+
* first (#1424). A day index files an event under each day it runs on, so its
|
|
57
|
+
* count is an upper bound on the events, never their number (`countExact`).
|
|
58
|
+
* A builder over resources read a window at a time reads a kind placed on them
|
|
59
|
+
* a cell at a time through the shared schedule reader, which hands each read
|
|
60
|
+
* seam — the events over a window, the backlog, one event by key — what it
|
|
61
|
+
* read of the kind's series index's cells (`cellsType`, `seriesKey`).
|
|
50
62
|
*
|
|
51
63
|
* A large record may also be read a window at a time (#1199, `window.ts`): given
|
|
52
64
|
* `window`, a paged read of a day index keyed by `Schedule.days`, the kind's
|
|
@@ -84,32 +96,31 @@ import { EventStateType, TimeStepType } from "@elaraai/east-ui";
|
|
|
84
96
|
import { EditingDraftFieldType, EditingReadinessType, Fields, FieldSpecType, TickFormatType } from "@elaraai/east-ui/internal";
|
|
85
97
|
import { RowInspectorType, rowInspector } from "../utils/row-inspector.js";
|
|
86
98
|
import { scheduleAccessor } from "./accessor.js";
|
|
99
|
+
import { checkKeyField, fieldOf, fieldSetters, keyFieldRef, keyFieldSlots, keyFieldValue } from "./fields.js";
|
|
87
100
|
import { SCHEDULE_TEMPLATES, checkedTemplates } from "./templates.js";
|
|
88
101
|
import { SCHEDULE_DEF } from "./resources.js";
|
|
89
|
-
import { scheduleRecordWindow } from "./record-window.js";
|
|
102
|
+
import { SCHEDULE_EVENT_CAP, scheduleRecordCount, scheduleRecordWindow } from "./record-window.js";
|
|
90
103
|
import { scheduleRecordSession } from "./session.js";
|
|
91
|
-
import { checkEntries, checkIndexWindow, optionOf, scheduleBacklogWindow, scheduleDayWindow, typeText } from "./window.js";
|
|
104
|
+
import { checkEntries, checkIndexWindow, optionOf, scheduleBacklogWindow, scheduleDayCount, scheduleDayWindow, typeText } from "./window.js";
|
|
92
105
|
import { PlanEventItemType, PlanEventKindType, PlanEventReadType, ScheduleAllocationEntryType, ScheduleAllocationKindType, ScheduleAllocationRolesType, ScheduleClockType, ScheduleDraftsType, ScheduleDurationType, ScheduleItemType, ScheduleKindType, ScheduleReadyEntryType, ScheduleResourceRefType, ScheduleRosterEntryType, ScheduleRosterKindType, ScheduleRosterRolesType, ScheduleStatusCasesFor, ScheduleStatusType, ScheduleWriteType, ScheduleTemplateType, ScheduleReadType, } from "./types.js";
|
|
93
106
|
/** The Roster's roles, as a kind's options name them. */
|
|
94
107
|
const ROSTER_ROLES = ["shift", "group", "position", "activity", "hours"];
|
|
95
108
|
/** The Allocation's roles, as a kind's options name them. */
|
|
96
109
|
const ALLOCATION_ROLES = ["arrival", "parts", "hold", "kind"];
|
|
97
|
-
// ============================================================================
|
|
98
|
-
// Reading East types
|
|
99
|
-
// ============================================================================
|
|
100
|
-
/** A variant's cases, when every one of them holds a String. */
|
|
101
|
-
function stringCases(type) {
|
|
102
|
-
if (type.type !== "Variant" || optionOf(type) !== undefined)
|
|
103
|
-
return undefined;
|
|
104
|
-
const cases = Object.entries(type.cases);
|
|
105
|
-
return cases.length > 0 && cases.every(([, t]) => isTypeEqual(t, StringType)) ? cases.map(([c]) => c) : undefined;
|
|
106
|
-
}
|
|
107
|
-
/** A field of a struct as an East expression, by name. */
|
|
108
|
-
function fieldOf(row, name) {
|
|
109
|
-
return row[name];
|
|
110
|
-
}
|
|
111
110
|
/** The ways a kind draws. */
|
|
112
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
|
+
}
|
|
113
124
|
export function scheduleEvents(record, input) {
|
|
114
125
|
const config = input;
|
|
115
126
|
const where = `Schedule.events: "${config.name}"`;
|
|
@@ -125,7 +136,7 @@ export function scheduleEvents(record, input) {
|
|
|
125
136
|
const read = handleType.type === "Struct" ? handleType.fields["read"] : undefined;
|
|
126
137
|
if (handleType.type !== "Struct" || read === undefined || read.type !== "Function"
|
|
127
138
|
|| handleType.fields["binding"] === undefined) {
|
|
128
|
-
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()`);
|
|
129
140
|
}
|
|
130
141
|
const recordType = read.output;
|
|
131
142
|
if (recordType.type !== "Dict" || recordType.value.type !== "Struct") {
|
|
@@ -183,38 +194,10 @@ export function scheduleEvents(record, input) {
|
|
|
183
194
|
? `${where}: \`backlog\` is a kind's rows with no time, and an instant kind's \`at\` is a plain DateTime field — it has none`
|
|
184
195
|
: `${where}: \`backlog\` is a kind's rows with no time, and its times are plain DateTime fields — make \`start\` and \`end\` Options for a backlog`);
|
|
185
196
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const inner = optionOf(type) ?? type;
|
|
191
|
-
const isOptional = optionOf(type) !== undefined;
|
|
192
|
-
const cases = stringCases(inner);
|
|
193
|
-
if (isTypeEqual(inner, StringType)) {
|
|
194
|
-
if (typeof of !== "string" || of === "") {
|
|
195
|
-
throw new Error(`${where}: \`resource.of\` names the resource slot "${field}" holds keys of — a String field holds one kind's keys`);
|
|
196
|
-
}
|
|
197
|
-
resource = { field, shape: "key", of, optional: isOptional };
|
|
198
|
-
}
|
|
199
|
-
else if (cases !== undefined) {
|
|
200
|
-
if (typeof of !== "object" || of === null) {
|
|
201
|
-
throw new Error(`${where}: "${field}" is a variant — \`resource.of\` names a resource slot per case: { ${cases.map((c) => `${c}: "…"`).join(", ")} }`);
|
|
202
|
-
}
|
|
203
|
-
const named = Object.keys(of);
|
|
204
|
-
if (named.length !== cases.length || !named.every((c) => cases.includes(c))) {
|
|
205
|
-
throw new Error(`${where}: \`resource.of\` names a resource slot for each of "${field}"'s cases (${cases.join(", ")}) — and it names ${named.join(", ") || "none"}`);
|
|
206
|
-
}
|
|
207
|
-
const kinds = Object.values(of);
|
|
208
|
-
if (new Set(kinds).size !== kinds.length) {
|
|
209
|
-
throw new Error(`${where}: \`resource.of\` names each resource slot once — a case per kind of resource — and it names ${kinds.join(", ")}`);
|
|
210
|
-
}
|
|
211
|
-
resource = { field, shape: "cases", of, cases, optional: isOptional, variant: inner };
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
throw new Error(`${where}: \`resource.field\` names a field holding a resource's key — a String, a variant of String cases, or an Option of either — and "${field}" holds ${typeText(type)}`);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
const takes = resource === undefined ? [] : resource.shape === "key" ? [resource.of] : Object.values(resource.of);
|
|
197
|
+
// The resource: a key of one kind, or a case per kind (`fields.ts`).
|
|
198
|
+
const resource = config.resource === undefined ? undefined
|
|
199
|
+
: checkKeyField(config.resource.field, fieldType("resource.field", config.resource.field), config.resource.of, { where, prop: "resource", noun: "resource" });
|
|
200
|
+
const takes = resource === undefined ? [] : keyFieldSlots(resource);
|
|
218
201
|
// The status: a variant, a Status per case.
|
|
219
202
|
let statusCases;
|
|
220
203
|
let statusTable;
|
|
@@ -348,6 +331,8 @@ export function scheduleEvents(record, input) {
|
|
|
348
331
|
// ── The East the seams share ─────────────────────────────────────────
|
|
349
332
|
const draftType = EditingDraftFieldType(rowType);
|
|
350
333
|
const EntryRowType = StructType({ id: StringType, key: keyType, row: rowType });
|
|
334
|
+
// The stored entries a reader read by a series index's cells (#1039), each its key and its row.
|
|
335
|
+
const CellsType = ArrayType(StructType({ key: keyType, row: rowType }));
|
|
351
336
|
// The entry a draft leaves: the drafted entry, none for one deleted, the held one for a draft it cannot read.
|
|
352
337
|
const drafted = East.function([BlobType, OptionType(rowType)], OptionType(rowType), (_$, bytes, held) => bytes.decodeBeast(draftType, "v2").match({
|
|
353
338
|
value: (_$2, row) => East.value(some(row), OptionType(rowType)),
|
|
@@ -394,6 +379,31 @@ export function scheduleEvents(record, input) {
|
|
|
394
379
|
: East.value(some(fieldOf(row, name)), OptionType(DateTimeType));
|
|
395
380
|
// A time as its field holds it: an Option field holds `some`.
|
|
396
381
|
const placedAt = (t) => (optional ? East.value(some(t), OptionType(DateTimeType)) : t);
|
|
382
|
+
// How many of the record's stored events overlap [from, to), its record read whole, counted in memory (#1039): by the
|
|
383
|
+
// views' rule, an optional missing end an instant at its start, as the views place it.
|
|
384
|
+
const countWhole = East.function([DateTimeType, DateTimeType], OptionType(IntegerType), ($, from, to) => {
|
|
385
|
+
const all = $.const(readAll());
|
|
386
|
+
const n = $.let(0n, IntegerType);
|
|
387
|
+
$.for(all, ($2, row) => {
|
|
388
|
+
const start = $2.const(instant(row, startField));
|
|
389
|
+
const end = $2.const(instant(row, endField).match({
|
|
390
|
+
none: () => start,
|
|
391
|
+
some: (_$3, e) => East.value(some(e), OptionType(DateTimeType)),
|
|
392
|
+
}));
|
|
393
|
+
$2.match(start, {
|
|
394
|
+
some: ($3, s) => {
|
|
395
|
+
$3.match(end, {
|
|
396
|
+
some: ($4, e) => {
|
|
397
|
+
$4.if(East.less(s, to).and(() => East.greater(e, from).or(() => East.greaterEqual(s, from))), ($5) => {
|
|
398
|
+
$5.assign(n, n.add(1n));
|
|
399
|
+
});
|
|
400
|
+
},
|
|
401
|
+
});
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
return East.value(some(n), OptionType(IntegerType));
|
|
406
|
+
});
|
|
397
407
|
// A duration in minutes — a month counts 30 days.
|
|
398
408
|
const minutesOf = East.function([ScheduleDurationType], IntegerType, (_$, step) => East.Float.roundHalf(step.match({
|
|
399
409
|
minutes: (_$2, n) => n,
|
|
@@ -406,53 +416,12 @@ export function scheduleEvents(record, input) {
|
|
|
406
416
|
: East.function([rowType, keyType], ScheduleDurationType, (_$, row, key) => config.backlog.duration(row, key));
|
|
407
417
|
const dueOf = config.backlog?.due === undefined ? undefined
|
|
408
418
|
: East.function([rowType, keyType], OptionType(DateTimeType), (_$, row, key) => config.backlog.due(row, key));
|
|
409
|
-
// The resource a row is on.
|
|
419
|
+
// The resource a row is on (`fields.ts`).
|
|
410
420
|
const RefOption = OptionType(ScheduleResourceRefType);
|
|
411
|
-
const refOf =
|
|
412
|
-
if (resource === undefined)
|
|
413
|
-
return East.value(none, RefOption);
|
|
414
|
-
const value = fieldOf(row, resource.field);
|
|
415
|
-
if (resource.shape === "key") {
|
|
416
|
-
const kind = resource.of;
|
|
417
|
-
const ref = (key) => East.value(some(East.value({ kind, key }, ScheduleResourceRefType)), RefOption);
|
|
418
|
-
return resource.optional
|
|
419
|
-
? value.match({ none: (_$2) => East.value(none, RefOption), some: (_$2, key) => ref(key) })
|
|
420
|
-
: ref(value);
|
|
421
|
-
}
|
|
422
|
-
const of = resource.of;
|
|
423
|
-
const byCase = (v) => v.match(Object.fromEntries(resource.cases.map((c) => [c, (_$2, key) => East.value(some(East.value({ kind: of[c], key }, ScheduleResourceRefType)), RefOption)])));
|
|
424
|
-
return resource.optional
|
|
425
|
-
? value.match({ none: (_$2) => East.value(none, RefOption), some: (_$2, v) => byCase(v) })
|
|
426
|
-
: byCase(value);
|
|
427
|
-
});
|
|
421
|
+
const refOf = keyFieldRef(resource, rowType);
|
|
428
422
|
// The value a resource field takes for a placement's resource; `none` where the kind refuses it: a resource of a
|
|
429
423
|
// kind it does not take, or none for a field that must hold one.
|
|
430
|
-
const resourceValue = resource === undefined ? undefined : (
|
|
431
|
-
const valueType = fields[resource.field];
|
|
432
|
-
return East.function([RefOption], OptionType(valueType), ($, ref) => {
|
|
433
|
-
const result = $.let(East.value(none, OptionType(valueType)), OptionType(valueType));
|
|
434
|
-
$.match(ref, {
|
|
435
|
-
none: ($2) => {
|
|
436
|
-
if (resource.optional)
|
|
437
|
-
$2.assign(result, East.value(some(East.value(none, valueType)), OptionType(valueType)));
|
|
438
|
-
},
|
|
439
|
-
some: ($2, r) => {
|
|
440
|
-
if (resource.shape === "key") {
|
|
441
|
-
const key = resource.optional ? East.value(some(r.key), valueType) : r.key;
|
|
442
|
-
$2.if(East.equal(r.kind, resource.of), ($3) => { $3.assign(result, East.value(some(key), OptionType(valueType))); });
|
|
443
|
-
}
|
|
444
|
-
else {
|
|
445
|
-
for (const c of resource.cases) {
|
|
446
|
-
const caseValue = East.value(variant(c, r.key), resource.variant);
|
|
447
|
-
const held = resource.optional ? East.value(some(caseValue), valueType) : caseValue;
|
|
448
|
-
$2.if(East.equal(r.kind, resource.of[c]), ($3) => { $3.assign(result, East.value(some(held), OptionType(valueType))); });
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
});
|
|
453
|
-
return result;
|
|
454
|
-
});
|
|
455
|
-
})();
|
|
424
|
+
const resourceValue = resource === undefined ? undefined : keyFieldValue(resource, fields[resource.field]);
|
|
456
425
|
// A row of the record's type, field by field: its times and resource from a placement, the rest from `source`.
|
|
457
426
|
// An instant kind's `at` is its start.
|
|
458
427
|
const rowWith = (source, start, end, resourceField) => East.value(Object.fromEntries(Object.keys(fields).map((f) => [f,
|
|
@@ -476,51 +445,46 @@ export function scheduleEvents(record, input) {
|
|
|
476
445
|
return result;
|
|
477
446
|
});
|
|
478
447
|
// A setter for every field, at any depth: an inspector edit writes one (`field`), its value as bytes at the field's type.
|
|
479
|
-
const setters =
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
chain.push({ struct, field: step, at });
|
|
488
|
-
at = fieldOf(at, step);
|
|
489
|
-
struct = struct.fields[step];
|
|
490
|
-
}
|
|
491
|
-
const leaf = struct;
|
|
492
|
-
const leafAt = at;
|
|
493
|
-
let next = East.value(Object.fromEntries(Object.keys(leaf.fields).map((f) => [f, f === name ? value : fieldOf(leafAt, f)])), leaf);
|
|
494
|
-
for (let i = chain.length - 1; i >= 0; i--) {
|
|
495
|
-
const link = chain[i];
|
|
496
|
-
const inner = next;
|
|
497
|
-
next = East.value(Object.fromEntries(Object.keys(link.struct.fields).map((f) => [f, f === link.field ? inner : fieldOf(link.at, f)])), link.struct);
|
|
498
|
-
}
|
|
499
|
-
return next;
|
|
500
|
-
});
|
|
501
|
-
const collect = (struct, prefix) => {
|
|
502
|
-
for (const [name, type] of Object.entries(struct.fields)) {
|
|
503
|
-
setters.push({ path: [...prefix, name], set: setterOf(prefix, name, type) });
|
|
504
|
-
if (type.type === "Struct")
|
|
505
|
-
collect(type, [...prefix, name]);
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
collect(rowType, []);
|
|
509
|
-
const readsOf = (slot, part) => {
|
|
448
|
+
const setters = fieldSetters(rowType);
|
|
449
|
+
/**
|
|
450
|
+
* The reads, through the kind's source of its builder's slice when it has one — given `cap` (#1039, #1424), the
|
|
451
|
+
* Calendar's and the Plan's, its window counted first, through the source, through its day index or in memory, and
|
|
452
|
+
* read only within `cap`, its backlog whole. Given `pagedBacklog` (#1424, the Calendar's), a kind with a backlog
|
|
453
|
+
* narrowed through its source reads its window's rows alone: its builder pages the backlog through the source itself.
|
|
454
|
+
*/
|
|
455
|
+
const readsOf = (once, slot, part, cap, pagedBacklog = false) => {
|
|
510
456
|
if (part === undefined) {
|
|
511
457
|
if (entries !== undefined && dayWindow === undefined) {
|
|
512
458
|
throw new Error(`${where}: \`entries\` reads one event by its key beside \`window\`, or beside the kind's source of its builder's ` +
|
|
513
459
|
`Slice.bindRecords (one named "${slot}") — give one of those with it`);
|
|
514
460
|
}
|
|
515
|
-
const unscheduled = backlogWindow === undefined ? undefined
|
|
461
|
+
const unscheduled = backlogWindow === undefined ? undefined
|
|
462
|
+
: once(scheduleBacklogWindow(backlogWindow, keyType, rowType, where));
|
|
463
|
+
// A backlog index's read takes no window: the window is given, and read past.
|
|
464
|
+
const backlog = unscheduled === undefined ? undefined : once(East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, _from, _to) => {
|
|
465
|
+
const read = $.const(unscheduled);
|
|
466
|
+
return read();
|
|
467
|
+
}));
|
|
468
|
+
// A record read whole under a cap (#1039): its window counted in memory first, and drawn only within the cap —
|
|
469
|
+
// past it the window answers none, and none of its events draws.
|
|
470
|
+
const capped = cap === undefined || dayWindow !== undefined ? undefined
|
|
471
|
+
: once(East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, from, to) => {
|
|
472
|
+
const count = $.const(countWhole);
|
|
473
|
+
const result = $.let(East.value(none, OptionType(HeldType)), OptionType(HeldType));
|
|
474
|
+
$.match(count(from, to), {
|
|
475
|
+
some: ($2, n) => {
|
|
476
|
+
$2.if(n.lessEqual(BigInt(cap)), ($3) => { $3.assign(result, East.value(some(readAll()), OptionType(HeldType))); });
|
|
477
|
+
},
|
|
478
|
+
});
|
|
479
|
+
return result;
|
|
480
|
+
}));
|
|
516
481
|
return {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
backlog
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
withDrafts: withDraftsFor(false),
|
|
482
|
+
// A day index under a cap counts the days' entries first, and past it reads no page (#1039).
|
|
483
|
+
days: dayWindow === undefined ? capped : once(scheduleDayWindow(dayWindow, keyType, rowType, where, cap)),
|
|
484
|
+
backlog,
|
|
485
|
+
alone: backlog,
|
|
486
|
+
withDrafts: once(withDraftsFor(false)),
|
|
487
|
+
pagedBacklog: false,
|
|
524
488
|
};
|
|
525
489
|
}
|
|
526
490
|
if (dayWindow !== undefined || backlogWindow !== undefined) {
|
|
@@ -530,14 +494,21 @@ export function scheduleEvents(record, input) {
|
|
|
530
494
|
throw new Error(`${where}: the builder's source "${slot}" reads only its narrowing — and one event, the inspector's ` +
|
|
531
495
|
"or its editing's, is read by its key: give `entries` beside it, Data.bindPaged(record), the record's own entries");
|
|
532
496
|
}
|
|
533
|
-
const scheduled = scheduleRecordWindow(part, slot, keyType, rowType, startField, endField, optional, false, where);
|
|
497
|
+
const scheduled = once(scheduleRecordWindow(part, slot, keyType, rowType, startField, endField, optional, false, where, cap));
|
|
534
498
|
if (!optional)
|
|
535
|
-
return { days: scheduled, backlog: undefined, withDrafts: withDraftsFor(true) };
|
|
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));
|
|
501
|
+
if (pagedBacklog) {
|
|
502
|
+
// Its builder pages its backlog through the source itself (#1424): the window is its rows alone, and a draft
|
|
503
|
+
// its host gives draws where it places its event — a backlog event scheduled into the window among them — the
|
|
504
|
+
// host having left out those of events the narrowing does not hold. Its backlog whole is `unscheduled`'s
|
|
505
|
+
// alone, which such a builder never asks.
|
|
506
|
+
return { days: scheduled, backlog: backlogged, alone: backlogged, withDrafts: once(withDraftsFor(false)), pagedBacklog: true };
|
|
507
|
+
}
|
|
536
508
|
// A kind with a backlog reads both through its source as one: what its narrowing holds over the window and in
|
|
537
509
|
// its backlog. A draft then moves an event between the two by its times alone, and a draft the narrowing does
|
|
538
510
|
// not hold never shows in either (#1343).
|
|
539
|
-
const
|
|
540
|
-
const both = East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, from, to) => {
|
|
511
|
+
const both = once(East.function([DateTimeType, DateTimeType], OptionType(HeldType), ($, from, to) => {
|
|
541
512
|
const inWindow = $.const(scheduled);
|
|
542
513
|
const inBacklog = $.const(backlogged);
|
|
543
514
|
const result = $.let(East.value(none, OptionType(HeldType)), OptionType(HeldType));
|
|
@@ -553,8 +524,8 @@ export function scheduleEvents(record, input) {
|
|
|
553
524
|
},
|
|
554
525
|
});
|
|
555
526
|
return result;
|
|
556
|
-
});
|
|
557
|
-
return { days: both, backlog: both, withDrafts: withDraftsFor(true) };
|
|
527
|
+
}));
|
|
528
|
+
return { days: both, backlog: both, alone: backlogged, withDrafts: once(withDraftsFor(true)), pagedBacklog: false };
|
|
558
529
|
};
|
|
559
530
|
/** An item seam over a window: the events whose items `itemFn` makes that overlap `[from, to)`. */
|
|
560
531
|
const windowOf = (itemType, itemFn, reads) => East.function([DateTimeType, DateTimeType, ScheduleDraftsType], OptionType(ArrayType(itemType)), ($, from, to, drafts) => {
|
|
@@ -622,6 +593,123 @@ export function scheduleEvents(record, input) {
|
|
|
622
593
|
}
|
|
623
594
|
return result;
|
|
624
595
|
});
|
|
596
|
+
// ── A kind a reader reads by a series index's cells (#1039) ──────────
|
|
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
|
|
599
|
+
// where its narrowing holds the entry, or the record does not.
|
|
600
|
+
/** The entries a reader read by cells, as the record's rows by key. */
|
|
601
|
+
const cellsHeld = East.function([BlobType], HeldType, ($, bytes) => {
|
|
602
|
+
const entries = $.const(bytes.decodeBeast(CellsType, "v2"));
|
|
603
|
+
const held = $.let(new Map(), HeldType);
|
|
604
|
+
$.for(entries, ($2, entry) => {
|
|
605
|
+
$2(held.insertOrUpdate(entry.key, entry.row, (_$3, _was, now) => now));
|
|
606
|
+
});
|
|
607
|
+
return held;
|
|
608
|
+
});
|
|
609
|
+
/** Every draft given in place over the entries a reader read by cells, as `withDraftsFor` gives them. */
|
|
610
|
+
const cellsInPlace = withDraftsFor(false);
|
|
611
|
+
/** An item seam over the entries a reader read by cells: the events whose items `itemFn` makes that overlap `[from, to)`, by the views' rule. */
|
|
612
|
+
const cellsOf = (itemType, itemFn) => East.function([BlobType, DateTimeType, DateTimeType, ScheduleDraftsType], ArrayType(itemType), ($, bytes, from, to, drafts) => {
|
|
613
|
+
const hold = $.const(cellsHeld);
|
|
614
|
+
const inPlace = $.const(cellsInPlace);
|
|
615
|
+
const item = $.const(itemFn);
|
|
616
|
+
const out = $.let([], ArrayType(itemType));
|
|
617
|
+
$.for(inPlace(hold(bytes), drafts), ($2, entry) => {
|
|
618
|
+
const one = $2.const(item(entry));
|
|
619
|
+
$2.match(one.start, {
|
|
620
|
+
some: ($3, s) => {
|
|
621
|
+
$3.match(one.end, {
|
|
622
|
+
some: ($4, e) => {
|
|
623
|
+
$4.if(East.less(s, to).and(() => East.greater(e, from).or(() => East.greaterEqual(s, from))), ($5) => {
|
|
624
|
+
$5(out.pushLast(one));
|
|
625
|
+
});
|
|
626
|
+
},
|
|
627
|
+
});
|
|
628
|
+
},
|
|
629
|
+
});
|
|
630
|
+
});
|
|
631
|
+
return out;
|
|
632
|
+
});
|
|
633
|
+
/**
|
|
634
|
+
* A backlog seam beside the entries a reader read by cells: the backlog read alone, never the window, with those
|
|
635
|
+
* entries held beside it — a draft moves an event between them by its times alone — the rows with no time, as
|
|
636
|
+
* `itemFn` makes them.
|
|
637
|
+
*/
|
|
638
|
+
const backlogBeside = (itemType, itemFn, reads) => East.function([BlobType, DateTimeType, DateTimeType, ScheduleDraftsType], OptionType(ArrayType(itemType)), ($, bytes, from, to, drafts) => {
|
|
639
|
+
const result = $.let(East.value(some([]), OptionType(ArrayType(itemType))), OptionType(ArrayType(itemType)));
|
|
640
|
+
if (optional) {
|
|
641
|
+
const hold = $.const(cellsHeld);
|
|
642
|
+
const inPlace = $.const(cellsInPlace);
|
|
643
|
+
const item = $.const(itemFn);
|
|
644
|
+
let read;
|
|
645
|
+
if (reads.alone === undefined) {
|
|
646
|
+
read = $.let(East.value(some(readAll()), OptionType(HeldType)));
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
const alone = $.const(reads.alone);
|
|
650
|
+
read = $.let(alone(from, to));
|
|
651
|
+
}
|
|
652
|
+
$.assign(result, East.value(none, OptionType(ArrayType(itemType))));
|
|
653
|
+
$.match(read, {
|
|
654
|
+
some: ($2, rows) => {
|
|
655
|
+
const all = $2.let(hold(bytes));
|
|
656
|
+
$2(all.unionInPlace(rows, (_$3, held) => held));
|
|
657
|
+
const out = $2.let([], ArrayType(itemType));
|
|
658
|
+
$2.for(inPlace(all, drafts), ($3, entry) => {
|
|
659
|
+
const one = $3.const(item(entry));
|
|
660
|
+
$3.if(one.start.hasTag("none"), ($4) => { $4(out.pushLast(one)); });
|
|
661
|
+
});
|
|
662
|
+
$2.assign(result, East.value(some(out), OptionType(ArrayType(itemType))));
|
|
663
|
+
},
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
return result;
|
|
667
|
+
});
|
|
668
|
+
/**
|
|
669
|
+
* One event by its key's text, the drafts in place, of a kind a reader reads by cells: the drafts, then its row as
|
|
670
|
+
* the reader holds it (`held`, none for one it does not), then the backlog read alone — but where its builder pages
|
|
671
|
+
* the backlog itself (#1424) — then its key; never the window.
|
|
672
|
+
*/
|
|
673
|
+
const readBeside = (makeItem, readType, reads) => East.function([StringType, ScheduleDraftsType, DateTimeType, DateTimeType, OptionType(BlobType)], OptionType(readType), ($, id, drafts, from, to, held) => {
|
|
674
|
+
const parse = $.const(keyOf);
|
|
675
|
+
const make = $.const(makeItem);
|
|
676
|
+
const key = $.const(parse(id));
|
|
677
|
+
const row = $.let(East.value(none, OptionType(rowType)), OptionType(rowType));
|
|
678
|
+
const unread = $.let(true, BooleanType);
|
|
679
|
+
$.if(drafts.has(id), ($2) => {
|
|
680
|
+
$2.match(drafts.get(id).decodeBeast(draftType, "v2"), {
|
|
681
|
+
value: ($3, entry) => {
|
|
682
|
+
$3.assign(row, East.value(some(entry), OptionType(rowType)));
|
|
683
|
+
$3.assign(unread, false);
|
|
684
|
+
},
|
|
685
|
+
missing: ($3) => { $3.assign(unread, false); },
|
|
686
|
+
});
|
|
687
|
+
});
|
|
688
|
+
$.if(unread, ($2) => {
|
|
689
|
+
$2.match(held, { some: ($3, bytes) => { $3.assign(row, East.value(some(bytes.decodeBeast(rowType, "v2")), OptionType(rowType))); } });
|
|
690
|
+
// A builder that pages the backlog itself never has it read whole (#1424): its key reads one event.
|
|
691
|
+
if (reads.alone !== undefined && !reads.pagedBacklog) {
|
|
692
|
+
const alone = $2.const(reads.alone);
|
|
693
|
+
$2.if(row.hasTag("none"), ($3) => {
|
|
694
|
+
$3.match(alone(from, to), { some: ($4, rows) => { $4.assign(row, rows.tryGet(key)); } });
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
if (byKey === undefined) {
|
|
698
|
+
const all = $2.const(readAll());
|
|
699
|
+
$2.if(row.hasTag("none"), ($3) => { $3.assign(row, all.tryGet(key)); });
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
const find = $2.const(byKey);
|
|
703
|
+
$2.if(row.hasTag("none"), ($3) => {
|
|
704
|
+
$3.match(find(id), { held: ($4, stored) => { $4.assign(row, East.value(some(stored), OptionType(rowType))); } });
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
return row.match({
|
|
709
|
+
some: (_$2, r) => East.value(some({ item: make({ id, key, row: r }), row: East.Blob.encodeBeast(r, "v2") }), OptionType(readType)),
|
|
710
|
+
none: (_$2) => East.value(none, OptionType(readType)),
|
|
711
|
+
});
|
|
712
|
+
});
|
|
625
713
|
const readEvent = (makeItem, readType, reads) => East.function([StringType, ScheduleDraftsType, DateTimeType, DateTimeType], OptionType(readType), ($, id, drafts, from, to) => {
|
|
626
714
|
const parse = $.const(keyOf);
|
|
627
715
|
const make = $.const(makeItem);
|
|
@@ -645,7 +733,8 @@ export function scheduleEvents(record, input) {
|
|
|
645
733
|
}
|
|
646
734
|
const days = $2.const(reads.days);
|
|
647
735
|
$2.match(days(from, to), { some: ($3, held) => { $3.assign(row, held.tryGet(key)); } });
|
|
648
|
-
|
|
736
|
+
// A builder that pages the backlog itself never has it read whole (#1424): its key reads one event.
|
|
737
|
+
if (reads.backlog !== undefined && !reads.pagedBacklog) {
|
|
649
738
|
const backlog = $2.const(reads.backlog);
|
|
650
739
|
$2.if(row.hasTag("none"), ($3) => {
|
|
651
740
|
$3.match(backlog(from, to), { some: ($4, held) => { $4.assign(row, held.tryGet(key)); } });
|
|
@@ -661,14 +750,116 @@ export function scheduleEvents(record, input) {
|
|
|
661
750
|
none: (_$2) => East.value(none, OptionType(readType)),
|
|
662
751
|
});
|
|
663
752
|
});
|
|
753
|
+
/**
|
|
754
|
+
* A kind's three read seams over its events as `itemFn` makes them (#1039): its events over a window, its backlog,
|
|
755
|
+
* and one event by its key — each from what a reader read by its series index's cells when it is given that, and
|
|
756
|
+
* never the window then; else over the window, as `reads` reads it.
|
|
757
|
+
*/
|
|
758
|
+
const readSeams = (itemType, itemFn, readType, reads) => {
|
|
759
|
+
const window = windowOf(itemType, itemFn, reads);
|
|
760
|
+
const cells = cellsOf(itemType, itemFn);
|
|
761
|
+
const items = East.function([DateTimeType, DateTimeType, ScheduleDraftsType, OptionType(BlobType)], OptionType(ArrayType(itemType)), ($, from, to, drafts, read) => {
|
|
762
|
+
const overWindow = $.const(window);
|
|
763
|
+
const fromCells = $.const(cells);
|
|
764
|
+
return read.match({
|
|
765
|
+
none: (_$2) => overWindow(from, to, drafts),
|
|
766
|
+
some: (_$2, bytes) => East.value(some(fromCells(bytes, from, to, drafts)), OptionType(ArrayType(itemType))),
|
|
767
|
+
});
|
|
768
|
+
});
|
|
769
|
+
const backlog = backlogOf(itemType, itemFn, reads);
|
|
770
|
+
const besideCells = backlogBeside(itemType, itemFn, reads);
|
|
771
|
+
const unscheduled = East.function([DateTimeType, DateTimeType, ScheduleDraftsType, OptionType(BlobType)], OptionType(ArrayType(itemType)), ($, from, to, drafts, read) => {
|
|
772
|
+
const overWindow = $.const(backlog);
|
|
773
|
+
const beside = $.const(besideCells);
|
|
774
|
+
return read.match({
|
|
775
|
+
none: (_$2) => overWindow(from, to, drafts),
|
|
776
|
+
some: (_$2, bytes) => beside(bytes, from, to, drafts),
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
const windowed = readEvent(itemFn, readType, reads);
|
|
780
|
+
const besideRead = readBeside(itemFn, readType, reads);
|
|
781
|
+
const event = East.function([StringType, ScheduleDraftsType, DateTimeType, DateTimeType, OptionType(OptionType(BlobType))], OptionType(readType), ($, id, drafts, from, to, held) => {
|
|
782
|
+
const overWindow = $.const(windowed);
|
|
783
|
+
const byCells = $.const(besideRead);
|
|
784
|
+
return held.match({
|
|
785
|
+
none: (_$2) => overWindow(id, drafts, from, to),
|
|
786
|
+
some: (_$2, row) => byCells(id, drafts, from, to, row),
|
|
787
|
+
});
|
|
788
|
+
});
|
|
789
|
+
return { items, unscheduled, event };
|
|
790
|
+
};
|
|
791
|
+
/**
|
|
792
|
+
* A kind's events' rows over a window and its backlog's beside them, by key, the drafts in place, read once (#1409,
|
|
793
|
+
* R24): the reads `event` finds one row in — the window's rows, then the backlog's where it is read apart from them —
|
|
794
|
+
* as the record's own Dict's bytes, so a run's request finds every event's row there rather than reading them all
|
|
795
|
+
* again an event. `none` while a read is in flight. It reads the window, never a reader's cells: a kind read by them
|
|
796
|
+
* carries no request.
|
|
797
|
+
*/
|
|
798
|
+
const rowsOver = (reads) => {
|
|
799
|
+
// A backlog read apart from the window's rows — a backlog index's, beside a day index — is read beside them; one
|
|
800
|
+
// read through the kind's source is read with them, and a record read whole holds it already.
|
|
801
|
+
const apart = reads.backlog !== undefined && !Object.is(reads.backlog, reads.days) && !reads.pagedBacklog;
|
|
802
|
+
// The entries held, the drafts in place, as the record's own Dict, by key: its bytes.
|
|
803
|
+
const heldBytes = East.function([ArrayType(EntryRowType)], BlobType, ($, entries) => {
|
|
804
|
+
const out = $.let(new Map(), HeldType);
|
|
805
|
+
$.for(entries, ($2, entry) => { $2(out.insert(entry.key, entry.row)); });
|
|
806
|
+
return East.Blob.encodeBeast(out, "v2");
|
|
807
|
+
});
|
|
808
|
+
return East.function([DateTimeType, DateTimeType, ScheduleDraftsType], OptionType(BlobType), ($, from, to, drafts) => {
|
|
809
|
+
const inPlace = $.const(reads.withDrafts);
|
|
810
|
+
const bytesOf = $.const(heldBytes);
|
|
811
|
+
const result = $.let(East.value(none, OptionType(BlobType)), OptionType(BlobType));
|
|
812
|
+
let read;
|
|
813
|
+
if (reads.days === undefined) {
|
|
814
|
+
read = $.let(East.value(some(readAll()), OptionType(HeldType)));
|
|
815
|
+
}
|
|
816
|
+
else {
|
|
817
|
+
const days = $.const(reads.days);
|
|
818
|
+
read = $.let(days(from, to));
|
|
819
|
+
}
|
|
820
|
+
$.match(read, {
|
|
821
|
+
some: ($2, rows) => {
|
|
822
|
+
if (!apart) {
|
|
823
|
+
$2.assign(result, East.value(some(bytesOf(inPlace(rows, drafts))), OptionType(BlobType)));
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
const backlog = $2.const(reads.backlog);
|
|
827
|
+
$2.match(backlog(from, to), {
|
|
828
|
+
some: ($3, more) => {
|
|
829
|
+
const all = $3.let(rows.copy());
|
|
830
|
+
$3(all.unionInPlace(more, (_$4, held) => held));
|
|
831
|
+
$3.assign(result, East.value(some(bytesOf(inPlace(all, drafts))), OptionType(BlobType)));
|
|
832
|
+
},
|
|
833
|
+
});
|
|
834
|
+
},
|
|
835
|
+
});
|
|
836
|
+
return result;
|
|
837
|
+
});
|
|
838
|
+
};
|
|
839
|
+
// The `.east` text of the value the resource field holds for a resource, or for none: what a series or a summary
|
|
840
|
+
// index of the record files the resource's events under (#1039), the key a reader's cells search for.
|
|
841
|
+
const seriesKey = East.function([RefOption], OptionType(StringType), ($, ref) => {
|
|
842
|
+
const result = $.let(none, OptionType(StringType));
|
|
843
|
+
if (resourceValue !== undefined) {
|
|
844
|
+
const resolve = $.const(resourceValue);
|
|
845
|
+
$.match(resolve(ref), { some: ($2, value) => { $2.assign(result, some(East.print(value))); } });
|
|
846
|
+
}
|
|
847
|
+
return result;
|
|
848
|
+
});
|
|
664
849
|
/**
|
|
665
850
|
* The Calendar's kind, part by part, under its slot and through its source's part, its form `form` — and the
|
|
666
|
-
* function that makes one of its events.
|
|
851
|
+
* function that makes one of its events. Given `cap`, its window — through its source, through its day index or in
|
|
852
|
+
* memory, its record read whole — is counted first and read only within it (#1039, #1424): the Calendar's and the
|
|
853
|
+
* Plan's. Every kind is counted before one of its events is read (`count`), through its source's interval index —
|
|
854
|
+
* the count its window's read asks first, so none of its own — through its day index, the days' entries the search
|
|
855
|
+
* its window's read asks first answers (an upper bound, never their number: `countExact` false), or in memory. Given
|
|
856
|
+
* `pagedBacklog` (#1424, the Calendar's), a kind with a backlog narrowed through its source reads its window's rows
|
|
857
|
+
* alone, its builder paging the backlog through the source itself.
|
|
667
858
|
*/
|
|
668
|
-
const kindParts = (slot, part, form) => {
|
|
669
|
-
const reads = readsOf(slot, part);
|
|
859
|
+
const kindParts = (once, slot, part, form, cap, pagedBacklog = false) => {
|
|
860
|
+
const reads = readsOf(once, slot, part, cap, pagedBacklog);
|
|
670
861
|
// One event, as every view draws it.
|
|
671
|
-
const itemOf = East.function([EntryRowType], ScheduleItemType, ($, entry) => {
|
|
862
|
+
const itemOf = once(East.function([EntryRowType], ScheduleItemType, ($, entry) => {
|
|
672
863
|
const row = entry.row;
|
|
673
864
|
const ref = $.const(refOf);
|
|
674
865
|
const start = $.const(instant(row, startField));
|
|
@@ -710,9 +901,14 @@ export function scheduleEvents(record, input) {
|
|
|
710
901
|
minutes,
|
|
711
902
|
due,
|
|
712
903
|
}, ScheduleItemType);
|
|
713
|
-
});
|
|
714
|
-
const
|
|
715
|
-
|
|
904
|
+
}));
|
|
905
|
+
const seams = readSeams(ScheduleItemType, itemOf, ScheduleReadType, reads);
|
|
906
|
+
// How many of its stored events overlap [from, to), counted before one is read (#1039): through its source's
|
|
907
|
+
// interval index — the count its window's read asks first, so none of its own; through its day index, the days'
|
|
908
|
+
// entries the search its window's read asks first answers — an event under each day it runs on, so an upper
|
|
909
|
+
// bound on them, never their number; or, its record read whole, in memory, by the views' rule.
|
|
910
|
+
const count = part !== undefined ? scheduleRecordCount(part, slot, keyType, rowType, startField, endField, optional, where)
|
|
911
|
+
: dayWindow !== undefined ? scheduleDayCount(dayWindow, where) : countWhole;
|
|
716
912
|
// Each template's values, by key, as the templates on the wire carry them.
|
|
717
913
|
const templateRows = boundTemplates ?? East.value(templates.map((t) => ({
|
|
718
914
|
key: t.key, name: t.name, group: t.group === undefined ? none : some(t.group),
|
|
@@ -803,20 +999,30 @@ export function scheduleEvents(record, input) {
|
|
|
803
999
|
templates: templateRows,
|
|
804
1000
|
templatesSource: templatesSource === undefined ? none : some(templatesSource),
|
|
805
1001
|
fields: East.value(form, ArrayType(FieldSpecType)),
|
|
806
|
-
items,
|
|
807
|
-
unscheduled,
|
|
1002
|
+
items: seams.items,
|
|
1003
|
+
unscheduled: seams.unscheduled,
|
|
808
1004
|
write,
|
|
809
1005
|
ready: ready === undefined ? none : some(ready),
|
|
810
1006
|
editing,
|
|
811
1007
|
entries: entriesSeam,
|
|
812
1008
|
history: session.history,
|
|
813
|
-
event:
|
|
1009
|
+
event: seams.event,
|
|
814
1010
|
// A kind with no title names none: the Calendar and Plan, whose inspectors draw it, refuse one.
|
|
815
1011
|
schedule: { title: titleField ?? "", start: startField, end: endField,
|
|
816
1012
|
resource: resource === undefined ? none : some(resource.field),
|
|
817
|
-
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] : [] },
|
|
818
1019
|
overlaps: variant(overlaps, null),
|
|
819
1020
|
inspector: inspector === undefined ? none : some(inspector),
|
|
1021
|
+
seriesKey,
|
|
1022
|
+
cellsType: toEastTypeValue(CellsType),
|
|
1023
|
+
count,
|
|
1024
|
+
// Every count but a day index's counts the events themselves.
|
|
1025
|
+
countExact: part !== undefined || dayWindow === undefined,
|
|
820
1026
|
};
|
|
821
1027
|
return { fields: fieldsOfKind, itemOf, reads };
|
|
822
1028
|
};
|
|
@@ -886,225 +1092,237 @@ export function scheduleEvents(record, input) {
|
|
|
886
1092
|
roles: [...rosterGiven, ...allocationGiven],
|
|
887
1093
|
partsOf: config.parts?.of,
|
|
888
1094
|
allocationValues,
|
|
1095
|
+
times: { start: startField, end: endField },
|
|
1096
|
+
resourceField: resource?.field,
|
|
1097
|
+
windowed: dayWindow !== undefined,
|
|
889
1098
|
build(slot, part) {
|
|
890
|
-
|
|
1099
|
+
// Its window counted first, and read only within the cap (#1424): past it, no page is read. The Calendar pages
|
|
1100
|
+
// a narrowed kind's backlog through its source itself, so its window reads the window's rows alone.
|
|
1101
|
+
return heldKind((once) => East.value(kindParts(once, slot, part, formSpecs, SCHEDULE_EVENT_CAP, true).fields, ScheduleKindType));
|
|
891
1102
|
},
|
|
892
1103
|
buildRoster(slot, part) {
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
if (optional)
|
|
898
|
-
throw new Error(`${where}: a duty has its times — \`start\` and \`end\` are DateTime fields, not Options`);
|
|
899
|
-
if (keyType.type !== "String") {
|
|
900
|
-
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)}`);
|
|
901
|
-
}
|
|
902
|
-
if (shiftField === undefined || groupField === undefined) {
|
|
903
|
-
throw new Error(`${where}: the Roster places a duty by its \`shift\` and its \`group\` — give both`);
|
|
904
|
-
}
|
|
905
|
-
if (resource === undefined || resourceValue === undefined) {
|
|
906
|
-
throw new Error(`${where}: the Roster rosters each duty to a person or an agency, its \`resource\` — give it, resource: { field, of: "people" }`);
|
|
907
|
-
}
|
|
908
|
-
oneFieldEach("Roster", [["start", startField], ["end", endField], ["resource.field", resource.field], ["shift", shiftField],
|
|
909
|
-
["group", groupField], ["position", positionField], ["activity", activityField]]);
|
|
910
|
-
const shift = shiftField;
|
|
911
|
-
const group = groupField;
|
|
912
|
-
const who = resource.field;
|
|
913
|
-
const whoOf = resourceValue;
|
|
914
|
-
const parts = kindParts(slot, part, formOver([startField, endField, who, shift, group, positionField, activityField]));
|
|
915
|
-
const Roles = ScheduleRosterRolesType;
|
|
916
|
-
// A row with the Roster's roles written from `roles`, the resource field from `value`, and every other field
|
|
917
|
-
// from `source`: the row as it was, or a new row's defaults. A kind with no `position` writes none.
|
|
918
|
-
const rosterRow = (source, roles, value) => East.value(Object.fromEntries(Object.keys(fields).map((f) => [f,
|
|
919
|
-
f === startField ? roles.start
|
|
920
|
-
: f === endField ? roles.end
|
|
921
|
-
: f === who ? value
|
|
922
|
-
: f === shift ? roles.shift
|
|
923
|
-
: f === group ? roles.group
|
|
924
|
-
: f === positionField ? roles.position.match({ some: (_$, held) => held, none: () => fieldOf(source, f) })
|
|
925
|
-
: f === activityField ? roles.activity
|
|
926
|
-
: fieldOf(source, f)])), rowType);
|
|
927
|
-
// A duty's roles, from its row and its key: its times and who, its shift and group, its position and
|
|
928
|
-
// activity, and the hours it counts.
|
|
929
|
-
const rolesOf = East.function([rowType, StringType], Roles, ($, row, key) => {
|
|
930
|
-
const ref = $.const(refOf);
|
|
931
|
-
const start = $.const(fieldOf(row, startField));
|
|
932
|
-
const end = $.const(fieldOf(row, endField));
|
|
933
|
-
let hours;
|
|
934
|
-
if (hoursOf === undefined) {
|
|
935
|
-
// Its length.
|
|
936
|
-
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`);
|
|
937
1108
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
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)}`);
|
|
941
1113
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
const
|
|
959
|
-
|
|
960
|
-
|
|
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);
|
|
961
1160
|
});
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
const create = East.function([Roles], OptionType(BlobType), ($, roles) => {
|
|
967
|
-
const row = $.const(blank);
|
|
968
|
-
const resolve = $.const(whoOf);
|
|
969
|
-
const result = $.let(East.value(none, OptionType(BlobType)), OptionType(BlobType));
|
|
970
|
-
$.match(resolve(roles.resource), {
|
|
971
|
-
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);
|
|
972
1165
|
});
|
|
973
|
-
|
|
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);
|
|
974
1196
|
});
|
|
975
|
-
return East.value({
|
|
976
|
-
kind: East.value(parts.fields, ScheduleKindType),
|
|
977
|
-
rows: storedRows(parts.reads, ScheduleRosterEntryType, rolesOf),
|
|
978
|
-
read,
|
|
979
|
-
write,
|
|
980
|
-
create,
|
|
981
|
-
roles: { position: positionField !== undefined, activity: activityField !== undefined },
|
|
982
|
-
rowType: toEastTypeValue(rowType),
|
|
983
|
-
}, ScheduleRosterKindType);
|
|
984
1197
|
},
|
|
985
1198
|
buildAllocation(slot, part) {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
["
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
: f ===
|
|
1025
|
-
: f ===
|
|
1026
|
-
: f ===
|
|
1027
|
-
: f ===
|
|
1028
|
-
: f ===
|
|
1029
|
-
:
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
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);
|
|
1053
1281
|
});
|
|
1054
|
-
return East.value({
|
|
1055
|
-
kind: East.value(parts.fields, ScheduleKindType),
|
|
1056
|
-
rows: storedRows(parts.reads, ScheduleAllocationEntryType, rolesOf),
|
|
1057
|
-
read,
|
|
1058
|
-
write,
|
|
1059
|
-
create,
|
|
1060
|
-
lanes: resource.of,
|
|
1061
|
-
parts: config.parts.of,
|
|
1062
|
-
kinded: kindField !== undefined,
|
|
1063
|
-
unit: config.quantity?.unit === undefined ? none : some(config.quantity.unit),
|
|
1064
|
-
values: toEastTypeValue(ValuesType),
|
|
1065
|
-
rowType: toEastTypeValue(rowType),
|
|
1066
|
-
}, ScheduleAllocationKindType);
|
|
1067
1282
|
},
|
|
1068
1283
|
buildPlan(slot, part) {
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1077
|
-
|
|
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));
|
|
1078
1312
|
return East.value({
|
|
1079
|
-
...
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
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);
|
|
1089
1325
|
});
|
|
1090
|
-
// One event by its id, the drafts in place: as Plan draws it, and its row as bytes. A draft holds its
|
|
1091
|
-
// event as drafted, or says it was deleted; an event never drafted — or one whose draft can't be read —
|
|
1092
|
-
// is the record's: read whole, or for a kind read a window at a time (#1199) looked for first among the
|
|
1093
|
-
// rows its windows hold over [from, to) and its backlog's, where a gesture's event is drawn, then read
|
|
1094
|
-
// by its key.
|
|
1095
|
-
const planEvent = readEvent(planItemOf, PlanEventReadType, parts.reads);
|
|
1096
|
-
const name = (field) => (field === undefined ? none : some(field));
|
|
1097
|
-
return East.value({
|
|
1098
|
-
...parts.fields,
|
|
1099
|
-
draw: variant(draw, null),
|
|
1100
|
-
instant: instantKind,
|
|
1101
|
-
overlaps: variant(overlaps, null),
|
|
1102
|
-
roles: { state: name(stateField), quantity: name(quantityField), lane: name(laneField) },
|
|
1103
|
-
planItems: windowOf(PlanEventItemType, planItemOf, parts.reads),
|
|
1104
|
-
planUnscheduled: backlogOf(PlanEventItemType, planItemOf, parts.reads),
|
|
1105
|
-
planEvent,
|
|
1106
|
-
inspector: inspector === undefined ? East.value(none, OptionType(RowInspectorType)) : East.value(some(inspector), OptionType(RowInspectorType)),
|
|
1107
|
-
}, PlanEventKindType);
|
|
1108
1326
|
},
|
|
1109
1327
|
};
|
|
1110
1328
|
}
|