lsync API
    Preparing search index...

    Interface Context

    interface Context {
        callApi: (call: { input?: unknown; path: string }) => unknown;
        changes: (
            query: { collections: Record<string, number>; limit?: number },
        ) =>
            | {
                cursors?: Record<string, number>;
                hasMore: boolean;
                type: "changes";
                updates: {
                    clientId?: string;
                    collection: string;
                    createdAt: number;
                    id: string;
                    key: string | number;
                    path?: string;
                    previousValue?: unknown;
                    sequence: number;
                    serverCreatedAt: string;
                    type: "insert" | "update" | "delete";
                    value?: unknown;
                }[];
                watermark: number;
            }
            | { collections: string[]; type: "resyncRequired"; watermark: number };
        mutate: (
            batch: {
                updates: {
                    clientId?: string;
                    collection: string;
                    createdAt: number;
                    id: string;
                    key: string | number;
                    path?: string;
                    previousValue?: unknown;
                    type: "insert" | "update" | "delete";
                    value?: unknown;
                }[];
            },
        ) => { accepted: number; watermark: number };
        persist: (
            batch: {
                updates: {
                    clientId?: string;
                    collection: string;
                    createdAt: number;
                    id: string;
                    key: string | number;
                    path?: string;
                    previousValue?: unknown;
                    type: "insert" | "update" | "delete";
                    value?: unknown;
                }[];
            },
        ) => SequencedBatch;
        publish: (batch: SequencedBatch) => void;
        read: (query: ReadQuery) => ReadResult;
        shardId: string;
        subscribe: (
            input: { collection: string },
        ) => { collection: string; subscriptions: string[] };
        unsubscribe: (
            input: { collection: string },
        ) => { collection: string; subscriptions: string[] };
        validate: (
            batch: {
                updates: {
                    clientId?: string;
                    collection: string;
                    createdAt: number;
                    id: string;
                    key: string | number;
                    path?: string;
                    previousValue?: unknown;
                    type: "insert" | "update" | "delete";
                    value?: unknown;
                }[];
            },
        ) => void;
    }
    Index
    callApi: (call: { input?: unknown; path: string }) => unknown
    changes: (
        query: { collections: Record<string, number>; limit?: number },
    ) =>
        | {
            cursors?: Record<string, number>;
            hasMore: boolean;
            type: "changes";
            updates: {
                clientId?: string;
                collection: string;
                createdAt: number;
                id: string;
                key: string | number;
                path?: string;
                previousValue?: unknown;
                sequence: number;
                serverCreatedAt: string;
                type: "insert" | "update" | "delete";
                value?: unknown;
            }[];
            watermark: number;
        }
        | { collections: string[]; type: "resyncRequired"; watermark: number }
    mutate: (
        batch: {
            updates: {
                clientId?: string;
                collection: string;
                createdAt: number;
                id: string;
                key: string | number;
                path?: string;
                previousValue?: unknown;
                type: "insert" | "update" | "delete";
                value?: unknown;
            }[];
        },
    ) => { accepted: number; watermark: number }
    persist: (
        batch: {
            updates: {
                clientId?: string;
                collection: string;
                createdAt: number;
                id: string;
                key: string | number;
                path?: string;
                previousValue?: unknown;
                type: "insert" | "update" | "delete";
                value?: unknown;
            }[];
        },
    ) => SequencedBatch
    publish: (batch: SequencedBatch) => void
    read: (query: ReadQuery) => ReadResult
    shardId: string
    subscribe: (
        input: { collection: string },
    ) => { collection: string; subscriptions: string[] }
    unsubscribe: (
        input: { collection: string },
    ) => { collection: string; subscriptions: string[] }
    validate: (
        batch: {
            updates: {
                clientId?: string;
                collection: string;
                createdAt: number;
                id: string;
                key: string | number;
                path?: string;
                previousValue?: unknown;
                type: "insert" | "update" | "delete";
                value?: unknown;
            }[];
        },
    ) => void