feat!: la famille ORM est publiee enveloppee, et le ng publie cesse de rendre des promesses
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
# @ng-eventually/polyfill
|
||||
|
||||
One entry point. Most of what it publishes has the same signature as the future SDK —
|
||||
`ng`, `useShape`, `useShapeQuery`, `docs`, `inbox`, `storeRegistry`, `readUnion` (+ types) —
|
||||
`ng`, `useShape`, `useShapeQuery`, `getObjects`, `insertObject`, `docs`, `inbox`,
|
||||
`storeRegistry`, `readUnion` (+ types) -
|
||||
and is a drop-in for `@ng-org/web` / `@ng-org/orm`: as NextGraph matures it resolves to
|
||||
the real SDK (build alias removed) with no code change.
|
||||
|
||||
@@ -32,7 +33,10 @@ import {
|
||||
configure,
|
||||
} from "@ng-eventually/polyfill";
|
||||
|
||||
configure({ ng: realNg, useShape: realUseShape, ormSubscription, initNg, sharedWallet });
|
||||
configure({
|
||||
ng: realNg, useShape: realUseShape, ormSubscription, getObjects, insertObject,
|
||||
initNg, sharedWallet,
|
||||
});
|
||||
await ensureIdentity(); // who I am (returned), connection work awaited
|
||||
// A store is named by its reference — `doc_create` takes one, and the session is where
|
||||
// upstream gets it. Omit it and the document goes to the private store, as upstream does.
|
||||
@@ -45,6 +49,13 @@ await docs.sparqlUpdate(sid, `INSERT DATA { … }`, doc);
|
||||
// `configure` as `ormSubscription`), and hands back the shape's own objects: `@graph`,
|
||||
// `@id` and one field per predicate the shape DECLARES.
|
||||
const query = useShapeQuery(NoteShape, { graphs: "did:ng:i" });
|
||||
// The ORM's one-shot read and its subscription-free write, at the SDK's own names and
|
||||
// signatures. Import them from HERE, never from `@ng-org/orm`: one wallet hosts every
|
||||
// identity, so the unwrapped read returns everybody's objects and the unwrapped write
|
||||
// reaches anybody's document. Wrapped, the read comes back filtered by what you hold and
|
||||
// the write is refused unless you own the document its `@graph` names.
|
||||
const notes = await getObjects(NoteShape, { graphs: "did:ng:i" });
|
||||
await insertObject(NoteShape, { "@id": "", "@graph": doc, title: "a note" });
|
||||
```
|
||||
|
||||
## Principle — the polyfill compensates, it never extends
|
||||
|
||||
Reference in New Issue
Block a user