@elaraai/e3-ui 1.0.97 → 1.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/dist/src/allocation/index.d.ts +258 -7
  2. package/dist/src/allocation/index.d.ts.map +1 -1
  3. package/dist/src/allocation/index.js +30 -1
  4. package/dist/src/allocation/index.js.map +1 -1
  5. package/dist/src/allocation/types.d.ts +41 -0
  6. package/dist/src/allocation/types.d.ts.map +1 -1
  7. package/dist/src/allocation/types.js +35 -0
  8. package/dist/src/allocation/types.js.map +1 -1
  9. package/dist/src/bind/data-indexed.d.ts +31 -4
  10. package/dist/src/bind/data-indexed.d.ts.map +1 -1
  11. package/dist/src/bind/data-indexed.js +54 -10
  12. package/dist/src/bind/data-indexed.js.map +1 -1
  13. package/dist/src/calendar/index.d.ts +540 -14
  14. package/dist/src/calendar/index.d.ts.map +1 -1
  15. package/dist/src/calendar/index.js +43 -7
  16. package/dist/src/calendar/index.js.map +1 -1
  17. package/dist/src/calendar/paged.d.ts +89 -0
  18. package/dist/src/calendar/paged.d.ts.map +1 -0
  19. package/dist/src/calendar/paged.js +148 -0
  20. package/dist/src/calendar/paged.js.map +1 -0
  21. package/dist/src/flowchart/payload.d.ts +156 -0
  22. package/dist/src/flowchart/payload.d.ts.map +1 -1
  23. package/dist/src/flowchart/window.d.ts +12 -0
  24. package/dist/src/flowchart/window.d.ts.map +1 -1
  25. package/dist/src/index.d.ts +11 -2
  26. package/dist/src/index.d.ts.map +1 -1
  27. package/dist/src/index.js +19 -0
  28. package/dist/src/index.js.map +1 -1
  29. package/dist/src/internal.d.ts +11 -5
  30. package/dist/src/internal.d.ts.map +1 -1
  31. package/dist/src/internal.js +28 -7
  32. package/dist/src/internal.js.map +1 -1
  33. package/dist/src/plan/builders.d.ts +12 -8
  34. package/dist/src/plan/builders.d.ts.map +1 -1
  35. package/dist/src/plan/builders.js +12 -8
  36. package/dist/src/plan/builders.js.map +1 -1
  37. package/dist/src/plan/event-rows.d.ts +228 -156
  38. package/dist/src/plan/event-rows.d.ts.map +1 -1
  39. package/dist/src/plan/event-rows.js +239 -54
  40. package/dist/src/plan/event-rows.js.map +1 -1
  41. package/dist/src/plan/index.d.ts +5 -0
  42. package/dist/src/plan/index.d.ts.map +1 -1
  43. package/dist/src/plan/index.js +3 -0
  44. package/dist/src/plan/index.js.map +1 -1
  45. package/dist/src/plan/ir.d.ts +70 -0
  46. package/dist/src/plan/ir.d.ts.map +1 -1
  47. package/dist/src/plan/ordered-source.d.ts +2038 -1
  48. package/dist/src/plan/ordered-source.d.ts.map +1 -1
  49. package/dist/src/plan/ordered-source.js +19 -11
  50. package/dist/src/plan/ordered-source.js.map +1 -1
  51. package/dist/src/plan/plan.d.ts +513 -32
  52. package/dist/src/plan/plan.d.ts.map +1 -1
  53. package/dist/src/plan/plan.js +119 -32
  54. package/dist/src/plan/plan.js.map +1 -1
  55. package/dist/src/plan/root.d.ts +4 -2
  56. package/dist/src/plan/root.d.ts.map +1 -1
  57. package/dist/src/plan/root.js +6 -4
  58. package/dist/src/plan/root.js.map +1 -1
  59. package/dist/src/plan/series.d.ts +13 -0
  60. package/dist/src/plan/series.d.ts.map +1 -1
  61. package/dist/src/plan/series.js +61 -7
  62. package/dist/src/plan/series.js.map +1 -1
  63. package/dist/src/plan/types.d.ts +14 -0
  64. package/dist/src/plan/types.d.ts.map +1 -1
  65. package/dist/src/plan/types.js +8 -0
  66. package/dist/src/plan/types.js.map +1 -1
  67. package/dist/src/roster/index.d.ts +608 -20
  68. package/dist/src/roster/index.d.ts.map +1 -1
  69. package/dist/src/roster/index.js +103 -29
  70. package/dist/src/roster/index.js.map +1 -1
  71. package/dist/src/roster/library.d.ts +12 -2
  72. package/dist/src/roster/library.d.ts.map +1 -1
  73. package/dist/src/roster/library.js +8 -0
  74. package/dist/src/roster/library.js.map +1 -1
  75. package/dist/src/roster/lists.d.ts +59 -12
  76. package/dist/src/roster/lists.d.ts.map +1 -1
  77. package/dist/src/roster/lists.js +51 -58
  78. package/dist/src/roster/lists.js.map +1 -1
  79. package/dist/src/roster/times.d.ts +402 -0
  80. package/dist/src/roster/times.d.ts.map +1 -1
  81. package/dist/src/roster/types.d.ts +913 -1
  82. package/dist/src/roster/types.d.ts.map +1 -1
  83. package/dist/src/roster/types.js +43 -3
  84. package/dist/src/roster/types.js.map +1 -1
  85. package/dist/src/schedule/cell-checks.d.ts +85 -0
  86. package/dist/src/schedule/cell-checks.d.ts.map +1 -0
  87. package/dist/src/schedule/cell-checks.js +211 -0
  88. package/dist/src/schedule/cell-checks.js.map +1 -0
  89. package/dist/src/schedule/events.d.ts +42 -10
  90. package/dist/src/schedule/events.d.ts.map +1 -1
  91. package/dist/src/schedule/events.js +349 -155
  92. package/dist/src/schedule/events.js.map +1 -1
  93. package/dist/src/schedule/fields.d.ts +134 -0
  94. package/dist/src/schedule/fields.d.ts.map +1 -0
  95. package/dist/src/schedule/fields.js +207 -0
  96. package/dist/src/schedule/fields.js.map +1 -0
  97. package/dist/src/schedule/library.d.ts +11 -3
  98. package/dist/src/schedule/library.d.ts.map +1 -1
  99. package/dist/src/schedule/library.js +9 -6
  100. package/dist/src/schedule/library.js.map +1 -1
  101. package/dist/src/schedule/optimise.d.ts +124 -0
  102. package/dist/src/schedule/optimise.d.ts.map +1 -0
  103. package/dist/src/schedule/optimise.js +140 -0
  104. package/dist/src/schedule/optimise.js.map +1 -0
  105. package/dist/src/schedule/pages.d.ts +76 -0
  106. package/dist/src/schedule/pages.d.ts.map +1 -0
  107. package/dist/src/schedule/pages.js +86 -0
  108. package/dist/src/schedule/pages.js.map +1 -0
  109. package/dist/src/schedule/record-window.d.ts +119 -6
  110. package/dist/src/schedule/record-window.d.ts.map +1 -1
  111. package/dist/src/schedule/record-window.js +139 -60
  112. package/dist/src/schedule/record-window.js.map +1 -1
  113. package/dist/src/schedule/resources.d.ts +8 -4
  114. package/dist/src/schedule/resources.d.ts.map +1 -1
  115. package/dist/src/schedule/resources.js +35 -15
  116. package/dist/src/schedule/resources.js.map +1 -1
  117. package/dist/src/schedule/session.d.ts +14 -0
  118. package/dist/src/schedule/session.d.ts.map +1 -1
  119. package/dist/src/schedule/session.js +29 -17
  120. package/dist/src/schedule/session.js.map +1 -1
  121. package/dist/src/schedule/types.d.ts +426 -36
  122. package/dist/src/schedule/types.d.ts.map +1 -1
  123. package/dist/src/schedule/types.js +63 -17
  124. package/dist/src/schedule/types.js.map +1 -1
  125. package/dist/src/schedule/window.d.ts +30 -9
  126. package/dist/src/schedule/window.d.ts.map +1 -1
  127. package/dist/src/schedule/window.js +101 -49
  128. package/dist/src/schedule/window.js.map +1 -1
  129. package/dist/src/schematic/index.d.ts +277 -0
  130. package/dist/src/schematic/index.d.ts.map +1 -0
  131. package/dist/src/schematic/index.js +206 -0
  132. package/dist/src/schematic/index.js.map +1 -0
  133. package/dist/src/schematic/kinds.d.ts +501 -0
  134. package/dist/src/schematic/kinds.d.ts.map +1 -0
  135. package/dist/src/schematic/kinds.js +1027 -0
  136. package/dist/src/schematic/kinds.js.map +1 -0
  137. package/dist/src/schematic/layers.d.ts +74 -0
  138. package/dist/src/schematic/layers.d.ts.map +1 -0
  139. package/dist/src/schematic/layers.js +99 -0
  140. package/dist/src/schematic/layers.js.map +1 -0
  141. package/dist/src/schematic/library.d.ts +202 -0
  142. package/dist/src/schematic/library.d.ts.map +1 -0
  143. package/dist/src/schematic/library.js +244 -0
  144. package/dist/src/schematic/library.js.map +1 -0
  145. package/dist/src/schematic/payload.d.ts +8360 -0
  146. package/dist/src/schematic/payload.d.ts.map +1 -0
  147. package/dist/src/schematic/payload.js +446 -0
  148. package/dist/src/schematic/payload.js.map +1 -0
  149. package/dist/src/schematic/schematic.d.ts +27 -0
  150. package/dist/src/schematic/schematic.d.ts.map +1 -0
  151. package/dist/src/schematic/schematic.js +17 -0
  152. package/dist/src/schematic/schematic.js.map +1 -0
  153. package/dist/src/schematic/shapes.d.ts +150 -0
  154. package/dist/src/schematic/shapes.d.ts.map +1 -0
  155. package/dist/src/schematic/shapes.js +171 -0
  156. package/dist/src/schematic/shapes.js.map +1 -0
  157. package/dist/src/schematic/templates.d.ts +96 -0
  158. package/dist/src/schematic/templates.d.ts.map +1 -0
  159. package/dist/src/schematic/templates.js +91 -0
  160. package/dist/src/schematic/templates.js.map +1 -0
  161. package/dist/src/schematic/types.d.ts +5766 -0
  162. package/dist/src/schematic/types.d.ts.map +1 -0
  163. package/dist/src/schematic/types.js +688 -0
  164. package/dist/src/schematic/types.js.map +1 -0
  165. package/dist/src/schematic/window.d.ts +212 -0
  166. package/dist/src/schematic/window.d.ts.map +1 -0
  167. package/dist/src/schematic/window.js +337 -0
  168. package/dist/src/schematic/window.js.map +1 -0
  169. package/dist/src/sheet/editing-bridge.d.ts +4 -2
  170. package/dist/src/sheet/editing-bridge.d.ts.map +1 -1
  171. package/dist/src/sheet/editing-bridge.js +8 -2
  172. package/dist/src/sheet/editing-bridge.js.map +1 -1
  173. package/dist/src/sheet/editing-types.d.ts +9 -5
  174. package/dist/src/sheet/editing-types.d.ts.map +1 -1
  175. package/dist/src/sheet/editing-types.js +9 -5
  176. package/dist/src/sheet/editing-types.js.map +1 -1
  177. package/dist/src/sheet/index.d.ts +18 -8
  178. package/dist/src/sheet/index.d.ts.map +1 -1
  179. package/dist/src/sheet/index.js +15 -7
  180. package/dist/src/sheet/index.js.map +1 -1
  181. package/dist/src/sheet/optimise.d.ts +69 -0
  182. package/dist/src/sheet/optimise.d.ts.map +1 -0
  183. package/dist/src/sheet/optimise.js +81 -0
  184. package/dist/src/sheet/optimise.js.map +1 -0
  185. package/dist/src/sheet/registers.d.ts +5 -5
  186. package/dist/src/sheet/registers.js +5 -5
  187. package/dist/src/sheet/root.d.ts +2 -0
  188. package/dist/src/sheet/root.d.ts.map +1 -1
  189. package/dist/src/sheet/root.js +2 -2
  190. package/dist/src/sheet/root.js.map +1 -1
  191. package/dist/src/sheet/sheet.d.ts +753 -573
  192. package/dist/src/sheet/sheet.d.ts.map +1 -1
  193. package/dist/src/sheet/sheet.js +45 -13
  194. package/dist/src/sheet/sheet.js.map +1 -1
  195. package/dist/src/sheet/types.d.ts +92 -12
  196. package/dist/src/sheet/types.d.ts.map +1 -1
  197. package/dist/src/sheet/types.js +4 -8
  198. package/dist/src/sheet/types.js.map +1 -1
  199. package/dist/src/utils/keyed-rows.d.ts +41 -0
  200. package/dist/src/utils/keyed-rows.d.ts.map +1 -0
  201. package/dist/src/utils/keyed-rows.js +64 -0
  202. package/dist/src/utils/keyed-rows.js.map +1 -0
  203. package/dist/src/utils/optimise.d.ts +79 -0
  204. package/dist/src/utils/optimise.d.ts.map +1 -0
  205. package/dist/src/utils/optimise.js +46 -0
  206. package/dist/src/utils/optimise.js.map +1 -0
  207. package/dist/test/allocation/allocation.examples.d.ts +6 -18
  208. package/dist/test/allocation/allocation.examples.d.ts.map +1 -1
  209. package/dist/test/allocation/allocation.examples.js +3 -3
  210. package/dist/test/allocation/allocation.examples.js.map +1 -1
  211. package/dist/test/allocation/optimise.examples.d.ts +109 -0
  212. package/dist/test/allocation/optimise.examples.d.ts.map +1 -0
  213. package/dist/test/allocation/optimise.examples.js +223 -0
  214. package/dist/test/allocation/optimise.examples.js.map +1 -0
  215. package/dist/test/bind/data/data.examples.d.ts +540 -36
  216. package/dist/test/bind/data/data.examples.d.ts.map +1 -1
  217. package/dist/test/bind/data/data.examples.js +66 -2
  218. package/dist/test/bind/data/data.examples.js.map +1 -1
  219. package/dist/test/bind/record/record.examples.d.ts +1 -3
  220. package/dist/test/bind/record/record.examples.d.ts.map +1 -1
  221. package/dist/test/calendar/calendar-records.examples.d.ts.map +1 -1
  222. package/dist/test/calendar/calendar-records.examples.js +3 -3
  223. package/dist/test/calendar/calendar-records.examples.js.map +1 -1
  224. package/dist/test/calendar/calendar-windows.examples.d.ts +9 -0
  225. package/dist/test/calendar/calendar-windows.examples.d.ts.map +1 -0
  226. package/dist/test/calendar/calendar-windows.examples.js +111 -0
  227. package/dist/test/calendar/calendar-windows.examples.js.map +1 -0
  228. package/dist/test/calendar/calendar.examples.d.ts +7 -21
  229. package/dist/test/calendar/calendar.examples.d.ts.map +1 -1
  230. package/dist/test/calendar/calendar.examples.js +7 -7
  231. package/dist/test/calendar/calendar.examples.js.map +1 -1
  232. package/dist/test/calendar/optimise.examples.d.ts +132 -0
  233. package/dist/test/calendar/optimise.examples.d.ts.map +1 -0
  234. package/dist/test/calendar/optimise.examples.js +75 -0
  235. package/dist/test/calendar/optimise.examples.js.map +1 -0
  236. package/dist/test/examples-package.d.ts +46 -10
  237. package/dist/test/examples-package.d.ts.map +1 -1
  238. package/dist/test/examples-package.js +142 -32
  239. package/dist/test/examples-package.js.map +1 -1
  240. package/dist/test/flowchart/flowchart.examples.d.ts +10 -30
  241. package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -1
  242. package/dist/test/plan/optimise.examples.d.ts +207 -0
  243. package/dist/test/plan/optimise.examples.d.ts.map +1 -0
  244. package/dist/test/plan/optimise.examples.js +98 -0
  245. package/dist/test/plan/optimise.examples.js.map +1 -0
  246. package/dist/test/plan/plan-events.examples.d.ts +8 -24
  247. package/dist/test/plan/plan-events.examples.d.ts.map +1 -1
  248. package/dist/test/plan/plan-events.examples.js +3 -3
  249. package/dist/test/plan/plan-events.examples.js.map +1 -1
  250. package/dist/test/plan/plan-records.examples.d.ts +200 -19
  251. package/dist/test/plan/plan-records.examples.d.ts.map +1 -1
  252. package/dist/test/plan/plan-records.examples.js +125 -28
  253. package/dist/test/plan/plan-records.examples.js.map +1 -1
  254. package/dist/test/plan/plan-windows.examples.d.ts +853 -36
  255. package/dist/test/plan/plan-windows.examples.d.ts.map +1 -1
  256. package/dist/test/plan/plan-windows.examples.js +166 -29
  257. package/dist/test/plan/plan-windows.examples.js.map +1 -1
  258. package/dist/test/plan/plan.examples.d.ts +7 -21
  259. package/dist/test/plan/plan.examples.d.ts.map +1 -1
  260. package/dist/test/plan/plan.examples.js +11 -9
  261. package/dist/test/plan/plan.examples.js.map +1 -1
  262. package/dist/test/roster/domain.examples.d.ts +804 -0
  263. package/dist/test/roster/domain.examples.d.ts.map +1 -1
  264. package/dist/test/roster/domain.examples.js +3 -3
  265. package/dist/test/roster/domain.examples.js.map +1 -1
  266. package/dist/test/roster/optimise.examples.d.ts +485 -0
  267. package/dist/test/roster/optimise.examples.d.ts.map +1 -0
  268. package/dist/test/roster/optimise.examples.js +155 -0
  269. package/dist/test/roster/optimise.examples.js.map +1 -0
  270. package/dist/test/roster/roster-records.examples.d.ts +6 -18
  271. package/dist/test/roster/roster-records.examples.d.ts.map +1 -1
  272. package/dist/test/roster/roster-records.examples.js +1 -1
  273. package/dist/test/roster/roster-records.examples.js.map +1 -1
  274. package/dist/test/roster/roster.examples.d.ts +3391 -21
  275. package/dist/test/roster/roster.examples.d.ts.map +1 -1
  276. package/dist/test/roster/roster.examples.js +54 -7
  277. package/dist/test/roster/roster.examples.js.map +1 -1
  278. package/dist/test/roster/warehouse.d.ts +150 -7
  279. package/dist/test/roster/warehouse.d.ts.map +1 -1
  280. package/dist/test/roster/warehouse.js +36 -11
  281. package/dist/test/roster/warehouse.js.map +1 -1
  282. package/dist/test/schedule/schedule.examples.d.ts +1 -3
  283. package/dist/test/schedule/schedule.examples.d.ts.map +1 -1
  284. package/dist/test/schematic/schematic-records.examples.d.ts +444 -0
  285. package/dist/test/schematic/schematic-records.examples.d.ts.map +1 -0
  286. package/dist/test/schematic/schematic-records.examples.js +205 -0
  287. package/dist/test/schematic/schematic-records.examples.js.map +1 -0
  288. package/dist/test/schematic/schematic.examples.d.ts +2289 -0
  289. package/dist/test/schematic/schematic.examples.d.ts.map +1 -0
  290. package/dist/test/schematic/schematic.examples.js +453 -0
  291. package/dist/test/schematic/schematic.examples.js.map +1 -0
  292. package/dist/test/sheet/optimise.examples.d.ts +177 -0
  293. package/dist/test/sheet/optimise.examples.d.ts.map +1 -0
  294. package/dist/test/sheet/optimise.examples.js +75 -0
  295. package/dist/test/sheet/optimise.examples.js.map +1 -0
  296. package/dist/test/sheet/sheet-records.examples.d.ts +95 -204
  297. package/dist/test/sheet/sheet-records.examples.d.ts.map +1 -1
  298. package/dist/test/sheet/sheet-records.examples.js +42 -17
  299. package/dist/test/sheet/sheet-records.examples.js.map +1 -1
  300. package/dist/test/sheet/sheet.examples.d.ts +17 -33
  301. package/dist/test/sheet/sheet.examples.d.ts.map +1 -1
  302. package/dist/test/sheet/sheet.examples.js +18 -15
  303. package/dist/test/sheet/sheet.examples.js.map +1 -1
  304. package/package.json +11 -11
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Where a paged resource kind's windows come from (#1199, #1344, #1424): the
7
+ * kind's own paged read, its resources in their key order; or, its builder's
8
+ * slice naming a source after its slot, that source's narrowed rows
9
+ * themselves, the narrowing's resources in the source's index's order — never
10
+ * a window of every resource filtered by the keys the source shows. The Plan's
11
+ * paged rows (`plan/event-rows.ts`) and the Calendar's (`calendar/paged.ts`)
12
+ * page through them alike.
13
+ *
14
+ * @packageDocumentation
15
+ */
16
+ import { ArrayType, StringType, type BlockBuilder, type DictType, type EastType, type ExprType, type FunctionType, type IntegerType, type NullType, type OptionType, type StructType } from "@elaraai/east";
17
+ import type { SeekQueryType, SeekRangeType } from "@elaraai/east-ui";
18
+ import type { ScheduleResourceKind } from "./resources.js";
19
+ /** A block's scope — the `$` of an East function body, its result type erased. */
20
+ export type ScheduleBlock = BlockBuilder<EastType>;
21
+ /** A paged source's handle, as a builder's paged rows read it: its identity, size, key search, snapshot and — a rail's narrowed source's — narrowing. */
22
+ export type SchedulePagedHandle = ExprType<StructType<{
23
+ id: StringType;
24
+ total: FunctionType<[], OptionType<IntegerType>>;
25
+ seek: OptionType<FunctionType<[typeof SeekQueryType], OptionType<typeof SeekRangeType>>>;
26
+ revision: FunctionType<[], OptionType<StringType>>;
27
+ refresh: FunctionType<[OptionType<StringType>], NullType>;
28
+ query: FunctionType<[], StringType>;
29
+ }>>;
30
+ /** A whole window's read of a paged kind's resources: `(offset, limit)` → the window, `none` while a piece is in flight. */
31
+ export type ScheduleWindowRead = ExprType<FunctionType<[IntegerType, IntegerType], OptionType<EastType>>>;
32
+ /**
33
+ * Where a paged resource kind's windows come from, and how one read is drawn:
34
+ * the kind's own paged read, in its resources' key order; or its source of the
35
+ * slice, the narrowing's rows in the source's index's order.
36
+ */
37
+ export interface ScheduleKindWindows {
38
+ /** The window `[offset, offset + limit)`, whole. */
39
+ readonly read: ScheduleWindowRead;
40
+ /** A window read → its resources, by key. */
41
+ readonly rows: (page: ExprType<EastType>) => ExprType<DictType<EastType, EastType>>;
42
+ /** A window read → the texts of its resources' keys, in the order its rows draw. */
43
+ readonly keys: ($: ScheduleBlock, page: ExprType<EastType>) => ExprType<ArrayType<StringType>>;
44
+ /** Whether a window's rows are drawn in its keys' order rather than the resources' key order: an index's order. */
45
+ readonly indexed: boolean;
46
+ /** The handle: its identity, size, key search, snapshot and narrowing. */
47
+ readonly handle: SchedulePagedHandle;
48
+ /** Whether the handle names its snapshot, `revision` and `refresh`. */
49
+ readonly pinned: boolean;
50
+ /** Whether the handle names the narrowing it serves, `query`: a source of the slice. */
51
+ readonly query: boolean;
52
+ }
53
+ /**
54
+ * A paged kind's own windows (#1199): its paged read, in its resources' key
55
+ * order.
56
+ *
57
+ * @param kind - The paged resource kind
58
+ * @param where - The kind, as a refusal names it (`Plan: resources.presses`)
59
+ * @returns Its windows
60
+ * @throws {Error} When its paged read is not a paged source of its resources
61
+ */
62
+ export declare function scheduleOwnWindows(kind: ScheduleResourceKind<EastType, EastType>, where: string): ScheduleKindWindows;
63
+ /**
64
+ * A paged kind's windows narrowed by its source of the slice (#1344): the
65
+ * narrowing's rows themselves, paged in the source's index's order — never a
66
+ * window of every resource filtered by the keys the source shows.
67
+ *
68
+ * @param kind - The paged resource kind
69
+ * @param slot - Its slot, which names its source
70
+ * @param narrowed - The source's narrowed data, as the builder's payload bound it: a rail's live source of index entries
71
+ * @param builder - The builder, as its refusals name it (`Plan`, `Calendar`)
72
+ * @returns Its windows
73
+ * @throws {Error} When the source's rows are not the kind's, or its entries carry no rows
74
+ */
75
+ export declare function scheduleNarrowedWindows(kind: ScheduleResourceKind<EastType, EastType>, slot: string, narrowed: ExprType<StructType>, builder: string): ScheduleKindWindows;
76
+ //# sourceMappingURL=pages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../../src/schedule/pages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EACH,SAAS,EAAQ,UAAU,EAC3B,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EACvJ,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;AAEnD,yJAAyJ;AACzJ,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,UAAU,CAAC;IAClD,EAAE,EAAE,UAAU,CAAC;IACf,KAAK,EAAE,YAAY,CAAC,EAAE,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,OAAO,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;IACzF,QAAQ,EAAE,YAAY,CAAC,EAAE,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IACnD,OAAO,EAAE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AQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,GAC9G,mBAAmB,CAoBrB"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Where a paged resource kind's windows come from (#1199, #1344, #1424): the
7
+ * kind's own paged read, its resources in their key order; or, its builder's
8
+ * slice naming a source after its slot, that source's narrowed rows
9
+ * themselves, the narrowing's resources in the source's index's order — never
10
+ * a window of every resource filtered by the keys the source shows. The Plan's
11
+ * paged rows (`plan/event-rows.ts`) and the Calendar's (`calendar/paged.ts`)
12
+ * page through them alike.
13
+ *
14
+ * @packageDocumentation
15
+ */
16
+ import { ArrayType, East, StringType, isTypeEqual, printType, } from "@elaraai/east";
17
+ import { buildPagedWindow, resolveRowSource } from "@elaraai/east-ui/internal";
18
+ import { orderedRowSource } from "../utils/ordered-source.js";
19
+ /**
20
+ * A paged kind's own windows (#1199): its paged read, in its resources' key
21
+ * order.
22
+ *
23
+ * @param kind - The paged resource kind
24
+ * @param where - The kind, as a refusal names it (`Plan: resources.presses`)
25
+ * @returns Its windows
26
+ * @throws {Error} When its paged read is not a paged source of its resources
27
+ */
28
+ export function scheduleOwnWindows(kind, where) {
29
+ // The resources a window at a time — each window whole, a piece the source cut short read on to its end.
30
+ const resolved = resolveRowSource(kind.window, where);
31
+ if (resolved.kind === "inline") {
32
+ throw new Error(`${where}: a paged kind's resources are a paged read — Data.bindPaged(record) over the resources' record`);
33
+ }
34
+ // A key's text, as the rows name it: a paged kind's keys are Strings, as `Schedule.resources` holds them.
35
+ const keyText = isTypeEqual(kind.keyType, StringType)
36
+ ? (key) => key
37
+ : (key) => East.print(key);
38
+ return {
39
+ read: buildPagedWindow(resolved),
40
+ rows: (page) => page,
41
+ keys: ($, page) => {
42
+ const out = $.let([], ArrayType(StringType));
43
+ $.for(page, ($2, _row, key) => { $2(out.pushLast(keyText(key))); });
44
+ return out;
45
+ },
46
+ indexed: false,
47
+ handle: resolved.source,
48
+ pinned: resolved.pinned,
49
+ query: false,
50
+ };
51
+ }
52
+ /**
53
+ * A paged kind's windows narrowed by its source of the slice (#1344): the
54
+ * narrowing's rows themselves, paged in the source's index's order — never a
55
+ * window of every resource filtered by the keys the source shows.
56
+ *
57
+ * @param kind - The paged resource kind
58
+ * @param slot - Its slot, which names its source
59
+ * @param narrowed - The source's narrowed data, as the builder's payload bound it: a rail's live source of index entries
60
+ * @param builder - The builder, as its refusals name it (`Plan`, `Calendar`)
61
+ * @returns Its windows
62
+ * @throws {Error} When the source's rows are not the kind's, or its entries carry no rows
63
+ */
64
+ export function scheduleNarrowedWindows(kind, slot, narrowed, builder) {
65
+ const where = `${builder}: the slice's source "${slot}"`;
66
+ const resolved = resolveRowSource(narrowed, where);
67
+ // The slice binds only a record's indexed reads, so a source is an index's window (`recordSources`).
68
+ if (resolved.kind !== "ordered")
69
+ throw new Error(`${where} narrows resources.${slot}, and it is no index's window of a record`);
70
+ const ordered = orderedRowSource(resolved, builder);
71
+ const row = ordered.resolved.elementType;
72
+ if (!isTypeEqual(resolved.keyType, kind.keyType) || !isTypeEqual(row, kind.rowType)) {
73
+ throw new Error(`${where} narrows resources.${slot}, and its rows are ${printType(row)} — the kind's are ${printType(kind.rowType)}: ` +
74
+ "bind the source over the kind's own record, Data.bindPaged(record, { indexes })");
75
+ }
76
+ return {
77
+ read: ordered.window,
78
+ rows: (page) => ordered.rows(page),
79
+ keys: (_$, page) => ordered.keys(page),
80
+ indexed: true,
81
+ handle: resolved.source,
82
+ pinned: resolved.pinned,
83
+ query: resolved.query,
84
+ };
85
+ }
86
+ //# sourceMappingURL=pages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pages.js","sourceRoot":"","sources":["../../../src/schedule/pages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;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a,CAAC;QAC/C,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,QAAQ,CAAC,MAAwC;QACzD,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,KAAK,EAAE,QAAQ,CAAC,KAAK;KACxB,CAAC;AACN,CAAC"}
@@ -2,8 +2,28 @@
2
2
  * Copyright (c) 2025 Elara AI Pty Ltd
