@livestore/utils-dev 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.
Files changed (76) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/node/DockerCompose/DockerCompose.d.ts +52 -0
  3. package/dist/node/DockerCompose/DockerCompose.d.ts.map +1 -0
  4. package/dist/node/DockerCompose/DockerCompose.js +158 -0
  5. package/dist/node/DockerCompose/DockerCompose.js.map +1 -0
  6. package/dist/node/DockerCompose/DockerCompose.test.d.ts +2 -0
  7. package/dist/node/DockerCompose/DockerCompose.test.d.ts.map +1 -0
  8. package/dist/node/{DockerComposeService/DockerComposeService.test.js → DockerCompose/DockerCompose.test.js} +16 -16
  9. package/dist/node/DockerCompose/DockerCompose.test.js.map +1 -0
  10. package/dist/node/DockerCompose/mod.d.ts +2 -0
  11. package/dist/node/DockerCompose/mod.d.ts.map +1 -0
  12. package/dist/node/DockerCompose/mod.js +2 -0
  13. package/dist/node/DockerCompose/mod.js.map +1 -0
  14. package/dist/node/FileLogger.d.ts +15 -8
  15. package/dist/node/FileLogger.d.ts.map +1 -1
  16. package/dist/node/FileLogger.js +63 -79
  17. package/dist/node/FileLogger.js.map +1 -1
  18. package/dist/node/cmd-log.d.ts.map +1 -1
  19. package/dist/node/cmd-log.js +19 -8
  20. package/dist/node/cmd-log.js.map +1 -1
  21. package/dist/node/cmd.d.ts +10 -12
  22. package/dist/node/cmd.d.ts.map +1 -1
  23. package/dist/node/cmd.js +73 -36
  24. package/dist/node/cmd.js.map +1 -1
  25. package/dist/node/cmd.test.js +17 -17
  26. package/dist/node/cmd.test.js.map +1 -1
  27. package/dist/node/mod.d.ts +4 -5
  28. package/dist/node/mod.d.ts.map +1 -1
  29. package/dist/node/mod.js +58 -55
  30. package/dist/node/mod.js.map +1 -1
  31. package/dist/node/workspace.d.ts +2 -2
  32. package/dist/node/workspace.d.ts.map +1 -1
  33. package/dist/node/workspace.js +7 -7
  34. package/dist/node/workspace.js.map +1 -1
  35. package/dist/node-vitest/Vitest.d.ts +17 -8
  36. package/dist/node-vitest/Vitest.d.ts.map +1 -1
  37. package/dist/node-vitest/Vitest.js +5 -5
  38. package/dist/node-vitest/Vitest.js.map +1 -1
  39. package/dist/node-vitest/Vitest.test.d.ts +3 -5
  40. package/dist/node-vitest/Vitest.test.d.ts.map +1 -1
  41. package/dist/node-vitest/Vitest.test.js +14 -3
  42. package/dist/node-vitest/Vitest.test.js.map +1 -1
  43. package/dist/wrangler/WranglerDevServer.d.ts +15 -20
  44. package/dist/wrangler/WranglerDevServer.d.ts.map +1 -1
  45. package/dist/wrangler/WranglerDevServer.js +77 -71
  46. package/dist/wrangler/WranglerDevServer.js.map +1 -1
  47. package/dist/wrangler/WranglerDevServer.test.js +28 -28
  48. package/dist/wrangler/WranglerDevServer.test.js.map +1 -1
  49. package/dist/wrangler/mod.d.ts +1 -1
  50. package/dist/wrangler/mod.d.ts.map +1 -1
  51. package/dist/wrangler/mod.js +1 -1
  52. package/dist/wrangler/mod.js.map +1 -1
  53. package/package.json +19 -37
  54. package/src/node/{DockerComposeService/DockerComposeService.test.ts → DockerCompose/DockerCompose.test.ts} +18 -18
  55. package/src/node/DockerCompose/DockerCompose.ts +328 -0
  56. package/src/node/DockerCompose/mod.ts +1 -0
  57. package/src/node/FileLogger.ts +89 -114
  58. package/src/node/cmd-log.ts +21 -10
  59. package/src/node/cmd.test.ts +19 -17
  60. package/src/node/cmd.ts +117 -86
  61. package/src/node/mod.ts +112 -104
  62. package/src/node/workspace.ts +9 -10
  63. package/src/node-vitest/Vitest.test.ts +22 -3
  64. package/src/node-vitest/Vitest.ts +32 -42
  65. package/src/wrangler/WranglerDevServer.test.ts +33 -37
  66. package/src/wrangler/WranglerDevServer.ts +145 -129
  67. package/src/wrangler/mod.ts +1 -6
  68. package/dist/node/DockerComposeService/DockerComposeService.d.ts +0 -63
  69. package/dist/node/DockerComposeService/DockerComposeService.d.ts.map +0 -1
  70. package/dist/node/DockerComposeService/DockerComposeService.js +0 -149
  71. package/dist/node/DockerComposeService/DockerComposeService.js.map +0 -1
  72. package/dist/node/DockerComposeService/DockerComposeService.test.d.ts +0 -2
  73. package/dist/node/DockerComposeService/DockerComposeService.test.d.ts.map +0 -1
  74. package/dist/node/DockerComposeService/DockerComposeService.test.js.map +0 -1
  75. package/src/node/DockerComposeService/DockerComposeService.ts +0 -343
  76. /package/src/node/{DockerComposeService → DockerCompose}/test-fixtures/docker-compose.yml +0 -0
