@metreeca/gate - v0.12.0
    Preparing search index...

    Type Alias LookupHooks

    Retrieval hooks, as accepted by the lookup() method of a Driver.

    type LookupHooks = {
        model?: Template | ((request: Request) => Template);
        scope?: Omit<StoreScope, "locale">;
        review?: (
            match: Resource,
            request: Request,
        ) => Optional<Resource> | Promise<Optional<Resource>>;
    }
    Index

    Properties

    Properties

    model?: Template | ((request: Request) => Template)

    The server template bounding what a client may retrieve; if omitted, the request is bounded by the shape alone.

    Stated as a function, the template is computed for each request, so that the view served may depend on the caller, as when scoping a collection to the resources a user or tenant may see.

    scope?: Omit<StoreScope, "locale">

    The retrieval bounds client templates are held to; its locale priority is taken from the request instead.

    review?: (
        match: Resource,
        request: Request,
    ) => Optional<Resource> | Promise<Optional<Resource>>

    Reviews the retrieved resource before it is served, returning the resource to send, or undefined to answer 404 Not Found as if the store held no such resource, as when the caller may not see it.