export type PersistentBlockIdentityRepairReason = 'missing' | 'duplicate'; export interface PersistentBlockIdentityNode { attributes?: Record | null; clientId: string; innerBlocks?: readonly PersistentBlockIdentityNode[]; } export interface PersistentBlockIdentityRepair { clientId: string; nextValue: string; previousValue: string | null; reason: PersistentBlockIdentityRepairReason; } export interface EnsurePersistentBlockIdentityOptions { duplicateDetection?: boolean; existingIds?: Iterable; generateId?: (prefix: string) => string; prefix: string; seenIds?: Iterable; value: unknown; } export interface EnsurePersistentBlockIdentityResult { changed: boolean; previousValue: string | null; reason: PersistentBlockIdentityRepairReason | null; value: string; } export interface CollectPersistentBlockIdentityRepairsOptions { attributeName: string; duplicateDetection?: boolean; generateId?: (prefix: string) => string; prefix: string; } /** * Generate a UUID v4-style id for block attributes. * * @returns A runtime-safe UUID-like identifier for generated block data. * @category Utilities */ export declare function generateBlockId(): string; /** * Generate a prefixed runtime id for client-side attributes such as uniqueId. * * @param prefix Prefix chosen by the scaffold/template. * @returns A prefix-scoped identifier suitable for client-only attribute values. * @category Utilities */ export declare function generateScopedClientId(prefix: string): string; /** * Generate a prefixed persistence resource key. * * @param prefix Prefix chosen by the scaffold/template. * @returns A prefix-scoped identifier for persistence resource keys. * @category Utilities */ export declare function generateResourceKey(prefix: string): string; /** * Generate an opaque id for one public write attempt. * * @returns A UUID-like request identifier that can be attached to one write operation. * @category Utilities */ export declare function generatePublicWriteRequestId(): string; /** * Resolve one persistent block id against the ids already used in the current * document tree. * * Missing ids always get generated. Duplicate repair only happens when * `duplicateDetection` is enabled and the current value is already present in * `seenIds`. * * @param options Current id plus scope metadata used to preserve valid values and generate safe replacements. * @returns The preserved or regenerated persistent id and whether it changed. * @category Utilities */ export declare function ensurePersistentBlockIdentity(options: EnsurePersistentBlockIdentityOptions): EnsurePersistentBlockIdentityResult; /** * Collect the persistent-id repairs required to make one document tree safe for * duplicate-aware structured block workflows. * * Existing non-empty ids are preserved when they are unique. Missing ids are * generated, and only the later duplicates in one depth-first traversal are * repaired when duplicate detection is enabled. * * @param blocks Current document tree rooted at the relevant editor scope. * @param options Attribute key plus prefix/generator settings. * @returns One repair patch per block that should regenerate or seed its persistent id. * @category Utilities */ export declare function collectPersistentBlockIdentityRepairs(blocks: readonly PersistentBlockIdentityNode[], options: CollectPersistentBlockIdentityRepairsOptions): PersistentBlockIdentityRepair[];