@@ -1,20 +1,20 @@
1
1
  import * as path from 'node:path';
2
2
  import * as Toml from '@iarna/toml';
3
+ import * as wrangler from 'wrangler';
3
4
  import { IS_CI } from '@livestore/utils';
4
- import { Cause, Duration, Effect, FileSystem, HttpClient, Schedule, Schema } from '@livestore/utils/effect';
5
+ import { Cause, Context, Duration, Effect, FileSystem, HttpClient, Layer, Schedule, Schema, } from '@livestore/utils/effect';
5
6
  import { getFreePort } from '@livestore/utils/node';
6
- import * as wrangler from 'wrangler';
7
7
  /**
8
8
  * Error type for WranglerDevServer operations
9
9
  */
10
10
  export class WranglerDevServerError extends Schema.TaggedError('~@livestore/utils-dev/WranglerDevServerError')('WranglerDevServerError', {
11
- cause: Schema.Unknown,
11
+ cause: Schema.Defect(),
12
12
  message: Schema.String,
13
- port: Schema.Number,
13
+ port: Schema.Finite,
14
14
  }) {
15
15
  }
16
16
  /**
17
- * WranglerDevServer as an Effect.Service.
17
+ * WranglerDevServer as an Effect service.
18
18
  *
19
19
  * This service provides the WranglerDevServer properties and can be accessed
20
20
  * directly to get port and url.
@@ -22,69 +22,76 @@ export class WranglerDevServerError extends Schema.TaggedError('~@livestore/util
22
22
  * TODO: Allow for config to be passed in via code instead of `wrangler.toml` file
23
23
  * (would need to be placed in temporary file as wrangler only accepts files as config)
24
24
  */
