style: ASCII dans les lignes ecrites pour cette tache
This commit is contained in:
@@ -218,7 +218,7 @@ const useShape = <T extends BaseType>(
|
|||||||
scope: Scope | string | undefined
|
scope: Scope | string | undefined
|
||||||
) => DeepSignalSet<T>;
|
) => DeepSignalSet<T>;
|
||||||
|
|
||||||
// …and as the BUILD ships it (`dist/frontendAdapters/react/useShape.d.ts`), which is the
|
// and as the BUILD ships it (`dist/frontendAdapters/react/useShape.d.ts`), which is the
|
||||||
// shape the wrapper mirrors: the collection moved inside a result object, and the second
|
// shape the wrapper mirrors: the collection moved inside a result object, and the second
|
||||||
// parameter widened from a bare `Scope` to the config. The gap between the two columns is
|
// parameter widened from a bare `Scope` to the config. The gap between the two columns is
|
||||||
// the one the provenance anchor records.
|
// the one the provenance anchor records.
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ let sessionResolve!: (s: BrokerSession) => void;
|
|||||||
const sessionReady = new Promise<BrokerSession>((r) => (sessionResolve = r));
|
const sessionReady = new Promise<BrokerSession>((r) => (sessionResolve = r));
|
||||||
|
|
||||||
// The injected `useShape`, so the lib's read-filtered view can be exercised WITHOUT a
|
// The injected `useShape`, so the lib's read-filtered view can be exercised WITHOUT a
|
||||||
// React tree. It is `test/use-shape-fake.ts` — the ONE fake in this repository that
|
// React tree. It is `test/use-shape-fake.ts` - the ONE fake in this repository that
|
||||||
// returns the shape `@ng-org/orm`'s hook really ships, read off the installed package's
|
// returns the shape `@ng-org/orm`'s hook really ships, read off the installed package's
|
||||||
// own `.d.ts`. This page used to carry a hand-written Set-like of its own, which is
|
// own `.d.ts`. This page used to carry a hand-written Set-like of its own, which is
|
||||||
// exactly why the capability filter could hand three members of that envelope back raw
|
// exactly why the capability filter could hand three members of that envelope back raw
|
||||||
@@ -1102,7 +1102,7 @@ const identity = new IdentityStore(
|
|||||||
// the cap is proven on the read paths, not here.
|
// the cap is proven on the read paths, not here.
|
||||||
setCurrentUser("stranger");
|
setCurrentUser("stranger");
|
||||||
const strangerView = read();
|
const strangerView = read();
|
||||||
// …and the SDK's own handle is refused outright, whoever asks: it reads and writes
|
// and the SDK's own handle is refused outright, whoever asks: it reads and writes
|
||||||
// with no capability filter at all.
|
// with no capability filter at all.
|
||||||
let subscriptionRefused: string | null = null;
|
let subscriptionRefused: string | null = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ async function main(): Promise<void> {
|
|||||||
);
|
);
|
||||||
// The three views above are read off `data`, one of the three members of the SDK's
|
// The three views above are read off `data`, one of the three members of the SDK's
|
||||||
// result envelope that carry the items. The fourth way in is the ORM's own handle,
|
// result envelope that carry the items. The fourth way in is the ORM's own handle,
|
||||||
// which reads and writes with no capability filter at all — so it is refused rather
|
// which reads and writes with no capability filter at all, so it is refused rather
|
||||||
// than handed on, and that refusal is checked here rather than assumed.
|
// than handed on, and that refusal is checked here rather than assumed.
|
||||||
check(
|
check(
|
||||||
"the read-filtered view refuses the ORM's own subscription handle",
|
"the read-filtered view refuses the ORM's own subscription handle",
|
||||||
|
|||||||
@@ -188,13 +188,13 @@ function filteredDescriptor(
|
|||||||
* Until 2026-09-24 that reasoning was applied to FUNCTION members alone: everything else
|
* Until 2026-09-24 that reasoning was applied to FUNCTION members alone: everything else
|
||||||
* was forwarded raw, on the recorded ground that "a plain property carries no items". That
|
* was forwarded raw, on the recorded ground that "a plain property carries no items". That
|
||||||
* ground was never a property of the model, only of the object that happened to be wrapped
|
* ground was never a property of the model, only of the object that happened to be wrapped
|
||||||
* — and the moment the wrapped object changed, three plain properties of it each carried
|
* and the moment the wrapped object changed, three plain properties of it each carried
|
||||||
* every identity's items ({@link makeReadFilteredShapeResult}). A boundary that is safe for
|
* every identity's items ({@link makeReadFilteredShapeResult}). A boundary that is safe for
|
||||||
* the shape in front of it and unsafe for the next one is not a boundary either.
|
* the shape in front of it and unsafe for the next one is not a boundary either.
|
||||||
*
|
*
|
||||||
* So the default is {@link cannotReachAnItem}, which asks of the VALUE what no version
|
* So the default is {@link cannotReachAnItem}, which asks of the VALUE what no version
|
||||||
* number can change: a primitive cannot hold a reference to anything, so it cannot reach an
|
* number can change: a primitive cannot hold a reference to anything, so it cannot reach an
|
||||||
* item and passes untouched — `size`, `isLoading`, a count, a flag, a name. An object or a
|
* item and passes untouched - `size`, `isLoading`, a count, a flag, a name. An object or a
|
||||||
* function can, so it refuses unless this file has a filtered form of it. That is why
|
* function can, so it refuses unless this file has a filtered form of it. That is why
|
||||||
* nothing below names `isLoading`, and why a member nobody has seen yet is already decided:
|
* nothing below names `isLoading`, and why a member nobody has seen yet is already decided:
|
||||||
* if it carries items it is an object or a function, and both refuse.
|
* if it carries items it is an object or a function, and both refuse.
|
||||||
@@ -403,7 +403,7 @@ function filteredPromise(value: PromiseLike<unknown>, caps: CapRegistry): Promis
|
|||||||
* and a wrapper of it would be a second published surface to keep honest. Refusing is
|
* and a wrapper of it would be a second published surface to keep honest. Refusing is
|
||||||
* loud, and what it refuses is the one member the contract already says is not published.
|
* loud, and what it refuses is the one member the contract already says is not published.
|
||||||
*/
|
*/
|
||||||
// @provenance makeReadFilteredShapeResult kind=aligned level=3 ref=sdk/js/orm/src/frontendAdapters/react/useShape.ts:useShape — the same capability filter, over the result envelope that hook returns rather than over the collection inside it; removed at migration
|
// @provenance makeReadFilteredShapeResult kind=aligned level=3 ref=sdk/js/orm/src/frontendAdapters/react/useShape.ts:useShape - the same capability filter, over the result envelope that hook returns rather than over the collection inside it; removed at migration
|
||||||
export function makeReadFilteredShapeResult<R extends object>(result: R, caps: CapRegistry): R {
|
export function makeReadFilteredShapeResult<R extends object>(result: R, caps: CapRegistry): R {
|
||||||
/** What the view answers for one member. The `get` trap and the descriptor trap BOTH
|
/** What the view answers for one member. The `get` trap and the descriptor trap BOTH
|
||||||
* call this, so neither can answer what the other refuses - `data` used to come back
|
* call this, so neither can answer what the other refuses - `data` used to come back
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ export interface ShapeResult {
|
|||||||
* says it, and the real `reactUseShape` is assignable to it with no wrapper and no cast
|
* says it, and the real `reactUseShape` is assignable to it with no wrapper and no cast
|
||||||
* (pinned by `test/use-shape.test.ts`).
|
* (pinned by `test/use-shape.test.ts`).
|
||||||
*/
|
*/
|
||||||
// @provenance UseShapeLike kind=invention level=none ref=none — nothing upstream is injected; the type exists only to describe what `configure` receives, here for the ORM's React hook
|
// @provenance UseShapeLike kind=invention level=none ref=none - nothing upstream is injected; the type exists only to describe what `configure` receives, here for the ORM's React hook
|
||||||
export type UseShapeLike = <T extends BaseType>(
|
export type UseShapeLike = <T extends BaseType>(
|
||||||
shapeType: ShapeType<T>,
|
shapeType: ShapeType<T>,
|
||||||
conf: RdfOrmConfig<T> | string | undefined,
|
conf: RdfOrmConfig<T> | string | undefined,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { getConfig, getCaps } from "../shared-wallet/bootstrap";
|
|||||||
import { makeReadFilteredShapeResult } from "../emulated-verifier/read-filter";
|
import { makeReadFilteredShapeResult } from "../emulated-verifier/read-filter";
|
||||||
import type { ShapeResult } from "../model/types";
|
import type { ShapeResult } from "../model/types";
|
||||||
|
|
||||||
// @provenance useShape kind=passthrough level=3 ref=sdk/js/orm/src/frontendAdapters/react/useShape.ts:useShape — forwards to the injected real hook, with its two arguments; the read-filtered view over the result envelope emulates cryptographic isolation
|
// @provenance useShape kind=passthrough level=3 ref=sdk/js/orm/src/frontendAdapters/react/useShape.ts:useShape - forwards to the injected real hook, with its two arguments; the read-filtered view over the result envelope emulates cryptographic isolation
|
||||||
export function useShape<T extends BaseType>(
|
export function useShape<T extends BaseType>(
|
||||||
shapeType: ShapeType<T>,
|
shapeType: ShapeType<T>,
|
||||||
conf: RdfOrmConfig<T> | string | undefined,
|
conf: RdfOrmConfig<T> | string | undefined,
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ test("useShape: no member of the result reaches a document this identity holds n
|
|||||||
// `subscription` - the SDK's own handle, which reads and writes with no filter at all.
|
// `subscription` - the SDK's own handle, which reads and writes with no filter at all.
|
||||||
expect(() => result.subscription).toThrow(/RdfOrmSubscription/);
|
expect(() => result.subscription).toThrow(/RdfOrmSubscription/);
|
||||||
|
|
||||||
// …and the collection underneath really does hold both, so it is the filter that
|
// and the collection underneath really does hold both, so it is the filter that
|
||||||
// removed one rather than the fake never having offered it.
|
// removed one rather than the fake never having offered it.
|
||||||
expect([...(hook.raw() as Iterable<BaseType>)]).toHaveLength(2);
|
expect([...(hook.raw() as Iterable<BaseType>)]).toHaveLength(2);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user