@livestore/cli 0.4.0 → 0.5.0-dev.0
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/fixtures/mock-config.d.ts +7 -9
- package/dist/__tests__/fixtures/mock-config.d.ts.map +1 -1
- package/dist/__tests__/fixtures/mock-config.js +6 -6
- package/dist/__tests__/fixtures/mock-config.js.map +1 -1
- package/dist/__tests__/sync-operations.test.js +20 -20
- package/dist/__tests__/sync-operations.test.js.map +1 -1
- package/dist/bin.js +6 -5
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts +2 -23
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/__fixtures__/mcp-protocol-server.d.ts +2 -0
- package/dist/commands/__fixtures__/mcp-protocol-server.d.ts.map +1 -0
- package/dist/commands/__fixtures__/mcp-protocol-server.js +10 -0
- package/dist/commands/__fixtures__/mcp-protocol-server.js.map +1 -0
- package/dist/commands/import-export.d.ts +5 -19
- package/dist/commands/import-export.d.ts.map +1 -1
- package/dist/commands/import-export.js +12 -12
- package/dist/commands/import-export.js.map +1 -1
- package/dist/commands/mcp-coach.d.ts +8 -7
- package/dist/commands/mcp-coach.d.ts.map +1 -1
- package/dist/commands/mcp-coach.js +10 -10
- package/dist/commands/mcp-coach.js.map +1 -1
- package/dist/commands/mcp-protocols.d.ts +7 -0
- package/dist/commands/mcp-protocols.d.ts.map +1 -0
- package/dist/commands/mcp-protocols.js +12 -0
- package/dist/commands/mcp-protocols.js.map +1 -0
- package/dist/commands/mcp-protocols.test.d.ts +2 -0
- package/dist/commands/mcp-protocols.test.d.ts.map +1 -0
- package/dist/commands/mcp-protocols.test.js +60 -0
- package/dist/commands/mcp-protocols.test.js.map +1 -0
- package/dist/commands/mcp-stdio.test.d.ts +2 -0
- package/dist/commands/mcp-stdio.test.d.ts.map +1 -0
- package/dist/commands/mcp-stdio.test.js +79 -0
- package/dist/commands/mcp-stdio.test.js.map +1 -0
- package/dist/commands/mcp-tool-handlers.d.ts +1 -1
- package/dist/commands/mcp-tool-handlers.d.ts.map +1 -1
- package/dist/commands/mcp-tool-handlers.js +1 -0
- package/dist/commands/mcp-tool-handlers.js.map +1 -1
- package/dist/commands/mcp-tools-defs.d.ts +65 -64
- package/dist/commands/mcp-tools-defs.d.ts.map +1 -1
- package/dist/commands/mcp-tools-defs.js +59 -52
- package/dist/commands/mcp-tools-defs.js.map +1 -1
- package/dist/commands/mcp-tools-defs.test.d.ts +2 -0
- package/dist/commands/mcp-tools-defs.test.d.ts.map +1 -0
- package/dist/commands/mcp-tools-defs.test.js +11 -0
- package/dist/commands/mcp-tools-defs.test.js.map +1 -0
- package/dist/commands/mcp.d.ts +1 -3
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +5 -4
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/new-project.d.ts +19 -27
- package/dist/commands/new-project.d.ts.map +1 -1
- package/dist/commands/new-project.js +17 -16
- package/dist/commands/new-project.js.map +1 -1
- package/dist/mcp-content/architecture.d.ts +1 -1
- package/dist/mcp-content/architecture.d.ts.map +1 -1
- package/dist/mcp-content/architecture.js +3 -3
- package/dist/mcp-content/features.d.ts +1 -1
- package/dist/mcp-content/features.d.ts.map +1 -1
- package/dist/mcp-content/features.js +1 -1
- package/dist/mcp-content/getting-started.d.ts +1 -1
- package/dist/mcp-content/getting-started.d.ts.map +1 -1
- package/dist/mcp-content/getting-started.js +37 -37
- package/dist/mcp-content/overview.d.ts +1 -1
- package/dist/mcp-content/overview.d.ts.map +1 -1
- package/dist/mcp-content/overview.js +6 -6
- package/dist/mcp-content/schemas/blog.d.ts +1 -1
- package/dist/mcp-content/schemas/blog.d.ts.map +1 -1
- package/dist/mcp-content/schemas/blog.js +25 -25
- package/dist/mcp-content/schemas/ecommerce.d.ts +1 -1
- package/dist/mcp-content/schemas/ecommerce.d.ts.map +1 -1
- package/dist/mcp-content/schemas/ecommerce.js +67 -67
- package/dist/mcp-content/schemas/social.d.ts +1 -1
- package/dist/mcp-content/schemas/social.d.ts.map +1 -1
- package/dist/mcp-content/schemas/social.js +48 -48
- package/dist/mcp-content/schemas/todo.d.ts +1 -1
- package/dist/mcp-content/schemas/todo.d.ts.map +1 -1
- package/dist/mcp-content/schemas/todo.js +35 -35
- package/dist/mcp-runtime/runtime.d.ts +2 -2
- package/dist/mcp-runtime/runtime.d.ts.map +1 -1
- package/dist/mcp-runtime/runtime.js +4 -4
- package/dist/mcp-runtime/runtime.js.map +1 -1
- package/dist/module-loader.d.ts +2 -2
- package/dist/module-loader.d.ts.map +1 -1
- package/dist/module-loader.js +6 -6
- package/dist/module-loader.js.map +1 -1
- package/dist/sync-operations.d.ts +24 -30
- package/dist/sync-operations.d.ts.map +1 -1
- package/dist/sync-operations.js +10 -12
- package/dist/sync-operations.js.map +1 -1
- package/package.json +30 -44
- package/src/__tests__/fixtures/mock-config.ts +8 -8
- package/src/__tests__/sync-operations.test.ts +21 -35
- package/src/bin.ts +7 -6
- package/src/cli.ts +1 -1
- package/src/commands/__fixtures__/mcp-protocol-server.ts +12 -0
- package/src/commands/import-export.ts +29 -29
- package/src/commands/mcp-coach.ts +12 -11
- package/src/commands/mcp-protocols.test.ts +76 -0
- package/src/commands/mcp-protocols.ts +12 -0
- package/src/commands/mcp-stdio.test.ts +93 -0
- package/src/commands/mcp-tool-handlers.ts +11 -8
- package/src/commands/mcp-tools-defs.test.ts +13 -0
- package/src/commands/mcp-tools-defs.ts +53 -51
- package/src/commands/mcp.ts +7 -4
- package/src/commands/new-project.ts +49 -36
- package/src/mcp-content/architecture.ts +3 -3
- package/src/mcp-content/features.ts +1 -1
- package/src/mcp-content/getting-started.ts +37 -37
- package/src/mcp-content/overview.ts +6 -6
- package/src/mcp-content/schemas/blog.ts +25 -25
- package/src/mcp-content/schemas/ecommerce.ts +67 -67
- package/src/mcp-content/schemas/social.ts +48 -48
- package/src/mcp-content/schemas/todo.ts +35 -35
- package/src/mcp-runtime/runtime.ts +7 -7
- package/src/module-loader.ts +10 -10
- package/src/sync-operations.ts +16 -16
|
@@ -4,53 +4,47 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { SyncBackend } from '@livestore/common';
|
|
6
6
|
import { UnknownError } from '@livestore/common';
|
|
7
|
-
import { Effect, type FileSystem, type HttpClient, Schema, type Scope } from '@livestore/utils/effect';
|
|
7
|
+
import { Cause, Effect, type FileSystem, type HttpClient, Schema, type Scope } from '@livestore/utils/effect';
|
|
8
8
|
/**
|
|
9
9
|
* Schema for the export file format.
|
|
10
10
|
* Contains metadata about the export and an array of events in global encoded format.
|
|
11
11
|
*/
|
|
12
12
|
export declare const ExportFileSchema: Schema.Struct<{
|
|
13
13
|
/** Format version for future compatibility */
|
|
14
|
-
version: Schema.Literal<
|
|
14
|
+
readonly version: Schema.Literal<1>;
|
|
15
15
|
/** Store identifier */
|
|
16
|
-
storeId:
|
|
16
|
+
readonly storeId: Schema.String;
|
|
17
17
|
/** ISO timestamp of when the export was created */
|
|
18
|
-
exportedAt:
|
|
18
|
+
readonly exportedAt: Schema.String;
|
|
19
19
|
/** Total number of events in the export */
|
|
20
|
-
eventCount:
|
|
20
|
+
readonly eventCount: Schema.Number;
|
|
21
21
|
/** Array of events in global encoded format */
|
|
22
|
-
events: Schema
|
|
23
|
-
name:
|
|
24
|
-
args:
|
|
25
|
-
seqNum: Schema.
|
|
26
|
-
parentSeqNum: Schema.
|
|
27
|
-
clientId:
|
|
28
|
-
sessionId:
|
|
22
|
+
readonly events: Schema.$Array<Schema.Struct<{
|
|
23
|
+
readonly name: Schema.String;
|
|
24
|
+
readonly args: Schema.Any;
|
|
25
|
+
readonly seqNum: Schema.brand<Schema.Int, "GlobalEventSequenceNumber">;
|
|
26
|
+
readonly parentSeqNum: Schema.brand<Schema.Int, "GlobalEventSequenceNumber">;
|
|
27
|
+
readonly clientId: Schema.String;
|
|
28
|
+
readonly sessionId: Schema.String;
|
|
29
29
|
}>>;
|
|
30
30
|
}>;
|
|
31
31
|
export type ExportFile = typeof ExportFileSchema.Type;
|
|
32
|
-
declare const ConnectionError_base: Schema.
|
|
33
|
-
readonly
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
note: typeof Schema.String;
|
|
37
|
-
}>;
|
|
32
|
+
declare const ConnectionError_base: Schema.Class<ConnectionError, Schema.TaggedStruct<"ConnectionError", {
|
|
33
|
+
readonly cause: Schema.Defect;
|
|
34
|
+
readonly note: Schema.String;
|
|
35
|
+
}>, Cause.YieldableError>;
|
|
38
36
|
export declare class ConnectionError extends ConnectionError_base {
|
|
39
37
|
}
|
|
40
|
-
declare const ExportError_base: Schema.
|
|
41
|
-
readonly
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
note: typeof Schema.String;
|
|
45
|
-
}>;
|
|
38
|
+
declare const ExportError_base: Schema.Class<ExportError, Schema.TaggedStruct<"ExportError", {
|
|
39
|
+
readonly cause: Schema.Defect;
|
|
40
|
+
readonly note: Schema.String;
|
|
41
|
+
}>, Cause.YieldableError>;
|
|
46
42
|
export declare class ExportError extends ExportError_base {
|
|
47
43
|
}
|
|
48
|
-
declare const ImportError_base: Schema.
|
|
49
|
-
readonly
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
note: typeof Schema.String;
|
|
53
|
-
}>;
|
|
44
|
+
declare const ImportError_base: Schema.Class<ImportError, Schema.TaggedStruct<"ImportError", {
|
|
45
|
+
readonly cause: Schema.Defect;
|
|
46
|
+
readonly note: Schema.String;
|
|
47
|
+
}>, Cause.YieldableError>;
|
|
54
48
|
export declare class ImportError extends ImportError_base {
|
|
55
49
|
}
|
|
56
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-operations.d.ts","sourceRoot":"","sources":["../src/sync-operations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD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AAG,MAAM,CAAC,MAAM,CACf,YAAY,EACZ,WAAW,GAAG,YAAY,GAAG,eAAe,EAC5C,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,GAAG,KAAK,CAAC,KAAK,CA2FjB,CAAA"}
|
package/dist/sync-operations.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UnknownError } from '@livestore/common';
|
|
2
2
|
import { LiveStoreEvent } from '@livestore/common/schema';
|
|
3
|
-
import { Cause,
|
|
3
|
+
import { Cause, Effect, KeyValueStore, Option, Schema, Stream, SubscriptionRef, } from '@livestore/utils/effect';
|
|
4
4
|
import { loadModuleConfig } from "./module-loader.js";
|
|
5
5
|
/** Connection timeout for sync backend ping (5 seconds) */
|
|
6
6
|
const CONNECTION_TIMEOUT_MS = 5000;
|
|
@@ -21,17 +21,17 @@ export const ExportFileSchema = Schema.Struct({
|
|
|
21
21
|
events: Schema.Array(LiveStoreEvent.Global.Encoded),
|
|
22
22
|
});
|
|
23
23
|
export class ConnectionError extends Schema.TaggedError('~@livestore/cli/ConnectionError')('ConnectionError', {
|
|
24
|
-
cause: Schema.Defect,
|
|
24
|
+
cause: Schema.Defect(),
|
|
25
25
|
note: Schema.String,
|
|
26
26
|
}) {
|
|
27
27
|
}
|
|
28
28
|
export class ExportError extends Schema.TaggedError('~@livestore/cli/ExportError')('ExportError', {
|
|
29
|
-
cause: Schema.Defect,
|
|
29
|
+
cause: Schema.Defect(),
|
|
30
30
|
note: Schema.String,
|
|
31
31
|
}) {
|
|
32
32
|
}
|
|
33
33
|
export class ImportError extends Schema.TaggedError('~@livestore/cli/ImportError')('ImportError', {
|
|
34
|
-
cause: Schema.Defect,
|
|
34
|
+
cause: Schema.Defect(),
|
|
35
35
|
note: Schema.String,
|
|
36
36
|
}) {
|
|
37
37
|
}
|
|
@@ -53,8 +53,8 @@ export const makeSyncBackend = ({ configPath, storeId, clientId, }) => Effect.ge
|
|
|
53
53
|
note: `Failed to connect to sync backend: ${cause._tag === 'IsOfflineError' ? 'Backend is offline or unreachable' : String(cause)}`,
|
|
54
54
|
})));
|
|
55
55
|
/** Verify connectivity with a ping (with timeout) */
|
|
56
|
-
yield* syncBackend.ping.pipe(Effect.timeout(CONNECTION_TIMEOUT_MS), Effect.
|
|
57
|
-
if (Cause.
|
|
56
|
+
yield* syncBackend.ping.pipe(Effect.timeout(CONNECTION_TIMEOUT_MS), Effect.catch((cause) => {
|
|
57
|
+
if (Cause.isTimeoutError(cause) === true) {
|
|
58
58
|
return Effect.fail(new ConnectionError({
|
|
59
59
|
cause,
|
|
60
60
|
note: `Connection timeout: Sync backend did not respond within ${CONNECTION_TIMEOUT_MS}ms`,
|
|
@@ -70,7 +70,7 @@ export const makeSyncBackend = ({ configPath, storeId, clientId, }) => Effect.ge
|
|
|
70
70
|
const releaseSyncBackend = (syncBackend) => {
|
|
71
71
|
const maybeDisconnect = syncBackend.disconnect;
|
|
72
72
|
const releaseEffect = maybeDisconnect ?? SubscriptionRef.set(syncBackend.isConnected, false);
|
|
73
|
-
return releaseEffect.pipe(Effect.
|
|
73
|
+
return releaseEffect.pipe(Effect.catch(() => Effect.void));
|
|
74
74
|
};
|
|
75
75
|
/**
|
|
76
76
|
* Core export operation - pulls all events from sync backend.
|
|
@@ -82,9 +82,7 @@ export const pullEventsFromSyncBackend = ({ configPath, storeId, clientId, }) =>
|
|
|
82
82
|
cause,
|
|
83
83
|
note: `Failed to pull events from sync backend: ${String(cause)}`,
|
|
84
84
|
})));
|
|
85
|
-
const events =
|
|
86
|
-
.flatMap((item) => item.batch)
|
|
87
|
-
.map((item) => item.eventEncoded);
|
|
85
|
+
const events = batchesChunk.flatMap((item) => item.batch).map((item) => item.eventEncoded);
|
|
88
86
|
const exportedAt = new Date().toISOString();
|
|
89
87
|
const exportData = {
|
|
90
88
|
version: 1,
|
|
@@ -106,7 +104,7 @@ export const pullEventsFromSyncBackend = ({ configPath, storeId, clientId, }) =>
|
|
|
106
104
|
* Returns validation info without actually importing.
|
|
107
105
|
*/
|
|
108
106
|
export const validateExportData = ({ data, targetStoreId, }) => Effect.gen(function* () {
|
|
109
|
-
const exportData = yield* Schema.
|
|
107
|
+
const exportData = yield* Schema.decodeUnknownEffect(ExportFileSchema)(data).pipe(Effect.mapError((cause) => new ImportError({
|
|
110
108
|
cause: new Error(`Invalid export file format: ${String(cause)}`),
|
|
111
109
|
note: `Invalid export file format: ${String(cause)}`,
|
|
112
110
|
})));
|
|
@@ -122,7 +120,7 @@ export const validateExportData = ({ data, targetStoreId, }) => Effect.gen(funct
|
|
|
122
120
|
* Validates that the backend is empty before importing.
|
|
123
121
|
*/
|
|
124
122
|
export const pushEventsToSyncBackend = ({ configPath, storeId, clientId, data, force, dryRun, onProgress, }) => Effect.acquireUseRelease(makeSyncBackend({ configPath, storeId, clientId }), (syncBackend) => Effect.gen(function* () {
|
|
125
|
-
const exportData = yield* Schema.
|
|
123
|
+
const exportData = yield* Schema.decodeUnknownEffect(ExportFileSchema)(data).pipe(Effect.mapError((cause) => new ImportError({
|
|
126
124
|
cause: new Error(`Invalid export file format: ${String(cause)}`),
|
|
127
125
|
note: `Invalid export file format: ${String(cause)}`,
|
|
128
126
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-operations.js","sourceRoot":"","sources":["../src/sync-operations.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EACL,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"sync-operations.js","sourceRoot":"","sources":["../src/sync-operations.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EACL,KAAK,EACL,MAAM,EAGN,aAAa,EACb,MAAM,EACN,MAAM,EAEN,MAAM,EACN,eAAe,GA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AAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;QAC7D,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAA;QAEvD,KAAK,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CACjC,MAAM,CAAC,QAAQ,CACb,CAAC,KAAK,EAAE,EAAE,CACR,IAAI,WAAW,CAAC;YACd,KAAK;YACL,IAAI,EAAE,qCAAqC,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE;SACjE,CAAC,CACL,CACF,CAAA;QAED,MAAM,IAAI,KAAK,CAAC,MAAM,CAAA;QACtB,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,KAAK,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QAClC,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO;QACP,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM;QACpC,MAAM,EAAE,KAAK;QACb,WAAW;KACZ,CAAA;AACH,CAAC,CAAC,EACJ,kBAAkB,CACnB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-dev.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/livestorejs/livestore.git"
|
|
7
|
+
"url": "git+https://github.com/livestorejs/livestore-contrib.git"
|
|
8
8
|
},
|
|
9
9
|
"bin": {
|
|
10
10
|
"livestore": "./dist/bin.js"
|
|
@@ -23,63 +23,49 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@effect/ai": "0.
|
|
27
|
-
"@effect/
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"@livestore/adapter-node": "^0.4.0",
|
|
35
|
-
"@livestore/peer-deps": "^0.4.0",
|
|
36
|
-
"@livestore/utils": "^0.4.0",
|
|
37
|
-
"@livestore/livestore": "^0.4.0"
|
|
26
|
+
"@effect/ai-openai": "4.0.0-rc.111",
|
|
27
|
+
"@effect/opentelemetry": "4.0.0-rc.111",
|
|
28
|
+
"@livestore/adapter-node": "0.5.0-dev.0",
|
|
29
|
+
"@livestore/common": "0.5.0-dev.0",
|
|
30
|
+
"@livestore/livestore": "0.5.0-dev.0",
|
|
31
|
+
"@livestore/peer-deps": "0.5.0-dev.0",
|
|
32
|
+
"@livestore/utils": "0.5.0-dev.0",
|
|
33
|
+
"effect": "4.0.0-rc.111"
|
|
38
34
|
},
|
|
39
35
|
"devDependencies": {
|
|
36
|
+
"@livestore/utils-dev": "0.5.0-dev.0",
|
|
40
37
|
"@types/node": "25.3.3",
|
|
41
|
-
"typescript": "
|
|
42
|
-
"vitest": "
|
|
43
|
-
"@livestore/utils-dev": "^0.4.0"
|
|
38
|
+
"typescript": "6.0.3",
|
|
39
|
+
"vitest": "4.1.9"
|
|
44
40
|
},
|
|
45
41
|
"peerDependencies": {
|
|
46
|
-
"@effect/
|
|
47
|
-
"@effect/
|
|
48
|
-
"@effect/
|
|
49
|
-
"@effect/
|
|
50
|
-
"@effect/
|
|
51
|
-
"@effect/
|
|
52
|
-
"@effect/platform-browser": "^0.76.0",
|
|
53
|
-
"@effect/platform-bun": "^0.89.0",
|
|
54
|
-
"@effect/platform-node": "^0.106.0",
|
|
55
|
-
"@effect/printer": "^0.49.0",
|
|
56
|
-
"@effect/printer-ansi": "^0.49.0",
|
|
57
|
-
"@effect/rpc": "^0.75.1",
|
|
58
|
-
"@effect/sql": "^0.51.1",
|
|
59
|
-
"@effect/typeclass": "^0.40.0",
|
|
60
|
-
"@effect/vitest": "^0.29.0",
|
|
42
|
+
"@effect/opentelemetry": "^4.0.0-rc.111",
|
|
43
|
+
"@effect/platform-browser": "^4.0.0-rc.111",
|
|
44
|
+
"@effect/platform-bun": "^4.0.0-rc.111",
|
|
45
|
+
"@effect/platform-node": "^4.0.0-rc.111",
|
|
46
|
+
"@effect/platform-node-shared": "^4.0.0-rc.111",
|
|
47
|
+
"@effect/vitest": "^4.0.0-rc.111",
|
|
61
48
|
"@opentelemetry/api": "^1.9.0",
|
|
62
49
|
"@opentelemetry/resources": "^2.2.0",
|
|
63
50
|
"@standard-schema/spec": "^1.1.0",
|
|
64
|
-
"effect": "^
|
|
51
|
+
"effect": "^4.0.0-rc.111"
|
|
65
52
|
},
|
|
66
53
|
"$genie": {
|
|
67
54
|
"source": "package.json.genie.ts",
|
|
68
55
|
"warning": "DO NOT EDIT - changes will be overwritten",
|
|
69
56
|
"workspaceClosureDirs": [
|
|
70
57
|
"packages/@livestore/adapter-node",
|
|
71
|
-
"packages/@livestore/adapter-web",
|
|
72
58
|
"packages/@livestore/cli",
|
|
73
|
-
"packages/@livestore/
|
|
74
|
-
"packages/@livestore/common
|
|
75
|
-
"packages/@livestore/
|
|
76
|
-
"packages/@livestore/livestore",
|
|
77
|
-
"packages/@livestore/peer-deps",
|
|
78
|
-
"packages/@livestore/sqlite-wasm",
|
|
79
|
-
"packages/@livestore/utils",
|
|
80
|
-
"packages/@livestore/utils-dev",
|
|
81
|
-
"packages/@livestore/wa-sqlite",
|
|
82
|
-
"packages/@livestore/webmesh"
|
|
59
|
+
"repos/livestore/packages/@livestore/adapter-web",
|
|
60
|
+
"repos/livestore/packages/@livestore/common",
|
|
61
|
+
"repos/livestore/packages/@livestore/common-cf",
|
|
62
|
+
"repos/livestore/packages/@livestore/livestore",
|
|
63
|
+
"repos/livestore/packages/@livestore/peer-deps",
|
|
64
|
+
"repos/livestore/packages/@livestore/sqlite-wasm",
|
|
65
|
+
"repos/livestore/packages/@livestore/utils",
|
|
66
|
+
"repos/livestore/packages/@livestore/utils-dev",
|
|
67
|
+
"repos/livestore/packages/@livestore/wa-sqlite",
|
|
68
|
+
"repos/livestore/packages/@livestore/webmesh"
|
|
83
69
|
]
|
|
84
70
|
},
|
|
85
71
|
"scripts": {
|
|
@@ -4,12 +4,12 @@ import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
|
4
4
|
import { Events, makeSchema, State } from '@livestore/common/schema'
|
|
5
5
|
import type { MockSyncBackend } from '@livestore/common/sync'
|
|
6
6
|
import { EventFactory } from '@livestore/common/testing'
|
|
7
|
-
import { Effect, FileSystem, type
|
|
7
|
+
import { Effect, FileSystem, type Queue, Schema } from '@livestore/utils/effect'
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
10
10
|
|
|
11
11
|
class DynamicImportError extends Schema.TaggedError<DynamicImportError>()('DynamicImportError', {
|
|
12
|
-
cause: Schema.Defect,
|
|
12
|
+
cause: Schema.Defect(),
|
|
13
13
|
path: Schema.String,
|
|
14
14
|
}) {}
|
|
15
15
|
|
|
@@ -49,21 +49,21 @@ const makeTempConfig = () => {
|
|
|
49
49
|
const moduleSource = `
|
|
50
50
|
import { schema } from ${JSON.stringify(schemaModuleUrl)}
|
|
51
51
|
import { makeMockSyncBackend } from '@livestore/common/sync'
|
|
52
|
-
import { Effect,
|
|
52
|
+
import { Effect, Queue } from '@livestore/utils/effect'
|
|
53
53
|
|
|
54
54
|
export const mockBackend = await Effect.runPromise(Effect.scoped(makeMockSyncBackend({ startConnected: true })))
|
|
55
|
-
export const connectionEvents = await Effect.runPromise(
|
|
55
|
+
export const connectionEvents = await Effect.runPromise(Queue.make<'connect' | 'disconnect'>())
|
|
56
56
|
|
|
57
57
|
export { schema }
|
|
58
58
|
|
|
59
59
|
export const syncBackend = (_args) =>
|
|
60
60
|
mockBackend.makeSyncBackend.pipe(
|
|
61
|
-
Effect.tap(() =>
|
|
61
|
+
Effect.tap(() => Queue.offer(connectionEvents, 'connect')),
|
|
62
62
|
Effect.map((backend) => {
|
|
63
63
|
const disconnect = backend.disconnect ?? Effect.void
|
|
64
64
|
return {
|
|
65
65
|
...backend,
|
|
66
|
-
disconnect: disconnect.pipe(Effect.tap(() =>
|
|
66
|
+
disconnect: disconnect.pipe(Effect.tap(() => Queue.offer(connectionEvents, 'disconnect'))),
|
|
67
67
|
}
|
|
68
68
|
}),
|
|
69
69
|
)
|
|
@@ -92,7 +92,7 @@ export const useMockConfig = Effect.acquireRelease(
|
|
|
92
92
|
catch: (cause) => new DynamicImportError({ cause, path: tempPath }),
|
|
93
93
|
})) as {
|
|
94
94
|
mockBackend: MockSyncBackend
|
|
95
|
-
connectionEvents:
|
|
95
|
+
connectionEvents: Queue.Queue<'connect' | 'disconnect'>
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
return { configPath: tempPath, mockBackend: mod.mockBackend, connectionEvents: mod.connectionEvents }
|
|
@@ -100,7 +100,7 @@ export const useMockConfig = Effect.acquireRelease(
|
|
|
100
100
|
({ configPath }) =>
|
|
101
101
|
Effect.gen(function* () {
|
|
102
102
|
const fs = yield* FileSystem.FileSystem
|
|
103
|
-
yield* fs.remove(configPath, { recursive: false }).pipe(Effect.
|
|
103
|
+
yield* fs.remove(configPath, { recursive: false }).pipe(Effect.catch(() => Effect.void))
|
|
104
104
|
}),
|
|
105
105
|
)
|
|
106
106
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import type { LiveStoreEvent } from '@livestore/common/schema'
|
|
4
|
-
import { Vitest } from '@livestore/utils-dev/node-vitest'
|
|
5
|
-
import { Chunk, Effect, FetchHttpClient, Layer, Mailbox, Stream } from '@livestore/utils/effect'
|
|
1
|
+
import { Effect, FetchHttpClient, Layer, Queue, Stream } from '@livestore/utils/effect'
|
|
6
2
|
import { PlatformNode } from '@livestore/utils/node'
|
|
3
|
+
import { Vitest } from '@livestore/utils-dev/node-vitest'
|
|
4
|
+
import { expect } from 'vitest'
|
|
7
5
|
|
|
8
6
|
import { pullEventsFromSyncBackend, pushEventsToSyncBackend } from '../sync-operations.ts'
|
|
9
7
|
import { makeEventFactory, useMockConfig } from './fixtures/mock-config.ts'
|
|
@@ -18,15 +16,11 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
18
16
|
|
|
19
17
|
/** Collects the connect + disconnect lifecycle emitted by the mock sync backend. */
|
|
20
18
|
const expectConnectLifecycle = (
|
|
21
|
-
mailbox:
|
|
19
|
+
mailbox: Queue.Queue<'connect' | 'disconnect'>,
|
|
22
20
|
): Effect.Effect<ReadonlyArray<'connect' | 'disconnect'>> =>
|
|
23
|
-
|
|
24
|
-
Stream.take(2),
|
|
25
|
-
Stream.runCollect,
|
|
26
|
-
Effect.map((chunk) => Chunk.toReadonlyArray(chunk)),
|
|
27
|
-
)
|
|
21
|
+
Stream.fromQueue(mailbox).pipe(Stream.take(2), Stream.runCollect)
|
|
28
22
|
|
|
29
|
-
Vitest.
|
|
23
|
+
Vitest.live('exports events and releases the backend connection', (test: Vitest.TestContext) =>
|
|
30
24
|
Effect.gen(function* () {
|
|
31
25
|
const { mockBackend, connectionEvents, configPath } = yield* useMockConfig
|
|
32
26
|
const factory = makeEventFactory()
|
|
@@ -52,7 +46,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
52
46
|
}).pipe(withTestCtx(test)),
|
|
53
47
|
)
|
|
54
48
|
|
|
55
|
-
Vitest.
|
|
49
|
+
Vitest.live('fails import when backend is not empty', (test: Vitest.TestContext) =>
|
|
56
50
|
Effect.gen(function* () {
|
|
57
51
|
const { mockBackend, connectionEvents, configPath } = yield* useMockConfig
|
|
58
52
|
const factory = makeEventFactory()
|
|
@@ -77,11 +71,11 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
77
71
|
},
|
|
78
72
|
force: false,
|
|
79
73
|
dryRun: false,
|
|
80
|
-
}).pipe(Effect.
|
|
74
|
+
}).pipe(Effect.result)
|
|
81
75
|
|
|
82
|
-
expect(result._tag).toBe('
|
|
83
|
-
if (result._tag === '
|
|
84
|
-
expect(result.
|
|
76
|
+
expect(result._tag).toBe('Failure')
|
|
77
|
+
if (result._tag === 'Failure') {
|
|
78
|
+
expect(result.failure._tag).toBe('ImportError')
|
|
85
79
|
}
|
|
86
80
|
|
|
87
81
|
const lifecycle = yield* expectConnectLifecycle(connectionEvents)
|
|
@@ -89,7 +83,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
89
83
|
}).pipe(withTestCtx(test)),
|
|
90
84
|
)
|
|
91
85
|
|
|
92
|
-
Vitest.
|
|
86
|
+
Vitest.live('supports dry-run import and releases backend', (test: Vitest.TestContext) =>
|
|
93
87
|
Effect.gen(function* () {
|
|
94
88
|
const { configPath, connectionEvents } = yield* useMockConfig
|
|
95
89
|
const factory = makeEventFactory()
|
|
@@ -118,7 +112,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
118
112
|
}).pipe(withTestCtx(test)),
|
|
119
113
|
)
|
|
120
114
|
|
|
121
|
-
Vitest.
|
|
115
|
+
Vitest.live('imports events into empty backend with progress and batching', (test: Vitest.TestContext) =>
|
|
122
116
|
Effect.gen(function* () {
|
|
123
117
|
const { mockBackend, configPath, connectionEvents } = yield* useMockConfig
|
|
124
118
|
const factory = makeEventFactory()
|
|
@@ -151,11 +145,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
151
145
|
{ pushed: 120, total: 120 },
|
|
152
146
|
])
|
|
153
147
|
|
|
154
|
-
const pushedEvents = yield* mockBackend.pushedEvents.pipe(
|
|
155
|
-
Stream.take(importBatch.length),
|
|
156
|
-
Stream.runCollect,
|
|
157
|
-
Effect.map((chunk: Chunk.Chunk<LiveStoreEvent.Global.Encoded>) => Chunk.toReadonlyArray(chunk)),
|
|
158
|
-
)
|
|
148
|
+
const pushedEvents = yield* mockBackend.pushedEvents.pipe(Stream.take(importBatch.length), Stream.runCollect)
|
|
159
149
|
expect(pushedEvents.map((event) => event.seqNum)).toHaveLength(importBatch.length)
|
|
160
150
|
|
|
161
151
|
const lifecycle = yield* expectConnectLifecycle(connectionEvents)
|
|
@@ -163,7 +153,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
163
153
|
}).pipe(withTestCtx(test)),
|
|
164
154
|
)
|
|
165
155
|
|
|
166
|
-
Vitest.
|
|
156
|
+
Vitest.live('allows force import on store ID mismatch', (test: Vitest.TestContext) =>
|
|
167
157
|
Effect.gen(function* () {
|
|
168
158
|
const { mockBackend, configPath, connectionEvents } = yield* useMockConfig
|
|
169
159
|
const factory = makeEventFactory()
|
|
@@ -187,11 +177,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
187
177
|
expect(result.dryRun).toBe(false)
|
|
188
178
|
expect(result.eventCount).toBe(importBatch.length)
|
|
189
179
|
|
|
190
|
-
const pushedEvents = yield* mockBackend.pushedEvents.pipe(
|
|
191
|
-
Stream.take(1),
|
|
192
|
-
Stream.runCollect,
|
|
193
|
-
Effect.map((chunk: Chunk.Chunk<LiveStoreEvent.Global.Encoded>) => Chunk.toReadonlyArray(chunk)),
|
|
194
|
-
)
|
|
180
|
+
const pushedEvents = yield* mockBackend.pushedEvents.pipe(Stream.take(1), Stream.runCollect)
|
|
195
181
|
expect(pushedEvents).toHaveLength(1)
|
|
196
182
|
|
|
197
183
|
const lifecycle = yield* expectConnectLifecycle(connectionEvents)
|
|
@@ -199,7 +185,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
199
185
|
}).pipe(withTestCtx(test)),
|
|
200
186
|
)
|
|
201
187
|
|
|
202
|
-
Vitest.
|
|
188
|
+
Vitest.live('rejects store ID mismatch without force', (test: Vitest.TestContext) =>
|
|
203
189
|
Effect.gen(function* () {
|
|
204
190
|
const { configPath, connectionEvents } = yield* useMockConfig
|
|
205
191
|
const factory = makeEventFactory()
|
|
@@ -218,11 +204,11 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
218
204
|
},
|
|
219
205
|
force: false,
|
|
220
206
|
dryRun: false,
|
|
221
|
-
}).pipe(Effect.
|
|
207
|
+
}).pipe(Effect.result)
|
|
222
208
|
|
|
223
|
-
expect(result._tag).toBe('
|
|
224
|
-
if (result._tag === '
|
|
225
|
-
expect(result.
|
|
209
|
+
expect(result._tag).toBe('Failure')
|
|
210
|
+
if (result._tag === 'Failure') {
|
|
211
|
+
expect(result.failure._tag).toBe('ImportError')
|
|
226
212
|
}
|
|
227
213
|
|
|
228
214
|
const lifecycle = yield* expectConnectLifecycle(connectionEvents)
|
package/src/bin.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { liveStoreVersion } from '@livestore/common'
|
|
4
|
-
import { Console, Effect, FetchHttpClient, Layer, Logger,
|
|
4
|
+
import { Console, Effect, FetchHttpClient, Layer, Logger, References } from '@livestore/utils/effect'
|
|
5
5
|
import { Cli, PlatformNode } from '@livestore/utils/node'
|
|
6
6
|
|
|
7
7
|
import { command } from './cli.ts'
|
|
8
8
|
|
|
9
9
|
const cli = Cli.Command.run(command, {
|
|
10
|
-
name: 'livestore',
|
|
11
10
|
version: liveStoreVersion,
|
|
12
11
|
})
|
|
13
12
|
|
|
14
|
-
const showExperimentalWarning = Console.
|
|
13
|
+
const showExperimentalWarning = Console.error('⚠️ Warning: LiveStore CLI is experimental and under active development')
|
|
15
14
|
|
|
16
15
|
const layer = Layer.mergeAll(
|
|
17
|
-
PlatformNode.
|
|
16
|
+
PlatformNode.NodeServices.layer,
|
|
18
17
|
FetchHttpClient.layer,
|
|
19
|
-
|
|
18
|
+
Layer.succeed(References.MinimumLogLevel, 'Info'),
|
|
19
|
+
// Keep stdout available for command data and protocol transports such as MCP stdio.
|
|
20
|
+
Layer.succeed(Logger.LogToStderr, true),
|
|
20
21
|
)
|
|
21
22
|
|
|
22
23
|
Effect.gen(function* () {
|
|
23
24
|
yield* showExperimentalWarning
|
|
24
|
-
return yield* cli
|
|
25
|
+
return yield* cli
|
|
25
26
|
}).pipe(Effect.provide(layer), PlatformNode.NodeRuntime.runMain)
|
package/src/cli.ts
CHANGED
|
@@ -5,5 +5,5 @@ import { mcpCommand } from './commands/mcp.ts'
|
|
|
5
5
|
import { createCommand } from './commands/new-project.ts'
|
|
6
6
|
|
|
7
7
|
export const command = Cli.Command.make('livestore', {
|
|
8
|
-
verbose: Cli.
|
|
8
|
+
verbose: Cli.Flag.boolean('verbose').pipe(Cli.Flag.withDefault(false)),
|
|
9
9
|
}).pipe(Cli.Command.withSubcommands([mcpCommand, createCommand, syncCommand]))
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { McpServer } from 'effect/unstable/ai'
|
|
2
|
+
|
|
3
|
+
import { Effect, Layer } from '@livestore/utils/effect'
|
|
4
|
+
import { PlatformNode } from '@livestore/utils/node'
|
|
5
|
+
|
|
6
|
+
import { supportedMcpProtocols } from '../mcp-protocols.ts'
|
|
7
|
+
|
|
8
|
+
McpServer.layerStdio({
|
|
9
|
+
name: 'livestore-mcp-protocol-test',
|
|
10
|
+
version: '0.0.0',
|
|
11
|
+
protocols: supportedMcpProtocols,
|
|
12
|
+
}).pipe(Layer.provide(PlatformNode.NodeStdio.layer), Layer.launch, Effect.scoped, PlatformNode.NodeRuntime.runMain)
|