feat!: useShapeQuery prend le Scope du SDK, et un store se nomme par sa reference

This commit is contained in:
Sylvain Duchesne
2026-09-16 16:47:09 +02:00
parent ee9319f89b
commit d0ca5c5d41
31 changed files with 812 additions and 291 deletions
+19 -6
View File
@@ -35,10 +35,23 @@ export type Nuri = `did:ng:${string}`;
// @provenance ReadCap kind=aligned level=1 ref=engine/repo/src/types.rs:readcap_nuri — the `r:` segment and its one-opaque-segment encoding are upstream's; the key material is a stand-in constant
export type ReadCap = `did:ng:${string}:r:${string}`;
/** NextGraph-native store scopes. The *mapping* of entities to scopes is the
* consumer's concern; this layer only knows the three scopes exist. */
// @provenance Scope kind=aligned level=1 ref=engine/repo/src/types.rs:from_type_and_repo — upstream's store types; `group` is omitted here and `dialog` is `unimplemented!()` upstream
export type Scope = "public" | "protected" | "private";
/**
* Which of a session's three stores a document is placed in. **Defined here, not
* published** - the standing `ReadCap` and {@link InboxScope} already have, and for
* the same reason: no published signature takes it. It was published as `Scope` until
* `1.0.0-dev.5`, where one name covered the scope of a READ and the placement of a
* write. The SDK's own `Scope` is an object filtering on `graphs` and `subjects`, and
* the two were never the same question.
*
* The three strings are upstream's own: `doc_create` takes a `store_type` of exactly
* `"public" | "protected" | "private"` (plus `"group"`, omitted here, and `"dialog"`,
* which is `unimplemented!()` upstream) and pairs it with a store id to build a
* `StoreRepo`. An application names a store by its REFERENCE
* (`storeRegistry.privateStore()` and its two neighbours); this type is how the
* library's own modules tell the three apart once one has been resolved.
*/
// @provenance StoreType kind=aligned level=1 ref=engine/repo/src/types.rs:from_type_and_repo — upstream's store types, the strings `doc_create`'s `store_type` accepts; `group` is omitted here and `dialog` is `unimplemented!()` upstream
export type StoreType = "public" | "protected" | "private";
/** The current identity id. Target: the wallet user (`session.user`). Polyfill:
* a chosen id, because everyone shares one wallet. */
@@ -60,7 +73,7 @@ export type NgLike = Record<string, any>;
export type UseShapeLike = (...args: any[]) => any;
/**
* The scopes that can carry an inbox. NOT `Scope`: upstream only the public and
* The stores that can carry an inbox. NOT `StoreType`: upstream only the public and
* protected store repos get one — `new_store_default` attaches an inbox solely
* `if !private` (`engine/verifier/src/verifier.rs:2994`), and the engine's only two
* `AddInboxCap` commits are for those two (`engine/verifier/src/site.rs:127-152`).
@@ -86,4 +99,4 @@ export type UseShapeLike = (...args: any[]) => any;
export type NuriLike = Nuri | string;
// @provenance InboxScope kind=aligned level=1 ref=engine/verifier/src/verifier.rs:new_store_default — an inbox is attached only `if !private`, so the private scope cannot carry one
export type InboxScope = Extract<Scope, "public" | "protected">;
export type InboxScope = Extract<StoreType, "public" | "protected">;