3
3
  * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
4
  */
5
- /** Schedule's typed adapter to record Slice's indexed queries. */
5
+ /**
6
+ * Schedule's typed adapter to record Slice's indexed queries: a kind's window
7
+ * and its backlog read through its source of its builder's slice, and the
8
+ * window's events counted before one is read.
9
+ *
10
+ * A window read under a cap counts first: its count is the request its read
11
+ * asks first, the same searches, so counting asks e3 nothing of its own; past
12
+ * the cap the read answers `none` and reads no page — the builder draws the
13
+ * kind's summary, or hatches its rows and says how many events there are
14
+ * ({@link SCHEDULE_EVENT_CAP}).
15
+ *
16
+ * @packageDocumentation
17
+ */
6
18
  import { ArrayType, DateTimeType, DictType, FunctionType, IntegerType, OptionType, StringType, StructType, type EastType, type ExprType, type SubtypeExprOrValue } from "@elaraai/east";
19
+ /**
20
+ * The most events a builder reads and draws of one kind over what it reads at
21
+ * once (#1039): its cells, or its window. Past it, the kind's events are never
22
+ * read or drawn: its resources' rows shade from its source's summary where the
23
+ * source lists one, and are hatched otherwise, the builder saying how many
24
+ * events there are.
25
+ */
26
+ export declare const SCHEDULE_EVENT_CAP = 10000;
7
27
  /** Minimal typed query reader; additional index-entry fields remain opaque. */
