import { next as A } from '@automerge/automerge'; import { type DocumentId } from '@automerge/automerge-repo'; import { type Obj } from '@dxos/echo'; import { type DatabaseDirectory, type RetirementReason } from '@dxos/echo-protocol'; import { type SpaceId } from '@dxos/keys'; /** Ops below which a document is never retired for its history, however it grew. */ export declare const HISTORY_BLOAT_MIN_OPS = 100000; /** A `retired` entry of a space directory, read back; see {@link DatabaseDirectory.retired}. */ export type Retirement = { documentId: string; replacedBy: string; reason: RetirementReason; }; /** One object of a retired document, as the index last saw it. */ export type IndexedObject = { objectId: string; json: Obj.JSON; createdAt: number | null; }; /** * Id of a document derived from `seed` rather than random, so peers that create the document for the same reason * concurrently write into one document instead of linking several. */ export declare const deriveDocumentId: (seed: string) => Promise; /** * A document as one deterministic change: its actor is derived from `seed` and the content exactly as inserted, * and its timestamp is fixed. Peers that build the same state produce byte-identical changes that merge into one; * any difference yields a distinct actor, which Automerge merges as a conflict. */ export declare const buildDeterministicDocument: (seed: string, directory: DatabaseDirectory) => Promise>; /** Id of the document that replaces `documentId` when it is retired. */ export declare const replacementDocumentId: (documentId: DocumentId) => Promise; /** The replacement document of `documentId`; see {@link buildDeterministicDocument}. */ export declare const buildReplacementDocument: (documentId: DocumentId, directory: DatabaseDirectory) => Promise>; /** The directory that replaces an unloadable document: its objects rebuilt from the index, with no history. */ export declare const makeReplacementDirectory: ({ spaceId, spaceKey, objects, }: { spaceId: SpaceId; /** Written alongside `spaceId` for clients that still read it, as every new document is. */ spaceKey: string | null; objects: readonly IndexedObject[]; }) => DatabaseDirectory; /** Whether a document's history has outgrown its current state, which a rebuild without history would fix. */ export declare const isHistoryBloated: ({ ops, stateBytes }: { ops: number; stateBytes: number; }) => boolean; /** Whether every object's type is one {@link HISTORY_RETIREMENT_TYPES} allows to be rebuilt. */ export declare const isRetirableForHistory: (typeDXNs: readonly (string | null | undefined)[]) => boolean; //# sourceMappingURL=retirement.d.ts.map