- 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.2.1)
Installation
@siax:registry=https://git.siax.app/api/packages/admin/npm/npm install @siax/[email protected]"@siax/geo-client": "0.2.1"About this package
@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.
Dependencies
Dependencies
| ID | Version |
|---|---|
| @duckdb/duckdb-wasm | 1.33.1-dev65.0 |
| @siax/geo | 0.6.0 |
| apache-arrow | 17.0.0 |
Development Dependencies
| ID | Version |
|---|---|
| typescript | ^5.7.2 |