/** * `_links_*` reserved collections — managed bidirectional many-to-many * junctions (design B). * * Where `refArray` (design A) stores an id-array on one owning record, * `vault.link()` creates a first-class junction: a dedicated encrypted * `_links_` collection whose rows are `{ a, b, meta? }` link tuples. * It is queryable from BOTH sides (`of(id)`), carries optional per-link * metadata, and cascades on endpoint delete. * * Each link is slot-typed: `a` is an id in the `a` endpoint collection, * `b` an id in the `b` endpoint collection (they may be the same * collection for self-links). A link's identity is the ordered pair * `(a, b)`; `of(id)` matches either slot. * * Rows are encrypted under a dedicated `_links_` DEK — same * zero-knowledge stack as every other collection (the store sees only * ciphertext). Backup/restore rides the normal `loadAll` path. */ import type { NoydbStore } from '../../kernel/types.js'; import type { NoydbEventEmitter } from '../../kernel/events.js'; import { type EnclaveKey } from '../../kernel/enclave/index.js'; import { NoydbError } from '../../kernel/errors.js'; export { LINK_COLLECTION_PREFIX, linkCollectionName, isLinkCollectionName, linkRowKey, LinkIntegrityError, } from './names.js'; export type { LinkOnDelete, LinkSpec, LinkRow, LinkSetHandle } from './names.js'; import type { LinkSpec, LinkRow, LinkSetHandle } from './names.js'; /** * @internal — the concrete handle. The Vault owns construction (one per * link name) and the cascade hooks; consumers use the {@link LinkSetHandle} * surface via `vault.links(name)`. */ export declare class LinkSet implements LinkSetHandle { private readonly adapter; private readonly vault; private readonly name; private readonly spec; private readonly encrypted; private readonly getDEK; private readonly actor; private readonly emitter; /** Vault-provided existence check for endpoint validation on connect(). */ private readonly endpointExists; private readonly collName; private dekPromise; constructor(adapter: NoydbStore, vault: string, name: string, spec: LinkSpec, encrypted: boolean, getDEK: (collectionName: string) => Promise, actor: string, emitter: NoydbEventEmitter, /** Vault-provided existence check for endpoint validation on connect(). */ endpointExists: (collection: string, id: string) => Promise); private dek; private encryptEntry; private decryptEntry; connect(aId: string, bId: string, meta?: Record): Promise; disconnect(aId: string, bId: string): Promise; has(aId: string, bId: string): Promise; of(id: string): Promise; list(): Promise; /** @internal — rows where the deleted endpoint id matches the relevant slot. */ _rowsTouchingEndpoint(collection: string, id: string): Promise; /** @internal — the storage collection name (for tx pre-image capture). */ get _collectionName(): string; } /** Thrown by `connect()` when an endpoint record does not exist. */ export declare class LinkEndpointError extends NoydbError { readonly link: string; readonly endpoint: string; readonly missingId: string; constructor(link: string, endpoint: string, missingId: string); }