/** * Wrapped `useShape`: same signature as `@ng-org/orm`. The returned reactive set * is filtered to what the current user may read (emulated caps). At migration * this filtering disappears — the broker only syncs authorized documents. */ import { getConfig } from "./polyfill"; export function useShape(shapeType: unknown, scope: unknown): unknown { const { useShape: real } = getConfig(); const set = real(shapeType, scope); // TODO(polyfill): wrap `set` so iteration yields only entries whose emulated // grant satisfies access.canRead(grant, getCurrentUser()), while preserving // the reactivity of the underlying DeepSignalSet. This is the trickiest piece. return set; }