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 -2
View File
@@ -19,7 +19,7 @@
*/
import { mock } from "bun:test";
import { configure } from "../src/index";
import { configure, storeRegistry } from "../src/index";
import {
configureStoreRegistry,
setCurrentUser,
@@ -32,7 +32,7 @@ import type { RegistrySession } from "../src/shared-wallet/account-registry";
import { resetOpenedRepos } from "../src/emulated-verifier/open-repo";
import { resetPublicStoreFetches } from "../src/emulated-verifier/public-store";
import { connectedUser } from "../src/emulated-verifier/connect";
import type { NgLike, UseShapeLike } from "../src/model/types";
import type { NgLike, Nuri, StoreType, UseShapeLike } from "../src/model/types";
export const SESSION: RegistrySession = { sessionId: "sid-wallet", privateStoreId: "PRIV-WALLET" };
@@ -438,3 +438,20 @@ export async function signIn(id: string): Promise<void> {
setCurrentUser(id);
await connectedUser();
}
/**
* The published reference of one of the connected identity's three stores.
*
* Placement stopped being spelled as a word on the published surface in `1.0.0-dev.5`:
* an application names a store by the reference `privateStore()`, `protectedStore()` or
* `publicStore()` hands it, and passes that to `createEntityDoc`. A suite that walks the
* three still needs to go from one to the other, and this is that step - through the
* published calls, never around them.
*/
export function storeOfType(type: StoreType): Promise<Nuri> {
return type === "public"
? storeRegistry.publicStore()
: type === "protected"
? storeRegistry.protectedStore()
: storeRegistry.privateStore();
}