Simon Axelsson admin
  • https://siax.io
  • Process optimisation, operational improvement and automation. Founder of SIAX Technology AB. Business workflows, data, BI and system integration.

  • Joined on 2026-07-02

@siax/geo-client (0.3.5)

Published 2026-11-11 16:26:17 +00:00 by admin

Installation

@siax:registry=https://git.siax.app/api/packages/admin/npm/
npm install @siax/[email protected]
"@siax/geo-client": "0.3.5"

About this package

Browser analysis client behind @siax/geo execution contracts (Wave 12 Lane C) — DuckDB-Wasm worker lifecycle, browser capability detection, client/server execution policy, ST0RE presigned-read flow, chunked streaming with memory budget. Heavy engine deps stay injectable: the DuckDB-Wasm adapter is opt-in and a server-fallback driver ships by default.

@siax/geo-client

Browser analysis behind the shared @siax/geo execution policy. The worker and DuckDB-Wasm engine are optional and load only for a client decision.

Run DuckDB-Wasm in a browser

The application provides a dedicated worker entry and hosts DuckDB's worker scripts and Wasm modules. Copy the matching files from the installed @duckdb/duckdb-wasm/dist/ version into the application's static asset directory. Keep the MVP and EH variants together so selectBundle() can choose the supported browser variant.

// analysis.worker.js — bundled as a dedicated worker by the host application
import { createAnalysisWorkerHandler, createDuckDbWasmEngine } from '@siax/geo-client/worker';

const asset = (name) => new URL(`/duckdb/${name}`, self.location.origin).href;
self.onmessage = createAnalysisWorkerHandler({
  engineFactory: () => createDuckDbWasmEngine({
    bundles: {
      mvp: {
        mainModule: asset('duckdb-mvp.wasm'),
        mainWorker: asset('duckdb-browser-mvp.worker.js'),
      },
      eh: {
        mainModule: asset('duckdb-eh.wasm'),
        mainWorker: asset('duckdb-browser-eh.worker.js'),
      },
    },
  }),
});

The UI passes workerFactory: () => new Worker(new URL('./analysis.worker.js', import.meta.url), { type: 'module' }) to createAnalysisWorker() or a shared consumer such as @siax/maps's createSpatialAnalysisSession(). Call resolveExecutionEngine() first and create a client session only when it returns CLIENT. Route SERVER and SERVER_REQUIRED through the product's server endpoint. On worker or Wasm failure, use fallbackDecisionFor() and show the resulting reason code; package publication alone does not wire a server fallback into a product.

The default engine bundle source is jsDelivr. Explicit same-origin bundles are required when the product's Content Security Policy permits only its own scripts or when private assets cannot be sent to a CDN. The host should allow its dedicated worker and blob worker bootstrap (worker-src 'self' blob:), Wasm compilation (script-src 'self' 'wasm-unsafe-eval'), and same-origin fetches for the selected worker script and Wasm asset. A CSP without wasm-unsafe-eval can fetch both assets successfully while initialization still times out.

For data queries, send a ColumnarBatch in request.datasets and a positive budgetBytes limit. The worker replaces each named table before the query, casts imported columns to the declared batch schema, and drops its temporary virtual JSON file afterward. Dataset names and column names must be SQL-safe identifiers. The result budget rejects an oversized result with oom_budget before it is sent to the UI; the host should also use the execution policy's input-size and estimated-result limits because the engine materializes a query result before this result budget is checked.

Dependencies

Dependencies

ID Version
@duckdb/duckdb-wasm 1.33.1-dev65.0
@siax/geo 0.9.1
apache-arrow 17.0.0

Development Dependencies

ID Version
typescript ^5.7.2
Details
npm
2026-11-11 16:26:17 +00:00
2
MIT
latest
23 KiB
Assets (1)
Versions (7) View all
0.3.5 2026-11-11
0.3.4 2026-11-11
0.3.3 2026-11-11
0.3.2 2026-11-11
0.2.4 2026-11-11