@elaraai/east-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 (99) hide show
  1. package/dist/src/collections/index.d.ts +0 -1
  2. package/dist/src/collections/index.d.ts.map +1 -1
  3. package/dist/src/collections/index.js +0 -1
  4. package/dist/src/collections/index.js.map +1 -1
  5. package/dist/src/component.d.ts +0 -999
  6. package/dist/src/component.d.ts.map +1 -1
  7. package/dist/src/component.js +0 -44
  8. package/dist/src/component.js.map +1 -1
  9. package/dist/src/contracts/drag.d.ts +2 -2
  10. package/dist/src/contracts/drag.js +2 -2
  11. package/dist/src/contracts/editing.d.ts +4 -0
  12. package/dist/src/contracts/editing.d.ts.map +1 -1
  13. package/dist/src/contracts/editing.js +2 -1
  14. package/dist/src/contracts/editing.js.map +1 -1
  15. package/dist/src/index.d.ts +2 -1
  16. package/dist/src/index.d.ts.map +1 -1
  17. package/dist/src/index.js +4 -1
  18. package/dist/src/index.js.map +1 -1
  19. package/dist/src/internal.d.ts +4 -1
  20. package/dist/src/internal.d.ts.map +1 -1
  21. package/dist/src/internal.js +5 -2
  22. package/dist/src/internal.js.map +1 -1
  23. package/dist/src/layout/snap-grid/index.d.ts +1 -0
  24. package/dist/src/layout/snap-grid/index.d.ts.map +1 -1
  25. package/dist/src/pick/panel/index.js +1 -1
  26. package/dist/src/pick/panel/index.js.map +1 -1
  27. package/dist/src/platform/slice/index.d.ts +4 -7
  28. package/dist/src/platform/slice/index.d.ts.map +1 -1
  29. package/dist/src/platform/slice/index.js +5 -8
  30. package/dist/src/platform/slice/index.js.map +1 -1
  31. package/dist/src/platform/slice/record-area.d.ts +181 -0
  32. package/dist/src/platform/slice/record-area.d.ts.map +1 -0
  33. package/dist/src/platform/slice/record-area.js +304 -0
  34. package/dist/src/platform/slice/record-area.js.map +1 -0
  35. package/dist/src/platform/slice/record-chrome.d.ts +138 -0
  36. package/dist/src/platform/slice/record-chrome.d.ts.map +1 -1
  37. package/dist/src/platform/slice/record-plan.d.ts +34 -1
  38. package/dist/src/platform/slice/record-plan.d.ts.map +1 -1
  39. package/dist/src/platform/slice/record-plan.js +126 -3
  40. package/dist/src/platform/slice/record-plan.js.map +1 -1
  41. package/dist/src/platform/slice/record-series.d.ts +166 -0
  42. package/dist/src/platform/slice/record-series.d.ts.map +1 -0
  43. package/dist/src/platform/slice/record-series.js +258 -0
  44. package/dist/src/platform/slice/record-series.js.map +1 -0
  45. package/dist/src/platform/slice/record-types.d.ts +1862 -13
  46. package/dist/src/platform/slice/record-types.d.ts.map +1 -1
  47. package/dist/src/platform/slice/record-types.js +50 -4
  48. package/dist/src/platform/slice/record-types.js.map +1 -1
  49. package/dist/src/platform/slice/record.d.ts +17 -2
  50. package/dist/src/platform/slice/record.d.ts.map +1 -1
  51. package/dist/src/platform/slice/record.js +62 -9
  52. package/dist/src/platform/slice/record.js.map +1 -1
  53. package/dist/src/runtime/collections/index.d.ts +0 -1
  54. package/dist/src/runtime/collections/index.d.ts.map +1 -1
  55. package/dist/src/runtime/collections/index.js +0 -1
  56. package/dist/src/runtime/collections/index.js.map +1 -1
  57. package/dist/src/runtime/record-slice-source.d.ts +298 -0
  58. package/dist/src/runtime/record-slice-source.d.ts.map +1 -1
  59. package/dist/src/runtime/record-slice-source.js +554 -16
  60. package/dist/src/runtime/record-slice-source.js.map +1 -1
  61. package/dist/src/runtime/record-slice.d.ts +87 -3
  62. package/dist/src/runtime/record-slice.d.ts.map +1 -1
  63. package/dist/src/runtime/record-slice.js +175 -12
  64. package/dist/src/runtime/record-slice.js.map +1 -1
  65. package/dist/src/slice/record/index.d.ts +69 -0
  66. package/dist/src/slice/record/index.d.ts.map +1 -1
  67. package/dist/src/style/color.d.ts +237 -0
  68. package/dist/src/style/color.d.ts.map +1 -0
  69. package/dist/src/style/color.js +105 -0
  70. package/dist/src/style/color.js.map +1 -0
  71. package/dist/src/style/namespace.d.ts +151 -1
  72. package/dist/src/style/namespace.d.ts.map +1 -1
  73. package/dist/src/style/namespace.js +9 -1
  74. package/dist/src/style/namespace.js.map +1 -1
  75. package/dist/src/style.d.ts +3 -0
  76. package/dist/src/style.d.ts.map +1 -1
  77. package/dist/src/style.js +3 -0
  78. package/dist/src/style.js.map +1 -1
  79. package/dist/test/style.examples.d.ts +1 -0
  80. package/dist/test/style.examples.d.ts.map +1 -1
  81. package/dist/test/style.examples.js +17 -2
  82. package/dist/test/style.examples.js.map +1 -1
  83. package/package.json +4 -4
  84. package/dist/src/collections/schematic/index.d.ts +0 -1390
  85. package/dist/src/collections/schematic/index.d.ts.map +0 -1
  86. package/dist/src/collections/schematic/index.js +0 -815
  87. package/dist/src/collections/schematic/index.js.map +0 -1
  88. package/dist/src/collections/schematic/types.d.ts +0 -1183
  89. package/dist/src/collections/schematic/types.d.ts.map +0 -1
  90. package/dist/src/collections/schematic/types.js +0 -724
  91. package/dist/src/collections/schematic/types.js.map +0 -1
  92. package/dist/src/runtime/collections/schematic.d.ts +0 -73
  93. package/dist/src/runtime/collections/schematic.d.ts.map +0 -1
  94. package/dist/src/runtime/collections/schematic.js +0 -69
  95. package/dist/src/runtime/collections/schematic.js.map +0 -1
  96. package/dist/test/collections/schematic.examples.d.ts +0 -23
  97. package/dist/test/collections/schematic.examples.d.ts.map +0 -1
  98. package/dist/test/collections/schematic.examples.js +0 -602
  99. package/dist/test/collections/schematic.examples.js.map +0 -1
