@elaraai/e3-types 1.0.83 → 1.0.84
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/api.d.ts +60 -0
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/function.d.ts +12 -0
- package/dist/src/function.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/record.d.ts +52 -0
- package/dist/src/record.d.ts.map +1 -1
- package/dist/src/record.js +25 -0
- package/dist/src/record.js.map +1 -1
- package/dist/src/record.spec.js +43 -6
- 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/runner.d.ts +22 -7
- package/dist/src/runner.d.ts.map +1 -1
- package/dist/src/runner.js +14 -11
- package/dist/src/runner.js.map +1 -1
- package/dist/src/runner.spec.js +4 -4
- package/dist/src/runner.spec.js.map +1 -1
- package/dist/src/task.d.ts +13 -1
- package/dist/src/task.d.ts.map +1 -1
- package/dist/src/task.js +1 -1
- package/dist/src/task.spec.js +25 -4
- package/dist/src/task.spec.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/record.spec.ts +51 -5
- package/src/record.ts +28 -0
- package/src/release.ts +1 -1
- package/src/runner.spec.ts +4 -4
- package/src/runner.ts +14 -11
- package/src/task.spec.ts +29 -3
- package/src/task.ts +1 -1
package/dist/src/runner.d.ts
CHANGED
|
@@ -13,23 +13,38 @@ import { VariantType, StructType, ArrayType, StringType, ValueTypeOf } from '@el
|
|
|
13
13
|
/**
|
|
14
14
|
* Wire representation of a runner — shared by tasks, functions and records.
|
|
15
15
|
*
|
|
16
|
-
* A known-runtime tag names a stock runner
|
|
17
|
-
* packages the units it runs load
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
16
|
+
* A known-runtime tag names a stock runner: `platforms` names the platform
|
|
17
|
+
* packages the units it runs load, and `decode` how it reads a run unit's
|
|
18
|
+
* inputs — each collection `lazy`, a segment decoded as the program reaches
|
|
19
|
+
* it, or every input decoded `whole` before the program runs — which e3 writes
|
|
20
|
+
* into each run unit it stages for the runner. `custom` carries a command,
|
|
21
|
+
* which e3 runs with the arguments of a stock runner's `run`: `-i` for each
|
|
22
|
+
* input, `-o` for the output, then the program's file. A custom task's body is
|
|
23
|
+
* its own command, and its runner's is empty. Package authors can already
|
|
24
|
+
* execute arbitrary commands via custom tasks, so `custom` grants no
|
|
25
|
+
* capability that tasks don't have.
|
|
23
26
|
*/
|
|
24
27
|
export declare const RunnerType: VariantType<{
|
|
25
28
|
readonly east_node: StructType<{
|
|
26
29
|
readonly platforms: ArrayType<StringType>;
|
|
30
|
+
readonly decode: VariantType<{
|
|
31
|
+
readonly lazy: import("@elaraai/east").NullType;
|
|
32
|
+
readonly whole: import("@elaraai/east").NullType;
|
|
33
|
+
}>;
|
|
27
34
|
}>;
|
|
28
35
|
readonly east_py: StructType<{
|
|
29
36
|
readonly platforms: ArrayType<StringType>;
|
|
37
|
+
readonly decode: VariantType<{
|
|
38
|
+
readonly lazy: import("@elaraai/east").NullType;
|
|
39
|
+
readonly whole: import("@elaraai/east").NullType;
|
|
40
|
+
}>;
|
|
30
41
|
}>;
|
|
31
42
|
readonly east_c: StructType<{
|
|
32
43
|
readonly platforms: ArrayType<StringType>;
|
|
44
|
+
readonly decode: VariantType<{
|
|
45
|
+
readonly lazy: import("@elaraai/east").NullType;
|
|
46
|
+
readonly whole: import("@elaraai/east").NullType;
|
|
47
|
+
}>;
|
|
33
48
|
}>;
|
|
34
49
|
readonly custom: StructType<{
|
|
35
50
|
readonly command: ArrayType<StringType>;
|
package/dist/src/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAkB,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5G;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;EAKrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,UAAU,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAGhF"}
|
package/dist/src/runner.js
CHANGED
|
@@ -9,22 +9,25 @@
|
|
|
9
9
|
* tag pins the executable to one of the stock runners, which runs units through
|
|
10
10
|
* its `exec` command; `custom` names a command of the author's own.
|
|
11
11
|
*/
|
|
12
|
-
import { VariantType, StructType, ArrayType, StringType } from '@elaraai/east';
|
|
12
|
+
import { VariantType, StructType, ArrayType, StringType, UnitDecodeType } from '@elaraai/east';
|
|
13
13
|
/**
|
|
14
14
|
* Wire representation of a runner — shared by tasks, functions and records.
|
|
15
15
|
*
|
|
16
|
-
* A known-runtime tag names a stock runner
|
|
17
|
-
* packages the units it runs load
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
16
|
+
* A known-runtime tag names a stock runner: `platforms` names the platform
|
|
17
|
+
* packages the units it runs load, and `decode` how it reads a run unit's
|
|
18
|
+
* inputs — each collection `lazy`, a segment decoded as the program reaches
|
|
19
|
+
* it, or every input decoded `whole` before the program runs — which e3 writes
|
|
20
|
+
* into each run unit it stages for the runner. `custom` carries a command,
|
|
21
|
+
* which e3 runs with the arguments of a stock runner's `run`: `-i` for each
|
|
22
|
+
* input, `-o` for the output, then the program's file. A custom task's body is
|
|
23
|
+
* its own command, and its runner's is empty. Package authors can already
|
|
24
|
+
* execute arbitrary commands via custom tasks, so `custom` grants no
|
|
25
|
+
* capability that tasks don't have.
|
|
23
26
|
*/
|
|
24
27
|
export const RunnerType = VariantType({
|
|
25
|
-
east_node: StructType({ platforms: ArrayType(StringType) }),
|
|
26
|
-
east_py: StructType({ platforms: ArrayType(StringType) }),
|
|
27
|
-
east_c: StructType({ platforms: ArrayType(StringType) }),
|
|
28
|
+
east_node: StructType({ platforms: ArrayType(StringType), decode: UnitDecodeType }),
|
|
29
|
+
east_py: StructType({ platforms: ArrayType(StringType), decode: UnitDecodeType }),
|
|
30
|
+
east_c: StructType({ platforms: ArrayType(StringType), decode: UnitDecodeType }),
|
|
28
31
|
custom: StructType({ command: ArrayType(StringType) }),
|
|
29
32
|
});
|
|
30
33
|
/**
|
package/dist/src/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAe,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAe,MAAM,eAAe,CAAC;AAE5G;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;IACpC,SAAS,EAAE,UAAU,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IACnF,OAAO,EAAI,UAAU,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IACnF,MAAM,EAAK,UAAU,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IACnF,MAAM,EAAK,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;CAC1D,CAAC,CAAC;AAKH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAmB,EAAE,IAAc;IACpE,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7D,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
package/dist/src/runner.spec.js
CHANGED
|
@@ -15,9 +15,9 @@ import * as assert from 'node:assert';
|
|
|
15
15
|
import { variant } from '@elaraai/east';
|
|
16
16
|
import { withRunnerLifeline } from './runner.js';
|
|
17
17
|
const KNOWN = [
|
|
18
|
-
['east_node', variant('east_node', { platforms: ['@elaraai/east-node-std'] }), 'east-node'],
|
|
19
|
-
['east_py', variant('east_py', { platforms: ['east-py-std'] }), 'east-py'],
|
|
20
|
-
['east_c', variant('east_c', { platforms: ['east-c-std'] }), 'east-c'],
|
|
18
|
+
['east_node', variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }), 'east-node'],
|
|
19
|
+
['east_py', variant('east_py', { platforms: ['east-py-std'], decode: variant('lazy', null) }), 'east-py'],
|
|
20
|
+
['east_c', variant('east_c', { platforms: ['east-c-std'], decode: variant('lazy', null) }), 'east-c'],
|
|
21
21
|
];
|
|
22
22
|
describe('withRunnerLifeline', () => {
|
|
23
23
|
for (const [tag, runner, bin] of KNOWN) {
|
|
@@ -32,7 +32,7 @@ describe('withRunnerLifeline', () => {
|
|
|
32
32
|
assert.deepStrictEqual(withRunnerLifeline(runner, args), args);
|
|
33
33
|
});
|
|
34
34
|
it('is a no-op on a degenerate argv and does not mutate its input', () => {
|
|
35
|
-
const runner = variant('east_c', { platforms: [] });
|
|
35
|
+
const runner = variant('east_c', { platforms: [], decode: variant('lazy', null) });
|
|
36
36
|
assert.deepStrictEqual(withRunnerLifeline(runner, ['east-c']), ['east-c']);
|
|
37
37
|
const args = ['east-c', 'exec', 'unit.beast2'];
|
|
38
38
|
const before = [...args];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.spec.js","sourceRoot":"","sources":["../../src/runner.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;AAEnE,MAAM,KAAK,GAAyC;IAClD,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,wBAAwB,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.spec.js","sourceRoot":"","sources":["../../src/runner.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,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AE,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5F,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;QACtG,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACnF,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3E,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QACzB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjC,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/src/task.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ export type TaskRole = ValueTypeOf<typeof TaskRoleType>;
|
|
|
160
160
|
* const task: TaskObject = {
|
|
161
161
|
* kind: TASK_OBJECT_KIND,
|
|
162
162
|
* body: variant('east', { program: '5e7a3b...' }),
|
|
163
|
-
* runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
|
|
163
|
+
* runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
|
|
164
164
|
* inputs: [{ path: [variant('field', 'inputs'), variant('field', 'sales')], partition: none }],
|
|
165
165
|
* output: { path: [variant('field', 'tasks'), variant('field', 'totals'), variant('field', 'output')], kind: variant('value', null) },
|
|
166
166
|
* role: variant('data', null),
|
|
@@ -185,12 +185,24 @@ export declare const TaskObjectType: StructType<{
|
|
|
185
185
|
readonly runner: VariantType<{
|
|
186
186
|
readonly east_node: StructType<{
|
|
187
187
|
readonly platforms: ArrayType<StringType>;
|
|
188
|
+
readonly decode: VariantType<{
|
|
189
|
+
readonly lazy: NullType;
|
|
190
|
+
readonly whole: NullType;
|
|
191
|
+
}>;
|
|
188
192
|
}>;
|
|
189
193
|
readonly east_py: StructType<{
|
|
190
194
|
readonly platforms: ArrayType<StringType>;
|
|
195
|
+
readonly decode: VariantType<{
|
|
196
|
+
readonly lazy: NullType;
|
|
197
|
+
readonly whole: NullType;
|
|
198
|
+
}>;
|
|
191
199
|
}>;
|
|
192
200
|
readonly east_c: StructType<{
|
|
193
201
|
readonly platforms: ArrayType<StringType>;
|
|
202
|
+
readonly decode: VariantType<{
|
|
203
|
+
readonly lazy: NullType;
|
|
204
|
+
readonly whole: NullType;
|
|
205
|
+
}>;
|
|
194
206
|
}>;
|
|
195
207
|
readonly custom: StructType<{
|
|
196
208
|
readonly command: ArrayType<StringType>;
|
package/dist/src/task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAmB,MAAM,eAAe,CAAC;AAInI;qBACqB;AACrB,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY;;;;;;;EAGvB,CAAC;AACH,MAAM,MAAM,YAAY,GAA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,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;EAK3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;EAGvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC;AAC/C,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc;IACzB,uCAAuC;;IAEvC,0BAA0B;;;;;;;;;IAE1B;gDAC4C;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE5C,kEAAkE;;;;;;;;;IAElE,iDAAiD;;;;;;;;;;;;;;;;;;IAEjD,8BAA8B;;;;;;;;;;;;;;IAE9B;uCACmC;;EAEnC,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAI5D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAc7D"}
|
package/dist/src/task.js
CHANGED
|
@@ -107,7 +107,7 @@ export const TaskRoleType = VariantType({
|
|
|
107
107
|
* const task: TaskObject = {
|
|
108
108
|
* kind: TASK_OBJECT_KIND,
|
|
109
109
|
* body: variant('east', { program: '5e7a3b...' }),
|
|
110
|
-
* runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
|
|
110
|
+
* runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
|
|
111
111
|
* inputs: [{ path: [variant('field', 'inputs'), variant('field', 'sales')], partition: none }],
|
|
112
112
|
* output: { path: [variant('field', 'tasks'), variant('field', 'totals'), variant('field', 'output')], kind: variant('value', null) },
|
|
113
113
|
* role: variant('data', null),
|
package/dist/src/task.spec.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { describe, it } from 'node:test';
|
|
9
9
|
import assert from 'node:assert/strict';
|
|
10
|
-
import { ArrayType, BlobType, IntegerType, OptionType, StringType, StructType, encodeBeast2For, none, some, variant } from '@elaraai/east';
|
|
11
|
-
import { TASK_OBJECT_KIND, TaskObjectType, decodeTaskObject, } from './task.js';
|
|
10
|
+
import { ArrayType, BlobType, IntegerType, OptionType, StringType, StructType, VariantType, encodeBeast2For, none, some, variant } from '@elaraai/east';
|
|
11
|
+
import { TASK_OBJECT_KIND, TaskBodyType, TaskInputType, TaskObjectType, TaskOutputType, TaskRoleType, decodeTaskObject, } from './task.js';
|
|
12
12
|
import { RunnerType } from './runner.js';
|
|
13
13
|
import { TreePathType } from './structure.js';
|
|
14
14
|
describe('TaskObjectType', () => {
|
|
@@ -18,7 +18,7 @@ describe('TaskObjectType', () => {
|
|
|
18
18
|
const base = {
|
|
19
19
|
kind: TASK_OBJECT_KIND,
|
|
20
20
|
body: variant('east', { program: 'a'.repeat(64) }),
|
|
21
|
-
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
|
|
21
|
+
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
|
|
22
22
|
inputs: [{ path: sales, partition: none }],
|
|
23
23
|
output: { path: totals, kind: variant('value', null) },
|
|
24
24
|
role: variant('data', null),
|
|
@@ -40,6 +40,7 @@ describe('TaskObjectType', () => {
|
|
|
40
40
|
},
|
|
41
41
|
{ ...base, output: { path: totals, kind: variant('fold', { zero: 'e'.repeat(64), combine: 'f'.repeat(64) }) } },
|
|
42
42
|
{ ...base, output: { path: totals, kind: variant('set', null) } },
|
|
43
|
+
{ ...base, runner: variant('east_py', { platforms: ['east-py-std'], decode: variant('whole', null) }) },
|
|
43
44
|
{ ...base, role: variant('ui', { paths: [sales], functions: ['forecast'], records: ['plans'], pages: [rates] }) },
|
|
44
45
|
];
|
|
45
46
|
const encode = encodeBeast2For(TaskObjectType);
|
|
@@ -62,11 +63,31 @@ describe('TaskObjectType', () => {
|
|
|
62
63
|
output: totals,
|
|
63
64
|
kind: none,
|
|
64
65
|
metadata: none,
|
|
65
|
-
runner: variant('east_node', { platforms: [] }),
|
|
66
|
+
runner: variant('east_node', { platforms: [], decode: variant('lazy', null) }),
|
|
66
67
|
environment: none,
|
|
67
68
|
});
|
|
68
69
|
assert.throws(() => decodeTaskObject(older), /exported by an older e3 SDK — re-export it with the current one/);
|
|
69
70
|
});
|
|
71
|
+
it('refuses a task object whose runner predates its decode, saying to re-export the package', () => {
|
|
72
|
+
// A stock runner as a package exported before runners said how they read
|
|
73
|
+
// a program's inputs: its platforms alone.
|
|
74
|
+
const PreDecodeRunnerType = VariantType({
|
|
75
|
+
east_node: StructType({ platforms: ArrayType(StringType) }),
|
|
76
|
+
east_py: StructType({ platforms: ArrayType(StringType) }),
|
|
77
|
+
east_c: StructType({ platforms: ArrayType(StringType) }),
|
|
78
|
+
custom: StructType({ command: ArrayType(StringType) }),
|
|
79
|
+
});
|
|
80
|
+
const older = encodeBeast2For(StructType({
|
|
81
|
+
kind: StringType,
|
|
82
|
+
body: TaskBodyType,
|
|
83
|
+
runner: PreDecodeRunnerType,
|
|
84
|
+
inputs: ArrayType(TaskInputType),
|
|
85
|
+
output: TaskOutputType,
|
|
86
|
+
role: TaskRoleType,
|
|
87
|
+
environment: OptionType(StringType),
|
|
88
|
+
}))({ ...base, runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }) });
|
|
89
|
+
assert.throws(() => decodeTaskObject(older), /exported by an older e3 SDK — re-export it with the current one/);
|
|
90
|
+
});
|
|
70
91
|
it('refuses an object of the task shape that carries another kind tag', () => {
|
|
71
92
|
assert.throws(() => decodeTaskObject(encodeBeast2For(TaskObjectType)({ ...base, kind: '$plan' })), /its kind is '\$plan', not '\$task'/);
|
|
72
93
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.spec.js","sourceRoot":"","sources":["../../src/task.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"task.spec.js","sourceRoot":"","sources":["../../src/task.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxJ,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,gBAAgB,GAEjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,MAAM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,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elaraai/e3-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.84",
|
|
4
4
|
"description": "Shared type definitions for e3 (East Execution Engine)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"directory": "libs/e3/packages/e3-types"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@elaraai/east": "1.0.
|
|
21
|
+
"@elaraai/east": "1.0.84"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^22.0.0",
|
package/src/index.ts
CHANGED
package/src/record.spec.ts
CHANGED
|
@@ -6,26 +6,29 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* The record wire types' decoders: each reads the current shape, and refuses
|
|
8
8
|
* an older one naming the fix — a commit an older e3 wrote, whose repository
|
|
9
|
-
* is re-created, and a mutation, migration or record object an older
|
|
10
|
-
* exported, whose package is re-exported.
|
|
9
|
+
* is re-created, and a mutation, migration, index or record object an older
|
|
10
|
+
* SDK exported, whose package is re-exported.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { describe, it } from 'node:test';
|
|
14
14
|
import assert from 'node:assert/strict';
|
|
15
|
-
import { DateTimeType, DictType, IntegerType, OptionType, StringType, StructType, ArrayType, EastTypeType, encodeBeast2For, isTypeValueEqual, some, toEastTypeValue, variant } from '@elaraai/east';
|
|
15
|
+
import { BooleanType, DateTimeType, DictType, IntegerType, OptionType, StringType, StructType, ArrayType, EastTypeType, VariantType, encodeBeast2For, isTypeValueEqual, some, toEastTypeValue, variant } from '@elaraai/east';
|
|
16
16
|
import { RunnerType } from './runner.js';
|
|
17
17
|
import {
|
|
18
18
|
MigrationObjectType,
|
|
19
19
|
MutationObjectType,
|
|
20
20
|
RecordCommitType,
|
|
21
|
+
RecordIndexObjectType,
|
|
21
22
|
RecordObjectType,
|
|
22
23
|
decodeMigrationObject,
|
|
23
24
|
decodeMutationObject,
|
|
24
25
|
decodeRecordCommit,
|
|
26
|
+
decodeRecordIndexObject,
|
|
25
27
|
decodeRecordObject,
|
|
26
28
|
type MigrationObject,
|
|
27
29
|
type MutationObject,
|
|
28
30
|
type RecordCommit,
|
|
31
|
+
type RecordIndexObject,
|
|
29
32
|
type RecordObject,
|
|
30
33
|
} from './record.js';
|
|
31
34
|
|
|
@@ -65,7 +68,7 @@ describe('decodeMutationObject', () => {
|
|
|
65
68
|
const mutation: MutationObject = {
|
|
66
69
|
bodyIr: 'a'.repeat(64),
|
|
67
70
|
argTypes: [toEastTypeValue(IntegerType)],
|
|
68
|
-
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
|
|
71
|
+
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
|
|
69
72
|
form: variant('edit', null),
|
|
70
73
|
programIr: 'b'.repeat(64),
|
|
71
74
|
};
|
|
@@ -113,6 +116,49 @@ describe('decodeMutationObject', () => {
|
|
|
113
116
|
});
|
|
114
117
|
});
|
|
115
118
|
|
|
119
|
+
describe('decodeRecordIndexObject', () => {
|
|
120
|
+
const index: RecordIndexObject = {
|
|
121
|
+
keyIr: 'a'.repeat(64),
|
|
122
|
+
multi: false,
|
|
123
|
+
valueIr: some('b'.repeat(64)),
|
|
124
|
+
keyType: toEastTypeValue(StringType),
|
|
125
|
+
valueType: toEastTypeValue(IntegerType),
|
|
126
|
+
buildIr: 'c'.repeat(64),
|
|
127
|
+
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('whole', null) }),
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
it('round-trips a current index object, its types among it', () => {
|
|
131
|
+
const decoded = decodeRecordIndexObject(encodeBeast2For(RecordIndexObjectType)(index));
|
|
132
|
+
// A decoded type value carries no memoized identity, so only the East
|
|
133
|
+
// comparison says whether two of them are the same type.
|
|
134
|
+
assert.ok(isTypeValueEqual(decoded.keyType, index.keyType));
|
|
135
|
+
assert.ok(isTypeValueEqual(decoded.valueType, index.valueType));
|
|
136
|
+
const { keyType: _keyType, valueType: _valueType, ...rest } = decoded;
|
|
137
|
+
const { keyType: _k, valueType: _v, ...expected } = index;
|
|
138
|
+
assert.deepEqual(rest, expected);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('refuses an index object whose runner predates its decode, naming the fix', () => {
|
|
142
|
+
// A stock runner as a package exported before runners said how they read
|
|
143
|
+
// a program's inputs: its platforms alone.
|
|
144
|
+
const PreDecodeRunnerType = VariantType({
|
|
145
|
+
east_node: StructType({ platforms: ArrayType(StringType) }),
|
|
146
|
+
east_py: StructType({ platforms: ArrayType(StringType) }),
|
|
147
|
+
east_c: StructType({ platforms: ArrayType(StringType) }),
|
|
148
|
+
custom: StructType({ command: ArrayType(StringType) }),
|
|
149
|
+
});
|
|
150
|
+
const PreDecodeIndexType = StructType({
|
|
151
|
+
keyIr: StringType, multi: BooleanType, valueIr: OptionType(StringType), keyType: EastTypeType,
|
|
152
|
+
valueType: EastTypeType, buildIr: StringType, runner: PreDecodeRunnerType,
|
|
153
|
+
});
|
|
154
|
+
const older = encodeBeast2For(PreDecodeIndexType)({ ...index, runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }) });
|
|
155
|
+
assert.throws(
|
|
156
|
+
() => decodeRecordIndexObject(older),
|
|
157
|
+
/^Error: the index object does not decode: the package was exported by an older e3 SDK — re-export it with the current one \(/,
|
|
158
|
+
);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
116
162
|
describe('decodeMigrationObject', () => {
|
|
117
163
|
const RowV1Type = StructType({ name: StringType });
|
|
118
164
|
const RowV2Type = StructType({ name: StringType, shift: IntegerType });
|
|
@@ -122,7 +168,7 @@ describe('decodeMigrationObject', () => {
|
|
|
122
168
|
to: toEastTypeValue(DictType(StringType, RowV2Type)),
|
|
123
169
|
bodyIr: 'a'.repeat(64),
|
|
124
170
|
programIr: 'b'.repeat(64),
|
|
125
|
-
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
|
|
171
|
+
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
|
|
126
172
|
};
|
|
127
173
|
|
|
128
174
|
it('round-trips a current migration, its types among it', () => {
|
package/src/record.ts
CHANGED
|
@@ -200,6 +200,34 @@ export const RecordIndexObjectType = StructType({
|
|
|
200
200
|
export type RecordIndexObjectType = typeof RecordIndexObjectType;
|
|
201
201
|
export type RecordIndexObject = ValueTypeOf<typeof RecordIndexObjectType>;
|
|
202
202
|
|
|
203
|
+
const decodeCurrentRecordIndex = decodeBeast2For(RecordIndexObjectType);
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Decode a `RecordIndexObject`.
|
|
207
|
+
*
|
|
208
|
+
* @remarks
|
|
209
|
+
* A package-borne wire, so it changes by hard cutover: a package exported by
|
|
210
|
+
* an older SDK is re-exported with the current one, and this says so. A
|
|
211
|
+
* record's state names the index object each index was built under, so one an
|
|
212
|
+
* older SDK exported is read until a deploy of the re-exported package
|
|
213
|
+
* rebuilds the index under the current one.
|
|
214
|
+
*
|
|
215
|
+
* @param data - the stored bytes
|
|
216
|
+
* @returns the index object
|
|
217
|
+
* @throws {Error} When the bytes are not a current index object — a package
|
|
218
|
+
* exported by an older SDK, which is re-exported with the current one.
|
|
219
|
+
*/
|
|
220
|
+
export function decodeRecordIndexObject(data: Uint8Array): RecordIndexObject {
|
|
221
|
+
try {
|
|
222
|
+
return decodeCurrentRecordIndex(data);
|
|
223
|
+
} catch (err) {
|
|
224
|
+
throw new Error(
|
|
225
|
+
`the index object does not decode: the package was exported by an older e3 SDK — re-export it with the current one ` +
|
|
226
|
+
`(${err instanceof Error ? err.message : String(err)})`,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
203
231
|
/**
|
|
204
232
|
* How a migration says what it changes.
|
|
205
233
|
*
|
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.84';
|
|
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/runner.spec.ts
CHANGED
|
@@ -18,9 +18,9 @@ import { variant } from '@elaraai/east';
|
|
|
18
18
|
import { withRunnerLifeline, type RunnerValue } from './runner.js';
|
|
19
19
|
|
|
20
20
|
const KNOWN: Array<[string, RunnerValue, string]> = [
|
|
21
|
-
['east_node', variant('east_node', { platforms: ['@elaraai/east-node-std'] }), 'east-node'],
|
|
22
|
-
['east_py', variant('east_py', { platforms: ['east-py-std'] }), 'east-py'],
|
|
23
|
-
['east_c', variant('east_c', { platforms: ['east-c-std'] }), 'east-c'],
|
|
21
|
+
['east_node', variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }), 'east-node'],
|
|
22
|
+
['east_py', variant('east_py', { platforms: ['east-py-std'], decode: variant('lazy', null) }), 'east-py'],
|
|
23
|
+
['east_c', variant('east_c', { platforms: ['east-c-std'], decode: variant('lazy', null) }), 'east-c'],
|
|
24
24
|
];
|
|
25
25
|
|
|
26
26
|
describe('withRunnerLifeline', () => {
|
|
@@ -38,7 +38,7 @@ describe('withRunnerLifeline', () => {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it('is a no-op on a degenerate argv and does not mutate its input', () => {
|
|
41
|
-
const runner = variant('east_c', { platforms: [] });
|
|
41
|
+
const runner = variant('east_c', { platforms: [], decode: variant('lazy', null) });
|
|
42
42
|
assert.deepStrictEqual(withRunnerLifeline(runner, ['east-c']), ['east-c']);
|
|
43
43
|
const args = ['east-c', 'exec', 'unit.beast2'];
|
|
44
44
|
const before = [...args];
|
package/src/runner.ts
CHANGED
|
@@ -11,23 +11,26 @@
|
|
|
11
11
|
* its `exec` command; `custom` names a command of the author's own.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { VariantType, StructType, ArrayType, StringType, ValueTypeOf } from '@elaraai/east';
|
|
14
|
+
import { VariantType, StructType, ArrayType, StringType, UnitDecodeType, ValueTypeOf } from '@elaraai/east';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Wire representation of a runner — shared by tasks, functions and records.
|
|
18
18
|
*
|
|
19
|
-
* A known-runtime tag names a stock runner
|
|
20
|
-
* packages the units it runs load
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
19
|
+
* A known-runtime tag names a stock runner: `platforms` names the platform
|
|
20
|
+
* packages the units it runs load, and `decode` how it reads a run unit's
|
|
21
|
+
* inputs — each collection `lazy`, a segment decoded as the program reaches
|
|
22
|
+
* it, or every input decoded `whole` before the program runs — which e3 writes
|
|
23
|
+
* into each run unit it stages for the runner. `custom` carries a command,
|
|
24
|
+
* which e3 runs with the arguments of a stock runner's `run`: `-i` for each
|
|
25
|
+
* input, `-o` for the output, then the program's file. A custom task's body is
|
|
26
|
+
* its own command, and its runner's is empty. Package authors can already
|
|
27
|
+
* execute arbitrary commands via custom tasks, so `custom` grants no
|
|
28
|
+
* capability that tasks don't have.
|
|
26
29
|
*/
|
|
27
30
|
export const RunnerType = VariantType({
|
|
28
|
-
east_node: StructType({ platforms: ArrayType(StringType) }),
|
|
29
|
-
east_py: StructType({ platforms: ArrayType(StringType) }),
|
|
30
|
-
east_c: StructType({ platforms: ArrayType(StringType) }),
|
|
31
|
+
east_node: StructType({ platforms: ArrayType(StringType), decode: UnitDecodeType }),
|
|
32
|
+
east_py: StructType({ platforms: ArrayType(StringType), decode: UnitDecodeType }),
|
|
33
|
+
east_c: StructType({ platforms: ArrayType(StringType), decode: UnitDecodeType }),
|
|
31
34
|
custom: StructType({ command: ArrayType(StringType) }),
|
|
32
35
|
});
|
|
33
36
|
export type RunnerType = typeof RunnerType;
|
package/src/task.spec.ts
CHANGED
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
import { describe, it } from 'node:test';
|
|
11
11
|
import assert from 'node:assert/strict';
|
|
12
|
-
import { ArrayType, BlobType, IntegerType, OptionType, StringType, StructType, encodeBeast2For, none, some, variant } from '@elaraai/east';
|
|
12
|
+
import { ArrayType, BlobType, IntegerType, OptionType, StringType, StructType, VariantType, encodeBeast2For, none, some, variant } from '@elaraai/east';
|
|
13
13
|
import {
|
|
14
14
|
TASK_OBJECT_KIND,
|
|
15
|
+
TaskBodyType,
|
|
16
|
+
TaskInputType,
|
|
15
17
|
TaskObjectType,
|
|
18
|
+
TaskOutputType,
|
|
19
|
+
TaskRoleType,
|
|
16
20
|
decodeTaskObject,
|
|
17
21
|
type TaskObject,
|
|
18
22
|
} from './task.js';
|
|
@@ -26,7 +30,7 @@ describe('TaskObjectType', () => {
|
|
|
26
30
|
const base: TaskObject = {
|
|
27
31
|
kind: TASK_OBJECT_KIND,
|
|
28
32
|
body: variant('east', { program: 'a'.repeat(64) }),
|
|
29
|
-
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
|
|
33
|
+
runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
|
|
30
34
|
inputs: [{ path: sales, partition: none }],
|
|
31
35
|
output: { path: totals, kind: variant('value', null) },
|
|
32
36
|
role: variant('data', null),
|
|
@@ -49,6 +53,7 @@ describe('TaskObjectType', () => {
|
|
|
49
53
|
},
|
|
50
54
|
{ ...base, output: { path: totals, kind: variant('fold', { zero: 'e'.repeat(64), combine: 'f'.repeat(64) }) } },
|
|
51
55
|
{ ...base, output: { path: totals, kind: variant('set', null) } },
|
|
56
|
+
{ ...base, runner: variant('east_py', { platforms: ['east-py-std'], decode: variant('whole', null) }) },
|
|
52
57
|
{ ...base, role: variant('ui', { paths: [sales], functions: ['forecast'], records: ['plans'], pages: [rates] }) },
|
|
53
58
|
];
|
|
54
59
|
const encode = encodeBeast2For(TaskObjectType);
|
|
@@ -71,12 +76,33 @@ describe('TaskObjectType', () => {
|
|
|
71
76
|
output: totals,
|
|
72
77
|
kind: none,
|
|
73
78
|
metadata: none,
|
|
74
|
-
runner: variant('east_node', { platforms: [] }),
|
|
79
|
+
runner: variant('east_node', { platforms: [], decode: variant('lazy', null) }),
|
|
75
80
|
environment: none,
|
|
76
81
|
});
|
|
77
82
|
assert.throws(() => decodeTaskObject(older), /exported by an older e3 SDK — re-export it with the current one/);
|
|
78
83
|
});
|
|
79
84
|
|
|
85
|
+
it('refuses a task object whose runner predates its decode, saying to re-export the package', () => {
|
|
86
|
+
// A stock runner as a package exported before runners said how they read
|
|
87
|
+
// a program's inputs: its platforms alone.
|
|
88
|
+
const PreDecodeRunnerType = VariantType({
|
|
89
|
+
east_node: StructType({ platforms: ArrayType(StringType) }),
|
|
90
|
+
east_py: StructType({ platforms: ArrayType(StringType) }),
|
|
91
|
+
east_c: StructType({ platforms: ArrayType(StringType) }),
|
|
92
|
+
custom: StructType({ command: ArrayType(StringType) }),
|
|
93
|
+
});
|
|
94
|
+
const older = encodeBeast2For(StructType({
|
|
95
|
+
kind: StringType,
|
|
96
|
+
body: TaskBodyType,
|
|
97
|
+
runner: PreDecodeRunnerType,
|
|
98
|
+
inputs: ArrayType(TaskInputType),
|
|
99
|
+
output: TaskOutputType,
|
|
100
|
+
role: TaskRoleType,
|
|
101
|
+
environment: OptionType(StringType),
|
|
102
|
+
}))({ ...base, runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }) });
|
|
103
|
+
assert.throws(() => decodeTaskObject(older), /exported by an older e3 SDK — re-export it with the current one/);
|
|
104
|
+
});
|
|
105
|
+
|
|
80
106
|
it('refuses an object of the task shape that carries another kind tag', () => {
|
|
81
107
|
assert.throws(() => decodeTaskObject(encodeBeast2For(TaskObjectType)({ ...base, kind: '$plan' })), /its kind is '\$plan', not '\$task'/);
|
|
82
108
|
});
|
package/src/task.ts
CHANGED
|
@@ -132,7 +132,7 @@ export type TaskRole = ValueTypeOf<typeof TaskRoleType>;
|
|
|
132
132
|
* const task: TaskObject = {
|
|
133
133
|
* kind: TASK_OBJECT_KIND,
|
|
134
134
|
* body: variant('east', { program: '5e7a3b...' }),
|
|
135
|
-
* runner: variant('east_node', { platforms: ['@elaraai/east-node-std'] }),
|
|
135
|
+
* runner: variant('east_node', { platforms: ['@elaraai/east-node-std'], decode: variant('lazy', null) }),
|
|
136
136
|
* inputs: [{ path: [variant('field', 'inputs'), variant('field', 'sales')], partition: none }],
|
|
137
137
|
* output: { path: [variant('field', 'tasks'), variant('field', 'totals'), variant('field', 'output')], kind: variant('value', null) },
|
|
138
138
|
* role: variant('data', null),
|