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
@@ -151,9 +151,9 @@ async function whileWatchingTheLog(body: () => Promise<void>): Promise<string[]>
*/
async function bobSharesWithAlice(): Promise<{ doc: Nuri; inTransit: Quad[] }> {
await signIn("alice");
await storeRegistry.createEntityDoc("protected"); // her first visit — now she exists
await storeRegistry.createEntityDoc(await storeRegistry.protectedStore()); // her first visit — now she exists
await signIn("bob");
const doc = await storeRegistry.createEntityDoc("protected");
const doc = await storeRegistry.createEntityDoc(await storeRegistry.protectedStore());
await inboxSurface.share(doc, "alice");
// Test-side inspection only — the address is read off the wallet to say WHICH document
// is in transit, and is never handed to an actor.
@@ -217,7 +217,7 @@ describe("an inbox opened in the middle of a session", () => {
await signIn("alice");
// The note and its inbox come into existence AFTER connecting, so nothing the
// connection enumerated could have included them.
const note = await storeRegistry.createEntityDoc("public");
const note = await storeRegistry.createEntityDoc(await storeRegistry.publicStore());
await storeRegistry.openDocumentInbox(note);
await converge();
@@ -237,7 +237,7 @@ describe("an inbox opened in the middle of a session", () => {
test("the messages left on it are readable, on the document its owner named", async () => {
await signIn("alice");
const note = await storeRegistry.createEntityDoc("public");
const note = await storeRegistry.createEntityDoc(await storeRegistry.publicStore());
await storeRegistry.openDocumentInbox(note);
await converge();
@@ -411,7 +411,7 @@ describe("a deposit that cannot be applied", () => {
// subscribes again as if it had never been attempted, and the initial push of that new
// subscription finds the deposit still waiting.
refusing = false;
await storeRegistry.createEntityDoc("protected");
await storeRegistry.createEntityDoc(await storeRegistry.protectedStore());
await converge();
expect(getCaps().capForHolder("alice", doc)).toBeDefined();
expect(await documentsGivenTo("alice")).toContain(doc);
@@ -513,7 +513,7 @@ describe("listing the inboxes when one of the two registers cannot be read", ()
await signIn("alice");
// A document inbox: a record on the User branch of the private store, which is the
// register the broker is about to stop answering for.
const note = await storeRegistry.createEntityDoc("public");
const note = await storeRegistry.createEntityDoc(await storeRegistry.publicStore());
await storeRegistry.openDocumentInbox(note);
await converge();
const store = (await resolveAccount("alice"))?.docPrivate;
@@ -574,7 +574,7 @@ describe("listing the inboxes when one of the two registers cannot be read", ()
test("still REJECTS for the caller that cannot use a partial list", async () => {
await signIn("alice");
await storeRegistry.openDocumentInbox(await storeRegistry.createEntityDoc("public"));
await storeRegistry.openDocumentInbox(await storeRegistry.createEntityDoc(await storeRegistry.publicStore()));
await converge();
const store = (await resolveAccount("alice"))?.docPrivate;
if (store === undefined) throw new Error("the fixture did not give Alice a private store");
@@ -597,12 +597,12 @@ describe("listing the inboxes when one of the two registers cannot be read", ()
*/
async function bobSharesTwiceWithAlice(): Promise<Quad[][]> {
await signIn("alice");
await storeRegistry.createEntityDoc("protected"); // her first visit — now she exists
await storeRegistry.createEntityDoc(await storeRegistry.protectedStore()); // her first visit — now she exists
await signIn("bob");
const aliceInbox = await userInbox("alice", "protected");
const batches: Quad[][] = [];
for (let round = 0; round < 2; round += 1) {
const doc = await storeRegistry.createEntityDoc("protected");
const doc = await storeRegistry.createEntityDoc(await storeRegistry.protectedStore());
await inboxSurface.share(doc, "alice");
batches.push(heldByTheBroker(aliceInbox));
}
@@ -680,7 +680,7 @@ describe("a register that stays unreadable", () => {
// the observation look again (`CapRegistry.onChange`).
fake._failReadsOn.delete(shim);
fake._failReadsOn.add(store);
await storeRegistry.createEntityDoc("protected");
await storeRegistry.createEntityDoc(await storeRegistry.protectedStore());
await converge();
});
fake._failReadsOn.delete(store);