/** * Shared sync operations for CLI and MCP. * Contains the core logic for exporting and importing events from sync backends. */ import type { SyncBackend } from '@livestore/common'; import { UnknownError } from '@livestore/common'; import { Effect, type FileSystem, type HttpClient, Schema, type Scope } from '@livestore/utils/effect'; /** * Schema for the export file format. * Contains metadata about the export and an array of events in global encoded format. */ export declare const ExportFileSchema: Schema.Struct<{ /** Format version for future compatibility */ version: Schema.Literal<[1]>; /** Store identifier */ storeId: typeof Schema.String; /** ISO timestamp of when the export was created */ exportedAt: typeof Schema.String; /** Total number of events in the export */ eventCount: typeof Schema.Number; /** Array of events in global encoded format */ events: Schema.Array$, number, never>; parentSeqNum: Schema.BrandSchema, number, never>; clientId: typeof Schema.String; sessionId: typeof Schema.String; }>>; }>; export type ExportFile = typeof ExportFileSchema.Type; declare const ConnectionError_base: Schema.TaggedErrorClass; } & { cause: typeof Schema.Defect; note: typeof Schema.String; }>; export declare class ConnectionError extends ConnectionError_base { } declare const ExportError_base: Schema.TaggedErrorClass; } & { cause: typeof Schema.Defect; note: typeof Schema.String; }>; export declare class ExportError extends ExportError_base { } declare const ImportError_base: Schema.TaggedErrorClass; } & { cause: typeof Schema.Defect; note: typeof Schema.String; }>; export declare class ImportError extends ImportError_base { } /** * Creates a sync backend connection from a user module and verifies connectivity. * This is a simplified version of the MCP runtime that only creates the sync backend. */ export declare const makeSyncBackend: ({ configPath, storeId, clientId, }: { /** Absolute or cwd-relative path to a module exporting `schema` and `syncBackend`. */ configPath: string; /** Identifier to scope the backend connection. */ storeId: string; /** Client identifier used when establishing the sync connection. */ clientId: string; }) => Effect.Effect; export interface ExportResult { storeId: string; eventCount: number; exportedAt: string; backendName: string; /** The export data as JSON string (for MCP) or written to file (for CLI) */ data: ExportFile; } /** * Core export operation - pulls all events from sync backend. * Returns the export data structure without writing to file. */ export declare const pullEventsFromSyncBackend: ({ configPath, storeId, clientId, }: { configPath: string; storeId: string; clientId: string; }) => Effect.Effect; export interface ImportResult { storeId: string; eventCount: number; /** Whether this was a dry run */ dryRun: boolean; backendName?: string; } export interface ImportValidationResult { storeId: string; eventCount: number; sourceStoreId: string; storeIdMismatch: boolean; } /** * Validates an export file for import. * Returns validation info without actually importing. */ export declare const validateExportData: ({ data, targetStoreId, }: { data: unknown; targetStoreId: string; }) => Effect.Effect; /** * Core import operation - pushes events to sync backend. * Validates that the backend is empty before importing. */ export declare const pushEventsToSyncBackend: ({ configPath, storeId, clientId, data, force, dryRun, onProgress, }: { configPath: string; storeId: string; clientId: string; /** The export data to import (already parsed) */ data: unknown; force: boolean; dryRun: boolean; onProgress?: (pushed: number, total: number) => Effect.Effect; }) => Effect.Effect; export {}; //# sourceMappingURL=sync-operations.d.ts.map