@elaraai/e3 1.0.98 → 1.0.100

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 (146) hide show
  1. package/README.md +4 -5
  2. package/dist/src/browser.d.ts +2 -0
  3. package/dist/src/browser.d.ts.map +1 -1
  4. package/dist/src/browser.js +6 -0
  5. package/dist/src/browser.js.map +1 -1
  6. package/dist/src/environment-capture.d.ts +21 -0
  7. package/dist/src/environment-capture.d.ts.map +1 -1
  8. package/dist/src/environment-capture.js +48 -0
  9. package/dist/src/environment-capture.js.map +1 -1
  10. package/dist/src/export.d.ts +10 -5
  11. package/dist/src/export.d.ts.map +1 -1
  12. package/dist/src/export.js +31 -47
  13. package/dist/src/export.js.map +1 -1
  14. package/dist/src/export.spec.js +27 -16
  15. package/dist/src/export.spec.js.map +1 -1
  16. package/dist/src/function.d.ts.map +1 -1
  17. package/dist/src/function.js.map +1 -1
  18. package/dist/src/functions-cache.d.ts +60 -0
  19. package/dist/src/functions-cache.d.ts.map +1 -0
  20. package/dist/src/functions-cache.js +165 -0
  21. package/dist/src/functions-cache.js.map +1 -0
  22. package/dist/src/functions-link.spec.js +191 -12
  23. package/dist/src/functions-link.spec.js.map +1 -1
  24. package/dist/src/functions-resolve.d.ts +52 -23
  25. package/dist/src/functions-resolve.d.ts.map +1 -1
  26. package/dist/src/functions-resolve.js +244 -96
  27. package/dist/src/functions-resolve.js.map +1 -1
  28. package/dist/src/index.d.ts +8 -61
  29. package/dist/src/index.d.ts.map +1 -1
  30. package/dist/src/index.js +3 -8
  31. package/dist/src/index.js.map +1 -1
  32. package/dist/src/internal.d.ts +53 -0
  33. package/dist/src/internal.d.ts.map +1 -0
  34. package/dist/src/internal.js +29 -0
  35. package/dist/src/internal.js.map +1 -0
  36. package/dist/src/lazy-build.d.ts +25 -0
  37. package/dist/src/lazy-build.d.ts.map +1 -0
  38. package/dist/src/lazy-build.js +56 -0
  39. package/dist/src/lazy-build.js.map +1 -0
  40. package/dist/src/lazy-build.spec.d.ts +6 -0
  41. package/dist/src/lazy-build.spec.d.ts.map +1 -0
  42. package/dist/src/lazy-build.spec.js +153 -0
  43. package/dist/src/lazy-build.spec.js.map +1 -0
  44. package/dist/src/migration.d.ts +20 -163
  45. package/dist/src/migration.d.ts.map +1 -1
  46. package/dist/src/migration.js +37 -34
  47. package/dist/src/migration.js.map +1 -1
  48. package/dist/src/migration.spec.js +83 -78
  49. package/dist/src/migration.spec.js.map +1 -1
  50. package/dist/src/mutation-programs.spec.js +211 -118
  51. package/dist/src/mutation-programs.spec.js.map +1 -1
  52. package/dist/src/mutation.d.ts +37 -141
  53. package/dist/src/mutation.d.ts.map +1 -1
  54. package/dist/src/mutation.js +66 -28
  55. package/dist/src/mutation.js.map +1 -1
  56. package/dist/src/open-beast-link.spec.js +1 -1
  57. package/dist/src/open-beast-link.spec.js.map +1 -1
  58. package/dist/src/output.js.map +1 -1
  59. package/dist/src/package.d.ts +2 -38
  60. package/dist/src/package.d.ts.map +1 -1
  61. package/dist/src/package.js +42 -175
  62. package/dist/src/package.js.map +1 -1
  63. package/dist/src/record-area.d.ts +49 -37
  64. package/dist/src/record-area.d.ts.map +1 -1
  65. package/dist/src/record-area.js +211 -131
  66. package/dist/src/record-area.js.map +1 -1
  67. package/dist/src/record-area.spec.js +79 -62
  68. package/dist/src/record-area.spec.js.map +1 -1
  69. package/dist/src/record-arguments.d.ts +55 -0
  70. package/dist/src/record-arguments.d.ts.map +1 -0
  71. package/dist/src/record-arguments.js +72 -0
  72. package/dist/src/record-arguments.js.map +1 -0
  73. package/dist/src/record-builders.d.ts +547 -0
  74. package/dist/src/record-builders.d.ts.map +1 -0
  75. package/dist/src/record-builders.js +112 -0
  76. package/dist/src/record-builders.js.map +1 -0
  77. package/dist/src/record-declared.spec.d.ts +6 -0
  78. package/dist/src/record-declared.spec.d.ts.map +1 -0
  79. package/dist/src/record-declared.spec.js +251 -0
  80. package/dist/src/record-declared.spec.js.map +1 -0
  81. package/dist/src/record-guards.d.ts +114 -1
  82. package/dist/src/record-guards.d.ts.map +1 -1
  83. package/dist/src/record-guards.js +153 -2
  84. package/dist/src/record-guards.js.map +1 -1
  85. package/dist/src/record-index.d.ts +128 -350
  86. package/dist/src/record-index.d.ts.map +1 -1
  87. package/dist/src/record-index.js +44 -481
  88. package/dist/src/record-index.js.map +1 -1
  89. package/dist/src/record-index.spec.js +124 -90
  90. package/dist/src/record-index.spec.js.map +1 -1
  91. package/dist/src/record-interval.d.ts +57 -36
  92. package/dist/src/record-interval.d.ts.map +1 -1
  93. package/dist/src/record-interval.js +136 -94
  94. package/dist/src/record-interval.js.map +1 -1
  95. package/dist/src/record-interval.spec.js +48 -27
  96. package/dist/src/record-interval.spec.js.map +1 -1
  97. package/dist/src/record-keys.d.ts +146 -0
  98. package/dist/src/record-keys.d.ts.map +1 -0
  99. package/dist/src/record-keys.js +178 -0
  100. package/dist/src/record-keys.js.map +1 -0
  101. package/dist/src/record-nested-programs.d.ts +1457 -0
  102. package/dist/src/record-nested-programs.d.ts.map +1 -0
  103. package/dist/src/record-nested-programs.js +1974 -0
  104. package/dist/src/record-nested-programs.js.map +1 -0
  105. package/dist/src/record-nested.d.ts +284 -0
  106. package/dist/src/record-nested.d.ts.map +1 -0
  107. package/dist/src/record-nested.js +304 -0
  108. package/dist/src/record-nested.js.map +1 -0
  109. package/dist/src/record-nested.spec.d.ts +6 -0
  110. package/dist/src/record-nested.spec.d.ts.map +1 -0
  111. package/dist/src/record-nested.spec.js +1032 -0
  112. package/dist/src/record-nested.spec.js.map +1 -0
  113. package/dist/src/record-patches.d.ts +25 -0
  114. package/dist/src/record-patches.d.ts.map +1 -0
  115. package/dist/src/record-patches.js +27 -0
  116. package/dist/src/record-patches.js.map +1 -0
  117. package/dist/src/record-programs.d.ts +192 -26
  118. package/dist/src/record-programs.d.ts.map +1 -1
  119. package/dist/src/record-programs.js +858 -350
  120. package/dist/src/record-programs.js.map +1 -1
  121. package/dist/src/record-programs.spec.d.ts +6 -0
  122. package/dist/src/record-programs.spec.d.ts.map +1 -0
  123. package/dist/src/record-programs.spec.js +242 -0
  124. package/dist/src/record-programs.spec.js.map +1 -0
  125. package/dist/src/record-series.d.ts +101 -97
  126. package/dist/src/record-series.d.ts.map +1 -1
  127. package/dist/src/record-series.js +198 -149
  128. package/dist/src/record-series.js.map +1 -1
  129. package/dist/src/record-series.spec.js +241 -120
  130. package/dist/src/record-series.spec.js.map +1 -1
  131. package/dist/src/record-tiles.d.ts +328 -37
  132. package/dist/src/record-tiles.d.ts.map +1 -1
  133. package/dist/src/record-tiles.js +289 -100
  134. package/dist/src/record-tiles.js.map +1 -1
  135. package/dist/src/record.d.ts +66 -12
  136. package/dist/src/record.d.ts.map +1 -1
  137. package/dist/src/record.js +103 -34
  138. package/dist/src/record.js.map +1 -1
  139. package/dist/src/record.spec.js +48 -63
  140. package/dist/src/record.spec.js.map +1 -1
  141. package/dist/src/task.d.ts.map +1 -1
  142. package/dist/src/task.js +4 -1
  143. package/dist/src/task.js.map +1 -1
  144. package/dist/src/types.d.ts +103 -37
  145. package/dist/src/types.d.ts.map +1 -1
  146. package/package.json +7 -3
