@elaraai/east 1.0.44 → 1.0.46
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/containers/sortedmap.d.ts +22 -0
- package/dist/src/containers/sortedmap.d.ts.map +1 -1
- package/dist/src/containers/sortedmap.js +31 -2
- package/dist/src/containers/sortedmap.js.map +1 -1
- package/dist/src/containers/sortedset.d.ts +22 -0
- package/dist/src/containers/sortedset.d.ts.map +1 -1
- package/dist/src/containers/sortedset.js +31 -2
- package/dist/src/containers/sortedset.js.map +1 -1
- package/dist/src/expr/blob.d.ts +6 -1
- package/dist/src/expr/blob.d.ts.map +1 -1
- package/dist/src/expr/blob.js +6 -1
- package/dist/src/expr/blob.js.map +1 -1
- package/dist/src/expr/libs/blob.d.ts +10 -1
- package/dist/src/expr/libs/blob.d.ts.map +1 -1
- package/dist/src/expr/libs/blob.js +10 -1
- package/dist/src/expr/libs/blob.js.map +1 -1
- package/dist/src/fuzz.d.ts.map +1 -1
- package/dist/src/fuzz.js +11 -2
- package/dist/src/fuzz.js.map +1 -1
- package/dist/src/serialization/beast2/index.d.ts +76 -22
- package/dist/src/serialization/beast2/index.d.ts.map +1 -1
- package/dist/src/serialization/beast2/index.js +87 -720
- package/dist/src/serialization/beast2/index.js.map +1 -1
- package/dist/src/serialization/beast2/index.spec.js +147 -4
- package/dist/src/serialization/beast2/index.spec.js.map +1 -1
- package/dist/src/serialization/beast2/shared.d.ts +79 -0
- package/dist/src/serialization/beast2/shared.d.ts.map +1 -0
- package/dist/src/serialization/beast2/shared.js +143 -0
- package/dist/src/serialization/beast2/shared.js.map +1 -0
- package/dist/src/serialization/beast2/v4/container.d.ts +67 -0
- package/dist/src/serialization/beast2/v4/container.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v4/container.js +727 -0
- package/dist/src/serialization/beast2/v4/container.js.map +1 -0
- package/dist/src/serialization/beast2/{sourcemap-table.d.ts → v4/sourcemap-table.d.ts} +2 -2
- package/dist/src/serialization/beast2/v4/sourcemap-table.d.ts.map +1 -0
- package/dist/src/serialization/beast2/{sourcemap-table.js → v4/sourcemap-table.js} +2 -2
- package/dist/src/serialization/beast2/v4/sourcemap-table.js.map +1 -0
- package/dist/src/serialization/beast2/{string-table.d.ts → v4/string-table.d.ts} +1 -1
- package/dist/src/serialization/beast2/v4/string-table.d.ts.map +1 -0
- package/dist/src/serialization/beast2/{string-table.js → v4/string-table.js} +1 -1
- package/dist/src/serialization/beast2/v4/string-table.js.map +1 -0
- package/dist/src/serialization/beast2/{type-table.d.ts → v4/type-table.d.ts} +6 -4
- package/dist/src/serialization/beast2/v4/type-table.d.ts.map +1 -0
- package/dist/src/serialization/beast2/{type-table.js → v4/type-table.js} +103 -10
- package/dist/src/serialization/beast2/v4/type-table.js.map +1 -0
- package/dist/src/serialization/beast2/{value-table.d.ts → v4/value-table.d.ts} +2 -2
- package/dist/src/serialization/beast2/v4/value-table.d.ts.map +1 -0
- package/dist/src/serialization/beast2/{value-table.js → v4/value-table.js} +3 -3
- package/dist/src/serialization/beast2/v4/value-table.js.map +1 -0
- package/dist/src/serialization/beast2/v5/codec.d.ts +213 -0
- package/dist/src/serialization/beast2/v5/codec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/codec.js +954 -0
- package/dist/src/serialization/beast2/v5/codec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/deflate.d.ts +16 -0
- package/dist/src/serialization/beast2/v5/deflate.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/deflate.js +172 -0
- package/dist/src/serialization/beast2/v5/deflate.js.map +1 -0
- package/dist/src/serialization/beast2/v5/frames.d.ts +150 -0
- package/dist/src/serialization/beast2/v5/frames.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/frames.js +284 -0
- package/dist/src/serialization/beast2/v5/frames.js.map +1 -0
- package/dist/src/serialization/beast2/v5/index.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/index.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/index.spec.js +484 -0
- package/dist/src/serialization/beast2/v5/index.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/stream.d.ts +177 -0
- package/dist/src/serialization/beast2/v5/stream.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/stream.js +447 -0
- package/dist/src/serialization/beast2/v5/stream.js.map +1 -0
- package/dist/src/serialization/beast2/v5/type-section.d.ts +81 -0
- package/dist/src/serialization/beast2/v5/type-section.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/type-section.js +211 -0
- package/dist/src/serialization/beast2/v5/type-section.js.map +1 -0
- package/dist/src/serialization/beast2/version.d.ts +40 -0
- package/dist/src/serialization/beast2/version.d.ts.map +1 -0
- package/dist/src/serialization/beast2/version.js +23 -0
- package/dist/src/serialization/beast2/version.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/package.json +1 -1
- package/dist/src/serialization/beast2/sourcemap-table.d.ts.map +0 -1
- package/dist/src/serialization/beast2/sourcemap-table.js.map +0 -1
- package/dist/src/serialization/beast2/string-table.d.ts.map +0 -1
- package/dist/src/serialization/beast2/string-table.js.map +0 -1
- package/dist/src/serialization/beast2/type-table.d.ts.map +0 -1
- package/dist/src/serialization/beast2/type-table.js.map +0 -1
- package/dist/src/serialization/beast2/value-table.d.ts.map +0 -1
- package/dist/src/serialization/beast2/value-table.js.map +0 -1
|
@@ -3,15 +3,12 @@
|
|
|
3
3
|
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Beast2
|
|
6
|
+
* Beast2 container — version-agnostic public entry points.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Functions: IR encoded directly — EastTypeType schema positions auto-emit type table indices.
|
|
13
|
-
*
|
|
14
|
-
* See devdocs/BEAST2.md for the full specification.
|
|
8
|
+
* Decoders dispatch on the magic's version byte (`v4` = 0x04, `v5` = 0x05) so
|
|
9
|
+
* every entry point accepts blobs of either container version. Encoders write
|
|
10
|
+
* the v4 container by default. See `SPEC.md` for the magic registry and
|
|
11
|
+
* version policy, `v4/SPEC.md` and `v5/SPEC.md` for the wire formats.
|
|
15
12
|
*/
|
|
16
13
|
import { type EastTypeValue } from "../../type_of_type.js";
|
|
17
14
|
import type { EastType, ValueTypeOf } from "../../types.js";
|
|
@@ -19,32 +16,89 @@ import { type FunctionIR, type AsyncFunctionIR } from "../../ir.js";
|
|
|
19
16
|
import type { PlatformFunction } from "../../platform.js";
|
|
20
17
|
import { EastIR, AsyncEastIR } from "../../eastir.js";
|
|
21
18
|
import type { SourceMap } from "../../location.js";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
export
|
|
19
|
+
import { type Beast2DecodeOptions } from "./shared.js";
|
|
20
|
+
import type { Beast2Codec } from "./v5/frames.js";
|
|
21
|
+
import { type Beast2Version } from "./version.js";
|
|
22
|
+
export { MAGIC_BYTES } from "./v4/container.js";
|
|
23
|
+
export { MAGIC_BYTES_V5 } from "./v5/codec.js";
|
|
24
|
+
export type { Beast2DecodeOptions } from "./shared.js";
|
|
25
|
+
export type { Beast2Codec } from "./v5/frames.js";
|
|
26
|
+
export { Beast2Writer, type Beast2WriterOptions, encodeBeast2SegmentsFor, iterBeast2SegmentsFor, Beast2Pages, openBeast2PagesFor, } from "./v5/stream.js";
|
|
27
|
+
export { BEAST2_WRITE_VERSION, BEAST2_READ_VERSIONS, type Beast2Version } from "./version.js";
|
|
28
|
+
/** Options accepted by {@link encodeBeast2For}. */
|
|
29
|
+
export type Beast2EncodeOptions = {
|
|
30
|
+
/** Explicit source map to embed (overrides discovery from function values). */
|
|
27
31
|
sourceMap?: SourceMap | null;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
/** Container version to write. Defaults to `5`. Pass `4` to write the
|
|
33
|
+
* legacy globally-sectioned container for a reader that predates v5. */
|
|
34
|
+
version?: Beast2Version;
|
|
35
|
+
/** v5 only: per-frame codec. Defaults to `"deflate"`. */
|
|
36
|
+
codec?: Beast2Codec;
|
|
37
|
+
/** v5 only: write the trailing index + footer (container roots).
|
|
38
|
+
* Defaults to `false`. */
|
|
39
|
+
index?: boolean;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Builds an encoder closure for the given type.
|
|
43
|
+
*
|
|
44
|
+
* The returned function encodes values of `type` into a self-contained beast2
|
|
45
|
+
* blob. The container version defaults to v5 — the segment-terminated record
|
|
46
|
+
* stream (see `v5/SPEC.md`), deflate-framed — and accepts the `codec` and
|
|
47
|
+
* `index` options. Pass `version: 4` for the legacy container; decode entry
|
|
48
|
+
* points accept every version regardless.
|
|
49
|
+
*
|
|
50
|
+
* @param type - the root East type (as `EastType` or `EastTypeValue`)
|
|
51
|
+
* @param options - encode options (source map, container version, v5 codec/index)
|
|
52
|
+
* @returns a reusable function encoding values of `type` to beast2 bytes
|
|
53
|
+
*/
|
|
54
|
+
export declare function encodeBeast2For(type: EastTypeValue, options?: Beast2EncodeOptions): (value: any) => Uint8Array;
|
|
55
|
+
export declare function encodeBeast2For<T extends EastType>(type: T, options?: Beast2EncodeOptions): (value: ValueTypeOf<T>) => Uint8Array;
|
|
56
|
+
/**
|
|
57
|
+
* Builds a decoder closure for the given type.
|
|
58
|
+
*
|
|
59
|
+
* The returned function dispatches on the blob's magic version byte, so v4
|
|
60
|
+
* blobs decode through the same entry point as newer container versions.
|
|
61
|
+
*
|
|
62
|
+
* @param type - the expected root East type (as `EastType` or `EastTypeValue`)
|
|
63
|
+
* @param options - decode options (platform functions for decoded functions)
|
|
64
|
+
* @returns a reusable function decoding beast2 bytes to values of `type`
|
|
65
|
+
*/
|
|
32
66
|
export declare function decodeBeast2For(type: EastTypeValue, options?: Beast2DecodeOptions): (data: Uint8Array) => any;
|
|
33
67
|
export declare function decodeBeast2For<T extends EastType>(type: T, options?: Beast2DecodeOptions): (data: Uint8Array) => ValueTypeOf<T>;
|
|
68
|
+
/**
|
|
69
|
+
* Builds an async decoder closure for the given type.
|
|
70
|
+
*
|
|
71
|
+
* Identical to {@link decodeBeast2For} but decompresses v5 deflate frames with
|
|
72
|
+
* the platform's async decompressor (`DecompressionStream`), so it works in
|
|
73
|
+
* browsers where Node's zlib is unavailable. v4 blobs decode synchronously.
|
|
74
|
+
*
|
|
75
|
+
* @param type - the expected root East type (as `EastType` or `EastTypeValue`)
|
|
76
|
+
* @param options - decode options (platform functions for decoded functions)
|
|
77
|
+
* @returns a reusable async function decoding beast2 bytes to values of `type`
|
|
78
|
+
*/
|
|
79
|
+
export declare function decodeBeast2ForAsync(type: EastTypeValue, options?: Beast2DecodeOptions): (data: Uint8Array) => Promise<any>;
|
|
80
|
+
export declare function decodeBeast2ForAsync<T extends EastType>(type: T, options?: Beast2DecodeOptions): (data: Uint8Array) => Promise<ValueTypeOf<T>>;
|
|
81
|
+
/**
|
|
82
|
+
* Decodes a self-describing blob using its embedded root type.
|
|
83
|
+
*
|
|
84
|
+
* @param data - a beast2 blob of any supported container version
|
|
85
|
+
* @param options - decode options (platform functions for decoded functions)
|
|
86
|
+
* @returns the blob's root type and decoded value
|
|
87
|
+
*/
|
|
88
|
+
export declare function decodeBeast2(data: Uint8Array, options?: Beast2DecodeOptions): {
|
|
89
|
+
type: EastTypeValue;
|
|
90
|
+
value: any;
|
|
91
|
+
};
|
|
34
92
|
/** Encode an EastIR (or AsyncEastIR) as a beast2 blob that carries both the
|
|
35
93
|
* IR and its source map. Prefer this over `encodeBeast2For(IRType)(ir)` when
|
|
36
94
|
* encoding a program rather than opaque IR data. */
|
|
37
|
-
export declare function encodeEastIR<I extends any[], O>(eastIR: EastIR<I, O> | AsyncEastIR<I, O>): Uint8Array;
|
|
95
|
+
export declare function encodeEastIR<I extends any[], O>(eastIR: EastIR<I, O> | AsyncEastIR<I, O>, options?: Omit<Beast2EncodeOptions, "sourceMap">): Uint8Array;
|
|
38
96
|
/** Decode a beast2 blob whose root is a Function IR into an EastIR. The
|
|
39
97
|
* returned wrapper has its source_map populated from the blob's source_map
|
|
40
98
|
* section, so downstream compile() resolves loc_ids automatically. */
|
|
41
99
|
export declare function decodeEastIR<I extends any[] = any[], O = any>(data: Uint8Array): EastIR<I, O>;
|
|
42
100
|
/** Async-function variant of decodeEastIR. */
|
|
43
101
|
export declare function decodeAsyncEastIR<I extends any[] = any[], O = any>(data: Uint8Array): AsyncEastIR<I, O>;
|
|
44
|
-
export declare function decodeBeast2(data: Uint8Array, options?: Beast2DecodeOptions): {
|
|
45
|
-
type: EastTypeValue;
|
|
46
|
-
value: any;
|
|
47
|
-
};
|
|
48
102
|
export declare function compileFunctionIR<I extends any[], O>(ir: FunctionIR, platform: PlatformFunction[]): (...args: I) => O;
|
|
49
103
|
export declare function compileAsyncFunctionIR<I extends any[], O>(ir: AsyncFunctionIR, platform: PlatformFunction[]): (...args: I) => Promise<O>;
|
|
50
104
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/serialization/beast2/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
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,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,O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