lsync API
    Preparing search index...

    Interface ApiHandlerContext

    interface ApiHandlerContext {
        auth: AccessAuth;
        clientId?: string;
        shardId: string;
        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;
        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;
    }

    Hierarchy (View Summary)

    Index
    clientId?: string
    shardId: string
    • Parameters

      • query: { collections: Record<string, number>; limit?: number }

      Returns
          | {
              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 }

    • Parameters

      • batch: {
            updates: {
                clientId?: string;
                collection: string;
                createdAt: number;
                id: string;
                key: string | number;
                path?: string;
                previousValue?: unknown;
                type: "insert" | "update" | "delete";
                value?: unknown;
            }[];
        }

      Returns { accepted: number; watermark: number }

    • Parameters

      • batch: {
            updates: {
                clientId?: string;
                collection: string;
                createdAt: number;
                id: string;
                key: string | number;
                path?: string;
                previousValue?: unknown;
                type: "insert" | "update" | "delete";
                value?: unknown;
            }[];
        }

      Returns SequencedBatch

    • Parameters

      • input: { collection: string }

      Returns { collection: string; subscriptions: string[] }

    • Parameters

      • input: { collection: string }

      Returns { collection: string; subscriptions: string[] }

    • Parameters

      • batch: {
            updates: {
                clientId?: string;
                collection: string;
                createdAt: number;
                id: string;
                key: string | number;
                path?: string;
                previousValue?: unknown;
                type: "insert" | "update" | "delete";
                value?: unknown;
            }[];
        }

      Returns void