import * as A from '@automerge/automerge'; import { type DocumentId } from '@automerge/automerge-repo'; import * as Effect from 'effect/Effect'; import { type Context } from '@dxos/context'; import { type DataSourceCursor, type DocumentActivity, type IndexDataSource, type IndexerObject } from '@dxos/index-core'; import { type AutomergeHost } from '../automerge/index.ts'; /** * Codec for serializing/deserializing Automerge heads to cursor strings. */ export declare const headsCodec: { /** * Serialize automerge heads to a cursor string. * Heads are sorted to ensure consistent comparison. */ encode: (heads: A.Heads) => string; /** * Deserialize a cursor string back to heads array. */ decode: (cursor: string) => string[]; }; export type AutomergeDataSourceOptions = { isBranchDocument?: (documentId: DocumentId) => boolean; /** * Stores a space root's directory JSON at heads its document is saved at, so the root can be opened from it * without loading Automerge. Called for each changed document `isSpaceRoot` names. */ directories?: { isSpaceRoot: (documentId: DocumentId) => boolean; store: (documentId: DocumentId, snapshot: { heads: A.Heads; json: string; }) => Promise; }; }; /** * Data source that fetches objects from AutomergeHost. * Iterates all documents from SqliteHeadsStore and tracks document heads as cursors to detect changes. */ export declare class AutomergeDataSource implements IndexDataSource { #private; readonly sourceName = "automerge"; constructor(automergeHost: AutomergeHost, options?: AutomergeDataSourceOptions); beginPass(): void; endPass(): void; getChangedObjects(ctx: Context, cursors: DataSourceCursor[], opts?: { limit?: number; activity?: boolean; objects?: boolean; countCatchUp?: boolean; }): Effect.Effect<{ objects: IndexerObject[]; cursors: DataSourceCursor[]; activity?: DocumentActivity[]; more: boolean; catchUp?: number; }>; } //# sourceMappingURL=automerge-data-source.d.ts.map