Inner StoreClient to delegate data calls to
Subset of Store management methods to delegate to; the wrapper fills in whatever is missing
Wraps every standalone StoreClient call and the body of execute,
typically a backend transaction primitive (for example, graph.execute for a SPARQL connector) responsible for
atomic commit and rollback. The wrapper StoreClient passed to the user task does NOT re-enter the opt; it relies
on the outer wrap so cross-call isolation works as expected. The task receives a per-call scope StoreClient,
and every delegated call within the wrap routes through scope (mirroring the Store.execute contract),
letting the wrapper install per-call state such as a freshly-bound graph buffer without leaking it across
concurrent invocations. Defaults to a deferred identity (task => Promise.resolve().then(() => task(store)));
user-supplied wrappers MUST pass a per-call scope StoreClient to task and MUST convert synchronous throws
from task into promise rejections to preserve the unified Store error channel; the lookup path delegates
directly to the wrapper and provides no additional guard
Registers each observer with the delegate as well as locally, combining the two unsubscribe handles so a single detach call releases both; this is how storage-level events (mutations from other clients sharing the backend) reach the wrapper's local observers. Absent by default
Exposed verbatim on the returned store. Defaults to a resolved no-op
An immutable Store composing store with the supplied management opts
Manages mutation events, transactional execution, and lifecycle for a bare StoreClient, exposing it as a full Store.
This lets a connector implement only the StoreClient data surface and obtain mutation events, transactional execution, and lifecycle for free: supply nothing and the wrapper provides working defaults, or hand it backend primitives through
managementto back any ofexecute,observe, orclose.Each standalone mutation call and each execute call accumulates its own batch of mutation signals and delivers a single filtered event to each matching registered observer when the call resolves; if it rejects, pending signals are discarded and no observers are notified. Both synchronous throws and asynchronous rejections from observers are caught and silently ignored so that one faulty observer cannot break delivery to others.
Any of the Store management methods may be supplied through
managementto delegate to an inner implementation; the wrapper fills in whatever is missing.All errors —
RangeError, TraceError, Problem — propagate as promise rejections per the unified Store error channel.Transaction Isolation —
Noneby default: the built-inexecuteis a deferred identity that applies each call directly, with no write buffering and no rollback. When anexecuteopt is supplied throughmanagement, the level is determined by that wrapper (typically a backend transaction primitive).Mutation Events — emits in-process observer events: each standalone mutation and each execute call delivers a single filtered batch to matching observers on resolve, and none on rejection. Cross-client signals reach local observers only when a backend-bridging
observeopt is supplied throughmanagement.