/** * Wrapped `useShape`: same signature as `@ng-org/orm`. Once the cap emulation is * in force, the returned set is a read-filtered VIEW (only items in documents the * current holder has the ReadCap of); before the first cap is issued it passes the * real set through unchanged. At migration the filtering disappears — the broker * only delivers documents whose cap the wallet holds. */ import { getConfig, getCaps } from "../shared-wallet/bootstrap"; import { makeReadFilteredView } from "../emulated-verifier/read-filter"; // @provenance useShape kind=passthrough level=3 ref=sdk/js/orm/src/frontendAdapters/react/useShape.ts:useShape — forwards to the injected real hook; the read-filtered view emulates cryptographic isolation and the generic `T` is widened to `unknown` export function useShape(shapeType: unknown, scope: unknown): unknown { const set = getConfig().useShape(shapeType, scope) as object; const caps = getCaps(); if (!caps.isEnforcing()) return set; // no cap issued yet → passthrough return makeReadFilteredView(set, caps); }