8
28
  export declare function ScheduleRecordSliceType<K extends EastType, R extends EastType>(key: K, row: R): StructType<{
9
29
  readonly data: StructType<{
@@ -17,6 +37,12 @@ export declare function ScheduleRecordSliceType<K extends EastType, R extends Ea
17
37
  readonly to: StringType;
18
38
  }>;
19
39
  readonly prefix: StringType;
40
+ readonly window: StructType<{
41
+ readonly minX: import("@elaraai/east").FloatType;
42
+ readonly minY: import("@elaraai/east").FloatType;
43
+ readonly maxX: import("@elaraai/east").FloatType;
44
+ readonly maxY: import("@elaraai/east").FloatType;
45
+ }>;
20
46
  }>>, IntegerType, IntegerType], OptionType<ArrayType<StructType<{
21
47
  readonly key: K;
22
48
  readonly row: OptionType<R>;
@@ -57,6 +83,39 @@ export declare function ScheduleRecordSliceType<K extends EastType, R extends Ea
57
83
  readonly to: StringType;
58
84
  readonly optional: import("@elaraai/east").BooleanType;
59
85
  }>>;
86
+ readonly area: OptionType<StructType<{
87
+ readonly x: StringType;
88
+ readonly y: StringType;
89
+ readonly width: OptionType<StringType>;
90
+ readonly height: OptionType<StringType>;
91
+ readonly centre: import("@elaraai/east").BooleanType;
92
+ readonly cell: import("@elaraai/east").FloatType;
93
+ readonly optional: import("@elaraai/east").BooleanType;
94
+ }>>;
95
+ readonly series: OptionType<StructType<{
96
+ readonly key: StringType;
97
+ readonly from: StringType;
98
+ readonly to: StringType;
99
+ readonly tile: import("@elaraai/east").VariantType<{
100
+ readonly day: import("@elaraai/east").NullType;
101
+ readonly week: import("@elaraai/east").NullType;
102
+ readonly month: import("@elaraai/east").NullType;
103
+ readonly quarter: import("@elaraai/east").NullType;
104
+ readonly year: import("@elaraai/east").NullType;
105
+ }>;
106
+ }>>;
107
+ readonly summary: OptionType<StructType<{
108
+ readonly key: StringType;
109
+ readonly from: StringType;
110
+ readonly to: StringType;
111
+ readonly tile: import("@elaraai/east").VariantType<{
112
+ readonly day: import("@elaraai/east").NullType;
113
+ readonly week: import("@elaraai/east").NullType;
114
+ readonly month: import("@elaraai/east").NullType;
115
+ readonly quarter: import("@elaraai/east").NullType;
116
+ readonly year: import("@elaraai/east").NullType;
117
+ }>;
118
+ }>>;
60
119
  }>>;
