@metreeca/keep
    Preparing search index...

    Function createManagingStore

    • Manages mutation events, transactional execution, and lifecycle for a connector's StoreClient, exposing it as a full Store.

      A connector can implement only the StoreClient data surface and still offer the full Store contract. The connector supplies its transaction primitive through management.execute, which hands the connector's StoreClient to every data call. The option is required, since only the connector knows what atomicity its backend can provide. Backend primitives supplied through management may also back observe or close, and the wrapper fills in whatever is missing.

      Each standalone mutation call and each execute call delivers a single filtered event to each matching observer once the call resolves. If the call rejects, its pending events are discarded and no observer is notified. Synchronous throws and asynchronous rejections from observers are caught and silently ignored, so one faulty observer cannot break delivery to others.

      All errors, including RangeError, TraceError and Problem, propagate as promise rejections, in line with the unified Store error channel.

      Important

      Transaction Isolation — Determined by the supplied execute option, typically through a backend transaction primitive: the wrapper adds neither isolation nor atomicity of its own.

      Important

      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. Mutations made by other clients reach local observers only if a backend-bridging observe option is supplied through management.

      Parameters

      • management: {
            observe?: (
                observer: StoreObserver,
                resources?: Some<string>,
            ) => () => void;
            execute: <V>(task: (store: StoreClient) => Awaitable<V>) => Promise<V>;
            close?: () => Promise<void>;
        }

        Store management methods backed by the connector: execute is required, and the wrapper fills in whatever else is missing

        • Optional Readonlyobserve?: (observer: StoreObserver, resources?: Some<string>) => () => void

          Backend registration for storage-level events, such as mutations made by other clients sharing the backend. Each observer is registered both with this option and locally, and a single detach call releases both registrations. The resource filter always arrives as an array of references, or as undefined for an unfiltered registration, so the option never has to handle bare references or single-pass iterables. Absent by default

        • Readonlyexecute: <V>(task: (store: StoreClient) => Awaitable<V>) => Promise<V>

          Transaction wrapper applied to every standalone StoreClient call and to the body of each execute call, typically a backend transaction primitive (for example, graph.execute for a SPARQL connector) responsible for atomic commit and rollback. A backend with no transaction primitive supplies a wrapper applying the task directly to its StoreClient, and declares on its factory that a failing task neither rolls back nor isolates its mutations. The option MUST call each task it receives with a scope StoreClient dedicated to that call, so per-call state, such as a freshly bound graph buffer, never leaks across concurrent invocations; every data call within the transaction is routed through scope. Calls made by a user task inside execute do not open further transactions: they share the outer one. The option MUST convert synchronous throws from the task into promise rejections, to preserve the unified Store error channel: lookups are routed through it with no additional guard

        • Optional Readonlyclose?: () => Promise<void>

          Exposed as is on the returned store. Defaults to a resolved no-op

      Returns Store

      An immutable Store serving data calls through the supplied management opts