import { API as LowLevelApi } from "automerge-types"; import { Actor as ActorId, Prop, ObjID, Change, DecodedChange, Heads, MaterializeValue } from "automerge-types"; import { JsSyncState as SyncState, SyncMessage, DecodedSyncMessage } from "automerge-types"; export { API as LowLevelApi } from "automerge-types"; export { Actor as ActorId, Prop, ObjID, Change, DecodedChange, Heads, Automerge, MaterializeValue } from "automerge-types"; export { JsSyncState as SyncState, SyncMessage, DecodedSyncMessage } from "automerge-types"; export type ChangeOptions = { message?: string; time?: number; }; export class Int { value: number; constructor(value: number); } export class Uint { value: number; constructor(value: number); } export class Float64 { value: number; constructor(value: number); } export class Counter { value: number; constructor(value?: number); valueOf(): number; toString(): string; toJSON(): number; } export class Text { elems: AutomergeValue[]; constructor(text?: string | string[]); get length(): number; get(index: number): AutomergeValue | undefined; [index: number]: AutomergeValue | undefined; [Symbol.iterator](): { next(): { done: boolean; value: AutomergeValue; } | { done: boolean; value?: undefined; }; }; toString(): string; toSpans(): AutomergeValue[]; toJSON(): string; set(index: number, value: AutomergeValue): void; insertAt(index: number, ...values: AutomergeValue[]): void; deleteAt(index: number, numDelete?: number): void; map(callback: (e: AutomergeValue) => T): void; } export type Doc = { readonly [P in keyof T]: T[P]; }; export type ChangeFn = (doc: T) => void; export interface State { change: DecodedChange; snapshot: T; } export type ScalarValue = string | number | null | boolean | Date | Counter | Uint8Array; export type AutomergeValue = ScalarValue | {[key: string]: AutomergeValue;} | Array; type Conflicts = { [key: string]: AutomergeValue; }; type InitOptions = { actor?: ActorId, freeze?: boolean, }; export function use(api: LowLevelApi): void; export function getBackend(doc: Doc) : Automerge; export function init(actor?: ActorId | InitOptions): Doc; export function clone(doc: Doc): Doc; export function free(doc: Doc): void; export function from(initialState: T | Doc, actor?: ActorId): Doc; export function change(doc: Doc, options: string | ChangeOptions | ChangeFn, callback?: ChangeFn): Doc; export function emptyChange(doc: Doc, options: ChangeOptions): unknown; export function load(data: Uint8Array, actor?: ActorId): Doc; export function save(doc: Doc): Uint8Array; export function merge(local: Doc, remote: Doc): Doc; export function getActorId(doc: Doc): ActorId; export function getConflicts(doc: Doc, prop: Prop): Conflicts | undefined; export function getLastLocalChange(doc: Doc): Change | undefined; export function getObjectId(doc: Doc): ObjID; export function getChanges(oldState: Doc, newState: Doc): Change[]; export function getAllChanges(doc: Doc): Change[]; export function applyChanges(doc: Doc, changes: Change[]): [Doc]; export function getHistory(doc: Doc): State[]; export function equals(val1: Doc, val2: Doc): boolean; export function encodeSyncState(state: SyncState): Uint8Array; export function decodeSyncState(state: Uint8Array): SyncState; export function generateSyncMessage(doc: Doc, inState: SyncState): [SyncState, SyncMessage | null]; export function receiveSyncMessage(doc: Doc, inState: SyncState, message: SyncMessage): [Doc, SyncState, null]; export function initSyncState(): SyncState; export function encodeChange(change: DecodedChange): Change; export function decodeChange(data: Change): DecodedChange; export function encodeSyncMessage(message: DecodedSyncMessage): SyncMessage; export function decodeSyncMessage(message: SyncMessage): DecodedSyncMessage; export function getMissingDeps(doc: Doc, heads: Heads): Heads; export function getHeads(doc: Doc): Heads; export function dump(doc: Doc): void; export function toJS(doc: Doc): MaterializeValue; export function uuid(): string;