refactor(layout): ranger les modules par destin à la migration

Les 25 modules étaient à plat, nommés d'après ce qu'ils font mécaniquement
(`store-registry`, `read-model`, `reach`, `caps`). Rien dans l'arborescence ne
disait lesquels DEVIENDRONT le vrai SDK, lesquels tiennent lieu du travail que
le verifier fera nativement, et lesquels n'existent que parce qu'un wallet est
partagé — trois destins sans rapport.

Quatre dossiers, les deux fichiers d'entrée restant à la racine pour que
l'`exports` du paquet et le code du consommateur ne bougent pas :

- `model/` — le modèle d'adressage de la cible, transcrit : vocabulaire pur,
  pas d'I/O. Survit comme connaissance.
- `surface/` — ce que l'app touche, chaque symbole ayant un pendant cible
  documenté. Supprimé quand l'alias bascule ; le code de l'app est inchangé.
- `emulated-verifier/` — les doublures de ce que le verifier fait nativement :
  possession, dépôt des caps, frontière, non-livraison, traitement des inbox,
  registres de branche, ouverture de repo. **C'est le dossier où diverger du
  modèle est possible.** Le préfixe `emulated-` porte le sens : tient lieu de,
  jamais est — cette bibliothèque ne réside dans aucune couche de la cible,
  elle les référence.
- `shared-wallet/` — n'existe que parce qu'un wallet héberge toutes les
  identités. Aucun pendant, rien sur quoi s'aligner ; sa seule loi est de
  rester invisible depuis `surface/`. S'évapore, remplacé par rien.

`store-registry-api.ts` devient `surface/placement.ts` : il faisait déjà à la
main ce que la frontière de dossier fait structurellement — c'est la meilleure
preuve interne du bien-fondé de ce rangement.

Ce commit ne fait que déplacer et recâbler les imports (src, test, e2e). Les
scissions des modules à cheval suivent.

