fastdb4ts 0.0.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -19
- package/dist/LICENSE +21 -0
- package/dist/THIRD_PARTY_NOTICES.txt +1958 -0
- package/dist/column.d.ts +1 -0
- package/dist/column.js +35 -1
- package/dist/database-buffer.d.ts +20 -0
- package/dist/database-buffer.js +101 -0
- package/dist/feature.d.ts +1 -1
- package/dist/feature.js +47 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/orm.d.ts +4 -2
- package/dist/orm.js +128 -33
- package/dist/payload/abi.d.ts +27 -0
- package/dist/payload/abi.js +160 -0
- package/dist/payload/builder.d.ts +98 -0
- package/dist/payload/builder.js +364 -0
- package/dist/payload/codegen.d.ts +43 -0
- package/dist/payload/codegen.js +182 -0
- package/dist/payload/error.d.ts +9 -0
- package/dist/payload/error.js +53 -0
- package/dist/payload/index.d.ts +9 -0
- package/dist/payload/index.js +9 -0
- package/dist/payload/runtime.d.ts +195 -0
- package/dist/payload/runtime.js +756 -0
- package/dist/payload/spec.d.ts +44 -0
- package/dist/payload/spec.js +220 -0
- package/dist/schema.js +1 -0
- package/dist/serializer.d.ts +2 -1
- package/dist/serializer.js +5 -4
- package/dist/table.js +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +31 -0
- package/dist/wasm/fastdb4ts.js +1 -1
- package/dist/wasm/fastdb4ts.wasm +0 -0
- package/dist/wasm-loader.d.ts +146 -1
- package/package.json +6 -2
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { POINTER_SIZE, SHA256_SIZE, checkedU32, checkedU64, copyBytes, payloadModule, readU32, readU64, withAllocation, writeU32, writeU64, } from './abi.js';
|
|
2
|
+
import { bindingError, checkStatus } from './error.js';
|
|
3
|
+
const CODEGEN_OPTIONS_SIZE = 48;
|
|
4
|
+
export var CodegenTarget;
|
|
5
|
+
(function (CodegenTarget) {
|
|
6
|
+
CodegenTarget[CodegenTarget["Cpp"] = 1] = "Cpp";
|
|
7
|
+
CodegenTarget[CodegenTarget["Rust"] = 2] = "Rust";
|
|
8
|
+
CodegenTarget[CodegenTarget["Python"] = 4] = "Python";
|
|
9
|
+
CodegenTarget[CodegenTarget["TypeScript"] = 8] = "TypeScript";
|
|
10
|
+
})(CodegenTarget || (CodegenTarget = {}));
|
|
11
|
+
export var ArtifactKind;
|
|
12
|
+
(function (ArtifactKind) {
|
|
13
|
+
ArtifactKind[ArtifactKind["Source"] = 1] = "Source";
|
|
14
|
+
})(ArtifactKind || (ArtifactKind = {}));
|
|
15
|
+
export class CodegenOptions {
|
|
16
|
+
flags;
|
|
17
|
+
maxArtifacts;
|
|
18
|
+
maxTotalBytes;
|
|
19
|
+
constructor(values = {}) {
|
|
20
|
+
const module = payloadModule();
|
|
21
|
+
const defaults = withAllocation(module, CODEGEN_OPTIONS_SIZE, (pointer) => {
|
|
22
|
+
module._fdb_payload_v1_codegen_options_init(pointer);
|
|
23
|
+
return {
|
|
24
|
+
flags: readU32(module, pointer + 4),
|
|
25
|
+
maxArtifacts: readU64(module, pointer + 8),
|
|
26
|
+
maxTotalBytes: readU64(module, pointer + 16),
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
this.flags = checkedU32(values.flags ?? defaults.flags, 'flags');
|
|
30
|
+
this.maxArtifacts = checkedU64(values.maxArtifacts ?? defaults.maxArtifacts, 'maxArtifacts');
|
|
31
|
+
this.maxTotalBytes = checkedU64(values.maxTotalBytes ?? defaults.maxTotalBytes, 'maxTotalBytes');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export class Artifact {
|
|
35
|
+
relativePath;
|
|
36
|
+
kind;
|
|
37
|
+
#bytes;
|
|
38
|
+
#sha256;
|
|
39
|
+
constructor(relativePath, kind, bytes, sha256) {
|
|
40
|
+
this.relativePath = relativePath;
|
|
41
|
+
this.kind = kind;
|
|
42
|
+
this.#bytes = bytes.slice();
|
|
43
|
+
this.#sha256 = sha256.slice();
|
|
44
|
+
}
|
|
45
|
+
get bytes() {
|
|
46
|
+
return this.#bytes.slice();
|
|
47
|
+
}
|
|
48
|
+
get sha256() {
|
|
49
|
+
return this.#sha256.slice();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const decoder = new TextDecoder('utf-8', { fatal: true });
|
|
53
|
+
const artifactSetToken = Symbol('fastdb.payload.artifactSetToken');
|
|
54
|
+
const createArtifactSet = Symbol('fastdb.payload.createArtifactSet');
|
|
55
|
+
const artifactSetFinalizer = new FinalizationRegistry((handle) => {
|
|
56
|
+
try {
|
|
57
|
+
payloadModule()._fdb_payload_v1_codegen_result_release(handle);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// Explicit disposal is authoritative; finalization is only a fallback.
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export class ArtifactSet {
|
|
64
|
+
#handle;
|
|
65
|
+
#finalizerToken = {};
|
|
66
|
+
constructor(handle, token) {
|
|
67
|
+
if (token !== artifactSetToken) {
|
|
68
|
+
throw new TypeError('ArtifactSet handles are created only by FastDB');
|
|
69
|
+
}
|
|
70
|
+
if (handle === 0) {
|
|
71
|
+
throw bindingError('FastDB Core returned success without an artifact set', 'missing_codegen_result');
|
|
72
|
+
}
|
|
73
|
+
this.#handle = handle;
|
|
74
|
+
artifactSetFinalizer.register(this, handle, this.#finalizerToken);
|
|
75
|
+
}
|
|
76
|
+
static [createArtifactSet](handle, token) {
|
|
77
|
+
if (token !== artifactSetToken) {
|
|
78
|
+
throw new TypeError('ArtifactSet handles are created only by FastDB');
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
return new ArtifactSet(handle, artifactSetToken);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
if (handle !== 0) {
|
|
85
|
+
payloadModule()._fdb_payload_v1_codegen_result_release(handle);
|
|
86
|
+
}
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
clone() {
|
|
91
|
+
const handle = this.requireHandle();
|
|
92
|
+
payloadModule()._fdb_payload_v1_codegen_result_retain(handle);
|
|
93
|
+
return ArtifactSet[createArtifactSet](handle, artifactSetToken);
|
|
94
|
+
}
|
|
95
|
+
dispose() {
|
|
96
|
+
if (this.#handle !== 0) {
|
|
97
|
+
const handle = this.#handle;
|
|
98
|
+
this.#handle = 0;
|
|
99
|
+
artifactSetFinalizer.unregister(this.#finalizerToken);
|
|
100
|
+
payloadModule()._fdb_payload_v1_codegen_result_release(handle);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
size() {
|
|
104
|
+
const module = payloadModule();
|
|
105
|
+
return withAllocation(module, 8 + POINTER_SIZE, (outputs) => {
|
|
106
|
+
const status = module._fdb_payload_v1_codegen_result_artifact_count(this.requireHandle(), outputs, outputs + 8);
|
|
107
|
+
checkStatus(status, outputs + 8);
|
|
108
|
+
return readU64(module, outputs);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
artifact(index) {
|
|
112
|
+
const checkedIndex = checkedU64(index, 'artifactIndex');
|
|
113
|
+
const module = payloadModule();
|
|
114
|
+
const pathBytes = this.queryBlob(checkedIndex, module._fdb_payload_v1_codegen_result_artifact_relative_path.bind(module));
|
|
115
|
+
let relativePath;
|
|
116
|
+
try {
|
|
117
|
+
relativePath = decoder.decode(pathBytes);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
throw bindingError(`FastDB Core returned a non-UTF-8 artifact path: ${String(error)}`, 'invalid_utf8_artifact_path');
|
|
121
|
+
}
|
|
122
|
+
const kind = withAllocation(module, POINTER_SIZE * 2, (outputs) => {
|
|
123
|
+
const status = module._fdb_payload_v1_codegen_result_artifact_kind(this.requireHandle(), checkedIndex, outputs, outputs + POINTER_SIZE);
|
|
124
|
+
checkStatus(status, outputs + POINTER_SIZE);
|
|
125
|
+
const value = readU32(module, outputs);
|
|
126
|
+
if (value !== ArtifactKind.Source) {
|
|
127
|
+
throw bindingError('FastDB Core returned an unknown artifact kind', 'unknown_artifact_kind');
|
|
128
|
+
}
|
|
129
|
+
return value;
|
|
130
|
+
});
|
|
131
|
+
const bytes = this.queryBlob(checkedIndex, module._fdb_payload_v1_codegen_result_artifact_bytes.bind(module));
|
|
132
|
+
const sha256 = withAllocation(module, SHA256_SIZE + POINTER_SIZE, (outputs) => {
|
|
133
|
+
const status = module._fdb_payload_v1_codegen_result_artifact_sha256(this.requireHandle(), checkedIndex, outputs, outputs + SHA256_SIZE);
|
|
134
|
+
checkStatus(status, outputs + SHA256_SIZE);
|
|
135
|
+
return module.HEAPU8.slice(outputs, outputs + SHA256_SIZE);
|
|
136
|
+
});
|
|
137
|
+
return new Artifact(relativePath, kind, bytes, sha256);
|
|
138
|
+
}
|
|
139
|
+
queryBlob(index, query) {
|
|
140
|
+
const module = payloadModule();
|
|
141
|
+
return withAllocation(module, POINTER_SIZE * 2, (outputs) => {
|
|
142
|
+
const status = query(this.requireHandle(), index, outputs, outputs + POINTER_SIZE);
|
|
143
|
+
checkStatus(status, outputs + POINTER_SIZE);
|
|
144
|
+
const blob = readU32(module, outputs);
|
|
145
|
+
if (blob === 0) {
|
|
146
|
+
throw bindingError('FastDB Core returned success without a blob', 'missing_blob_handle');
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
return copyBytes(module, module._fdb_payload_v1_blob_data(blob), module._fdb_payload_v1_blob_size(blob));
|
|
150
|
+
}
|
|
151
|
+
finally {
|
|
152
|
+
module._fdb_payload_v1_blob_release(blob);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
requireHandle() {
|
|
157
|
+
if (this.#handle === 0) {
|
|
158
|
+
throw bindingError('ArtifactSet is disposed', 'disposed_handle');
|
|
159
|
+
}
|
|
160
|
+
return this.#handle;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export function generateArtifacts(specHandle, target, options = new CodegenOptions()) {
|
|
164
|
+
if (target !== CodegenTarget.Cpp &&
|
|
165
|
+
target !== CodegenTarget.Rust &&
|
|
166
|
+
target !== CodegenTarget.Python &&
|
|
167
|
+
target !== CodegenTarget.TypeScript) {
|
|
168
|
+
throw new RangeError('target must be a CodegenTarget');
|
|
169
|
+
}
|
|
170
|
+
const module = payloadModule();
|
|
171
|
+
return withAllocation(module, CODEGEN_OPTIONS_SIZE, (rawOptions) => {
|
|
172
|
+
module._fdb_payload_v1_codegen_options_init(rawOptions);
|
|
173
|
+
writeU32(module, rawOptions + 4, checkedU32(options.flags, 'flags'));
|
|
174
|
+
writeU64(module, rawOptions + 8, checkedU64(options.maxArtifacts, 'maxArtifacts'));
|
|
175
|
+
writeU64(module, rawOptions + 16, checkedU64(options.maxTotalBytes, 'maxTotalBytes'));
|
|
176
|
+
return withAllocation(module, POINTER_SIZE * 2, (outputs) => {
|
|
177
|
+
const status = module._fdb_payload_v1_spec_codegen(specHandle, BigInt(target), rawOptions, outputs, outputs + POINTER_SIZE);
|
|
178
|
+
checkStatus(status, outputs + POINTER_SIZE);
|
|
179
|
+
return ArtifactSet[createArtifactSet](readU32(module, outputs), artifactSetToken);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class PayloadError extends Error {
|
|
2
|
+
readonly code: number;
|
|
3
|
+
readonly symbol: string;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly detailsJson: string;
|
|
6
|
+
constructor(code: number, symbol: string, path: string, message: string, detailsJson: string);
|
|
7
|
+
}
|
|
8
|
+
export declare function bindingError(message: string, reason: string): PayloadError;
|
|
9
|
+
export declare function checkStatus(status: number, errorOut: number): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { copyBytes, payloadModule, readU32, readU64, withAllocation, } from './abi.js';
|
|
2
|
+
const decoder = new TextDecoder('utf-8');
|
|
3
|
+
const ERROR_SIZE_OFFSET = 8;
|
|
4
|
+
const ERROR_OUTPUT_SIZE = 16;
|
|
5
|
+
export class PayloadError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
symbol;
|
|
8
|
+
path;
|
|
9
|
+
detailsJson;
|
|
10
|
+
constructor(code, symbol, path, message, detailsJson) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'PayloadError';
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.symbol = symbol;
|
|
15
|
+
this.path = path;
|
|
16
|
+
this.detailsJson = detailsJson;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function bindingError(message, reason) {
|
|
20
|
+
return new PayloadError(9001, 'BINDING_CONTRACT', '', message, `{"reason":"${reason}"}`);
|
|
21
|
+
}
|
|
22
|
+
function copyErrorField(error, accessor) {
|
|
23
|
+
const module = payloadModule();
|
|
24
|
+
return withAllocation(module, ERROR_OUTPUT_SIZE, (outputs) => {
|
|
25
|
+
accessor(error, outputs, outputs + ERROR_SIZE_OFFSET);
|
|
26
|
+
const data = readU32(module, outputs);
|
|
27
|
+
const size = readU64(module, outputs + ERROR_SIZE_OFFSET);
|
|
28
|
+
return decoder.decode(copyBytes(module, data, size));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function takeNativeError(status, error) {
|
|
32
|
+
if (error === 0) {
|
|
33
|
+
return new PayloadError(status || 9001, 'BINDING_CONTRACT', '', 'FastDB Core returned a failure without an owned error', '{"reason":"missing_error_handle"}');
|
|
34
|
+
}
|
|
35
|
+
const module = payloadModule();
|
|
36
|
+
try {
|
|
37
|
+
return new PayloadError(module._fdb_payload_v1_error_code(error), copyErrorField(error, module._fdb_payload_v1_error_symbol.bind(module)), copyErrorField(error, module._fdb_payload_v1_error_path.bind(module)), copyErrorField(error, module._fdb_payload_v1_error_message.bind(module)), copyErrorField(error, module._fdb_payload_v1_error_details_json.bind(module)));
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
module._fdb_payload_v1_error_release(error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function checkStatus(status, errorOut) {
|
|
44
|
+
const module = payloadModule();
|
|
45
|
+
const error = readU32(module, errorOut);
|
|
46
|
+
if (status !== 0) {
|
|
47
|
+
throw takeNativeError(status, error);
|
|
48
|
+
}
|
|
49
|
+
if (error !== 0) {
|
|
50
|
+
module._fdb_payload_v1_error_release(error);
|
|
51
|
+
throw bindingError('FastDB Core returned success with an error handle', 'unexpected_error_handle');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { BuildPlan, Builder, FixedRun, ObjectHandle, PlanInfo, } from './builder.js';
|
|
2
|
+
export type { BuilderOptions } from './builder.js';
|
|
3
|
+
export { Artifact, ArtifactKind, ArtifactSet, CodegenOptions, CodegenTarget, } from './codegen.js';
|
|
4
|
+
export type { CodegenOptionValues } from './codegen.js';
|
|
5
|
+
export { PayloadError } from './error.js';
|
|
6
|
+
export { Capabilities, CompiledSpec, Profile } from './spec.js';
|
|
7
|
+
export { Access, BuildPolicy, BuildResult, ExecutionMode, ExecutionReport, FallbackReason, GraphIdentity, OpenOptions, Payload, WasmMemoryBacking, WasmOwnedBytes, View, ViewKind, } from './runtime.js';
|
|
8
|
+
export type { OpenOptionValues, PayloadBackingStats, WasmMemoryBackingOptions, } from './runtime.js';
|
|
9
|
+
export declare function initPayload(): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { initPayloadModule } from './abi.js';
|
|
2
|
+
export { BuildPlan, Builder, FixedRun, ObjectHandle, PlanInfo, } from './builder.js';
|
|
3
|
+
export { Artifact, ArtifactKind, ArtifactSet, CodegenOptions, CodegenTarget, } from './codegen.js';
|
|
4
|
+
export { PayloadError } from './error.js';
|
|
5
|
+
export { Capabilities, CompiledSpec, Profile } from './spec.js';
|
|
6
|
+
export { Access, BuildPolicy, BuildResult, ExecutionMode, ExecutionReport, FallbackReason, GraphIdentity, OpenOptions, Payload, WasmMemoryBacking, WasmOwnedBytes, View, ViewKind, } from './runtime.js';
|
|
7
|
+
export async function initPayload() {
|
|
8
|
+
await initPayloadModule();
|
|
9
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { WxPayloadBackingHandle, WxPayloadOwnedBytesHandle } from '../wasm-loader.js';
|
|
2
|
+
import { BuildPlan } from './builder.js';
|
|
3
|
+
import { CompiledSpec, Profile } from './spec.js';
|
|
4
|
+
export declare enum BuildPolicy {
|
|
5
|
+
AllowStaging = 1,
|
|
6
|
+
RequireDirect = 2
|
|
7
|
+
}
|
|
8
|
+
export declare enum ExecutionMode {
|
|
9
|
+
Direct = 1,
|
|
10
|
+
Staged = 2
|
|
11
|
+
}
|
|
12
|
+
export declare enum FallbackReason {
|
|
13
|
+
None = 0,
|
|
14
|
+
PlanRequiresStaging = 1,
|
|
15
|
+
BackingDeclinedDirect = 2
|
|
16
|
+
}
|
|
17
|
+
export declare enum ViewKind {
|
|
18
|
+
Sequence = 1,
|
|
19
|
+
Bool = 2,
|
|
20
|
+
U8 = 3,
|
|
21
|
+
U16 = 4,
|
|
22
|
+
U32 = 5,
|
|
23
|
+
I32 = 6,
|
|
24
|
+
U8n = 7,
|
|
25
|
+
U16n = 8,
|
|
26
|
+
F32 = 9,
|
|
27
|
+
F64 = 10,
|
|
28
|
+
Str = 11,
|
|
29
|
+
Wstr = 12,
|
|
30
|
+
Bytes = 13,
|
|
31
|
+
Component = 14,
|
|
32
|
+
List = 15,
|
|
33
|
+
Ref = 16
|
|
34
|
+
}
|
|
35
|
+
/** Core identity coordinates meaningful only within one payload owner. */
|
|
36
|
+
export declare class GraphIdentity {
|
|
37
|
+
readonly componentIndex: number;
|
|
38
|
+
readonly objectId: bigint;
|
|
39
|
+
constructor(componentIndex: number, objectId: bigint);
|
|
40
|
+
}
|
|
41
|
+
export interface PayloadBackingStats {
|
|
42
|
+
readonly reservations: bigint;
|
|
43
|
+
readonly writes: bigint;
|
|
44
|
+
readonly commits: bigint;
|
|
45
|
+
readonly rollbacks: bigint;
|
|
46
|
+
readonly retains: bigint;
|
|
47
|
+
readonly releases: bigint;
|
|
48
|
+
}
|
|
49
|
+
export declare class ExecutionReport {
|
|
50
|
+
readonly mode: ExecutionMode;
|
|
51
|
+
readonly fallbackReason: FallbackReason;
|
|
52
|
+
readonly requestedBytes: bigint;
|
|
53
|
+
readonly usedBytes: bigint;
|
|
54
|
+
readonly stagingBytes: bigint;
|
|
55
|
+
readonly regionCount: bigint;
|
|
56
|
+
readonly backingCapacity: bigint;
|
|
57
|
+
constructor(mode: ExecutionMode, fallbackReason: FallbackReason, requestedBytes: bigint, usedBytes: bigint, stagingBytes: bigint, regionCount: bigint, backingCapacity: bigint);
|
|
58
|
+
}
|
|
59
|
+
export interface OpenOptionValues {
|
|
60
|
+
flags?: number;
|
|
61
|
+
maxTotalBytes?: bigint;
|
|
62
|
+
maxRegions?: bigint;
|
|
63
|
+
maxEntries?: bigint;
|
|
64
|
+
maxComponents?: bigint;
|
|
65
|
+
maxNestingDepth?: bigint;
|
|
66
|
+
maxListElements?: bigint;
|
|
67
|
+
maxGraphObjects?: bigint;
|
|
68
|
+
maxStringBytes?: bigint;
|
|
69
|
+
maxValidationWork?: bigint;
|
|
70
|
+
}
|
|
71
|
+
export declare class OpenOptions {
|
|
72
|
+
readonly values: Readonly<OpenOptionValues>;
|
|
73
|
+
constructor(values?: OpenOptionValues);
|
|
74
|
+
}
|
|
75
|
+
export interface WasmMemoryBackingOptions {
|
|
76
|
+
allowDirect?: boolean;
|
|
77
|
+
}
|
|
78
|
+
interface TestingBackingOptions extends WasmMemoryBackingOptions {
|
|
79
|
+
failWrite?: boolean;
|
|
80
|
+
failCommit?: boolean;
|
|
81
|
+
}
|
|
82
|
+
declare const testingBackingToken: unique symbol;
|
|
83
|
+
declare const createTestingBacking: unique symbol;
|
|
84
|
+
declare const backingHandleValue: unique symbol;
|
|
85
|
+
export declare class WasmMemoryBacking {
|
|
86
|
+
#private;
|
|
87
|
+
constructor(options?: WasmMemoryBackingOptions);
|
|
88
|
+
static [createTestingBacking](options: TestingBackingOptions, token: typeof testingBackingToken): WasmMemoryBacking;
|
|
89
|
+
stats(): PayloadBackingStats;
|
|
90
|
+
dispose(): void;
|
|
91
|
+
/** @internal */
|
|
92
|
+
[backingHandleValue](): WxPayloadBackingHandle;
|
|
93
|
+
private requireNative;
|
|
94
|
+
private replaceNative;
|
|
95
|
+
}
|
|
96
|
+
export declare function __testingWasmMemoryBacking(options: TestingBackingOptions): WasmMemoryBacking;
|
|
97
|
+
declare const ownedBytesHandleValue: unique symbol;
|
|
98
|
+
export declare class WasmOwnedBytes {
|
|
99
|
+
#private;
|
|
100
|
+
private constructor();
|
|
101
|
+
static copyFrom(source: Uint8Array): WasmOwnedBytes;
|
|
102
|
+
dispose(): void;
|
|
103
|
+
/** @internal */
|
|
104
|
+
[ownedBytesHandleValue](): WxPayloadOwnedBytesHandle;
|
|
105
|
+
}
|
|
106
|
+
declare const payloadConstructionToken: unique symbol;
|
|
107
|
+
declare const createPayload: unique symbol;
|
|
108
|
+
declare const accessConstructionToken: unique symbol;
|
|
109
|
+
declare const createAccess: unique symbol;
|
|
110
|
+
/** A unique Core access pin. Safe methods always return JavaScript-owned copies. */
|
|
111
|
+
export declare class Access {
|
|
112
|
+
#private;
|
|
113
|
+
private constructor();
|
|
114
|
+
static [createAccess](handle: number, token: typeof accessConstructionToken): Access;
|
|
115
|
+
dispose(): void;
|
|
116
|
+
payloadBytes(): Uint8Array;
|
|
117
|
+
str(): string;
|
|
118
|
+
wstr(): string;
|
|
119
|
+
bytes(): Uint8Array;
|
|
120
|
+
private copyByteSpan;
|
|
121
|
+
private requireHandle;
|
|
122
|
+
}
|
|
123
|
+
declare const viewConstructionToken: unique symbol;
|
|
124
|
+
declare const createView: unique symbol;
|
|
125
|
+
/** A retainable immutable Core view with generation-checked operations. */
|
|
126
|
+
export declare class View {
|
|
127
|
+
#private;
|
|
128
|
+
private constructor();
|
|
129
|
+
static [createView](handle: number, token: typeof viewConstructionToken): View;
|
|
130
|
+
clone(): View;
|
|
131
|
+
dispose(): void;
|
|
132
|
+
requireSpecSha256(expectedSha256: Uint8Array): void;
|
|
133
|
+
kind(): ViewKind;
|
|
134
|
+
isNull(): boolean;
|
|
135
|
+
length(): bigint;
|
|
136
|
+
at(index: bigint): View;
|
|
137
|
+
componentIndex(): number;
|
|
138
|
+
fieldCount(): number;
|
|
139
|
+
field(index: number): View;
|
|
140
|
+
/** Follow exactly one explicit Core ref edge. */
|
|
141
|
+
refTarget(): View;
|
|
142
|
+
/** Return Core coordinates meaningful only within this payload owner. */
|
|
143
|
+
graphIdentity(): GraphIdentity;
|
|
144
|
+
getBool(): boolean;
|
|
145
|
+
getU8(): number;
|
|
146
|
+
getU16(): number;
|
|
147
|
+
getU32(): number;
|
|
148
|
+
getI32(): number;
|
|
149
|
+
getU8nF64Bits(): bigint;
|
|
150
|
+
getU8n(): number;
|
|
151
|
+
getU16nF64Bits(): bigint;
|
|
152
|
+
getU16n(): number;
|
|
153
|
+
getF32Bits(): number;
|
|
154
|
+
getF32(): number;
|
|
155
|
+
getF64Bits(): bigint;
|
|
156
|
+
getF64(): number;
|
|
157
|
+
acquire(): Access;
|
|
158
|
+
/** Performs exactly one Core materialization call. */
|
|
159
|
+
materialize(): View;
|
|
160
|
+
private readU8;
|
|
161
|
+
private readU16;
|
|
162
|
+
private readU32;
|
|
163
|
+
private readU64;
|
|
164
|
+
private requireHandle;
|
|
165
|
+
}
|
|
166
|
+
export declare class Payload {
|
|
167
|
+
#private;
|
|
168
|
+
private constructor();
|
|
169
|
+
static [createPayload](handle: number, token: typeof payloadConstructionToken, keeper?: object): Payload;
|
|
170
|
+
static openCopy(spec: CompiledSpec, source: Uint8Array, options?: OpenOptions): Payload;
|
|
171
|
+
static openWasmOwned(spec: CompiledSpec, source: WasmOwnedBytes, options?: OpenOptions): Payload;
|
|
172
|
+
clone(): Payload;
|
|
173
|
+
dispose(): void;
|
|
174
|
+
requireSpecSha256(expectedSha256: Uint8Array): void;
|
|
175
|
+
sha256(): Uint8Array;
|
|
176
|
+
profile(): Profile;
|
|
177
|
+
executionReport(): ExecutionReport;
|
|
178
|
+
binaryBytes(): Uint8Array;
|
|
179
|
+
acquire(): Access;
|
|
180
|
+
entryView(entryIndex: number): View;
|
|
181
|
+
/**
|
|
182
|
+
* Invalidates synchronously after all access pins have been disposed.
|
|
183
|
+
* The official Wasm host is single-threaded, so retaining an Access here
|
|
184
|
+
* would prevent Core's drain from completing.
|
|
185
|
+
*/
|
|
186
|
+
invalidate(): void;
|
|
187
|
+
private requireHandle;
|
|
188
|
+
}
|
|
189
|
+
export declare class BuildResult {
|
|
190
|
+
readonly payload: Payload;
|
|
191
|
+
readonly report: ExecutionReport;
|
|
192
|
+
constructor(payload: Payload, report: ExecutionReport);
|
|
193
|
+
}
|
|
194
|
+
export declare function executePlan(plan: BuildPlan, policy: BuildPolicy, backing?: WasmMemoryBacking): BuildResult;
|
|
195
|
+
export {};
|