§18A.12 — options accepted by preloadCauslWasm / createCauslWasm / loadAuthoritativeWasm.

Extends WasmBackendOptions (bridge / wasmBaseUrl / fetch / graphName / batchedFlush / retention caps) with computeImportsUrl — the #32 loader port landed, so the artefact + snippet resolution paths are real.

#280 removed the two soft-path opt-ins this interface used to add (fallbackToTs and its fork alias fallbackToJs); see the note in the body.

interface AuthoritativeWasmOptions {
    batchedFlush?: BatchedFlushOptions;
    bridge?: BridgeId;
    commitHistoryCap?: number;
    computeImportsUrl?: string | URL;
    fetch?: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    };
    graphName?: string;
    snapshotRetentionCap?: number;
    wasmBaseUrl?: string;
}

Hierarchy (View Summary)

Properties

batchedFlush?: BatchedFlushOptions

C.4 (#1505) — per-graph batched-flush opt-in. Omitting this is byte-identical to dev b15069fa (the load-bearing C.4 acceptance property — no queue installed, pre-C.3 per-commit shadow path unchanged). When supplied, a BatchedFlush queue is installed on the returned backend with the configured afterN / intervalMs. Per-graph, not global (option-c doc §2.3). No adopter-visible perf change at v1.x even when opted in — the JS engine remains SSOT; scaffolding for a future v2.x Rust-SSOT cutover.

bridge?: BridgeId

Override the bridge picker. Defaults to detectBridge() — probes the host and picks the fastest supported artifact.

Adopters with a known target (e.g. internal Node 24 service with WasmGC) can pin a bridge to skip detection cost and shrink the build.

commitHistoryCap?: number

lift-readat (causl/causl-core-rs#170) — bound on the wrapped TS #graph's commit-history retention ring. Mirrors import('../src/types.js').CreateCauslOptions.commitHistoryCap. Threaded into the wrapped engine so the same-timeline TS oracle mirrors the Rust engine's retention window — load-bearing for the readAt / snapshotAt byte-identity invariant (the wrapped TS oracle vs the rust-ssot Rust extern on the IDENTICAL seed-inclusive commit timeline). Omitting it keeps the pre-lift-readat default (cap 0 — dead retention).

causl/causl-wasm-ts#411: on createCauslWasm this bag is one of TWO that accept the cap, and BOTH are read. The inner create: CreateCauslOptions bag wins per field; a field only this bag names is inherited. So createCauslWasm({ create: { commitHistoryCap: 1000 } }) is a graph WITH retention, and { commitHistoryCap: 1000, create: { commitHistoryCap: 3 } } is a graph with a cap of 3. preloadCauslWasm accepts the cap here only (it has no create bag) and BAKES it for the sync factory's boot inheritance.

computeImportsUrl?: string | URL

WIRE (epic #31 / issue #32) — explicit URL of the causl-compute-imports.js snippet module. When omitted the factory resolves it relative to the wasm artefact's directory by scanning <bridge>/snippets/<hash>/ (the wasm-pack bundler-target layout). Supply this when your bundler emits the snippet at a known asset URL.

fetch?: {
    (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
    (input: string | URL | Request, init?: RequestInit): Promise<Response>;
}

fetch override for non-browser/non-Node environments (Cloudflare Workers, Deno without --allow-net, test harnesses). Defaults to the global fetch.

Type declaration

    • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
    • Parameters

      • input: URL | RequestInfo
      • Optionalinit: RequestInit

      Returns Promise<Response>

    • (input: string | URL | Request, init?: RequestInit): Promise<Response>
    • Parameters

      • input: string | URL | Request
      • Optionalinit: RequestInit

      Returns Promise<Response>

graphName?: string

Optional name passed through to the underlying engine when constructing the wrapped Graph. Used by the cross-backend determinism gate (#685) and the migration round-trip suite (#687): two backends must share a graphId for byte-equal IR comparison, and the gate works around it by threading the same name through both engines.

Defaults to '@causl/causl-wasm-ts/wasm:<bridge>' so unrelated callers cannot accidentally collide with a TS-engine instance that uses the default-minted name. Adopters who want migration between TS and WASM backends pass the same name to createCausl({ name }) and loadWasmBackend({ graphName: name }).

snapshotRetentionCap?: number

lift-readat (#170) — bound on the wrapped TS #graph's per-commit snapshot retention buffer (the readAt / snapshotAt window). Mirrors import('../src/types.js').CreateCauslOptions.snapshotRetentionCap. See commitHistoryCap, including which bags accept it on createCauslWasm and how the two merge (causl/causl-wasm-ts#411).

wasmBaseUrl?: string

Override the base URL the WASM artifact is fetched from.

Defaults to the package-relative URL resolved through the bundler's import.meta.url mechanism (works in webpack 5 + experiments.asyncWebAssembly, Vite 5 + vite-plugin-wasm, esbuild 0.20 + --loader:.wasm=file, and Node 22+ ESM).

Set this to an asset-server URL (e.g. https://assets.example.com/causl/<ver>/gc-classic-bundler/) when the host CSP connect-src directive forbids same-origin fetches of .wasm blobs. It must be an origin YOU serve: a public CDN is not available, because jsDelivr and unpkg mirror npmjs and this package is private to the Gitea registry. Copy the artefact out of node_modules/@causl/causl-wasm-ts/wasm-pkg/ at deploy time. Adopters MUST whitelist the chosen origin explicitly — the loader does not auto-fallback.