25
- export class WranglerDevServerService extends Effect.Service()('WranglerDevServerService', {
26
- scoped: (args) => Effect.gen(function* () {
27
- const showLogs = args.showLogs ?? false;
28
- // Allocate preferred port (Wrangler may bind a different one if unavailable)
29
- const preferredPort = args.preferredPort ??
30
- (yield* getFreePort.pipe(Effect.mapError((cause) => new WranglerDevServerError({ cause, message: 'Failed to get free port', port: -1 }))));
31
- yield* Effect.annotateCurrentSpan({ preferredPort });
32
- const configPath = path.resolve(args.wranglerConfigPath ?? path.join(args.cwd, 'wrangler.toml'));
33
- const fs = yield* FileSystem.FileSystem;
34
- const configContent = yield* fs.readFileString(configPath);
35
- const parsedConfig = yield* Effect.try(() => Toml.parse(configContent)).pipe(Effect.andThen(Schema.decodeUnknown(Schema.Struct({ main: Schema.String }))), Effect.mapError((error) => new WranglerDevServerError({ cause: error, message: 'Failed to parse wrangler config', port: -1 })));
36
- const resolvedMainPath = yield* Effect.try(() => path.resolve(args.cwd, parsedConfig.main));
37
- const readiness = args.readiness ?? {};
38
- const startupTimeout = readiness.startupTimeout ?? Duration.seconds(IS_CI === true ? 30 : 10);
39
- const devServer = yield* Effect.promise(() => wrangler.unstable_dev(resolvedMainPath, {
40
- config: configPath,
41
- port: preferredPort,
42
- inspectorPort: args.inspectorPort ?? 0,
43
- persistTo: path.join(args.cwd, '.wrangler/state'),
44
- logLevel: showLogs === true ? 'debug' : 'none',
45
- experimental: {
46
- disableExperimentalWarning: true,
47
- },
48
- })).pipe(Effect.timeout(startupTimeout), Effect.mapError((cause) => new WranglerDevServerError({
49
- cause,
50
- message: `Failed to start wrangler dev server within ${Duration.format(startupTimeout)}`,
51
- port: preferredPort,
52
- })), Effect.tapError((error) => Effect.logError('Wrangler dev server failed to start', {
53
- message: error.message,
54
- preferredPort,
55
- cwd: args.cwd,
56
- })), Effect.retry(readiness.retrySchedule ?? Schedule.recurs(1)));
57
- yield* Effect.addFinalizer(Effect.fn(function* (exit) {
58
- if (exit._tag === 'Failure' && Cause.isInterruptedOnly(exit.cause) === false) {
59
- yield* Effect.logError('Closing wrangler dev server on failure', exit.cause);
60
- }
61
- yield* Effect.tryPromise(async () => {
62
- await devServer.stop();
63
- // TODO investigate whether we need to wait until exit (see workers-sdk repo/talk to Cloudflare team)
64
- // await devServer.waitUntilExit()
65
- });
66
- }, Effect.timeout('5 seconds'), Effect.orDie, Effect.tapCauseLogPretty, Effect.withSpan('WranglerDevServerService:stopDevServer')));
67
- const actualPort = devServer.port;
68
- const actualHost = devServer.address;
69
- const url = `http://${actualHost}:${actualPort}`;
70
- // Use longer timeout in CI environments to account for slower HTTP readiness
71
- const defaultConnectivityTimeout = Duration.seconds(IS_CI === true ? 30 : 5);
72
- const connectivityTimeout = readiness.connectTimeout ?? defaultConnectivityTimeout;
73
- yield* verifyHttpConnectivity({ url, showLogs, connectTimeout: connectivityTimeout });
74
- if (showLogs === true) {
75
- yield* Effect.logDebug(`Wrangler dev server ready and accepting connections on port ${actualPort} (preferred: ${preferredPort})`);
76
- }
77
- return {
78
- port: actualPort,
79
- url,
80
- };
81
- }).pipe(Effect.mapError((error) => error instanceof WranglerDevServerError
82
- ? error
83
- : new WranglerDevServerError({ cause: error, message: 'Failed to start wrangler dev server', port: -1 })), Effect.withSpan('WranglerDevServerService', {
84
- attributes: { preferredPort: args.preferredPort ?? 'auto', cwd: args.cwd },
85
- })),
86
- }) {
25
+ export class WranglerDevServer extends Context.Service()('@livestore/utils-dev/WranglerDevServer') {
87
26
  }
27
+ export const make = (args) => Effect.gen(function* () {
28
+ const showLogs = args.showLogs ?? false;
29
+ // Allocate preferred port (Wrangler may bind a different one if unavailable)
30
+ const preferredPort = args.preferredPort ??
31
+ (yield* getFreePort.pipe(Effect.mapError((cause) => new WranglerDevServerError({ cause, message: 'Failed to get free port', port: -1 }))));
32
+ yield* Effect.annotateCurrentSpan({ preferredPort });
33
+ const configPath = path.resolve(args.wranglerConfigPath ?? path.join(args.cwd, 'wrangler.toml'));
34
+ const fs = yield* FileSystem.FileSystem;
35
+ const configContent = yield* fs.readFileString(configPath);
36
+ const parsedConfig = yield* Effect.try({
37
+ try: () => Toml.parse(configContent),
38
+ catch: (cause) => new Cause.UnknownError(cause),
39
+ }).pipe(Effect.andThen(Schema.decodeUnknownEffect(Schema.Struct({ main: Schema.String }))), Effect.mapError((error) => new WranglerDevServerError({ cause: error, message: 'Failed to parse wrangler config', port: -1 })));
40
+ const resolvedMainPath = yield* Effect.try({
41
+ try: () => path.resolve(args.cwd, parsedConfig.main),
42
+ catch: (cause) => new Cause.UnknownError(cause),
43
+ });
44
+ const readiness = args.readiness ?? {};
45
+ const startupTimeout = readiness.startupTimeout ?? Duration.seconds(IS_CI === true ? 30 : 10);
46
+ const startupTimeoutDuration = Duration.fromInputUnsafe(startupTimeout);
47
+ const devServer = yield* Effect.promise(() => wrangler.unstable_dev(resolvedMainPath, {
48
+ config: configPath,
49
+ port: preferredPort,
50
+ inspectorPort: args.inspectorPort ?? 0,
51
+ persistTo: path.join(args.cwd, '.wrangler/state'),
52
+ logLevel: showLogs === true ? 'debug' : 'none',
53
+ experimental: {
54
+ disableExperimentalWarning: true,
55
+ },
56
+ })).pipe(Effect.timeout(startupTimeout), Effect.mapError((cause) => new WranglerDevServerError({
57
+ cause,
58
+ message: `Failed to start wrangler dev server within ${Duration.format(startupTimeoutDuration)}`,
59
+ port: preferredPort,
60
+ })), Effect.tapError((error) => Effect.logError('Wrangler dev server failed to start', {
61
+ message: error.message,
62
+ preferredPort,
63
+ cwd: args.cwd,
64
+ })), Effect.retry(readiness.retrySchedule ?? Schedule.recurs(1)));
65
+ yield* Effect.addFinalizer(Effect.fn(function* (exit) {
66
+ if (exit._tag === 'Failure' && Cause.hasInterruptsOnly(exit.cause) === false) {
67
+ yield* Effect.logError('Closing wrangler dev server on failure', exit.cause);
68
+ }
69
+ yield* Effect.tryPromise(async () => {
70
+ await devServer.stop();
71
+ // TODO investigate whether we need to wait until exit (see workers-sdk repo/talk to Cloudflare team)
72
+ // await devServer.waitUntilExit()
73
+ });
74
+ }, Effect.timeout('5 seconds'), Effect.orDie, Effect.tapCauseLogPretty, Effect.withSpan('WranglerDevServer:stopDevServer')));
75
+ const actualPort = devServer.port;
76
+ const actualHost = devServer.address;
77
+ const url = `http://${actualHost}:${actualPort}`;
78
+ // Use longer timeout in CI environments to account for slower HTTP readiness
79
+ const defaultConnectivityTimeout = Duration.seconds(IS_CI === true ? 30 : 5);
80
+ const connectivityTimeout = readiness.connectTimeout ?? defaultConnectivityTimeout;
81
+ yield* verifyHttpConnectivity({ url, showLogs, connectTimeout: connectivityTimeout });
82
+ if (showLogs === true) {
83
+ yield* Effect.logDebug(`Wrangler dev server ready and accepting connections on port ${actualPort} (preferred: ${preferredPort})`);
84
+ }
85
+ return WranglerDevServer.of({
86
+ port: actualPort,
87
+ url,
88
+ });
89
+ }).pipe(Effect.mapError((error) => error instanceof WranglerDevServerError
90
+ ? error
91
+ : new WranglerDevServerError({ cause: error, message: 'Failed to start wrangler dev server', port: -1 })), Effect.withSpan('WranglerDevServer', {
92
+ attributes: { preferredPort: args.preferredPort ?? 'auto', cwd: args.cwd },
93
+ }));
94
+ export const layer = (options) => Layer.effect(WranglerDevServer, make(options));
88
95
  /**
89
96
  * Verifies the server is actually accepting HTTP connections by making a test request
90
97
  */
@@ -93,11 +100,10 @@ const verifyHttpConnectivity = ({ url, showLogs, connectTimeout, }) => Effect.ge
93
100
  if (showLogs === true) {
94
101
  yield* Effect.logDebug(`Verifying HTTP connectivity to ${url}`);
95
102
  }
96
- // Try to connect with retries using exponential backoff
97
- yield* client.get(url).pipe(Effect.retryOrElse(Schedule.exponential('50 millis', 2).pipe(Schedule.jittered, Schedule.intersect(Schedule.elapsed.pipe(Schedule.whileOutput(Duration.lessThanOrEqualTo(connectTimeout)))), Schedule.compose(Schedule.count)), (error, attemptCount) => Effect.fail(new WranglerDevServerError({
103
+ yield* client.get(url).pipe(Effect.retry(Schedule.exponential('50 millis', 2).pipe(Schedule.jittered)), Effect.timeout(connectTimeout), Effect.mapError((error) => new WranglerDevServerError({
98
104
  cause: error,
99
- message: `Failed to establish HTTP connection to Wrangler server at ${url} after ${attemptCount} attempts (timeout: ${Duration.toMillis(connectTimeout)}ms)`,
105
+ message: `Failed to establish HTTP connection to Wrangler server at ${url} (timeout: ${Duration.toMillis(Duration.fromInputUnsafe(connectTimeout))}ms)`,
100
106
  port: 0,
101
- }))), Effect.tap(() => (showLogs === true ? Effect.logDebug(`HTTP connectivity verified for ${url}`) : Effect.void)), Effect.asVoid, Effect.withSpan('verifyHttpConnectivity'));
107
+ })), Effect.tap(() => (showLogs === true ? Effect.logDebug(`HTTP connectivity verified for ${url}`) : Effect.void)), Effect.asVoid, Effect.withSpan('verifyHttpConnectivity'));
102
108
  });
