@elaraai/east 1.0.83 → 1.0.85
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/analyze.d.ts.map +1 -1
- package/dist/src/analyze.js +48 -0
- package/dist/src/analyze.js.map +1 -1
- package/dist/src/ast_to_ir.coerce_to.spec.js +4 -4
- package/dist/src/ast_to_ir.coerce_to.spec.js.map +1 -1
- package/dist/src/ast_to_ir.d.ts +6 -1
- package/dist/src/ast_to_ir.d.ts.map +1 -1
- package/dist/src/ast_to_ir.js +20 -7
- package/dist/src/ast_to_ir.js.map +1 -1
- package/dist/src/builtins.d.ts +1 -1
- package/dist/src/builtins.d.ts.map +1 -1
- package/dist/src/builtins.js +52 -0
- package/dist/src/builtins.js.map +1 -1
- package/dist/src/codegen/canonical.d.ts +37 -0
- package/dist/src/codegen/canonical.d.ts.map +1 -0
- package/dist/src/codegen/canonical.js +208 -0
- package/dist/src/codegen/canonical.js.map +1 -0
- package/dist/src/codegen/codegen.spec.js +132 -201
- package/dist/src/codegen/codegen.spec.js.map +1 -1
- package/dist/src/codegen/printer.d.ts.map +1 -1
- package/dist/src/codegen/printer.js +142 -24
- package/dist/src/codegen/printer.js.map +1 -1
- package/dist/src/codegen/spellings.d.ts +4 -1
- package/dist/src/codegen/spellings.d.ts.map +1 -1
- package/dist/src/codegen/spellings.js +5 -1
- package/dist/src/codegen/spellings.js.map +1 -1
- package/dist/src/compile/builtins/index.d.ts.map +1 -1
- package/dist/src/compile/builtins/index.js +2 -0
- package/dist/src/compile/builtins/index.js.map +1 -1
- package/dist/src/compile/builtins/primitives.d.ts.map +1 -1
- package/dist/src/compile/builtins/primitives.js +2 -1
- package/dist/src/compile/builtins/primitives.js.map +1 -1
- package/dist/src/compile/builtins/query.d.ts +10 -0
- package/dist/src/compile/builtins/query.d.ts.map +1 -0
- package/dist/src/compile/builtins/query.js +5 -0
- package/dist/src/compile/builtins/query.js.map +1 -0
- package/dist/src/expr/block.d.ts.map +1 -1
- package/dist/src/expr/block.js +2 -1
- package/dist/src/expr/block.js.map +1 -1
- package/dist/src/expr/index.d.ts +75 -47
- package/dist/src/expr/index.d.ts.map +1 -1
- package/dist/src/expr/index.js +31 -0
- package/dist/src/expr/index.js.map +1 -1
- package/dist/src/expr/libs/datetime.d.ts +20 -20
- package/dist/src/expr/libs/datetime.d.ts.map +1 -1
- package/dist/src/expr/libs/datetime.js +208 -167
- package/dist/src/expr/libs/datetime.js.map +1 -1
- package/dist/src/expr/libs/float.d.ts +15 -15
- package/dist/src/expr/libs/float.d.ts.map +1 -1
- package/dist/src/expr/libs/float.js +298 -267
- package/dist/src/expr/libs/float.js.map +1 -1
- package/dist/src/expr/libs/integer.d.ts +12 -12
- package/dist/src/expr/libs/integer.d.ts.map +1 -1
- package/dist/src/expr/libs/integer.js +219 -194
- package/dist/src/expr/libs/integer.js.map +1 -1
- package/dist/src/expr/libs/lazy.d.ts +28 -0
- package/dist/src/expr/libs/lazy.d.ts.map +1 -0
- package/dist/src/expr/libs/lazy.js +55 -0
- package/dist/src/expr/libs/lazy.js.map +1 -0
- package/dist/src/expr/libs/lazy.spec.d.ts +6 -0
- package/dist/src/expr/libs/lazy.spec.d.ts.map +1 -0
- package/dist/src/expr/libs/lazy.spec.js +102 -0
- package/dist/src/expr/libs/lazy.spec.js.map +1 -0
- package/dist/src/expr/query.d.ts +60 -0
- package/dist/src/expr/query.d.ts.map +1 -0
- package/dist/src/expr/query.js +84 -0
- package/dist/src/expr/query.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +4 -0
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +9 -0
- package/dist/src/internal.js.map +1 -1
- package/dist/src/location.d.ts +22 -0
- package/dist/src/location.d.ts.map +1 -1
- package/dist/src/location.js +31 -0
- package/dist/src/location.js.map +1 -1
- package/dist/src/naming.d.ts +12 -7
- package/dist/src/naming.d.ts.map +1 -1
- package/dist/src/naming.js +30 -13
- package/dist/src/naming.js.map +1 -1
- package/dist/src/naming.spec.js +49 -0
- package/dist/src/naming.spec.js.map +1 -1
- package/dist/src/portable.spec.d.ts +6 -0
- package/dist/src/portable.spec.d.ts.map +1 -0
- package/dist/src/portable.spec.js +181 -0
- package/dist/src/portable.spec.js.map +1 -0
- package/dist/src/query/evaluate.d.ts +98 -0
- package/dist/src/query/evaluate.d.ts.map +1 -0
- package/dist/src/query/evaluate.js +193 -0
- package/dist/src/query/evaluate.js.map +1 -0
- package/dist/src/query/index.d.ts +17 -0
- package/dist/src/query/index.d.ts.map +1 -0
- package/dist/src/query/index.js +17 -0
- package/dist/src/query/index.js.map +1 -0
- package/dist/src/query/jq/catalog.d.ts +174 -0
- package/dist/src/query/jq/catalog.d.ts.map +1 -0
- package/dist/src/query/jq/catalog.js +1740 -0
- package/dist/src/query/jq/catalog.js.map +1 -0
- package/dist/src/query/jq/check.d.ts +210 -0
- package/dist/src/query/jq/check.d.ts.map +1 -0
- package/dist/src/query/jq/check.js +2261 -0
- package/dist/src/query/jq/check.js.map +1 -0
- package/dist/src/query/jq/complete.d.ts +89 -0
- package/dist/src/query/jq/complete.d.ts.map +1 -0
- package/dist/src/query/jq/complete.js +320 -0
- package/dist/src/query/jq/complete.js.map +1 -0
- package/dist/src/query/jq/describe.d.ts +53 -0
- package/dist/src/query/jq/describe.d.ts.map +1 -0
- package/dist/src/query/jq/describe.js +149 -0
- package/dist/src/query/jq/describe.js.map +1 -0
- package/dist/src/query/jq/lex.d.ts +118 -0
- package/dist/src/query/jq/lex.d.ts.map +1 -0
- package/dist/src/query/jq/lex.js +371 -0
- package/dist/src/query/jq/lex.js.map +1 -0
- package/dist/src/query/jq/literals.d.ts +49 -0
- package/dist/src/query/jq/literals.d.ts.map +1 -0
- package/dist/src/query/jq/literals.js +78 -0
- package/dist/src/query/jq/literals.js.map +1 -0
- package/dist/src/query/jq/messages.d.ts +126 -0
- package/dist/src/query/jq/messages.d.ts.map +1 -0
- package/dist/src/query/jq/messages.js +172 -0
- package/dist/src/query/jq/messages.js.map +1 -0
- package/dist/src/query/jq/parse.d.ts +70 -0
- package/dist/src/query/jq/parse.d.ts.map +1 -0
- package/dist/src/query/jq/parse.js +1013 -0
- package/dist/src/query/jq/parse.js.map +1 -0
- package/dist/src/query/jq/print.d.ts +59 -0
- package/dist/src/query/jq/print.d.ts.map +1 -0
- package/dist/src/query/jq/print.js +587 -0
- package/dist/src/query/jq/print.js.map +1 -0
- package/dist/src/query/jq/shapes.d.ts +345 -0
- package/dist/src/query/jq/shapes.d.ts.map +1 -0
- package/dist/src/query/jq/shapes.js +584 -0
- package/dist/src/query/jq/shapes.js.map +1 -0
- package/dist/src/query/jq/spans.d.ts +133 -0
- package/dist/src/query/jq/spans.d.ts.map +1 -0
- package/dist/src/query/jq/spans.js +195 -0
- package/dist/src/query/jq/spans.js.map +1 -0
- package/dist/src/query/jq/split.d.ts +334 -0
- package/dist/src/query/jq/split.d.ts.map +1 -0
- package/dist/src/query/jq/split.js +2108 -0
- package/dist/src/query/jq/split.js.map +1 -0
- package/dist/src/query/jq/strftime.d.ts +20 -0
- package/dist/src/query/jq/strftime.d.ts.map +1 -0
- package/dist/src/query/jq/strftime.js +65 -0
- package/dist/src/query/jq/strftime.js.map +1 -0
- package/dist/src/query/jq/summary.d.ts +139 -0
- package/dist/src/query/jq/summary.d.ts.map +1 -0
- package/dist/src/query/jq/summary.js +222 -0
- package/dist/src/query/jq/summary.js.map +1 -0
- package/dist/src/query/jq/translate-builtins.d.ts +21 -0
- package/dist/src/query/jq/translate-builtins.d.ts.map +1 -0
- package/dist/src/query/jq/translate-builtins.js +1873 -0
- package/dist/src/query/jq/translate-builtins.js.map +1 -0
- package/dist/src/query/jq/translate.d.ts +627 -0
- package/dist/src/query/jq/translate.d.ts.map +1 -0
- package/dist/src/query/jq/translate.js +3364 -0
- package/dist/src/query/jq/translate.js.map +1 -0
- package/dist/src/query/types.d.ts +505 -0
- package/dist/src/query/types.d.ts.map +1 -0
- package/dist/src/query/types.js +231 -0
- package/dist/src/query/types.js.map +1 -0
- package/dist/src/runner_exec.d.ts +134 -0
- package/dist/src/runner_exec.d.ts.map +1 -0
- package/dist/src/runner_exec.js +371 -0
- package/dist/src/runner_exec.js.map +1 -0
- package/dist/src/runner_exec.spec.d.ts +6 -0
- package/dist/src/runner_exec.spec.d.ts.map +1 -0
- package/dist/src/runner_exec.spec.js +198 -0
- package/dist/src/runner_exec.spec.js.map +1 -0
- package/dist/src/runner_io.d.ts +370 -0
- package/dist/src/runner_io.d.ts.map +1 -0
- package/dist/src/runner_io.js +563 -0
- package/dist/src/runner_io.js.map +1 -0
- package/dist/src/runner_io.spec.d.ts +6 -0
- package/dist/src/runner_io.spec.d.ts.map +1 -0
- package/dist/src/runner_io.spec.js +224 -0
- package/dist/src/runner_io.spec.js.map +1 -0
- package/dist/src/runner_merge.d.ts +95 -0
- package/dist/src/runner_merge.d.ts.map +1 -0
- package/dist/src/runner_merge.js +238 -0
- package/dist/src/runner_merge.js.map +1 -0
- package/dist/src/runner_protocol.d.ts +60 -6
- package/dist/src/runner_protocol.d.ts.map +1 -1
- package/dist/src/runner_protocol.js +48 -6
- package/dist/src/runner_protocol.js.map +1 -1
- package/dist/src/serialization/beast2/index.d.ts +2 -2
- package/dist/src/serialization/beast2/index.d.ts.map +1 -1
- package/dist/src/serialization/beast2/index.js +1 -1
- package/dist/src/serialization/beast2/index.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.d.ts +10 -6
- package/dist/src/serialization/beast2/v5/frames.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.js +10 -6
- package/dist/src/serialization/beast2/v5/frames.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/frames.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/frames.spec.js +42 -0
- package/dist/src/serialization/beast2/v5/frames.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/index.spec.js +108 -0
- package/dist/src/serialization/beast2/v5/index.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.d.ts +74 -7
- package/dist/src/serialization/beast2/v5/lazy.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.js +129 -27
- package/dist/src/serialization/beast2/v5/lazy.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.spec.js +251 -16
- package/dist/src/serialization/beast2/v5/lazy.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.d.ts +139 -23
- package/dist/src/serialization/beast2/v5/stream.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.js +196 -44
- package/dist/src/serialization/beast2/v5/stream.js.map +1 -1
- package/dist/src/serialization/beast2/v5/type-section.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/type-section.js +25 -12
- package/dist/src/serialization/beast2/v5/type-section.js.map +1 -1
- package/dist/src/serialization/beast2/v5/type-section.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/type-section.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/type-section.spec.js +41 -0
- package/dist/src/serialization/beast2/v5/type-section.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/weight.d.ts +36 -0
- package/dist/src/serialization/beast2/v5/weight.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/weight.js +238 -0
- package/dist/src/serialization/beast2/v5/weight.js.map +1 -0
- package/dist/src/serialization/crc32.d.ts +38 -0
- package/dist/src/serialization/crc32.d.ts.map +1 -0
- package/dist/src/serialization/crc32.js +70 -0
- package/dist/src/serialization/crc32.js.map +1 -0
- package/dist/src/serialization/crc32.spec.d.ts +6 -0
- package/dist/src/serialization/crc32.spec.d.ts.map +1 -0
- package/dist/src/serialization/crc32.spec.js +92 -0
- package/dist/src/serialization/crc32.spec.js.map +1 -0
- package/dist/src/serialization/east-inferred.spec.js +4 -0
- package/dist/src/serialization/east-inferred.spec.js.map +1 -1
- package/dist/src/serialization/east.d.ts.map +1 -1
- package/dist/src/serialization/east.js +134 -110
- package/dist/src/serialization/east.js.map +1 -1
- package/dist/src/serialization/east.spec.js +185 -4
- package/dist/src/serialization/east.spec.js.map +1 -1
- package/dist/src/serialization/east_text.d.ts +25 -0
- package/dist/src/serialization/east_text.d.ts.map +1 -0
- package/dist/src/serialization/east_text.js +29 -0
- package/dist/src/serialization/east_text.js.map +1 -0
- package/dist/src/serialization/index.d.ts +1 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/serialization/index.js +1 -1
- package/dist/src/serialization/index.js.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +7 -6
- package/dist/src/types.js.map +1 -1
- package/package.json +7 -4
|
@@ -19,7 +19,16 @@
|
|
|
19
19
|
*
|
|
20
20
|
* The types live here, beside the collection layer, because every runner and
|
|
21
21
|
* the platform that schedules them read them; east-c declares the same types
|
|
22
|
-
* in C, and the conformance corpus pins that all three runners agree.
|
|
22
|
+
* in C, and the conformance corpus pins that all three runners agree. The
|
|
23
|
+
* TypeScript runner is `executeUnit` (`runner_exec.ts`), which does a unit's
|
|
24
|
+
* work over whatever holds its files (`UnitIO`): east-node's `exec` is its
|
|
25
|
+
* file wrapper, and a browser runs it over the files in memory.
|
|
26
|
+
*
|
|
27
|
+
* A run unit says how its collection inputs are read (`decode`): lazily, a
|
|
28
|
+
* segment at a time as the program reads them, or decoded whole before it
|
|
29
|
+
* runs. A runner's `run` command takes the same choice as `--decode`, lazy
|
|
30
|
+
* unless it says `whole`, so a program reads its inputs the same way whichever
|
|
31
|
+
* runner, and whichever command, runs it.
|
|
23
32
|
*
|
|
24
33
|
* A collection a unit reads is staged as its manifest and the manifest's
|
|
25
34
|
* segments beside it, `<file>.segments/<hash>.beast2`. A host whose store is
|
|
@@ -27,8 +36,11 @@
|
|
|
27
36
|
* reads it, so a unit downloads what it reads: the unit says so (`fetch`). Its
|
|
28
37
|
* runner then asks for a staged manifest's segment file it finds absent, by
|
|
29
38
|
* creating `<segment file>.want` beside where it would be, and waits for the
|
|
30
|
-
* host to place the file
|
|
31
|
-
*
|
|
39
|
+
* host to place the file or to write `<segment file>.error`, holding why it
|
|
40
|
+
* cannot, which the runner fails with. The host writes either whole — under a
|
|
41
|
+
* name of its own, renamed into place — since the runner reads each the moment
|
|
42
|
+
* it is there, and a file it finds half-written it reads as such. A unit that
|
|
43
|
+
* does not say so reads
|
|
32
44
|
* an absent segment as the input's own error, at once. Such a unit and the
|
|
33
45
|
* files beside it are a snapshot of the work only once its segments are there.
|
|
34
46
|
*/
|
|
@@ -79,10 +91,35 @@ export declare const UnitOutputType: VariantType<{
|
|
|
79
91
|
}>;
|
|
80
92
|
export type UnitOutputType = typeof UnitOutputType;
|
|
81
93
|
export type UnitOutput = ValueTypeOf<typeof UnitOutputType>;
|
|
94
|
+
/**
|
|
95
|
+
* How a run unit's collection inputs are read.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* `lazy` opens each Array, Set and Dict input over its file and decodes a
|
|
99
|
+
* segment at a time as the program reads it: its size, a keyed read and the
|
|
100
|
+
* `$.for` loop decode only the segments they reach, and an operation the
|
|
101
|
+
* runner cannot serve so decodes the input whole, once, when it first needs
|
|
102
|
+
* it. `whole` decodes every input before the program runs, which suits a
|
|
103
|
+
* program that reads most of an input at random: lazily, a runner keeps only
|
|
104
|
+
* the segments it decoded last, and a read beyond them decodes its segment
|
|
105
|
+
* again. A value that is not a collection, and a collection whose elements
|
|
106
|
+
* hold a Ref or a function, is decoded whole either way. The program's result
|
|
107
|
+
* is the same either way: only the memory and the time it takes differ.
|
|
108
|
+
*/
|
|
109
|
+
export declare const UnitDecodeType: VariantType<{
|
|
110
|
+
/** Each collection input opened over its file, a segment decoded as the
|
|
111
|
+
* program reaches it. */
|
|
112
|
+
readonly lazy: NullType;
|
|
113
|
+
/** Every input decoded whole before the program runs. */
|
|
114
|
+
readonly whole: NullType;
|
|
115
|
+
}>;
|
|
116
|
+
export type UnitDecodeType = typeof UnitDecodeType;
|
|
117
|
+
export type UnitDecode = ValueTypeOf<typeof UnitDecodeType>;
|
|
82
118
|
/** What a unit does. */
|
|
83
119
|
export declare const UnitWorkType: VariantType<{
|
|
84
120
|
/** Evaluate `program`, an IR file, on `inputs`, one file per parameter —
|
|
85
|
-
* a blob or a manifest directory —
|
|
121
|
+
* a blob or a manifest directory — read as `decode` says, and write
|
|
122
|
+
* `output`. */
|
|
86
123
|
readonly run: StructType<{
|
|
87
124
|
readonly program: StringType;
|
|
88
125
|
readonly inputs: ArrayType<StringType>;
|
|
@@ -113,6 +150,13 @@ export declare const UnitWorkType: VariantType<{
|
|
|
113
150
|
readonly combine: StringType;
|
|
114
151
|
}>;
|
|
115
152
|
}>;
|
|
153
|
+
readonly decode: VariantType<{
|
|
154
|
+
/** Each collection input opened over its file, a segment decoded as the
|
|
155
|
+
* program reaches it. */
|
|
156
|
+
readonly lazy: NullType;
|
|
157
|
+
/** Every input decoded whole before the program runs. */
|
|
158
|
+
readonly whole: NullType;
|
|
159
|
+
}>;
|
|
116
160
|
}>;
|
|
117
161
|
/**
|
|
118
162
|
* Assemble `parts` of one output kind into one: sorted set or dict runs
|
|
@@ -185,6 +229,7 @@ export type UnitWork = ValueTypeOf<typeof UnitWorkType>;
|
|
|
185
229
|
* program: "program.beast2",
|
|
186
230
|
* inputs: ["sales.beast2"],
|
|
187
231
|
* output: variant("dict", { dir: "out", merge: some("add.beast2") }),
|
|
232
|
+
* decode: variant("lazy", null),
|
|
188
233
|
* }),
|
|
189
234
|
* platforms: [],
|
|
190
235
|
* threads: 1n,
|
|
@@ -199,7 +244,8 @@ export declare const UnitType: StructType<{
|
|
|
199
244
|
/** The work. */
|
|
200
245
|
readonly work: VariantType<{
|
|
201
246
|
/** Evaluate `program`, an IR file, on `inputs`, one file per parameter —
|
|
202
|
-
* a blob or a manifest directory —
|
|
247
|
+
* a blob or a manifest directory — read as `decode` says, and write
|
|
248
|
+
* `output`. */
|
|
203
249
|
readonly run: StructType<{
|
|
204
250
|
readonly program: StringType;
|
|
205
251
|
readonly inputs: ArrayType<StringType>;
|
|
@@ -230,6 +276,13 @@ export declare const UnitType: StructType<{
|
|
|
230
276
|
readonly combine: StringType;
|
|
231
277
|
}>;
|
|
232
278
|
}>;
|
|
279
|
+
readonly decode: VariantType<{
|
|
280
|
+
/** Each collection input opened over its file, a segment decoded as the
|
|
281
|
+
* program reaches it. */
|
|
282
|
+
readonly lazy: NullType;
|
|
283
|
+
/** Every input decoded whole before the program runs. */
|
|
284
|
+
readonly whole: NullType;
|
|
285
|
+
}>;
|
|
233
286
|
}>;
|
|
234
287
|
/**
|
|
235
288
|
* Assemble `parts` of one output kind into one: sorted set or dict runs
|
|
@@ -362,7 +415,8 @@ export declare const UnitResultType: StructType<{
|
|
|
362
415
|
}>;
|
|
363
416
|
}>;
|
|
364
417
|
/** The process's peak resident memory: VmHWM on Linux, `ru_maxrss`
|
|
365
|
-
* elsewhere
|
|
418
|
+
* elsewhere; 0 from a host that does not measure memory, as a browser
|
|
419
|
+
* does not. */
|
|
366
420
|
readonly peakBytes: IntegerType;
|
|
367
421
|
/** Where the time went. */
|
|
368
422
|
readonly timings: StructType<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner_protocol.d.ts","sourceRoot":"","sources":["../../src/runner_protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"runner_protocol.d.ts","sourceRoot":"","sources":["../../src/runner_protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,WA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here, beside the collection layer, because every runner and
|
|
21
21
|
* the platform that schedules them read them; east-c declares the same types
|
|
22
|
-
* in C, and the conformance corpus pins that all three runners agree.
|
|
22
|
+
* in C, and the conformance corpus pins that all three runners agree. The
|
|
23
|
+
* TypeScript runner is `executeUnit` (`runner_exec.ts`), which does a unit's
|
|
24
|
+
* work over whatever holds its files (`UnitIO`): east-node's `exec` is its
|
|
25
|
+
* file wrapper, and a browser runs it over the files in memory.
|
|
26
|
+
*
|
|
27
|
+
* A run unit says how its collection inputs are read (`decode`): lazily, a
|
|
28
|
+
* segment at a time as the program reads them, or decoded whole before it
|
|
29
|
+
* runs. A runner's `run` command takes the same choice as `--decode`, lazy
|
|
30
|
+
* unless it says `whole`, so a program reads its inputs the same way whichever
|
|
31
|
+
* runner, and whichever command, runs it.
|
|
23
32
|
*
|
|
24
33
|
* A collection a unit reads is staged as its manifest and the manifest's
|
|
25
34
|
* segments beside it, `<file>.segments/<hash>.beast2`. A host whose store is
|
|
@@ -27,8 +36,11 @@
|
|
|
27
36
|
* reads it, so a unit downloads what it reads: the unit says so (`fetch`). Its
|
|
28
37
|
* runner then asks for a staged manifest's segment file it finds absent, by
|
|
29
38
|
* creating `<segment file>.want` beside where it would be, and waits for the
|
|
30
|
-
* host to place the file
|
|
31
|
-
*
|
|
39
|
+
* host to place the file or to write `<segment file>.error`, holding why it
|
|
40
|
+
* cannot, which the runner fails with. The host writes either whole — under a
|
|
41
|
+
* name of its own, renamed into place — since the runner reads each the moment
|
|
42
|
+
* it is there, and a file it finds half-written it reads as such. A unit that
|
|
43
|
+
* does not say so reads
|
|
32
44
|
* an absent segment as the input's own error, at once. Such a unit and the
|
|
33
45
|
* files beside it are a snapshot of the work only once its segments are there.
|
|
34
46
|
*/
|
|
@@ -71,11 +83,39 @@ export const UnitOutputType = VariantType({
|
|
|
71
83
|
* written to `path` as a `value` is. */
|
|
72
84
|
fold: StructType({ path: StringType, zero: StringType, combine: StringType }),
|
|
73
85
|
});
|
|
86
|
+
/**
|
|
87
|
+
* How a run unit's collection inputs are read.
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* `lazy` opens each Array, Set and Dict input over its file and decodes a
|
|
91
|
+
* segment at a time as the program reads it: its size, a keyed read and the
|
|
92
|
+
* `$.for` loop decode only the segments they reach, and an operation the
|
|
93
|
+
* runner cannot serve so decodes the input whole, once, when it first needs
|
|
94
|
+
* it. `whole` decodes every input before the program runs, which suits a
|
|
95
|
+
* program that reads most of an input at random: lazily, a runner keeps only
|
|
96
|
+
* the segments it decoded last, and a read beyond them decodes its segment
|
|
97
|
+
* again. A value that is not a collection, and a collection whose elements
|
|
98
|
+
* hold a Ref or a function, is decoded whole either way. The program's result
|
|
99
|
+
* is the same either way: only the memory and the time it takes differ.
|
|
100
|
+
*/
|
|
101
|
+
export const UnitDecodeType = VariantType({
|
|
102
|
+
/** Each collection input opened over its file, a segment decoded as the
|
|
103
|
+
* program reaches it. */
|
|
104
|
+
lazy: NullType,
|
|
105
|
+
/** Every input decoded whole before the program runs. */
|
|
106
|
+
whole: NullType,
|
|
107
|
+
});
|
|
74
108
|
/** What a unit does. */
|
|
75
109
|
export const UnitWorkType = VariantType({
|
|
76
110
|
/** Evaluate `program`, an IR file, on `inputs`, one file per parameter —
|
|
77
|
-
* a blob or a manifest directory —
|
|
78
|
-
|
|
111
|
+
* a blob or a manifest directory — read as `decode` says, and write
|
|
112
|
+
* `output`. */
|
|
113
|
+
run: StructType({
|
|
114
|
+
program: StringType,
|
|
115
|
+
inputs: ArrayType(StringType),
|
|
116
|
+
output: UnitOutputType,
|
|
117
|
+
decode: UnitDecodeType,
|
|
118
|
+
}),
|
|
79
119
|
/**
|
|
80
120
|
* Assemble `parts` of one output kind into one: sorted set or dict runs
|
|
81
121
|
* merged into one run, `<dir>/0.beast2`, with a key that several parts hold
|
|
@@ -112,6 +152,7 @@ export const UnitWorkType = VariantType({
|
|
|
112
152
|
* program: "program.beast2",
|
|
113
153
|
* inputs: ["sales.beast2"],
|
|
114
154
|
* output: variant("dict", { dir: "out", merge: some("add.beast2") }),
|
|
155
|
+
* decode: variant("lazy", null),
|
|
115
156
|
* }),
|
|
116
157
|
* platforms: [],
|
|
117
158
|
* threads: 1n,
|
|
@@ -170,7 +211,8 @@ export const UnitResultType = StructType({
|
|
|
170
211
|
/** How the unit ended. */
|
|
171
212
|
outcome: UnitOutcomeType,
|
|
172
213
|
/** The process's peak resident memory: VmHWM on Linux, `ru_maxrss`
|
|
173
|
-
* elsewhere
|
|
214
|
+
* elsewhere; 0 from a host that does not measure memory, as a browser
|
|
215
|
+
* does not. */
|
|
174
216
|
peakBytes: IntegerType,
|
|
175
217
|
/** Where the time went. */
|
|
176
218
|
timings: UnitTimingsType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner_protocol.js","sourceRoot":"","sources":["../../src/runner_protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"runner_protocol.js","sourceRoot":"","sources":["../../src/runner_protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAoB,MAAM,YAAY,CAAC;AACzJ,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;IACxC;sDACkD;IAClD,KAAK,EAAE,UAAU;IACjB;sCACkC;IAClC,KAAK,EAAE,UAAU;IACjB;;6DAEyD;IACzD,GAAG,EAAE,UAAU;IACf;;mEAE+D;IAC/D,IAAI,EAAE,UAAU,CAAC,EAAE,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C;IAChC;yBACqB;IACrB,OAAO,EAAE,WAAW;IACpB;;6EAEyE;IACzE,KAAK,EAAE,WAAW;IAClB,0DAA0D;IAC1D,MAAM,EAAE,UAAU;CACnB,CAAC,CAAC;AAIH,wBAAwB;AACxB,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;IACzC,gCAAgC;IAChC,EAAE,EAAE,QAAQ;IACZ;;mBAEe;IACf,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;CAChF,CAAC,CAAC;AAIH,iDAAiD;AACjD,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,yDAAyD;IACzD,IAAI,EAAE,SAAS;IACf,qEAAqE;IACrE,OAAO,EAAE,SAAS;IAClB,iDAAiD;IACjD,OAAO,EAAE,SAAS;IAClB,4BAA4B;IAC5B,MAAM,EAAE,SAAS;CAClB,CAAC,CAAC;AAIH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,0BAA0B;IAC1B,OAAO,EAAE,eAAe;IACxB;;oBAEgB;IAChB,SAAS,EAAE,WAAW;IACtB,2BAA2B;IAC3B,OAAO,EAAE,eAAe;CACzB,CAAC,CAAC"}
|
|
@@ -23,9 +23,9 @@ export { MAGIC_BYTES } from "./v4/container.js";
|
|
|
23
23
|
export { MAGIC_BYTES_V5 } from "./v5/codec.js";
|
|
24
24
|
export type { Beast2DecodeOptions } from "./shared.js";
|
|
25
25
|
export type { Beast2Codec } from "./v5/frames.js";
|
|
26
|
-
export { Beast2Writer, type Beast2WriterOptions, Beast2ElementWriter, type Beast2ElementWriterOptions, type Beast2ElementOf, type Beast2Segment, type Beast2SegmentSink, encodeBeast2SegmentsFor, encodeBeast2PagedFor, type Beast2PagedEncodeOptions, iterBeast2SegmentsFor, Beast2Pages, openBeast2PagesFor, } from "./v5/stream.js";
|
|
26
|
+
export { Beast2Writer, type Beast2WriterOptions, Beast2ElementWriter, type Beast2ElementWriterOptions, type Beast2ElementOf, type Beast2Segment, type Beast2SegmentSink, encodeBeast2SegmentsFor, encodeBeast2PagedFor, type Beast2PagedEncodeOptions, iterBeast2SegmentsFor, Beast2Pages, openBeast2PagesFor, type Beast2PagesOptions, type Beast2PagesCacheStats, } from "./v5/stream.js";
|
|
27
27
|
export { type Beast2Extents, readBeast2Extents, readBeast2SegmentLogicalBytes, carveBeast2, spliceBeast2, rebuildBeast2, type RebuildBeast2Options, type Beast2RangeReader, type Beast2SyncRangeReader, type Beast2RangedExtents, type ReadBeast2ExtentsRangedOptions, readBeast2ExtentsRanged, readBeast2ExtentsSync, isBeast2SyncRangeReader, carveBeast2Ranged, spliceBeast2Tail, spliceBeast2Segments, } from "./v5/geometry.js";
|
|
28
|
-
export { openBeast2LazyFor, isBeast2LazySafe, type Beast2LazySafeOptions } from "./v5/lazy.js";
|
|
28
|
+
export { openBeast2LazyFor, isBeast2LazySafe, beast2LazyStats, type Beast2LazySafeOptions, type Beast2LazyOptions, type Beast2LazyStats, } from "./v5/lazy.js";
|
|
29
29
|
export { RUN_MAX_COUNT, RUN_MAX_BYTES, Beast2RunSorter, type Beast2RunSink, type Beast2RunSorterOptions, } from "./v5/runs.js";
|
|
30
30
|
export { mergeBeast2For, type Beast2MergeSource, type Beast2MergeOptions, type Beast2MergeStats, } from "./v5/merge.js";
|
|
31
31
|
export { decodeBeast2ElementsFor } from "./v5/elements.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/serialization/beast2/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAU,KAAK,UAAU,EAAE,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AU,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAQvG;AAiBD,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAErH;AAED,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAExI"}
|
|
@@ -24,7 +24,7 @@ export { MAGIC_BYTES } from "./v4/container.js";
|
|
|
24
24
|
export { MAGIC_BYTES_V5 } from "./v5/codec.js";
|
|
25
25
|
export { Beast2Writer, Beast2ElementWriter, encodeBeast2SegmentsFor, encodeBeast2PagedFor, iterBeast2SegmentsFor, Beast2Pages, openBeast2PagesFor, } from "./v5/stream.js";
|
|
26
26
|
export { readBeast2Extents, readBeast2SegmentLogicalBytes, carveBeast2, spliceBeast2, rebuildBeast2, readBeast2ExtentsRanged, readBeast2ExtentsSync, isBeast2SyncRangeReader, carveBeast2Ranged, spliceBeast2Tail, spliceBeast2Segments, } from "./v5/geometry.js";
|
|
27
|
-
export { openBeast2LazyFor, isBeast2LazySafe } from "./v5/lazy.js";
|
|
27
|
+
export { openBeast2LazyFor, isBeast2LazySafe, beast2LazyStats, } from "./v5/lazy.js";
|
|
28
28
|
export { RUN_MAX_COUNT, RUN_MAX_BYTES, Beast2RunSorter, } from "./v5/runs.js";
|
|
29
29
|
export { mergeBeast2For, } from "./v5/merge.js";
|
|
30
30
|
export { decodeBeast2ElementsFor } from "./v5/elements.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/serialization/beast2/index.ts"],"names":[],"mappings":"AAAA;;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AC;IAC5D,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;+CAC+C;AAC/C,SAAS,qBAAqB,CAAC,IAAgB;IAC7C,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,gFAAgF;AAEhF,MAAM,UAAU,iBAAiB,CAAqB,EAAc,EAAE,QAA4B;IAChG,OAAO,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAsB,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAqB,EAAmB,EAAE,QAA4B;IAC1G,OAAO,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAA+B,CAAC;AAC7E,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,mEAAmE;AACnE,SAAS,WAAW,CAAC,IAA8B;IACjD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAqB,CAAC,CAAC,CAAC,eAAe,CAAC,IAAgB,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -45,14 +45,18 @@ export declare const FRAME_HEADER_MAX = 21;
|
|
|
45
45
|
/** Resolves a codec name to its wire id. */
|
|
46
46
|
export declare function codecId(codec: Beast2Codec): number;
|
|
47
47
|
/**
|
|
48
|
-
* Decompresses a raw DEFLATE
|
|
48
|
+
* Decompresses a raw DEFLATE (RFC 1951) stream synchronously: a frame's
|
|
49
|
+
* payload, or a zip entry's bytes, which e3 reads with it in every runtime.
|
|
49
50
|
*
|
|
50
51
|
* Prefers Node's zlib (native code); without it — browsers — falls back to
|
|
51
|
-
* the portable pure-TS inflate, so synchronous decode works everywhere.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* @
|
|
52
|
+
* the portable pure-TS inflate, so synchronous decode works everywhere. A
|
|
53
|
+
* stream that inflates to no bytes is inflated by the portable decoder too:
|
|
54
|
+
* zlib takes no output limit of zero.
|
|
55
|
+
*
|
|
56
|
+
* @param payload - the raw DEFLATE stream (no zlib header or trailer)
|
|
57
|
+
* @param uncompressedLen - the exact length it inflates to: the logical byte
|
|
58
|
+
* length from a frame header, or a zip entry's size
|
|
59
|
+
* @returns the inflated bytes
|
|
56
60
|
* @throws {Error} When the stream is corrupt or the output length mismatches.
|
|
57
61
|
*/
|
|
58
62
|
export declare function inflateRawSync(payload: Uint8Array, uncompressedLen: number): Uint8Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/frames.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,cAAc,CAAC;AAG5E,kDAAkD;AAClD,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,sEAAsE;AACtE,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,uEAAuE;AACvE,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B,uDAAuD;AACvD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;2EAC2E;AAC3E,eAAO,MAAM,sBAAsB,QAAU,CAAC;AAE9C;;;iEAGiE;AACjE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,4CAA4C;AAC5C,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAElD;A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see a `node:zlib` import. */
|
|
50
50
|
const zlib = globalThis.process?.getBuiltinModule?.("node:zlib") ?? null;
|
|
51
51
|
/**
|
|
52
|
-
* Decompresses a raw DEFLATE
|
|
52
|
+
* Decompresses a raw DEFLATE (RFC 1951) stream synchronously: a frame's
|
|
53
|
+
* payload, or a zip entry's bytes, which e3 reads with it in every runtime.
|
|
53
54
|
*
|
|
54
55
|
* Prefers Node's zlib (native code); without it — browsers — falls back to
|
|
55
|
-
* the portable pure-TS inflate, so synchronous decode works everywhere.
|
|
56
|
+
* the portable pure-TS inflate, so synchronous decode works everywhere. A
|
|
57
|
+
* stream that inflates to no bytes is inflated by the portable decoder too:
|
|
58
|
+
* zlib takes no output limit of zero.
|
|
56
59
|
*
|
|
57
|
-
* @param payload - the
|
|
58
|
-
* @param uncompressedLen - the
|
|
59
|
-
*
|
|
60
|
+
* @param payload - the raw DEFLATE stream (no zlib header or trailer)
|
|
61
|
+
* @param uncompressedLen - the exact length it inflates to: the logical byte
|
|
62
|
+
* length from a frame header, or a zip entry's size
|
|
63
|
+
* @returns the inflated bytes
|
|
60
64
|
* @throws {Error} When the stream is corrupt or the output length mismatches.
|
|
61
65
|
*/
|
|
62
66
|
export function inflateRawSync(payload, uncompressedLen) {
|
|
63
|
-
if (!zlib) {
|
|
67
|
+
if (!zlib || uncompressedLen === 0) {
|
|
64
68
|
return inflateRawPure(payload, uncompressedLen);
|
|
65
69
|
}
|
|
66
70
|
const out = zlib.inflateRawSync(payload, { maxOutputLength: uncompressedLen });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/frames.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAuB,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,c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QACD,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC;IACpB,CAAC;IACD,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE;QAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;QACxB,OAAO,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frames.spec.d.ts","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/frames.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 frame layer's synchronous inflate, which e3 inflates a zip's deflated
|
|
7
|
+
* entries with too: to exactly the length it is told, through Node's zlib or
|
|
8
|
+
* east's own inflate — including a stream of no bytes, which zlib cannot be
|
|
9
|
+
* asked for.
|
|
10
|
+
*/
|
|
11
|
+
import { describe, test } from "node:test";
|
|
12
|
+
import assert from "node:assert/strict";
|
|
13
|
+
import { deflateRawSync, inflateRawSync as zlibInflateRawSync } from "node:zlib";
|
|
14
|
+
import { inflateRawSync } from "./frames.js";
|
|
15
|
+
import { inflateRawPure } from "./inflate.js";
|
|
16
|
+
describe("inflateRawSync", () => {
|
|
17
|
+
test("inflates a stream of no bytes, which zlib takes no output limit for", () => {
|
|
18
|
+
// What a zip writer deflates an empty entry to: one final fixed block.
|
|
19
|
+
const empty = deflateRawSync(new Uint8Array(0));
|
|
20
|
+
assert.deepEqual([...empty], [0x03, 0x00]);
|
|
21
|
+
assert.throws(() => zlibInflateRawSync(empty, { maxOutputLength: 0 }), { code: "ERR_OUT_OF_RANGE" });
|
|
22
|
+
assert.equal(inflateRawSync(empty, 0).byteLength, 0);
|
|
23
|
+
assert.equal(inflateRawPure(empty, 0).byteLength, 0);
|
|
24
|
+
});
|
|
25
|
+
test("refuses a stream of bytes it is told inflates to none, or to more than it holds", () => {
|
|
26
|
+
const deflated = deflateRawSync(new TextEncoder().encode("a zip entry's bytes"));
|
|
27
|
+
assert.throws(() => inflateRawSync(deflated, 0), /past the declared 0 bytes/);
|
|
28
|
+
assert.throws(() => inflateRawSync(deflated, 1000), /inflated to 19 bytes, header declared 1000/);
|
|
29
|
+
assert.throws(() => inflateRawSync(deflateRawSync(new Uint8Array(0)), 1), /inflated to 0 bytes, header declared 1/);
|
|
30
|
+
});
|
|
31
|
+
test("gives zlib's bytes for every kind of block a zip writer deflates", () => {
|
|
32
|
+
const text = new TextEncoder().encode("the same few words, again and again; ".repeat(400));
|
|
33
|
+
const noise = new Uint8Array(70_000).map((_, i) => (i * 2654435761) >>> 24);
|
|
34
|
+
for (const [bytes, level] of [[text, 0], [text, 1], [text, 9], [noise, 6], [new Uint8Array(1), 6]]) {
|
|
35
|
+
const deflated = deflateRawSync(bytes, { level });
|
|
36
|
+
// zlib gives a Buffer: both are compared as plain bytes.
|
|
37
|
+
assert.deepEqual(new Uint8Array(inflateRawSync(deflated, bytes.byteLength)), new Uint8Array(zlibInflateRawSync(deflated)), `level ${level}, ${bytes.byteLength} bytes`);
|
|
38
|
+
assert.deepEqual(inflateRawPure(deflated, bytes.byteLength), bytes, `level ${level}, ${bytes.byteLength} bytes, inflated here`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=frames.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frames.spec.js","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/frames.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,QAA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AC,UAAU,CAAC,EAAE,KAAK,EAAE,SAAS,KAAK,KAAK,KAAK,CAAC,UAAU,uBAAuB,CAAC,CAAC;QAClI,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -547,6 +547,114 @@ describe("Beast2 v5 — Paging", () => {
|
|
|
547
547
|
test("non-collection types are refused by the paged encoder", () => {
|
|
548
548
|
assert.throws(() => encodeBeast2PagedFor(StringType), /Array, Set or Dict/);
|
|
549
549
|
});
|
|
550
|
+
test("a keyed or row read is frozen, so it cannot change what a later read is served (#1129)", () => {
|
|
551
|
+
// The pager keeps the segment a keyed or row read decodes, for the next
|
|
552
|
+
// read into it. That segment is shared, so it decodes frozen whatever the
|
|
553
|
+
// pager was opened with: writing through what one read returned would
|
|
554
|
+
// change what the next read is served.
|
|
555
|
+
const DT = DictType(StringType, ArrayType(IntegerType));
|
|
556
|
+
const pages = openBeast2PagesFor(DT)(encodeBeast2SegmentsFor(DT)([new Map([["a", [1n]], ["b", [2n]]]), new Map([["c", [3n]], ["d", [4n]]])]));
|
|
557
|
+
const a = pages.get("a");
|
|
558
|
+
assert.ok(Object.isFrozen(a), "a keyed read's array is frozen");
|
|
559
|
+
assert.throws(() => a.push(99n), TypeError);
|
|
560
|
+
assert.deepEqual(pages.get("a"), [1n], "the next read is served the segment as written");
|
|
561
|
+
// A scan's segment is decoded fresh, and is the caller's own.
|
|
562
|
+
const scanned = pages.segmentDisjoint(1);
|
|
563
|
+
assert.ok(!Object.isFrozen(scanned.get("c")), "a scan's fresh segment is the caller's");
|
|
564
|
+
const AT = ArrayType(ArrayType(IntegerType));
|
|
565
|
+
const rows = openBeast2PagesFor(AT)(encodeBeast2SegmentsFor(AT)([[[1n], [2n]], [[3n]]]));
|
|
566
|
+
assert.ok(Object.isFrozen(rows.element(2)), "a row read is frozen");
|
|
567
|
+
});
|
|
568
|
+
test("a keyed read answers what the collection holds at the key: -0, 0 and NaN apart, and nothing between or beyond its keys", () => {
|
|
569
|
+
// East orders -0 before 0 and NaN after every number, each a key of its own.
|
|
570
|
+
const DT = DictType(FloatType, StringType);
|
|
571
|
+
const entries = [[-0, "minus zero"], [0, "zero"]];
|
|
572
|
+
for (let i = 1; i <= 5000; i++)
|
|
573
|
+
entries.push([i / 2, `half-${i}`]);
|
|
574
|
+
entries.push([Number.NaN, "not a number"]);
|
|
575
|
+
const pages = openBeast2PagesFor(DT)(encodeBeast2PagedFor(DT)(new SortedMap(entries, compareFor(FloatType))));
|
|
576
|
+
assert.ok(pages.segmentCount > 2, `the keys are several segments, not ${pages.segmentCount}`);
|
|
577
|
+
for (const [key, label] of entries)
|
|
578
|
+
assert.equal(pages.get(key), label, `${label}'s key`);
|
|
579
|
+
for (let i = 1; i < 5000; i += 97)
|
|
580
|
+
assert.equal(pages.get(i / 2 + 0.25), undefined, "a key between two is absent");
|
|
581
|
+
assert.equal(pages.get(-1), undefined, "below the first key");
|
|
582
|
+
assert.equal(pages.get(Number.NEGATIVE_INFINITY), undefined, "below the first key");
|
|
583
|
+
assert.equal(pages.get(Number.POSITIVE_INFINITY), undefined, "between the last number and NaN");
|
|
584
|
+
for (let s = 1; s < pages.segmentCount; s++) {
|
|
585
|
+
const fence = pages.fence(s);
|
|
586
|
+
if (!Number.isNaN(fence))
|
|
587
|
+
assert.equal(pages.get(fence - 0.25), undefined, `just below segment ${s}'s first key`);
|
|
588
|
+
}
|
|
589
|
+
// A Set answers with the element it holds, as the segment decoded it, not the key it was asked with.
|
|
590
|
+
const Elem = StructType({ id: IntegerType, name: StringType });
|
|
591
|
+
const ST = SetType(Elem);
|
|
592
|
+
const elems = Array.from({ length: 3000 }, (_, i) => ({ id: BigInt(i * 2), name: `row-${i}` }));
|
|
593
|
+
const sp = openBeast2PagesFor(ST)(encodeBeast2PagedFor(ST)(new SortedSet(elems, compareFor(Elem))));
|
|
594
|
+
assert.ok(sp.segmentCount > 1, `the elements are several segments, not ${sp.segmentCount}`);
|
|
595
|
+
const asked = { id: 1000n, name: "row-500" };
|
|
596
|
+
const stored = sp.get(asked);
|
|
597
|
+
assert.ok(stored !== undefined && equalFor(Elem)(stored, asked), "the element is found");
|
|
598
|
+
assert.notStrictEqual(stored, asked, "the element held, not the key asked with");
|
|
599
|
+
assert.ok(Object.isFrozen(stored), "as the segment decoded it");
|
|
600
|
+
assert.equal(sp.get({ id: 1001n, name: "row-500" }), undefined, "an element between two is absent");
|
|
601
|
+
assert.equal(sp.get({ id: 1000n, name: "row-501" }), undefined, "so is one that differs in a later field");
|
|
602
|
+
assert.equal(sp.get({ id: -1n, name: "" }), undefined, "and one below the first");
|
|
603
|
+
});
|
|
604
|
+
test("a keyed read looks its key up in its segment, and walks none of the segment's entries", (t) => {
|
|
605
|
+
// The deterministic stand-in for a read's cost. A segment is a SortedMap or
|
|
606
|
+
// SortedSet, whose B-tree finds a key in O(log m) of its m keys, as east-c's
|
|
607
|
+
// east_dict_get and east_set_has do; a walk of its entries is O(m) a read,
|
|
608
|
+
// which cost a join's lookups 20 µs each in 1,200-key segments. The
|
|
609
|
+
// segments are held first, read last to first so no run of reads in key
|
|
610
|
+
// order drops any: a decode walks what it decodes, to weigh it.
|
|
611
|
+
const DT = DictType(StringType, IntegerType);
|
|
612
|
+
const rows = Array.from({ length: 4000 }, (_, i) => [`k${String(i).padStart(4, "0")}`, BigInt(i)]);
|
|
613
|
+
const dp = openBeast2PagesFor(DT)(encodeBeast2PagedFor(DT)(new Map(rows)));
|
|
614
|
+
const ST = SetType(IntegerType);
|
|
615
|
+
const sp = openBeast2PagesFor(ST)(encodeBeast2PagedFor(ST)(new Set(rows.map(([, v]) => v * 2n))));
|
|
616
|
+
assert.ok(dp.segmentCount > 1 && sp.segmentCount > 1, `both are several segments, not ${dp.segmentCount} and ${sp.segmentCount}`);
|
|
617
|
+
for (const [key, v] of [...rows].reverse()) {
|
|
618
|
+
dp.get(key);
|
|
619
|
+
sp.get(v * 2n);
|
|
620
|
+
}
|
|
621
|
+
assert.equal(dp.cacheStats.segments, dp.segmentCount, "every Dict segment is held");
|
|
622
|
+
assert.equal(sp.cacheStats.segments, sp.segmentCount, "every Set segment is held");
|
|
623
|
+
const walks = [
|
|
624
|
+
t.mock.method(SortedMap.prototype, "entries"),
|
|
625
|
+
t.mock.method(SortedMap.prototype, "keys"),
|
|
626
|
+
t.mock.method(SortedMap.prototype, "values"),
|
|
627
|
+
t.mock.method(SortedMap.prototype, "forEach"),
|
|
628
|
+
t.mock.method(SortedSet.prototype, "entries"),
|
|
629
|
+
t.mock.method(SortedSet.prototype, "values"),
|
|
630
|
+
t.mock.method(SortedSet.prototype, "forEach"),
|
|
631
|
+
];
|
|
632
|
+
const positioned = t.mock.method(SortedSet.prototype, "keys");
|
|
633
|
+
// A `for...of` over a segment: counted by hand, since node 22's
|
|
634
|
+
// mock.method leaves a Symbol-keyed method broken once it restores it.
|
|
635
|
+
let iterated = 0;
|
|
636
|
+
for (const proto of [SortedMap.prototype, SortedSet.prototype]) {
|
|
637
|
+
const iterate = proto[Symbol.iterator];
|
|
638
|
+
proto[Symbol.iterator] = function () {
|
|
639
|
+
iterated++;
|
|
640
|
+
return iterate.call(this);
|
|
641
|
+
};
|
|
642
|
+
t.after(() => {
|
|
643
|
+
proto[Symbol.iterator] = iterate;
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
const hits = dp.cacheStats.hits + sp.cacheStats.hits;
|
|
647
|
+
for (const [key, v] of rows) {
|
|
648
|
+
assert.equal(dp.get(key), v);
|
|
649
|
+
assert.equal(sp.get(v * 2n), v * 2n);
|
|
650
|
+
assert.equal(sp.get(v * 2n + 1n), undefined);
|
|
651
|
+
}
|
|
652
|
+
assert.equal(dp.cacheStats.hits + sp.cacheStats.hits - hits, 3 * rows.length, "every read was served a held segment");
|
|
653
|
+
assert.deepEqual(walks.map((walk) => walk.mock.callCount()), walks.map(() => 0), "no read walked a segment");
|
|
654
|
+
assert.equal(iterated, 0, "nor iterated one");
|
|
655
|
+
assert.equal(positioned.mock.callCount(), 2 * rows.length, "each Set read starts its segment's B-tree once");
|
|
656
|
+
assert.ok(positioned.mock.calls.every((call) => call.arguments.length === 1), "at the key it was asked");
|
|
657
|
+
});
|
|
550
658
|
});
|
|
551
659
|
// =============================================================================
|
|
552
660
|
// 6. Hardening — malformed inputs fail loudly
|