@livestore/cli 0.4.0 → 0.5.0-dev.1
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 +8 -9
- package/dist/__tests__/fixtures/mock-config.d.ts.map +1 -1
- package/dist/__tests__/fixtures/mock-config.js +18 -8
- package/dist/__tests__/fixtures/mock-config.js.map +1 -1
- package/dist/__tests__/sync-operations.test.js +32 -22
- package/dist/__tests__/sync-operations.test.js.map +1 -1
- package/dist/bin.js +7 -6
- 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 +4 -4
- 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 +13 -13
- 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 +11 -11
- 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 +9 -8
- package/dist/commands/mcp-tool-handlers.js.map +1 -1
- package/dist/commands/mcp-tools-defs.d.ts +74 -73
- package/dist/commands/mcp-tools-defs.d.ts.map +1 -1
- package/dist/commands/mcp-tools-defs.js +64 -57
- 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 +15 -14
- 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 +19 -18
- 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 +5 -5
- package/dist/mcp-runtime/runtime.d.ts.map +1 -1
- package/dist/mcp-runtime/runtime.js +5 -5
- package/dist/mcp-runtime/runtime.js.map +1 -1
- package/dist/mod.js +1 -1
- package/dist/module-loader.d.ts +2 -2
- package/dist/module-loader.d.ts.map +1 -1
- package/dist/module-loader.js +8 -8
- package/dist/module-loader.js.map +1 -1
- package/dist/package-manager.d.ts +3 -3
- package/dist/package-manager.d.ts.map +1 -1
- package/dist/package-manager.test.js +1 -1
- package/dist/sync-operations.d.ts +24 -30
- package/dist/sync-operations.d.ts.map +1 -1
- package/dist/sync-operations.js +15 -15
- package/dist/sync-operations.js.map +1 -1
- package/package.json +45 -59
- package/src/__tests__/fixtures/.gitignore +1 -0
- package/src/__tests__/fixtures/mock-config.ts +21 -10
- package/src/__tests__/sync-operations.test.ts +36 -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 +13 -12
- 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 +57 -55
- package/src/commands/mcp.ts +9 -4
- package/src/commands/new-project.ts +50 -37
- 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 +11 -12
- package/src/sync-operations.ts +26 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-loader.js","sourceRoot":"","sources":["../src/module-loader.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;GAGG;AACH,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,0BAA0B,CAAA;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AASpE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,UAAU,GAGX,EAAoE,EAAE,CACrE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAA;IAEvG,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAA;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAA;IACzE,IAAI,MAAM,KAAK,KAAK,EAAE,CAA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AG,GAAG,EAAE,iBAAiB,CAAA;IACtD,MAAM,iBAAiB,GACrB,uBAAuB,KAAK,SAAS;QACnC,CAAC,CAAC,MAAM,CAAC,IAAI;QACb,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,KAAK,IAAI;YACjD,CAAC,CAAE,uBAAkE;YACrE,CAAC,CAAC,iBAAiB,CACf,qCAAqC,GAAG,uCAAuC,OAAO,uBAAuB,IAAI,CAClH,CAAA;IAET,MAAM,iBAAiB,GAAG,GAAG,EAAE,WAAW,CAAA;IAC1C,MAAM,WAAW,GACf,iBAAiB,KAAK,SAAS;QAC7B,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAA;IAElH,OAAO;QACL,MAAM;QACN,sBAAsB;QACtB,iBAAiB;QACjB,WAAW;KACZ,CAAA;AACH,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAC,CAAA"}
|
|
@@ -25,9 +25,9 @@ export declare const detectPackageManager: (userAgent?: string) => DetectPackage
|
|
|
25
25
|
/** Package manager command templates */
|
|
26
26
|
export declare const pmCommands: {
|
|
27
27
|
readonly install: {
|
|
28
|
-
readonly npm:
|
|
29
|
-
readonly pnpm:
|
|
30
|
-
readonly bun:
|
|
28
|
+
readonly npm: 'npm install';
|
|
29
|
+
readonly pnpm: 'pnpm install';
|
|
30
|
+
readonly bun: 'bun install';
|
|
31
31
|
};
|
|
32
32
|
readonly run: {
|
|
33
33
|
readonly npm: (script: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../src/package-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;AAEnD;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,cAAc,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAExH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../src/package-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;AAEnD;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,cAAc,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAExH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,0BAE9B,0BAQF,CAAA;AAED,wCAAwC;AACxC,eAAO,MAAM,UAAU;aACrB,OAAO;iBACL,GAAG,EAAE,aAAa;iBAClB,IAAI,EAAE,cAAc;iBACpB,GAAG,EAAE,aAAa;;aAEpB,GAAG;iBACD,GAAG,WAAW,MAAM;iBACpB,IAAI,WAAW,MAAM;iBACrB,GAAG,WAAW,MAAM;;CAEd,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Vitest } from '@livestore/utils-dev/node-vitest';
|
|
2
|
-
import { detectPackageManager, pmCommands } from
|
|
2
|
+
import { detectPackageManager, pmCommands } from './package-manager.js';
|
|
3
3
|
Vitest.describe('detectPackageManager', () => {
|
|
4
4
|
Vitest.it('detects npm from user agent', () => {
|
|
5
5
|
const result = detectPackageManager('npm/10.2.4 node/v20.11.0 darwin arm64 workspaces/false');
|
|
@@ -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.Finite;
|
|
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,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,
|
|
1
|
+
{"version":3,"file":"sync-operations.d.ts","sourceRoot":"","sources":["../src/sync-operations.ts"],"names":[],"mappings":"AAAA;;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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UnknownError } from '@livestore/common';
|
|
2
2
|
import { LiveStoreEvent } from '@livestore/common/schema';
|
|
3
|
-
import { Cause,
|
|
4
|
-
import { loadModuleConfig } from
|
|
3
|
+
import { Cause, Effect, KeyValueStore, Option, Schema, Stream, SubscriptionRef, } from '@livestore/utils/effect';
|
|
4
|
+
import { loadModuleConfig } from './module-loader.js';
|
|
5
5
|
/** Connection timeout for sync backend ping (5 seconds) */
|
|
6
6
|
const CONNECTION_TIMEOUT_MS = 5000;
|
|
7
7
|
/**
|
|
@@ -16,22 +16,22 @@ export const ExportFileSchema = Schema.Struct({
|
|
|
16
16
|
/** ISO timestamp of when the export was created */
|
|
17
17
|
exportedAt: Schema.String,
|
|
18
18
|
/** Total number of events in the export */
|
|
19
|
-
eventCount: Schema.
|
|
19
|
+
eventCount: Schema.Finite,
|
|
20
20
|
/** Array of events in global encoded format */
|
|
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`,
|
|
@@ -69,8 +69,10 @@ export const makeSyncBackend = ({ configPath, storeId, clientId, }) => Effect.ge
|
|
|
69
69
|
});
|
|
70
70
|
const releaseSyncBackend = (syncBackend) => {
|
|
71
71
|
const maybeDisconnect = syncBackend.disconnect;
|
|
72
|
-
const releaseEffect = maybeDisconnect
|
|
73
|
-
|
|
72
|
+
const releaseEffect = maybeDisconnect !== undefined && Effect.isEffect(maybeDisconnect) === true
|
|
73
|
+
? maybeDisconnect
|
|
74
|
+
: SubscriptionRef.set(syncBackend.isConnected, false);
|
|
75
|
+
return releaseEffect.pipe(Effect.ignore);
|
|
74
76
|
};
|
|
75
77
|
/**
|
|
76
78
|
* Core export operation - pulls all events from sync backend.
|
|
@@ -82,9 +84,7 @@ export const pullEventsFromSyncBackend = ({ configPath, storeId, clientId, }) =>
|
|
|
82
84
|
cause,
|
|
83
85
|
note: `Failed to pull events from sync backend: ${String(cause)}`,
|
|
84
86
|
})));
|
|
85
|
-
const events =
|
|
86
|
-
.flatMap((item) => item.batch)
|
|
87
|
-
.map((item) => item.eventEncoded);
|
|
87
|
+
const events = batchesChunk.flatMap((item) => item.batch).map((item) => item.eventEncoded);
|
|
88
88
|
const exportedAt = new Date().toISOString();
|
|
89
89
|
const exportData = {
|
|
90
90
|
version: 1,
|
|
@@ -106,7 +106,7 @@ export const pullEventsFromSyncBackend = ({ configPath, storeId, clientId, }) =>
|
|
|
106
106
|
* Returns validation info without actually importing.
|
|
107
107
|
*/
|
|
108
108
|
export const validateExportData = ({ data, targetStoreId, }) => Effect.gen(function* () {
|
|
109
|
-
const exportData = yield* Schema.
|
|
109
|
+
const exportData = yield* Schema.decodeUnknownEffect(ExportFileSchema)(data).pipe(Effect.mapError((cause) => new ImportError({
|
|
110
110
|
cause: new Error(`Invalid export file format: ${String(cause)}`),
|
|
111
111
|
note: `Invalid export file format: ${String(cause)}`,
|
|
112
112
|
})));
|
|
@@ -122,7 +122,7 @@ export const validateExportData = ({ data, targetStoreId, }) => Effect.gen(funct
|
|
|
122
122
|
* Validates that the backend is empty before importing.
|
|
123
123
|
*/
|
|
124
124
|
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.
|
|
125
|
+
const exportData = yield* Schema.decodeUnknownEffect(ExportFileSchema)(data).pipe(Effect.mapError((cause) => new ImportError({
|
|
126
126
|
cause: new Error(`Invalid export file format: ${String(cause)}`),
|
|
127
127
|
note: `Invalid export file format: ${String(cause)}`,
|
|
128
128
|
})));
|
|
@@ -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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AAA;IACrB,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAA;IACtC,IAAI,MAAM,GAAG,CAAC,CAAA;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,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,33 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$genie": {
|
|
3
|
+
"source": "package.json.genie.ts",
|
|
4
|
+
"warning": "DO NOT EDIT - changes will be overwritten",
|
|
5
|
+
"workspaceClosureDirs": [
|
|
6
|
+
"packages/@livestore/adapter-node",
|
|
7
|
+
"packages/@livestore/cli",
|
|
8
|
+
"repos/livestore/packages/@livestore/adapter-web",
|
|
9
|
+
"repos/livestore/packages/@livestore/common",
|
|
10
|
+
"repos/livestore/packages/@livestore/common-cf",
|
|
11
|
+
"repos/livestore/packages/@livestore/livestore",
|
|
12
|
+
"repos/livestore/packages/@livestore/peer-deps",
|
|
13
|
+
"repos/livestore/packages/@livestore/sqlite-wasm",
|
|
14
|
+
"repos/livestore/packages/@livestore/utils",
|
|
15
|
+
"repos/livestore/packages/@livestore/utils-dev",
|
|
16
|
+
"repos/livestore/packages/@livestore/wa-sqlite",
|
|
17
|
+
"repos/livestore/packages/@livestore/webmesh"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
2
20
|
"name": "@livestore/cli",
|
|
3
|
-
"version": "0.
|
|
21
|
+
"version": "0.5.0-dev.1",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"sideEffects": false,
|
|
4
24
|
"license": "Apache-2.0",
|
|
5
25
|
"repository": {
|
|
6
26
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/livestorejs/livestore.git"
|
|
27
|
+
"url": "git+https://github.com/livestorejs/livestore-contrib.git"
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": "./dist/mod.js"
|
|
8
31
|
},
|
|
9
32
|
"bin": {
|
|
10
33
|
"livestore": "./dist/bin.js"
|
|
@@ -14,73 +37,36 @@
|
|
|
14
37
|
"package.json",
|
|
15
38
|
"src"
|
|
16
39
|
],
|
|
17
|
-
"type": "module",
|
|
18
|
-
"sideEffects": false,
|
|
19
|
-
"exports": {
|
|
20
|
-
".": "./dist/mod.js"
|
|
21
|
-
},
|
|
22
|
-
"publishConfig": {
|
|
23
|
-
"access": "public"
|
|
24
|
-
},
|
|
25
40
|
"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"
|
|
41
|
+
"@effect/ai-openai": "4.0.3",
|
|
42
|
+
"@effect/opentelemetry": "4.0.3",
|
|
43
|
+
"@livestore/adapter-node": "0.5.0-dev.1",
|
|
44
|
+
"@livestore/common": "0.5.0-dev.1",
|
|
45
|
+
"@livestore/livestore": "0.5.0-dev.1",
|
|
46
|
+
"@livestore/peer-deps": "0.5.0-dev.1",
|
|
47
|
+
"@livestore/utils": "0.5.0-dev.1",
|
|
48
|
+
"effect": "4.0.3"
|
|
38
49
|
},
|
|
39
50
|
"devDependencies": {
|
|
51
|
+
"@livestore/utils-dev": "0.5.0-dev.1",
|
|
40
52
|
"@types/node": "25.3.3",
|
|
41
|
-
"typescript": "
|
|
42
|
-
"vitest": "
|
|
43
|
-
"@livestore/utils-dev": "^0.4.0"
|
|
53
|
+
"typescript": "7.0.2",
|
|
54
|
+
"vitest": "4.1.9"
|
|
44
55
|
},
|
|
45
56
|
"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",
|
|
57
|
+
"@effect/opentelemetry": "^4.0.3",
|
|
58
|
+
"@effect/platform-browser": "^4.0.3",
|
|
59
|
+
"@effect/platform-bun": "^4.0.3",
|
|
60
|
+
"@effect/platform-node": "^4.0.3",
|
|
61
|
+
"@effect/platform-node-shared": "^4.0.3",
|
|
62
|
+
"@effect/vitest": "^4.0.3",
|
|
61
63
|
"@opentelemetry/api": "^1.9.0",
|
|
62
64
|
"@opentelemetry/resources": "^2.2.0",
|
|
63
65
|
"@standard-schema/spec": "^1.1.0",
|
|
64
|
-
"effect": "^
|
|
66
|
+
"effect": "^4.0.3"
|
|
65
67
|
},
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"warning": "DO NOT EDIT - changes will be overwritten",
|
|
69
|
-
"workspaceClosureDirs": [
|
|
70
|
-
"packages/@livestore/adapter-node",
|
|
71
|
-
"packages/@livestore/adapter-web",
|
|
72
|
-
"packages/@livestore/cli",
|
|
73
|
-
"packages/@livestore/common",
|
|
74
|
-
"packages/@livestore/common-cf",
|
|
75
|
-
"packages/@livestore/devtools-web-common",
|
|
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"
|
|
83
|
-
]
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public"
|
|
84
70
|
},
|
|
85
71
|
"scripts": {
|
|
86
72
|
"build": "tsc",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tmp-test-configs/
|
|
@@ -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, type SubscriptionRef } 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,26 @@ 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, SubscriptionRef } 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
|
+
export const disconnectShouldFail = await Effect.runPromise(SubscriptionRef.make(false))
|
|
56
57
|
|
|
57
58
|
export { schema }
|
|
58
59
|
|
|
59
60
|
export const syncBackend = (_args) =>
|
|
60
61
|
mockBackend.makeSyncBackend.pipe(
|
|
61
|
-
Effect.tap(() =>
|
|
62
|
+
Effect.tap(() => Queue.offer(connectionEvents, 'connect')),
|
|
62
63
|
Effect.map((backend) => {
|
|
63
|
-
const disconnect =
|
|
64
|
+
const disconnect = SubscriptionRef.get(disconnectShouldFail).pipe(
|
|
65
|
+
Effect.flatMap((shouldFail) =>
|
|
66
|
+
shouldFail ? Effect.fail(new Error('disconnect failed')) : (backend.disconnect ?? Effect.void),
|
|
67
|
+
),
|
|
68
|
+
)
|
|
64
69
|
return {
|
|
65
70
|
...backend,
|
|
66
|
-
disconnect: disconnect.pipe(Effect.tap(() =>
|
|
71
|
+
disconnect: disconnect.pipe(Effect.tap(() => Queue.offer(connectionEvents, 'disconnect'))),
|
|
67
72
|
}
|
|
68
73
|
}),
|
|
69
74
|
)
|
|
@@ -92,15 +97,21 @@ export const useMockConfig = Effect.acquireRelease(
|
|
|
92
97
|
catch: (cause) => new DynamicImportError({ cause, path: tempPath }),
|
|
93
98
|
})) as {
|
|
94
99
|
mockBackend: MockSyncBackend
|
|
95
|
-
connectionEvents:
|
|
100
|
+
connectionEvents: Queue.Queue<'connect' | 'disconnect'>
|
|
101
|
+
disconnectShouldFail: SubscriptionRef.SubscriptionRef<boolean>
|
|
96
102
|
}
|
|
97
103
|
|
|
98
|
-
return {
|
|
104
|
+
return {
|
|
105
|
+
configPath: tempPath,
|
|
106
|
+
mockBackend: mod.mockBackend,
|
|
107
|
+
connectionEvents: mod.connectionEvents,
|
|
108
|
+
disconnectShouldFail: mod.disconnectShouldFail,
|
|
109
|
+
}
|
|
99
110
|
}),
|
|
100
111
|
({ configPath }) =>
|
|
101
112
|
Effect.gen(function* () {
|
|
102
113
|
const fs = yield* FileSystem.FileSystem
|
|
103
|
-
yield* fs.remove(configPath, { recursive: false }).pipe(Effect.
|
|
114
|
+
yield* fs.remove(configPath, { recursive: false }).pipe(Effect.ignore)
|
|
104
115
|
}),
|
|
105
116
|
)
|
|
106
117
|
|
|
@@ -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, type Queue, Stream, SubscriptionRef } 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,22 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
52
46
|
}).pipe(withTestCtx(test)),
|
|
53
47
|
)
|
|
54
48
|
|
|
55
|
-
Vitest.
|
|
49
|
+
Vitest.live('preserves a successful export when backend disconnect fails', (test: Vitest.TestContext) =>
|
|
50
|
+
Effect.gen(function* () {
|
|
51
|
+
const { configPath, disconnectShouldFail } = yield* useMockConfig
|
|
52
|
+
yield* SubscriptionRef.set(disconnectShouldFail, true)
|
|
53
|
+
|
|
54
|
+
const result = yield* pullEventsFromSyncBackend({
|
|
55
|
+
configPath,
|
|
56
|
+
storeId,
|
|
57
|
+
clientId,
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
expect(result.eventCount).toBe(0)
|
|
61
|
+
}).pipe(withTestCtx(test)),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
Vitest.live('fails import when backend is not empty', (test: Vitest.TestContext) =>
|
|
56
65
|
Effect.gen(function* () {
|
|
57
66
|
const { mockBackend, connectionEvents, configPath } = yield* useMockConfig
|
|
58
67
|
const factory = makeEventFactory()
|
|
@@ -77,11 +86,11 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
77
86
|
},
|
|
78
87
|
force: false,
|
|
79
88
|
dryRun: false,
|
|
80
|
-
}).pipe(Effect.
|
|
89
|
+
}).pipe(Effect.result)
|
|
81
90
|
|
|
82
|
-
expect(result._tag).toBe('
|
|
83
|
-
if (result._tag === '
|
|
84
|
-
expect(result.
|
|
91
|
+
expect(result._tag).toBe('Failure')
|
|
92
|
+
if (result._tag === 'Failure') {
|
|
93
|
+
expect(result.failure._tag).toBe('ImportError')
|
|
85
94
|
}
|
|
86
95
|
|
|
87
96
|
const lifecycle = yield* expectConnectLifecycle(connectionEvents)
|
|
@@ -89,7 +98,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
89
98
|
}).pipe(withTestCtx(test)),
|
|
90
99
|
)
|
|
91
100
|
|
|
92
|
-
Vitest.
|
|
101
|
+
Vitest.live('supports dry-run import and releases backend', (test: Vitest.TestContext) =>
|
|
93
102
|
Effect.gen(function* () {
|
|
94
103
|
const { configPath, connectionEvents } = yield* useMockConfig
|
|
95
104
|
const factory = makeEventFactory()
|
|
@@ -118,7 +127,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
118
127
|
}).pipe(withTestCtx(test)),
|
|
119
128
|
)
|
|
120
129
|
|
|
121
|
-
Vitest.
|
|
130
|
+
Vitest.live('imports events into empty backend with progress and batching', (test: Vitest.TestContext) =>
|
|
122
131
|
Effect.gen(function* () {
|
|
123
132
|
const { mockBackend, configPath, connectionEvents } = yield* useMockConfig
|
|
124
133
|
const factory = makeEventFactory()
|
|
@@ -151,11 +160,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
151
160
|
{ pushed: 120, total: 120 },
|
|
152
161
|
])
|
|
153
162
|
|
|
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
|
-
)
|
|
163
|
+
const pushedEvents = yield* mockBackend.pushedEvents.pipe(Stream.take(importBatch.length), Stream.runCollect)
|
|
159
164
|
expect(pushedEvents.map((event) => event.seqNum)).toHaveLength(importBatch.length)
|
|
160
165
|
|
|
161
166
|
const lifecycle = yield* expectConnectLifecycle(connectionEvents)
|
|
@@ -163,7 +168,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
163
168
|
}).pipe(withTestCtx(test)),
|
|
164
169
|
)
|
|
165
170
|
|
|
166
|
-
Vitest.
|
|
171
|
+
Vitest.live('allows force import on store ID mismatch', (test: Vitest.TestContext) =>
|
|
167
172
|
Effect.gen(function* () {
|
|
168
173
|
const { mockBackend, configPath, connectionEvents } = yield* useMockConfig
|
|
169
174
|
const factory = makeEventFactory()
|
|
@@ -187,11 +192,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
187
192
|
expect(result.dryRun).toBe(false)
|
|
188
193
|
expect(result.eventCount).toBe(importBatch.length)
|
|
189
194
|
|
|
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
|
-
)
|
|
195
|
+
const pushedEvents = yield* mockBackend.pushedEvents.pipe(Stream.take(1), Stream.runCollect)
|
|
195
196
|
expect(pushedEvents).toHaveLength(1)
|
|
196
197
|
|
|
197
198
|
const lifecycle = yield* expectConnectLifecycle(connectionEvents)
|
|
@@ -199,7 +200,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
199
200
|
}).pipe(withTestCtx(test)),
|
|
200
201
|
)
|
|
201
202
|
|
|
202
|
-
Vitest.
|
|
203
|
+
Vitest.live('rejects store ID mismatch without force', (test: Vitest.TestContext) =>
|
|
203
204
|
Effect.gen(function* () {
|
|
204
205
|
const { configPath, connectionEvents } = yield* useMockConfig
|
|
205
206
|
const factory = makeEventFactory()
|
|
@@ -218,11 +219,11 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
|
|
|
218
219
|
},
|
|
219
220
|
force: false,
|
|
220
221
|
dryRun: false,
|
|
221
|
-
}).pipe(Effect.
|
|
222
|
+
}).pipe(Effect.result)
|
|
222
223
|
|
|
223
|
-
expect(result._tag).toBe('
|
|
224
|
-
if (result._tag === '
|
|
225
|
-
expect(result.
|
|
224
|
+
expect(result._tag).toBe('Failure')
|
|
225
|
+
if (result._tag === 'Failure') {
|
|
226
|
+
expect(result.failure._tag).toBe('ImportError')
|
|
226
227
|
}
|
|
227
228
|
|
|
228
229
|
const lifecycle = yield* expectConnectLifecycle(connectionEvents)
|