@tonk/keepsync
Version:
A reactive sync engine framework for use with Tonk apps
38 lines (36 loc) • 1.11 kB
TypeScript
import { RepoConfig, Repo, StorageAdapterInterface, PeerId, NetworkAdapterInterface, DocumentId } from '@automerge/automerge-repo/slim';
/**
* Options for configuring the SyncEngine
*/
export interface SyncEngineOptions {
/** url of the service to resolve root document */
url: string;
/** Storage adapter for persistence */
storage?: StorageAdapterInterface;
/** Additional network adapters */
network?: NetworkAdapterInterface[];
/** Peer ID for this client */
peerId?: PeerId;
/** Share policy */
sharePolicy?: RepoConfig['sharePolicy'];
/** Ephemeral flag */
ephemeral?: boolean;
}
/**
* SyncEngine class for creating and configuring an Automerge Repo
*/
export declare class SyncEngine {
#private;
/**
* Create a new SyncEngine instance
* @param options Configuration options for the Repo
*/
constructor(options?: SyncEngineOptions);
whenReady(): Promise<void>;
/**
* Get the Automerge Repo instance
* @returns The configured Repo instance
*/
getRepo(): Repo;
getRootId(): DocumentId | undefined;
}