61
120
  readonly range: OptionType<StringType>;
62
121
  readonly search: ArrayType<StringType>;
@@ -70,6 +129,12 @@ export declare function ScheduleRecordSliceType<K extends EastType, R extends Ea
70
129
  readonly to: StringType;
71
130
  }>;
72
131
  readonly prefix: StringType;
132
+ readonly window: StructType<{
133
+ readonly minX: import("@elaraai/east").FloatType;
134
+ readonly minY: import("@elaraai/east").FloatType;
135
+ readonly maxX: import("@elaraai/east").FloatType;
136
+ readonly maxY: import("@elaraai/east").FloatType;
137
+ }>;
73
138
  }>>;
74
139
  }>>;
75
140
  }>;
@@ -81,6 +146,12 @@ export declare function ScheduleRecordSliceType<K extends EastType, R extends Ea
81
146
  readonly to: StringType;
82
147
  }>;
83
148
  readonly prefix: StringType;
149
+ readonly window: StructType<{
150
+ readonly minX: import("@elaraai/east").FloatType;
151
+ readonly minY: import("@elaraai/east").FloatType;
152
+ readonly maxX: import("@elaraai/east").FloatType;
153
+ readonly maxY: import("@elaraai/east").FloatType;
154
+ }>;
84
155
  }>>;