@@ -0,0 +1,166 @@
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
+ * Queries for e3's series and summary indexes (#1039), the twin of
7
+ * `record-interval.ts` and `record-area.ts`: a record's events filed by the key
8
+ * they are on — a Plan's resource — and by each time tile they touch,
9
+ * `{ …on, __tile, <key> }`. A series index holds an entry for each event in
10
+ * each tile it touches, carrying the row; a summary index one entry for each
11
+ * key in each tile, `{ count, ms }`, standing for every event touching it.
12
+ *
13
+ * A **cell** is some keys in one tile: what a reader reads of either index for
14
+ * a block of its rows. Each key of a cell is one search, `[…on, tile, key]`,
15
+ * which holds exactly that key's entries in that tile, so a cell's searches
16
+ * hold its keys' entries and no others, in whatever order its keys come — a
17
+ * block of rows narrowed or ordered by another index included. A reader asks
18
+ * every cell it wants in one batch of searches, which counts each cell's
19
+ * entries before one is read, and reads them in one batch of runs.
20
+ *
21
+ * Neither index serves the rail's narrowing (`record-plan.ts`): a series index
22
+ * files an event under each tile it touches, so its runs would count the event
23
+ * more than once, and a summary index's entries name no row. A narrowing
24
+ * reaches a cell through the index's leading fields, chosen exactly; what else
25
+ * it chooses is the reader's to ask of the events it draws (`within`).
26
+ *
27
+ * The tiles are e3's, to the millisecond (`e3.recordIndex.series`): a day and
28
+ * an ISO week counted in whole milliseconds from the epoch and from the Monday
29
+ * before it, so an instant before 1970 is tiled as one after it; a month, a
30
+ * quarter and a year by the UTC calendar.
31
+ */
32
+ import { type ValueTypeOf } from "@elaraai/east";
33
+ import type { SeekQueryType } from "../../contracts/source.js";
34
+ import type { RecordSliceChoiceType, RecordSliceIndexType, RecordSliceTileType, RecordSliceTilingType } from "./record-types.js";
35
+ type Choice = ValueTypeOf<RecordSliceChoiceType>;
36
+ type Index = ValueTypeOf<RecordSliceIndexType>;
37
+ type Tiling = ValueTypeOf<RecordSliceTilingType>;
38
+ /** A series or a summary index's tile field: the tile's start, after the index's leading fields and before its key. */
39
+ export declare const TILE_FIELD = "__tile";
40
+ /** A tile: a day, an ISO week from Monday, a calendar month, a quarter or a year, in UTC. */
41
+ export type RecordTile = keyof RecordSliceTileType["cases"] & string;
42
+ /** The tiles, from the shortest. */
43
+ export declare const RECORD_TILES: readonly RecordTile[];
44
+ /** How a series or a summary index files a record's events, as a binding's index metadata carries it. */
45
+ export interface TileMarker {
46
+ /** The row field naming what an event is on. */
47
+ readonly key: string;
48
+ /** The row field an event starts at. */
49
+ readonly from: string;
50
+ /** The row field it ends at. */
51
+ readonly to: string;
52
+ /** The tile. */
53
+ readonly tile: RecordTile;
54
+ /** Whether the index is a summary — its totals — rather than a series of its events. */
55
+ readonly summary: boolean;
56
+ }
57
+ /**
58
+ * The names of the struct `Data.bindPaged` marks a series or a summary index's
59
+ * `__tile` with in a binding's index metadata, as an area index's `__area` is
60
+ * marked with its box: the key, start and end fields and the tile, each named
61
+ * with its role (`key=…`), and `__summary` for a summary index.
62
+ *
63
+ * @param marker - How the index files the record's events
64
+ * @returns The marker struct's field names, in order
65
+ */
66
+ export declare function tileMarkerFields(marker: TileMarker): string[];
67
+ /**
68
+ * Read a series or a summary index's filing back from its `__tile` marker's
69
+ * field names ({@link tileMarkerFields}).
70
+ *
71
+ * @param names - The marker struct's field names
72
+ * @returns The filing, or `undefined` when the names are not a tile marker's
73
+ */
74
+ export declare function readTileMarker(names: readonly string[]): TileMarker | undefined;
75
+ /**
76
+ * The start of the tile holding an instant, as e3 files it: a day and a week
77
+ * floored in whole milliseconds from the epoch and from the Monday before it, a
78
+ * month, a quarter and a year by the UTC calendar.
79
+ *
80
+ * @param tile - The tile
81
+ * @param at - The instant
82
+ * @returns The tile's start
83
+ */
84
+ export declare function tileStart(tile: RecordTile, at: Date): Date;
85
+ /**
86
+ * The start of the tile after one, as e3 files it.
87
+ *
88
+ * @param tile - The tile
89
+ * @param start - A tile's start
90
+ * @returns The next tile's start
91
+ */
92
+ export declare function tileNext(tile: RecordTile, start: Date): Date;
93
+ /**
94
+ * The tiles a span `[from, to)` overlaps, as e3 files an event over them: each
95
+ * tile's start, in order — the one tile holding `from` when `to` is at or
96
+ * before it.
97
+ *
98
+ * @param tile - The tile
99
+ * @param from - The span's start
100
+ * @param to - Its end, exclusive
101
+ * @param limit - The most tiles to list, at least one
102
+ * @returns The tiles' starts; `undefined` when the span overlaps more than `limit` of them
103
+ * @throws {Error} When `limit` is below one
104
+ */
105
+ export declare function tilesOver(tile: RecordTile, from: Date, to: Date, limit: number): Date[] | undefined;
106
+ /**
107
+ * How a series or a summary index files a record's events: the index's own
108
+ * metadata, or `undefined` for an index of another kind.
109
+ *
110
+ * @param index - The index
111
+ * @returns Its key, start and end fields and its tile
112
+ */
113
+ export declare function tilingOf(index: Index): Tiling | undefined;
114
+ /**
115
+ * Whether a series or a summary index reads a narrowing's cells: whether the
116
+ * narrowing chooses exact values of each of the index's leading fields — one
117
+ * of a field that fans out over a Set, so no event is counted twice.
118
+ *
119
+ * @param index - The index
120
+ * @param where - The narrowing
121
+ * @returns Whether its cells hold the narrowing's events of their keys, or more
122
+ */
123
+ export declare function tileIndexServes(index: Index, where: ReadonlyMap<string, Choice>): boolean;
124
+ /**
125
+ * The index of a binding's that reads a narrowing's cells: of its series
126
+ * indexes — or its summary indexes — whose leading fields the narrowing
127
+ * chooses exactly ({@link tileIndexServes}), the one led by the most of them,
128
+ * so the fewest of the narrowing's choices are left for the reader to ask; of
129
+ * two led by as many, the one listed first.
130
+ *
131
+ * @param indexes - The binding's indexes
132
+ * @param where - The narrowing
133
+ * @param which - A series index, or a summary index
134
+ * @param accept - Which tiles the reader takes; every tile by default
135
+ * @returns The index, or `undefined` when none serves the narrowing
136
+ */
137
+ export declare function tileIndexFor(indexes: readonly Index[], where: ReadonlyMap<string, Choice>, which: "series" | "summary", accept?: (tile: RecordTile) => boolean): Index | undefined;
138
+ /** A cell's searches, and what of the narrowing they leave to the reader. */
139
+ export interface TileCellPlan {
140
+ /** The searches, one for each combination of the leading fields' chosen values and each key, the keys inner. */
141
+ readonly queries: ValueTypeOf<SeekQueryType>[];
142
+ /** The fields of the narrowing the searches do not answer — every field but the index's leading fields and a
143
+ * range of its start field, which the tiles cover. The reader asks of each event it draws whether the
144
+ * narrowing holds it (`within`); none, and every entry is the narrowing's. */
145
+ readonly residual: readonly string[];
146
+ }
147
+ /**
148
+ * Plan a cell of a series or a summary index: some keys in one tile, a search
149
+ * for each key under each combination of the narrowing's values of the index's
150
+ * leading fields, `[…on, tile, key]`, holding that key's entries in that tile
151
+ * and no other's. A range of the index's start field — the window — is the
152
+ * reader's: its tiles cover it.
153
+ *
154
+ * @param index - A series or a summary index ({@link tileIndexFor})
155
+ * @param where - The narrowing
156
+ * @param tile - The tile's start ({@link tilesOver})
157
+ * @param keys - The keys, as `.east` literals of the index's key field
158
+ * @returns The cell's searches, and the fields the reader asks of each event
159
+ * @throws {Error} When the index is neither, when the narrowing does not choose
160
+ * exact values of each of its leading fields (one of a Set's), when the
161
+ * combinations of them pass {@link MAX_RECORD_SLICE_RUNS}, or when `tile` is
162
+ * not the start of one of the index's tiles
163
+ */
164
+ export declare function tileCellQueries(index: Index, where: ReadonlyMap<string, Choice>, tile: Date, keys: readonly string[]): TileCellPlan;
165
+ export {};
166
+ //# sourceMappingURL=record-series.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-series.d.ts","sourceRoot":"","sources":["../../../../src/platform/slice/record-series.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAmD,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGjI,KAAK,MAAM,GAAG,WAAW,CAAC,qBAAqB,CAAC,CAAC;AACjD,KAAK,KAAK,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;AAC/C,KAAK,MAAM,GAAG,WAAW,CAAC,qBAAqB,CAAC,CAAC;AAEjD,uHAAuH;AACvH,eAAO,MAAM,UAAU,WAAW,CAAC;AAEnC,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;AAErE,oCAAoC;AACpC,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAAgD,CAAC;AAE/F,yGAAyG;AACzG,MAAM,WAAW,UAA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AAE,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,GAAG,SAAS,EACnH,MAAM,GAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAoB,GAAG,KAAK,GAAG,SAAS,CAQzE;AAED,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IACzB,gHAAgH;IAChH,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC;IAC/C;;mFAE+E;IAC/E,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAKD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,CA2BnI"}
@@ -0,0 +1,258 @@
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
+ * Queries for e3's series and summary indexes (#1039), the twin of
7
+ * `record-interval.ts` and `record-area.ts`: a record's events filed by the key
8
+ * they are on — a Plan's resource — and by each time tile they touch,
9
+ * `{ …on, __tile, <key> }`. A series index holds an entry for each event in
10
+ * each tile it touches, carrying the row; a summary index one entry for each
11
+ * key in each tile, `{ count, ms }`, standing for every event touching it.
12
+ *
13
+ * A **cell** is some keys in one tile: what a reader reads of either index for
14
+ * a block of its rows. Each key of a cell is one search, `[…on, tile, key]`,
15
+ * which holds exactly that key's entries in that tile, so a cell's searches
16
+ * hold its keys' entries and no others, in whatever order its keys come — a
17
+ * block of rows narrowed or ordered by another index included. A reader asks
18
+ * every cell it wants in one batch of searches, which counts each cell's
19
+ * entries before one is read, and reads them in one batch of runs.
20
+ *
21
+ * Neither index serves the rail's narrowing (`record-plan.ts`): a series index
22
+ * files an event under each tile it touches, so its runs would count the event
23
+ * more than once, and a summary index's entries name no row. A narrowing
24
+ * reaches a cell through the index's leading fields, chosen exactly; what else
25
+ * it chooses is the reader's to ask of the events it draws (`within`).
26
+ *
27
+ * The tiles are e3's, to the millisecond (`e3.recordIndex.series`): a day and
28
+ * an ISO week counted in whole milliseconds from the epoch and from the Monday
29
+ * before it, so an instant before 1970 is tiled as one after it; a month, a
30
+ * quarter and a year by the UTC calendar.
31
+ */
32
+ import { DateTimeType, equalFor, none, printFor, variant } from "@elaraai/east";
33
+ import { MAX_RECORD_SLICE_RUNS } from "./record-plan.js";
34
+ /** A series or a summary index's tile field: the tile's start, after the index's leading fields and before its key. */
35
+ export const TILE_FIELD = "__tile";
36
+ /** The tiles, from the shortest. */
37
+ export const RECORD_TILES = ["day", "week", "month", "quarter", "year"];
38
+ /** The marker's name for a summary index. */
39
+ const SUMMARY_MARKER = "__summary";
40
+ const TILE_ROLES = ["key", "from", "to", "tile"];
41
+ /**
42
+ * The names of the struct `Data.bindPaged` marks a series or a summary index's
43
+ * `__tile` with in a binding's index metadata, as an area index's `__area` is
44
+ * marked with its box: the key, start and end fields and the tile, each named
45
+ * with its role (`key=…`), and `__summary` for a summary index.
46
+ *
47
+ * @param marker - How the index files the record's events
48
+ * @returns The marker struct's field names, in order
49
+ */
50
+ export function tileMarkerFields(marker) {
51
+ return [`key=${marker.key}`, `from=${marker.from}`, `to=${marker.to}`, `tile=${marker.tile}`, ...(marker.summary ? [SUMMARY_MARKER] : [])];
52
+ }
53
+ /**
54
+ * Read a series or a summary index's filing back from its `__tile` marker's
55
+ * field names ({@link tileMarkerFields}).
56
+ *
57
+ * @param names - The marker struct's field names
58
+ * @returns The filing, or `undefined` when the names are not a tile marker's
59
+ */
60
+ export function readTileMarker(names) {
61
+ const roles = new Map();
62
+ let summary = false;
63
+ for (const name of names) {
64
+ if (name === SUMMARY_MARKER) {
65
+ if (summary)
66
+ return undefined;
67
+ summary = true;
68
+ continue;
69
+ }
70
+ const at = name.indexOf("=");
71
+ const role = name.slice(0, Math.max(at, 0));
72
+ if (at <= 0 || !TILE_ROLES.includes(role) || roles.has(role))
73
+ return undefined;
74
+ roles.set(role, name.slice(at + 1));
75
+ }
76
+ const key = roles.get("key"), from = roles.get("from"), to = roles.get("to"), tile = RECORD_TILES.find(t => t === roles.get("tile"));
77
+ if (key === undefined || from === undefined || to === undefined || tile === undefined)
78
+ return undefined;
79
+ return { key, from, to, tile, summary };
80
+ }
81
+ /** A day, in milliseconds. */
82
+ const DAY_MS = 86_400_000;
83
+ /** An ISO week, in milliseconds. */
84
+ const WEEK_MS = 604_800_000;
85
+ /** 1969-12-29T00:00:00Z, the Monday before the epoch, in milliseconds: where weeks are counted from. */
86
+ const MONDAY_MS = -259_200_000;
87
+ /** An instant floored to a whole number of `length` milliseconds from `origin`, whichever its sign. */
88
+ function flooredTo(ms, length, origin) {
89
+ return ms - ((((ms - origin) % length) + length) % length);
90
+ }
91
+ /** The first instant of a UTC month, the month counted on into the next years past December. */
92
+ function monthStart(year, month) {
93
+ // Never Date.UTC, which reads a year below 100 as one of the 1900s.
94
+ const at = new Date(0);
95
+ at.setUTCFullYear(year, month, 1);
96
+ return at;
97
+ }
98
+ /**
99
+ * The start of the tile holding an instant, as e3 files it: a day and a week
100
+ * floored in whole milliseconds from the epoch and from the Monday before it, a
101
+ * month, a quarter and a year by the UTC calendar.
102
+ *
103
+ * @param tile - The tile
104
+ * @param at - The instant
105
+ * @returns The tile's start
106
+ */
107
+ export function tileStart(tile, at) {
108
+ switch (tile) {
109
+ case "day": return new Date(flooredTo(at.getTime(), DAY_MS, 0));
110
+ case "week": return new Date(flooredTo(at.getTime(), WEEK_MS, MONDAY_MS));
111
+ case "month": return monthStart(at.getUTCFullYear(), at.getUTCMonth());
112
+ case "quarter": return monthStart(at.getUTCFullYear(), at.getUTCMonth() - (at.getUTCMonth() % 3));
113
+ case "year": return monthStart(at.getUTCFullYear(), 0);
114
+ }
115
+ }
116
+ /**
117
+ * The start of the tile after one, as e3 files it.
118
+ *
119
+ * @param tile - The tile
120
+ * @param start - A tile's start
121
+ * @returns The next tile's start
122
+ */
123
+ export function tileNext(tile, start) {
124
+ switch (tile) {
125
+ case "day": return new Date(start.getTime() + DAY_MS);
126
+ case "week": return new Date(start.getTime() + WEEK_MS);
127
+ case "month": return monthStart(start.getUTCFullYear(), start.getUTCMonth() + 1);
128
+ case "quarter": return monthStart(start.getUTCFullYear(), start.getUTCMonth() + 3);
129
+ case "year": return monthStart(start.getUTCFullYear() + 1, start.getUTCMonth());
130
+ }
131
+ }
132
+ /**
133
+ * The tiles a span `[from, to)` overlaps, as e3 files an event over them: each
134
+ * tile's start, in order — the one tile holding `from` when `to` is at or
135
+ * before it.
136
+ *
137
+ * @param tile - The tile
138
+ * @param from - The span's start
139
+ * @param to - Its end, exclusive
140
+ * @param limit - The most tiles to list, at least one
141
+ * @returns The tiles' starts; `undefined` when the span overlaps more than `limit` of them
142
+ * @throws {Error} When `limit` is below one
143
+ */
144
+ export function tilesOver(tile, from, to, limit) {
145
+ if (!(limit >= 1))
146
+ throw new Error(`A span's tiles are listed one at least, not ${limit}`);
147
+ let at = tileStart(tile, from);
148
+ if (to.getTime() <= from.getTime())
149
+ return [at];
150
+ const tiles = [];
151
+ while (at.getTime() < to.getTime()) {
152
+ if (tiles.length >= limit)
153
+ return undefined;
154
+ tiles.push(at);
155
+ at = tileNext(tile, at);
156
+ }
157
+ return tiles;
158
+ }
159
+ /**
160
+ * How a series or a summary index files a record's events: the index's own
161
+ * metadata, or `undefined` for an index of another kind.
162
+ *
163
+ * @param index - The index
164
+ * @returns Its key, start and end fields and its tile
165
+ */
166
+ export function tilingOf(index) {
167
+ return index.series.type === "some" ? index.series.value : index.summary.type === "some" ? index.summary.value : undefined;
168
+ }
169
+ /**
170
+ * Whether a series or a summary index reads a narrowing's cells: whether the
171
+ * narrowing chooses exact values of each of the index's leading fields — one
172
+ * of a field that fans out over a Set, so no event is counted twice.
173
+ *
174
+ * @param index - The index
175
+ * @param where - The narrowing
176
+ * @returns Whether its cells hold the narrowing's events of their keys, or more
177
+ */
178
+ export function tileIndexServes(index, where) {
179
+ if (tilingOf(index) === undefined)
180
+ return false;
181
+ return index.fields.slice(0, -2).every(field => {
182
+ const choice = where.get(field);
183
+ return choice?.type === "values" && choice.value.length > 0 && (!index.sets.has(field) || new Set(choice.value).size === 1);
184
+ });
185
+ }
186
+ /**
187
+ * The index of a binding's that reads a narrowing's cells: of its series
188
+ * indexes — or its summary indexes — whose leading fields the narrowing
189
+ * chooses exactly ({@link tileIndexServes}), the one led by the most of them,
190
+ * so the fewest of the narrowing's choices are left for the reader to ask; of
191
+ * two led by as many, the one listed first.
192
+ *
193
+ * @param indexes - The binding's indexes
194
+ * @param where - The narrowing
195
+ * @param which - A series index, or a summary index
196
+ * @param accept - Which tiles the reader takes; every tile by default
197
+ * @returns The index, or `undefined` when none serves the narrowing
198
+ */
199
+ export function tileIndexFor(indexes, where, which, accept = () => true) {
200
+ let best;
201
+ for (const index of indexes) {
202
+ const tiling = which === "series" ? index.series : index.summary;
203
+ if (tiling.type !== "some" || !accept(tiling.value.tile.type) || !tileIndexServes(index, where))
204
+ continue;
205
+ if (best === undefined || index.fields.length > best.fields.length)
206
+ best = index;
207
+ }
208
+ return best;
209
+ }
210
+ const printTile = printFor(DateTimeType);
211
+ const sameInstant = equalFor(DateTimeType);
212
+ /**
213
+ * Plan a cell of a series or a summary index: some keys in one tile, a search
214
+ * for each key under each combination of the narrowing's values of the index's
215
+ * leading fields, `[…on, tile, key]`, holding that key's entries in that tile
216
+ * and no other's. A range of the index's start field — the window — is the
217
+ * reader's: its tiles cover it.
218
+ *
219
+ * @param index - A series or a summary index ({@link tileIndexFor})
220
+ * @param where - The narrowing
221
+ * @param tile - The tile's start ({@link tilesOver})
222
+ * @param keys - The keys, as `.east` literals of the index's key field
223
+ * @returns The cell's searches, and the fields the reader asks of each event
224
+ * @throws {Error} When the index is neither, when the narrowing does not choose
225
+ * exact values of each of its leading fields (one of a Set's), when the
226
+ * combinations of them pass {@link MAX_RECORD_SLICE_RUNS}, or when `tile` is
227
+ * not the start of one of the index's tiles
228
+ */
229
+ export function tileCellQueries(index, where, tile, keys) {
230
+ const tiling = tilingOf(index);
231
+ if (tiling === undefined)
232
+ throw new Error(`A cell reads a series or a summary index, and '${index.name}' is neither`);
233
+ if (!sameInstant(tileStart(tiling.tile.type, tile), tile)) {
234
+ throw new Error(`${printTile(tile)} starts no ${tiling.tile.type} tile of '${index.name}'`);
235
+ }
236
+ const leading = index.fields.slice(0, -2);
237
+ let prefixes = [[]];
238
+ for (const field of leading) {
239
+ const choice = where.get(field);
240
+ if (choice?.type !== "values" || choice.value.length === 0) {
241
+ throw new Error(`A cell of '${index.name}' takes exact values of '${field}', which leads it: choose them, or read the cells of an index it does not lead`);
242
+ }
243
+ const values = [...new Set(choice.value)];
244
+ if (index.sets.has(field) && values.length !== 1) {
245
+ throw new Error(`A cell of '${index.name}' takes one value of '${field}', which fans out over a Set`);
246
+ }
247
+ if (prefixes.length * values.length > MAX_RECORD_SLICE_RUNS) {
248
+ throw new Error(`A cell of '${index.name}' needs more than ${MAX_RECORD_SLICE_RUNS} searches a key; choose fewer values`);
249
+ }
250
+ prefixes = prefixes.flatMap(prefix => values.map(value => [...prefix, value]));
251
+ }
252
+ const at = printTile(tile);
253
+ const queries = prefixes.flatMap(prefix => keys.map(key => variant("fields", { values: [...prefix, at, key], prefix: none })));
254
+ const residual = [...where].filter(([field, choice]) => !leading.includes(field) && !(field === tiling.from && choice.type === "range"))
255
+ .map(([field]) => field);
256
+ return { queries, residual };
257
+ }
258
+ //# sourceMappingURL=record-series.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-series.js","sourceRoot":"","sources":["../../../../src/platform/slice/record-series.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAoB,M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