Retrieve a resource.
The result is shaped by the model Template: plain identifier properties are resolved from the
shape's Instance<T> type, while computed bindings are derived from the template value.
shape and model are kept distinct so that a single shape can serve many retrieval templates —
for example, a server wiring one shape at startup and accepting any admissible model decoded
from the client request on each call. Callers wanting the shape's own model as template MUST pass
it explicitly via @metreeca/blue/value!model.
By default, model templates support the full query language, including aggregate transforms and nested
expansion. When exposing retrieval to untrusted clients, restrict query complexity as required by setting
plain to true, depth to 0 or a positive value, and/or limit to a maximum result set size.
The retrieval template type
Retrieval specifications
Readonlyentry: stringAbsolute identifier of the resource to be retrieved
Readonlyshape: Lazy<ResourceShape>Resource shape driving the operation
Readonlymodel: TRetrieval template defining the data envelope
Optionalopts: { locale?: readonly string[]; plain?: boolean; depth?: number; limit?: number }Optional retrieval options
Optionallocale?: readonly string[]Tag priority list driving language negotiation for localised content; entries are
matched in order of preference against the language tags available for each localised value. Implementations
default this to ["und"] when omitted
Optionalplain?: booleanWhen true, rejects model templates carrying aggregate transforms (count, sum, min,
max, avg); defaults to false, admitting the full query language
Optionaldepth?: numberMaximum depth admitted for nested model expansion and query probe paths, each nesting
level or path segment counting against the budget; 0 rejects any nested template while still accepting IRI
references; omission leaves expansion unbounded
Optionallimit?: numberMaximum value admitted for the # pagination constraint in model selections; a positive
value caps the result set, rejecting any # exceeding it or set to 0 (unbounded) and injecting itself as a
default where # is absent; omission, like 0, leaves result sets unbounded
A promise resolving to an immutable copy of the resource data matching the specified model,
or to undefined if the resource is not present in the store; rejects with a RangeError if entry
is not an absolute IRI, a TraceError if model doesn't validate against the shape,
or a Problem on network, storage, or other processing errors
Error if the store has been closed
Create a resource.
Stores the resource's own data if the resource doesn't already exist. Specific reference kinds are handled as follows:
state is always validated at depth 0. Use
insert to embed a captive tree in a single batchCreation specifications
Readonlyentry: stringAbsolute identifier of the target resource
Readonlyshape: Lazy<ResourceShape>Resource shape driving the operation
Readonlystate: ResourceInitial property values for the new resource
A promise resolving to the entry Reference of the created resource, or to undefined
if the resource already exists; rejects with a RangeError if entry is not an absolute IRI or if
state carries an id differing from entry, a TraceError if state doesn't validate
against the shape, or a Problem on network, storage, or other processing errors
Update a resource.
Replaces the resource's own data if the resource already exists, fully removing any previously existing embedded data. Specific reference kinds are handled as follows:
state is always validated at depth 0. Use
insert to embed a captive tree in a single batchUpdate specifications
Readonlyentry: stringAbsolute identifier of the target resource
Readonlyshape: Lazy<ResourceShape>Resource shape driving the operation
Readonlystate: ResourceComplete replacement state for the resource
A promise resolving to the entry Reference of the updated resource, or to undefined
if the resource doesn't exist; rejects with a RangeError if entry is not an absolute IRI or if
state carries an id differing from entry, a TraceError if state doesn't validate
against the shape, or a Problem on network, storage, or other processing errors
Delete a resource.
Removes the resource's own data and clears references to it from other resources, if the resource exists. Specific reference kinds are handled as follows:
Deletion specifications
Readonlyentry: stringAbsolute identifier of the target resource
Readonlyshape: Lazy<ResourceShape>Resource shape driving the operation
A promise resolving to the entry Reference of the deleted resource, or to undefined
if the resource doesn't exist; rejects with a RangeError if entry is not an absolute IRI, or a
Problem on network, storage, or other processing errors
Insert a resource.
Unconditionally inserts or replaces the resource's own data, fully removing any previously existing embedded data. Specific reference kinds are handled as follows:
opts.depth nesting levels, as inline batches creating or updating the captive tree
By default, resources accept captive reference expansion to unbounded depth. To enforce a strict insertion
process that admits only bare references, set opts.depth to 0 to reject all expansion; set it to a positive
value to cap the nesting depth admitted.
Insertion specifications
Readonlyentry: stringAbsolute identifier of the target resource
Readonlyshape: Lazy<ResourceShape>Resource shape driving the operation
Readonlystate: ResourceComplete resource state to be inserted
Optionalopts: { depth?: number }Optional insertion options
Optional Readonlydepth?: numberMaximum nesting depth for expanding captive reference values as inline target resource
states, each expansion level counting against the budget; 0 rejects all expansion, accepting bare IRI
references only; omission leaves expansion unbounded
A promise resolving to the entry Reference of the inserted resource; rejects with a
RangeError if entry is not an absolute IRI or if state carries an id differing from entry, a
TraceError if state doesn't validate against the shape, or a Problem on
network, storage, or other processing errors
Remove a resource.
Unconditionally removes the resource's own data and clears references to it from other resources. Specific reference kinds are handled as follows:
Removal specifications
Readonlyentry: stringAbsolute identifier of the target resource
Readonlyshape: Lazy<ResourceShape>Resource shape driving the operation
A promise resolving to the entry Reference of the removed resource; rejects with a
RangeError if entry is not an absolute IRI, or a Problem on network, storage, or other
processing errors
Model-driven resource CRUD operations.
Persists and retrieves linked data resources as shape-validated states and query projections.