@livestore/cli 0.0.0-snapshot-29b38715366635e2fffea5f896089d326087c0f2 → 0.0.0-snapshot-1c5e370f46628c955d00cb8458252ce4aa495cb2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/cli.d.ts +1 -15
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +1 -2
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/mcp-tool-handlers.d.ts +1 -5
  6. package/dist/commands/mcp-tool-handlers.d.ts.map +1 -1
  7. package/dist/commands/mcp-tool-handlers.js +4 -37
  8. package/dist/commands/mcp-tool-handlers.js.map +1 -1
  9. package/dist/commands/mcp-tools-defs.d.ts +1 -31
  10. package/dist/commands/mcp-tools-defs.d.ts.map +1 -1
  11. package/dist/commands/mcp-tools-defs.js +5 -87
  12. package/dist/commands/mcp-tools-defs.js.map +1 -1
  13. package/dist/commands/new-project.d.ts +1 -1
  14. package/dist/mcp-runtime/runtime.d.ts +3 -4
  15. package/dist/mcp-runtime/runtime.d.ts.map +1 -1
  16. package/dist/mcp-runtime/runtime.js +53 -19
  17. package/dist/mcp-runtime/runtime.js.map +1 -1
  18. package/dist/tsconfig.tsbuildinfo +1 -1
  19. package/package.json +8 -8
  20. package/src/cli.ts +1 -2
  21. package/src/commands/mcp-tool-handlers.ts +5 -44
  22. package/src/commands/mcp-tools-defs.ts +4 -92
  23. package/src/mcp-runtime/runtime.ts +65 -32
  24. package/dist/commands/import-export.d.ts +0 -34
  25. package/dist/commands/import-export.d.ts.map +0 -1
  26. package/dist/commands/import-export.js +0 -123
  27. package/dist/commands/import-export.js.map +0 -1
  28. package/dist/module-loader.d.ts +0 -22
  29. package/dist/module-loader.d.ts.map +0 -1
  30. package/dist/module-loader.js +0 -75
  31. package/dist/module-loader.js.map +0 -1
  32. package/dist/sync-operations.d.ts +0 -118
  33. package/dist/sync-operations.d.ts.map +0 -1
  34. package/dist/sync-operations.js +0 -164
  35. package/dist/sync-operations.js.map +0 -1
  36. package/src/commands/import-export.ts +0 -262
  37. package/src/module-loader.ts +0 -93
  38. package/src/sync-operations.ts +0 -326
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/cli",
3
- "version": "0.0.0-snapshot-29b38715366635e2fffea5f896089d326087c0f2",
3
+ "version": "0.0.0-snapshot-1c5e370f46628c955d00cb8458252ce4aa495cb2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -11,17 +11,17 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@effect/ai-openai": "0.32.0",
14
- "@livestore/adapter-node": "0.0.0-snapshot-29b38715366635e2fffea5f896089d326087c0f2",
15
- "@livestore/livestore": "0.0.0-snapshot-29b38715366635e2fffea5f896089d326087c0f2",
16
- "@livestore/peer-deps": "0.0.0-snapshot-29b38715366635e2fffea5f896089d326087c0f2",
17
- "@livestore/common": "0.0.0-snapshot-29b38715366635e2fffea5f896089d326087c0f2",
18
- "@livestore/sync-cf": "0.0.0-snapshot-29b38715366635e2fffea5f896089d326087c0f2",
19
- "@livestore/utils": "0.0.0-snapshot-29b38715366635e2fffea5f896089d326087c0f2"
14
+ "@livestore/adapter-node": "0.0.0-snapshot-1c5e370f46628c955d00cb8458252ce4aa495cb2",
15
+ "@livestore/common": "0.0.0-snapshot-1c5e370f46628c955d00cb8458252ce4aa495cb2",
16
+ "@livestore/livestore": "0.0.0-snapshot-1c5e370f46628c955d00cb8458252ce4aa495cb2",
17
+ "@livestore/peer-deps": "0.0.0-snapshot-1c5e370f46628c955d00cb8458252ce4aa495cb2",
18
+ "@livestore/sync-cf": "0.0.0-snapshot-1c5e370f46628c955d00cb8458252ce4aa495cb2",
19
+ "@livestore/utils": "0.0.0-snapshot-1c5e370f46628c955d00cb8458252ce4aa495cb2"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "24.10.1",
23
23
  "typescript": "5.9.2",
