@metreeca/keep
    Preparing search index...

    Function createValidatingStore

    • Creates a validating store backed by a delegate.

      Each method validates its inputs against the supplied shape before forwarding the request to store:

      • entry must be an absolute IRI with no query string and no fragment; otherwise the request is rejected with a RangeError
      • model is validated as a template for lookup, within the query-complexity bounds (plain, depth, limit) of the caller's retrieval scope, and as a collection slice for create
      • state.id, if present, must be nested under entry for create, and equal to entry for update and insert; otherwise the request is rejected with a RangeError
      • state is validated as a resource with captive expansion capped at depth 0, so inline captive batches are rejected; create validates it against the shape of the collected resources, and update and insert against the supplied shape

      The trusted option controls whether lookup responses are re-validated against the shape, as narrowed by the caller's model. It defaults to false, the safe choice for connectors whose source may deliver non-conforming data, such as a remote REST endpoint. Local stores that compute results themselves can pass trusted: true to skip the redundant check.

      Validation failures surface as TraceError or RangeError rejections, in line with the unified Store error channel.

      Parameters

      • store: StoreClient

        Inner StoreClient receiving the validated requests

      • options: { trusted?: boolean } = {}

        Optional validation options

        • Optional Readonlytrusted?: boolean

          Whether to skip re-validation of lookup responses against the shape, as narrowed by the caller's model.

          false, treating the wrapped store as untrusted

      Returns StoreClient

      An immutable StoreClient wrapping store with input validation