157 tests unitaires, typecheck src/test/e2e vert.
This commit is contained in:
Sylvain Duchesne
2026-08-04 12:46:44 +02:00
parent d07b3642aa
commit 88914f50ae
46 changed files with 302 additions and 137 deletions
+2 -2
View File
@@ -38,8 +38,8 @@ import {
// The harness tests the LIBRARY, so it legitimately reaches machinery a consumer
// application must not — but through the internal path, never the published entry.
// `storeRegistry` above is the app-facing slice; these are the shim internals.
import * as registryInternals from "../src/store-registry";
import * as accounts from "../src/accounts";
import * as registryInternals from "../src/shared-wallet/account-registry";
import * as accounts from "../src/shared-wallet/accounts";
import { isNuri } from "@ng-eventually/client";
import type { Nuri, ShapeObservable, ShapeQuery } from "@ng-eventually/client";
@@ -50,8 +50,8 @@
* writer; they are left as-is and belong to P1b.
*/
import { hasReadCap, mintCap, targetOf } from "./nuri";
import type { Nuri, PrincipalId, ReadCap, Scope } from "./types";
import { hasReadCap, mintCap, targetOf } from "../model/nuri";
import type { Nuri, PrincipalId, ReadCap, Scope } from "../model/types";
/** The map key of the anonymous holder (no identity established yet). */
const ANONYMOUS = "";
@@ -34,9 +34,9 @@
* them and this drains each in turn.
*/
import { getCaps, getCurrentUser } from "./polyfill";
import { myInboxes, readLinks, resolveAccount } from "./store-registry";
import { processInbox } from "./inbox";
import { getCaps, getCurrentUser } from "../polyfill";
import { myInboxes, readLinks, resolveAccount } from "../shared-wallet/account-registry";
import { processInbox } from "../surface/inbox";
/** The in-flight connection work, per user key — so two calls do not race. */
const inFlight = new Map<string, Promise<void>>();
@@ -60,10 +60,10 @@
*/
import { mustNotAttempt } from "./reach";
import { getConfig, getStoreRegistryDeps } from "./polyfill";
import { subscribePhysicalDoc, type Unsubscribe } from "./subscribe";
import { logStage, shortNuri } from "./access-log";
import type { Nuri } from "./types";
import { getConfig, getStoreRegistryDeps } from "../polyfill";
import { subscribePhysicalDoc, type Unsubscribe } from "../surface/subscribe";
import { logStage, shortNuri } from "../shared-wallet/access-log";
import type { Nuri } from "../model/types";
/**
* The per-nuri bootstrap sync state (lib-internal). See the module header:
@@ -40,9 +40,9 @@
* At migration this module disappears: the boundary becomes the wallet itself.
*/
import { getCaps } from "./polyfill";
import { targetOf } from "./nuri";
import type { Nuri } from "./types";
import { getCaps } from "../polyfill";
import { targetOf } from "../model/nuri";
import type { Nuri } from "../model/types";
/**
* NURIs of the polyfill's own scaffolding, registered as they are resolved.
@@ -21,8 +21,8 @@
*/
import type { CapRegistry } from "./caps";
import { isNuri } from "./nuri";
import type { Nuri } from "./types";
import { isNuri } from "../model/nuri";
import type { Nuri } from "../model/types";
/** The document (repo NURI) an item lives in its `@graph`. The ORM boundary:
* `@graph` is an untyped value on a property bag, so it is narrowed here rather
+15 -15
View File
@@ -20,24 +20,24 @@
* away is visible at the import line.
*/
export * from "./types";
export { useShape } from "./use-shape";
export { watchShape } from "./watch-shape";
export type { ShapeQuery, ShapeObservable } from "./watch-shape";
export { init, initNg } from "./lifecycle";
export * as inbox from "./inbox";
export * as docs from "./docs";
export { subscribeDoc, subscribeDocs, docChangeType } from "./subscribe";
export type { DocChange, DocChangeType, Unsubscribe } from "./subscribe";
export * as readModel from "./read-model";
export type { UnionSubject } from "./read-model";
export * as storeRegistry from "./store-registry-api";
export * from "./model/types";
export { useShape } from "./surface/use-shape";
export { watchShape } from "./surface/watch-shape";
export type { ShapeQuery, ShapeObservable } from "./surface/watch-shape";
export { init, initNg } from "./surface/lifecycle";
export * as inbox from "./surface/inbox";
export * as docs from "./surface/docs";
export { subscribeDoc, subscribeDocs, docChangeType } from "./surface/subscribe";
export type { DocChange, DocChangeType, Unsubscribe } from "./surface/subscribe";
export * as readModel from "./surface/read-model";
export type { UnionSubject } from "./surface/read-model";
export * as storeRegistry from "./surface/placement";
// SPARQL injection-safety helpers — so the app can reuse the same escaping /
// validation when it builds SPARQL by interpolation. `escapeLiteral` for string
// literals, `escapeIri` to embed untrusted values in an IRI, `assertNuri` to
// validate trusted-shaped NURIs before embedding them in an IRI.
export { escapeLiteral, escapeIri, assertNuri } from "./sparql";
export { escapeLiteral, escapeIri, assertNuri } from "./surface/sparql";
// NURI type guards — the doors through which an app's own `string` (read back
// from storage, a URL, JSON, a form) becomes a typed `Nuri` or `ReadCap`. `Nuri`
@@ -46,7 +46,7 @@ export { escapeLiteral, escapeIri, assertNuri } from "./sparql";
// particular, it cannot pass a bare reference where a cap is required. Narrow
// with these rather than casting: a cast re-opens exactly the confusion the
// types exist to close.
export { isNuri, hasReadCap } from "./nuri";
export { isNuri, hasReadCap } from "./model/nuri";
// SDK type re-exports — so the app imports these from @ng-eventually/client too,
// not from @ng-org. `export type` is ERASED at build, so this adds NO runtime
@@ -55,7 +55,7 @@ export type { ShapeType, BaseType, Schema } from "@ng-org/shex-orm";
export type { DeepSignalSet } from "@ng-org/alien-deepsignals";
export type { NG } from "@ng-org/web";
import { makeNg } from "./ng-proxy";
import { makeNg } from "./surface/ng-proxy";
/** SDK-identical `ng` (wrapped). Drop-in replacement for `@ng-org/web`'s `ng`. */
export const ng: Record<string, any> = makeNg();
+12 -12
View File
@@ -8,12 +8,12 @@
* here is removed at migration.
*/
import type { NgLike, UseShapeLike, Nuri, PrincipalId, ReadCap } from "./types";
import type { RegistrySession } from "./store-registry";
import { CapRegistry } from "./caps";
import { setAccessLog } from "./access-log";
import { inspectOutbox } from "./outbox-log";
import { startConnect } from "./connect";
import type { NgLike, UseShapeLike, Nuri, PrincipalId, ReadCap } from "./model/types";
import type { RegistrySession } from "./shared-wallet/account-registry";
import { CapRegistry } from "./emulated-verifier/caps";
import { setAccessLog } from "./shared-wallet/access-log";
import { inspectOutbox } from "./shared-wallet/outbox-log";
import { startConnect } from "./emulated-verifier/connect";
/**
* Consumer-injected dependencies of the storeRegistry (polyfill-era). The
@@ -224,9 +224,9 @@ export function resetCaps(): void {
// lives in `inbox.ts` because sharing IS an inbox deposit (upstream: a sealed
// message carrying the cap), but it is surfaced here so the cap vocabulary stays
// on the polyfill side of the boundary rather than in the SDK-identical entry.
export { CapRegistry } from "./caps";
export { shareCap } from "./inbox";
export { connectedUser } from "./connect";
export { CapRegistry } from "./emulated-verifier/caps";
export { shareCap } from "./surface/inbox";
export { connectedUser } from "./emulated-verifier/connect";
// --- identity persistence (polyfill-era, no SDK counterpart) ----------------
//
@@ -235,7 +235,7 @@ export { connectedUser } from "./connect";
// one shared wallet hosts several identities. The real SDK has no counterpart: there
// each user opens their own wallet, and "who am I" is the session. Shipping it from
// the SDK entry advertised as durable something that disappears at migration.
export * as accounts from "./accounts";
export type { AccountStorage } from "./accounts";
export * as accounts from "./shared-wallet/accounts";
export type { AccountStorage } from "./shared-wallet/accounts";
// Config-shaped types the bootstrap needs; both describe the shim, not the SDK.
export type { AccountRecord, RegistrySession } from "./store-registry";
export type { AccountRecord, RegistrySession } from "./shared-wallet/account-registry";
@@ -19,7 +19,7 @@
* migration where the broker/verifier enforces isolation natively.
*/
import { getCurrentUser } from "./polyfill";
import { getCurrentUser } from "../polyfill";
/** Access kind: a document READ or a document WRITE. */
export type AccessOp = "READ" | "WRITE";
@@ -61,15 +61,15 @@
* `ng`), so this module imports **no** `@ng-org` package.
*/
import { sparqlUpdate, sparqlQuery } from "./docs";
import { sparqlUpdate, sparqlQuery } from "../surface/docs";
import { physicalCreate, physicalQuery, physicalUpdate } from "./physical";
import { getCaps, getCurrentUser, getStoreRegistryDeps } from "./polyfill";
import { ensureRepoOpen, ensurePhysicalRepoOpen } from "./open-repo";
import { escapeLiteral, escapeIri, assertNuri } from "./sparql";
import { hasReadCap, isNuri, mintCap } from "./nuri";
import { mustNotAttempt } from "./reach";
import { getCaps, getCurrentUser, getStoreRegistryDeps } from "../polyfill";
import { ensureRepoOpen, ensurePhysicalRepoOpen } from "../emulated-verifier/open-repo";
import { escapeLiteral, escapeIri, assertNuri } from "../surface/sparql";
import { hasReadCap, isNuri, mintCap } from "../model/nuri";
import { mustNotAttempt } from "../emulated-verifier/reach";
import { accessLogPrefix, logStage, shortNuri } from "./access-log";
import type { Nuri, ReadCap, Scope } from "./types";
import type { Nuri, ReadCap, Scope } from "../model/types";
// --- sharedWalletShim model ----------------------------------------------
@@ -38,10 +38,10 @@
* split once each user opens their own wallet.
*/
import { getConfig } from "./polyfill";
import { getConfig } from "../polyfill";
import { logAccess } from "./access-log";
import { isNuri } from "./nuri";
import type { Nuri } from "./types";
import { isNuri } from "../model/nuri";
import type { Nuri } from "../model/types";
/**
* Create a document as the PHYSICAL user the shim's own documents (the doc-shim,
@@ -13,11 +13,11 @@
* app's storeRegistry usage), so this is a drop-in for those raw calls.
*/
import { getCaps, getConfig } from "./polyfill";
import { logAccess, enabled as accessLogEnabled } from "./access-log";
import { isNuri } from "./nuri";
import { assertMayReach } from "./reach";
import type { Nuri } from "./types";
import { getCaps, getConfig } from "../polyfill";
import { logAccess, enabled as accessLogEnabled } from "../shared-wallet/access-log";
import { isNuri } from "../model/nuri";
import { assertMayReach } from "../emulated-verifier/reach";
import type { Nuri } from "../model/types";
// The low common point for ALL document access: every read in the SDK routes
// through `sparqlQuery`, every write through `sparqlUpdate` (+ container creation
@@ -28,19 +28,19 @@
import { depositInto, sparqlQuery } from "./docs";
import { subscribeDoc } from "./subscribe";
import { ensureRepoOpen } from "./open-repo";
import { getCaps, getCurrentUser, getStoreRegistryDeps } from "./polyfill";
import { addLink, documentInboxAddress, isOwnInbox } from "./store-registry";
import { ensureRepoOpen } from "../emulated-verifier/open-repo";
import { getCaps, getCurrentUser, getStoreRegistryDeps } from "../polyfill";
import { addLink, documentInboxAddress, isOwnInbox } from "../shared-wallet/account-registry";
import { escapeLiteral } from "./sparql";
import { hasReadCap } from "./nuri";
import { hasReadCap } from "../model/nuri";
import {
accessLogPrefix,
enabled as accessLogEnabled,
logAccess,
logStage,
shortNuri,
} from "./access-log";
import type { Nuri, PrincipalId, ReadCap } from "./types";
} from "../shared-wallet/access-log";
import type { Nuri, PrincipalId, ReadCap } from "../model/types";
// --- deposit model --------------------------------------------------------
@@ -5,7 +5,7 @@
* a hook point later (e.g. opening the shared wallet on `init`).
*/
import { getConfig } from "./polyfill";
import { getConfig } from "../polyfill";
/** Forwards to the real `@ng-org/web` `init`. */
export function init(...args: any[]): any {
@@ -4,8 +4,8 @@
* surface stays identical to `@ng-org/web`'s `ng`.
*/
import { getConfig, getCaps, getCurrentUser } from "./polyfill";
import type { Nuri } from "./types";
import { getConfig, getCaps, getCurrentUser } from "../polyfill";
import type { Nuri } from "../model/types";
export function makeNg(): Record<string, any> {
return new Proxy({} as Record<string, any>, {
@@ -5,7 +5,7 @@
* placement/addressing calls a consumer application legitimately makes, and the
* shim machinery that makes virtual users work at all (account resolution, the
* durable cap registers, the inbox-ownership predicate, cache resets). Until now
* `index.ts` did `export * as storeRegistry from "./store-registry"` and shipped
* `index.ts` did `export * as storeRegistry from "../shared-wallet/account-registry"` and shipped
* both, so an application could reach `ensureAccount`, `addLink` or
* `resetRegistryCache` from the SDK-identical entry machinery it must never call,
* on the entry whose whole promise is "this survives migration unchanged".
@@ -34,4 +34,4 @@ export {
openDocumentInbox,
/** WHERE to deposit for a document — readable by any holder of it. `undefined` if none. */
documentInboxAddress,
} from "./store-registry";
} from "../shared-wallet/account-registry";
@@ -42,12 +42,12 @@
*/
import { docCreate, sparqlUpdate, sparqlQuery } from "./docs";
import { getCaps, getStoreRegistryDeps } from "./polyfill";
import { mustNotAttempt } from "./reach";
import { ensureReposOpen } from "./open-repo";
import { getCaps, getStoreRegistryDeps } from "../polyfill";
import { mustNotAttempt } from "../emulated-verifier/reach";
import { ensureReposOpen } from "../emulated-verifier/open-repo";
import { assertNuri } from "./sparql";
import { isMachinerySubject } from "./machinery";
import type { Nuri } from "./types";
import { isMachinerySubject } from "../emulated-verifier/machinery";
import type { Nuri } from "../model/types";
// Keep the primitives referenced so tree-shaking never drops the import used by
// the (side-effecting) open step below; `docCreate`/`sparqlUpdate` are not used
@@ -33,9 +33,9 @@
* builds a set of these with per-doc error isolation to preserve that property.
*/
import { getConfig, getStoreRegistryDeps } from "./polyfill";
import { assertMayReach } from "./reach";
import type { Nuri } from "./types";
import { getConfig, getStoreRegistryDeps } from "../polyfill";
import { assertMayReach } from "../emulated-verifier/reach";
import type { Nuri } from "../model/types";
/**
* A push from the platform to a document subscriber. Loosely typed: the raw
@@ -6,8 +6,8 @@
* only delivers documents whose cap the wallet holds.
*/
import { getConfig, getCaps } from "./polyfill";
import { makeReadFilteredView } from "./read-filter";
import { getConfig, getCaps } from "../polyfill";
import { makeReadFilteredView } from "../emulated-verifier/read-filter";
export function useShape(shapeType: unknown, scope: unknown): unknown {
const set = getConfig().useShape(shapeType, scope) as object;
@@ -51,12 +51,12 @@
* `isError` fires ONLY on a real thrown exception in the pipeline.
*/
import { getCaps, getCurrentUser } from "./polyfill";
import { ensureReposOpen, getSyncState } from "./open-repo";
import { getCaps, getCurrentUser } from "../polyfill";
import { ensureReposOpen, getSyncState } from "../emulated-verifier/open-repo";
import { readUnion, type UnionSubject } from "./read-model";
import { subscribeDoc, type Unsubscribe } from "./subscribe";
import { listMyEntityDocs, userStoreDoc } from "./store-registry";
import type { Nuri, Scope } from "./types";
import { listMyEntityDocs, userStoreDoc } from "../shared-wallet/account-registry";
import type { Nuri, Scope } from "../model/types";
/**
* The RDF `type` predicate IRI. A SHEX shape pins its class via a triple
+2 -2
View File
@@ -19,8 +19,8 @@
*/
import { describe, it, expect, mock, beforeEach, afterEach, afterAll } from "bun:test";
import { setAccessLog, enabled, shortNuri } from "../src/access-log";
import { docCreate, sparqlUpdate, sparqlQuery } from "../src/docs";
import { setAccessLog, enabled, shortNuri } from "../src/shared-wallet/access-log";
import { docCreate, sparqlUpdate, sparqlQuery } from "../src/surface/docs";
import {
configure,
configureStoreRegistry,
+1 -1
View File
@@ -4,7 +4,7 @@ import {
browserIdentityStore,
ACCOUNT_STORAGE_KEY,
type AccountStorage,
} from "../src/accounts";
} from "../src/shared-wallet/accounts";
// In-memory fake of the Storage subset — keeps this framework/DOM-agnostic.
function fakeStorage(): AccountStorage & { map: Map<string, string> } {
+3 -3
View File
@@ -24,15 +24,15 @@ import {
ensureAccount,
resolveAccount,
resetRegistryCache,
} from "../src/store-registry";
import type { RegistrySession } from "../src/store-registry";
} from "../src/shared-wallet/account-registry";
import type { RegistrySession } from "../src/shared-wallet/account-registry";
import {
configure,
configureStoreRegistry,
resetStoreRegistry,
resetConfig,
} from "../src/polyfill";
import { resetOpenedRepos } from "../src/open-repo";
import { resetOpenedRepos } from "../src/emulated-verifier/open-repo";
afterAll(() => {
resetConfig();
+3 -3
View File
@@ -7,9 +7,9 @@
* function turns a bare reference into a cap.
*/
import { test, expect } from "bun:test";
import { CapRegistry } from "../src/caps";
import { hasReadCap, targetOf } from "../src/nuri";
import type { ReadCap } from "../src/types";
import { CapRegistry } from "../src/emulated-verifier/caps";
import { hasReadCap, targetOf } from "../src/model/nuri";
import type { ReadCap } from "../src/model/types";
/** A registry whose holder the test drives. */
function registry(initial: string | null = "alice") {
@@ -21,8 +21,8 @@
*/
import { describe, it, expect, mock, afterAll, beforeEach } from "bun:test";
import { ensureAccount, resolveWriteGraph, resetRegistryCache } from "../src/store-registry";
import { resetOpenedRepos } from "../src/open-repo";
import { ensureAccount, resolveWriteGraph, resetRegistryCache } from "../src/shared-wallet/account-registry";
import { resetOpenedRepos } from "../src/emulated-verifier/open-repo";
import {
configure,
configureStoreRegistry,
@@ -31,7 +31,7 @@ import {
resetCaps,
setCurrentUser,
} from "../src/polyfill";
import { resetInfrastructure } from "../src/reach";
import { resetInfrastructure } from "../src/emulated-verifier/reach";
const SESSION = { sessionId: "sid-cold", privateStoreId: "PRIV-COLD" };
const ANCHOR = `did:ng:${SESSION.privateStoreId}`;
@@ -24,8 +24,8 @@ import {
openDocumentInbox,
resetRegistryCache,
walletInbox,
} from "../src/store-registry";
import type { RegistrySession } from "../src/store-registry";
} from "../src/shared-wallet/account-registry";
import type { RegistrySession } from "../src/shared-wallet/account-registry";
import {
configure,
configureStoreRegistry,
@@ -38,10 +38,10 @@ import {
shareCap,
connectedUser,
} from "../src/polyfill";
import { post, postToDocument, read as readInbox } from "../src/inbox";
import { readUnion } from "../src/read-model";
import { sparqlUpdate } from "../src/docs";
import type { Nuri } from "../src/types";
import { post, postToDocument, read as readInbox } from "../src/surface/inbox";
import { readUnion } from "../src/surface/read-model";
import { sparqlUpdate } from "../src/surface/docs";
import type { Nuri } from "../src/model/types";
afterAll(() => {
resetConfig();
+2 -2
View File
@@ -1,5 +1,5 @@
import { test, expect, mock, beforeEach } from "bun:test";
import { docCreate, sparqlUpdate, sparqlQuery } from "../src/docs";
import { docCreate, sparqlUpdate, sparqlQuery } from "../src/surface/docs";
// The reach guard is process-wide: once ANY cap exists it applies to every reader.
// This suite declares none, so it must not inherit another suite's enforcement.
@@ -7,7 +7,7 @@ beforeEach(() => {
resetCaps();
setCurrentUser(null);
});
import * as ngProxy from "../src/ng-proxy";
import * as ngProxy from "../src/surface/ng-proxy";
// NOTE ORDER: the "not configured → throw" case MUST run before any configure()
// call, because configure() sets a module-level singleton with no public reset.
+4 -4
View File
@@ -1,7 +1,7 @@
import { test, expect, mock, beforeEach, afterAll } from "bun:test";
import { post, read, materialize, watch } from "../src/inbox";
import { walletInbox, resetRegistryCache } from "../src/store-registry";
import type { Deposit } from "../src/inbox";
import { post, read, materialize, watch } from "../src/surface/inbox";
import { walletInbox, resetRegistryCache } from "../src/shared-wallet/account-registry";
import type { Deposit } from "../src/surface/inbox";
import {
configure,
configureStoreRegistry,
@@ -9,7 +9,7 @@ import {
resetConfig,
setCurrentUser,
} from "../src/polyfill";
import type { RegistrySession } from "../src/store-registry";
import type { RegistrySession } from "../src/shared-wallet/account-registry";
// This suite injects a fake `ng` via configure() and reuses the storeRegistry's
// injected session provider (inbox docs live in the shared wallet). Restore the
@@ -16,9 +16,9 @@
* (c) switching identity SWITCHES heldByHolder — it never wipes one.
*/
import { test, expect, mock, afterAll } from "bun:test";
import { createEntityDoc, resetRegistryCache, walletInbox, listMyEntityDocs } from "../src/store-registry";
import type { RegistrySession } from "../src/store-registry";
import type { ReadCap } from "../src/types";
import { createEntityDoc, resetRegistryCache, walletInbox, listMyEntityDocs } from "../src/shared-wallet/account-registry";
import type { RegistrySession } from "../src/shared-wallet/account-registry";
import type { ReadCap } from "../src/model/types";
import {
configure,
configureStoreRegistry,
@@ -30,8 +30,8 @@ import {
setCurrentUser,
shareCap,
} from "../src/polyfill";
import { read as readInbox } from "../src/inbox";
import { filterReadable } from "../src/read-filter";
import { read as readInbox } from "../src/surface/inbox";
import { filterReadable } from "../src/emulated-verifier/read-filter";
afterAll(() => {
resetConfig();
@@ -356,7 +356,7 @@ test("a fresh session rebuilds the held caps from the scope index (the emulated
// Listing my own documents refiles their caps: this is the store branch that
// carries `AddRepo { read_cap }` upstream.
const { listMyEntityDocs } = await import("../src/store-registry");
const { listMyEntityDocs } = await import("../src/shared-wallet/account-registry");
expect(await listMyEntityDocs("alice", "protected")).toEqual([doc]);
expect(view(items)).toEqual(["p1"]);
});
+1 -1
View File
@@ -7,7 +7,7 @@
* wrong in the other and real data silently disappears from reads.
*/
import { test, expect } from "bun:test";
import { MACHINERY_NS, isMachinerySubject } from "../src/machinery";
import { MACHINERY_NS, isMachinerySubject } from "../src/emulated-verifier/machinery";
test("the emulated branch subjects are all machinery", () => {
// The four compartments store-registry emulates, verbatim.
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect, mock, afterEach } from "bun:test";
import { makeNg } from "../src/ng-proxy";
import { makeNg } from "../src/surface/ng-proxy";
import {
configure,
resetConfig,
+4 -4
View File
@@ -18,8 +18,8 @@
*/
import { describe, it, expect, mock, beforeEach, afterAll } from "bun:test";
import { ensureRepoOpen, ensureReposOpen, resetOpenedRepos } from "../src/open-repo";
import { readUnion } from "../src/read-model";
import { ensureRepoOpen, ensureReposOpen, resetOpenedRepos } from "../src/emulated-verifier/open-repo";
import { readUnion } from "../src/surface/read-model";
import {
configure,
configureStoreRegistry,
@@ -28,8 +28,8 @@ import {
resetCaps,
setCurrentUser,
} from "../src/polyfill";
import { resetInfrastructure } from "../src/reach";
import { resetRegistryCache } from "../src/store-registry";
import { resetInfrastructure } from "../src/emulated-verifier/reach";
import { resetRegistryCache } from "../src/shared-wallet/account-registry";
afterAll(() => {
resetConfig();
+5 -5
View File
@@ -11,9 +11,9 @@
* how a link travels between users at all, and it gives the depositor nothing back.
*/
import { test, expect, mock, afterAll } from "bun:test";
import { sparqlQuery, sparqlUpdate, depositInto } from "../src/docs";
import { createEntityDoc, resetRegistryCache, walletInbox } from "../src/store-registry";
import type { RegistrySession } from "../src/store-registry";
import { sparqlQuery, sparqlUpdate, depositInto } from "../src/surface/docs";
import { createEntityDoc, resetRegistryCache, walletInbox } from "../src/shared-wallet/account-registry";
import type { RegistrySession } from "../src/shared-wallet/account-registry";
import {
configure,
configureStoreRegistry,
@@ -22,8 +22,8 @@ import {
resetCaps,
setCurrentUser,
} from "../src/polyfill";
import { mayReach, mustNotAttempt } from "../src/reach";
import { hasReadCap } from "../src/nuri";
import { mayReach, mustNotAttempt } from "../src/emulated-verifier/reach";
import { hasReadCap } from "../src/model/nuri";
afterAll(() => {
resetConfig();
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect } from "bun:test";
import { filterReadable, makeReadFilteredView } from "../src/read-filter";
import { CapRegistry } from "../src/caps";
import { filterReadable, makeReadFilteredView } from "../src/emulated-verifier/read-filter";
import { CapRegistry } from "../src/emulated-verifier/caps";
// The access unit is the DOCUMENT (an item's `@graph` = the repo it lives in),
// not the item. Items here carry `@graph`; each holder holds caps per document.
+2 -2
View File
@@ -1,6 +1,6 @@
import { test, expect, mock, afterAll } from "bun:test";
import { readUnion } from "../src/read-model";
import type { Nuri } from "../src/types";
import { readUnion } from "../src/surface/read-model";
import type { Nuri } from "../src/model/types";
import {
configure,
configureStoreRegistry,
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from "bun:test";
import { escapeLiteral, escapeIri, assertNuri } from "../src/sparql";
import { escapeLiteral, escapeIri, assertNuri } from "../src/surface/sparql";
// --- escapeLiteral --------------------------------------------------------
+2 -2
View File
@@ -8,8 +8,8 @@ import {
walletInbox,
createEntityDoc,
resetRegistryCache,
} from "../src/store-registry";
import type { RegistrySession } from "../src/store-registry";
} from "../src/shared-wallet/account-registry";
import type { RegistrySession } from "../src/shared-wallet/account-registry";
import {
configure,
configureStoreRegistry,
+2 -2
View File
@@ -1,12 +1,12 @@
import { test, expect, mock, afterAll } from "bun:test";
import { subscribeDoc, subscribeDocs } from "../src/subscribe";
import { subscribeDoc, subscribeDocs } from "../src/surface/subscribe";
import {
configure,
configureStoreRegistry,
resetConfig,
resetStoreRegistry,
} from "../src/polyfill";
import type { RegistrySession } from "../src/store-registry";
import type { RegistrySession } from "../src/shared-wallet/account-registry";
// subscribeDoc/subscribeDocs wrap the REAL injected `ng.doc_subscribe`. This
// suite injects a fake `ng` whose `doc_subscribe` records the callback per doc
+3 -3
View File
@@ -24,7 +24,7 @@
*/
import { describe, it, expect, mock, beforeEach, afterEach, afterAll } from "bun:test";
import { watchShape } from "../src/watch-shape";
import { watchShape } from "../src/surface/watch-shape";
import {
configure,
configureStoreRegistry,
@@ -33,8 +33,8 @@ import {
resetCaps,
setCurrentUser,
} from "../src/polyfill";
import { resetRegistryCache, createEntityDoc } from "../src/store-registry";
import { resetOpenedRepos, setOpenTimeoutForTests, getSyncState } from "../src/open-repo";
import { resetRegistryCache, createEntityDoc } from "../src/shared-wallet/account-registry";
import { resetOpenedRepos, setOpenTimeoutForTests, getSyncState } from "../src/emulated-verifier/open-repo";
const TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
const FP = "http://festipod.org/";