import * as Y from 'yjs'; /** Default upper bound for one inbound update or snapshot (32 MiB). */ export declare const MAX_UPDATE_BYTES: number; export type ApplyResult = { ok: true; } | { ok: false; reason: string; }; export interface ApplyOptions { /** Reject payloads larger than this. Default {@link MAX_UPDATE_BYTES}. */ maxBytes?: number; /** Structurally decode the update before touching the document. Default true. */ validate?: boolean; } /** Encode the whole document state as one update (usable as a persisted snapshot). */ export declare function encodeSnapshot(doc: Y.Doc): Uint8Array; /** Encode what `doc` has that a peer with state vector `peerStateVector` lacks. */ export declare function encodeDiff(doc: Y.Doc, peerStateVector?: Uint8Array): Uint8Array; export declare function encodeStateVector(doc: Y.Doc): Uint8Array; /** * Check that `update` is a well-formed Yjs update without applying it. Decoding happens before any * integration, so a payload that fails here can never half-apply (a malformed delete set would * otherwise throw only after structs were integrated). */ export declare function validateUpdate(update: unknown, maxBytes?: number): ApplyResult; /** Apply a possibly hostile update; never throws, reports why a payload was rejected. */ export declare function applyUpdateSafe(doc: Y.Doc, update: unknown, origin?: unknown, options?: ApplyOptions): ApplyResult; /** Build a fresh document from a snapshot; throws when the snapshot is invalid. */ export declare function restoreSnapshot(snapshot: Uint8Array, options?: ApplyOptions): Y.Doc; /** Merge several updates into one without a document (compaction of an update log). */ export declare function mergeUpdates(updates: readonly Uint8Array[]): Uint8Array; /** Base64 for transports that carry text (JSON, postMessage); works without Buffer or DOM. */ export declare function toBase64(bytes: Uint8Array): string; /** Inverse of {@link toBase64}; returns `null` for input that is not valid base64. */ export declare function fromBase64(text: string): Uint8Array | null; //# sourceMappingURL=codec.d.ts.map