import { CommitInfo, GetLocalStoreFn } from './types'; export declare type DocAndMetadata = { doc: Doc; metadata: CommitMetadata; }; export declare type CommitDoc = { ref: string; } & DocAndMetadata; export declare type ComputeRefFn = (baseRef: string | undefined, mergeRef: string | undefined, delta: Delta | undefined) => string; export declare type DiffFn = (prior: SavedDoc | undefined, doc: SavedDoc) => Delta | undefined; export declare type PatchFn = (priorOrNext: SavedDoc | undefined, delta: Delta | undefined) => SavedDoc; export declare type AddNewCommitMetadataFn = (metadata: CommitMetadata, commitRef: string, userId: string, clientId: string) => CommitMetadata; export interface DocCache { get: (ref: string) => CommitDoc | undefined; set: (ref: string, doc: CommitDoc) => void; has: (ref: string) => boolean; delete: (ref: string) => void; } export declare type MergeHelpers = { getCommitInfo(ref: string): CommitInfo; computeLatestDoc(ref: string): CommitDoc; addMerge(doc: LatestDoc, metadata: CommitMetadata, temp: boolean, leftRef: string, rightRef: string): string; }; export declare type MergeAllBranchesFn = (branchHeadRefs: string[], helpers: MergeHelpers) => void; export declare type MigrateDocFn = (doc: SavedDoc, metadata: CommitMetadata) => DocAndMetadata; export interface Differ { /** Computed the difference between two Docs */ readonly diff: DiffFn; /** Apply a patch from one Doc to another */ readonly patch: PatchFn; } export declare type TrimergeClientOptions = { readonly differ: Differ; /** Calculate the ref string for a given edit */ readonly computeRef: ComputeRefFn; /** Merge all head commits */ readonly mergeAllBranches: MergeAllBranchesFn; /** Get the Local commit store. */ readonly getLocalStore: GetLocalStoreFn; /** How to convert a historical format of your document to the latest version of the document. * If not supplied, the document will always be treated as if it is in the latest format. */ readonly migrate?: MigrateDocFn; readonly addNewCommitMetadata?: AddNewCommitMetadataFn; /** This is an optional entry point to an alternative storage system for documents. This allows * consumers of TrimergeClient to create snapshots of the document and cut off the recursive * building up of the Document. */ readonly docCache?: DocCache; };