85
156
  readonly preset: OptionType<StringType>;
86
157
  readonly resolution: OptionType<import("@elaraai/east").VariantType<{
@@ -101,6 +172,12 @@ export declare function ScheduleRecordSliceType<K extends EastType, R extends Ea
101
172
  readonly to: StringType;
102
173
  }>;
103
174
  readonly prefix: StringType;
175
+ readonly window: StructType<{
176
+ readonly minX: import("@elaraai/east").FloatType;
177
+ readonly minY: import("@elaraai/east").FloatType;
178
+ readonly maxX: import("@elaraai/east").FloatType;
179
+ readonly maxY: import("@elaraai/east").FloatType;
180
+ }>;
104
181
  }>>;
105
182
  readonly preset: OptionType<StringType>;
106
183
  readonly resolution: OptionType<import("@elaraai/east").VariantType<{
@@ -126,6 +203,12 @@ export declare function ScheduleRecordSliceType<K extends EastType, R extends Ea
126
203
  readonly to: StringType;
127
204
  }>;
128
205
  readonly prefix: StringType;
206
+ readonly window: StructType<{
207
+ readonly minX: import("@elaraai/east").FloatType;
208
+ readonly minY: import("@elaraai/east").FloatType;
209
+ readonly maxX: import("@elaraai/east").FloatType;
210
+ readonly maxY: import("@elaraai/east").FloatType;
211
+ }>;
129
212
  }>>], OptionType<IntegerType>>;
