@metreeca/keep
    Preparing search index...

    Request-submission surface over the batching handlers.

    Routes each request (detection, detail, selection, modification) to the handler for its type. Each call queues the request for the next batch and returns a promise that settles with its result. Handlers receive a broker to hand nested work to a sibling handler.

    type Broker = {
        detect(request: Detect): Promise<boolean>;
        detail<S extends Lazy<ResourceShape>, T extends Template>(
            request: Detail<T, S>,
        ): Promise<Match<S, T>>;
        select<T extends Query<Slot>>(
            request: Select<T>,
        ): Promise<readonly Value[]>;
        modify(request: Modify): Promise<string>;
    }
    Index

    Methods

    • Enqueue a Detect request.

      Parameters

      • request: Detect

        The entry to probe

      Returns Promise<boolean>

      A promise resolving to true when the request's entry exists in the store; false otherwise

    • Enqueue a Detail request.

      Carries no existence precondition: an entry with no stored state resolves to an empty instance of the request's model rather than rejecting.

      Type Parameters

      • S extends Lazy<ResourceShape>
      • T extends Template

      Parameters

      • request: Detail<T, S>

        The resource and model to materialise

      Returns Promise<Match<S, T>>

      A promise resolving to the resource materialised against the request's model, settled once the owning batch and any nested requests needed to assemble it have resolved

    • Enqueue a Select request.

      Carries no existence precondition: an entry with no matching members resolves to an empty collection rather than rejecting.

      Type Parameters

      • T extends Query<Slot>

      Parameters

      • request: Select<T>

        The property and query to materialise

      Returns Promise<readonly Value[]>

      A promise resolving to the values the collection holds as the request's query narrows them, items for a template and rows for a projection, settled once the owning batch and any nested requests needed to assemble them have resolved

    • Enqueue a Modify request.

      Mutates unconditionally, with no existence precondition. A present state upserts the entry, creating it if absent. An omitted state deletes the entry, and is a no-op if the entry is absent.

      Parameters

      • request: Modify

        The entry and target state to persist, or the collection link to add

      Returns Promise<string>

      A promise resolving to the Reference of the mutated entry, settled once the owning batch has completed