@elaraai/e3 1.0.108 → 1.0.109
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/dist/src/export.d.ts.map +1 -1
- package/dist/src/export.js +13 -6
- package/dist/src/export.js.map +1 -1
- package/dist/src/export.spec.js +25 -3
- package/dist/src/export.spec.js.map +1 -1
- package/dist/src/function.d.ts +136 -57
- package/dist/src/function.d.ts.map +1 -1
- package/dist/src/function.js +47 -12
- package/dist/src/function.js.map +1 -1
- package/dist/src/function.spec.d.ts +3 -1
- package/dist/src/function.spec.d.ts.map +1 -1
- package/dist/src/function.spec.js +246 -3
- package/dist/src/function.spec.js.map +1 -1
- package/dist/src/index-input.d.ts +162 -0
- package/dist/src/index-input.d.ts.map +1 -0
- package/dist/src/index-input.js +216 -0
- package/dist/src/index-input.js.map +1 -0
- package/dist/src/index-input.spec.d.ts +6 -0
- package/dist/src/index-input.spec.d.ts.map +1 -0
- package/dist/src/index-input.spec.js +269 -0
- package/dist/src/index-input.spec.js.map +1 -0
- package/dist/src/index-read.d.ts +428 -0
- package/dist/src/index-read.d.ts.map +1 -0
- package/dist/src/index-read.js +747 -0
- package/dist/src/index-read.js.map +1 -0
- package/dist/src/index-read.spec.d.ts +6 -0
- package/dist/src/index-read.spec.d.ts.map +1 -0
- package/dist/src/index-read.spec.js +1447 -0
- package/dist/src/index-read.spec.js.map +1 -0
- package/dist/src/index.d.ts +10 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/package.d.ts.map +1 -1
- package/dist/src/package.js +3 -4
- package/dist/src/package.js.map +1 -1
- package/dist/src/record-area.d.ts +12 -0
- package/dist/src/record-area.d.ts.map +1 -1
- package/dist/src/record-area.js +26 -0
- package/dist/src/record-area.js.map +1 -1
- package/dist/src/record-area.spec.js +4 -14
- package/dist/src/record-area.spec.js.map +1 -1
- package/dist/src/record-builders.d.ts +39 -14
- package/dist/src/record-builders.d.ts.map +1 -1
- package/dist/src/record-builders.js.map +1 -1
- package/dist/src/record-entries.spec.js +2 -15
- package/dist/src/record-entries.spec.js.map +1 -1
- package/dist/src/record-index.d.ts +11 -5
- package/dist/src/record-index.d.ts.map +1 -1
- package/dist/src/record-index.js.map +1 -1
- package/dist/src/record-interval.d.ts +7 -0
- package/dist/src/record-interval.d.ts.map +1 -1
- package/dist/src/record-interval.js +7 -0
- package/dist/src/record-interval.js.map +1 -1
- package/dist/src/record-nested-programs.d.ts +63 -511
- package/dist/src/record-nested-programs.d.ts.map +1 -1
- package/dist/src/record-nested-programs.js +403 -222
- package/dist/src/record-nested-programs.js.map +1 -1
- package/dist/src/record-nested.d.ts +60 -10
- package/dist/src/record-nested.d.ts.map +1 -1
- package/dist/src/record-nested.js +65 -23
- package/dist/src/record-nested.js.map +1 -1
- package/dist/src/record-nested.spec.js +113 -34
- package/dist/src/record-nested.spec.js.map +1 -1
- package/dist/src/record-series.spec.js +6 -31
- package/dist/src/record-series.spec.js.map +1 -1
- package/dist/src/record.d.ts +9 -0
- package/dist/src/record.d.ts.map +1 -1
- package/dist/src/record.js +14 -0
- package/dist/src/record.js.map +1 -1
- package/dist/src/task.d.ts +28 -16
- package/dist/src/task.d.ts.map +1 -1
- package/dist/src/task.js +33 -5
- package/dist/src/task.js.map +1 -1
- package/dist/src/test-helpers.d.ts +35 -0
- package/dist/src/test-helpers.d.ts.map +1 -0
- package/dist/src/test-helpers.js +56 -0
- package/dist/src/test-helpers.js.map +1 -0
- package/dist/src/types.d.ts +86 -13
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,216 @@
|
|
|
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
|
+
* An index of a record as an input of a task, a stream task or a function.
|
|
7
|
+
*
|
|
8
|
+
* A record's index is an ordinary collection — `Dict<{ ik, k }, P>`, stored as
|
|
9
|
+
* a manifest of segments as the record's own rows are, and maintained in the
|
|
10
|
+
* same commit — whose order is the order of a read the app declared it for.
|
|
11
|
+
* `e3.index` hands that collection to a body, which then reads the index's
|
|
12
|
+
* runs with `range` and `prefix`, where a body handed the record reads every
|
|
13
|
+
* row.
|
|
14
|
+
*/
|
|
15
|
+
import { NullType } from '@elaraai/east';
|
|
16
|
+
import { indexCollectionType } from '@elaraai/e3-types';
|
|
17
|
+
import { readersOn } from './index-read.js';
|
|
18
|
+
import { isRecord } from './record.js';
|
|
19
|
+
import { RECORD_PART } from './record-builders.js';
|
|
20
|
+
import { builtIndex, summed } from './record-programs.js';
|
|
21
|
+
/** The words for what `e3.index` was given, when it is no index a record carries: what it is, by its kind. */
|
|
22
|
+
function given(value) {
|
|
23
|
+
if (isRecord(value)) {
|
|
24
|
+
const names = Object.keys(value.indexes);
|
|
25
|
+
const has = names.length === 0 ? 'it declares no index' : `its indexes are ${names.map((name) => `'${name}'`).join(', ')}`;
|
|
26
|
+
return `the record '${value.name}' itself — pass one of its indexes, as ${value.name}.indexes.<name>; ${has}`;
|
|
27
|
+
}
|
|
28
|
+
if (typeof value !== 'object' || value === null)
|
|
29
|
+
return value === null ? 'null' : `a ${typeof value}`;
|
|
30
|
+
const item = value;
|
|
31
|
+
const named = typeof item.name === 'string' ? ` '${item.name}'` : '';
|
|
32
|
+
switch (item.kind) {
|
|
33
|
+
case 'dataset': return `the dataset${named}, which is no record: only an e3.record has indexes`;
|
|
34
|
+
case 'partition': return `e3.partition of '${String(item.dataset?.name)}': a partition marks a dataset, and an index is read whole`;
|
|
35
|
+
case 'index': return 'an e3.index already: pass the record\'s index, as record.indexes.<name>';
|
|
36
|
+
case 'task': return `the task${named}: a task has no index`;
|
|
37
|
+
case 'recordIndex':
|
|
38
|
+
return `an index named '${String(item.name)}' that no record carries by that name — pass it as the record holds it, record.indexes.${String(item.name)}`;
|
|
39
|
+
case 'mutation': return `the mutation${named}: a mutation writes its record, and has no index — pass one of the record's indexes, as record.indexes.<name>`;
|
|
40
|
+
case 'migration': return `the migration${named}: a migration changes its record's type, and has no index`;
|
|
41
|
+
case 'function': return `the function${named}: a function has no index`;
|
|
42
|
+
case 'package': return `the package${named}: a package has no index`;
|
|
43
|
+
case 'datatree': return `the data tree${named}: only an e3.record has indexes`;
|
|
44
|
+
case 'array':
|
|
45
|
+
case 'set':
|
|
46
|
+
case 'dict':
|
|
47
|
+
case 'fold': return `e3.output.${item.kind}, an output kind: it has no index`;
|
|
48
|
+
}
|
|
49
|
+
// What a record's builders make, before a record builds it
|
|
50
|
+
const part = value[RECORD_PART]?.part;
|
|
51
|
+
if (part === 'index')
|
|
52
|
+
return 'an index the `index` builder made, before its record built it — declare it in e3.record\'s `indexes`, and pass record.indexes.<name>';
|
|
53
|
+
if (part === 'mutation' || part === 'migration')
|
|
54
|
+
return `a ${part} the \`${part}\` builder made, which has no index`;
|
|
55
|
+
return 'a value that is no definition of e3\'s';
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Takes an index of a record as an input of a task, a stream task or a
|
|
59
|
+
* function: `e3.index(record.indexes.<name>)` in its `inputs`.
|
|
60
|
+
*
|
|
61
|
+
* The body's parameter is the index's entries, a `Dict<{ ik, k }, P>` opened
|
|
62
|
+
* lazily and frozen, as any input is: `ik` the index's key, `k` the record's
|
|
63
|
+
* key, and `P` what the index carries — the row, a `value` of its own, or
|
|
64
|
+
* nothing; beside a nested series index or an entries index of the record,
|
|
65
|
+
* the lean row where it would carry nothing or the row, which the parameter's
|
|
66
|
+
* type says. Entries with one index key are one contiguous run, in the record's
|
|
67
|
+
* key order, and a range of index keys is one run too, so a body reads them
|
|
68
|
+
* with `prefix` and `range`, by key, by size and by a loop, each at the cost
|
|
69
|
+
* of the entries it reaches and never of the index. A body that reads it any
|
|
70
|
+
* other way decodes it whole, as it would any input.
|
|
71
|
+
*
|
|
72
|
+
* It takes an index as its record carries it by name
|
|
73
|
+
* (`jobs.indexes.jobs_by_press`), and the indexes e3 keeps beside one: a nested
|
|
74
|
+
* series index's span (`jobs.indexes.<name>.nested.span`) and an entries
|
|
75
|
+
* index's lean rows (`jobs.indexes.<name>.entries.rows`). To read more of a row
|
|
76
|
+
* than the index carries, take the record as an input beside it and read the
|
|
77
|
+
* row by the entry's `k`.
|
|
78
|
+
*
|
|
79
|
+
* The inputs of one record — the record, and any of its indexes — are read at
|
|
80
|
+
* one state of it, so a body never meets an index entry for a row it reads
|
|
81
|
+
* otherwise. A task that takes an index is decided again when its record
|
|
82
|
+
* changes, and runs again when the index it reads did; a function reads it as
|
|
83
|
+
* the record is stored when the call starts, and its result names the record,
|
|
84
|
+
* the index and the hash the record was pinned at. A record with no state yet
|
|
85
|
+
* makes a task wait and a call `invalid`, as it does for the record as an
|
|
86
|
+
* input. `e3.package` collects the index's record.
|
|
87
|
+
*
|
|
88
|
+
* Its kind's readers give a body the rows a read's words say — a series
|
|
89
|
+
* index's `events`, an interval index's `overlapping`, a plain index's `of`
|
|
90
|
+
* (`IndexRead`). An `e3.function` with a spec and an `e3.streamTask` give the
|
|
91
|
+
* body its parameter with the readers on it; over any other expression of the
|
|
92
|
+
* index's type, a task's own function's parameter among them,
|
|
93
|
+
* `e3.index(def).read(entries)` gives that expression with the same readers.
|
|
94
|
+
*
|
|
95
|
+
* @typeParam D - The index, as `record.indexes.<name>` types it
|
|
96
|
+
* @param def - The index, as its record carries it by name
|
|
97
|
+
* @returns The input: pass it in `inputs`; its `type` is the body's parameter, and its `read` the index's readers
|
|
98
|
+
* @throws {Error} When given anything but an index its record carries by name
|
|
99
|
+
* — a record, a dataset, a mutation, a function, an index the builder made
|
|
100
|
+
* before its record built it — naming what it was given and what to pass
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* const jobs = e3.record('jobs', DictType(StringType, JobType), {
|
|
105
|
+
* initial: new Map(),
|
|
106
|
+
* indexes: (index) => ({ jobs_by_press: index.on(['press']) }),
|
|
107
|
+
* mutations: (mutation) => ({ patch: mutation.patch() }),
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* // How many jobs a press holds, read from the index alone: the run of one
|
|
111
|
+
* // press costs its two ends and what lies between them.
|
|
112
|
+
* const jobsOnPress = e3.function('jobs_on_press', {
|
|
113
|
+
* inputs: [e3.index(jobs.indexes.jobs_by_press)],
|
|
114
|
+
* args: [StringType],
|
|
115
|
+
* output: IntegerType,
|
|
116
|
+
* }, ($, jobsByPress, press) => jobsByPress.prefix({ ik: press }).size());
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* // A task takes it the same way: its body's parameter is the index's type.
|
|
122
|
+
* const byPress = e3.index(jobs.indexes.jobs_by_press);
|
|
123
|
+
* const busiest = e3.task('busiest_press', [byPress, presses],
|
|
124
|
+
* East.function([byPress.type, PressesType], StringType, ($, jobsByPress, presses) => {
|
|
125
|
+
* const best = $.let("");
|
|
126
|
+
* const most = $.let(0n);
|
|
127
|
+
* $.for(presses, ($, _press, code) => {
|
|
128
|
+
* const count = $.const(jobsByPress.prefix({ ik: code }).size());
|
|
129
|
+
* $.if(East.less(most, count), ($) => { $.assign(most, count); $.assign(best, code); });
|
|
130
|
+
* });
|
|
131
|
+
* return best;
|
|
132
|
+
* }));
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export function index(def) {
|
|
136
|
+
const declared = def;
|
|
137
|
+
const record = typeof declared === 'object' && declared !== null && declared.kind === 'recordIndex' && isRecord(declared.record)
|
|
138
|
+
? declared.record : undefined;
|
|
139
|
+
// The record carries it by its name: its own indexes, and those e3 keeps
|
|
140
|
+
// beside one — a nested series index's span, an entries index's lean rows.
|
|
141
|
+
if (record === undefined || typeof def.name !== 'string' || !Object.hasOwn(record.indexes, def.name) || record.indexes[def.name] !== def) {
|
|
142
|
+
throw new Error(`e3.index takes an index of a record, as the record carries it by name — e3.index(record.indexes.<name>) — and was given ${given(def)}`);
|
|
143
|
+
}
|
|
144
|
+
const input = {
|
|
145
|
+
kind: 'index', index: def, record, type: indexEntriesType(record, def),
|
|
146
|
+
read: (entries) => readersOn(input, entries),
|
|
147
|
+
};
|
|
148
|
+
return input;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* A body's parameters with each index input's readers on its own: the
|
|
152
|
+
* parameter is still the index's entries, and its kind's readers read them.
|
|
153
|
+
*
|
|
154
|
+
* @param inputs - The inputs, in the body's parameter order
|
|
155
|
+
* @param params - The body's parameters: the inputs', then any others
|
|
156
|
+
* @returns The parameters
|
|
157
|
+
* @internal
|
|
158
|
+
*/
|
|
159
|
+
export function withIndexReaders(inputs, params) {
|
|
160
|
+
inputs.forEach((input, at) => {
|
|
161
|
+
if (input.kind === 'index')
|
|
162
|
+
readersOn(input, params[at]);
|
|
163
|
+
});
|
|
164
|
+
return params;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The type a record's state holds an index's entries as: the index as it is
|
|
168
|
+
* built (`builtIndex`), in the collection the store keeps it in
|
|
169
|
+
* (`indexCollectionType`), a summed index's `k` Null.
|
|
170
|
+
*
|
|
171
|
+
* @param record - The record
|
|
172
|
+
* @param def - One of its indexes
|
|
173
|
+
* @returns `Dict<{ ik, k }, P>`
|
|
174
|
+
*/
|
|
175
|
+
function indexEntriesType(record, def) {
|
|
176
|
+
const built = builtIndex(record, def);
|
|
177
|
+
// An index is declared over a Dict record alone, whose key is its rows'.
|
|
178
|
+
const rowKey = record.type.key;
|
|
179
|
+
return indexCollectionType(summed(built) ? NullType : rowKey, built.keyType, built.valueType);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The dataset an input is read through: the dataset itself, a partitioned
|
|
183
|
+
* input's dataset, or an index's record. What a definition's dependencies are
|
|
184
|
+
* collected from.
|
|
185
|
+
*
|
|
186
|
+
* @param input - The input
|
|
187
|
+
* @returns The dataset
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
export function inputDataset(input) {
|
|
191
|
+
return input.kind === 'partition' ? input.dataset : input.kind === 'index' ? input.record : input;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The type of the parameter a body is given for an input: the dataset's, a
|
|
195
|
+
* partitioned input's dataset's — a piece is typed as the whole — or an
|
|
196
|
+
* index's entries'.
|
|
197
|
+
*
|
|
198
|
+
* @param input - The input
|
|
199
|
+
* @returns The type
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
export function inputType(input) {
|
|
203
|
+
return input.kind === 'partition' ? input.dataset.type : input.type;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The name an input is refused by: a dataset's, or an index's as
|
|
207
|
+
* `record.index`.
|
|
208
|
+
*
|
|
209
|
+
* @param input - The input
|
|
210
|
+
* @returns The name
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
export function inputName(input) {
|
|
214
|
+
return input.kind === 'partition' ? input.dataset.name : input.kind === 'index' ? `${input.record.name}.${input.index.name}` : input.name;
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=index-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-input.js","sourceRoot":"","sources":["../../src/index-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAA4D,MAAM,eAAe,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AA0B1D,8GAA8G;AAC9G,SAAS,KAAK,CAAC,KAA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;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,KAA8B;IACzD,OAAO,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AACpG,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,KAA8B;IACtD,OAAO,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;AACtE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,KAA8B;IACtD,OAAO,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;AAC5I,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-input.spec.d.ts","sourceRoot":"","sources":["../../src/index-input.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,269 @@
|
|
|
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
|
+
* An index of a record as an input — `e3.index(record.indexes.<name>)`
|
|
7
|
+
* (#1617): what it takes and refuses, the type of the entries it hands a body,
|
|
8
|
+
* and the body's parameter in each form that declares inputs.
|
|
9
|
+
*/
|
|
10
|
+
import { describe, it } from 'node:test';
|
|
11
|
+
import * as assert from 'node:assert';
|
|
12
|
+
import { DateTimeType, DictType, East, FloatType, IntegerType, NullType, OptionType, SortedMap, StringType, StructType, compareFor, isTypeValueEqual, none, printType, toEastTypeValue, variant, } from '@elaraai/east';
|
|
13
|
+
import { RecordSummaryTotalsType, indexCollectionType } from '@elaraai/e3-types';
|
|
14
|
+
import { index } from './index-input.js';
|
|
15
|
+
import { function_ } from './function.js';
|
|
16
|
+
import { input } from './input.js';
|
|
17
|
+
import { output } from './output.js';
|
|
18
|
+
import { package_ } from './package.js';
|
|
19
|
+
import { record } from './record.js';
|
|
20
|
+
import { builtIndex } from './record-programs.js';
|
|
21
|
+
import { customTask, partition, streamTask, task } from './task.js';
|
|
22
|
+
/** Whether two East types are one type, as East tells them. */
|
|
23
|
+
function sameType(a, b) {
|
|
24
|
+
return isTypeValueEqual(toEastTypeValue(a), toEastTypeValue(b));
|
|
25
|
+
}
|
|
26
|
+
/** Asserts a type is the one expected, printing both when it is not. */
|
|
27
|
+
function assertType(actual, expected, what) {
|
|
28
|
+
assert.ok(sameType(actual, expected), `${what}: ${printType(actual)}, expected ${printType(expected)}`);
|
|
29
|
+
}
|
|
30
|
+
const JobType = StructType({
|
|
31
|
+
title: StringType, press: StringType,
|
|
32
|
+
start: OptionType(DateTimeType), end: OptionType(DateTimeType), sheets: FloatType,
|
|
33
|
+
});
|
|
34
|
+
const JobsType = DictType(StringType, JobType);
|
|
35
|
+
const jobs = record('jobs', JobsType, {
|
|
36
|
+
initial: new Map(),
|
|
37
|
+
indexes: (index) => ({
|
|
38
|
+
jobs_by_press: index.on(['press']),
|
|
39
|
+
jobs_titles: index.on(['press'], { value: East.function([StringType, JobType], StringType, (_$, _key, job) => job.title) }),
|
|
40
|
+
jobs_by_press_week: index.series({ key: 'press', from: 'start', to: 'end', tile: 'week' }),
|
|
41
|
+
press_weeks: index.summary({ key: 'press', from: 'start', to: 'end', tile: 'week' }),
|
|
42
|
+
}),
|
|
43
|
+
mutations: (mutation) => ({ patch: mutation.patch() }),
|
|
44
|
+
});
|
|
45
|
+
const presses = input('presses', DictType(StringType, StringType), variant('value', new Map([['P1', 'Heidelberg']])));
|
|
46
|
+
/** The entries of `jobs_by_press`: `Dict<{ ik: press, k: job }, Null>`. */
|
|
47
|
+
const ByPressKey = StructType({ ik: StringType, k: StringType });
|
|
48
|
+
const ByPress = DictType(ByPressKey, NullType);
|
|
49
|
+
/** Entries of `jobs_by_press` for the jobs given, as `[press, job]`. */
|
|
50
|
+
function byPressOf(entries) {
|
|
51
|
+
return new SortedMap(entries.map(([ik, k]) => [{ ik, k }, null]), compareFor(ByPressKey));
|
|
52
|
+
}
|
|
53
|
+
describe('e3.index', () => {
|
|
54
|
+
it('takes an index as its record carries it, and types its entries Dict<{ ik, k }, P>', () => {
|
|
55
|
+
const byPress = index(jobs.indexes.jobs_by_press);
|
|
56
|
+
assert.strictEqual(byPress.kind, 'index');
|
|
57
|
+
assert.strictEqual(byPress.index, jobs.indexes.jobs_by_press);
|
|
58
|
+
assert.strictEqual(byPress.record, jobs);
|
|
59
|
+
assertType(byPress.type, ByPress, 'an index that carries nothing');
|
|
60
|
+
// What it carries is the entries' value: a `value` of its own, or the row
|
|
61
|
+
assertType(index(jobs.indexes.jobs_titles).type, DictType(ByPressKey, StringType), 'an index with a value');
|
|
62
|
+
const series = jobs.indexes.jobs_by_press_week;
|
|
63
|
+
assertType(index(series).type, DictType(StructType({ ik: series.keyType, k: StringType }), JobType), 'a series index, which carries the row');
|
|
64
|
+
});
|
|
65
|
+
it('types a summary index\'s entries with a Null row key, as the store holds them', () => {
|
|
66
|
+
const weeks = jobs.indexes.press_weeks;
|
|
67
|
+
assertType(index(weeks).type, DictType(StructType({ ik: weeks.keyType, k: NullType }), RecordSummaryTotalsType), 'a summary index');
|
|
68
|
+
});
|
|
69
|
+
it('types the entries as the index is built: beside an entries index, one that carries nothing carries the lean row', () => {
|
|
70
|
+
const Evidence = StructType({ parcels: IntegerType, site: StringType, byService: DictType(StringType, IntegerType) });
|
|
71
|
+
const evidence = record('evidence', DictType(StringType, Evidence), {
|
|
72
|
+
initial: new Map(),
|
|
73
|
+
indexes: (index) => ({
|
|
74
|
+
by_site: index.on(['site']),
|
|
75
|
+
by_service: index.entries('byService'),
|
|
76
|
+
}),
|
|
77
|
+
});
|
|
78
|
+
const bySite = index(evidence.indexes.by_site);
|
|
79
|
+
assertType(bySite.type, DictType(StructType({ ik: StringType, k: StringType }), Evidence), 'the lean row, whose type is the row\'s');
|
|
80
|
+
// The type is the one the store keeps the built index in
|
|
81
|
+
const built = builtIndex(evidence, evidence.indexes.by_site);
|
|
82
|
+
assertType(bySite.type, indexCollectionType(StringType, built.keyType, built.valueType), 'the built index\'s collection');
|
|
83
|
+
// An entries index files its field's entries, each under its own key
|
|
84
|
+
assertType(index(evidence.indexes.by_service).type, DictType(StructType({ ik: StringType, k: StringType }), IntegerType), 'an entries index');
|
|
85
|
+
});
|
|
86
|
+
it('takes the indexes e3 keeps beside one: an entries index\'s lean rows, and a nested series index\'s span', () => {
|
|
87
|
+
const Evidence = StructType({ parcels: IntegerType, byService: DictType(StringType, IntegerType) });
|
|
88
|
+
const evidence = record('evidence', DictType(StringType, Evidence), {
|
|
89
|
+
initial: new Map(),
|
|
90
|
+
indexes: (index) => ({ by_service: index.entries('byService') }),
|
|
91
|
+
});
|
|
92
|
+
const rows = evidence.indexes.by_service.entries.rows;
|
|
93
|
+
assertType(index(rows).type, DictType(StructType({ ik: StringType, k: StringType }), Evidence), 'an entries index\'s lean rows');
|
|
94
|
+
const Machine = StructType({ name: StringType, load: DictType(DateTimeType, FloatType) });
|
|
95
|
+
const machines = record('machines', DictType(StringType, Machine), {
|
|
96
|
+
initial: new Map(),
|
|
97
|
+
indexes: (index) => ({ machines_in_time: index.nested({ collections: { load: index.nested.values() }, tile: 'week', summary: 'month' }) }),
|
|
98
|
+
});
|
|
99
|
+
const span = machines.indexes.machines_in_time.nested.span;
|
|
100
|
+
assertType(index(span).type, DictType(StructType({ ik: span.keyType, k: NullType }), RecordSummaryTotalsType), 'a nested series index\'s span, summed as a summary is');
|
|
101
|
+
assert.strictEqual(index(span).record, machines);
|
|
102
|
+
});
|
|
103
|
+
it('refuses anything but an index a record carries by name, naming what it was given', () => {
|
|
104
|
+
const untyped = index;
|
|
105
|
+
const takes = 'e3.index takes an index of a record, as the record carries it by name — e3.index(record.indexes.<name>) — and was given ';
|
|
106
|
+
assert.throws(() => untyped(jobs), {
|
|
107
|
+
message: `${takes}the record 'jobs' itself — pass one of its indexes, as jobs.indexes.<name>; ` +
|
|
108
|
+
`its indexes are 'jobs_by_press', 'jobs_titles', 'jobs_by_press_week', 'press_weeks'`,
|
|
109
|
+
});
|
|
110
|
+
assert.throws(() => untyped(record('bare', JobsType, { initial: new Map() })), {
|
|
111
|
+
message: `${takes}the record 'bare' itself — pass one of its indexes, as bare.indexes.<name>; it declares no index`,
|
|
112
|
+
});
|
|
113
|
+
assert.throws(() => untyped(presses), { message: `${takes}the dataset 'presses', which is no record: only an e3.record has indexes` });
|
|
114
|
+
assert.throws(() => untyped(partition(presses)), { message: `${takes}e3.partition of 'presses': a partition marks a dataset, and an index is read whole` });
|
|
115
|
+
assert.throws(() => untyped(index(jobs.indexes.jobs_by_press)), { message: `${takes}an e3.index already: pass the record's index, as record.indexes.<name>` });
|
|
116
|
+
assert.throws(() => untyped('jobs_by_press'), { message: `${takes}a string` });
|
|
117
|
+
assert.throws(() => untyped(null), { message: `${takes}null` });
|
|
118
|
+
// An index's definition its record does not carry: a copy, or one under another record
|
|
119
|
+
const copy = { ...jobs.indexes.jobs_by_press };
|
|
120
|
+
assert.throws(() => untyped(copy), {
|
|
121
|
+
message: `${takes}an index named 'jobs_by_press' that no record carries by that name — pass it as the record holds it, record.indexes.jobs_by_press`,
|
|
122
|
+
});
|
|
123
|
+
// What the `index` builder makes, before a record builds it
|
|
124
|
+
let draft;
|
|
125
|
+
record('drafting', JobsType, { initial: new Map(), indexes: (index) => { draft = index.on(['press']); return {}; } });
|
|
126
|
+
assert.throws(() => untyped(draft), {
|
|
127
|
+
message: `${takes}an index the \`index\` builder made, before its record built it — declare it in e3.record's \`indexes\`, and pass record.indexes.<name>`,
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
it('refuses a record\'s other parts and e3\'s other definitions, each named by what it is', () => {
|
|
131
|
+
const untyped = index;
|
|
132
|
+
const takes = 'e3.index takes an index of a record, as the record carries it by name — e3.index(record.indexes.<name>) — and was given ';
|
|
133
|
+
assert.throws(() => untyped(jobs.mutations.patch), {
|
|
134
|
+
message: `${takes}the mutation 'patch': a mutation writes its record, and has no index — pass one of the record's indexes, as record.indexes.<name>`,
|
|
135
|
+
});
|
|
136
|
+
const count = function_('count', { inputs: [jobs], args: [], output: IntegerType }, ($, rows) => rows.size());
|
|
137
|
+
assert.throws(() => untyped(count), { message: `${takes}the function 'count': a function has no index` });
|
|
138
|
+
assert.throws(() => untyped(package_('planning', '1.0.0', count)), { message: `${takes}the package 'planning': a package has no index` });
|
|
139
|
+
assert.throws(() => untyped(output.dict(StringType, FloatType)), { message: `${takes}e3.output.dict, an output kind: it has no index` });
|
|
140
|
+
// What a record's other builders make, before a record builds it
|
|
141
|
+
let mutation;
|
|
142
|
+
record('drafting_mutation', JobsType, { initial: new Map(), mutations: (builder) => { mutation = builder.patch(); return {}; } });
|
|
143
|
+
assert.throws(() => untyped(mutation), { message: `${takes}a mutation the \`mutation\` builder made, which has no index` });
|
|
144
|
+
assert.throws(() => untyped({ name: 'jobs_by_press' }), { message: `${takes}a value that is no definition of e3's` });
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
describe('e3.index as an input', () => {
|
|
148
|
+
const held = byPressOf([['P1', 'j1'], ['P1', 'j3'], ['P2', 'j2'], ['P3', 'j4']]);
|
|
149
|
+
it('gives a function\'s body the index\'s entries, before its arguments', () => {
|
|
150
|
+
const jobsOnPress = function_('jobs_on_press', {
|
|
151
|
+
inputs: [index(jobs.indexes.jobs_by_press)],
|
|
152
|
+
args: [StringType],
|
|
153
|
+
output: IntegerType,
|
|
154
|
+
}, ($, jobsByPress, press) => jobsByPress.prefix({ ik: press }).size());
|
|
155
|
+
assert.strictEqual(jobsOnPress.inputs.length, 1);
|
|
156
|
+
assert.strictEqual(jobsOnPress.inputs[0].kind, 'index');
|
|
157
|
+
assert.deepStrictEqual(jobsOnPress.argTypes.map((type) => printType(type)), [printType(StringType)]);
|
|
158
|
+
const compiled = jobsOnPress.body.compile([]);
|
|
159
|
+
assert.strictEqual(compiled(held, 'P1'), 2n);
|
|
160
|
+
assert.strictEqual(compiled(held, 'P2'), 1n);
|
|
161
|
+
assert.strictEqual(compiled(held, 'P9'), 0n);
|
|
162
|
+
// The package collects the index's record, as it collects any input's
|
|
163
|
+
assert.ok(jobsOnPress.deps.has(jobs), 'its record is among what it depends on');
|
|
164
|
+
const pkg = package_('index-fn', '1.0.0', jobsOnPress);
|
|
165
|
+
assert.ok(pkg.contents.includes(jobs), 'the package holds the record');
|
|
166
|
+
assert.strictEqual(pkg.records['jobs'], jobs);
|
|
167
|
+
});
|
|
168
|
+
it('reads more of a row than the index carries from the record beside it, by the entry\'s key', () => {
|
|
169
|
+
const titlesOnPress = function_('titles_on_press', {
|
|
170
|
+
inputs: [index(jobs.indexes.jobs_by_press), jobs],
|
|
171
|
+
args: [StringType],
|
|
172
|
+
output: DictType(StringType, StringType),
|
|
173
|
+
}, ($, jobsByPress, jobs, press) => {
|
|
174
|
+
const titles = $.let(new Map(), DictType(StringType, StringType));
|
|
175
|
+
$.for(jobsByPress.prefix({ ik: press }), ($, _carried, key) => {
|
|
176
|
+
$(titles.insert(key.k, jobs.get(key.k).title));
|
|
177
|
+
});
|
|
178
|
+
return titles;
|
|
179
|
+
});
|
|
180
|
+
const job = (title, press) => ({ title, press, start: none, end: none, sheets: 1.0 });
|
|
181
|
+
const rows = new Map([['j1', job('Annual report', 'P1')], ['j2', job('Posters', 'P2')], ['j3', job('Catalogue', 'P1')], ['j4', job('Flyers', 'P3')]]);
|
|
182
|
+
const titles = titlesOnPress.body.compile([])(held, rows, 'P1');
|
|
183
|
+
assert.deepStrictEqual([...titles], [['j1', 'Annual report'], ['j3', 'Catalogue']]);
|
|
184
|
+
});
|
|
185
|
+
it('gives a task\'s body the index\'s entries, its parameter the input\'s type', () => {
|
|
186
|
+
const byPress = index(jobs.indexes.jobs_by_press);
|
|
187
|
+
const busiest = task('busiest_press', [byPress, presses], East.function([byPress.type, DictType(StringType, StringType)], StringType, ($, jobsByPress, presses) => {
|
|
188
|
+
const best = $.let('');
|
|
189
|
+
const most = $.let(0n);
|
|
190
|
+
$.for(presses, ($, _press, code) => {
|
|
191
|
+
const count = $.const(jobsByPress.prefix({ ik: code }).size());
|
|
192
|
+
$.if(East.less(most, count), ($) => { $.assign(most, count); $.assign(best, code); });
|
|
193
|
+
});
|
|
194
|
+
return best;
|
|
195
|
+
}));
|
|
196
|
+
assert.deepStrictEqual(busiest.inputs, [byPress, presses]);
|
|
197
|
+
assert.ok(busiest.deps.has(jobs), 'its record is among what the task depends on');
|
|
198
|
+
assert.ok(package_('index-task', '1.0.0', busiest).contents.includes(jobs), 'and the package holds it');
|
|
199
|
+
assert.strictEqual(busiest.body.kind, 'east');
|
|
200
|
+
const compiled = (busiest.body.kind === 'east' ? busiest.body.program : undefined).compile([]);
|
|
201
|
+
assert.strictEqual(compiled(held, new Map([['P1', 'Heidelberg'], ['P2', 'Komori'], ['P3', 'Roland']])), 'P1');
|
|
202
|
+
});
|
|
203
|
+
it('refuses a task whose body\'s parameter is not the index\'s type, naming it', () => {
|
|
204
|
+
const byPress = index(jobs.indexes.jobs_by_press);
|
|
205
|
+
const untyped = task;
|
|
206
|
+
assert.throws(() => untyped('rows_for_entries', [byPress], East.function([JobsType], IntegerType, (_$, rows) => rows.size())), {
|
|
207
|
+
message: `task 'rows_for_entries': its input 'jobs.jobs_by_press' is an index whose entries are ${printType(ByPress)}, and the body's parameter for it ` +
|
|
208
|
+
`is ${printType(JobsType)} — declare the parameter as the input's type, e3.index(…).type`,
|
|
209
|
+
});
|
|
210
|
+
assert.throws(() => untyped('no_parameter', [byPress], East.function([], IntegerType, () => 0n)), {
|
|
211
|
+
message: `task 'no_parameter': its input 'jobs.jobs_by_press' is an index whose entries are ${printType(ByPress)}, and the body's parameter for it ` +
|
|
212
|
+
`is missing — declare the parameter as the input's type, e3.index(…).type`,
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
it('reaches every piece of a stream task whole, beside the input its work is split over', () => {
|
|
216
|
+
const sales = input('sales', DictType(StringType, StructType({ press: StringType, amount: FloatType })));
|
|
217
|
+
const totals = streamTask('totals_on_busy_presses', {
|
|
218
|
+
inputs: [partition(sales), index(jobs.indexes.jobs_by_press)],
|
|
219
|
+
output: output.dict(StringType, FloatType, { merge: (_$, _press, a, b) => a.add(b) }),
|
|
220
|
+
}, ($, sales, jobsByPress, emit) => {
|
|
221
|
+
$.for(sales, ($, sale) => {
|
|
222
|
+
$.if(East.greater(jobsByPress.prefix({ ik: sale.press }).size(), 0n), ($) => { $(emit(sale.press, sale.amount)); });
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
assert.strictEqual(totals.inputs.length, 2);
|
|
226
|
+
assert.strictEqual(totals.inputs[0].kind, 'partition');
|
|
227
|
+
assert.strictEqual(totals.inputs[1].kind, 'index');
|
|
228
|
+
assert.ok(totals.deps.has(jobs) && totals.deps.has(sales), 'the record and the dataset are both collected');
|
|
229
|
+
});
|
|
230
|
+
it('is refused inside e3.partition, as an input of a custom task, and of a function on the custom runtime, each naming the change to make', () => {
|
|
231
|
+
const byPress = index(jobs.indexes.jobs_by_press);
|
|
232
|
+
const untypedPartition = partition;
|
|
233
|
+
assert.throws(() => untypedPartition(byPress), {
|
|
234
|
+
message: 'e3.partition: \'jobs.jobs_by_press\' is an index of a record, which a stream task\'s work is not split over — '
|
|
235
|
+
+ 'pass the e3.index itself: every piece reads it whole, a run at a time',
|
|
236
|
+
});
|
|
237
|
+
const untypedCustom = customTask;
|
|
238
|
+
assert.throws(() => untypedCustom('copy', [byPress], StringType, () => 'true'), {
|
|
239
|
+
message: 'customTask \'copy\': input \'jobs.jobs_by_press\' is an index of a record, and a custom task\'s command reads its inputs as files — '
|
|
240
|
+
+ 'read the index in an e3.task or an e3.streamTask, and pass that task\'s output',
|
|
241
|
+
});
|
|
242
|
+
assert.throws(() => function_('custom', {
|
|
243
|
+
inputs: [byPress],
|
|
244
|
+
args: [],
|
|
245
|
+
output: IntegerType,
|
|
246
|
+
runner: { runtime: 'custom', command: ['python3', 'my-runner.py'] },
|
|
247
|
+
}, ($, jobsByPress) => jobsByPress.size()), /e3.function 'custom': the custom runtime takes no inputs/);
|
|
248
|
+
});
|
|
249
|
+
it('lets a function draft a record it reads by an index alone, and refuses a record none of its inputs reads', () => {
|
|
250
|
+
const drafted = function_('drafted_by_index', {
|
|
251
|
+
inputs: [index(jobs.indexes.jobs_by_press)],
|
|
252
|
+
drafts: [jobs],
|
|
253
|
+
args: [StringType],
|
|
254
|
+
output: IntegerType,
|
|
255
|
+
}, ($, jobsByPress, press) => jobsByPress.prefix({ ik: press }).size());
|
|
256
|
+
assert.deepStrictEqual(drafted.drafts, [jobs]);
|
|
257
|
+
const other = record('other', JobsType, { initial: new Map(), mutations: (mutation) => ({ patch: mutation.patch() }) });
|
|
258
|
+
assert.throws(() => function_('unread', {
|
|
259
|
+
inputs: [index(jobs.indexes.jobs_by_press)],
|
|
260
|
+
drafts: [other],
|
|
261
|
+
args: [],
|
|
262
|
+
output: IntegerType,
|
|
263
|
+
}, ($, jobsByPress) => jobsByPress.size()), {
|
|
264
|
+
message: 'e3.function \'unread\': the record \'other\', listed in drafts, is read by none of its inputs — '
|
|
265
|
+
+ 'list it in inputs too, or an index of it, and a call reads it with its drafts laid over it',
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
//# sourceMappingURL=index-input.spec.js.map
|
|
@@ -0,0 +1 @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