space-data-module-sdk 0.10.0 → 0.10.2

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.
@@ -5,7 +5,7 @@
5
5
  <link rel="stylesheet" href="./assets/sdn-chrome/sdn-chrome.css" />
6
6
  <script src="./assets/sdn-chrome/sdn-chrome.js"></script>
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1" />
8
- <meta name="description" content="The SDK uses FlatSQL 3.12.0, one public API and one flatsql/flatsql.wasm" />
8
+ <meta name="description" content="The SDK uses FlatSQL 3.12, one public API and one flatsql/flatsql.wasm" />
9
9
  <title>FlatSQL host contract — Space Data Module SDK</title>
10
10
  <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'><defs><linearGradient id='t' gradientUnits='userSpaceOnUse' x1='16' y1='29' x2='16' y2='3'><stop offset='0' stop-color='%23f5a524' stop-opacity='0'/><stop offset='.55' stop-color='%23f5a524' stop-opacity='.55'/><stop offset='1' stop-color='%23f5a524'/></linearGradient></defs><circle cx='16' cy='16' r='13' stroke='%23f5f5f7' stroke-width='1.6' opacity='.3'/><path d='M16 29A13 13 0 0 1 16 3' stroke='url(%23t)' stroke-width='2.2' stroke-linecap='round'/><path d='M16 10.2L10.4 20.1H21.6Z' stroke='%23f5f5f7' stroke-width='1.6' stroke-linejoin='round'/><circle cx='16' cy='10.2' r='2.6' fill='%23f5f5f7'/><circle cx='10.4' cy='20.1' r='2.6' fill='%23f5f5f7'/><circle cx='21.6' cy='20.1' r='2.6' fill='%23f5f5f7'/><circle cx='16' cy='3' r='2.5' fill='%23f5a524'/></svg>" />
11
11
  <link rel="stylesheet" href="./styles.css" />
@@ -95,7 +95,7 @@
95
95
  </nav>
96
96
  <main class="doc" id="main">
97
97
  <h1>FlatSQL host contract</h1>
98
- <p>The SDK uses <strong>FlatSQL 3.12.0</strong>, one public API and one <code>flatsql/flatsql.wasm</code> artifact across Node, browsers and native WASI hosts. The runtime store uses <code>FlatSQL.open</code>, binary schema registration, native record ingestion and SDS QRP queries. All operations are asynchronous.</p>
98
+ <p>The SDK uses <strong>FlatSQL 3.12</strong>, one public API and one <code>flatsql/flatsql.wasm</code> artifact across Node, browsers and native WASI hosts. The runtime store uses <code>FlatSQL.open</code>, binary schema registration, native record ingestion and SDS QRP queries. All operations are asynchronous.</p>
99
99
  <h2 id="binary-boundary"><a class="anchor" href="#binary-boundary" aria-hidden="true">#</a>Binary boundary</h2>
100
100
  <p>Register canonical SDS BFBS schemas before ingesting records. Records are size-prefixed FlatBuffers; queries and projected results use SDS QRP. Geometry uses SDS GJN. Schema compilation, JSON/GeoJSON conversion and presentation run outside the engine, using <code>flatc-wasm</code> or generated SDS bindings.</p>
101
101
  <p>The SDK provides <code>encodeFlatSqlQuery</code> and <code>decodeFlatSqlResult</code> as caller-side QRP helpers. <code>createFlatSqlRuntimeStore</code> owns native row identities, and <code>createFlatBufferStreamIngestor</code> supplies ordered, backpressured ingestion. Await <code>pushBytes</code>, <code>finish</code>, all row-store calls and <code>close</code>.</p>
@@ -1,6 +1,6 @@
1
1
  # The unified FlatSQL host contract
2
2
 
3
- The SDK uses **FlatSQL 3.12.0**, one public API and one `flatsql/flatsql.wasm`
3
+ The SDK uses **FlatSQL 3.12**, one public API and one `flatsql/flatsql.wasm`
4
4
  artifact across Node, browsers and native WASI hosts. The runtime store uses
5
5
  `FlatSQL.open`, binary schema registration, native record ingestion and SDS QRP
6
6
  queries. All operations are asynchronous.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "space-data-module-sdk",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Module SDK for building, validating, signing, and deploying WebAssembly modules on the Space Data Network.",
6
6
  "type": "module",
@@ -93,7 +93,7 @@
93
93
  ],
