@elaraai/e3-types 1.0.98 → 1.0.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/src/api.d.ts +73 -62
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/api.js +30 -26
- package/dist/src/api.js.map +1 -1
- package/dist/src/bundle.d.ts +366 -0
- package/dist/src/bundle.d.ts.map +1 -0
- package/dist/src/bundle.js +66 -0
- package/dist/src/bundle.js.map +1 -0
- package/dist/src/dataset-type.d.ts +5 -5
- package/dist/src/dataset-type.js +5 -5
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/record.d.ts +339 -8
- package/dist/src/record.d.ts.map +1 -1
- package/dist/src/record.js +181 -14
- package/dist/src/record.js.map +1 -1
- package/dist/src/record.spec.js +2 -1
- package/dist/src/record.spec.js.map +1 -1
- package/dist/src/release.d.ts +1 -1
- package/dist/src/release.js +1 -1
- package/dist/src/structure.d.ts.map +1 -1
- package/dist/src/structure.js +1 -8
- package/dist/src/structure.js.map +1 -1
- package/package.json +2 -2
- package/src/api.ts +30 -26
- package/src/bundle.ts +76 -0
- package/src/dataset-type.ts +5 -5
- package/src/index.ts +29 -0
- package/src/record.spec.ts +2 -1
- package/src/record.ts +207 -14
- package/src/release.ts +1 -1
- package/src/structure.ts +1 -7
package/src/bundle.ts
ADDED
|
@@ -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
|
+
/**
|
|
7
|
+
* A workspace bundle: a workspace as it is, in one stream of beast2, which a
|
|
8
|
+
* repository in any store makes a workspace from — the package deployed to
|
|
9
|
+
* it, every dataset's ref, the executions its tasks' outputs come from, and
|
|
10
|
+
* every object they reach.
|
|
11
|
+
*
|
|
12
|
+
* A bundle is a {@link WorkspaceBundleType}, written an entry at a time and
|
|
13
|
+
* read a segment at a time (East's `Beast2ElementWriter` and
|
|
14
|
+
* `decodeBeast2ElementsFor`), so a bundle of any size is written and read in
|
|
15
|
+
* the memory of a few entries. Its first entry is the workspace's, and every
|
|
16
|
+
* entry after it is an object, or a piece of one. Its type is in its header,
|
|
17
|
+
* as every beast2 value's is, so a reader refuses a bundle of another form
|
|
18
|
+
* naming both, and a new kind of entry is one more case.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { ArrayType, BlobType, DateTimeType, DictType, StringType, StructType, VariantType, type ValueTypeOf } from '@elaraai/east';
|
|
22
|
+
import { DatasetRefType } from './dataset-ref.js';
|
|
23
|
+
import { ExecutionStatusType } from './execution.js';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* What a bundle says of its workspace, ahead of any object.
|
|
27
|
+
*/
|
|
28
|
+
export const WorkspaceBundleHeadType = StructType({
|
|
29
|
+
/** The package deployed to the workspace: its name and version, and its
|
|
30
|
+
* object */
|
|
31
|
+
package: StructType({
|
|
32
|
+
name: StringType,
|
|
33
|
+
version: StringType,
|
|
34
|
+
hash: StringType,
|
|
35
|
+
}),
|
|
36
|
+
/** When the package was deployed */
|
|
37
|
+
deployedAt: DateTimeType,
|
|
38
|
+
/** Every dataset's ref, by the path its store keys it by (`inputs/sales`):
|
|
39
|
+
* a record's state and the head of its history among them */
|
|
40
|
+
datasets: DictType(StringType, DatasetRefType),
|
|
41
|
+
/** The executions the tasks' outputs come from: each task's latest attempt
|
|
42
|
+
* over its current inputs, where it succeeded and made the output the
|
|
43
|
+
* workspace holds */
|
|
44
|
+
executions: ArrayType(StructType({
|
|
45
|
+
/** The task object's hash */
|
|
46
|
+
taskHash: StringType,
|
|
47
|
+
/** The hash of the inputs it ran over */
|
|
48
|
+
inputsHash: StringType,
|
|
49
|
+
/** Its record, which names its id */
|
|
50
|
+
status: ExecutionStatusType,
|
|
51
|
+
})),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export type WorkspaceBundleHead = ValueTypeOf<typeof WorkspaceBundleHeadType>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* An entry of a bundle.
|
|
58
|
+
*/
|
|
59
|
+
export const WorkspaceBundleEntryType = VariantType({
|
|
60
|
+
/** The workspace: a bundle's first entry, and its only one of this kind */
|
|
61
|
+
workspace: WorkspaceBundleHeadType,
|
|
62
|
+
/** An object's bytes: the whole object, or the last of its pieces */
|
|
63
|
+
object: BlobType,
|
|
64
|
+
/** A piece of an object too large for one entry: the object goes on in the
|
|
65
|
+
* entries after it, and ends at an `object` */
|
|
66
|
+
piece: BlobType,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export type WorkspaceBundleEntry = ValueTypeOf<typeof WorkspaceBundleEntryType>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A workspace bundle: its entries, in order.
|
|
73
|
+
*/
|
|
74
|
+
export const WorkspaceBundleType = ArrayType(WorkspaceBundleEntryType);
|
|
75
|
+
|
|
76
|
+
export type WorkspaceBundle = ValueTypeOf<typeof WorkspaceBundleType>;
|
package/src/dataset-type.ts
CHANGED
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
*
|
|
29
29
|
* **Read by structure.** The bytes may come from another build than the
|
|
30
30
|
* package's — an app's UI deployed apart from its package, any client — and
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* id
|
|
34
|
-
*
|
|
35
|
-
* component's.
|
|
31
|
+
* the package may be an earlier release's, which numbered its recursive types
|
|
32
|
+
* by its process's counter, so a recursive type edited between two of its
|
|
33
|
+
* exports could keep its id. `isTypeValueEqual` takes one id as one type
|
|
34
|
+
* without reading it; `isTypeValueStructurallyEqual`, the relation here, reads
|
|
35
|
+
* it, at under a millisecond for a type as large as a UI component's.
|
|
36
36
|
*
|
|
37
37
|
* @packageDocumentation
|
|
38
38
|
*/
|
package/src/index.ts
CHANGED
|
@@ -128,6 +128,24 @@ export {
|
|
|
128
128
|
type RecordIndexForm,
|
|
129
129
|
RecordSummaryTotalsType,
|
|
130
130
|
type RecordSummaryTotals,
|
|
131
|
+
RecordLevelType,
|
|
132
|
+
type RecordLevel,
|
|
133
|
+
RecordRollupType,
|
|
134
|
+
type RecordRollup,
|
|
135
|
+
RecordNestedRunType,
|
|
136
|
+
type RecordNestedRun,
|
|
137
|
+
RecordNestedPathType,
|
|
138
|
+
type RecordNestedPath,
|
|
139
|
+
RecordNestedItemType,
|
|
140
|
+
type RecordNestedItem,
|
|
141
|
+
NestedEntryKeyType,
|
|
142
|
+
NestedSpanKeyType,
|
|
143
|
+
nestedSpanName,
|
|
144
|
+
RecordNestedTotalsType,
|
|
145
|
+
type RecordNestedTotals,
|
|
146
|
+
NestedEntryType,
|
|
147
|
+
RecordNestedDeclType,
|
|
148
|
+
type RecordNestedDecl,
|
|
131
149
|
RecordSummaryOpType,
|
|
132
150
|
type RecordSummaryOp,
|
|
133
151
|
RECORD_STATE_KIND,
|
|
@@ -191,6 +209,16 @@ export {
|
|
|
191
209
|
type WorkspaceRecord,
|
|
192
210
|
} from './workspace.js';
|
|
193
211
|
|
|
212
|
+
// A workspace as it is, in one stream
|
|
213
|
+
export {
|
|
214
|
+
WorkspaceBundleHeadType,
|
|
215
|
+
type WorkspaceBundleHead,
|
|
216
|
+
WorkspaceBundleEntryType,
|
|
217
|
+
type WorkspaceBundleEntry,
|
|
218
|
+
WorkspaceBundleType,
|
|
219
|
+
type WorkspaceBundle,
|
|
220
|
+
} from './bundle.js';
|
|
221
|
+
|
|
194
222
|
// Execution status
|
|
195
223
|
export {
|
|
196
224
|
StopReasonType,
|
|
@@ -317,6 +345,7 @@ export {
|
|
|
317
345
|
PackageNotFoundErrorType,
|
|
318
346
|
PackageExistsErrorType,
|
|
319
347
|
PackageInvalidErrorType,
|
|
348
|
+
BundleInvalidErrorType,
|
|
320
349
|
DatasetNotFoundErrorType,
|
|
321
350
|
TaskNotFoundErrorType,
|
|
322
351
|
ExecutionNotFoundErrorType,
|
package/src/record.spec.ts
CHANGED
|
@@ -194,7 +194,8 @@ describe('decodeRecordIndexObject', () => {
|
|
|
194
194
|
});
|
|
195
195
|
|
|
196
196
|
describe('mutationDeltaType', () => {
|
|
197
|
-
|
|
197
|
+
// A summary index's key: its leading fields under `on`, then a tile and a key (#1432).
|
|
198
|
+
const ik = StructType({ on: StructType({}), tile: DateTimeType, key: StringType });
|
|
198
199
|
const caseOf = (delta: EastType, part: 'key' | 'value', name: string): EastType =>
|
|
199
200
|
((delta as unknown as Record<'key' | 'value', { cases: Record<string, EastType> }>)[part]).cases[name]!;
|
|
200
201
|
|
package/src/record.ts
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
|
-
ArrayType, BooleanType, DateTimeType, DictType, EastTypeType, FunctionType, IntegerType, NullType,
|
|
23
|
-
OptionType, PatchType, StringType, StructType, VariantType,
|
|
22
|
+
ArrayType, BooleanType, DateTimeType, DictType, EastTypeType, FloatType, FunctionType, IntegerType, NullType,
|
|
23
|
+
OptionType, PatchType, RecursiveType, StringType, StructType, VariantType,
|
|
24
24
|
decodeBeast2For, dictPatchOpsType, setPatchOpsType, toEastTypeValue,
|
|
25
25
|
type EastType, type EastTypeValue, type PatchTypeOf, type ValueTypeOf,
|
|
26
26
|
} from '@elaraai/east';
|
|
@@ -185,6 +185,198 @@ export const RecordSummaryTotalsType = StructType({
|
|
|
185
185
|
export type RecordSummaryTotalsType = typeof RecordSummaryTotalsType;
|
|
186
186
|
export type RecordSummaryTotals = ValueTypeOf<typeof RecordSummaryTotalsType>;
|
|
187
187
|
|
|
188
|
+
/**
|
|
189
|
+
* The level a series index files an event at (#1433): the finest, from the
|
|
190
|
+
* index's tile up, whose shortest tile holds the event's length, or the year
|
|
191
|
+
* for an event longer than a year. It names a level with the tiles' own
|
|
192
|
+
* words, as east-ui's `RecordSliceTileType` does.
|
|
193
|
+
*
|
|
194
|
+
* @property day - Filed under the UTC day holding its start
|
|
195
|
+
* @property week - Under the ISO week from Monday holding its start
|
|
196
|
+
* @property month - Under the UTC month holding its start
|
|
197
|
+
* @property quarter - Under the UTC quarter holding its start
|
|
198
|
+
* @property year - Under the UTC year holding its start, or every year it touches
|
|
199
|
+
*/
|
|
200
|
+
export const RecordLevelType = VariantType({
|
|
201
|
+
day: NullType, week: NullType, month: NullType, quarter: NullType, year: NullType,
|
|
202
|
+
});
|
|
203
|
+
export type RecordLevelType = typeof RecordLevelType;
|
|
204
|
+
export type RecordLevel = ValueTypeOf<typeof RecordLevelType>;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* A rollup, as a nested series index keeps it (#1434): how a node's own values
|
|
208
|
+
* in a tile fold, and how a parent aggregates what its children draw.
|
|
209
|
+
*
|
|
210
|
+
* @property fold - Its own values in a tile, in key order: their sum, mean,
|
|
211
|
+
* least, greatest, the value at the latest instant, or how many
|
|
212
|
+
* @property aggregate - What its children draw in a tile, in key order: their
|
|
213
|
+
* sum, mean, least or greatest; `count`, the leaf rows beneath that draw a
|
|
214
|
+
* value, a child drawing its own counting one
|
|
215
|
+
*/
|
|
216
|
+
export const RecordRollupType = StructType({
|
|
217
|
+
fold: VariantType({ sum: NullType, mean: NullType, min: NullType, max: NullType, last: NullType, count: NullType }),
|
|
218
|
+
aggregate: VariantType({ sum: NullType, mean: NullType, min: NullType, max: NullType, count: NullType }),
|
|
219
|
+
});
|
|
220
|
+
export type RecordRollupType = typeof RecordRollupType;
|
|
221
|
+
export type RecordRollup = ValueTypeOf<typeof RecordRollupType>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Which run of a node's entries a nested series index files an entry in
|
|
225
|
+
* (#1434). Each run is contiguous in the key, so a read of one never reads
|
|
226
|
+
* another.
|
|
227
|
+
*
|
|
228
|
+
* @property items - The node's own items or values, each at the level it is filed at
|
|
229
|
+
* @property totals - The node's own totals, a summary tile at a time
|
|
230
|
+
* @property subtotals - A parent's subtotals by one of the collection's rollups, at each level from the index's tile up
|
|
231
|
+
* @property subtree - The items of the node's descendants, filed under it too (`items(…, { rollup: true })`)
|
|
232
|
+
* @property subtreeTotals - Its descendants' items' totals, a summary tile at a time
|
|
233
|
+
*/
|
|
234
|
+
export const RecordNestedRunType = VariantType({
|
|
235
|
+
items: NullType,
|
|
236
|
+
totals: NullType,
|
|
237
|
+
subtotals: RecordRollupType,
|
|
238
|
+
subtree: NullType,
|
|
239
|
+
subtreeTotals: NullType,
|
|
240
|
+
});
|
|
241
|
+
export type RecordNestedRunType = typeof RecordNestedRunType;
|
|
242
|
+
export type RecordNestedRun = ValueTypeOf<typeof RecordNestedRunType>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* A path in a nested series index's key (#1434): field names, or Dict keys,
|
|
246
|
+
* from a row down — `end` for none, else one `step` and the rest. A key holds
|
|
247
|
+
* no Array, which East may change in place, so a path is this list: it is
|
|
248
|
+
* immutable, and it sorts as an Array of its names would, a path before every
|
|
249
|
+
* path it leads (`[] < ["a"] < ["a", "b"] < ["b"]`).
|
|
250
|
+
*
|
|
251
|
+
* @property end - No more names
|
|
252
|
+
* @property step - One name, and the path after it
|
|
253
|
+
*/
|
|
254
|
+
export const RecordNestedPathType = RecursiveType((self) => VariantType({
|
|
255
|
+
end: NullType,
|
|
256
|
+
step: StructType({ key: StringType, rest: self }),
|
|
257
|
+
}));
|
|
258
|
+
export type RecordNestedPathType = typeof RecordNestedPathType;
|
|
259
|
+
export type RecordNestedPath = ValueTypeOf<typeof RecordNestedPathType>;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Which item a nested series index's entry is (#1434).
|
|
263
|
+
*
|
|
264
|
+
* @property id - An item, by its id
|
|
265
|
+
* @property at - A value, by its instant
|
|
266
|
+
* @property under - A descendant's item filed under an ancestor: the Dict keys
|
|
267
|
+
* from the ancestor down to the node holding it, and its id
|
|
268
|
+
* @property none - A total or a subtotal, of which a node has one a tile a run
|
|
269
|
+
*/
|
|
270
|
+
export const RecordNestedItemType = VariantType({
|
|
271
|
+
id: StringType,
|
|
272
|
+
at: DateTimeType,
|
|
273
|
+
under: StructType({ path: RecordNestedPathType, id: StringType }),
|
|
274
|
+
none: NullType,
|
|
275
|
+
});
|
|
276
|
+
export type RecordNestedItemType = typeof RecordNestedItemType;
|
|
277
|
+
export type RecordNestedItem = ValueTypeOf<typeof RecordNestedItemType>;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* The key a nested series index files an entry under (#1434): its
|
|
281
|
+
* collection, its row, the node it is about, its run, its level and tile, and
|
|
282
|
+
* the item — in that order, so a node's run at one level is one contiguous
|
|
283
|
+
* range across tiles.
|
|
284
|
+
*
|
|
285
|
+
* @param rowKey - The record's key type
|
|
286
|
+
* @returns The entry key's struct type
|
|
287
|
+
* @property collection - The collection's place: the field names from the row down to it, a recursive step adding none
|
|
288
|
+
* @property row - The record row's key
|
|
289
|
+
* @property path - The Dict keys from the row down to the node the entry is about: `end` for the row itself
|
|
290
|
+
* @property run - Which of the node's runs ({@link RecordNestedRunType})
|
|
291
|
+
* @property level - The level the entry is filed at; a total's, the summary tile's
|
|
292
|
+
* @property tile - The start of the level's tile
|
|
293
|
+
* @property item - Which item ({@link RecordNestedItemType})
|
|
294
|
+
*/
|
|
295
|
+
export function NestedEntryKeyType<K extends EastType>(rowKey: K) {
|
|
296
|
+
return StructType({
|
|
297
|
+
collection: RecordNestedPathType, row: rowKey, path: RecordNestedPathType,
|
|
298
|
+
run: RecordNestedRunType, level: RecordLevelType, tile: DateTimeType, item: RecordNestedItemType,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* The key a nested series index's span keeps its totals under (#1438): a
|
|
304
|
+
* collection's place, as an entry's key names it, and a month its items or
|
|
305
|
+
* values touch. Each holds how many of them touch it and the milliseconds of it
|
|
306
|
+
* its items cover ({@link RecordSummaryTotalsType}), summed across the record's
|
|
307
|
+
* rows as a summary index's totals are, so a collection's first and last month
|
|
308
|
+
* held are its span across the rows, and its months' counts how much it holds
|
|
309
|
+
* in each.
|
|
310
|
+
*
|
|
311
|
+
* @property collection - The collection's place: the field names from the row down to it, a recursive step adding none
|
|
312
|
+
* @property tile - The start of a month its items or values touch
|
|
313
|
+
*/
|
|
314
|
+
export const NestedSpanKeyType = StructType({ collection: RecordNestedPathType, tile: DateTimeType });
|
|
315
|
+
export type NestedSpanKeyType = typeof NestedSpanKeyType;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* The name of the index a nested series index's span is kept in, beside it
|
|
319
|
+
* (#1438): an index of its record's, built with it and never declared.
|
|
320
|
+
*
|
|
321
|
+
* @param index - The nested series index's name
|
|
322
|
+
* @returns The span's
|
|
323
|
+
*/
|
|
324
|
+
export function nestedSpanName(index: string): string {
|
|
325
|
+
return `${index}_span`;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* One collection's totals in one summary tile (#1434), for one node, or for
|
|
330
|
+
* its descendants' items under `subtreeTotals`.
|
|
331
|
+
*
|
|
332
|
+
* @property count - How many items touch the tile
|
|
333
|
+
* @property ms - The milliseconds of the tile they cover; an instant covers none
|
|
334
|
+
* @property values - For a collection of Float or Integer values: their sum,
|
|
335
|
+
* the least, the greatest, and the value at the latest instant in the tile,
|
|
336
|
+
* as Floats, taken in key order; `none` for any other collection
|
|
337
|
+
*/
|
|
338
|
+
export const RecordNestedTotalsType = StructType({
|
|
339
|
+
count: IntegerType,
|
|
340
|
+
ms: IntegerType,
|
|
341
|
+
values: OptionType(StructType({ sum: FloatType, min: FloatType, max: FloatType, last: FloatType })),
|
|
342
|
+
});
|
|
343
|
+
export type RecordNestedTotalsType = typeof RecordNestedTotalsType;
|
|
344
|
+
export type RecordNestedTotals = ValueTypeOf<typeof RecordNestedTotalsType>;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* What a nested series index's entry carries (#1434): an item or a value as
|
|
348
|
+
* its collection holds it, its variant nesting as the declaration nests
|
|
349
|
+
* (`.item .members .load 0.82`); a node's totals in a tile; or a parent's
|
|
350
|
+
* subtotal.
|
|
351
|
+
*
|
|
352
|
+
* @param places - The items' variant: `VariantType({ jobs: Job, members: VariantType({ load: FloatType }) })`
|
|
353
|
+
* @returns The value's variant type
|
|
354
|
+
*/
|
|
355
|
+
export function NestedEntryType<P extends EastType>(places: P) {
|
|
356
|
+
return VariantType({ item: places, totals: RecordNestedTotalsType, subtotal: FloatType });
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* A nested series index's declaration, as its definition holds it (#1434):
|
|
361
|
+
* each collection a row nests by its field — things people drag, with the
|
|
362
|
+
* fields their times are read from and whether each is filed under its
|
|
363
|
+
* ancestors too; values, with the rollups a parent's subtotals are kept by;
|
|
364
|
+
* child rows, their own collections declared the same way; or more rows of
|
|
365
|
+
* the row's own type. The field names are data, as an index's `on` is, and
|
|
366
|
+
* the binding reads them (#1435).
|
|
367
|
+
*/
|
|
368
|
+
export const RecordNestedDeclType = RecursiveType((self) => DictType(StringType, VariantType({
|
|
369
|
+
items: StructType({
|
|
370
|
+
times: VariantType({ span: StructType({ from: StringType, to: StringType }), at: StringType }),
|
|
371
|
+
rollup: BooleanType,
|
|
372
|
+
}),
|
|
373
|
+
values: StructType({ rollups: ArrayType(RecordRollupType) }),
|
|
374
|
+
rows: self,
|
|
375
|
+
recursive: NullType,
|
|
376
|
+
})));
|
|
377
|
+
export type RecordNestedDeclType = typeof RecordNestedDeclType;
|
|
378
|
+
export type RecordNestedDecl = ValueTypeOf<typeof RecordNestedDeclType>;
|
|
379
|
+
|
|
188
380
|
/**
|
|
189
381
|
* Which collection an index builds (#1039).
|
|
190
382
|
*
|
|
@@ -222,7 +414,8 @@ export type RecordIndexForm = ValueTypeOf<typeof RecordIndexFormType>;
|
|
|
222
414
|
*/
|
|
223
415
|
export const RecordIndexObjectType = StructType({
|
|
224
416
|
/** Hash of the encoded EastIR bundle: `(K, V) -> IK`, or `-> Set<IK>` when
|
|
225
|
-
* {@link multi}
|
|
417
|
+
* {@link multi}; a summary's or a nested series index's `(K, V) ->
|
|
418
|
+
* Dict<IK, P>`, a row's entries with their values (#1039, #1434). */
|
|
226
419
|
keyIr: StringType,
|
|
227
420
|
/** Declared with `keys` (a Set return) rather than `key`: one entry per
|
|
228
421
|
* element, so a row that names five resources appears under five keys. */
|
|
@@ -502,11 +695,10 @@ export function indexCollectionType(keyType: EastType, indexKeyType: EastType, v
|
|
|
502
695
|
* patches are sparse and addressed by key.
|
|
503
696
|
*/
|
|
504
697
|
export function patchOpsType(collectionType: EastType): EastType {
|
|
505
|
-
|
|
506
|
-
if (
|
|
507
|
-
if (collection.type === 'Set') return setPatchOpsType(collection.key);
|
|
698
|
+
if (collectionType.type === 'Dict') return dictPatchOpsType(collectionType.value);
|
|
699
|
+
if (collectionType.type === 'Set') return setPatchOpsType(collectionType.key);
|
|
508
700
|
throw new Error(
|
|
509
|
-
`a mutation delta addresses Dict and Set targets by key; this one holds ${
|
|
701
|
+
`a mutation delta addresses Dict and Set targets by key; this one holds ${collectionType.type}`,
|
|
510
702
|
);
|
|
511
703
|
}
|
|
512
704
|
|
|
@@ -578,7 +770,7 @@ export const DELTA_CONFLICT = '$conflict';
|
|
|
578
770
|
* @param targets - the primary and each index, in canonical case order
|
|
579
771
|
* @returns `Dict<DeltaKey, DeltaOp>`
|
|
580
772
|
*/
|
|
581
|
-
export function mutationDeltaType(targets: readonly DeltaTarget[]): EastType {
|
|
773
|
+
export function mutationDeltaType(targets: readonly DeltaTarget[]): DictType<VariantType<Record<string, EastType>>, VariantType<Record<string, EastType>>> {
|
|
582
774
|
const keys: Record<string, EastType> = { [DELTA_CONFLICT]: StringType };
|
|
583
775
|
const ops: Record<string, EastType> = { [DELTA_CONFLICT]: NullType };
|
|
584
776
|
for (const target of targets) {
|
|
@@ -618,14 +810,15 @@ export function editTypeOf<K extends EastType, V extends EastType>(recordType: D
|
|
|
618
810
|
}>;
|
|
619
811
|
export function editTypeOf(recordType: EastType): EastType;
|
|
620
812
|
export function editTypeOf(recordType: EastType): EastType {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
throw new Error(`an edit mutation writes a Dict record; this one holds ${dict.type}`);
|
|
813
|
+
if (recordType.type !== 'Dict') {
|
|
814
|
+
throw new Error(`an edit mutation writes a Dict record; this one holds ${recordType.type}`);
|
|
624
815
|
}
|
|
816
|
+
const keyType: EastType = recordType.key;
|
|
817
|
+
const valueType: EastType = recordType.value;
|
|
625
818
|
return StructType({
|
|
626
|
-
set: FunctionType([
|
|
627
|
-
delete: FunctionType([
|
|
628
|
-
update: FunctionType([
|
|
819
|
+
set: FunctionType([keyType, valueType], NullType),
|
|
820
|
+
delete: FunctionType([keyType], NullType),
|
|
821
|
+
update: FunctionType([keyType, PatchType(valueType)], NullType),
|
|
629
822
|
});
|
|
630
823
|
}
|
|
631
824
|
|
package/src/release.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
/** The release of e3 this build is. */
|
|
20
|
-
export const E3_RELEASE = '1.0.
|
|
20
|
+
export const E3_RELEASE = '1.0.99';
|
|
21
21
|
|
|
22
22
|
/** A semantic version: its core, a pre-release, and build metadata. */
|
|
23
23
|
const RELEASE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
package/src/structure.ts
CHANGED
|
@@ -129,13 +129,7 @@ export type TreePath = ValueTypeOf<typeof TreePathType>;
|
|
|
129
129
|
* ```
|
|
130
130
|
*/
|
|
131
131
|
export function pathToString(path: TreePath): string {
|
|
132
|
-
return path.map(segment =>
|
|
133
|
-
if (segment.type === 'field') {
|
|
134
|
-
return '.' + printIdentifier(segment.value);
|
|
135
|
-
} else {
|
|
136
|
-
throw new Error(`pathToString: unsupported path segment type: ${segment.type}`);
|
|
137
|
-
}
|
|
138
|
-
}).join('');
|
|
132
|
+
return path.map(segment => '.' + printIdentifier(segment.value)).join('');
|
|
139
133
|
}
|
|
140
134
|
|
|
141
135
|
/**
|