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
@@ -29,6 +29,7 @@
import { test, expect, describe, afterAll, beforeEach } from "bun:test";
import { docs, inbox as inboxSurface, storeRegistry } from "../src/index";
import { getSyncState } from "../src/emulated-verifier/open-repo";
import { listMyEntityDocs } from "../src/shared-wallet/account-registry";
import { bootPage, forgetEverything, reloadPage, signIn, SESSION, type Quad } from "./wallet-fake";
import type { Nuri } from "../src/model/types";
@@ -47,7 +48,7 @@ const COLD = { unsyncedUntilSubscribed: true } as const;
async function aNoteWithAMessageOnIt(quads: Quad[]): Promise<Nuri> {
bootPage(quads, COLD);
await signIn("alice");
const note = await storeRegistry.createEntityDoc("public");
const note = await storeRegistry.createEntityDoc(await storeRegistry.publicStore());
await docs.sparqlUpdate(
SESSION.sessionId,
`INSERT DATA { <${note}> <${TITLE}> "Courses" }`,
@@ -75,9 +76,14 @@ function inboxOnTheNote(quads: Quad[], note: Nuri): Nuri {
return record.o.split(" ")[1] as Nuri;
}
/** Alice's note, found the way her application finds it: by listing her own store. */
/** Alice's note, found by listing her own store.
*
* That listing is the LIBRARY's own path now, not an application's: `listMyEntityDocs`
* stopped being published in `1.0.0-dev.5` (no counterpart at any level upstream), so
* this reaches it where it lives. What is under test is unchanged - the cold store still
* has to answer, and it still has to refile the caps while it does. */
async function myNote(): Promise<Nuri> {
const mine = await storeRegistry.listMyEntityDocs("public");
const mine = await listMyEntityDocs("alice", "public");
const note = mine[0];
if (!note) throw new Error("the note Alice wrote is not in her store");
return note;
@@ -141,7 +147,7 @@ describe("reading the messages left on my note, on a page that has just loaded",
const quads: Quad[] = [];
bootPage(quads, COLD);
await signIn("alice");
const bare = await storeRegistry.createEntityDoc("public");
const bare = await storeRegistry.createEntityDoc(await storeRegistry.publicStore());
reloadPage(quads, COLD);
await signIn("alice");