@elaraai/e3-api-tests 1.0.97 → 1.0.98
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/assertions.d.ts +11 -0
- package/dist/src/assertions.d.ts.map +1 -1
- package/dist/src/assertions.js +19 -3
- package/dist/src/assertions.js.map +1 -1
- package/dist/src/fixtures.d.ts +201 -1
- package/dist/src/fixtures.d.ts.map +1 -1
- package/dist/src/fixtures.js +257 -1
- package/dist/src/fixtures.js.map +1 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/suites/dataset-batches.d.ts +8 -0
- package/dist/src/suites/dataset-batches.d.ts.map +1 -0
- package/dist/src/suites/dataset-batches.js +346 -0
- package/dist/src/suites/dataset-batches.js.map +1 -0
- package/dist/src/suites/records-area.d.ts +8 -0
- package/dist/src/suites/records-area.d.ts.map +1 -0
- package/dist/src/suites/records-area.js +339 -0
- package/dist/src/suites/records-area.js.map +1 -0
- package/dist/src/suites/records-keyed.d.ts.map +1 -1
- package/dist/src/suites/records-keyed.js +8 -5
- package/dist/src/suites/records-keyed.js.map +1 -1
- package/dist/src/suites/records-place.d.ts +8 -0
- package/dist/src/suites/records-place.d.ts.map +1 -0
- package/dist/src/suites/records-place.js +341 -0
- package/dist/src/suites/records-place.js.map +1 -0
- package/dist/src/suites/records-series.d.ts +8 -0
- package/dist/src/suites/records-series.d.ts.map +1 -0
- package/dist/src/suites/records-series.js +280 -0
- package/dist/src/suites/records-series.js.map +1 -0
- package/package.json +10 -10
package/dist/src/assertions.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
+
import { type ValueTypeOf } from '@elaraai/east';
|
|
6
|
+
import { MutationResultType } from '@elaraai/e3-types';
|
|
5
7
|
/**
|
|
6
8
|
* Names no workspace can have, each with why, as a refusal says it: a lock's
|
|
7
9
|
* name (`main#dataflow`, the lock a run of main's dataflow holds), the
|
|
@@ -38,6 +40,15 @@ interface DataflowResultLike {
|
|
|
38
40
|
}
|
|
39
41
|
/** Build a human-readable summary of a dataflow result for failure messages. */
|
|
40
42
|
export declare function describeDataflowResult(result: DataflowResultLike): string;
|
|
43
|
+
/**
|
|
44
|
+
* Assert that a record mutation committed, printing its whole outcome when it
|
|
45
|
+
* did not: a failed program's exit code and the tail of its stderr, a timeout
|
|
46
|
+
* and the stderr it left, a conflict's detail, or why the call was invalid.
|
|
47
|
+
*
|
|
48
|
+
* @param result - The mutation's result, as `workspaceRecordMutate` answers it
|
|
49
|
+
* @param what - What the mutation does, which the message starts with (e.g. `seeding`)
|
|
50
|
+
*/
|
|
51
|
+
export declare function assertMutationCommitted(result: ValueTypeOf<typeof MutationResultType>, what: string): void;
|
|
41
52
|
/**
|
|
42
53
|
* Assert that a dataflow execution succeeded, surfacing every task's
|
|
43
54
|
* terminal state (exit codes, runner error messages) when it did not.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../src/assertions.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../src/assertions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,OAAO,EAAiC,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAwB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAM7E;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,mKAK5B,CAAC;AAEX;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAYxF;AAED,iFAAiF;AACjF,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iEAAiE;AACjE,UAAU,kBAAkB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAcD,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAMzE;AAKD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1G;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAO1F"}
|
package/dist/src/assertions.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Assertions the suites share: of a dataflow's result,
|
|
7
|
-
* refusal of a name no workspace can have.
|
|
6
|
+
* Assertions the suites share: of a dataflow's result, of a record mutation's,
|
|
7
|
+
* and of the API's refusal of a name no workspace can have.
|
|
8
8
|
*
|
|
9
9
|
* A bare `assert.strictEqual(result.success, true)` collapses a rich
|
|
10
10
|
* failure — a task that exited non-zero, a runner that failed to spawn,
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* `.ref` rename-over-open can transiently fail). These helpers fold the
|
|
14
14
|
* per-task diagnostics already carried in `result.tasks` into the
|
|
15
15
|
* assertion message so the next failure is actionable instead of opaque.
|
|
16
|
+
* A mutation's outcome is the same: one that did not commit carries its
|
|
17
|
+
* program's exit code and the tail of its stderr, which a check of the
|
|
18
|
+
* outcome's case alone drops.
|
|
16
19
|
*
|
|
17
20
|
* Every route of a workspace refuses a name no workspace can have before it
|
|
18
21
|
* takes a lock, as `invalid_name` of a workspace: a lock's name may hold the
|
|
@@ -21,7 +24,7 @@
|
|
|
21
24
|
*/
|
|
22
25
|
import assert from 'node:assert/strict';
|
|
23
26
|
import { equalFor, isValueOf, printFor } from '@elaraai/east';
|
|
24
|
-
import { InvalidNameErrorType } from '@elaraai/e3-types';
|
|
27
|
+
import { InvalidNameErrorType, MutationResultType } from '@elaraai/e3-types';
|
|
25
28
|
import { ApiError } from '@elaraai/e3-api-client';
|
|
26
29
|
/** Why no workspace's name may hold `c`: it joins the parts of a lock's name. */
|
|
27
30
|
const joinsLockNames = (c) => `holds ${JSON.stringify(c)}, which joins the parts of a lock's name`;
|
|
@@ -76,6 +79,19 @@ export function describeDataflowResult(result) {
|
|
|
76
79
|
const lines = result.tasks.map(describeTask);
|
|
77
80
|
return lines.length > 0 ? `${counts}\ntasks:\n${lines.join('\n')}` : counts;
|
|
78
81
|
}
|
|
82
|
+
/** A record mutation's result, printed whole. */
|
|
83
|
+
const printMutationResult = printFor(MutationResultType);
|
|
84
|
+
/**
|
|
85
|
+
* Assert that a record mutation committed, printing its whole outcome when it
|
|
86
|
+
* did not: a failed program's exit code and the tail of its stderr, a timeout
|
|
87
|
+
* and the stderr it left, a conflict's detail, or why the call was invalid.
|
|
88
|
+
*
|
|
89
|
+
* @param result - The mutation's result, as `workspaceRecordMutate` answers it
|
|
90
|
+
* @param what - What the mutation does, which the message starts with (e.g. `seeding`)
|
|
91
|
+
*/
|
|
92
|
+
export function assertMutationCommitted(result, what) {
|
|
93
|
+
assert.equal(result.outcome.type, 'committed', `${what} must commit, got ${printMutationResult(result)}`);
|
|
94
|
+
}
|
|
79
95
|
/**
|
|
80
96
|
* Assert that a dataflow execution succeeded, surfacing every task's
|
|
81
97
|
* terminal state (exit codes, runner error messages) when it did not.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../src/assertions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../src/assertions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAoB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,iFAAiF;AACjF,MAAM,cAAc,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,0CAA0C,CAAC;AAE3G;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,CAAC,eAAe,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC,UAAU,EAAE,qCAAqC,CAAC;CAC3C,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,GAAW;IAC9D,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,CAAC,EAAE,CAAC,GAAG,YAAY,QAAQ,EAAE,GAAG,IAAI,4BAA4B,GAAG,EAAE,CAAC,CAAC;QAC7E,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,IAA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for details.
|
|
4
4
|
*/
|
|
5
|
-
import { DictType, IntegerType, StringType, StructType } from '@elaraai/east';
|
|
5
|
+
import { DateTimeType, DictType, FloatType, IntegerType, SetType, StringType, StructType, OptionType } from '@elaraai/east';
|
|
6
6
|
/**
|
|
7
7
|
* Create a simple compute package for testing.
|
|
8
8
|
*
|
|
@@ -95,6 +95,206 @@ export declare const PlanStatusKeyType: StructType<{
|
|
|
95
95
|
* @returns Path to the created zip file
|
|
96
96
|
*/
|
|
97
97
|
export declare function createKeyedRecordPackageZip(tempDir: string, name: string, version: string): Promise<string>;
|
|
98
|
+
/** The row of the batch-read fixture's record. */
|
|
99
|
+
export declare const ItemRowType: StructType<{
|
|
100
|
+
readonly group: StringType;
|
|
101
|
+
readonly rank: IntegerType;
|
|
102
|
+
readonly label: StringType;
|
|
103
|
+
}>;
|
|
104
|
+
/** The batch-read fixture's record: a Dict of items. */
|
|
105
|
+
export declare const ItemsType: DictType<StringType, StructType<{
|
|
106
|
+
readonly group: StringType;
|
|
107
|
+
readonly rank: IntegerType;
|
|
108
|
+
readonly label: StringType;
|
|
109
|
+
}>>;
|
|
110
|
+
/** The `by_group` index key: a group, then a rank inside it. */
|
|
111
|
+
export declare const ItemGroupKeyType: StructType<{
|
|
112
|
+
readonly group: StringType;
|
|
113
|
+
readonly rank: IntegerType;
|
|
114
|
+
}>;
|
|
115
|
+
/** The row of the batch-read fixture's second record: a note on an item. */
|
|
116
|
+
export declare const ItemNoteRowType: StructType<{
|
|
117
|
+
readonly note: StringType;
|
|
118
|
+
}>;
|
|
119
|
+
/** The batch-read fixture's second record: notes, keyed as the items are. */
|
|
120
|
+
export declare const ItemNotesType: DictType<StringType, StructType<{
|
|
121
|
+
readonly note: StringType;
|
|
122
|
+
}>>;
|
|
123
|
+
/**
|
|
124
|
+
* Create a package whose record a dataset's batch reads are run over (#1351):
|
|
125
|
+
* several key searches in one request, the rows of several keys — or of the
|
|
126
|
+
* keys some runs of another record's index name (#1393) — the entries of
|
|
127
|
+
* several runs.
|
|
128
|
+
*
|
|
129
|
+
* Creates a package with:
|
|
130
|
+
* - Record: "items" (Dict<String, {group, rank, label}>, empty), and Mutation
|
|
131
|
+
* "seed" (rows) => `rows` items keyed `item-<i>`, in five groups
|
|
132
|
+
* (`g0`…`g4`, by `i` mod 5), each ranked `i`
|
|
133
|
+
* - Index: "by_group" on `group` then `rank`, one entry per row, so a group is
|
|
134
|
+
* one run of it
|
|
135
|
+
* - Record: "item_notes" (Dict<String, {note}>, empty), keyed as the items
|
|
136
|
+
* are, and Mutation "seed_notes" (rows) => a note on every third of `rows`
|
|
137
|
+
* items, `item-<i>` for `i` a multiple of 3, `Note <i>`
|
|
138
|
+
*
|
|
139
|
+
* @param tempDir - Directory to write the zip file
|
|
140
|
+
* @param name - Package name
|
|
141
|
+
* @param version - Package version
|
|
142
|
+
* @returns Path to the created zip file
|
|
143
|
+
*/
|
|
144
|
+
export declare function createBatchReadsPackageZip(tempDir: string, name: string, version: string): Promise<string>;
|
|
145
|
+
/** The upload-named fixture's input: counts by name. */
|
|
146
|
+
export declare const CountsType: DictType<StringType, IntegerType>;
|
|
147
|
+
/**
|
|
148
|
+
* Create a package whose dataset is named as an upload's route ends: a
|
|
149
|
+
* dataset's batch reads are POSTs to its own path, and an upload's init is a
|
|
150
|
+
* POST to `<path>/upload`, so a batch read of `inputs.upload` is a POST to the
|
|
151
|
+
* path an upload of `inputs` would begin at.
|
|
152
|
+
*
|
|
153
|
+
* Creates a package with:
|
|
154
|
+
* - Input: "upload" (Dict<String, Integer>, default {a: 1, b: 2, c: 3})
|
|
155
|
+
*
|
|
156
|
+
* @param tempDir - Directory to write the zip file
|
|
157
|
+
* @param name - Package name
|
|
158
|
+
* @param version - Package version
|
|
159
|
+
* @returns Path to the created zip file
|
|
160
|
+
*/
|
|
161
|
+
export declare function createUploadNamedPackageZip(tempDir: string, name: string, version: string): Promise<string>;
|
|
162
|
+
/** The row of the area fixture's record: a rack's hall, where it stands — by its centre — if anywhere yet, and its footprint. */
|
|
163
|
+
export declare const RackRowType: StructType<{
|
|
164
|
+
readonly hall: StringType;
|
|
165
|
+
readonly x: OptionType<FloatType>;
|
|
166
|
+
readonly y: OptionType<FloatType>;
|
|
167
|
+
readonly w: FloatType;
|
|
168
|
+
readonly h: FloatType;
|
|
169
|
+
}>;
|
|
170
|
+
/** The area fixture's record: racks by key. */
|
|
171
|
+
export declare const RacksType: DictType<StringType, StructType<{
|
|
172
|
+
readonly hall: StringType;
|
|
173
|
+
readonly x: OptionType<FloatType>;
|
|
174
|
+
readonly y: OptionType<FloatType>;
|
|
175
|
+
readonly w: FloatType;
|
|
176
|
+
readonly h: FloatType;
|
|
177
|
+
}>>;
|
|
178
|
+
/** The finest cell of the area fixture's indexes: their declared 0.01, rounded down to a power of two. */
|
|
179
|
+
export declare const RACK_CELL: number;
|
|
180
|
+
/** The key of the area fixture's `racks_by_area`: a rack's cell and level, led by no field. */
|
|
181
|
+
export declare const RackAreaKeyType: StructType<{
|
|
182
|
+
readonly __area: IntegerType;
|
|
183
|
+
}>;
|
|
184
|
+
/** The key of its `racks_by_hall_area`: a rack's hall, then its cell and level. */
|
|
185
|
+
export declare const RackHallAreaKeyType: StructType<{
|
|
186
|
+
readonly hall: StringType;
|
|
187
|
+
readonly __area: IntegerType;
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* Create a package whose record is read by area (#1385): a window over a
|
|
191
|
+
* floor's racks, read through an area index from the index alone.
|
|
192
|
+
*
|
|
193
|
+
* Creates a package with:
|
|
194
|
+
* - Record: "racks" (Dict<String, {hall, x, y, w, h}>, empty), its patch door,
|
|
195
|
+
* and Mutation "seed" (count) => `count` racks keyed `rack-<i>`: in three
|
|
196
|
+
* halls (`H0`…`H2`, by `i` mod 3), centred on a grid of 37 columns 1.7 apart
|
|
197
|
+
* from x = −30 and rows 1.3 apart from y = −20, some a cell or two off their
|
|
198
|
+
* column; of footprints from 0.3 × 0.2 to 1.9 × 2.0; every eleventh not yet
|
|
199
|
+
* placed
|
|
200
|
+
* - Index: "racks_by_area", each rack's box by its centre, at a 0.01 cell, led
|
|
201
|
+
* by no field ({@link RackAreaKeyType}); and "racks_by_hall_area", the same
|
|
202
|
+
* led by the hall ({@link RackHallAreaKeyType}). Each carries its rows whole
|
|
203
|
+
*
|
|
204
|
+
* @param tempDir - Directory to write the zip file
|
|
205
|
+
* @param name - Package name
|
|
206
|
+
* @param version - Package version
|
|
207
|
+
* @returns Path to the created zip file
|
|
208
|
+
*/
|
|
209
|
+
export declare function createAreaRecordPackageZip(tempDir: string, name: string, version: string): Promise<string>;
|
|
210
|
+
/** When the place fixture's first order starts: midnight UTC on 1 January 2026. */
|
|
211
|
+
export declare const ORDERS_FROM: Date;
|
|
212
|
+
/** The row of the place fixture's record: an order's status, its name, its due rank, its tags, and when it runs. */
|
|
213
|
+
export declare const OrderRowType: StructType<{
|
|
214
|
+
readonly status: StringType;
|
|
215
|
+
readonly name: StringType;
|
|
216
|
+
readonly due: IntegerType;
|
|
217
|
+
readonly tags: SetType<StringType>;
|
|
218
|
+
readonly start: DateTimeType;
|
|
219
|
+
readonly end: DateTimeType;
|
|
220
|
+
}>;
|
|
221
|
+
/** The place fixture's record: orders by key. */
|
|
222
|
+
export declare const OrdersType: DictType<StringType, StructType<{
|
|
223
|
+
readonly status: StringType;
|
|
224
|
+
readonly name: StringType;
|
|
225
|
+
readonly due: IntegerType;
|
|
226
|
+
readonly tags: SetType<StringType>;
|
|
227
|
+
readonly start: DateTimeType;
|
|
228
|
+
readonly end: DateTimeType;
|
|
229
|
+
}>>;
|
|
230
|
+
/**
|
|
231
|
+
* Create a package whose record a narrowing's rows are placed in (#1349): in
|
|
232
|
+
* which of the record's segments the rows of a narrowing sit, from its runs of
|
|
233
|
+
* one of the record's indexes, and which index entries those runs hold.
|
|
234
|
+
*
|
|
235
|
+
* Creates a package with:
|
|
236
|
+
* - Record: "orders" (Dict<String, {status, name, due, tags, start, end}>,
|
|
237
|
+
* empty), and Mutation "seed" (count) => `count` orders keyed `order-<i>`:
|
|
238
|
+
* `open`, `late`, `done` or `held` by `i` mod 4; named `Ash`, `Birch`,
|
|
239
|
+
* `Cedar` or `Fir` by `i` div 3 mod 4, then `i`; due `i` × 7919 mod `count`,
|
|
240
|
+
* a rank of its own whenever `count` shares no factor with 7919; tagged
|
|
241
|
+
* `t<i mod 5>` and `t<i mod 7>`; starting `i` mod 97 hours after
|
|
242
|
+
* {@link ORDERS_FROM}, and running 30 days when `i` is a multiple of 13, else
|
|
243
|
+
* `i` mod 5 hours, which is no time at all when it is 0
|
|
244
|
+
* - Indexes: "orders_by_status", "orders_by_name", "orders_by_due" and
|
|
245
|
+
* "orders_by_tag", each on its one field (the tags' files an order under each
|
|
246
|
+
* of its tags), and "orders_by_time", the interval index from `start` to
|
|
247
|
+
* `end`
|
|
248
|
+
*
|
|
249
|
+
* @param tempDir - Directory to write the zip file
|
|
250
|
+
* @param name - Package name
|
|
251
|
+
* @param version - Package version
|
|
252
|
+
* @returns Path to the created zip file
|
|
253
|
+
*/
|
|
254
|
+
export declare function createPlaceRecordPackageZip(tempDir: string, name: string, version: string): Promise<string>;
|
|
255
|
+
/** When the series fixture's first job may start: midnight UTC on Monday 5 October 2026, a week's start. */
|
|
256
|
+
export declare const JOBS_FROM: Date;
|
|
257
|
+
/** The row of the series fixture's record: a print job's press, when it runs, and its title. */
|
|
258
|
+
export declare const JobRowType: StructType<{
|
|
259
|
+
readonly press: StringType;
|
|
260
|
+
readonly start: DateTimeType;
|
|
261
|
+
readonly end: DateTimeType;
|
|
262
|
+
readonly title: StringType;
|
|
263
|
+
}>;
|
|
264
|
+
/** The series fixture's record: jobs by key. */
|
|
265
|
+
export declare const JobsType: DictType<StringType, StructType<{
|
|
266
|
+
readonly press: StringType;
|
|
267
|
+
readonly start: DateTimeType;
|
|
268
|
+
readonly end: DateTimeType;
|
|
269
|
+
readonly title: StringType;
|
|
270
|
+
}>>;
|
|
271
|
+
/** The key of the series fixture's two indexes: a week's start, then a press. */
|
|
272
|
+
export declare const JobWeekPressKeyType: StructType<{
|
|
273
|
+
readonly __tile: DateTimeType;
|
|
274
|
+
readonly press: StringType;
|
|
275
|
+
}>;
|
|
276
|
+
/**
|
|
277
|
+
* Create a package whose record is read in two dimensions (#1039): a block of
|
|
278
|
+
* presses over a span of weeks, through a series index from the index alone,
|
|
279
|
+
* and, zoomed out, through a summary index's totals.
|
|
280
|
+
*
|
|
281
|
+
* Creates a package with:
|
|
282
|
+
* - Record: "jobs" (Dict<String, {press, start, end, title}>, empty), its patch
|
|
283
|
+
* door, and Mutation "seed" (count) => `count` jobs keyed `job-<i>`: on one of
|
|
284
|
+
* forty presses (`P-1001`…`P-1040`, by `i` mod 40), starting `i` × 7 mod 1,680
|
|
285
|
+
* hours after {@link JOBS_FROM} — over ten weeks — and running `i` mod 50 + 1
|
|
286
|
+
* hours, so many run into the next week
|
|
287
|
+
* - Index: "jobs_by_press_week", each job under each week it touches and its
|
|
288
|
+
* press, carrying its row; and "jobs_by_press_week_totals", how many jobs
|
|
289
|
+
* touch each week on each press and the time of it they cover. Both are keyed
|
|
290
|
+
* {@link JobWeekPressKeyType}
|
|
291
|
+
*
|
|
292
|
+
* @param tempDir - Directory to write the zip file
|
|
293
|
+
* @param name - Package name
|
|
294
|
+
* @param version - Package version
|
|
295
|
+
* @returns Path to the created zip file
|
|
296
|
+
*/
|
|
297
|
+
export declare function createSeriesRecordPackageZip(tempDir: string, name: string, version: string): Promise<string>;
|
|
98
298
|
/** A row of the migration fixture's record before its migration. */
|
|
99
299
|
export declare const TaskRowV1Type: StructType<{
|
|
100
300
|
readonly title: StringType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAA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
|
|
13
13
|
import e3 from '@elaraai/e3';
|
|
14
|
-
import { ArrayType, DictType, FunctionType, IntegerType, NullType, StringType, StructType, OptionType, East, variant, some, none } from '@elaraai/east';
|
|
14
|
+
import { ArrayType, DateTimeType, DictType, FloatType, FunctionType, IntegerType, NullType, SetType, StringType, StructType, OptionType, East, variant, some, none, } from '@elaraai/east';
|
|
15
15
|
import { Console, Time } from '@elaraai/east-node-std';
|
|
16
16
|
/**
|
|
17
17
|
* Create a simple compute package for testing.
|
|
@@ -175,6 +175,262 @@ export async function createKeyedRecordPackageZip(tempDir, name, version) {
|
|
|
175
175
|
await e3.export(pkg, zipPath);
|
|
176
176
|
return zipPath;
|
|
177
177
|
}
|
|
178
|
+
/** The row of the batch-read fixture's record. */
|
|
179
|
+
export const ItemRowType = StructType({ group: StringType, rank: IntegerType, label: StringType });
|
|
180
|
+
/** The batch-read fixture's record: a Dict of items. */
|
|
181
|
+
export const ItemsType = DictType(StringType, ItemRowType);
|
|
182
|
+
/** The `by_group` index key: a group, then a rank inside it. */
|
|
183
|
+
export const ItemGroupKeyType = StructType({ group: StringType, rank: IntegerType });
|
|
184
|
+
/** The row of the batch-read fixture's second record: a note on an item. */
|
|
185
|
+
export const ItemNoteRowType = StructType({ note: StringType });
|
|
186
|
+
/** The batch-read fixture's second record: notes, keyed as the items are. */
|
|
187
|
+
export const ItemNotesType = DictType(StringType, ItemNoteRowType);
|
|
188
|
+
/**
|
|
189
|
+
* Create a package whose record a dataset's batch reads are run over (#1351):
|
|
190
|
+
* several key searches in one request, the rows of several keys — or of the
|
|
191
|
+
* keys some runs of another record's index name (#1393) — the entries of
|
|
192
|
+
* several runs.
|
|
193
|
+
*
|
|
194
|
+
* Creates a package with:
|
|
195
|
+
* - Record: "items" (Dict<String, {group, rank, label}>, empty), and Mutation
|
|
196
|
+
* "seed" (rows) => `rows` items keyed `item-<i>`, in five groups
|
|
197
|
+
* (`g0`…`g4`, by `i` mod 5), each ranked `i`
|
|
198
|
+
* - Index: "by_group" on `group` then `rank`, one entry per row, so a group is
|
|
199
|
+
* one run of it
|
|
200
|
+
* - Record: "item_notes" (Dict<String, {note}>, empty), keyed as the items
|
|
201
|
+
* are, and Mutation "seed_notes" (rows) => a note on every third of `rows`
|
|
202
|
+
* items, `item-<i>` for `i` a multiple of 3, `Note <i>`
|
|
203
|
+
*
|
|
204
|
+
* @param tempDir - Directory to write the zip file
|
|
205
|
+
* @param name - Package name
|
|
206
|
+
* @param version - Package version
|
|
207
|
+
* @returns Path to the created zip file
|
|
208
|
+
*/
|
|
209
|
+
export async function createBatchReadsPackageZip(tempDir, name, version) {
|
|
210
|
+
mkdirSync(tempDir, { recursive: true });
|
|
211
|
+
const items = e3.record('items', ItemsType, new Map());
|
|
212
|
+
const seed = e3.mutation.reduce('seed', items, East.function([ItemsType, IntegerType], ItemsType, ($, _state, rows) => {
|
|
213
|
+
const out = $.let(new Map(), ItemsType);
|
|
214
|
+
$.for(East.Array.range(0n, rows), ($, i) => {
|
|
215
|
+
$(out.insert(East.str `item-${i}`, { group: East.str `g${i.remainder(5n)}`, rank: i, label: East.str `Item ${i}` }));
|
|
216
|
+
});
|
|
217
|
+
return out;
|
|
218
|
+
}));
|
|
219
|
+
const byGroup = e3.recordIndex('by_group', items, { on: ['group', 'rank'] });
|
|
220
|
+
const notes = e3.record('item_notes', ItemNotesType, new Map());
|
|
221
|
+
const seedNotes = e3.mutation.reduce('seed_notes', notes, East.function([ItemNotesType, IntegerType], ItemNotesType, ($, _state, rows) => {
|
|
222
|
+
const out = $.let(new Map(), ItemNotesType);
|
|
223
|
+
$.for(East.Array.range(0n, rows), ($, i) => {
|
|
224
|
+
$.if(East.equal(i.remainder(3n), 0n), ($) => {
|
|
225
|
+
$(out.insert(East.str `item-${i}`, { note: East.str `Note ${i}` }));
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
return out;
|
|
229
|
+
}));
|
|
230
|
+
const pkg = e3.package(name, version, items, seed, byGroup, notes, seedNotes);
|
|
231
|
+
const zipPath = join(tempDir, `${name}-${version}.zip`);
|
|
232
|
+
await e3.export(pkg, zipPath);
|
|
233
|
+
return zipPath;
|
|
234
|
+
}
|
|
235
|
+
/** The upload-named fixture's input: counts by name. */
|
|
236
|
+
export const CountsType = DictType(StringType, IntegerType);
|
|
237
|
+
/**
|
|
238
|
+
* Create a package whose dataset is named as an upload's route ends: a
|
|
239
|
+
* dataset's batch reads are POSTs to its own path, and an upload's init is a
|
|
240
|
+
* POST to `<path>/upload`, so a batch read of `inputs.upload` is a POST to the
|
|
241
|
+
* path an upload of `inputs` would begin at.
|
|
242
|
+
*
|
|
243
|
+
* Creates a package with:
|
|
244
|
+
* - Input: "upload" (Dict<String, Integer>, default {a: 1, b: 2, c: 3})
|
|
245
|
+
*
|
|
246
|
+
* @param tempDir - Directory to write the zip file
|
|
247
|
+
* @param name - Package name
|
|
248
|
+
* @param version - Package version
|
|
249
|
+
* @returns Path to the created zip file
|
|
250
|
+
*/
|
|
251
|
+
export async function createUploadNamedPackageZip(tempDir, name, version) {
|
|
252
|
+
mkdirSync(tempDir, { recursive: true });
|
|
253
|
+
const upload = e3.input('upload', CountsType, variant('value', new Map([['a', 1n], ['b', 2n], ['c', 3n]])));
|
|
254
|
+
const pkg = e3.package(name, version, upload);
|
|
255
|
+
const zipPath = join(tempDir, `${name}-${version}.zip`);
|
|
256
|
+
await e3.export(pkg, zipPath);
|
|
257
|
+
return zipPath;
|
|
258
|
+
}
|
|
259
|
+
/** The row of the area fixture's record: a rack's hall, where it stands — by its centre — if anywhere yet, and its footprint. */
|
|
260
|
+
export const RackRowType = StructType({ hall: StringType, x: OptionType(FloatType), y: OptionType(FloatType), w: FloatType, h: FloatType });
|
|
261
|
+
/** The area fixture's record: racks by key. */
|
|
262
|
+
export const RacksType = DictType(StringType, RackRowType);
|
|
263
|
+
/** The finest cell of the area fixture's indexes: their declared 0.01, rounded down to a power of two. */
|
|
264
|
+
export const RACK_CELL = 2 ** -7;
|
|
265
|
+
/** The key of the area fixture's `racks_by_area`: a rack's cell and level, led by no field. */
|
|
266
|
+
export const RackAreaKeyType = StructType({ __area: IntegerType });
|
|
267
|
+
/** The key of its `racks_by_hall_area`: a rack's hall, then its cell and level. */
|
|
268
|
+
export const RackHallAreaKeyType = StructType({ hall: StringType, __area: IntegerType });
|
|
269
|
+
/**
|
|
270
|
+
* Create a package whose record is read by area (#1385): a window over a
|
|
271
|
+
* floor's racks, read through an area index from the index alone.
|
|
272
|
+
*
|
|
273
|
+
* Creates a package with:
|
|
274
|
+
* - Record: "racks" (Dict<String, {hall, x, y, w, h}>, empty), its patch door,
|
|
275
|
+
* and Mutation "seed" (count) => `count` racks keyed `rack-<i>`: in three
|
|
276
|
+
* halls (`H0`…`H2`, by `i` mod 3), centred on a grid of 37 columns 1.7 apart
|
|
277
|
+
* from x = −30 and rows 1.3 apart from y = −20, some a cell or two off their
|
|
278
|
+
* column; of footprints from 0.3 × 0.2 to 1.9 × 2.0; every eleventh not yet
|
|
279
|
+
* placed
|
|
280
|
+
* - Index: "racks_by_area", each rack's box by its centre, at a 0.01 cell, led
|
|
281
|
+
* by no field ({@link RackAreaKeyType}); and "racks_by_hall_area", the same
|
|
282
|
+
* led by the hall ({@link RackHallAreaKeyType}). Each carries its rows whole
|
|
283
|
+
*
|
|
284
|
+
* @param tempDir - Directory to write the zip file
|
|
285
|
+
* @param name - Package name
|
|
286
|
+
* @param version - Package version
|
|
287
|
+
* @returns Path to the created zip file
|
|
288
|
+
*/
|
|
289
|
+
export async function createAreaRecordPackageZip(tempDir, name, version) {
|
|
290
|
+
mkdirSync(tempDir, { recursive: true });
|
|
291
|
+
const racks = e3.record('racks', RacksType, new Map());
|
|
292
|
+
const seed = e3.mutation.reduce('seed', racks, East.function([RacksType, IntegerType], RacksType, ($, _state, count) => {
|
|
293
|
+
const out = $.let(new Map(), RacksType);
|
|
294
|
+
$.for(East.Array.range(0n, count), ($, i) => {
|
|
295
|
+
const hall = $.let(East.str `H${i.remainder(3n)}`);
|
|
296
|
+
const x = $.let(i.remainder(37n).toFloat().multiply(1.7).subtract(30.0).add(i.remainder(3n).toFloat().multiply(RACK_CELL)));
|
|
297
|
+
const y = $.let(i.divide(37n).toFloat().multiply(1.3).subtract(20.0));
|
|
298
|
+
const w = $.let(i.remainder(5n).toFloat().multiply(0.4).add(0.3));
|
|
299
|
+
const h = $.let(i.remainder(7n).toFloat().multiply(0.3).add(0.2));
|
|
300
|
+
$.if(East.equal(i.remainder(11n), 0n), ($) => {
|
|
301
|
+
$(out.insert(East.str `rack-${i}`, { hall, x: none, y: none, w, h }));
|
|
302
|
+
}).else(($) => {
|
|
303
|
+
$(out.insert(East.str `rack-${i}`, { hall, x: some(x), y: some(y), w, h }));
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
return out;
|
|
307
|
+
}));
|
|
308
|
+
const byArea = e3.recordIndex.area('racks_by_area', racks, { x: 'x', y: 'y', width: 'w', height: 'h', at: 'centre', cell: 0.01 });
|
|
309
|
+
const byHallArea = e3.recordIndex.area('racks_by_hall_area', racks, { on: ['hall'], x: 'x', y: 'y', width: 'w', height: 'h', at: 'centre', cell: 0.01 });
|
|
310
|
+
const pkg = e3.package(name, version, racks, seed, e3.mutation.patch(racks), byArea, byHallArea);
|
|
311
|
+
const zipPath = join(tempDir, `${name}-${version}.zip`);
|
|
312
|
+
await e3.export(pkg, zipPath);
|
|
313
|
+
return zipPath;
|
|
314
|
+
}
|
|
315
|
+
/** When the place fixture's first order starts: midnight UTC on 1 January 2026. */
|
|
316
|
+
export const ORDERS_FROM = new Date(Date.UTC(2026, 0, 1));
|
|
317
|
+
/** The row of the place fixture's record: an order's status, its name, its due rank, its tags, and when it runs. */
|
|
318
|
+
export const OrderRowType = StructType({
|
|
319
|
+
status: StringType, name: StringType, due: IntegerType, tags: SetType(StringType), start: DateTimeType, end: DateTimeType,
|
|
320
|
+
});
|
|
321
|
+
/** The place fixture's record: orders by key. */
|
|
322
|
+
export const OrdersType = DictType(StringType, OrderRowType);
|
|
323
|
+
/**
|
|
324
|
+
* Create a package whose record a narrowing's rows are placed in (#1349): in
|
|
325
|
+
* which of the record's segments the rows of a narrowing sit, from its runs of
|
|
326
|
+
* one of the record's indexes, and which index entries those runs hold.
|
|
327
|
+
*
|
|
328
|
+
* Creates a package with:
|
|
329
|
+
* - Record: "orders" (Dict<String, {status, name, due, tags, start, end}>,
|
|
330
|
+
* empty), and Mutation "seed" (count) => `count` orders keyed `order-<i>`:
|
|
331
|
+
* `open`, `late`, `done` or `held` by `i` mod 4; named `Ash`, `Birch`,
|
|
332
|
+
* `Cedar` or `Fir` by `i` div 3 mod 4, then `i`; due `i` × 7919 mod `count`,
|
|
333
|
+
* a rank of its own whenever `count` shares no factor with 7919; tagged
|
|
334
|
+
* `t<i mod 5>` and `t<i mod 7>`; starting `i` mod 97 hours after
|
|
335
|
+
* {@link ORDERS_FROM}, and running 30 days when `i` is a multiple of 13, else
|
|
336
|
+
* `i` mod 5 hours, which is no time at all when it is 0
|
|
337
|
+
* - Indexes: "orders_by_status", "orders_by_name", "orders_by_due" and
|
|
338
|
+
* "orders_by_tag", each on its one field (the tags' files an order under each
|
|
339
|
+
* of its tags), and "orders_by_time", the interval index from `start` to
|
|
340
|
+
* `end`
|
|
341
|
+
*
|
|
342
|
+
* @param tempDir - Directory to write the zip file
|
|
343
|
+
* @param name - Package name
|
|
344
|
+
* @param version - Package version
|
|
345
|
+
* @returns Path to the created zip file
|
|
346
|
+
*/
|
|
347
|
+
export async function createPlaceRecordPackageZip(tempDir, name, version) {
|
|
348
|
+
mkdirSync(tempDir, { recursive: true });
|
|
349
|
+
const orders = e3.record('orders', OrdersType, new Map());
|
|
350
|
+
const seed = e3.mutation.reduce('seed', orders, East.function([OrdersType, IntegerType], OrdersType, ($, _state, count) => {
|
|
351
|
+
const statuses = $.const(['open', 'late', 'done', 'held'], ArrayType(StringType));
|
|
352
|
+
const names = $.const(['Ash', 'Birch', 'Cedar', 'Fir'], ArrayType(StringType));
|
|
353
|
+
const from = $.const(ORDERS_FROM, DateTimeType);
|
|
354
|
+
const out = $.let(new Map(), OrdersType);
|
|
355
|
+
$.for(East.Array.range(0n, count), ($, i) => {
|
|
356
|
+
const tags = $.let(new Set(), SetType(StringType));
|
|
357
|
+
$(tags.tryInsert(East.str `t${i.remainder(5n)}`));
|
|
358
|
+
$(tags.tryInsert(East.str `t${i.remainder(7n)}`));
|
|
359
|
+
const start = $.let(from.addHours(i.remainder(97n)));
|
|
360
|
+
const end = $.let(start.addHours(i.remainder(5n)));
|
|
361
|
+
$.if(East.equal(i.remainder(13n), 0n), ($) => {
|
|
362
|
+
$.assign(end, start.addDays(30n));
|
|
363
|
+
});
|
|
364
|
+
$(out.insert(East.str `order-${i}`, {
|
|
365
|
+
status: statuses.get(i.remainder(4n)),
|
|
366
|
+
name: East.str `${names.get(i.divide(3n).remainder(4n))} ${i}`,
|
|
367
|
+
due: i.multiply(7919n).remainder(count),
|
|
368
|
+
tags,
|
|
369
|
+
start,
|
|
370
|
+
end,
|
|
371
|
+
}));
|
|
372
|
+
});
|
|
373
|
+
return out;
|
|
374
|
+
}));
|
|
375
|
+
const byStatus = e3.recordIndex('orders_by_status', orders, { on: ['status'] });
|
|
376
|
+
const byName = e3.recordIndex('orders_by_name', orders, { on: ['name'] });
|
|
377
|
+
const byDue = e3.recordIndex('orders_by_due', orders, { on: ['due'] });
|
|
378
|
+
const byTag = e3.recordIndex('orders_by_tag', orders, { on: ['tags'] });
|
|
379
|
+
const byTime = e3.recordIndex.interval('orders_by_time', orders, { from: 'start', to: 'end' });
|
|
380
|
+
const pkg = e3.package(name, version, orders, seed, byStatus, byName, byDue, byTag, byTime);
|
|
381
|
+
const zipPath = join(tempDir, `${name}-${version}.zip`);
|
|
382
|
+
await e3.export(pkg, zipPath);
|
|
383
|
+
return zipPath;
|
|
384
|
+
}
|
|
385
|
+
/** When the series fixture's first job may start: midnight UTC on Monday 5 October 2026, a week's start. */
|
|
386
|
+
export const JOBS_FROM = new Date(Date.UTC(2026, 9, 5));
|
|
387
|
+
/** The row of the series fixture's record: a print job's press, when it runs, and its title. */
|
|
388
|
+
export const JobRowType = StructType({ press: StringType, start: DateTimeType, end: DateTimeType, title: StringType });
|
|
389
|
+
/** The series fixture's record: jobs by key. */
|
|
390
|
+
export const JobsType = DictType(StringType, JobRowType);
|
|
391
|
+
/** The key of the series fixture's two indexes: a week's start, then a press. */
|
|
392
|
+
export const JobWeekPressKeyType = StructType({ __tile: DateTimeType, press: StringType });
|
|
393
|
+
/**
|
|
394
|
+
* Create a package whose record is read in two dimensions (#1039): a block of
|
|
395
|
+
* presses over a span of weeks, through a series index from the index alone,
|
|
396
|
+
* and, zoomed out, through a summary index's totals.
|
|
397
|
+
*
|
|
398
|
+
* Creates a package with:
|
|
399
|
+
* - Record: "jobs" (Dict<String, {press, start, end, title}>, empty), its patch
|
|
400
|
+
* door, and Mutation "seed" (count) => `count` jobs keyed `job-<i>`: on one of
|
|
401
|
+
* forty presses (`P-1001`…`P-1040`, by `i` mod 40), starting `i` × 7 mod 1,680
|
|
402
|
+
* hours after {@link JOBS_FROM} — over ten weeks — and running `i` mod 50 + 1
|
|
403
|
+
* hours, so many run into the next week
|
|
404
|
+
* - Index: "jobs_by_press_week", each job under each week it touches and its
|
|
405
|
+
* press, carrying its row; and "jobs_by_press_week_totals", how many jobs
|
|
406
|
+
* touch each week on each press and the time of it they cover. Both are keyed
|
|
407
|
+
* {@link JobWeekPressKeyType}
|
|
408
|
+
*
|
|
409
|
+
* @param tempDir - Directory to write the zip file
|
|
410
|
+
* @param name - Package name
|
|
411
|
+
* @param version - Package version
|
|
412
|
+
* @returns Path to the created zip file
|
|
413
|
+
*/
|
|
414
|
+
export async function createSeriesRecordPackageZip(tempDir, name, version) {
|
|
415
|
+
mkdirSync(tempDir, { recursive: true });
|
|
416
|
+
const jobs = e3.record('jobs', JobsType, new Map());
|
|
417
|
+
const seed = e3.mutation.reduce('seed', jobs, East.function([JobsType, IntegerType], JobsType, ($, _state, count) => {
|
|
418
|
+
const from = $.const(JOBS_FROM, DateTimeType);
|
|
419
|
+
const out = $.let(new Map(), JobsType);
|
|
420
|
+
$.for(East.Array.range(0n, count), ($, i) => {
|
|
421
|
+
const start = $.let(from.addHours(i.multiply(7n).remainder(1680n)));
|
|
422
|
+
const end = $.let(start.addHours(i.remainder(50n).add(1n)));
|
|
423
|
+
$(out.insert(East.str `job-${i}`, { press: East.str `P-${i.remainder(40n).add(1001n)}`, start, end, title: East.str `Job ${i}` }));
|
|
424
|
+
});
|
|
425
|
+
return out;
|
|
426
|
+
}));
|
|
427
|
+
const byPressWeek = e3.recordIndex.series('jobs_by_press_week', jobs, { key: 'press', from: 'start', to: 'end', tile: 'week' });
|
|
428
|
+
const totals = e3.recordIndex.summary('jobs_by_press_week_totals', jobs, { key: 'press', from: 'start', to: 'end', tile: 'week' });
|
|
429
|
+
const pkg = e3.package(name, version, jobs, seed, e3.mutation.patch(jobs), byPressWeek, totals);
|
|
430
|
+
const zipPath = join(tempDir, `${name}-${version}.zip`);
|
|
431
|
+
await e3.export(pkg, zipPath);
|
|
432
|
+
return zipPath;
|
|
433
|
+
}
|
|
178
434
|
/** A row of the migration fixture's record before its migration. */
|
|
179
435
|
export const TaskRowV1Type = StructType({ title: StringType });
|
|
180
436
|
/** A row after it, which gives each row an owner. */
|