130
213
  readonly total: FunctionType<[], OptionType<IntegerType>>;
131
214
  readonly domain: FunctionType<[StringType], OptionType<StructType<{
@@ -167,6 +250,12 @@ export declare function ScheduleRecordSliceType<K extends EastType, R extends Ea
167
250
  readonly to: StringType;
168
251
  }>;
169
252
  readonly prefix: StringType;
253
+ readonly window: StructType<{
254
+ readonly minX: import("@elaraai/east").FloatType;
255
+ readonly minY: import("@elaraai/east").FloatType;
256
+ readonly maxX: import("@elaraai/east").FloatType;
257
+ readonly maxY: import("@elaraai/east").FloatType;
258
+ }>;
170
259
  }>>, StringType], OptionType<import("@elaraai/east").BooleanType>>;
171
260
  readonly containsRow: FunctionType<[DictType<StringType, import("@elaraai/east").VariantType<{
172
261
  readonly values: ArrayType<StringType>;
@@ -175,6 +264,12 @@ export declare function ScheduleRecordSliceType<K extends EastType, R extends Ea
175
264
  readonly to: StringType;
176
265
  }>;
177
266
  readonly prefix: StringType;
267
+ readonly window: StructType<{
268
+ readonly minX: import("@elaraai/east").FloatType;
269
+ readonly minY: import("@elaraai/east").FloatType;
270
+ readonly maxX: import("@elaraai/east").FloatType;
271
+ readonly maxY: import("@elaraai/east").FloatType;
272
+ }>;
178
273
  }>>, StringType, import("@elaraai/east").BlobType], OptionType<import("@elaraai/east").BooleanType>>;
179
274
  }>;
180
275
  /** A record Slice over the event record's original key and row types. */
@@ -190,10 +285,9 @@ export type ScheduleKindPart = ExprType<StructType>;
190
285
  /**
191
286
  * Read a visible interval or backlog through the same declared Slice paths.
192
287
  * This reads only the chosen result, in bounded pages. Index bounds own all
193
- * membership and distinct counts; no row predicate implements narrowing.
194
- * The narrowing is the source's choices but its start field's and, on the
195
- * start field, the window's half-open range — or, for a backlog, the start
196
- * Unset; exact start values a choice holds stand for a window.
288
+ * membership and distinct counts; no row predicate implements narrowing. A
289
+ * window read under a cap counts its events first — the count its read asks
290
+ * first, so no request of its own — and past the cap reads no page.
197
291
  * @param part - The kind's source of its builder's slice, bound in the builder's payload.
198
292
  * @param slot - The kind's slot, which names its source.
199
293
  * @param key - Original record key type.
@@ -203,9 +297,28 @@ export type ScheduleKindPart = ExprType<StructType>;
203
297
  * @param optional - Whether the time fields admit backlog rows.
204
298
  * @param backlog - Read Unset starts instead of a scheduled interval.
205
299
  * @param label - Kind name used by authoring errors.
300
+ * @param cap - The most events a window is read with ({@link SCHEDULE_EVENT_CAP}): counted first, and past it the read
301
+ * answers `none`, reading no page; no cap, every window is read. A backlog is read whole, whatever the cap.
206
302
  * @returns A window reader compatible with the existing Schedule seams; refused as it reads when the source's range is
207
303
  * not the start field, or it declares no interval index from the start to the end.
208
304
  * @throws {Error} When the source is not a record Slice over this event record with joined rows.
209
305
  */
210
- export declare function scheduleRecordWindow(part: ScheduleKindPart, slot: string, key: EastType, row: EastType, start: string, end: string, optional: boolean, backlog: boolean, label: string): ExprType<FunctionType<[DateTimeType, DateTimeType], OptionType<DictType<EastType, EastType>>>>;
306
+ export declare function scheduleRecordWindow(part: ScheduleKindPart, slot: string, key: EastType, row: EastType, start: string, end: string, optional: boolean, backlog: boolean, label: string, cap?: number): ExprType<FunctionType<[DateTimeType, DateTimeType], OptionType<DictType<EastType, EastType>>>>;
307
+ /**
308
+ * Count a window's events through a kind's source before one is read: the
309
+ * count {@link scheduleRecordWindow} asks first over the same window — the same
310
+ * searches, so a count and its window's read ask e3 once.
311
+ * @param part - The kind's source of its builder's slice, bound in the builder's payload.
312
+ * @param slot - The kind's slot, which names its source.
313
+ * @param key - Original record key type.
314
+ * @param row - Record row type.
315
+ * @param start - Interval start field.
316
+ * @param end - Interval end field (the same field for an instant).
317
+ * @param optional - Whether the time fields admit backlog rows: a row with no start is in no window, and not counted.
318
+ * @param label - Kind name used by authoring errors.
319
+ * @returns `(from, to)` → how many of the source's events overlap `[from, to)`, under its narrowing; `none` while the
320
+ * count is in flight. Refused as it counts, as the window's read is.
321
+ * @throws {Error} When the source is not a record Slice over this event record with joined rows.
322
+ */
323
+ export declare function scheduleRecordCount(part: ScheduleKindPart, slot: string, key: EastType, row: EastType, start: string, end: string, optional: boolean, label: string): ExprType<FunctionType<[DateTimeType, DateTimeType], OptionType<IntegerType>>>;
211
324
  //# sourceMappingUR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;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAC/H,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAqCpK;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAC9H,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAQnH"}