94
94
  "scripts": {
95
95
  "test": "node scripts/flatsql-release-e2e.mjs",
96
- "test:host-surfaces": "node --test test/node-host.test.js test/host-abi.test.js test/browser-host.test.js test/browser-module-harness.test.js test/testing-harness.test.js",
96
+ "test:host-surfaces": "node --test test/node-host.test.js test/host-abi.test.js test/browser-host.test.js test/browser-module-harness.test.js test/testing-harness.test.js test/browser-owner-tls.test.js",
97
97
  "test:runtime-matrix": "SPACE_DATA_MODULE_SDK_ENABLE_RUNTIME_MATRIX=1 node --test test/runtime-matrix.test.js",
98
98
  "test:parity": "node --test test/parity-harness.test.js",
99
99
  "test:parity-tri-lane": "SPACE_DATA_MODULE_SDK_ENABLE_TRI_RUNTIME_PARITY=1 node --test test/parity-tri-lane.test.js",
@@ -128,10 +128,10 @@
128
128
  "dependencies": {
129
129
  "flatbuffers": "^25.9.23",
130
130
  "flatc-wasm": "^26.1.32",
131
- "flatsql": "3.12.0",
131
+ "flatsql": "3.12.1",
132
132
  "hd-wallet-wasm": "2.2.2",
133
133
  "sdn-emception": "1.0.0",
134
- "spacedatastandards.org": "1.261.0"
134
+ "spacedatastandards.org": "1.279.0"
135
135
  },
136
136
  "devDependencies": {
137
137
  "esbuild": "^0.28.0",
@@ -378,30 +378,10 @@ async function instantiateBrowserModule(options = {}) {
378
378
  "wasi-threads module imports wasi.thread-spawn but no shared imported memory is available.",
379
379
  );
380
380
  }
381
- threadHost = await createWasiThreadSpawn({
382
- wasmModule: options.wasmModule,
383
- memory: providedMemory,
384
- processState,
385
- // Browser warm-pool sizing: cap pooled workers at how many guest threads
386
- // the module will actually ask for. Ignored by the Node lazy path.
387
- requestedThreads: options.maxThreads,
388
- poolSize: options.wasiThreadPoolSize,
389
- hostcallChannel: options.threadHostcallChannel,
390
- requiresHostcalls: needsHostBridge,
391
- enableBrowserThreads: options.enableBrowserWasiThreads,
392
- // Explicit worker anchor for BUNDLED consumers: when this host source is
393
- // bundled into an engine artifact, `import.meta.url` inside the SDK host
394
- // points at the bundle and the sibling worker asset 404s. A host shim
395
- // passes the directory its build actually serves the SDK host chain from
396
- // (e.g. OrbPro: `js/vendor/space-data-module-sdk/src/host/`). Unset =
397
- // packaged sibling, i.e. today's unbundled behavior.
398
- browserWorkerBaseUrl: options.wasiThreadWorkerBaseUrl,
399
- browserWorkerUrl: options.wasiThreadWorkerUrl,
400
- spawnWaitMs: options.wasiThreadSpawnWaitMs,
401
- });
381
+
402
382
  importObject.wasi = {
403
383
  ...(importObject.wasi ?? {}),
404
- "thread-spawn": threadHost.threadSpawn,
384
+ "thread-spawn": (...args) => threadHost.threadSpawn(...args),
405
385
  };
406
386
  }
407
387
 
@@ -437,6 +417,32 @@ async function instantiateBrowserModule(options = {}) {
437
417
  }
438
418
  wasi.setMemory(memory);
439
419
  }
420
+ // Instantiate the owner before secondary instances can initialize shared
421
+ // memory. The WASI startup winner establishes the owner's TLS base.
422
+ // Constructors run after the pool is ready so they can spawn threads.
423
+ if (isThreaded) {
424
+ threadHost = await createWasiThreadSpawn({
425
+ wasmModule: options.wasmModule,
426
+ memory: providedMemory,
427
+ processState,
428
+ // Browser warm-pool sizing: cap pooled workers at how many guest threads
429
+ // the module will actually ask for. Ignored by the Node lazy path.
430
+ requestedThreads: options.maxThreads,
431
+ poolSize: options.wasiThreadPoolSize,
432
+ hostcallChannel: options.threadHostcallChannel,
433
+ requiresHostcalls: needsHostBridge,
434
+ enableBrowserThreads: options.enableBrowserWasiThreads,
435
+ // Explicit worker anchor for BUNDLED consumers: when this host source is
436
+ // bundled into an engine artifact, `import.meta.url` inside the SDK host
437
+ // points at the bundle and the sibling worker asset 404s. A host shim
438
+ // passes the directory its build actually serves the SDK host chain from
439
+ // (e.g. OrbPro: `js/vendor/space-data-module-sdk/src/host/`). Unset =
440
+ // packaged sibling, i.e. today's unbundled behavior.
441
+ browserWorkerBaseUrl: options.wasiThreadWorkerBaseUrl,
442
+ browserWorkerUrl: options.wasiThreadWorkerUrl,
443
+ spawnWaitMs: options.wasiThreadSpawnWaitMs,
444
+ });
445
+ }
440
446
  initializeInstance(instance, options.directSurface === true);
441
447
  } catch (error) {
442
448
  await threadHost?.terminateAll();