24
- "@livestore/utils-dev": "0.0.0-snapshot-29b38715366635e2fffea5f896089d326087c0f2"
24
+ "@livestore/utils-dev": "0.0.0-snapshot-1c5e370f46628c955d00cb8458252ce4aa495cb2"
25
25
  },
26
26
  "files": [
27
27
  "package.json",
package/src/cli.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { Cli } from '@livestore/utils/node'
2
- import { syncCommand } from './commands/import-export.ts'
3
2
  import { mcpCommand } from './commands/mcp.ts'
4
3
  import { createCommand } from './commands/new-project.ts'
5
4
 
6
5
  export const command = Cli.Command.make('livestore', {
7
6
  verbose: Cli.Options.boolean('verbose').pipe(Cli.Options.withDefault(false)),
8
- }).pipe(Cli.Command.withSubcommands([mcpCommand, createCommand, syncCommand]))
7
+ }).pipe(Cli.Command.withSubcommands([mcpCommand, createCommand]))
@@ -1,20 +1,14 @@
1
- import { Effect, FetchHttpClient, Layer, type Toolkit } from '@livestore/utils/effect'
2
- import { PlatformNode } from '@livestore/utils/node'
1
+ import { Effect } from '@livestore/utils/effect'
3
2
  import { blogSchemaContent } from '../mcp-content/schemas/blog.ts'
4
3
  import { ecommerceSchemaContent } from '../mcp-content/schemas/ecommerce.ts'
5
4
  import { socialSchemaContent } from '../mcp-content/schemas/social.ts'
6
5
  import { todoSchemaContent } from '../mcp-content/schemas/todo.ts'
7
6
  import * as Runtime from '../mcp-runtime/runtime.ts'
8
- import * as SyncOps from '../sync-operations.ts'
9
7
  import { coachToolHandler } from './mcp-coach.ts'
10
8
  import { livestoreToolkit } from './mcp-tools-defs.ts'
11
9
 