@@ -2,9 +2,29 @@
2
2
  * Copyright (c) 2025 Elara AI Pty Ltd
3
3
  * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
4
  */
5
- /** Schedule's typed adapter to record Slice's indexed queries. */
5
+ /**
6
+ * Schedule's typed adapter to record Slice's indexed queries: a kind's window
7
+ * and its backlog read through its source of its builder's slice, and the
8
+ * window's events counted before one is read.
9
+ *
10
+ * A window read under a cap counts first: its count is the request its read
11
+ * asks first, the same searches, so counting asks e3 nothing of its own; past
12
+ * the cap the read answers `none` and reads no page — the builder draws the
13
+ * kind's summary, or hatches its rows and says how many events there are
14
+ * ({@link SCHEDULE_EVENT_CAP}).
15
+ *
16
+ * @packageDocumentation
17
+ */
6
18
  import { ArrayType, DateTimeType, DictType, East, Expr, FunctionType, IntegerType, OptionType, StringType, StructType, isSubtype, isTypeEqual, none, some, variant, } from "@elaraai/east";
7
19
  import { RecordSliceBindType, RecordSliceChoiceType, RecordSliceConfigType, RecordSliceStateType, RecordSliceWhereType, recordSliceReadPlatform, } from "@elaraai/east-ui/internal";
20
+ /**
21
+ * The most events a builder reads and draws of one kind over what it reads at
22
+ * once (#1039): its cells, or its window. Past it, the kind's events are never
23
+ * read or drawn: its resources' rows shade from its source's summary where the
24
+ * source lists one, and are hatched otherwise, the builder saying how many
25
+ * events there are.
26
+ */
27
+ export const SCHEDULE_EVENT_CAP = 10_000;
8
28
  /** Minimal typed query reader; additional index-entry fields remain opaque. */