103
109
  //# sourceMappingURL=WranglerDevServer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WranglerDevServer.js","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAC3G,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAA;AAEpC;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,MAAM,CAAC,WAAW,CAAyB,8CAA8C,CAAC,CAAC,wBAAwB,EAAE;IAC/J,KAAK,EAAE,MAAM,CAAC,OAAO;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,IAAI,EAAE,MAAM,CAAC,MAAM;CACpB,CAAC;CAAG;AA2CL;;;;;;;;GAQG;AACH,MAAM,OAAO,wBAAyB,SAAQ,MAAM,CAAC,OAAO,EAA4B,CAAC,0BAA0B,EAAE;IACnH,MAAM,EAAE,CAAC,IAAgC,EAAE,EAAE,CAC3C,MAAM,CAAC,GAAG,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eAAe,CAAC,cAAc,CAAC,CAAC,KAAK;QACvJ,IAAI,EAAE,CAAC;KACR,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAC9G,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAC1C,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,10 +1,10 @@
1
1
  import { expect } from 'vitest';
2
2
  import { Vitest } from '@livestore/utils-dev/node-vitest';
3
- import { Effect, FetchHttpClient, Layer } from '@livestore/utils/effect';
3
+ import { Effect, FetchHttpClient, Layer, Result } from '@livestore/utils/effect';
4
4
  import { getFreePort, PlatformNode } from '@livestore/utils/node';
