import { DocHandle, Repo } from '@automerge/automerge-repo'; import type { HookContext, Params, Application } from '@feathersjs/feathers'; import { SyncServiceCreate, SyncServiceInfo, Query } from '@kalisio/feathers-automerge'; export interface SyncServiceParams extends Params { user?: any; } export type RootDocument = { documents: SyncServiceInfo[]; }; export interface SyncServiceOptions { canAccess: (query: Query, params: Params) => Promise; initializeDocument(servicePath: string, query: Query, documents: SyncServiceInfo[]): Promise; getDocumentsForData(servicePath: string, data: unknown, documents: SyncServiceInfo[]): Promise; } export declare class AutomergeSyncService { repo: Repo; rootDocument: DocHandle; options: SyncServiceOptions; app?: Application; docHandles: Record>; processedChanges: Set; pendingRemovals: Set; servicePath?: string; constructor(repo: Repo, rootDocument: DocHandle, options: SyncServiceOptions); checkAccess(query: Query, params: SyncServiceParams, throwError?: boolean): Promise; find(params?: SyncServiceParams): Promise; get(url: string, params?: SyncServiceParams): Promise>; create(payload: SyncServiceCreate, params?: SyncServiceParams): Promise; remove(url: string, params?: SyncServiceParams): Promise; handleEvent(servicePath: string, eventName: string, data: any, context: HookContext): Promise; syncExistingData(handle: DocHandle): Promise; handleDocument({ url }: SyncServiceInfo): Promise; listenService(servicePath: string): void; setup(app: Application, myPath: string): Promise; }