@elaraai/e3 1.0.78 → 1.0.80
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 +11 -2
- package/dist/src/browser.d.ts +5 -4
- package/dist/src/browser.d.ts.map +1 -1
- package/dist/src/browser.js +3 -2
- package/dist/src/browser.js.map +1 -1
- package/dist/src/dataset-file.d.ts +17 -19
- package/dist/src/dataset-file.d.ts.map +1 -1
- package/dist/src/dataset-file.js +26 -45
- package/dist/src/dataset-file.js.map +1 -1
- package/dist/src/export.d.ts +2 -3
- package/dist/src/export.d.ts.map +1 -1
- package/dist/src/export.js +150 -80
- package/dist/src/export.js.map +1 -1
- package/dist/src/export.spec.js +177 -57
- package/dist/src/export.spec.js.map +1 -1
- package/dist/src/function.spec.js +29 -58
- package/dist/src/function.spec.js.map +1 -1
- package/dist/src/functions-link.spec.js +19 -17
- package/dist/src/functions-link.spec.js.map +1 -1
- package/dist/src/index.d.ts +56 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/input.d.ts +8 -5
- package/dist/src/input.d.ts.map +1 -1
- package/dist/src/input.js +8 -5
- package/dist/src/input.js.map +1 -1
- package/dist/src/migration.d.ts +172 -0
- package/dist/src/migration.d.ts.map +1 -0
- package/dist/src/migration.js +108 -0
- package/dist/src/migration.js.map +1 -0
- package/dist/src/migration.spec.d.ts +6 -0
- package/dist/src/migration.spec.d.ts.map +1 -0
- package/dist/src/migration.spec.js +197 -0
- package/dist/src/migration.spec.js.map +1 -0
- package/dist/src/mutation-programs.spec.d.ts +6 -0
- package/dist/src/mutation-programs.spec.d.ts.map +1 -0
- package/dist/src/mutation-programs.spec.js +310 -0
- package/dist/src/mutation-programs.spec.js.map +1 -0
- package/dist/src/mutation.d.ts +117 -9
- package/dist/src/mutation.d.ts.map +1 -1
- package/dist/src/mutation.js +104 -46
- package/dist/src/mutation.js.map +1 -1
- package/dist/src/open-beast-link.spec.js +10 -8
- package/dist/src/open-beast-link.spec.js.map +1 -1
- package/dist/src/output.d.ts +117 -0
- package/dist/src/output.d.ts.map +1 -0
- package/dist/src/output.js +119 -0
- package/dist/src/output.js.map +1 -0
- package/dist/src/package.d.ts +7 -5
- package/dist/src/package.d.ts.map +1 -1
- package/dist/src/package.js +98 -8
- package/dist/src/package.js.map +1 -1
- package/dist/src/package.spec.d.ts +6 -0
- package/dist/src/package.spec.d.ts.map +1 -0
- package/dist/src/package.spec.js +16 -0
- package/dist/src/package.spec.js.map +1 -0
- package/dist/src/record-guards.d.ts +41 -0
- package/dist/src/record-guards.d.ts.map +1 -0
- package/dist/src/record-guards.js +44 -0
- package/dist/src/record-guards.js.map +1 -0
- package/dist/src/record-index.d.ts +129 -0
- package/dist/src/record-index.d.ts.map +1 -0
- package/dist/src/record-index.js +144 -0
- package/dist/src/record-index.js.map +1 -0
- package/dist/src/record-index.spec.d.ts +6 -0
- package/dist/src/record-index.spec.d.ts.map +1 -0
- package/dist/src/record-index.spec.js +160 -0
- package/dist/src/record-index.spec.js.map +1 -0
- package/dist/src/record-programs.d.ts +128 -0
- package/dist/src/record-programs.d.ts.map +1 -0
- package/dist/src/record-programs.js +480 -0
- package/dist/src/record-programs.js.map +1 -0
- package/dist/src/record.d.ts.map +1 -1
- package/dist/src/record.js +2 -0
- package/dist/src/record.js.map +1 -1
- package/dist/src/record.spec.js +71 -13
- package/dist/src/record.spec.js.map +1 -1
- package/dist/src/runner.d.ts +6 -9
- package/dist/src/runner.d.ts.map +1 -1
- package/dist/src/runner.js +9 -25
- package/dist/src/runner.js.map +1 -1
- package/dist/src/runner.spec.js +16 -34
- package/dist/src/runner.spec.js.map +1 -1
- package/dist/src/sha256.d.ts +4 -3
- package/dist/src/sha256.d.ts.map +1 -1
- package/dist/src/sha256.js +20 -17
- package/dist/src/sha256.js.map +1 -1
- package/dist/src/sha256.spec.js +10 -0
- package/dist/src/sha256.spec.js.map +1 -1
- package/dist/src/task.d.ts +116 -251
- package/dist/src/task.d.ts.map +1 -1
- package/dist/src/task.js +169 -435
- package/dist/src/task.js.map +1 -1
- package/dist/src/task.spec.js +174 -489
- package/dist/src/task.spec.js.map +1 -1
- package/dist/src/types.d.ts +215 -23
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/src/package.js
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Package definitions for e3.
|
|
7
|
+
*/
|
|
8
|
+
import { printType } from '@elaraai/east';
|
|
9
|
+
import { nameProblem } from '@elaraai/e3-types';
|
|
10
|
+
import { sameEastType } from './record-guards.js';
|
|
5
11
|
/**
|
|
6
12
|
* Creates a package definition from items.
|
|
7
13
|
*
|
|
@@ -18,6 +24,11 @@
|
|
|
18
24
|
* @param version - Package version
|
|
19
25
|
* @param items - Items to include (datasets, tasks)
|
|
20
26
|
* @returns A PackageDef with typed access to contents
|
|
27
|
+
* @throws {Error} When the name or the version cannot be a file name — a
|
|
28
|
+
* repository keeps the package at `packages/<name>/<version>` — when a
|
|
29
|
+
* record is given two different mutations, indexes or migrations of one
|
|
30
|
+
* name, or when a record's migrations are not one chain that leaves it as
|
|
31
|
+
* its declared type
|
|
21
32
|
*
|
|
22
33
|
* @example
|
|
23
34
|
* ```ts
|
|
@@ -41,6 +52,11 @@
|
|
|
41
52
|
// and forced authors to hand-annotate. Access datasets via the exported
|
|
42
53
|
// task/input consts (`myTask.output`, `myInput.path`) instead — fully typed.
|
|
43
54
|
export function package_(name, version, ...items) {
|
|
55
|
+
for (const [kind, value] of [['package', name], ['package version', version]]) {
|
|
56
|
+
const problem = nameProblem(kind, value);
|
|
57
|
+
if (problem !== null)
|
|
58
|
+
throw new Error(`e3.package: the ${kind} name ${JSON.stringify(value)} ${problem}`);
|
|
59
|
+
}
|
|
44
60
|
// Recursively collect all items and their transitive dependencies
|
|
45
61
|
const all_items = new Set();
|
|
46
62
|
const visited = new Set();
|
|
@@ -51,6 +67,12 @@ export function package_(name, version, ...items) {
|
|
|
51
67
|
// folded onto their record below. Records themselves are datasets, so they
|
|
52
68
|
// ride `all_items` and only need a separate RecordObject channel.
|
|
53
69
|
const mutationsByRecord = new Map();
|
|
70
|
+
// Indexes are collected onto their record the same way, and for the same
|
|
71
|
+
// reason: an index is declared beside the record and belongs to it.
|
|
72
|
+
const indexesByRecord = new Map();
|
|
73
|
+
// Migrations are collected onto their record too, each with the steps before
|
|
74
|
+
// it, which its `after` names: passing a chain's last step passes the chain.
|
|
75
|
+
const migrationsByRecord = new Map();
|
|
54
76
|
const importedRecords = {};
|
|
55
77
|
function collect(item) {
|
|
56
78
|
if (visited.has(item))
|
|
@@ -77,9 +99,18 @@ export function package_(name, version, ...items) {
|
|
|
77
99
|
else if (item.kind === "mutation") {
|
|
78
100
|
// Pull in the owning record's dataset and register the mutation onto it.
|
|
79
101
|
collect(item.record);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
102
|
+
mutationsByRecord.set(item.record.name, [...(mutationsByRecord.get(item.record.name) ?? []), item]);
|
|
103
|
+
}
|
|
104
|
+
else if (item.kind === "recordIndex") {
|
|
105
|
+
collect(item.record);
|
|
106
|
+
indexesByRecord.set(item.record.name, [...(indexesByRecord.get(item.record.name) ?? []), item]);
|
|
107
|
+
}
|
|
108
|
+
else if (item.kind === "migration") {
|
|
109
|
+
collect(item.record);
|
|
110
|
+
const steps = migrationsByRecord.get(item.record.name) ?? [];
|
|
111
|
+
for (let step = item; step !== undefined; step = step.after)
|
|
112
|
+
steps.push(step);
|
|
113
|
+
migrationsByRecord.set(item.record.name, steps);
|
|
83
114
|
}
|
|
84
115
|
else {
|
|
85
116
|
collect(item);
|
|
@@ -127,6 +158,55 @@ export function package_(name, version, ...items) {
|
|
|
127
158
|
tasks[item.name] = item;
|
|
128
159
|
}
|
|
129
160
|
}
|
|
161
|
+
// One declaration per name on a record: given two different mutations, or
|
|
162
|
+
// two different indexes, under one name, the record would keep whichever
|
|
163
|
+
// came last.
|
|
164
|
+
const byName = (record, kind, defs) => {
|
|
165
|
+
const named = {};
|
|
166
|
+
for (const def of defs) {
|
|
167
|
+
const taken = named[def.name];
|
|
168
|
+
if (taken !== undefined && taken !== def) {
|
|
169
|
+
throw new Error(`e3.package '${name}': record '${record}' declares two ${kind} named '${def.name}' — pass each declaration once`);
|
|
170
|
+
}
|
|
171
|
+
named[def.name] = def;
|
|
172
|
+
}
|
|
173
|
+
return named;
|
|
174
|
+
};
|
|
175
|
+
// A record's migrations in the order they run. They are one chain: exactly
|
|
176
|
+
// one step has no `after`, no two name the same one, and the last leaves the
|
|
177
|
+
// record as it is declared, since a deploy leaves a migrated record at the
|
|
178
|
+
// package's type.
|
|
179
|
+
const chainOf = (rec, steps) => {
|
|
180
|
+
const all = Object.values(byName(rec.name, 'migrations', steps));
|
|
181
|
+
if (all.length === 0)
|
|
182
|
+
return [];
|
|
183
|
+
const where = `e3.package '${name}': record '${rec.name}'`;
|
|
184
|
+
const firsts = all.filter((step) => step.after === undefined);
|
|
185
|
+
if (firsts.length !== 1) {
|
|
186
|
+
throw new Error(`${where} has ${firsts.length} migrations with no 'after' (${firsts.map((step) => `'${step.name}'`).join(', ')}) — ` +
|
|
187
|
+
`its migrations are one chain, and only the first step names none`);
|
|
188
|
+
}
|
|
189
|
+
const next = new Map();
|
|
190
|
+
for (const step of all) {
|
|
191
|
+
if (step.after === undefined)
|
|
192
|
+
continue;
|
|
193
|
+
const taken = next.get(step.after.name);
|
|
194
|
+
if (taken !== undefined) {
|
|
195
|
+
throw new Error(`${where} has two migrations after '${step.after.name}', '${taken.name}' and '${step.name}' — ` +
|
|
196
|
+
`its migrations are one chain`);
|
|
197
|
+
}
|
|
198
|
+
next.set(step.after.name, step);
|
|
199
|
+
}
|
|
200
|
+
const chain = [firsts[0]];
|
|
201
|
+
for (let step = next.get(firsts[0].name); step !== undefined; step = next.get(step.name))
|
|
202
|
+
chain.push(step);
|
|
203
|
+
const last = chain[chain.length - 1];
|
|
204
|
+
if (!sameEastType(last.to, rec.type)) {
|
|
205
|
+
throw new Error(`${where} is declared as ${printType(rec.type)}, but its last migration, '${last.name}', ` +
|
|
206
|
+
`leaves it as ${printType(last.to)}`);
|
|
207
|
+
}
|
|
208
|
+
return chain;
|
|
209
|
+
};
|
|
130
210
|
// Assemble records: a record's dataset rides `all_items`; fold in any
|
|
131
211
|
// mutations collected for it. A record imported via a package arrives twice —
|
|
132
212
|
// its bare dataset (mutations `{}`) in `all_items` and its already-assembled
|
|
@@ -139,11 +219,21 @@ export function package_(name, version, ...items) {
|
|
|
139
219
|
const rec = item;
|
|
140
220
|
records[rec.name] = {
|
|
141
221
|
...rec,
|
|
142
|
-
mutations:
|
|
143
|
-
...records[rec.name]?.mutations,
|
|
144
|
-
...rec.mutations,
|
|
145
|
-
...mutationsByRecord.get(rec.name),
|
|
146
|
-
|
|
222
|
+
mutations: byName(rec.name, 'mutations', [
|
|
223
|
+
...Object.values(records[rec.name]?.mutations ?? {}),
|
|
224
|
+
...Object.values(rec.mutations),
|
|
225
|
+
...(mutationsByRecord.get(rec.name) ?? []),
|
|
226
|
+
]),
|
|
227
|
+
indexes: byName(rec.name, 'indexes', [
|
|
228
|
+
...Object.values(records[rec.name]?.indexes ?? {}),
|
|
229
|
+
...Object.values(rec.indexes),
|
|
230
|
+
...(indexesByRecord.get(rec.name) ?? []),
|
|
231
|
+
]),
|
|
232
|
+
migrations: chainOf(rec, [
|
|
233
|
+
...(records[rec.name]?.migrations ?? []),
|
|
234
|
+
...rec.migrations,
|
|
235
|
+
...(migrationsByRecord.get(rec.name) ?? []),
|
|
236
|
+
]),
|
|
147
237
|
};
|
|
148
238
|
}
|
|
149
239
|
}
|
package/dist/src/package.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,8EAA8E;AAC9E,kFAAkF;AAClF,mFAAmF;AACnF,gFAAgF;AAChF,mFAAmF;AACnF,wEAAwE;AACxE,6EAA6E;AAC7E,MAAM,UAAU,QAAQ,CACtB,IAAY,EACZ,OAAe,EACf,GAAG,KAAoG;IAEvG,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAU,EAAE,CAAC;QACvF,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,OAAO,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,SAAS,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;IAC5G,CAAC;IAED,kEAAkE;IAClE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAe,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;IACvC,sEAAsE;IACtE,mCAAmC;IACnC,MAAM,SAAS,GAAgC,EAAE,CAAC;IAClD,0EAA0E;IAC1E,2EAA2E;IAC3E,kEAAkE;IAClE,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC3D,yEAAyE;IACzE,oEAAoE;IACpE,MAAM,eAAe,GAAG,IAAI,GAAG,E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AE,SAAS,EAAE;oBACnC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,IAAI,EAAE,CAAC;oBAClD,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;oBAC7B,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBACzC,CAAC;gBACF,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE;oBACvB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,UAAU,IAAI,EAAE,CAAC;oBACxC,GAAG,GAAG,CAAC,UAAU;oBACjB,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBAC5C,CAAC;aACH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,+BAA+B,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,IAAI;QACJ,OAAO;QACP,QAAQ,EAAE,QAAe;QACzB,QAAQ,EAAE,CAAC,GAAG,SAAS,CAAC;QACxB,SAAS;QACT,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../../src/package.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
import { describe, it } from 'node:test';
|
|
6
|
+
import * as assert from 'node:assert';
|
|
7
|
+
import { package_ } from './package.js';
|
|
8
|
+
describe('package', () => {
|
|
9
|
+
it('refuses a name or a version no path can hold, since a repository keeps a package under both', () => {
|
|
10
|
+
assert.throws(() => package_('../escape', '1.0.0'), /^Error: e3\.package: the package name "\.\.\/escape" holds "\/", which a file name cannot$/);
|
|
11
|
+
assert.throws(() => package_('pkg', '..'), /^Error: e3\.package: the package version name "\.\." is a path of its own$/);
|
|
12
|
+
assert.throws(() => package_('pkg', ''), /^Error: e3\.package: the package version name "" is empty$/);
|
|
13
|
+
assert.strictEqual(package_('pkg', '1.0.0-rc.1').version, '1.0.0-rc.1');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=package.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../../src/package.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,6FAA6F,EAAE,GAAG,EAAE;QACrG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,4FAA4F,CAAC,CAAC;QAClJ,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,4EAA4E,CAAC,CAAC;QACzH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,4DAA4D,CAAC,CAAC;QACvG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 guards a record's declarations share. A mutation, an index and a
|
|
7
|
+
* migration each run an author's function where the data is, again and again,
|
|
8
|
+
* and each must give the same result every time it runs.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import type { EastType } from '@elaraai/east';
|
|
13
|
+
/**
|
|
14
|
+
* Whether two East types are the same type.
|
|
15
|
+
*
|
|
16
|
+
* @param a - One type
|
|
17
|
+
* @param b - The other
|
|
18
|
+
* @returns Whether their type values are equal
|
|
19
|
+
*/
|
|
20
|
+
export declare function sameEastType(a: EastType, b: EastType): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Refuses an author's function that is async or reaches a platform function.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* An async function implies platform IO. A synchronous platform call is an
|
|
26
|
+
* ordinary function IR, so the whole body is walked for one: `walkIR` descends
|
|
27
|
+
* into nested closures, loop bodies and collection-op lambdas.
|
|
28
|
+
*
|
|
29
|
+
* @param subject - The function as the error names it, such as
|
|
30
|
+
* `e3.mutation.reduce 'place' body`
|
|
31
|
+
* @param fn - The function
|
|
32
|
+
* @param why - Why the declaration refuses each, which ends its error
|
|
33
|
+
* @throws {Error} When the function is async, or calls a platform function.
|
|
34
|
+
*/
|
|
35
|
+
export declare function checkPure(subject: string, fn: {
|
|
36
|
+
toIR(): unknown;
|
|
37
|
+
}, why: {
|
|
38
|
+
async: string;
|
|
39
|
+
platform: string;
|
|
40
|
+
}): void;
|
|
41
|
+
//# sourceMappingURL=record-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-guards.d.ts","sourceRoot":"","sources":["../../src/record-guards.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAO9C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAE9D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;IAAE,IAAI,IAAI,OAAO,CAAA;CAAE,EAAE,GAAG,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAUlH"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
import { AsyncEastIR, EastTypeType, equalFor, toEastTypeValue, walkIR } from '@elaraai/east';
|
|
6
|
+
// Structural East-type equality, the same primitive the redeploy type-change
|
|
7
|
+
// guard uses (e3-core workspaces.ts): compare the encoded EastTypeValues.
|
|
8
|
+
const typeValueEqual = equalFor(EastTypeType);
|
|
9
|
+
/**
|
|
10
|
+
* Whether two East types are the same type.
|
|
11
|
+
*
|
|
12
|
+
* @param a - One type
|
|
13
|
+
* @param b - The other
|
|
14
|
+
* @returns Whether their type values are equal
|
|
15
|
+
*/
|
|
16
|
+
export function sameEastType(a, b) {
|
|
17
|
+
return typeValueEqual(toEastTypeValue(a), toEastTypeValue(b));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Refuses an author's function that is async or reaches a platform function.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* An async function implies platform IO. A synchronous platform call is an
|
|
24
|
+
* ordinary function IR, so the whole body is walked for one: `walkIR` descends
|
|
25
|
+
* into nested closures, loop bodies and collection-op lambdas.
|
|
26
|
+
*
|
|
27
|
+
* @param subject - The function as the error names it, such as
|
|
28
|
+
* `e3.mutation.reduce 'place' body`
|
|
29
|
+
* @param fn - The function
|
|
30
|
+
* @param why - Why the declaration refuses each, which ends its error
|
|
31
|
+
* @throws {Error} When the function is async, or calls a platform function.
|
|
32
|
+
*/
|
|
33
|
+
export function checkPure(subject, fn, why) {
|
|
34
|
+
const ir = fn.toIR();
|
|
35
|
+
if (ir instanceof AsyncEastIR) {
|
|
36
|
+
throw new Error(`${subject} must be a synchronous East function — ${why.async}`);
|
|
37
|
+
}
|
|
38
|
+
walkIR(ir.ir, (node) => {
|
|
39
|
+
if (node.type === 'Platform') {
|
|
40
|
+
throw new Error(`${subject} must not call platform functions (found '${node.value.name}') — ${why.platform}`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=record-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-guards.js","sourceRoot":"","sources":["../../src/record-guards.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE7F,6EAA6E;AAC7E,0EAA0E;AAC1E,MAAM,cAAc,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,CAAW,EAAE,CAAW;IACnD,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,EAAuB,EAAE,GAAwC;IAC1G,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACrB,IAAI,EAAE,YAAY,WAAW,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,0CAA0C,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IACnF,CAAC;IACD,MAAM,CAAE,EAAoB,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;QACxC,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,6CAA6C,IAAI,CAAC,KAAK,CAAC,IAAI,QAAQ,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
* Secondary index definitions for e3 records.
|
|
7
|
+
*
|
|
8
|
+
* A record is paged and searched in its primary key order and nothing else.
|
|
9
|
+
* The views over a planning record have more than one order — by status, by
|
|
10
|
+
* the resources a plan consumes, by time across every plan — and only the ones
|
|
11
|
+
* contiguous in primary order are addressable without scanning it. An index
|
|
12
|
+
* closes that gap without a new storage structure: it is a second canonical
|
|
13
|
+
* collection whose sort order IS the query order, stored as a segment manifest
|
|
14
|
+
* exactly like the primary, maintained inside the same commit, and read with
|
|
15
|
+
* the same paging machinery.
|
|
16
|
+
*
|
|
17
|
+
* The functions are pure for the reason a reducer is: they run again on every
|
|
18
|
+
* commit and in every bulk build, and a maintained index must equal a rebuilt
|
|
19
|
+
* one to the byte.
|
|
20
|
+
*/
|
|
21
|
+
import type { EastType, FunctionExpr, SetType } from '@elaraai/east';
|
|
22
|
+
import { NullType } from '@elaraai/east';
|
|
23
|
+
import type { RecordDef, RecordIndexDef } from './types.js';
|
|
24
|
+
import { type FunctionRunner } from './runner.js';
|
|
25
|
+
/**
|
|
26
|
+
* What an index declaration needs of a function: a way to reach its IR, and
|
|
27
|
+
* through that its signature.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Deliberately the weakest shape that works, because a stronger one silently
|
|
31
|
+
* breaks the authored surface. An index reads
|
|
32
|
+
* `key: East.function([K, V], IK, ($, k, v) => …)` written INLINE in the spec,
|
|
33
|
+
* and `East.function` infers its callback's parameters from its own first
|
|
34
|
+
* argument — but only if nothing is imposed on it from outside. Both a
|
|
35
|
+
* callable contextual type (`FunctionExpr<any, any>`) and a generic return
|
|
36
|
+
* type here (`toIR(): EastIR<any, any>`) make TypeScript infer against the
|
|
37
|
+
* expected type instead, and the body's `k` and `v` come out as the union of
|
|
38
|
+
* every expression class. `unknown` imposes nothing; the guards below read the
|
|
39
|
+
* signature at run time regardless.
|
|
40
|
+
*/
|
|
41
|
+
export interface IndexFunction {
|
|
42
|
+
/** The function's IR bundle, as `EastIR` or `AsyncEastIR`. */
|
|
43
|
+
toIR(): unknown;
|
|
44
|
+
}
|
|
45
|
+
/** What an index keys on: exactly one of `key` (one entry per row) or `keys`
|
|
46
|
+
* (one per element of a returned Set), and an optional covering projection. */
|
|
47
|
+
export type RecordIndexSpec = {
|
|
48
|
+
/** `(K, V) -> IK` — one index entry per row. */
|
|
49
|
+
key?: IndexFunction;
|
|
50
|
+
/** `(K, V) -> Set<IK>` — one index entry per element, so a row that names
|
|
51
|
+
* five resources appears under five keys. An empty set is a row the index
|
|
52
|
+
* does not carry, which is how a partial index is written. */
|
|
53
|
+
keys?: IndexFunction;
|
|
54
|
+
/** `(K, V) -> P` — the fields a view renders from the index alone, so it
|
|
55
|
+
* never touches the primary's segments. */
|
|
56
|
+
value?: IndexFunction;
|
|
57
|
+
};
|
|
58
|
+
/** The type an East function returns, read off the expression itself. */
|
|
59
|
+
type OutputOf<F> = F extends FunctionExpr<any, infer O> ? (O extends EastType ? O : EastType) : EastType;
|
|
60
|
+
/**
|
|
61
|
+
* The index key a spec declares: `key`'s return, or the element of the Set
|
|
62
|
+
* `keys` returns.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* Read off the spec the caller actually wrote, so the factory's parameter
|
|
66
|
+
* keeps the weak {@link IndexFunction} shape the inline callbacks need while
|
|
67
|
+
* its result carries the precise key type — which is what types a window read
|
|
68
|
+
* through the index, and so every component that renders one.
|
|
69
|
+
*/
|
|
70
|
+
export type IndexKeyOf<S> = S extends {
|
|
71
|
+
key: infer F;
|
|
72
|
+
} ? OutputOf<F> : S extends {
|
|
73
|
+
keys: infer F;
|
|
74
|
+
} ? (OutputOf<F> extends SetType<infer IK> ? IK : EastType) : EastType;
|
|
75
|
+
/** The covering projection a spec declares: `value`'s return, Null when the
|
|
76
|
+
* spec has no `value`, and any type when it only might. */
|
|
77
|
+
export type ProjectionOf<S> = S extends {
|
|
78
|
+
value: infer F;
|
|
79
|
+
} ? OutputOf<F> : 'value' extends keyof S ? EastType : NullType;
|
|
80
|
+
/**
|
|
81
|
+
* Defines a secondary index over a record.
|
|
82
|
+
*
|
|
83
|
+
* The index is a collection `Dict<{ik, k}, P>` — the index key first, the
|
|
84
|
+
* primary key second — so every entry sharing an index key is one contiguous
|
|
85
|
+
* run ordered by primary key inside it, and a RANGE of index keys is one
|
|
86
|
+
* contiguous run too. Pages and key searches take the index by name; a view
|
|
87
|
+
* that renders from the index alone declares its fields as `value` and never
|
|
88
|
+
* reads the primary at all.
|
|
89
|
+
*
|
|
90
|
+
* Every guard here is a definition-time error rather than a deploy failure.
|
|
91
|
+
*
|
|
92
|
+
* @typeParam Name - Index name (literal type)
|
|
93
|
+
* @typeParam T - The owning record's state type (a Dict)
|
|
94
|
+
* @typeParam S - The spec as written, from which the index key and covering
|
|
95
|
+
* projection types are read
|
|
96
|
+
* @param name - Index name: never `primary`, and one declaration per name on
|
|
97
|
+
* the record, which `e3.package` enforces when it folds indexes onto it
|
|
98
|
+
* @param rec - The record to index
|
|
99
|
+
* @param spec - Exactly one of `key` / `keys`, and an optional `value`
|
|
100
|
+
* @param config - Optional runner selection (known runtimes only)
|
|
101
|
+
* @returns A RecordIndexDef to pass to `e3.package`
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const plans = e3.record('plans', DictType(PlanKeyType, PlanRowType), new Map());
|
|
106
|
+
*
|
|
107
|
+
* // One key per row, with a covering projection: a queue renders from the
|
|
108
|
+
* // index alone.
|
|
109
|
+
* const byStatus = e3.recordIndex('by_status', plans, {
|
|
110
|
+
* key: East.function([PlanKeyType, PlanRowType], StatusKeyType,
|
|
111
|
+
* ($, k, v) => ({ status: v.status, due: v.due })),
|
|
112
|
+
* value: East.function([PlanKeyType, PlanRowType], QueueCardType,
|
|
113
|
+
* ($, k, v) => ({ title: v.title, owner: v.owner })),
|
|
114
|
+
* });
|
|
115
|
+
*
|
|
116
|
+
* // Many keys per row: a Set return.
|
|
117
|
+
* const byResource = e3.recordIndex('by_resource', plans, {
|
|
118
|
+
* keys: East.function([PlanKeyType, PlanRowType], SetType(ResourceRefType),
|
|
119
|
+
* ($, k, v) => v.resources),
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* const pkg = e3.package('planning', '1.0.0', plans, byStatus, byResource);
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare function recordIndex<Name extends string, T extends EastType, S extends RecordIndexSpec>(name: Name, rec: RecordDef<T>, spec: S, config?: {
|
|
126
|
+
runner?: FunctionRunner;
|
|
127
|
+
}): RecordIndexDef<Name, T, IndexKeyOf<S>, ProjectionOf<S>>;
|
|
128
|
+
export {};
|
|
129
|
+
//# sourceMappingURL=record-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-index.d.ts","sourceRoot":"","sources":["../../src/record-index.ts"],"names":[],"mappings":"AAA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AA;CAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,GACxC,OAAO,SAAS,MAAM,CAAC,GAAG,QAAQ,GAClC,QAAQ,CAAC;AA2Bb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,WAAW,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,eAAe,EAC5F,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,EACjB,IAAI,EAAE,CAAC,EACP,MAAM,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,cAAc,CAAA;CAAE,GACnC,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAoFzD"}
|
|
@@ -0,0 +1,144 @@
|
|
|
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
|
+
import { Expr, NullType, printType } from '@elaraai/east';
|
|
6
|
+
import { checkPure, sameEastType } from './record-guards.js';
|
|
7
|
+
import { DEFAULT_RUNNER, runnerToVariant } from './runner.js';
|
|
8
|
+
/** The index name reserved for the record's own collection wherever an index
|
|
9
|
+
* is selected — a page, a key search, an arm of the mutation delta. */
|
|
10
|
+
const RESERVED_INDEX_NAME = 'primary';
|
|
11
|
+
/** The signature of a function an index declares, as the guards see it. */
|
|
12
|
+
function signatureOf(fn) {
|
|
13
|
+
return Expr.type(fn);
|
|
14
|
+
}
|
|
15
|
+
/** Why an index function may be neither async nor reach a platform function:
|
|
16
|
+
* either makes the index non-deterministic, and an index that does not equal
|
|
17
|
+
* its rebuild is worse than no index, since the view it serves is quietly
|
|
18
|
+
* wrong. */
|
|
19
|
+
const INDEX_PURITY = {
|
|
20
|
+
async: 'an async function implies platform IO, and an index is rebuilt from the record whenever it is dropped or its declaration changes.',
|
|
21
|
+
platform: 'the index is maintained on every commit and rebuilt on demand, so a platform call makes the two disagree.',
|
|
22
|
+
};
|
|
23
|
+
/** Refuses an index function whose parameters are not the record's entry. */
|
|
24
|
+
function checkEntryParams(name, role, keyType, valueType, inputs) {
|
|
25
|
+
if (inputs.length !== 2 || !sameEastType(keyType, inputs[0]) || !sameEastType(valueType, inputs[1])) {
|
|
26
|
+
const got = inputs.length === 0 ? 'no parameters' : inputs.map((t) => printType(t)).join(', ');
|
|
27
|
+
throw new Error(`e3.recordIndex '${name}' ${role} must take the record's entry ` +
|
|
28
|
+
`(${printType(keyType)}, ${printType(valueType)}), but got ${got}.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Defines a secondary index over a record.
|
|
33
|
+
*
|
|
34
|
+
* The index is a collection `Dict<{ik, k}, P>` — the index key first, the
|
|
35
|
+
* primary key second — so every entry sharing an index key is one contiguous
|
|
36
|
+
* run ordered by primary key inside it, and a RANGE of index keys is one
|
|
37
|
+
* contiguous run too. Pages and key searches take the index by name; a view
|
|
38
|
+
* that renders from the index alone declares its fields as `value` and never
|
|
39
|
+
* reads the primary at all.
|
|
40
|
+
*
|
|
41
|
+
* Every guard here is a definition-time error rather than a deploy failure.
|
|
42
|
+
*
|
|
43
|
+
* @typeParam Name - Index name (literal type)
|
|
44
|
+
* @typeParam T - The owning record's state type (a Dict)
|
|
45
|
+
* @typeParam S - The spec as written, from which the index key and covering
|
|
46
|
+
* projection types are read
|
|
47
|
+
* @param name - Index name: never `primary`, and one declaration per name on
|
|
48
|
+
* the record, which `e3.package` enforces when it folds indexes onto it
|
|
49
|
+
* @param rec - The record to index
|
|
50
|
+
* @param spec - Exactly one of `key` / `keys`, and an optional `value`
|
|
51
|
+
* @param config - Optional runner selection (known runtimes only)
|
|
52
|
+
* @returns A RecordIndexDef to pass to `e3.package`
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const plans = e3.record('plans', DictType(PlanKeyType, PlanRowType), new Map());
|
|
57
|
+
*
|
|
58
|
+
* // One key per row, with a covering projection: a queue renders from the
|
|
59
|
+
* // index alone.
|
|
60
|
+
* const byStatus = e3.recordIndex('by_status', plans, {
|
|
61
|
+
* key: East.function([PlanKeyType, PlanRowType], StatusKeyType,
|
|
62
|
+
* ($, k, v) => ({ status: v.status, due: v.due })),
|
|
63
|
+
* value: East.function([PlanKeyType, PlanRowType], QueueCardType,
|
|
64
|
+
* ($, k, v) => ({ title: v.title, owner: v.owner })),
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* // Many keys per row: a Set return.
|
|
68
|
+
* const byResource = e3.recordIndex('by_resource', plans, {
|
|
69
|
+
* keys: East.function([PlanKeyType, PlanRowType], SetType(ResourceRefType),
|
|
70
|
+
* ($, k, v) => v.resources),
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* const pkg = e3.package('planning', '1.0.0', plans, byStatus, byResource);
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export function recordIndex(name, rec, spec, config) {
|
|
77
|
+
if (!name) {
|
|
78
|
+
throw new Error('e3.recordIndex requires a non-empty name');
|
|
79
|
+
}
|
|
80
|
+
if (name === RESERVED_INDEX_NAME) {
|
|
81
|
+
throw new Error(`e3.recordIndex cannot be named '${RESERVED_INDEX_NAME}' — that name is the ` +
|
|
82
|
+
`record's own collection wherever an index is selected.`);
|
|
83
|
+
}
|
|
84
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
|
|
85
|
+
throw new Error(`e3.recordIndex '${name}' must be an identifier — it names a query ` +
|
|
86
|
+
`selector in URLs and on the command line.`);
|
|
87
|
+
}
|
|
88
|
+
// An assembled record — a package's `records.plans` — carries its indexes
|
|
89
|
+
// already; a bare one is checked when `e3.package` folds indexes onto it.
|
|
90
|
+
if (rec.indexes[name] !== undefined) {
|
|
91
|
+
throw new Error(`e3.recordIndex '${name}' is already declared on record '${rec.name}'`);
|
|
92
|
+
}
|
|
93
|
+
const recordType = rec.type;
|
|
94
|
+
if (recordType.type !== 'Dict') {
|
|
95
|
+
throw new Error(`e3.recordIndex '${name}' indexes a Dict record — '${rec.name}' holds ` +
|
|
96
|
+
`${printType(rec.type)}, which has no (key, value) entry to index. A Set or ` +
|
|
97
|
+
`Array record is read in its own order only.`);
|
|
98
|
+
}
|
|
99
|
+
const keyType = recordType.key;
|
|
100
|
+
const valueType = recordType.value;
|
|
101
|
+
if ((spec.key === undefined) === (spec.keys === undefined)) {
|
|
102
|
+
throw new Error(`e3.recordIndex '${name}' takes exactly one of 'key' (one entry per row) ` +
|
|
103
|
+
`or 'keys' (one per element of a returned Set)`);
|
|
104
|
+
}
|
|
105
|
+
const multi = spec.keys !== undefined;
|
|
106
|
+
const keyFn = (spec.key ?? spec.keys);
|
|
107
|
+
const runner = config?.runner ?? DEFAULT_RUNNER;
|
|
108
|
+
// Validate eagerly so a bad runner fails at definition time, not export time.
|
|
109
|
+
runnerToVariant(runner);
|
|
110
|
+
checkPure(`e3.recordIndex '${name}' ${multi ? "'keys' function" : "'key' function"}`, keyFn, INDEX_PURITY);
|
|
111
|
+
const keySig = signatureOf(keyFn);
|
|
112
|
+
checkEntryParams(name, multi ? "'keys' function" : "'key' function", keyType, valueType, keySig.inputs);
|
|
113
|
+
let indexKeyType = keySig.output;
|
|
114
|
+
if (multi) {
|
|
115
|
+
const returned = keySig.output;
|
|
116
|
+
if (returned.type !== 'Set') {
|
|
117
|
+
throw new Error(`e3.recordIndex '${name}' declared with 'keys' must return a Set of index ` +
|
|
118
|
+
`keys — one entry per element — but returns ${printType(keySig.output)}. ` +
|
|
119
|
+
`For one entry per row use 'key'.`);
|
|
120
|
+
}
|
|
121
|
+
indexKeyType = returned.key;
|
|
122
|
+
}
|
|
123
|
+
let projectionType = NullType;
|
|
124
|
+
if (spec.value !== undefined) {
|
|
125
|
+
checkPure(`e3.recordIndex '${name}' 'value' projection`, spec.value, INDEX_PURITY);
|
|
126
|
+
const valueSig = signatureOf(spec.value);
|
|
127
|
+
checkEntryParams(name, "'value' projection", keyType, valueType, valueSig.inputs);
|
|
128
|
+
projectionType = valueSig.output;
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
kind: 'recordIndex',
|
|
132
|
+
name,
|
|
133
|
+
record: rec,
|
|
134
|
+
keyFn,
|
|
135
|
+
...(spec.value !== undefined && { valueFn: spec.value }),
|
|
136
|
+
multi,
|
|
137
|
+
// The signature read above IS the type the spec's functions declare; the
|
|
138
|
+
// casts only restate it at the TypeScript level.
|
|
139
|
+
keyType: indexKeyType,
|
|
140
|
+
valueType: projectionType,
|
|
141
|
+
runner,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=record-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-index.js","sourceRoot":"","sources":["../../src/record-index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAuB,MAAM,aAAa,CAAC;AAEnF;wEACwE;AACxE,MAAM,mBAAmB,GAAG,SAAS,CAAC;AA8DtC,2EAA2E;AAC3E,SAAS,WAAW,CAAC,EAAiB;IACpC,OAAO,IAAI,CAAC,IAAI,CAAC,EAA0B,CAA6C,CAAC;AAC3F,CAAC;AAED;;;aAGa;AACb,MAAM,YAAY,GAAG;IACnB,KAAK,EAAE,mIAAmI;IAC1I,QAAQ,EAAE,2GAA2G;CACtH,CAAC;AAEF,6EAA6E;AAC7E,SAAS,gBAAgB,CAAC,IAAY,EAAE,IAAY,EAAE,OAAiB,EAAE,SAAmB,EAAE,MAAkB;IAC9G,IAAI,MAAM,C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