5
- import { WranglerDevServerError, WranglerDevServerService, } from "./WranglerDevServer.js";
5
+ import * as WranglerDevServer from "./WranglerDevServer.js";
6
6
  const testTimeout = 60_000;
7
- const WranglerDevServerTest = (args = {}) => WranglerDevServerService.Default({
7
+ const WranglerDevServerTest = (args = {}) => WranglerDevServer.layer({
8
8
  cwd: `${import.meta.dirname}/fixtures`,
9
9
  ...args,
10
10
  }).pipe(Layer.provide(FetchHttpClient.layer));
@@ -12,15 +12,15 @@ Vitest.describe('WranglerDevServer', { timeout: testTimeout }, () => {
12
12
  Vitest.describe('Basic Operations', () => {
13
13
  const withBasicTest = (args = {}) => Vitest.makeWithTestCtx({
14
14
  timeout: testTimeout,
15
- makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
15
+ makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeServices.layer)),
16
16
  });
17
- Vitest.scopedLive('should start wrangler dev server and return port', (test) => Effect.gen(function* () {
18
- const server = yield* WranglerDevServerService;
17
+ Vitest.live('should start wrangler dev server and return port', (test) => Effect.gen(function* () {
18
+ const server = yield* WranglerDevServer.WranglerDevServer;
19
19
  expect(server.port).toBeGreaterThan(0);
20
20
  expect(server.url).toMatch(/http:\/\/127.0.0.1:\d+/);
21
21
  }).pipe(withBasicTest()(test)));
22
- Vitest.scopedLive('should use specified port when provided', (test) => Effect.andThen(getFreePort, (port) => Effect.gen(function* () {
23
- const server = yield* WranglerDevServerService;
22
+ Vitest.live('should use specified port when provided', (test) => Effect.andThen(getFreePort, (port) => Effect.gen(function* () {
23
+ const server = yield* WranglerDevServer.WranglerDevServer;
24
24
  expect(server.port).toBe(port);
25
25
  expect(server.url).toBe(`http://127.0.0.1:${port}`);
26
26
  }).pipe(withBasicTest({ preferredPort: port })(test))));
@@ -28,47 +28,47 @@ Vitest.describe('WranglerDevServer', { timeout: testTimeout }, () => {
28
28
  Vitest.describe('Error Handling', () => {
29
29
  const withErrorTest = (args = {}) => Vitest.makeWithTestCtx({
30
30
  timeout: testTimeout,
31
- makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
31
+ makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeServices.layer)),
32
32
  });
33
- Vitest.scopedLive('should handle missing wrangler.toml but should timeout', (test) => Effect.gen(function* () {
34
- const error = yield* WranglerDevServerService.pipe(Effect.provide(WranglerDevServerTest({
33
+ Vitest.live('should handle missing wrangler.toml but should timeout', (test) => Effect.gen(function* () {
34
+ const error = yield* WranglerDevServer.WranglerDevServer.pipe(Effect.provide(WranglerDevServerTest({
35
35
  cwd: '/tmp',
36
36
  wranglerConfigPath: '/dev/null',
37
37
  readiness: { connectTimeout: '500 millis' },
38
- }).pipe(Layer.provide(PlatformNode.NodeContext.layer))), Effect.flip);
39
- expect(error).toBeInstanceOf(WranglerDevServerError);
38
+ }).pipe(Layer.provide(PlatformNode.NodeServices.layer))), Effect.flip);
39
+ expect(error).toBeInstanceOf(WranglerDevServer.WranglerDevServerError);
40
40
  }).pipe(Vitest.withTestCtx(test)));
41
- Vitest.scopedLive('should handle invalid working directory', (test) => Effect.gen(function* () {
42
- const result = yield* WranglerDevServerService.pipe(Effect.provide(WranglerDevServerTest({
41
+ Vitest.live('should handle invalid working directory', (test) => Effect.gen(function* () {
42
+ const result = yield* WranglerDevServer.WranglerDevServer.pipe(Effect.provide(WranglerDevServerTest({
43
43
  cwd: '/completely/nonexistent/directory',
44
- }).pipe(Layer.provide(PlatformNode.NodeContext.layer))), Effect.either);
45
- expect(result._tag).toBe('Left');
46
- if (result._tag === 'Left') {
47
- expect(result.left).toBeInstanceOf(WranglerDevServerError);
44
+ }).pipe(Layer.provide(PlatformNode.NodeServices.layer))), Effect.result);
45
+ expect(result._tag).toBe('Failure');
46
+ if (result._tag === 'Failure') {
47
+ expect(result.failure).toBeInstanceOf(WranglerDevServer.WranglerDevServerError);
48
48
  }
49
49
  }).pipe(Vitest.withTestCtx(test)));
50
- Vitest.scopedLive('should timeout if server fails to start', (test) => Effect.gen(function* () {
50
+ Vitest.live('should timeout if server fails to start', (test) => Effect.gen(function* () {
51
51
  // Create a command that will never output "Ready on"
52
- const result = yield* WranglerDevServerService.pipe(
52
+ const result = yield* WranglerDevServer.WranglerDevServer.pipe(
53
53
  // Override the timeout for this test to be shorter
54
- Effect.timeout('5 seconds'), Effect.either);
54
+ Effect.timeout('5 seconds'), Effect.result);
55
55
  // This might succeed or fail depending on actual wrangler behavior
56
56
  // The main point is testing timeout functionality
57
- expect(['Left', 'Right']).toContain(result._tag);
57
+ expect(['Failure', 'Success']).toContain(result._tag);
58
58
  }).pipe(withErrorTest()(test)));
59
59
  });
60
60
  Vitest.describe('Service Pattern', () => {
61
61
  const withServiceTest = (args = {}) => Vitest.makeWithTestCtx({
62
62
  timeout: testTimeout,
63
- makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
63
+ makeLayer: () => WranglerDevServerTest(args).pipe(Layer.provide(PlatformNode.NodeServices.layer)),
64
64
  });
65
- Vitest.scopedLive('should work with service pattern', (test) => Effect.gen(function* () {
66
- const server = yield* WranglerDevServerService;
65
+ Vitest.live('should work with service pattern', (test) => Effect.gen(function* () {
66
+ const server = yield* WranglerDevServer.WranglerDevServer;
67
67
  expect(server.port).toBeGreaterThan(0);
68
68
  expect(server.url).toMatch(/http:\/\/127.0.0.1:\d+/);
69
69
  }).pipe(withServiceTest()(test)));
70
- Vitest.scopedLive('should work with custom port via service', (test) => Effect.andThen(getFreePort, (port) => Effect.gen(function* () {
71
- const server = yield* WranglerDevServerService;
70
+ Vitest.live('should work with custom port via service', (test) => Effect.andThen(getFreePort, (port) => Effect.gen(function* () {
71
+ const server = yield* WranglerDevServer.WranglerDevServer;
72
72
  expect(server.port).toBe(port);
73
73
  expect(server.url).toBe(`http://127.0.0.1:${port}`);
74
74
  }).pipe(withServiceTest({ preferredPort: port })(test))));
@@ -1 +1 @@
1
- {"version":3,"file":"WranglerDevServer.test.js","sourceRoot":"","sources":["../../src/wrangler/WranglerDevServer.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEjE,OAAO,EAEL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,wBAAwB,CAAA;AAE/B,MAAM,WAAW,GAAG,MAAM,CAAA;AAE1B,MAAM,qBAAqB,GAAG,CAAC,OAA4C,EAAE,EAAE,EAAE,CAC/E,wBAAwB,CAAC,OAAO,CAAC;IAC/B,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW;IACtC,GAAG,IAAI;CACR,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO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AC,eAAe,CAAC,CAAC,CAAC,CAAA;YACtC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAA;QACtD,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,CAAC,CACjC,CAAA;QAED,MAAM,CAAC,IAAI,CAAC,0CAA0C,EAAE,CAAC,IAAI,EAAE,EAAE,CAC/D,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CACnC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YAClB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,iBAAiB,CAAC,iBAAiB,CAAA;YAEzD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC9B,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAA;QACrD,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CACxD,CACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +1,2 @@
1
- export { type StartWranglerDevServerArgs, type WranglerDevServer, WranglerDevServerError, WranglerDevServerService, } from './WranglerDevServer.ts';
1
+ export * as WranglerDevServer from './WranglerDevServer.ts';
2
2
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA"}
@@ -1,2 +1,2 @@
1
- export { WranglerDevServerError, WranglerDevServerService, } from "./WranglerDevServer.js";
1
+ export * as WranglerDevServer from "./WranglerDevServer.js";
2
2
  //# sourceMappingURL=mod.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,wBAAwB,CAAA"}
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/wrangler/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/utils-dev",
3
- "version": "0.4.0",
3
+ "version": "0.5.0-dev.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,8 +25,8 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@effect/opentelemetry": "0.63.0",
29
- "@effect/vitest": "0.29.0",
28
+ "@effect/opentelemetry": "4.0.0-rc.111",
29
+ "@effect/vitest": "4.0.0-rc.111",
30
30
  "@iarna/toml": "3.0.0",
31
31
  "@opentelemetry/api": "1.9.0",
32
32
  "@opentelemetry/exporter-metrics-otlp-http": "0.208.0",
@@ -35,50 +35,32 @@
35
35
  "@opentelemetry/sdk-trace-base": "2.2.0",
36
36
  "@opentelemetry/sdk-trace-node": "2.2.0",
37
37
  "wrangler": "4.42.2",
38
- "@livestore/utils": "^0.4.0"
38
+ "@livestore/utils": "^0.5.0-dev.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@effect/ai": "0.35.0",
42
- "@effect/cli": "0.75.1",
43
- "@effect/cluster": "0.58.2",
44
- "@effect/experimental": "0.60.0",
45
- "@effect/opentelemetry": "0.63.0",
46
- "@effect/platform": "0.96.1",
47
- "@effect/platform-browser": "0.76.0",
48
- "@effect/platform-bun": "0.89.0",
49
- "@effect/platform-node": "0.106.0",
50
- "@effect/printer": "0.49.0",
51
- "@effect/printer-ansi": "0.49.0",
52
- "@effect/rpc": "0.75.1",
53
- "@effect/sql": "0.51.1",
54
- "@effect/typeclass": "0.40.0",
55
- "@effect/vitest": "0.29.0",
41
+ "@effect/opentelemetry": "4.0.0-rc.111",
42
+ "@effect/platform-browser": "4.0.0-rc.111",
43
+ "@effect/platform-bun": "4.0.0-rc.111",
44
+ "@effect/platform-node": "4.0.0-rc.111",
45
+ "@effect/platform-node-shared": "4.0.0-rc.111",
46
+ "@effect/vitest": "4.0.0-rc.111",
56
47
  "@opentelemetry/api": "1.9.0",
57
48
  "@opentelemetry/resources": "2.2.0",
58
49
  "@standard-schema/spec": "1.1.0",
59
- "effect": "3.21.2",
60
- "vitest": "3.2.4"
50
+ "effect": "4.0.0-rc.111",
51
+ "vitest": "4.1.9"
61
52
  },
62
53
  "peerDependencies": {
63
- "@effect/ai": "^0.35.0",
64
- "@effect/cli": "^0.75.1",
65
- "@effect/cluster": "^0.58.2",
66
- "@effect/experimental": "^0.60.0",
67
- "@effect/opentelemetry": "^0.63.0",
68
- "@effect/platform": "^0.96.1",
69
- "@effect/platform-browser": "^0.76.0",
70
- "@effect/platform-bun": "^0.89.0",
71
- "@effect/platform-node": "^0.106.0",
72
- "@effect/printer": "^0.49.0",
73
- "@effect/printer-ansi": "^0.49.0",
74
- "@effect/rpc": "^0.75.1",
75
- "@effect/sql": "^0.51.1",
76
- "@effect/typeclass": "^0.40.0",
77
- "@effect/vitest": "^0.29.0",
54
+ "@effect/opentelemetry": "^4.0.0-rc.111",
55
+ "@effect/platform-browser": "^4.0.0-rc.111",
56
+ "@effect/platform-bun": "^4.0.0-rc.111",
57
+ "@effect/platform-node": "^4.0.0-rc.111",
58
+ "@effect/platform-node-shared": "^4.0.0-rc.111",
59
+ "@effect/vitest": "^4.0.0-rc.111",
78
60
  "@opentelemetry/api": "^1.9.0",
79
61
  "@opentelemetry/resources": "^2.2.0",
80
62
  "@standard-schema/spec": "^1.1.0",
81
- "effect": "^3.21.2"
63
+ "effect": "^4.0.0-rc.111"
82
64
  },
83
65
  "$genie": {
84
66
  "source": "package.json.genie.ts",
@@ -6,37 +6,37 @@ import { Vitest } from '@livestore/utils-dev/node-vitest'
6
6
  import { Duration, Effect, Layer, Stream } from '@livestore/utils/effect'
7
7
  import { PlatformNode } from '@livestore/utils/node'
8
8
 
9
- import { type DockerComposeArgs, DockerComposeService } from './DockerComposeService.ts'
9
+ import * as DockerCompose from './DockerCompose.ts'
10
10
 
11
11
  const testTimeout = 30_000
12
12
  const testFixturePath = path.join(import.meta.dirname, 'test-fixtures')
13
13
 
14
- const DockerComposeTest = (args: Partial<DockerComposeArgs> = {}) =>
15
- DockerComposeService.Default({
14
+ const DockerComposeTest = (args: Partial<DockerCompose.Options> = {}) =>
15
+ DockerCompose.layer({
16
16
  cwd: testFixturePath,
17
17
  ...args,
18
18
  })
19
19
 
20
- Vitest.describe('DockerComposeService', { timeout: testTimeout }, () => {
20
+ Vitest.describe('DockerCompose', { timeout: testTimeout }, () => {
21
21
  Vitest.describe('Basic Operations', () => {
22
- const withBasicTest = (args: Partial<DockerComposeArgs> = {}) =>
22
+ const withBasicTest = (args: Partial<DockerCompose.Options> = {}) =>
23
23
  Vitest.makeWithTestCtx({
24
24
  timeout: testTimeout,
25
- makeLayer: () => DockerComposeTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
25
+ makeLayer: () => DockerComposeTest(args).pipe(Layer.provide(PlatformNode.NodeServices.layer)),
26
26
  })
27
27
 
28
- Vitest.scopedLive('can pull docker images', (test) =>
28
+ Vitest.live('can pull docker images', (test) =>
29
29
  Effect.gen(function* () {
30
- const dockerCompose = yield* DockerComposeService
30
+ const dockerCompose = yield* DockerCompose.DockerCompose
31
31
 
32
32
  // Test that pull operation works (should succeed for hello-world image)
33
33
  yield* dockerCompose.pull
34
34
  }).pipe(withBasicTest()(test)),
35
35
  )
36
36
 
37
- Vitest.scopedLive('can start and stop docker compose services', (test) =>
37
+ Vitest.live('can start and stop docker compose services', (test) =>
38
38
  Effect.gen(function* () {
39
- const dockerCompose = yield* DockerComposeService
39
+ const dockerCompose = yield* DockerCompose.DockerCompose
40
40
 
41
41
  // Start the service
42
42
  yield* dockerCompose.start({ detached: true })
@@ -46,9 +46,9 @@ Vitest.describe('DockerComposeService', { timeout: testTimeout }, () => {
46
46
  }).pipe(withBasicTest({ serviceName: 'hello-world' })(test)),
47
47
  )
48
48
 
49
- Vitest.scopedLive('can get logs from docker compose services', (test) =>
49
+ Vitest.live('can get logs from docker compose services', (test) =>
50
50
  Effect.gen(function* () {
51
- const dockerCompose = yield* DockerComposeService
51
+ const dockerCompose = yield* DockerCompose.DockerCompose
52
52
 
53
53
  // Start the service first
54
54
  yield* dockerCompose.start({ detached: true })
@@ -65,15 +65,15 @@ Vitest.describe('DockerComposeService', { timeout: testTimeout }, () => {
65
65
  })
66
66
 
67
67
  Vitest.describe('Health Check Operations', () => {
68
- const withHealthCheckTest = (args: Partial<DockerComposeArgs> = {}) =>
68
+ const withHealthCheckTest = (args: Partial<DockerCompose.Options> = {}) =>
69
69
  Vitest.makeWithTestCtx({
70
70
  timeout: testTimeout,
71
- makeLayer: () => DockerComposeTest(args).pipe(Layer.provide(PlatformNode.NodeContext.layer)),
71
+ makeLayer: () => DockerComposeTest(args).pipe(Layer.provide(PlatformNode.NodeServices.layer)),
72
72
  })
73
73
 
74
- Vitest.scopedLive('handles health check timeout gracefully', (test) =>
74
+ Vitest.live('handles health check timeout gracefully', (test) =>
75
75
  Effect.gen(function* () {
76
- const dockerCompose = yield* DockerComposeService
76
+ const dockerCompose = yield* DockerCompose.DockerCompose
77
77
 
78
78
  // Test starting with a health check that will timeout (invalid URL)
79
79
  const result = yield* dockerCompose
@@ -84,10 +84,10 @@ Vitest.describe('DockerComposeService', { timeout: testTimeout }, () => {
84
84
  timeout: Duration.seconds(2),
85
85
  },
86
86
  })
87
- .pipe(Effect.either)
87
+ .pipe(Effect.result)
88
88
 
89
89
  // Should fail due to health check timeout
90
- expect(result._tag).toBe('Left')
90
+ expect(result._tag).toBe('Failure')
91
91
  }).pipe(withHealthCheckTest({ serviceName: 'hello-world' })(test)),
92
92
  )
93
93
  })