@metreeca/keep-rest
v0.10.0
Published
REST/JSON proxy connector for @metreeca/keep.
Maintainers
Readme
@metreeca/keep-rest
REST/JSON proxy connector for the @metreeca/keep model-driven linked data storage framework.
Forwards every store operation to a remote REST endpoint over HTTP, exposing the same Store surface as every other
connector: each call is round-tripped to the remote service rather than applied to a local backing store. Inputs are
shape-validated before the request, and retrieval responses are re-validated against the projected shape, since the
remote endpoint is treated as untrusted by default.
[!IMPORTANT] Transaction Isolation — None. REST has no native transaction support; operations apply eagerly with no cross-call isolation, and an
executetask that throws after partial server-side mutations does not roll them back.
[!IMPORTANT] Mutation Events — Limited to mutations issued through this store; mutations from other clients sharing the remote service are not observed.
Installation
npm install @metreeca/keep-restUsage
[!NOTE]
This section introduces essential concepts; for complete coverage, see the API reference.
Wiring a Store
Call createRESTStore to obtain a Store that proxies a remote REST service over the global fetch:
import { createRESTStore } from "@metreeca/keep-rest";
const store = createRESTStore();
const product = await store.lookup({
entry: "http://example.com/products/1",
shape: ProductShape,
model: {
name: "",
price: 0
}
});Pass a custom fetch-compatible transport as the first argument to route requests through a configured client; pass
{ trusted: true } to skip re-validation of retrieval responses when the remote endpoint is trusted to deliver
shape-conforming data.
Support
- open an issue to report a problem or to suggest a new feature
- start a discussion to ask a how-to question or to share an idea
License
This project is licensed under the Apache 2.0 License – see LICENSE file for details.