9
29
  export function ScheduleRecordSliceType(key, row) {
10
30
  return StructType({ ...RecordSliceBindType.fields,
@@ -13,26 +33,13 @@ export function ScheduleRecordSliceType(key, row) {
13
33
  });
14
34
  }
15
35
  /**
16
- * Read a visible interval or backlog through the same declared Slice paths.
17
- * This reads only the chosen result, in bounded pages. Index bounds own all
18
- * membership and distinct counts; no row predicate implements narrowing.
19
- * The narrowing is the source's choices but its start field's and, on the
20
- * start field, the window's half-open range — or, for a backlog, the start
21
- * Unset; exact start values a choice holds stand for a window.
22
- * @param part - The kind's source of its builder's slice, bound in the builder's payload.
23
- * @param slot - The kind's slot, which names its source.
24
- * @param key - Original record key type.
25
- * @param row - Record row type.
26
- * @param start - Interval start field.
27
- * @param end - Interval end field (the same field for an instant).
28
- * @param optional - Whether the time fields admit backlog rows.
29
- * @param backlog - Read Unset starts instead of a scheduled interval.
30
- * @param label - Kind name used by authoring errors.
31
- * @returns A window reader compatible with the existing Schedule seams; refused as it reads when the source's range is
32
- * not the start field, or it declares no interval index from the start to the end.
33
- * @throws {Error} When the source is not a record Slice over this event record with joined rows.
36
+ * Checks a kind's source at build: a record Slice over the kind's own record,
37
+ * its entries carrying their rows.
38
+ *
39
+ * @returns The source's entries' type: the window's own wire type, its index key and covering value preserved
40
+ * @throws {Error} When the source is not a record Slice over this event record with joined rows
34
41
  */
35
- export function scheduleRecordWindow(part, slot, key, row, start, end, optional, backlog, label) {
42
+ function checkedSource(part, slot, key, row, label) {
36
43
  const Type = ScheduleRecordSliceType(key, row);
37
44
  const type = Expr.type(part);
38
45
  const fields = type.type === "Struct" ? type.fields : {};
@@ -52,57 +59,129 @@ export function scheduleRecordWindow(part, slot, key, row, start, end, optional,
52
59
  throw new Error(`${label}: the builder's source "${slot}" narrows another record — name it after this kind's slot over the kind's own record, ` +
53
60
  "Data.bindPaged(record, { indexes }), its rows joined");
54
61
  }
62
+ return collection;
63
+ }
64
+ /**
65
+ * The narrowing a window `[from, to)` is read under, built in a read's block —
66
+ * its window's read and its count build it alike, so they ask the same
67
+ * searches: the source's choices but its start field's and, on the start
68
+ * field, the window's half-open range — or, for a backlog, the start Unset;
69
+ * exact start values a choice holds stand for a window. Refused as it is read
70
+ * when the source's range is not the start field, or it declares no interval
71
+ * index from the start to the end.
72
+ */
73
+ function windowWhere($, source, from, to, start, end, optional, backlog, label) {
74
+ const config = $.const(source.config);
75
+ const read = $.const(source.read);
76
+ $.if(config.range.match({ none: () => true, some: (_$2, field) => field.notEqual(start) }), $2 => {
77
+ $2.error(`${label}: set the record Slice range to '${start}' so navigation and filters share one window`);
78
+ });
79
+ const supported = $.let(false);
80
+ $.for(config.indexes, ($2, index) => {
81
+ $2.match(index.interval, { some: ($3, interval) => {
82
+ $3.if(interval.from.equal(start).and(() => interval.to.equal(end)), $4 => { $4.assign(supported, true); });
83
+ } });
84
+ });
85
+ $.if(supported.not(), $2 => { $2.error(`${label}: declare an interval index for ${start} and ${end} to preserve overlapping events`); });
86
+ const where = $.let(new Map(), RecordSliceWhereType);
87
+ const state = $.const(read());
88
+ $.for(state.where, ($2, choice, field) => {
89
+ $2.if(field.notEqual(start), $3 => { $3(where.insert(field, choice)); });
90
+ });
91
+ const time = $.let(backlog ? variant("values", [East.print(East.value(none, OptionType(DateTimeType)))])
92
+ : variant("range", { from: East.print(optional ? East.value(some(from), OptionType(DateTimeType)) : from),
93
+ to: East.print(optional ? East.value(some(to), OptionType(DateTimeType)) : to) }), RecordSliceChoiceType);
94
+ if (!backlog) {
95
+ $.match(state.where.tryGet(start), { some: ($2, choice) => {
96
+ $2.match(choice, { values: ($3, values) => { $3.assign(time, variant("values", values)); } });
97
+ } });
98
+ }
99
+ $(where.insert(start, time));
100
+ return where;
101
+ }
102
+ /**
103
+ * Read a visible interval or backlog through the same declared Slice paths.
104
+ * This reads only the chosen result, in bounded pages. Index bounds own all
105
+ * membership and distinct counts; no row predicate implements narrowing. A
106
+ * window read under a cap counts its events first — the count its read asks
107
+ * first, so no request of its own — and past the cap reads no page.
108
+ * @param part - The kind's source of its builder's slice, bound in the builder's payload.
109
+ * @param slot - The kind's slot, which names its source.
110
+ * @param key - Original record key type.
111
+ * @param row - Record row type.
112
+ * @param start - Interval start field.
113
+ * @param end - Interval end field (the same field for an instant).
114
+ * @param optional - Whether the time fields admit backlog rows.
115
+ * @param backlog - Read Unset starts instead of a scheduled interval.
116
+ * @param label - Kind name used by authoring errors.
117
+ * @param cap - The most events a window is read with ({@link SCHEDULE_EVENT_CAP}): counted first, and past it the read
118
+ * answers `none`, reading no page; no cap, every window is read. A backlog is read whole, whatever the cap.
119
+ * @returns A window reader compatible with the existing Schedule seams; refused as it reads when the source's range is
120
+ * not the start field, or it declares no interval index from the start to the end.
121
+ * @throws {Error} When the source is not a record Slice over this event record with joined rows.
122
+ */
123
+ export function scheduleRecordWindow(part, slot, key, row, start, end, optional, backlog, label, cap) {
124
+ const entriesType = checkedSource(part, slot, key, row, label);
55
125
  const Held = DictType(key, row);
56
- // Preserve the actual window's wire type (including its index key and
57
- // covering value); only the two validated entry fields are inspected.
58
- const Entries = collection;
59
126
  return East.function([DateTimeType, DateTimeType], OptionType(Held), ($, from, to) => {
60
127
  // The source as the builder bound it, its members read here: the reader captures the source alone.
61
128
  const source = $.const(part);
62
- const config = $.const(source.config);
63
- const read = $.const(source.read);
64
129
  const countWhere = $.const(source.countWhere);
65
130
  const pageWhere = $.const(source.pageWhere);
66
131
  const id = $.const(source.data.id);
67
132
  const revision = $.const(source.data.revision);
68
- $.if(config.range.match({ none: () => true, some: (_$2, field) => field.notEqual(start) }), $2 => {
69
- $2.error(`${label}: set the record Slice range to '${start}' so navigation and filters share one window`);
70
- });
71
- const supported = $.let(false);
72
- $.for(config.indexes, ($2, index) => {
73
- $2.match(index.interval, { some: ($3, interval) => {
74
- $3.if(interval.from.equal(start).and(() => interval.to.equal(end)), $4 => { $4.assign(supported, true); });
75
- } });
76
- });
77
- $.if(supported.not(), $2 => { $2.error(`${label}: declare an interval index for ${start} and ${end} to preserve overlapping events`); });
78
- const where = $.let(new Map(), RecordSliceWhereType);
79
- const state = $.const(read());
80
- $.for(state.where, ($2, choice, field) => {
81
- $2.if(field.notEqual(start), $3 => { $3(where.insert(field, choice)); });
82
- });
83
- const time = $.let(backlog ? variant("values", [East.print(East.value(none, OptionType(DateTimeType)))])
84
- : variant("range", { from: East.print(optional ? East.value(some(from), OptionType(DateTimeType)) : from),
85
- to: East.print(optional ? East.value(some(to), OptionType(DateTimeType)) : to) }), RecordSliceChoiceType);
86
- if (!backlog) {
87
- $.match(state.where.tryGet(start), { some: ($2, choice) => {
88
- $2.match(choice, { values: ($3, values) => { $3.assign(time, variant("values", values)); } });
89
- } });
90
- }
91
- $(where.insert(start, time));
133
+ const where = windowWhere($, source, from, to, start, end, optional, backlog, label);
92
134
  const result = $.let(none, OptionType(Held));
93
- $.match(recordSliceReadPlatform([Entries], id, revision, countWhere, pageWhere, where), {
94
- some: ($2, entries) => {
95
- const held = $2.let(new Map(), Held);
96
- $2.for(entries, ($3, entry) => {
97
- $3.match(entry.row, {
98
- none: $4 => { $4.error(`${label}: the builder's source "${slot}" reads no rows — bind it with Data.bindPaged with join: true`); },
99
- some: ($4, value) => { $4(held.insert(entry.key, value)); },
135
+ // The window's entries, read a page at a time once their count is known: the rows by their keys.
136
+ const read = ($b) => {
137
+ $b.match(recordSliceReadPlatform([entriesType], id, revision, countWhere, pageWhere, where), {
138
+ some: ($2, entries) => {
139
+ const held = $2.let(new Map(), Held);
140
+ $2.for(entries, ($3, entry) => {
141
+ $3.match(entry.row, {
142
+ none: $4 => { $4.error(`${label}: the builder's source "${slot}" reads no rows — bind it with Data.bindPaged with join: true`); },
143
+ some: ($4, value) => { $4(held.insert(entry.key, value)); },
144
+ });
100
145
  });
101
- });
102
- $2.assign(result, some(held));
103
- },
104
- });
146
+ $2.assign(result, some(held));
147
+ },
148
+ });
149
+ };
150
+ if (cap === undefined || backlog) {
151
+ read($);
152
+ }
153
+ else {
154
+ // Counted first, as the read counts first: past the cap, no page is read and the window answers none.
155
+ $.match(countWhere(where), {
156
+ some: ($2, count) => { $2.if(count.lessEqual(BigInt(cap)), ($3) => { read($3); }); },
157
+ });
158
+ }
105
159
  return result;
106
160
  });
107
161
  }
162
+ /**
163
+ * Count a window's events through a kind's source before one is read: the
164
+ * count {@link scheduleRecordWindow} asks first over the same window — the same
165
+ * searches, so a count and its window's read ask e3 once.
166
+ * @param part - The kind's source of its builder's slice, bound in the builder's payload.
167
+ * @param slot - The kind's slot, which names its source.
168
+ * @param key - Original record key type.
169
+ * @param row - Record row type.
170
+ * @param start - Interval start field.
171
+ * @param end - Interval end field (the same field for an instant).
172
+ * @param optional - Whether the time fields admit backlog rows: a row with no start is in no window, and not counted.
173
+ * @param label - Kind name used by authoring errors.
174
+ * @returns `(from, to)` → how many of the source's events overlap `[from, to)`, under its narrowing; `none` while the
175
+ * count is in flight. Refused as it counts, as the window's read is.
176
+ * @throws {Error} When the source is not a record Slice over this event record with joined rows.
177
+ */
178
+ export function scheduleRecordCount(part, slot, key, row, start, end, optional, label) {
179
+ checkedSource(part, slot, key, row, label);
180
+ return East.function([DateTimeType, DateTimeType], OptionType(IntegerType), ($, from, to) => {
181
+ const source = $.const(part);
182
+ const countWhere = $.const(source.countWhere);
183
+ const where = windowWhere($, source, from, to, start, end, optional, false, label);
184
+ return countWhere(where);
185
+ });
186
+ }
108
187
  //# sourceMappingURL=record-window.js.map