space-data-module-sdk 0.5.15 → 0.5.18
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 +24 -0
- package/package.json +8 -4
- package/schemas/HostStorageAbi.fbs +53 -0
- package/src/bundle/codec.js +1 -1
- package/src/compliance/pluginCompliance.js +1 -1
- package/src/generated/orbpro/invoke/plugin-invoke-request.js +1 -1
- package/src/generated/orbpro/invoke/plugin-invoke-response.js +1 -1
- package/src/generated/orbpro/manifest/accepted-type-set.js +1 -1
- package/src/generated/orbpro/manifest/build-artifact.js +1 -1
- package/src/generated/orbpro/manifest/host-capability.js +1 -1
- package/src/generated/orbpro/manifest/method-manifest.js +1 -1
- package/src/generated/orbpro/manifest/plugin-manifest.js +1 -1
- package/src/generated/orbpro/manifest/port-manifest.js +1 -1
- package/src/generated/orbpro/manifest/protocol-spec.js +1 -1
- package/src/generated/orbpro/manifest/timer-spec.js +1 -1
- package/src/generated/orbpro/module/canonicalization-rule.js +1 -1
- package/src/generated/orbpro/module/module-bundle-entry.js +1 -1
- package/src/generated/orbpro/module/module-bundle.js +1 -1
- package/src/generated/orbpro/stream/flat-buffer-type-ref.js +1 -1
- package/src/generated/orbpro/stream/typed-arena-buffer.js +1 -1
- package/src/index.d.ts +139 -0
- package/src/index.js +1 -0
- package/src/invoke/codec.js +1 -1
- package/src/manifest/codec.js +1 -1
- package/src/manifest/typeRefs.js +49 -12
- package/src/runtime-host/flatsqlRuntimeStore.js +217 -0
- package/src/runtime-host/index.js +21 -0
- package/src/runtime-host/moduleRegistry.js +92 -0
- package/src/runtime-host/runtimeRegionStore.js +245 -0
- package/src/testing/buildWasmEdgeRunner.js +41 -2
- package/src/testing/index.d.ts +123 -2
- package/src/testing/index.js +1 -0
- package/src/testing/moduleHarness.js +102 -1
- package/src/testing/native/wasmedge_emscripten_pthread_runner.c +2319 -209
- package/src/testing/processInvoke.js +250 -9
- package/src/testing/streamInvokeCodec.js +175 -0
- package/src/transport/records.js +19 -6
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ This repository is the source of truth for module-level concerns:
|
|
|
14
14
|
- the `sds.bundle` single-file container
|
|
15
15
|
- deployment authorization plus SDS publication records (`REC`, `PNM`, `ENC`)
|
|
16
16
|
- the first canonical module hostcall/import ABI surface
|
|
17
|
+
- the canonical runtime-host model for append-only standards rows, host-managed
|
|
18
|
+
runtime regions, and dynamic module installation/loading
|
|
17
19
|
- shared module-level testing/runtime harnesses, including the WasmEdge
|
|
18
20
|
process runner used by package-level validation suites
|
|
19
21
|
|
|
@@ -36,6 +38,28 @@ specific validation suites, including conjunction replay/V&V, are expected to
|
|
|
36
38
|
sit on top of these shared harnesses instead of defining their own runtime
|
|
37
39
|
process model.
|
|
38
40
|
|
|
41
|
+
## Canonical Runtime Host
|
|
42
|
+
|
|
43
|
+
The SDK now owns the durable runtime identity model used by OrbPro, browser and
|
|
44
|
+
server SDN hosts, and the evolving WasmEdge harness:
|
|
45
|
+
|
|
46
|
+
- standards rows are addressed only by `($SCHEMA_FILE_ID, rowId)`
|
|
47
|
+
- `rowId` is append-only and never reused
|
|
48
|
+
- aligned-binary runtime state is addressed only by `(regionId, recordIndex)`
|
|
49
|
+
- raw pointers remain internal execution details and are not durable APIs
|
|
50
|
+
|
|
51
|
+
The minimal host surface lives under `src/runtime-host/` and covers three
|
|
52
|
+
responsibilities:
|
|
53
|
+
|
|
54
|
+
- `createFlatSqlRuntimeStore()` for append-only row handles and row resolution
|
|
55
|
+
- `createRuntimeRegionStore()` for host-allocated aligned-binary regions and
|
|
56
|
+
externally backed record-view descriptors
|
|
57
|
+
- `createModuleRegistry()` for dynamic install/load/unload/invoke
|
|
58
|
+
|
|
59
|
+
`createRuntimeHost()` composes those stores into the canonical SDK host model.
|
|
60
|
+
OrbPro layers entity/view helpers on top of that host instead of inventing a
|
|
61
|
+
separate durable identity model.
|
|
62
|
+
|
|
39
63
|
## Module Artifact Model
|
|
40
64
|
|
|
41
65
|
A compliant module built with this SDK is always a valid `.wasm` artifact with:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "space-data-module-sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.18",
|
|
4
4
|
"description": "Module SDK for building, validating, signing, and deploying WebAssembly modules on the Space Data Network.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"./deployment": "./src/deployment/index.js",
|
|
32
32
|
"./invoke": "./src/invoke/index.js",
|
|
33
33
|
"./runtime": "./src/runtime/index.js",
|
|
34
|
+
"./runtime-host": {
|
|
35
|
+
"types": "./src/index.d.ts",
|
|
36
|
+
"default": "./src/runtime-host/index.js"
|
|
37
|
+
},
|
|
34
38
|
"./testing": "./src/testing/index.js",
|
|
35
39
|
"./standards": "./src/standards/index.js",
|
|
36
40
|
"./schemas/*": "./schemas/*"
|
|
@@ -50,15 +54,15 @@
|
|
|
50
54
|
"prepublishOnly": "npm test && npm run check:compliance"
|
|
51
55
|
},
|
|
52
56
|
"dependencies": {
|
|
53
|
-
"flatc-wasm": "25.12.19-wasm.43",
|
|
54
57
|
"flatbuffers": "^25.9.23",
|
|
58
|
+
"flatc-wasm": "25.12.19-wasm.43",
|
|
59
|
+
"flatsql": "^0.4.0",
|
|
55
60
|
"hd-wallet-wasm": "1.6.0",
|
|
56
61
|
"sdn-emception": "1.0.0",
|
|
57
62
|
"spacedatastandards.org": "git+https://github.com/DigitalArsenal/spacedatastandards.org.git#09af351a1"
|
|
58
63
|
},
|
|
59
64
|
"devDependencies": {
|
|
60
|
-
"express": "^4.21.2"
|
|
61
|
-
"flatsql": "^0.4.0"
|
|
65
|
+
"express": "^4.21.2"
|
|
62
66
|
},
|
|
63
67
|
"engines": {
|
|
64
68
|
"node": ">=20.0.0"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
namespace orbpro.hoststorage;
|
|
2
|
+
|
|
3
|
+
table RowHandle {
|
|
4
|
+
schema_file_id: string (required);
|
|
5
|
+
row_id: uint64;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
table RuntimeRegionRecord {
|
|
9
|
+
region_id: uint64;
|
|
10
|
+
record_index: uint32;
|
|
11
|
+
layout_id: string (required);
|
|
12
|
+
record_byte_length: uint32;
|
|
13
|
+
byte_length: uint32;
|
|
14
|
+
alignment: uint16 = 1;
|
|
15
|
+
bytes: [ubyte];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
table ResolveRowViewRequest {
|
|
19
|
+
handle: RowHandle;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
table ResolveRowViewResult {
|
|
23
|
+
handle: RowHandle;
|
|
24
|
+
found: bool = false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
table ResolveRegionRecordRequest {
|
|
28
|
+
region_id: uint64;
|
|
29
|
+
record_index: uint32;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
table ResolveRegionRecordResult {
|
|
33
|
+
record: RuntimeRegionRecord;
|
|
34
|
+
found: bool = false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
table AllocateRuntimeRegionRequest {
|
|
38
|
+
layout_id: string (required);
|
|
39
|
+
record_byte_length: uint32;
|
|
40
|
+
alignment: uint16 = 1;
|
|
41
|
+
initial_record_count: uint32;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
table AllocateRuntimeRegionResult {
|
|
45
|
+
region_id: uint64;
|
|
46
|
+
layout_id: string (required);
|
|
47
|
+
record_byte_length: uint32;
|
|
48
|
+
alignment: uint16 = 1;
|
|
49
|
+
record_count: uint32;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
root_type ResolveRowViewRequest;
|
|
53
|
+
file_identifier "HSTR";
|
package/src/bundle/codec.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { TypedArenaBuffer } from '../../orbpro/stream/typed-arena-buffer.js';
|
|
5
5
|
/**
|
|
6
6
|
* Canonical invoke envelope consumed by direct ABI and command-mode execution.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { TypedArenaBuffer } from '../../orbpro/stream/typed-arena-buffer.js';
|
|
5
5
|
/**
|
|
6
6
|
* Canonical invoke result emitted by direct ABI and command-mode execution.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers";
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { FlatBufferTypeRef, } from "../../orbpro/stream/flat-buffer-type-ref.js";
|
|
5
5
|
/**
|
|
6
6
|
* Accepted schema family for a port.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers";
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
/**
|
|
5
5
|
* Build artifact emitted by the plugin toolchain.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers";
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { CapabilityKind } from "../../orbpro/manifest/capability-kind.js";
|
|
5
5
|
/**
|
|
6
6
|
* One host capability dependency.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers";
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { DrainPolicy } from "../../orbpro/manifest/drain-policy.js";
|
|
5
5
|
import { PortManifest, } from "../../orbpro/manifest/port-manifest.js";
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { BuildArtifact } from '../../orbpro/manifest/build-artifact.js';
|
|
5
5
|
import { HostCapability } from '../../orbpro/manifest/host-capability.js';
|
|
6
6
|
import { MethodManifest } from '../../orbpro/manifest/method-manifest.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers";
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { AcceptedTypeSet, } from "../../orbpro/manifest/accepted-type-set.js";
|
|
5
5
|
/**
|
|
6
6
|
* One input or output port on a method.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers";
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
/**
|
|
5
5
|
* Protocol handler declared by a plugin.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers";
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
/**
|
|
5
5
|
* Timer entry declared by a plugin.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
/**
|
|
5
5
|
* Canonicalization rule applied before hashing or signature verification.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { ModuleBundleEntryRole } from '../../orbpro/module/module-bundle-entry-role.js';
|
|
5
5
|
import { ModulePayloadEncoding } from '../../orbpro/module/module-payload-encoding.js';
|
|
6
6
|
import { FlatBufferTypeRef } from '../../orbpro/stream/flat-buffer-type-ref.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { CanonicalizationRule } from '../../orbpro/module/canonicalization-rule.js';
|
|
5
5
|
import { ModuleBundleEntry } from '../../orbpro/module/module-bundle-entry.js';
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers";
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { PayloadWireFormat } from "../../orbpro/stream/payload-wire-format.js";
|
|
5
5
|
function normalizePayloadWireFormat(value) {
|
|
6
6
|
if (value === PayloadWireFormat.ALIGNED_BINARY) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
|
3
|
-
import * as flatbuffers from "flatbuffers";
|
|
3
|
+
import * as flatbuffers from "flatbuffers/mjs/flatbuffers.js";
|
|
4
4
|
import { BufferMutability } from "../../orbpro/stream/buffer-mutability.js";
|
|
5
5
|
import { BufferOwnership } from "../../orbpro/stream/buffer-ownership.js";
|
|
6
6
|
import { FlatBufferTypeRef, } from "../../orbpro/stream/flat-buffer-type-ref.js";
|
package/src/index.d.ts
CHANGED
|
@@ -258,6 +258,144 @@ export function loadComplianceConfig(
|
|
|
258
258
|
rootDirectory: string,
|
|
259
259
|
): Promise<{ path: string; config: Record<string, unknown> } | null>;
|
|
260
260
|
export function getWasmExportNames(wasmBytes: Uint8Array): string[];
|
|
261
|
+
|
|
262
|
+
// --- Runtime Host ---
|
|
263
|
+
|
|
264
|
+
export interface RowHandle {
|
|
265
|
+
schemaFileId: string;
|
|
266
|
+
rowId: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface RuntimeRowView {
|
|
270
|
+
handle: RowHandle;
|
|
271
|
+
payload: unknown;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface RuntimeRowQueryResult {
|
|
275
|
+
columns: string[];
|
|
276
|
+
rows: unknown[][];
|
|
277
|
+
rowCount: number;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface FlatSqlRuntimeStore {
|
|
281
|
+
appendRow(options: { schemaFileId: string; payload?: unknown }): RowHandle;
|
|
282
|
+
listRows(schemaFileId?: string | null): RuntimeRowView[];
|
|
283
|
+
query(sql: string): RuntimeRowQueryResult;
|
|
284
|
+
resolveRow(handle: RowHandle): RuntimeRowView | null;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export interface RuntimeRegionDescriptor {
|
|
288
|
+
regionId: number;
|
|
289
|
+
layoutId: string;
|
|
290
|
+
recordByteLength: number;
|
|
291
|
+
alignment: number;
|
|
292
|
+
recordCount: number;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface RuntimeRegionRecord {
|
|
296
|
+
regionId: number;
|
|
297
|
+
recordIndex: number;
|
|
298
|
+
layoutId: string;
|
|
299
|
+
recordByteLength: number;
|
|
300
|
+
alignment: number;
|
|
301
|
+
byteLength: number;
|
|
302
|
+
bytes: Uint8Array;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface RuntimeRegionExternalRecordView {
|
|
306
|
+
regionId: number;
|
|
307
|
+
recordIndex: number;
|
|
308
|
+
layoutId: string;
|
|
309
|
+
recordByteLength: number;
|
|
310
|
+
alignment: number;
|
|
311
|
+
byteOffset?: number;
|
|
312
|
+
buffer?: ArrayBufferLike;
|
|
313
|
+
elementType?: string;
|
|
314
|
+
elementCount?: number;
|
|
315
|
+
strideElements?: number;
|
|
316
|
+
[key: string]: unknown;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export interface RuntimeRegionRecordViewRequest {
|
|
320
|
+
regionId: number;
|
|
321
|
+
recordIndex: number;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export interface RuntimeRegionStore {
|
|
325
|
+
allocateRegion(options: {
|
|
326
|
+
layoutId: string;
|
|
327
|
+
recordByteLength: number;
|
|
328
|
+
alignment?: number;
|
|
329
|
+
initialRecords?: Array<Uint8Array | ArrayBuffer | ArrayBufferView | null | undefined>;
|
|
330
|
+
}): RuntimeRegionDescriptor;
|
|
331
|
+
registerExternalRegion(options: {
|
|
332
|
+
layoutId: string;
|
|
333
|
+
recordByteLength: number;
|
|
334
|
+
alignment?: number;
|
|
335
|
+
recordCount?: number;
|
|
336
|
+
getRecordCount?: (regionId: number) => number;
|
|
337
|
+
resolveRecordView?: (query: {
|
|
338
|
+
regionId: number;
|
|
339
|
+
recordIndex: number;
|
|
340
|
+
layoutId: string;
|
|
341
|
+
recordByteLength: number;
|
|
342
|
+
alignment: number;
|
|
343
|
+
}) =>
|
|
344
|
+
| Omit<
|
|
345
|
+
RuntimeRegionExternalRecordView,
|
|
346
|
+
"regionId" | "recordIndex" | "layoutId" | "recordByteLength" | "alignment"
|
|
347
|
+
>
|
|
348
|
+
| null
|
|
349
|
+
| undefined;
|
|
350
|
+
}): RuntimeRegionDescriptor;
|
|
351
|
+
setRegionRecordCount(regionId: number, recordCount: number): RuntimeRegionDescriptor | null;
|
|
352
|
+
describeRegion(regionId: number): RuntimeRegionDescriptor | null;
|
|
353
|
+
resolveRecord(options: RuntimeRegionRecordViewRequest): RuntimeRegionRecord | null;
|
|
354
|
+
resolveRecordView(
|
|
355
|
+
options: RuntimeRegionRecordViewRequest,
|
|
356
|
+
): RuntimeRegionRecord | RuntimeRegionExternalRecordView | null;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export interface InstalledRuntimeModule {
|
|
360
|
+
moduleId: string;
|
|
361
|
+
metadata: unknown;
|
|
362
|
+
methodIds: string[];
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export interface RuntimeModuleRegistry {
|
|
366
|
+
installModule(definition: {
|
|
367
|
+
moduleId: string;
|
|
368
|
+
methods?: Record<string, (...args: unknown[]) => unknown>;
|
|
369
|
+
metadata?: unknown;
|
|
370
|
+
}): InstalledRuntimeModule;
|
|
371
|
+
invokeModule(
|
|
372
|
+
moduleId: string,
|
|
373
|
+
methodId: string,
|
|
374
|
+
...args: unknown[]
|
|
375
|
+
): Promise<unknown>;
|
|
376
|
+
listModules(): InstalledRuntimeModule[];
|
|
377
|
+
loadModule(moduleId: string): {
|
|
378
|
+
moduleId: string;
|
|
379
|
+
methods: Record<string, (...args: unknown[]) => unknown>;
|
|
380
|
+
metadata: unknown;
|
|
381
|
+
} | null;
|
|
382
|
+
unloadModule(moduleId: string): boolean;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export interface RuntimeHost {
|
|
386
|
+
rows: FlatSqlRuntimeStore;
|
|
387
|
+
regions: RuntimeRegionStore;
|
|
388
|
+
moduleRegistry: RuntimeModuleRegistry;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export function createFlatSqlRuntimeStore(): FlatSqlRuntimeStore;
|
|
392
|
+
export function createRuntimeRegionStore(): RuntimeRegionStore;
|
|
393
|
+
export function createModuleRegistry(): RuntimeModuleRegistry;
|
|
394
|
+
export function createRuntimeHost(options?: {
|
|
395
|
+
rows?: FlatSqlRuntimeStore;
|
|
396
|
+
regions?: RuntimeRegionStore;
|
|
397
|
+
moduleRegistry?: RuntimeModuleRegistry;
|
|
398
|
+
}): RuntimeHost;
|
|
261
399
|
export function getWasmExportNamesFromFile(wasmPath: string): Promise<string[]>;
|
|
262
400
|
|
|
263
401
|
// --- Auth ---
|
|
@@ -678,6 +816,7 @@ export {
|
|
|
678
816
|
createPublicationProtectionDemoSummary,
|
|
679
817
|
createModuleHarness,
|
|
680
818
|
createPluginInvokeProcessClient,
|
|
819
|
+
createWasmEdgeStreamProcessClient,
|
|
681
820
|
describeCapabilityRuntimeSurface,
|
|
682
821
|
generateManifestHarnessPlan,
|
|
683
822
|
materializeHarnessScenario,
|
package/src/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./bundle/index.js";
|
|
|
7
7
|
export * from "./capabilities.js";
|
|
8
8
|
export * from "./standards/index.js";
|
|
9
9
|
export * from "./host/index.js";
|
|
10
|
+
export * from "./runtime-host/index.js";
|
|
10
11
|
export * from "./invoke/index.js";
|
|
11
12
|
export * from "./testing/index.js";
|
|
12
13
|
export * from "./deployment/index.js";
|
package/src/invoke/codec.js
CHANGED
package/src/manifest/codec.js
CHANGED
package/src/manifest/typeRefs.js
CHANGED
|
@@ -1,31 +1,62 @@
|
|
|
1
1
|
function cloneSchemaHash(value) {
|
|
2
2
|
if (value instanceof Uint8Array) {
|
|
3
|
-
return new Uint8Array(value);
|
|
3
|
+
return value.byteLength > 0 ? new Uint8Array(value) : undefined;
|
|
4
4
|
}
|
|
5
5
|
if (Array.isArray(value)) {
|
|
6
|
-
return [...value];
|
|
6
|
+
return value.length > 0 ? [...value] : undefined;
|
|
7
7
|
}
|
|
8
8
|
return value ?? undefined;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
function normalizeNullableString(value) {
|
|
12
|
+
if (value === undefined || value === null) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const normalized = String(value).trim();
|
|
16
|
+
return normalized.length > 0 ? normalized : null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function normalizeAlignedMetadataScalar(value) {
|
|
20
|
+
if (value === undefined || value === null || value === "") {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const numeric = Number(value);
|
|
24
|
+
if (Number.isFinite(numeric)) {
|
|
25
|
+
return numeric === 0 ? undefined : numeric;
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
|
|
11
30
|
export function clonePayloadTypeRef(value = null) {
|
|
12
31
|
if (!value || typeof value !== "object") {
|
|
13
|
-
return { acceptsAnyFlatbuffer: true };
|
|
32
|
+
return { acceptsAnyFlatbuffer: true, fileIdentifier: null };
|
|
14
33
|
}
|
|
15
34
|
return {
|
|
16
|
-
schemaName:
|
|
17
|
-
|
|
35
|
+
schemaName: normalizeNullableString(
|
|
36
|
+
value.schemaName ?? value.schema_name,
|
|
37
|
+
),
|
|
38
|
+
fileIdentifier: normalizeNullableString(
|
|
39
|
+
value.fileIdentifier ?? value.file_identifier,
|
|
40
|
+
),
|
|
18
41
|
schemaHash: cloneSchemaHash(value.schemaHash ?? value.schema_hash),
|
|
19
42
|
acceptsAnyFlatbuffer: Boolean(
|
|
20
43
|
value.acceptsAnyFlatbuffer ?? value.accepts_any_flatbuffer ?? false,
|
|
21
44
|
),
|
|
22
|
-
wireFormat:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
wireFormat: normalizePayloadWireFormatName(
|
|
46
|
+
value.wireFormat ?? value.wire_format,
|
|
47
|
+
),
|
|
48
|
+
rootTypeName: normalizeNullableString(
|
|
49
|
+
value.rootTypeName ?? value.root_type_name,
|
|
50
|
+
),
|
|
51
|
+
fixedStringLength: normalizeAlignedMetadataScalar(
|
|
52
|
+
value.fixedStringLength ?? value.fixed_string_length,
|
|
53
|
+
),
|
|
54
|
+
byteLength: normalizeAlignedMetadataScalar(
|
|
55
|
+
value.byteLength ?? value.byte_length,
|
|
56
|
+
),
|
|
57
|
+
requiredAlignment: normalizeAlignedMetadataScalar(
|
|
58
|
+
value.requiredAlignment ?? value.required_alignment,
|
|
59
|
+
),
|
|
29
60
|
};
|
|
30
61
|
}
|
|
31
62
|
|
|
@@ -33,6 +64,12 @@ export function normalizePayloadWireFormatName(value) {
|
|
|
33
64
|
if (value === undefined || value === null || value === "") {
|
|
34
65
|
return null;
|
|
35
66
|
}
|
|
67
|
+
if (value === 1 || value === "1") {
|
|
68
|
+
return "aligned-binary";
|
|
69
|
+
}
|
|
70
|
+
if (value === 0 || value === "0") {
|
|
71
|
+
return "flatbuffer";
|
|
72
|
+
}
|
|
36
73
|
const normalized = String(value).trim().toLowerCase().replace(/_/g, "-");
|
|
37
74
|
if (normalized === "aligned-binary") {
|
|
38
75
|
return "aligned-binary";
|