/** * Orchestrate the derive → hash → skip-or-write cycle for a collection's * persisted JSON Schema. Called by the Vault at collection-registration * time when the developer opts in via `collection({ persistJsonSchema: * true })`. * * Skip semantics: * * - Zod validators: skip when the new hash equals the stored hash. * - Non-Zod (stub envelopes have hash=null): skip when the stored * envelope's `kind` matches the freshly-detected kind (since there's * no body to compare yet — a kind change is the only signal). * * @module */ import type { SchemaUpdateStrategy, UpdateDecision } from '../schema-update/types.js'; import type { NoydbStore, ClassifiedMarker } from '../../kernel/types.js'; import type { PersistedSchemaEnvelope } from './types.js'; import type { PairingMarker } from '../satellites/types.js'; import type { EnclaveKey } from '../../kernel/enclave/index.js'; export interface PersistSchemaResult { /** True when a fresh envelope was written to storage. */ readonly written: boolean; /** True when an existing envelope matched and the write was skipped. */ readonly skipped: boolean; /** The envelope that was either written or matched. */ readonly envelope: PersistedSchemaEnvelope; /** The update-strategy decision, present when strategies ran. */ readonly decision?: UpdateDecision; } export declare function persistSchemaIfNeeded(opts: { readonly store: NoydbStore; readonly vault: string; readonly collectionName: string; readonly validator: unknown; readonly dek: EnclaveKey; readonly strategies?: readonly SchemaUpdateStrategy[]; }): Promise; /** * Persist (or refresh) the C-A / R10 classified marker into the collection's * `_schemas/` record, preserving any existing derived JSON-Schema * body. Idempotent — a no-op when an equivalent marker is already stored. * Independent of `persistJsonSchema`: called on the first classified write so a * later naive handle can detect the drift cross-session. */ export declare function persistClassifiedMarker(opts: { readonly store: NoydbStore; readonly vault: string; readonly collectionName: string; readonly dek: EnclaveKey; readonly marker: ClassifiedMarker; }): Promise; /** * Persist (or refresh) the R-S9 satellite pairing marker into the collection's * `_schemas/` record, preserving any existing derived JSON-Schema * body. Idempotent — a no-op when an equivalent marker is already stored. * Independent of `persistJsonSchema`: called on satellite declaration so a * later divergent re-declaration can be detected cross-session. */ export declare function persistSatelliteMarker(opts: { readonly store: NoydbStore; readonly vault: string; readonly collectionName: string; readonly dek: EnclaveKey; readonly marker: PairingMarker; }): Promise;