import { createCauslWasm } from '@causl/causl-wasm-ts/wasm'
const graph = await createCauslWasm()
const a = graph.input('a', 1)
graph.commit('set', (tx) => tx.set(a, 2)) // a === 2
WasmEngineUnavailableError when the wasm path cannot be
resolved on this host. #280 removed the { fallbackToTs: true } soft path:
there is no second engine to degrade to, and one that DISAGREES with the
primary (#272) is worse than none.
Async wasm-engine factory — the
@causl/causl-wasm-ts/wasmmember of the package's TWO adopter-facing graph factories:createCauslWasm()(async, this one) andcreateCausl()(sync, the main barrel's headline factory, which reaches THIS SAME engine through thesrc/wasm-registry.tsslot and throws when it cannot). Returns a public seven-methodGraphwhose commit / read / subscribe / derived-compute run through the wasm backend for the resolved bridge.causl/causl-wasm-ts#363 — this paragraph described a 0.4.x "engine trio" in which a TypeScript factory sat beside
createCauslWasm()andcreateCausl()was a sync wrapper around it.createCausl()stopped wrapping anything at #280 (it is construct-the-wasm-engine-or-throw), the TypeScript factory left the public barrel at epic #31 / issue #34, and #279 slice S12 deleted the engine behind it. There is no trio and no engine choice: there is one engine, reached synchronously or asynchronously.Shipped: the returned
Graphruns over the REAL Rust engine via the FFI bridge — the epic-B#32loader port (artefact loader + true compile/instantiate split) has LANDED, and every adopter operation resolves from Rust (§18A.3 lift, causl/causl-core-rs#170).§18A.12 — the factory is expressed as
preload ∘ sync: ONE instantiate codepath, provably equal topreloadCauslWasm(); createCauslWasmSync(), zero drift. The async preloadCauslWasm resolves the artefact + per-graph backend params (the ONE async seam — the realWebAssembly.compile); the synchronous createCauslWasmSync instantiates and builds theGraphwith ZERO await. The signature is back-compat-shaped against the rest of the trio so callers keep awaiting it.TWO BAGS, both read (causl/causl-wasm-ts#363, causl/causl-wasm-ts#411). This is the only factory that takes a loader bag AND a nested
create: CreateCauslOptions. Three options are declared by both (commitHistoryCap,snapshotRetentionCap,batchedFlush) and are accepted in EITHER; when both name one,createwins PER FIELD and a field it omits inherits the loader bag's value. Everything else belongs to exactly one bag:bridge/wasmBaseUrl/fetch/computeImportsUrl/graphName(the wasm backend's engine-side graph name) to the loader bag, andname(the IRgraphIdthe graph closure stamps) plus the rest ofCreateCauslOptionstocreate.