12
- /** Layer providing FileSystem and HttpClient for sync operations */
13
- const SyncOpsLayer = Layer.mergeAll(PlatformNode.NodeFileSystem.layer, FetchHttpClient.layer)
14
-
15
- type LivestoreToolHandlers = Toolkit.HandlersFrom<Toolkit.Tools<typeof livestoreToolkit>>
16
-
17
- export const toolHandlers: LivestoreToolHandlers = livestoreToolkit.of({
10
+ // Tool handlers using Tim Smart's pattern
11
+ export const toolHandlers: any = livestoreToolkit.of({
18
12
  livestore_coach: coachToolHandler,
19
13
 
20
14
  livestore_generate_schema: Effect.fnUntraced(function* ({ schemaType, customDescription }) {
@@ -127,13 +121,8 @@ export const schema = Schema.create({
127
121
  }),
128
122
 
129
123
  // Connect the single in-process LiveStore instance from user module
130
- livestore_instance_connect: Effect.fnUntraced(function* ({ configPath, storeId, clientId, sessionId }) {
131
- const store = yield* Runtime.init({
132
- configPath,
133
- storeId,
134
- ...(clientId !== undefined ? { clientId } : {}),
135
- ...(sessionId !== undefined ? { sessionId } : {}),
136
- }).pipe(Effect.orDie)
124
+ livestore_instance_connect: Effect.fnUntraced(function* ({ storePath, storeId, clientId, sessionId }) {
125
+ const store = yield* Runtime.init({ storePath, storeId, clientId, sessionId }).pipe(Effect.orDie)
137
126
  const eventNames = Array.from(store.schema.eventsDefsMap.keys())
138
127
  const tableNames = Array.from(store.schema.state.sqlite.tables.keys())
139
128
 
@@ -167,32 +156,4 @@ export const schema = Schema.create({
167
156
  livestore_instance_disconnect: Effect.fnUntraced(function* () {
168
157
  return yield* Runtime.disconnect
169
158
  }),
170
-
171
- // Sync export - pull all events from sync backend
172
- livestore_sync_export: Effect.fnUntraced(function* ({ configPath, storeId, clientId }) {
173
- const result = yield* SyncOps.pullEventsFromSyncBackend({
174
- configPath,
175
- storeId,
176
- clientId: clientId ?? 'mcp-export',
177
- }).pipe(Effect.scoped, Effect.provide(SyncOpsLayer), Effect.orDie)
178
-
179
- return {
180
- storeId: result.storeId,
181
- eventCount: result.eventCount,
182
- exportedAt: result.exportedAt,
183
- data: result.data,
184
- }
185
- }),
186
-
187
- // Sync import - push events to sync backend
188
- livestore_sync_import: Effect.fnUntraced(function* ({ configPath, storeId, clientId, data, force, dryRun }) {
189
- return yield* SyncOps.pushEventsToSyncBackend({
190
- configPath,
191
- storeId,
192
- clientId: clientId ?? 'mcp-import',
193
- data,
194
- force: force ?? false,
195
- dryRun: dryRun ?? false,
196
- }).pipe(Effect.scoped, Effect.provide(SyncOpsLayer), Effect.orDie)
197
- }),
198
159
  })
@@ -43,7 +43,7 @@ export const livestoreToolkit = Toolkit.make(
43
43
  Notes:
44
44
  - Only one instance can be active at a time; calling connect again shuts down and replaces the previous instance.
45
45
  - Reconnecting creates a fresh, in-memory client database. The state visible to queries is populated by your backend's initial sync behavior; depending on configuration, you may briefly observe empty or partial data until sync completes.
46
- - \`configPath\` is resolved relative to the current working directory.
46
+ - \`storePath\` is resolved relative to the current working directory.
47
47
  - \`syncBackend\` must be a function (factory) that returns a backend; \`syncPayload\` must be JSON-serializable.
48
48
 
49
49
  Module contract (generic example):
@@ -63,13 +63,13 @@ export const syncPayload = { authToken: process.env.LIVESTORE_SYNC_AUTH_TOKEN ??
63
63
 
64
64
  Connect parameters:
65
65
  {
66
- "configPath": "livestore-cli.config.ts",
66
+ "storePath": "<path-to-your-mcp-module>.ts",
67
67
  "storeId": "<store-id>"
68
68
  }
69
69
 
70
70
  Optional identifiers to group client state on the server:
71
71
  {
72
- "configPath": "livestore-cli.config.ts",
72
+ "storePath": "<path-to-your-mcp-module>.ts",
73
73
  "storeId": "<store-id>",
74
74
  "clientId": "<client-id>",
75
75
  "sessionId": "<session-id>"
@@ -86,7 +86,7 @@ Returns on success:
86
86
  }
87
87
  }`,
88
88
  parameters: {
89
- configPath: Schema.String.annotations({
89
+ storePath: Schema.String.annotations({
90
90
  description: 'Path to a module that exports named variables: schema and syncBackend',
91
91
  }),
92
92
  storeId: Schema.String.annotations({ description: 'Required store id for the LiveStore instance.' }),
@@ -226,92 +226,4 @@ Example success:
226
226
  parameters: {},
227
227
  success: Schema.TaggedStruct('disconnected', {}),
228
228
  }),
229
-
230
- Tool.make('livestore_sync_export', {
231
- description: `Export all events from a sync backend to JSON data.
232
-
233
- This tool connects directly to the sync backend (without creating a full LiveStore instance) and pulls all events. Useful for backup, migration, and debugging.
234
-
235
- Module contract (same as livestore_instance_connect):
236
- \`\`\`ts
237
- export { schema } from './src/livestore/schema.ts'
238
- export const syncBackend = makeWsSync({ url: process.env.LIVESTORE_SYNC_URL ?? 'ws://localhost:8787' })
239
- export const syncPayload = { authToken: process.env.LIVESTORE_SYNC_AUTH_TOKEN }
240
- \`\`\`
241
-
242
- Example parameters:
243
- {
244
- "configPath": "livestore-cli.config.ts",
245
- "storeId": "my-store"
246
- }
247
-
248
- Returns on success:
249
- {
250
- "storeId": "my-store",
251
- "eventCount": 127,
252
- "exportedAt": "2024-01-15T10:30:00.000Z",
253
- "data": { "version": 1, "storeId": "my-store", ... }
254
- }`,
255
- parameters: {
256
- configPath: Schema.String.annotations({
257
- description: 'Path to a module that exports schema and syncBackend',
258
- }),
259
- storeId: Schema.String.annotations({ description: 'Store identifier' }),
260
- clientId: Schema.optional(Schema.String.annotations({ description: 'Client identifier (default: mcp-export)' })),
261
- },
262
- success: Schema.Struct({
263
- storeId: Schema.String,
264
- eventCount: Schema.Number,
265
- exportedAt: Schema.String,
266
- data: Schema.JsonValue.annotations({ description: 'The export file data (can be saved or passed to import)' }),
267
- }),
268
- }).annotate(Tool.Readonly, true),
269
-
270
- Tool.make('livestore_sync_import', {
271
- description: `Import events from export data to a sync backend.
272
-
273
- This tool connects directly to the sync backend and pushes events. The sync backend must be empty.
274
-
275
- Example parameters:
276
- {
277
- "configPath": "livestore-cli.config.ts",
278
- "storeId": "my-store",
279
- "data": { "version": 1, "storeId": "my-store", "events": [...] }
280
- }
281
-
282
- With options:
283
- {
284
- "configPath": "livestore-cli.config.ts",
285
- "storeId": "my-store",
286
- "data": { ... },
287
- "force": true, // Import even if store ID doesn't match
288
- "dryRun": true // Validate without importing
289
- }
290
-
291
- Returns on success:
292
- {
293
- "storeId": "my-store",
294
- "eventCount": 127,
295
- "dryRun": false
296
- }`,
297
- parameters: {
298
- configPath: Schema.String.annotations({
299
- description: 'Path to a module that exports schema and syncBackend',
300
- }),
301
- storeId: Schema.String.annotations({ description: 'Store identifier' }),
302
- clientId: Schema.optional(Schema.String.annotations({ description: 'Client identifier (default: mcp-import)' })),
303
- data: Schema.JsonValue.annotations({
304
- description: 'The export data to import (from livestore_sync_export or a file)',
305
- }),
306
- force: Schema.optional(
307
- Schema.Boolean.annotations({ description: 'Force import even if store ID does not match' }),
308
- ),
309
- dryRun: Schema.optional(Schema.Boolean.annotations({ description: 'Validate without actually importing' })),
310
- },
311
- success: Schema.Struct({
312
- storeId: Schema.String,
313
- eventCount: Schema.Number,
314
- dryRun: Schema.Boolean,
315
- }),
316
- }).annotate(Tool.Destructive, true),
317
229
  )
@@ -1,40 +1,77 @@
1
+ import path from 'node:path'
2
+ import { pathToFileURL } from 'node:url'
1
3
  import { makeAdapter as makeNodeAdapter } from '@livestore/adapter-node'
2
- import type { UnknownError } from '@livestore/common'
3
- import { LiveStoreEvent, SystemTables } from '@livestore/common/schema'
4
+ import { isLiveStoreSchema, LiveStoreEvent, SystemTables } from '@livestore/common/schema'
4
5
  import type { Store } from '@livestore/livestore'
5
6
  import { createStorePromise } from '@livestore/livestore'
6
- import { Effect, FetchHttpClient, Layer, Option, Schema } from '@livestore/utils/effect'
7
- import { PlatformNode } from '@livestore/utils/node'
8
-
9
- import { loadModuleConfig } from '../module-loader.ts'
7
+ import { shouldNeverHappen } from '@livestore/utils'
8
+ import { Effect, Option, Schema } from '@livestore/utils/effect'
10
9
 
11
10
  /** Currently connected store */
12
11
  let store: Store<any> | undefined
13
12
 
14
- /** Layer providing FileSystem and HttpClient for module loading */
15
- const ModuleLoaderLayer = Layer.mergeAll(PlatformNode.NodeFileSystem.layer, FetchHttpClient.layer)
16
-
17
13
  /**
18
14
  * Dynamically imports a module that exports a `makeStore({ storeId }): Promise<Store>` function,
19
15
  * calls it with the provided storeId, and caches the Store instance for subsequent tool calls.
20
16
  */
21
17
  export const init = ({
22
- configPath,
18
+ storePath,
23
19
  storeId,
24
20
  clientId,
25
21
  sessionId,
26
22
  }: {
27
- configPath: string
23
+ storePath: string
28
24
  storeId: string
29
25
  clientId?: string
30
26
  sessionId?: string
31
- }): Effect.Effect<Store<any>, UnknownError> =>
32
- Effect.gen(function* () {
27
+ }) =>
28
+ Effect.promise(async () => {
33
29
  if (!storeId || typeof storeId !== 'string') {
34
- return yield* Effect.die(new Error('Invalid storeId: expected a non-empty string'))
30
+ throw new Error('Invalid storeId: expected a non-empty string')
31
+ }
32
+ // Resolve to absolute path and import as file URL
33
+ const abs = path.isAbsolute(storePath) ? storePath : path.resolve(process.cwd(), storePath)
34
+ const mod = await import(pathToFileURL(abs).href)
35
+
36
+ // Validate required exports
37
+ const schema = (mod as any)?.schema
38
+ if (!isLiveStoreSchema(schema)) {
39
+ throw new Error(
40
+ `Module at ${abs} must export a valid LiveStore 'schema'. Ex: export { schema } from './src/livestore/schema.ts'`,
41
+ )
35
42
  }
36
43
 
37
- const { schema, syncBackendConstructor, syncPayloadSchema, syncPayload } = yield* loadModuleConfig({ configPath })
44
+ const syncBackend = (mod as any)?.syncBackend
45
+ if (typeof syncBackend !== 'function') {
46
+ throw new Error(
47
+ `Module at ${abs} must export a 'syncBackend' constructor (e.g., makeWsSync({ url })). Ex: export const syncBackend = makeWsSync({ url })`,
48
+ )
49
+ }
50
+
51
+ // Optional: syncPayload for authenticated backends
52
+ const syncPayloadSchemaExport = (mod as any)?.syncPayloadSchema
53
+ const syncPayloadSchema =
54
+ syncPayloadSchemaExport === undefined
55
+ ? Schema.JsonValue
56
+ : Schema.isSchema(syncPayloadSchemaExport)
57
+ ? (syncPayloadSchemaExport as Schema.Schema<any>)
58
+ : shouldNeverHappen(
59
+ `Exported 'syncPayloadSchema' from ${abs} must be an Effect Schema (received ${typeof syncPayloadSchemaExport}).`,
60
+ )
61
+
62
+ const syncPayloadExport = (mod as any)?.syncPayload
63
+ const syncPayload =
64
+ syncPayloadExport === undefined
65
+ ? undefined
66
+ : (() => {
67
+ try {
68
+ return Schema.decodeSync(syncPayloadSchema)(syncPayloadExport)
69
+ } catch (error) {
70
+ throw new Error(
71
+ `Failed to decode 'syncPayload' from ${abs} using the provided schema: ${(error as Error).message}`,
72
+ )
73
+ }
74
+ })()
38
75
 
39
76
  // Build Node adapter internally
40
77
  const adapter = makeNodeAdapter({
@@ -42,36 +79,32 @@ export const init = ({
42
79
  ...(clientId ? { clientId } : {}),
43
80
  ...(sessionId ? { sessionId } : {}),
44
81
  sync: {
45
- backend: syncBackendConstructor,
82
+ backend: syncBackend as any,
46
83
  initialSyncOptions: { _tag: 'Blocking', timeout: 5000 },
47
84
  onSyncError: 'shutdown',
48
85
  },
49
86
  })
50
87
 
51
88
  // Create the store
52
- const s = yield* Effect.promise(() =>
53
- createStorePromise({
54
- schema,
55
- storeId,
56
- adapter,
57
- disableDevtools: true,
58
- syncPayload,
59
- syncPayloadSchema,
60
- }),
61
- )
89
+ const s = await createStorePromise({
90
+ schema,
91
+ storeId,
92
+ adapter,
93
+ disableDevtools: true,
94
+ syncPayload,
95
+ syncPayloadSchema,
96
+ })
62
97
 
63
98
  // Replace existing store if any
64
99
  if (store) {
65
- yield* Effect.promise(async () => {
66
- try {
67
- await store!.shutdownPromise()
68
- } catch {}
69
- })
100
+ try {
101
+ await store.shutdownPromise()
102
+ } catch {}
70
103
  }
71
104
 
72
105
  store = s
73
106
  return store
74
- }).pipe(Effect.provide(ModuleLoaderLayer), Effect.withSpan('mcp-runtime:init'))
107
+ })
75
108
 
76
109
  export const getStore = Effect.sync(() => Option.fromNullable(store))
77
110
 
@@ -1,34 +0,0 @@
1
- import type { UnknownError } from '@livestore/common';
2
- import { FileSystem, type HttpClient } from '@livestore/utils/effect';
3
- import { Cli } from '@livestore/utils/node';
4
- import * as SyncOps from '../sync-operations.ts';
5
- export declare const exportCommand: Cli.Command.Command<"export", FileSystem.FileSystem | HttpClient.HttpClient, UnknownError | SyncOps.ConnectionError | SyncOps.ExportError, {
6
- readonly config: string;
7
- readonly storeId: string;
8
- readonly clientId: string;
9
- readonly output: string;
10
- }>;
11
- export declare const importCommand: Cli.Command.Command<"import", FileSystem.FileSystem | HttpClient.HttpClient, UnknownError | SyncOps.ConnectionError | SyncOps.ImportError, {
12
- readonly config: string;
13
- readonly storeId: string;
14
- readonly clientId: string;
15
- readonly force: boolean;
16
- readonly dryRun: boolean;
17
- readonly input: string;
18
- }>;
19
- export declare const syncCommand: Cli.Command.Command<"sync", FileSystem.FileSystem | HttpClient.HttpClient, UnknownError | SyncOps.ConnectionError | SyncOps.ExportError | SyncOps.ImportError, {
20
- readonly subcommand: import("effect/Option").Option<{
21
- readonly config: string;
22
- readonly storeId: string;
23
- readonly clientId: string;
24
- readonly output: string;
25
- } | {
26
- readonly config: string;
27
- readonly storeId: string;
28
- readonly clientId: string;
29
- readonly force: boolean;
30
- readonly dryRun: boolean;
31
- readonly input: string;
32
- }>;
33
- }>;
34
- //# sourceMappingURL=import-export.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"import-export.d.ts","sourceRoot":"","sources":["../../src/commands/import-export.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAmB,UAAU,EAAE,KAAK,UAAU,EAAc,MAAM,yBAAyB,CAAA;AAClG,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAA;AAiJhD,eAAO,MAAM,aAAa;;;;;EA6CzB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;EA4DzB,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;EAGvB,CAAA"}
@@ -1,123 +0,0 @@
1
- import path from 'node:path';
2
- import { Console, Effect, FileSystem } from '@livestore/utils/effect';
3
- import { Cli } from '@livestore/utils/node';
4
- import * as SyncOps from "../sync-operations.js";
5
- /**
6
- * Export events from the sync backend to a JSON file.
7
- */
8
- const exportEvents = ({ configPath, storeId, clientId, outputPath, }) => Effect.gen(function* () {
9
- yield* Console.log(`Connecting to sync backend...`);
10
- const result = yield* SyncOps.pullEventsFromSyncBackend({ configPath, storeId, clientId });
11
- yield* Console.log(`✓ Connected to sync backend`);
12
- yield* Console.log(`Pulled ${result.eventCount} events`);
13
- const fs = yield* FileSystem.FileSystem;
14
- const absOutputPath = path.isAbsolute(outputPath) ? outputPath : path.resolve(process.cwd(), outputPath);
15
- yield* fs.writeFileString(absOutputPath, JSON.stringify(result.data, null, 2)).pipe(Effect.mapError((cause) => new SyncOps.ExportError({
16
- cause,
17
- note: `Failed to write export file: ${cause}`,
18
- })));
19
- yield* Console.log(`Exported ${result.eventCount} events to ${absOutputPath}`);
20
- }).pipe(Effect.withSpan('cli:export'));
21
- /**
22
- * Import events from a JSON file to the sync backend.
23
- */
24
- const importEvents = ({ configPath, storeId, clientId, inputPath, force, dryRun, }) => Effect.gen(function* () {
25
- const fs = yield* FileSystem.FileSystem;
26
- const absInputPath = path.isAbsolute(inputPath) ? inputPath : path.resolve(process.cwd(), inputPath);
27
- const exists = yield* fs.exists(absInputPath).pipe(Effect.mapError((cause) => new SyncOps.ImportError({
28
- cause,
29
- note: `Failed to check file existence: ${cause}`,
30
- })));
31
- if (!exists) {
32
- return yield* new SyncOps.ImportError({
33
- cause: new Error(`File not found: ${absInputPath}`),
34
- note: `Import file does not exist at ${absInputPath}`,
35
- });
36
- }
37
- yield* Console.log(`Reading import file...`);
38
- const fileContent = yield* fs.readFileString(absInputPath).pipe(Effect.mapError((cause) => new SyncOps.ImportError({
39
- cause,
40
- note: `Failed to read import file: ${cause}`,
41
- })));
42
- const parsedContent = yield* Effect.try({
43
- try: () => JSON.parse(fileContent),
44
- catch: (error) => new SyncOps.ImportError({
45
- cause: new Error(`Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`),
46
- note: `Invalid JSON in import file: ${error instanceof Error ? error.message : String(error)}`,
47
- }),
48
- });
49
- /** Validate export file format before proceeding */
50
- const validation = yield* SyncOps.validateExportData({ data: parsedContent, targetStoreId: storeId });
51
- if (validation.storeIdMismatch) {
52
- if (!force) {
53
- return yield* new SyncOps.ImportError({
54
- cause: new Error(`Store ID mismatch: file has '${validation.sourceStoreId}', expected '${storeId}'`),
55
- note: `The export file was created for a different store. Use --force to import anyway.`,
56
- });
57
- }
58
- yield* Console.log(`Store ID mismatch: file has '${validation.sourceStoreId}', importing to '${storeId}' (--force)`);
59
- }
60
- yield* Console.log(`Found ${validation.eventCount} events in export file`);
61
- if (dryRun) {
62
- yield* Console.log(`Dry run - validating import file...`);
63
- yield* Console.log(`Dry run complete. ${validation.eventCount} events would be imported.`);
64
- return;
65
- }
66
- yield* Console.log(`Connecting to sync backend...`);
67
- const result = yield* SyncOps.pushEventsToSyncBackend({
68
- configPath,
69
- storeId,
70
- clientId,
71
- data: parsedContent,
72
- force,
73
- dryRun: false,
74
- });
75
- yield* Console.log(`✓ Connected to sync backend`);
76
- yield* Console.log(`Successfully imported ${result.eventCount} events`);
77
- }).pipe(Effect.withSpan('cli:import'));
78
- export const exportCommand = Cli.Command.make('export', {
79
- config: Cli.Options.text('config').pipe(Cli.Options.withAlias('c'), Cli.Options.withDescription('Path to the config module that exports schema and syncBackend')),
80
- storeId: Cli.Options.text('store-id').pipe(Cli.Options.withAlias('i'), Cli.Options.withDescription('Store identifier')),
81
- clientId: Cli.Options.text('client-id').pipe(Cli.Options.withDefault('cli-export'), Cli.Options.withDescription('Client identifier for the sync connection')),
82
- output: Cli.Args.text({ name: 'file' }).pipe(Cli.Args.withDescription('Output JSON file path')),
83
- }, Effect.fn(function* ({ config, storeId, clientId, output, }) {
84
- yield* Console.log(`Exporting events from LiveStore...`);
85
- yield* Console.log(` Config: ${config}`);
86
- yield* Console.log(` Store ID: ${storeId}`);
87
- yield* Console.log(` Output: ${output}`);
88
- yield* Console.log('');
89
- yield* exportEvents({
90
- configPath: config,
91
- storeId,
92
- clientId,
93
- outputPath: output,
94
- }).pipe(Effect.scoped);
95
- })).pipe(Cli.Command.withDescription('Export all events from the sync backend to a JSON file. Useful for backup and migration.'));
96
- export const importCommand = Cli.Command.make('import', {
97
- config: Cli.Options.text('config').pipe(Cli.Options.withAlias('c'), Cli.Options.withDescription('Path to the config module that exports schema and syncBackend')),
98
- storeId: Cli.Options.text('store-id').pipe(Cli.Options.withAlias('i'), Cli.Options.withDescription('Store identifier')),
99
- clientId: Cli.Options.text('client-id').pipe(Cli.Options.withDefault('cli-import'), Cli.Options.withDescription('Client identifier for the sync connection')),
100
- force: Cli.Options.boolean('force').pipe(Cli.Options.withAlias('f'), Cli.Options.withDefault(false), Cli.Options.withDescription('Force import even if store ID does not match')),
101
- dryRun: Cli.Options.boolean('dry-run').pipe(Cli.Options.withDefault(false), Cli.Options.withDescription('Validate the import file without actually importing')),
102
- input: Cli.Args.text({ name: 'file' }).pipe(Cli.Args.withDescription('Input JSON file to import')),
103
- }, Effect.fn(function* ({ config, storeId, clientId, force, dryRun, input, }) {
104
- yield* Console.log(`Importing events to LiveStore...`);
105
- yield* Console.log(` Config: ${config}`);
106
- yield* Console.log(` Store ID: ${storeId}`);
107
- yield* Console.log(` Input: ${input}`);
108
- if (force)
109
- yield* Console.log(` Force: enabled`);
110
- if (dryRun)
111
- yield* Console.log(` Dry run: enabled`);
112
- yield* Console.log('');
113
- yield* importEvents({
114
- configPath: config,
115
- storeId,
116
- clientId,
117
- inputPath: input,
118
- force,
119
- dryRun,
120
- }).pipe(Effect.scoped);
121
- })).pipe(Cli.Command.withDescription('Import events from a JSON file to the sync backend. The sync backend must be empty.'));
122
- export const syncCommand = Cli.Command.make('sync').pipe(Cli.Command.withSubcommands([exportCommand, importCommand]), Cli.Command.withDescription('Import and export events from the sync backend'));
123
- //# sourceMappingURL=import-export.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"import-export.js","sourceRoot":"","sources":["../../src/commands/import-export.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAA+B,MAAM,yBAAyB,CAAA;AAClG,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAA;AAEhD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AAkC,CAAC,CAAA;IACtD,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,EAAE,CAAC,CAAA;IAC1C,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAA;IAC7C,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,EAAE,CAAC,CAAA;IACxC,IAAI,KAAK;QAAE,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;IAClD,IAAI,MAAM;QAAE,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;IACrD,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEtB,KAAK,CAAC,CAAC,YAAY,CAAC;QAClB,UAAU,EAAE,MAAM;QAClB,OAAO;QACP,QAAQ;QACR,SAAS,EAAE,KAAK;QAChB,KAAK;QACL,MAAM;KACP,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AACxB,CAAC,CAAC,CACH,CAAC,IAAI,CACJ,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,qFAAqF,CAAC,CACnH,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CACtD,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,EAC3D,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,gDAAgD,CAAC,CAC9E,CAAA"}
@@ -1,22 +0,0 @@
1
- import type { SyncBackend } from '@livestore/common';
2
- import { UnknownError } from '@livestore/common';
3
- import { type LiveStoreSchema } from '@livestore/common/schema';
4
- import { Effect, FileSystem, Schema } from '@livestore/utils/effect';
5
- export interface ModuleConfig {
6
- schema: LiveStoreSchema;
7
- syncBackendConstructor: SyncBackend.SyncBackendConstructor;
8
- syncPayloadSchema: Schema.Schema<any>;
9
- syncPayload: unknown;
10
- }
11
- /**
12
- * Loads and validates a user config module.
13
- * The module must export:
14
- * - `schema`: A valid LiveStore schema
15
- * - `syncBackend`: A sync backend constructor function
16
- * - `syncPayloadSchema` (optional): Schema for validating syncPayload
17
- * - `syncPayload` (optional): Payload data for the sync backend
18
- */
19
- export declare const loadModuleConfig: ({ configPath, }: {
20
- configPath: string;
21
- }) => Effect.Effect<ModuleConfig, UnknownError, FileSystem.FileSystem>;
22
- //# sourceMappingURL=module-loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../src/module-loader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAElF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEpE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,eAAe,CAAA;IACvB,sBAAsB,EAAE,WAAW,CAAC,sBAAsB,CAAA;IAC1D,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACrC,WAAW,EAAE,OAAO,CAAA;CACrB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,iBAE9B;IACD,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,UAAU,CAAC,UAAU,CA6DP,CAAA"}