@@ -0,0 +1,547 @@
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
+ * The builders a record declared whole hands its declaration.
7
+ *
8
+ * `e3.record(name, type, { indexes, mutations, migrations })` calls each of
9
+ * these with a builder typed by the record's state — `index`, `mutation` and
10
+ * `migration` — and builds what they return under its name, as the record is
11
+ * declared: its indexes and mutations by their keys, its migrations in order.
12
+ * Each part is checked there, every refusal naming the record and the part, and
13
+ * TypeScript reads each part's name and types off the one call.
14
+ */
15
+ import type { CallableFunctionExpr, DictType, EastType, FunctionExpr, NullType, PatchTypeOf, StructType } from '@elaraai/east';
16
+ import type { RecordSummaryTotalsType } from '@elaraai/e3-types';
17
+ import type { MigrationDef, MutationDef, RecordDef, RecordIndexDef } from './types.js';
18
+ import type { AreaIndexOf, AreaIndexSpec, IndexKeyOf, IndexOn, IntervalIndexSpec, NestedKeyOf, NestedSeriesIndexSpec, NestedValueOf, ProjectionOf, SeriesIndexSpec, SummaryIndexSpec, SummaryKeyOf, TimeTileOf } from './record-index.js';
19
+ import { items, recursive, rows, values, type NestedOf } from './record-nested.js';
20
+ import type { IndexFunction } from './record-guards.js';
21
+ import type { FunctionRunner } from './runner.js';
22
+ /** A Dict record's row type. */
23
+ type RowOf<T> = T extends DictType<unknown, infer V extends EastType> ? V : EastType;
24
+ /** A Dict record's row fields, by name. */
25
+ type RowFields<T> = T extends DictType<unknown, StructType<infer F>> ? F : Record<never, never>;
26
+ /** The name of one of a Dict record's row fields. */
27
+ type Field<T> = keyof RowFields<T> & string;
28
+ /** The key of a part a builder makes: what `e3.record` builds the part by. */
29
+ export declare const RECORD_PART: unique symbol;
30
+ /** A part's runner selection (known runtimes only, as `e3.function`'s). */
31
+ export interface PartRunner {
32
+ /** The runner its functions run on. */
33
+ readonly runner?: FunctionRunner;
34
+ }
35
+ /** A plain index's options: the projection its entries carry, and its runner. */
36
+ export interface PlainIndexOptions extends PartRunner {
37
+ /** `(K, V) -> P`: what a view renders from the index alone, so it never reads the record's segments. */
38
+ readonly value?: IndexFunction;
39
+ }
40
+ /**
41
+ * An index the `index` builder makes, which `e3.record` builds under its key.
42
+ *
43
+ * @typeParam IK - The index key an entry sorts under
44
+ * @typeParam P - What each entry carries
45
+ * @typeParam On - The row fields leading it, as written
46
+ * @typeParam Extra - Its kind's own part of the definition
47
+ */
48
+ export interface IndexDraft<IK extends EastType = EastType, P extends EastType = EastType, On extends readonly string[] | undefined = readonly string[] | undefined, Extra = unknown> {
49
+ /** How the record builds it under its name. */
50
+ readonly [RECORD_PART]: {
51
+ readonly part: 'index';
52
+ readonly build: (record: RecordDef, name: string) => RecordIndexDef;
53
+ };
54
+ /** Its types, for TypeScript alone: never set. */
55
+ readonly types?: {
56
+ readonly key: IK;
57
+ readonly value: P;
58
+ readonly on: On;
59
+ readonly extra: Extra;
60
+ };
61
+ }
62
+ /**
63
+ * A mutation the `mutation` builder makes, which `e3.record` builds under its key.
64
+ *
65
+ * @typeParam Args - The arguments it takes after the state
66
+ */
67
+ export interface MutationDraft<Args extends readonly EastType[] = readonly EastType[]> {
68
+ /** How the record builds it under its name. */
69
+ readonly [RECORD_PART]: {
70
+ readonly part: 'mutation';
71
+ readonly build: (record: RecordDef, name: string) => MutationDef;
72
+ };
73
+ /** Its types, for TypeScript alone: never set. */
74
+ readonly types?: {
75
+ readonly args: Args;
76
+ };
77
+ }
78
+ /** A migration step the `migration` builder makes, which `e3.record` builds in its place in the list. */
79
+ export interface MigrationDraft {
80
+ /** How the record builds it, after the step before it in the list (none for the first). */
81
+ readonly [RECORD_PART]: {
82
+ readonly part: 'migration';
83
+ readonly build: (record: RecordDef, previous: MigrationDef | undefined) => MigrationDef;
84
+ };
85
+ }
86
+ /**
87
+ * The nested series index's builder, `index.nested`, and the builders of the
88
+ * collections it files.
89
+ *
90
+ * @typeParam T - The record's state type
91
+ */
92
+ export interface NestedBuilder<T extends EastType> {
93
+ /**
94
+ * A nested series index (#1434): every collection the record's rows nest,
95
+ * filed in time. Each item is filed once (or once a year past a year) by its
96
+ * collection, its row, the node holding it and its time, carrying the item;
97
+ * each node's totals are kept a `summary` tile at a time; every parent's
98
+ * subtotals of a collection of values declared with a rollup are kept at every
99
+ * level from `tile` up; and each item of a collection declared `{ rollup: true }`
100
+ * is filed under every ancestor too. The record's other indexes then carry its
101
+ * rows without the listed collections, so a page of rows reads no nested item,
102
+ * and `Data.bindPaged` asks it beside any of them (#1435). A record has one; no
103
+ * field leads it, and it takes no `value`.
104
+ *
105
+ * @param spec - `collections`, each declared with {@link items}, {@link values}, {@link rows} or {@link recursive};
106
+ * `tile`, the finest level an item is filed at; `summary`, the tile each node's totals are kept by
107
+ * @param options - Its runner
108
+ * @returns The index, its key e3-types' `NestedEntryKeyType` and its value `NestedEntryType`
109
+ * @throws {Error} Where a collection's declaration does not fit its field, naming the collection and what to write;
110
+ * for a tile of none of the five; or for a second nested series index on the record, naming the first
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * const machines = e3.record('machines', MachinesType, {
115
+ * initial: new Map(),
116
+ * indexes: (index) => ({
117
+ * // Every collection a machine nests, filed from a week up and totalled a month at a time:
118
+ * machines_in_time: index.nested({
119
+ * collections: {
120
+ * jobs: index.nested.items({ from: 'start', to: 'end' }),
121
+ * load: index.nested.values(),
122
+ * },
123
+ * tile: 'week',
124
+ * summary: 'month',
125
+ * }),
126
+ * }),
127
+ * });
128
+ * ```
129
+ */
130
+ <const S extends NestedSeriesIndexSpec<T>>(spec: S, options?: PartRunner): IndexDraft<NestedKeyOf<T>, NestedValueOf<T, S>, readonly [], {
131
+ readonly nested: NestedOf<S>;
132
+ }>;
133
+ /** A collection of items, each placed by its times: things people drag. */
134
+ readonly items: typeof items;
135
+ /** A collection of values, one per instant. */
136
+ readonly values: typeof values;
137
+ /** A collection of child rows, which nest collections of their own. */
138
+ readonly rows: typeof rows;
139
+ /** A field holding more rows like the one listing it. */
140
+ readonly recursive: typeof recursive;
141
+ }
142
+ /**
143
+ * The `index` builder a record declared whole hands its `indexes`: one
144
+ * method a kind, each typed by the record's rows, so a field it names is one of
145
+ * the row's.
146
+ *
147
+ * An index is a second collection over a Dict record, `Dict<{ik, k}, P>` — the
148
+ * index key first, the primary key second — maintained in the same commit as
149
+ * the record, so every entry sharing an index key is one contiguous run, ordered
150
+ * by primary key inside it, and a range of index keys is one contiguous run too.
151
+ * Pages and key searches take it by its name; a view that renders from the index
152
+ * alone declares what it renders as `value`, and never reads the record's
153
+ * segments. Its functions are pure for the reason a reducer is: they run again
154
+ * on every commit and in every build, and a maintained index must equal a
155
+ * rebuilt one to the byte. Its name is an identifier, never `primary`.
156
+ *
157
+ * The indexes that answer more than an order — `interval`, `area`, `series`,
158
+ * `summary` and `nested` — have keys the SDK generates: the row's leading
159
+ * fields under `on` (#1432), e3's own parts beside them, so no row field's
160
+ * name is reserved.
161
+ *
162
+ * @typeParam T - The record's state type, a Dict of Struct rows
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const plans = e3.record('plans', DictType(PlanKeyType, PlanRowType), {
167
+ * initial: new Map(),
168
+ * indexes: (index) => ({
169
+ * // A row field supplies its own key type.
170
+ * by_due: index.on(['due']),
171
+ * // One key per row, with a covering projection: a queue renders from the index alone.
172
+ * by_status: index.key(
173
+ * East.function([PlanKeyType, PlanRowType], StatusKeyType, ($, k, v) => ({ status: v.status, due: v.due })),
174
+ * { value: East.function([PlanKeyType, PlanRowType], QueueCardType, ($, k, v) => ({ title: v.title, owner: v.owner })) },
175
+ * ),
176
+ * // Many keys per row: a Set return.
177
+ * by_resource: index.keys(East.function([PlanKeyType, PlanRowType], SetType(ResourceRefType), ($, k, v) => v.resources)),
178
+ * // The plans overlapping a window of time, a status chosen beside it in one read:
179
+ * by_status_time: index.interval({ on: ['status'], from: 'start', to: 'end' }),
180
+ * }),
181
+ * });
182
+ * ```
183
+ */
184
+ export interface IndexBuilder<T extends EastType> {
185
+ /**
186
+ * An index led by row fields: the rows in the order of their values. One
187
+ * field uses its value as the key, several a Struct of them in their order. A
188
+ * Set field fans out, a row under each of its elements.
189
+ *
190
+ * @param fields - The row fields, in key order: one or more
191
+ * @param options - `value`, what each entry carries; its runner
192
+ * @returns The index
193
+ * @throws {Error} When a field is not one of the row's, or none is named
194
+ */
195
+ on<const F extends readonly Field<T>[], const O extends PlainIndexOptions = Record<never, never>>(fields: F, options?: O): IndexDraft<IndexKeyOf<{
196
+ on: F;
197
+ }, T>, ProjectionOf<O>, F>;
198
+ /**
199
+ * An index by a key each row computes: `(K, V) -> IK`, one entry a row.
200
+ *
201
+ * @param fn - The key function
202
+ * @param options - `value`, what each entry carries; its runner
203
+ * @returns The index
204
+ * @throws {Error} When the function is async, calls a platform function or does not take the record's key and row
205
+ */
206
+ key<const F extends IndexFunction, const O extends PlainIndexOptions = Record<never, never>>(fn: F, options?: O): IndexDraft<IndexKeyOf<{
207
+ key: F;
208
+ }, T>, ProjectionOf<O>, undefined>;
209
+ /**
210
+ * An index by many keys a row computes, `(K, V) -> Set<IK>`: a row under each
211
+ * key, so one naming five resources appears under five, and none under an
212
+ * empty set — how a partial index is written.
213
+ *
214
+ * @param fn - The keys function
215
+ * @param options - `value`, what each entry carries; its runner
216
+ * @returns The index
217
+ * @throws {Error} As {@link key} does, and when it does not return a Set
218
+ */
219
+ keys<const F extends IndexFunction, const O extends PlainIndexOptions = Record<never, never>>(fn: F, options?: O): IndexDraft<IndexKeyOf<{
220
+ keys: F;
221
+ }, T>, ProjectionOf<O>, undefined>;
222
+ /**
223
+ * An interval index: the events overlapping a half-open time window
224
+ * `[from, to)`, carry-in events and those spanning the whole window among
225
+ * them, each once, without day fan-out or a guessed lookback. Each event is
226
+ * filed under at most three entries a combination of its leading fields,
227
+ * whatever its length — a centred interval tree laid along the index's key
228
+ * order, its key `{ on: { …on }, node, at }` — so a record Slice reads a
229
+ * window as one start range and at most 54 carry-in ranges a combination. A
230
+ * missing start is the backlog, selectable as Unset; a missing or
231
+ * non-positive end is an instant.
232
+ *
233
+ * @param spec - `from` and `to`, the row's DateTime (or Option<DateTime>) fields an event starts and ends at, and
234
+ * the optional exact leading `on` fields
235
+ * @param options - Its runner
236
+ * @returns The index
237
+ * @throws {Error} When `from` or `to` is not a DateTime field, or the start is a leading field
238
+ */
239
+ interval<const S extends IntervalIndexSpec<T>>(spec: S, options?: PartRunner): IndexDraft<IndexKeyOf<S, T>, NullType, IndexOn<S>, {
240
+ readonly interval: {
241
+ readonly from: S['from'];
242
+ readonly to: S['to'];
243
+ };
244
+ }>;
245
+ /**
246
+ * An area index: the rows whose box meets a window, each once — the 2D twin of
247
+ * {@link interval}. A loose quadtree laid along a Z-order curve: the domain is
248
+ * the square `[−cell·2²⁷, cell·2²⁷)` world units in 29 levels, and each row is
249
+ * filed once, under the deepest level whose cell is at least twice its box's
250
+ * larger side, in the cell holding its box's centre, its key
251
+ * `{ on: { …on }, area }`. A row whose `x` or `y` is `none` is unplaced, `area`
252
+ * −1; one outside the domain, not finite, or larger than half the domain is
253
+ * filed under the root. A record Slice reads a window as at most 266 disjoint
254
+ * searches a combination of its leading fields. Each entry carries its row, so
255
+ * a window reads the index alone; it takes no `value`.
256
+ *
257
+ * @param spec - The box's fields — `x`, `y` (Float, or Option<Float> for a row that may be unplaced), `width` and
258
+ * `height` (Float, or neither for a point) — `at` (`"corner"`, the default, or `"centre"`), `cell` (the finest
259
+ * cell's side in world units, rounded down to a power of two) and the optional exact leading `on` fields
260
+ * @param options - Its runner
261
+ * @returns The index, its projection the row
262
+ * @throws {Error} When a field is not of its option's type, naming the option, the field and its type; when `x`
263
+ * and `y` are not both Options or neither, or `width` and `height` are not given together; or when `cell` is not
264
+ * a positive number
265
+ */
266
+ area<const S extends AreaIndexSpec<T>>(spec: S, options?: PartRunner): IndexDraft<IndexKeyOf<S, T>, RowOf<T>, IndexOn<S>, {
267
+ readonly area: AreaIndexOf<S>;
268
+ }>;
269
+ /**
270
+ * A series index (#1039): the record's events by the key they are on — a
271
+ * Plan's resource — and by time, so a key's events over any span are one
272
+ * contiguous range a level (#1433). An event `[from, to)` is filed once, its
273
+ * key `{ on: { …on }, key, level, tile }`: at the finest level, from `tile` up
274
+ * to `year`, whose shortest tile holds its length — a day, a week, 28 days, 90
275
+ * days, 365 days — under that level's tile holding its start; past 365 days,
276
+ * under each year it touches, as many as 4,096. An instant is filed at
277
+ * `tile`; a row with no start is filed nowhere. Each entry carries its row, so
278
+ * a cell reads the index alone; it takes no `value`.
279
+ *
280
+ * @param spec - `key`, the field naming what an event is on (any but a Set); `from` and `to`, its DateTime (or
281
+ * Option<DateTime>) start and end fields; `tile`, `day`, `week`, `month`, `quarter` or `year`; and the optional
282
+ * exact leading `on` fields
283
+ * @param options - Its runner
284
+ * @returns The index, its projection the row
285
+ * @throws {Error} When a field is not of its option's type, naming the option, the field and its type; when the
286
+ * tile is not one of the five; when the key is a leading field; or for `collections`, which are
287
+ * {@link NestedBuilder | the nested index's}
288
+ */
289
+ series<const S extends SeriesIndexSpec<T>>(spec: S, options?: PartRunner): IndexDraft<IndexKeyOf<S, T>, RowOf<T>, IndexOn<S>, {
290
+ readonly series: TimeTileOf<S>;
291
+ }>;
292
+ /** The nested series index, and the builders of the collections it files. */
293
+ readonly nested: NestedBuilder<T>;
294
+ /**
295
+ * A summary index (#1039): under each key and tile of a series index, how many
296
+ * rows touch the tile and the milliseconds of it they cover — what a
297
+ * zoomed-out view draws where its events are too many to read. Its entries are
298
+ * `{ ik: { on: { …on }, key, tile }, k: Null }` → `{ count, ms }`. A write
299
+ * changes them by what its rows took away and gave, summed, and a total whose
300
+ * count reaches zero is dropped, so a maintained summary equals the one a
301
+ * reindex sums, byte for byte. An event's share of a tile is the milliseconds
302
+ * of it the event overlaps; an instant counts in the tile holding it and
303
+ * covers none of it; a row with no start counts in no tile.
304
+ *
305
+ * @param spec - `key`, `from`, `to` and `tile`, as {@link series} takes them, and the optional exact leading `on`
306
+ * fields
307
+ * @param options - Its runner
308
+ * @returns The index, its value the totals
309
+ * @throws {Error} As {@link series} does, and for an event touching more than 4,096 tiles where it is written
310
+ */
311
+ summary<const S extends SummaryIndexSpec<T>>(spec: S, options?: PartRunner): IndexDraft<SummaryKeyOf<S, T>, typeof RecordSummaryTotalsType, IndexOn<S>, {
312
+ readonly summary: TimeTileOf<S>;
313
+ }>;
314
+ }
315
+ /**
316
+ * The `mutation` builder a record declared whole hands its `mutations`: its
317
+ * write forms, each typed by the record's state.
318
+ *
319
+ * Every form commits the same thing, a delta of the primary's and every
320
+ * index's changes addressed by key, which e3 applies segment by segment; they
321
+ * differ in how the author says what changed, and so in what a write costs.
322
+ * Each is pure, synchronous East — no async body and no platform call —
323
+ * since the compare-and-swap loop re-runs a mutation against fresher state
324
+ * when its write conflicts. A mutation's name is an identifier: it names the
325
+ * record's commits beside e3's own, which begin with `$`, and `e3 mutate`
326
+ * addresses it as `record.mutation`.
327
+ *
328
+ * @typeParam T - The record's state type
329
+ *
330
+ * @example
331
+ * ```ts
332
+ * const PlansType = DictType(StringType, PlanType);
333
+ * const plans = e3.record('plans', PlansType, {
334
+ * initial: new Map(),
335
+ * mutations: (mutation) => ({
336
+ * add_plan: mutation.reduce(East.function([PlansType, StringType, PlanType], PlansType, ($, state, id, plan) => {
337
+ * const next = $.let(state.copy()); // the state is a frozen input: copy first
338
+ * $(next.insert(id, plan));
339
+ * return next;
340
+ * })),
341
+ * reschedule: mutation.edit(East.function([PlansType, StringType, DateTimeType, e3.mutation.editType(PlansType)], NullType,
342
+ * ($, state, id, due, edit) => {
343
+ * const plan = $.let(state.get(id)); // decodes one segment, not the record
344
+ * $(edit.set(id, { title: plan.title, owner: plan.owner, due }));
345
+ * })),
346
+ * patch: mutation.patch(), // a view's save
347
+ * }),
348
+ * });
349
+ * ```
350
+ */
351
+ export interface MutationBuilder<T extends EastType> {
352
+ /**
353
+ * A reducer of the whole state, `(state, ...args) => state`, for any record:
354
+ * its first parameter and its return are the record's state, its other
355
+ * parameters the mutation's arguments, read off its signature. The state is a
356
+ * frozen input — derive the new state from a `.copy()`, or build it fresh. It
357
+ * sees the whole state, so it costs the record's size in its runner however
358
+ * little it changes; only its write, for a Dict or Set record, is what it
359
+ * touched — any other record is written whole. {@link edit} reads and writes
360
+ * only the entries it touches.
361
+ *
362
+ * @param fn - The reducer
363
+ * @param options - Its runner
364
+ * @returns The mutation
365
+ * @throws {Error} When the body is async or calls a platform function, or its first parameter or its return is not
366
+ * the record's state
367
+ */
368
+ reduce<Args extends EastType[]>(fn: FunctionExpr<[T, ...Args], T> | CallableFunctionExpr<[T, ...Args], T>, options?: PartRunner): MutationDraft<Args>;
369
+ /**
370
+ * A body writing through an `edit` capability, `(state, ...args, edit) => null`
371
+ * — the lazy write, for a Dict or Set record. It reads the state lazily, so a
372
+ * body that looks at ten entries of a two-million-entry record decodes the
373
+ * segments those ten live in, and writes through `edit.set(key, value)`,
374
+ * `edit.delete(key)` and `edit.update(key, patch)`, so its commit rewrites only
375
+ * the segments it touched. Repeated edits of one key fold; a `set` of the
376
+ * value the record already holds is no change; a `delete` or `update` of a key
377
+ * the record does not hold is a conflict naming the key. Its last parameter is
378
+ * the capability, `e3.mutation.editType(type)` of the record's type.
379
+ *
380
+ * @param fn - The body
381
+ * @param options - Its runner
382
+ * @returns The mutation
383
+ * @throws {Error} When the record is not a Dict or a Set, the body is async or calls a platform function, its first
384
+ * parameter is not the record's state or its last the capability, or it does not return Null
385
+ */
386
+ edit<Args extends EastType[], E extends EastType>(fn: FunctionExpr<[T, ...Args, E], NullType> | CallableFunctionExpr<[T, ...Args, E], NullType>, options?: PartRunner): MutationDraft<Args>;
387
+ /**
388
+ * The door for a patch a client computed, for a Dict or Set record: no body,
389
+ * its argument the change, a `PatchType` of the state — what `Record.bind`
390
+ * writes an interactive edit through, and what an integration sending diffs
391
+ * calls. On a record with no index, a patch of per-key changes is the delta
392
+ * itself and no program runs, so its cost is independent of the record's size;
393
+ * any other patch runs a program that checks it against the state, and on a
394
+ * record with indexes computes the entries the change moves.
395
+ *
396
+ * @param options - Its runner
397
+ * @returns The mutation
398
+ * @throws {Error} When the record is not a Dict or a Set
399
+ */
400
+ patch(options?: PartRunner): MutationDraft<[PatchTypeOf<T>]>;
401
+ }
402
+ /**
403
+ * The `migration` builder a record declared whole hands its `migrations`: the
404
+ * step forms, each named, the list's order its chain.
405
+ *
406
+ * A deploy runs the steps a workspace has not applied, in order, a
407
+ * `$migrate:<name>` commit each, and records each by its name, so a step keeps
408
+ * its identity when its code moves or its package is re-exported. Each step
409
+ * takes the record as the step before it leaves it, and the last leaves it as
410
+ * its declared type. Each function is pure, synchronous East, as a mutation's
411
+ * is: a step runs again in every workspace that has not applied it, a piece at a
412
+ * time, and must migrate every one the same way.
413
+ *
414
+ * @example
415
+ * ```ts
416
+ * const RowV1Type = StructType({ title: StringType });
417
+ * const RowV2Type = StructType({ title: StringType, owner: StringType });
418
+ * const plans = e3.record('plans', DictType(StringType, RowV2Type), {
419
+ * initial: new Map(),
420
+ * migrations: (migration) => [
421
+ * // Each row gains an owner; the keys are unchanged.
422
+ * migration.rows('add_owner', East.function([StringType, RowV1Type], RowV2Type,
423
+ * ($, id, row) => ({ title: row.title, owner: 'unassigned' }))),
424
+ * ],
425
+ * });
426
+ * ```
427
+ */
428
+ export interface MigrationBuilder {
429
+ /**
430
+ * A step over the whole state, `(Old) => New`, for a record of any type. It
431
+ * runs as one unit whose runner opens the state lazily, so a step that reads
432
+ * little of a large record costs little, and one that rebuilds it costs the
433
+ * record.
434
+ *
435
+ * @param name - The step: an identifier, unique on the record, by which a workspace records it has applied it
436
+ * @param fn - The step's function
437
+ * @param options - Its runner
438
+ * @returns The step
439
+ * @throws {Error} When the name is not an identifier, the function is async, calls a platform function or takes
440
+ * other than the one state, or the step before it leaves the record as another type than `Old`
441
+ */
442
+ value<From extends EastType, To extends EastType>(name: string, fn: FunctionExpr<[From], To> | CallableFunctionExpr<[From], To>, options?: PartRunner): MigrationDraft;
443
+ /**
444
+ * A step over an Array's elements, `(T1) => T2`, in order: a task split over
445
+ * the stored state, so a record of any size migrates a piece at a time, in
446
+ * parallel, each piece cached.
447
+ *
448
+ * @param name - The step
449
+ * @param fn - The step's function
450
+ * @param options - Its runner
451
+ * @returns The step
452
+ * @throws {Error} As {@link value} does
453
+ */
454
+ rows<E1 extends EastType, E2 extends EastType>(name: string, fn: FunctionExpr<[E1], E2> | CallableFunctionExpr<[E1], E2>, options?: PartRunner): MigrationDraft;
455
+ /**
456
+ * A step over a Dict's rows, `(K, V1) => V2`, its keys unchanged, a piece at a
457
+ * time, as an Array's elements are.
458
+ *
459
+ * @param name - The step
460
+ * @param fn - The step's function
461
+ * @param options - Its runner
462
+ * @returns The step
463
+ * @throws {Error} As {@link value} does
464
+ */
465
+ rows<K extends EastType, V1 extends EastType, V2 extends EastType>(name: string, fn: FunctionExpr<[K, V1], V2> | CallableFunctionExpr<[K, V1], V2>, options?: PartRunner): MigrationDraft;
466
+ /**
467
+ * A step re-keying a Set's elements, `(T1) => T2`: two landing on one are one
468
+ * element, as in any Set, and nothing is lost.
469
+ *
470
+ * @param name - The step
471
+ * @param fn - The step's function
472
+ * @param options - Its runner
473
+ * @returns The step
474
+ * @throws {Error} As {@link value} does
475
+ */
476
+ rekey<E1 extends EastType, E2 extends EastType>(name: string, fn: FunctionExpr<[E1], E2> | CallableFunctionExpr<[E1], E2>, options?: PartRunner): MigrationDraft;
477
+ /**
478
+ * A step re-keying a Dict's entries, `(K1, V1) => { key: K2, value: V2 }`: the
479
+ * task {@link rows} runs, its pieces' outputs merged by key. Two rows landing
480
+ * on one key fail the deploy, naming it, since their values may differ and
481
+ * neither can be chosen.
482
+ *
483
+ * @param name - The step
484
+ * @param fn - The step's function
485
+ * @param options - Its runner
486
+ * @returns The step
487
+ * @throws {Error} As {@link value} does, and when the function returns other than `{ key, value }` or the new key is
488
+ * not a type a key may be
489
+ */
490
+ rekey<K1 extends EastType, V1 extends EastType, K2 extends EastType, V2 extends EastType>(name: string, fn: FunctionExpr<[K1, V1], StructType<{
491
+ key: K2;
492
+ value: V2;
493
+ }>> | CallableFunctionExpr<[K1, V1], StructType<{
494
+ key: K2;
495
+ value: V2;
496
+ }>>, options?: PartRunner): MigrationDraft;
497
+ }
498
+ /**
499
+ * A record's indexes as declared, by name: each the index its builder made,
500
+ * named by its key.
501
+ *
502
+ * @typeParam I - What `indexes` returned
503
+ * @typeParam T - The record's state type
504
+ */
505
+ export type IndexesOf<I, T extends EastType> = {
506
+ readonly [K in keyof I & string]: I[K] extends IndexDraft<infer IK, infer P, infer On, infer Extra> ? RecordIndexDef<K, T, IK, P, On> & Extra : never;
507
+ };
508
+ /**
509
+ * A record's mutations as declared, by name: each the mutation its builder
510
+ * made, named by its key.
511
+ *
512
+ * @typeParam M - What `mutations` returned
513
+ * @typeParam T - The record's state type
514
+ */
515
+ export type MutationsOf<M, T extends EastType> = {
516
+ readonly [K in keyof M & string]: M[K] extends MutationDraft<infer A extends EastType[]> ? MutationDef<K, T, A> : never;
517
+ };
518
+ /** The `index` builder: each method a draft `e3.record` builds under its key. */
519
+ export declare const INDEX_BUILDER: {
520
+ on: (by: unknown, options?: unknown) => IndexDraft;
521
+ key: (by: unknown, options?: unknown) => IndexDraft;
522
+ keys: (by: unknown, options?: unknown) => IndexDraft;
523
+ interval: (spec: unknown, options?: unknown) => IndexDraft<EastType, EastType, readonly string[] | undefined, unknown>;
524
+ area: (spec: unknown, options?: unknown) => IndexDraft<EastType, EastType, readonly string[] | undefined, unknown>;
525
+ series: (spec: unknown, options?: unknown) => IndexDraft<EastType, EastType, readonly string[] | undefined, unknown>;
526
+ nested: ((spec: unknown, options?: unknown) => IndexDraft<EastType, EastType, readonly string[] | undefined, unknown>) & {
527
+ items: typeof items;
528
+ values: typeof values;
529
+ rows: typeof rows;
530
+ recursive: typeof recursive;
531
+ };
532
+ summary: (spec: unknown, options?: unknown) => IndexDraft<EastType, EastType, readonly string[] | undefined, unknown>;
533
+ };
534
+ /** The `mutation` builder: each method a draft `e3.record` builds under its key. */
535
+ export declare const MUTATION_BUILDER: {
536
+ reduce: (fn: IndexFunction, options?: unknown) => MutationDraft<readonly EastType[]>;
537
+ edit: (fn: IndexFunction, options?: unknown) => MutationDraft<readonly EastType[]>;
538
+ patch: (options?: unknown) => MutationDraft<readonly EastType[]>;
539
+ };
540
+ /** The `migration` builder: each method a step `e3.record` builds in its place. */
541
+ export declare const MIGRATION_BUILDER: {
542
+ value: (name: string, fn: IndexFunction, options?: unknown) => MigrationDraft;
543
+ rows: (name: string, fn: IndexFunction, options?: unknown) => MigrationDraft;
544
+ rekey: (name: string, fn: IndexFunction, options?: unknown) => MigrationDraft;
545
+ };
546
+ export {};
547
+ //# sourceMappingURL=record-builders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-builders.d.ts","sourceRoot":"","sources":["../../src/record-builders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;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