@voidhash/mimic-effect 1.0.0-beta.16 → 1.0.0-beta.18

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 (99) hide show
  1. package/dist/ColdStorage.cjs +1 -1
  2. package/dist/ColdStorage.d.cts +2 -2
  3. package/dist/ColdStorage.d.cts.map +1 -1
  4. package/dist/ColdStorage.d.mts +2 -2
  5. package/dist/ColdStorage.d.mts.map +1 -1
  6. package/dist/ColdStorage.mjs +2 -2
  7. package/dist/ColdStorage.mjs.map +1 -1
  8. package/dist/DocumentInstance.cjs +13 -13
  9. package/dist/DocumentInstance.mjs +13 -13
  10. package/dist/DocumentInstance.mjs.map +1 -1
  11. package/dist/Errors.d.cts +8 -8
  12. package/dist/Errors.d.cts.map +1 -1
  13. package/dist/Errors.d.mts +8 -8
  14. package/dist/Errors.d.mts.map +1 -1
  15. package/dist/HotStorage.cjs +1 -1
  16. package/dist/HotStorage.d.cts +2 -2
  17. package/dist/HotStorage.d.mts +2 -2
  18. package/dist/HotStorage.mjs +2 -2
  19. package/dist/HotStorage.mjs.map +1 -1
  20. package/dist/Metrics.cjs +6 -6
  21. package/dist/Metrics.d.cts +21 -23
  22. package/dist/Metrics.d.cts.map +1 -1
  23. package/dist/Metrics.d.mts +21 -23
  24. package/dist/Metrics.d.mts.map +1 -1
  25. package/dist/Metrics.mjs +7 -7
  26. package/dist/Metrics.mjs.map +1 -1
  27. package/dist/MimicAuthService.cjs +1 -1
  28. package/dist/MimicAuthService.d.cts +2 -2
  29. package/dist/MimicAuthService.d.cts.map +1 -1
  30. package/dist/MimicAuthService.d.mts +2 -2
  31. package/dist/MimicAuthService.d.mts.map +1 -1
  32. package/dist/MimicAuthService.mjs +2 -2
  33. package/dist/MimicAuthService.mjs.map +1 -1
  34. package/dist/MimicClusterServerEngine.cjs +38 -41
  35. package/dist/MimicClusterServerEngine.d.cts +1 -1
  36. package/dist/MimicClusterServerEngine.d.mts +1 -1
  37. package/dist/MimicClusterServerEngine.mjs +31 -34
  38. package/dist/MimicClusterServerEngine.mjs.map +1 -1
  39. package/dist/MimicServer.cjs +23 -23
  40. package/dist/MimicServer.d.cts +3 -3
  41. package/dist/MimicServer.d.cts.map +1 -1
  42. package/dist/MimicServer.d.mts +3 -3
  43. package/dist/MimicServer.d.mts.map +1 -1
  44. package/dist/MimicServer.mjs +22 -22
  45. package/dist/MimicServer.mjs.map +1 -1
  46. package/dist/MimicServerEngine.cjs +13 -13
  47. package/dist/MimicServerEngine.d.cts +2 -2
  48. package/dist/MimicServerEngine.d.mts +2 -2
  49. package/dist/MimicServerEngine.mjs +14 -14
  50. package/dist/MimicServerEngine.mjs.map +1 -1
  51. package/dist/PresenceManager.cjs +4 -4
  52. package/dist/PresenceManager.d.cts +2 -2
  53. package/dist/PresenceManager.d.mts +2 -2
  54. package/dist/PresenceManager.mjs +5 -5
  55. package/dist/PresenceManager.mjs.map +1 -1
  56. package/dist/Types.d.cts +1 -1
  57. package/dist/Types.d.mts +1 -1
  58. package/dist/testing/ColdStorageTestSuite.cjs +3 -3
  59. package/dist/testing/ColdStorageTestSuite.mjs +3 -3
  60. package/dist/testing/ColdStorageTestSuite.mjs.map +1 -1
  61. package/dist/testing/HotStorageTestSuite.cjs +13 -13
  62. package/dist/testing/HotStorageTestSuite.mjs +13 -13
  63. package/dist/testing/HotStorageTestSuite.mjs.map +1 -1
  64. package/dist/testing/StorageIntegrationTestSuite.cjs +3 -3
  65. package/dist/testing/StorageIntegrationTestSuite.mjs +3 -3
  66. package/dist/testing/StorageIntegrationTestSuite.mjs.map +1 -1
  67. package/dist/testing/types.d.cts +3 -3
  68. package/dist/testing/types.d.cts.map +1 -1
  69. package/dist/testing/types.d.mts +1 -1
  70. package/dist/testing/types.d.mts.map +1 -1
  71. package/package.json +17 -21
  72. package/src/ColdStorage.ts +4 -5
  73. package/src/DocumentInstance.ts +13 -13
  74. package/src/HotStorage.ts +3 -3
  75. package/src/Metrics.ts +22 -16
  76. package/src/MimicAuthService.ts +3 -3
  77. package/src/MimicClusterServerEngine.ts +35 -35
  78. package/src/MimicServer.ts +26 -30
  79. package/src/MimicServerEngine.ts +15 -15
  80. package/src/PresenceManager.ts +6 -6
  81. package/src/Types.ts +1 -1
  82. package/src/testing/ColdStorageTestSuite.ts +3 -3
  83. package/src/testing/HotStorageTestSuite.ts +17 -17
  84. package/src/testing/StorageIntegrationTestSuite.ts +3 -3
  85. package/.turbo/turbo-build.log +0 -154
  86. package/tests/ColdStorage.test.ts +0 -24
  87. package/tests/DocumentInstance.test.ts +0 -669
  88. package/tests/HotStorage.test.ts +0 -24
  89. package/tests/MimicAuthService.test.ts +0 -153
  90. package/tests/MimicClusterServerEngine.test.ts +0 -587
  91. package/tests/MimicServer.test.ts +0 -142
  92. package/tests/MimicServerEngine.test.ts +0 -547
  93. package/tests/PresenceManager.test.ts +0 -380
  94. package/tests/Protocol.test.ts +0 -190
  95. package/tests/StorageIntegration.test.ts +0 -259
  96. package/tsconfig.build.json +0 -24
  97. package/tsconfig.json +0 -8
  98. package/tsdown.config.ts +0 -18
  99. package/vitest.mts +0 -11
@@ -12,12 +12,8 @@ import {
12
12
  Metric,
13
13
  Stream,
14
14
  } from "effect";
15
- import {
16
- HttpLayerRouter,
17
- HttpServerRequest,
18
- HttpServerResponse,
19
- } from "@effect/platform";
20
- import type * as Socket from "@effect/platform/Socket";
15
+ import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
16
+ import type * as Socket from "effect/unstable/socket";
21
17
  import { Presence } from "@voidhash/mimic";
22
18
  import type { MimicServerRouteConfig, ResolvedRouteConfig } from "./Types";
23
19
  import * as Protocol from "./Protocol";
@@ -43,10 +39,10 @@ const resolveRouteConfig = (
43
39
  ): ResolvedRouteConfig => ({
44
40
  path: config?.path ?? DEFAULT_PATH,
45
41
  heartbeatInterval: config?.heartbeatInterval
46
- ? Duration.decode(config.heartbeatInterval)
42
+ ? Duration.fromInputUnsafe(config.heartbeatInterval)
47
43
  : DEFAULT_HEARTBEAT_INTERVAL,
48
44
  heartbeatTimeout: config?.heartbeatTimeout
49
- ? Duration.decode(config.heartbeatTimeout)
45
+ ? Duration.fromInputUnsafe(config.heartbeatTimeout)
50
46
  : DEFAULT_HEARTBEAT_TIMEOUT,
51
47
  });
52
48
 
@@ -94,7 +90,7 @@ interface ConnectionState {
94
90
  */
95
91
  const handleWebSocketConnection = Effect.fn("websocket.connection.handle")(
96
92
  function* (
97
- socket: Socket.Socket,
93
+ socket: Socket.Socket.Socket,
98
94
  documentId: string,
99
95
  engine: MimicServerEngine,
100
96
  authService: MimicAuthService,
@@ -104,8 +100,8 @@ const handleWebSocketConnection = Effect.fn("websocket.connection.handle")(
104
100
  const connectionStartTime = Date.now();
105
101
 
106
102
  // Track connection metrics
107
- yield* Metric.increment(Metrics.connectionsTotal);
108
- yield* Metric.incrementBy(Metrics.connectionsActive, 1);
103
+ yield* Metric.update(Metrics.connectionsTotal, 1);
104
+ yield* Metric.update(Metrics.connectionsActive, 1);
109
105
 
110
106
  // Track connection state (mutable for simplicity)
111
107
  const state: ConnectionState = {
@@ -146,18 +142,18 @@ const handleWebSocketConnection = Effect.fn("websocket.connection.handle")(
146
142
 
147
143
  // Handle authentication
148
144
  const handleAuth = Effect.fn("auth.handle")(function* (token: string) {
149
- const result = yield* Effect.either(
145
+ const result = yield* Effect.result(
150
146
  authService.authenticate(token, documentId)
151
147
  );
152
148
 
153
- if (result._tag === "Right") {
149
+ if (result._tag === "Success") {
154
150
  state.authenticated = true;
155
- state.authContext = result.right;
151
+ state.authContext = result.success;
156
152
 
157
153
  yield* sendMessage(
158
154
  Protocol.authResultSuccess(
159
- result.right.userId,
160
- result.right.permission
155
+ result.success.userId,
156
+ result.success.permission
161
157
  )
162
158
  );
163
159
 
@@ -167,10 +163,10 @@ const handleWebSocketConnection = Effect.fn("websocket.connection.handle")(
167
163
  // Send presence snapshot after successful auth
168
164
  yield* sendPresenceSnapshot();
169
165
  } else {
170
- yield* Metric.increment(Metrics.connectionsErrors);
166
+ yield* Metric.update(Metrics.connectionsErrors, 1);
171
167
  yield* sendMessage(
172
168
  Protocol.authResultFailure(
173
- result.left.reason ?? "Authentication failed"
169
+ result.failure.reason ?? "Authentication failed"
174
170
  )
175
171
  );
176
172
  }
@@ -295,7 +291,7 @@ const handleWebSocketConnection = Effect.fn("websocket.connection.handle")(
295
291
  );
296
292
 
297
293
  // Subscribe to document broadcasts
298
- const subscribeFiber = yield* Effect.fork(
294
+ const subscribeFiber = yield* Effect.forkChild(
299
295
  Effect.fn("subscriptions.document.start")(function* () {
300
296
  // Wait until authenticated before subscribing
301
297
  while (!state.authenticated) {
@@ -313,7 +309,7 @@ const handleWebSocketConnection = Effect.fn("websocket.connection.handle")(
313
309
  );
314
310
 
315
311
  // Subscribe to presence events (if presence is enabled)
316
- const presenceFiber = yield* Effect.fork(
312
+ const presenceFiber = yield* Effect.forkChild(
317
313
  Effect.fn("subscriptions.presence.start")(function* () {
318
314
  if (!engine.config.presence) return;
319
315
 
@@ -359,7 +355,7 @@ const handleWebSocketConnection = Effect.fn("websocket.connection.handle")(
359
355
  }
360
356
 
361
357
  // Update connection metrics
362
- yield* Metric.incrementBy(Metrics.connectionsActive, -1);
358
+ yield* Metric.update(Metrics.connectionsActive, -1);
363
359
  yield* Metric.update(Metrics.connectionsDuration, duration);
364
360
 
365
361
  yield* Effect.logDebug("WebSocket connection closed", {
@@ -371,12 +367,12 @@ const handleWebSocketConnection = Effect.fn("websocket.connection.handle")(
371
367
  );
372
368
 
373
369
  // Process incoming messages
374
- yield* socket.runRaw((data) =>
370
+ yield* socket.runRaw((data: string | Uint8Array) =>
375
371
  Effect.fn("message.process")(function* () {
376
372
  const message = yield* Protocol.parseClientMessage(data);
377
373
  yield* handleMessage(message);
378
374
  })().pipe(
379
- Effect.catchAll((error) =>
375
+ Effect["catch"]((error) =>
380
376
  Effect.logError("Message handling error", error)
381
377
  )
382
378
  )
@@ -433,11 +429,11 @@ export const layerHttpLayerRouter = (
433
429
 
434
430
  // Build the route path pattern: {path}/doc/:documentId
435
431
  const routePath =
436
- `${routeConfig.path}/doc/:documentId` as HttpLayerRouter.PathInput;
432
+ `${routeConfig.path}/doc/:documentId` as HttpRouter.PathInput;
437
433
 
438
- return Layer.scopedDiscard(
434
+ return Layer.effectDiscard(
439
435
  Effect.gen(function* () {
440
- const router = yield* HttpLayerRouter.HttpRouter;
436
+ const router = yield* HttpRouter.HttpRouter;
441
437
  // Capture engine and auth service at layer creation time
442
438
  const engine = yield* MimicServerEngineTag;
443
439
  const authService = yield* MimicAuthServiceTag;
@@ -447,16 +443,16 @@ export const layerHttpLayerRouter = (
447
443
  const handler = Effect.fn("websocket.route.handler")(
448
444
  function* (request: HttpServerRequest.HttpServerRequest) {
449
445
  // Extract document ID from path
450
- const documentIdResult = yield* Effect.either(
446
+ const documentIdResult = yield* Effect.result(
451
447
  extractDocumentId(request.url)
452
448
  );
453
- if (documentIdResult._tag === "Left") {
449
+ if (documentIdResult._tag === "Failure") {
454
450
  return HttpServerResponse.text(
455
451
  `Missing document ID in path: ${request.url}`,
456
452
  { status: 400 }
457
453
  );
458
454
  }
459
- const documentId = documentIdResult.right;
455
+ const documentId = documentIdResult.success;
460
456
 
461
457
  // Upgrade to WebSocket
462
458
  const socket = yield* request.upgrade;
@@ -470,7 +466,7 @@ export const layerHttpLayerRouter = (
470
466
  routeConfig
471
467
  ).pipe(
472
468
  Effect.scoped,
473
- Effect.catchAll((error) =>
469
+ Effect["catch"]((error) =>
474
470
  Effect.logError("WebSocket connection error", error)
475
471
  )
476
472
  );
@@ -7,7 +7,7 @@
7
7
  * This is the engine layer - for WebSocket routes, use MimicServer.layerHttpLayerRouter().
8
8
  */
9
9
  import {
10
- Context,
10
+ ServiceMap,
11
11
  Duration,
12
12
  Effect,
13
13
  HashMap,
@@ -152,9 +152,9 @@ export interface MimicServerEngine {
152
152
  /**
153
153
  * Context tag for MimicServerEngine
154
154
  */
155
- export class MimicServerEngineTag extends Context.Tag(
155
+ export class MimicServerEngineTag extends ServiceMap.Service<MimicServerEngineTag, MimicServerEngine>()(
156
156
  "@voidhash/mimic-effect/MimicServerEngine"
157
- )<MimicServerEngineTag, MimicServerEngine>() {}
157
+ ) {}
158
158
 
159
159
  // =============================================================================
160
160
  // Default Configuration
@@ -176,18 +176,18 @@ const resolveConfig = <TSchema extends Primitive.AnyPrimitive>(
176
176
  initial: config.initial,
177
177
  presence: config.presence,
178
178
  maxIdleTime: config.maxIdleTime
179
- ? Duration.decode(config.maxIdleTime)
179
+ ? Duration.fromInputUnsafe(config.maxIdleTime)
180
180
  : DEFAULT_MAX_IDLE_TIME,
181
181
  maxTransactionHistory:
182
182
  config.maxTransactionHistory ?? DEFAULT_MAX_TRANSACTION_HISTORY,
183
183
  snapshot: {
184
184
  interval: config.snapshot?.interval
185
- ? Duration.decode(config.snapshot.interval)
185
+ ? Duration.fromInputUnsafe(config.snapshot.interval)
186
186
  : DEFAULT_SNAPSHOT_INTERVAL,
187
187
  transactionThreshold:
188
188
  config.snapshot?.transactionThreshold ?? DEFAULT_SNAPSHOT_THRESHOLD,
189
189
  idleTimeout: config.snapshot?.idleTimeout
190
- ? Duration.decode(config.snapshot.idleTimeout)
190
+ ? Duration.fromInputUnsafe(config.snapshot.idleTimeout)
191
191
  : DEFAULT_SNAPSHOT_IDLE_TIMEOUT,
192
192
  },
193
193
  });
@@ -248,7 +248,7 @@ export const make = <TSchema extends Primitive.AnyPrimitive>(
248
248
  > => {
249
249
  const resolvedConfig = resolveConfig(config);
250
250
 
251
- return Layer.scoped(
251
+ return Layer.effect(
252
252
  MimicServerEngineTag,
253
253
  Effect.gen(function* () {
254
254
  const coldStorage = yield* ColdStorageTag;
@@ -311,7 +311,7 @@ export const make = <TSchema extends Primitive.AnyPrimitive>(
311
311
  const lastActivity = yield* Ref.get(entry.lastActivityTime);
312
312
  if (now - lastActivity >= maxIdleMs) {
313
313
  // Save final snapshot before eviction (best effort)
314
- yield* Effect.catchAll(entry.instance.saveSnapshot(), (e) =>
314
+ yield* Effect["catch"](entry.instance.saveSnapshot(), (e) =>
315
315
  Effect.logError("Failed to save snapshot during eviction", {
316
316
  documentId,
317
317
  error: e,
@@ -322,8 +322,8 @@ export const make = <TSchema extends Primitive.AnyPrimitive>(
322
322
  yield* Ref.update(store, (map) => HashMap.remove(map, documentId));
323
323
 
324
324
  // Track eviction metrics
325
- yield* Metric.increment(Metrics.documentsEvicted);
326
- yield* Metric.incrementBy(Metrics.documentsActive, -1);
325
+ yield* Metric.update(Metrics.documentsEvicted, 1);
326
+ yield* Metric.update(Metrics.documentsActive, -1);
327
327
 
328
328
  yield* Effect.logInfo("Document evicted due to idle timeout", {
329
329
  documentId,
@@ -335,7 +335,7 @@ export const make = <TSchema extends Primitive.AnyPrimitive>(
335
335
  // Run GC every minute
336
336
  yield* gcLoop().pipe(
337
337
  Effect.repeat(Schedule.spaced("1 minute")),
338
- Effect.fork
338
+ Effect.forkChild
339
339
  );
340
340
  });
341
341
 
@@ -376,7 +376,7 @@ export const make = <TSchema extends Primitive.AnyPrimitive>(
376
376
  }
377
377
 
378
378
  // Save snapshot (with error handling)
379
- yield* Effect.catchAll(entry.instance.saveSnapshot(), (e) =>
379
+ yield* Effect["catch"](entry.instance.saveSnapshot(), (e) =>
380
380
  Effect.logWarning("Periodic snapshot save failed", {
381
381
  documentId,
382
382
  error: e,
@@ -384,14 +384,14 @@ export const make = <TSchema extends Primitive.AnyPrimitive>(
384
384
  );
385
385
 
386
386
  // Track metric
387
- yield* Metric.increment(Metrics.storageIdleSnapshots);
387
+ yield* Metric.update(Metrics.storageIdleSnapshots, 1);
388
388
  }
389
389
  });
390
390
 
391
391
  // Run snapshot check every 10 seconds
392
392
  yield* snapshotLoop().pipe(
393
393
  Effect.repeat(Schedule.spaced("10 seconds")),
394
- Effect.fork
394
+ Effect.forkChild
395
395
  );
396
396
  });
397
397
 
@@ -404,7 +404,7 @@ export const make = <TSchema extends Primitive.AnyPrimitive>(
404
404
  const current = yield* Ref.get(store);
405
405
  for (const [documentId, entry] of current) {
406
406
  // Best effort save - don't fail shutdown if storage is unavailable
407
- yield* Effect.catchAll(entry.instance.saveSnapshot(), (e) =>
407
+ yield* Effect["catch"](entry.instance.saveSnapshot(), (e) =>
408
408
  Effect.logError("Failed to save snapshot during shutdown", {
409
409
  documentId,
410
410
  error: e,
@@ -4,7 +4,6 @@
4
4
  * Internal service for managing presence state per document.
5
5
  */
6
6
  import {
7
- Context,
8
7
  Effect,
9
8
  HashMap,
10
9
  Layer,
@@ -12,6 +11,7 @@ import {
12
11
  PubSub,
13
12
  Ref,
14
13
  Scope,
14
+ ServiceMap,
15
15
  Stream,
16
16
  } from "effect";
17
17
  import type {
@@ -72,9 +72,9 @@ export interface PresenceManager {
72
72
  /**
73
73
  * Context tag for PresenceManager service
74
74
  */
75
- export class PresenceManagerTag extends Context.Tag(
75
+ export class PresenceManagerTag extends ServiceMap.Service<PresenceManagerTag, PresenceManager>()(
76
76
  "@voidhash/mimic-effect/PresenceManager"
77
- )<PresenceManagerTag, PresenceManager>() {}
77
+ ) {}
78
78
 
79
79
  // =============================================================================
80
80
  // Internal Types
@@ -167,8 +167,8 @@ export const layer: Layer.Layer<PresenceManagerTag> = Layer.effect(
167
167
  });
168
168
 
169
169
  // Track metrics
170
- yield* Metric.increment(Metrics.presenceUpdates);
171
- yield* Metric.incrementBy(Metrics.presenceActive, 1);
170
+ yield* Metric.update(Metrics.presenceUpdates, 1);
171
+ yield* Metric.update(Metrics.presenceActive, 1);
172
172
 
173
173
  // Broadcast update event
174
174
  const event: PresenceEvent = {
@@ -205,7 +205,7 @@ export const layer: Layer.Layer<PresenceManagerTag> = Layer.effect(
205
205
  });
206
206
 
207
207
  // Track metrics
208
- yield* Metric.incrementBy(Metrics.presenceActive, -1);
208
+ yield* Metric.update(Metrics.presenceActive, -1);
209
209
 
210
210
  // Broadcast remove event
211
211
  const event: PresenceEvent = {
package/src/Types.ts CHANGED
@@ -107,7 +107,7 @@ export type PresenceEvent = PresenceUpdateEvent | PresenceRemoveEvent;
107
107
  /**
108
108
  * Duration input type - matches Effect's DurationInput
109
109
  */
110
- export type DurationInput = Duration.DurationInput;
110
+ export type DurationInput = Duration.Input;
111
111
 
112
112
  /**
113
113
  * Snapshot configuration
@@ -565,11 +565,11 @@ export const runAll = (): Effect.Effect<
565
565
  }> = [];
566
566
 
567
567
  for (const test of tests) {
568
- const result = yield* Effect.either(test.run);
569
- if (result._tag === "Right") {
568
+ const result = yield* Effect.result(test.run);
569
+ if (result._tag === "Success") {
570
570
  passed.push(test);
571
571
  } else {
572
- failed.push({ test, error: result.left });
572
+ failed.push({ test, error: result.failure });
573
573
  }
574
574
  }
575
575
 
@@ -659,16 +659,16 @@ const tests: StorageTestCase<HotStorageTestError, HotStorageTag>[] = [
659
659
  const storage = yield* HotStorageTag;
660
660
  yield* storage.appendWithCheck("gap-check-fail", makeEntry(1), 1);
661
661
  // Attempt to append version 3, skipping version 2
662
- const result = yield* Effect.either(
662
+ const result = yield* Effect.result(
663
663
  storage.appendWithCheck("gap-check-fail", makeEntry(3), 3)
664
664
  );
665
665
  yield* assertTrue(
666
- result._tag === "Left",
666
+ result._tag === "Failure",
667
667
  "appendWithCheck should fail when there's a version gap"
668
668
  );
669
- if (result._tag === "Left") {
669
+ if (result._tag === "Failure") {
670
670
  yield* assertTrue(
671
- result.left._tag === "WalVersionGapError",
671
+ result.failure._tag === "WalVersionGapError",
672
672
  "Error should be WalVersionGapError"
673
673
  );
674
674
  }
@@ -685,16 +685,16 @@ const tests: StorageTestCase<HotStorageTestError, HotStorageTag>[] = [
685
685
  run: Effect.gen(function* () {
686
686
  const storage = yield* HotStorageTag;
687
687
  // Attempt to append version 2 as first entry (expecting gap error)
688
- const result = yield* Effect.either(
688
+ const result = yield* Effect.result(
689
689
  storage.appendWithCheck("gap-check-not-first", makeEntry(2), 2)
690
690
  );
691
691
  yield* assertTrue(
692
- result._tag === "Left",
692
+ result._tag === "Failure",
693
693
  "appendWithCheck should fail when first entry is not version 1"
694
694
  );
695
- if (result._tag === "Left") {
695
+ if (result._tag === "Failure") {
696
696
  yield* assertTrue(
697
- result.left._tag === "WalVersionGapError",
697
+ result.failure._tag === "WalVersionGapError",
698
698
  "Error should be WalVersionGapError"
699
699
  );
700
700
  }
@@ -711,11 +711,11 @@ const tests: StorageTestCase<HotStorageTestError, HotStorageTag>[] = [
711
711
  const storage = yield* HotStorageTag;
712
712
  yield* storage.appendWithCheck("gap-check-duplicate", makeEntry(1), 1);
713
713
  // Attempt to append another version 1
714
- const result = yield* Effect.either(
714
+ const result = yield* Effect.result(
715
715
  storage.appendWithCheck("gap-check-duplicate", makeEntry(1), 1)
716
716
  );
717
717
  yield* assertTrue(
718
- result._tag === "Left",
718
+ result._tag === "Failure",
719
719
  "appendWithCheck should fail when version already exists"
720
720
  );
721
721
  // Verify still only one entry
@@ -774,13 +774,13 @@ const tests: StorageTestCase<HotStorageTestError, HotStorageTag>[] = [
774
774
  // Truncate (to establish empty WAL scenario)
775
775
  yield* storage.truncate("gap-base-detect", 5);
776
776
  // Try to append version 7 with baseVersion=5 (skipping version 6)
777
- const result = yield* Effect.either(
777
+ const result = yield* Effect.result(
778
778
  storage.appendWithCheck("gap-base-detect", makeEntry(7), 7, 5)
779
779
  );
780
- yield* assertTrue(result._tag === "Left", "Should fail when skipping version 6");
781
- if (result._tag === "Left") {
780
+ yield* assertTrue(result._tag === "Failure", "Should fail when skipping version 6");
781
+ if (result._tag === "Failure") {
782
782
  yield* assertTrue(
783
- result.left._tag === "WalVersionGapError",
783
+ result.failure._tag === "WalVersionGapError",
784
784
  "Error should be WalVersionGapError"
785
785
  );
786
786
  }
@@ -1137,11 +1137,11 @@ export const runAll = (): Effect.Effect<
1137
1137
  }> = [];
1138
1138
 
1139
1139
  for (const test of tests) {
1140
- const result = yield* Effect.either(test.run);
1141
- if (result._tag === "Right") {
1140
+ const result = yield* Effect.result(test.run);
1141
+ if (result._tag === "Success") {
1142
1142
  passed.push(test);
1143
1143
  } else {
1144
- failed.push({ test, error: result.left });
1144
+ failed.push({ test, error: result.failure });
1145
1145
  }
1146
1146
  }
1147
1147
 
@@ -713,12 +713,12 @@ export const runAll = <R>(
713
713
  const results: Array<{ name: string; passed: boolean; error?: unknown }> = [];
714
714
 
715
715
  for (const test of tests) {
716
- const result = yield* Effect.either(test.run.pipe(Effect.provide(layer)));
716
+ const result = yield* Effect.result(test.run.pipe(Effect.provide(layer)));
717
717
 
718
- if (result._tag === "Right") {
718
+ if (result._tag === "Success") {
719
719
  results.push({ name: test.name, passed: true });
720
720
  } else {
721
- results.push({ name: test.name, passed: false, error: result.left });
721
+ results.push({ name: test.name, passed: false, error: result.failure });
722
722
  }
723
723
  }
724
724
 
@@ -1,154 +0,0 @@
1
-
2
- > @voidhash/mimic-effect@1.0.0-beta.16 build /home/runner/work/mimic/mimic/packages/mimic-effect
3
- > tsdown
4
-
5
- ℹ tsdown v0.18.2 powered by rolldown v1.0.0-beta.55
6
- ℹ config file: /home/runner/work/mimic/mimic/packages/mimic-effect/tsdown.config.ts
7
- ℹ entry: src/index.ts, src/testing/index.ts
8
- ℹ target: es2017
9
- ℹ tsconfig: tsconfig.json
10
- ℹ Build start
11
- ℹ [CJS] dist/index.cjs  2.28 kB │ gzip: 0.49 kB
12
- ℹ [CJS] dist/testing/index.cjs  0.95 kB │ gzip: 0.22 kB
13
- ℹ [CJS] dist/testing/HotStorageTestSuite.cjs 40.13 kB │ gzip: 5.31 kB
14
- ℹ [CJS] dist/testing/StorageIntegrationTestSuite.cjs 20.68 kB │ gzip: 3.67 kB
15
- ℹ [CJS] dist/testing/ColdStorageTestSuite.cjs 18.14 kB │ gzip: 3.22 kB
16
- ℹ [CJS] dist/MimicClusterServerEngine.cjs 15.39 kB │ gzip: 3.56 kB
17
- ℹ [CJS] dist/DocumentInstance.cjs 10.59 kB │ gzip: 2.75 kB
18
- ℹ [CJS] dist/MimicServer.cjs 10.37 kB │ gzip: 2.84 kB
19
- ℹ [CJS] dist/MimicServerEngine.cjs  8.45 kB │ gzip: 2.21 kB
20
- ℹ [CJS] dist/testing/FailingStorage.cjs  6.91 kB │ gzip: 1.53 kB
21
- ℹ [CJS] dist/Metrics.cjs  4.47 kB │ gzip: 1.08 kB
22
- ℹ [CJS] dist/HotStorage.cjs  4.06 kB │ gzip: 1.31 kB
23
- ℹ [CJS] dist/PresenceManager.cjs  3.81 kB │ gzip: 1.03 kB
24
- ℹ [CJS] dist/Protocol.cjs  3.78 kB │ gzip: 1.14 kB
25
- ℹ [CJS] dist/testing/assertions.cjs  3.74 kB │ gzip: 1.16 kB
26
- ℹ [CJS] dist/MimicAuthService.cjs  2.27 kB │ gzip: 0.88 kB
27
- ℹ [CJS] dist/ColdStorage.cjs  2.09 kB │ gzip: 0.82 kB
28
- ℹ [CJS] dist/Errors.cjs  1.98 kB │ gzip: 0.61 kB
29
- ℹ [CJS] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.cjs  0.95 kB │ gzip: 0.43 kB
30
- ℹ [CJS] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.cjs  0.53 kB │ gzip: 0.29 kB
31
- ℹ [CJS] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.cjs  0.52 kB │ gzip: 0.32 kB
32
- ℹ [CJS] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.cjs  0.40 kB │ gzip: 0.24 kB
33
- ℹ [CJS] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.cjs  0.37 kB │ gzip: 0.23 kB
34
- ℹ [CJS] dist/_virtual/rolldown_runtime.cjs  0.36 kB │ gzip: 0.25 kB
35
- ℹ [CJS] dist/testing/types.cjs  0.34 kB │ gzip: 0.23 kB
36
- ℹ [CJS] 25 files, total: 163.55 kB
37
- ℹ [CJS] dist/Protocol.d.cts.map 1.57 kB │ gzip: 0.70 kB
38
- ℹ [CJS] dist/Types.d.cts.map 1.44 kB │ gzip: 0.66 kB
39
- ℹ [CJS] dist/DocumentInstance.d.cts.map 1.32 kB │ gzip: 0.59 kB
40
- ℹ [CJS] dist/MimicServerEngine.d.cts.map 0.93 kB │ gzip: 0.46 kB
41
- ℹ [CJS] dist/ColdStorage.d.cts.map 0.70 kB │ gzip: 0.37 kB
42
- ℹ [CJS] dist/MimicAuthService.d.cts.map 0.61 kB │ gzip: 0.35 kB
43
- ℹ [CJS] dist/Errors.d.cts.map 0.60 kB │ gzip: 0.32 kB
44
- ℹ [CJS] dist/HotStorage.d.cts.map 0.55 kB │ gzip: 0.32 kB
45
- ℹ [CJS] dist/testing/HotStorageTestSuite.d.cts.map 0.48 kB │ gzip: 0.29 kB
46
- ℹ [CJS] dist/PresenceManager.d.cts.map 0.45 kB │ gzip: 0.27 kB
47
- ℹ [CJS] dist/testing/types.d.cts.map 0.38 kB │ gzip: 0.23 kB
48
- ℹ [CJS] dist/testing/ColdStorageTestSuite.d.cts.map 0.35 kB │ gzip: 0.25 kB
49
- ℹ [CJS] dist/testing/StorageIntegrationTestSuite.d.cts.map 0.32 kB │ gzip: 0.21 kB
50
- ℹ [CJS] dist/testing/FailingStorage.d.cts.map 0.26 kB │ gzip: 0.18 kB
51
- ℹ [CJS] dist/MimicClusterServerEngine.d.cts.map 0.25 kB │ gzip: 0.19 kB
52
- ℹ [CJS] dist/MimicServer.d.cts.map 0.22 kB │ gzip: 0.16 kB
53
- ℹ [CJS] dist/Metrics.d.cts.map 0.12 kB │ gzip: 0.12 kB
54
- ℹ [CJS] dist/index.d.cts 2.14 kB │ gzip: 0.53 kB
55
- ℹ [CJS] dist/testing/index.d.cts 0.91 kB │ gzip: 0.25 kB
56
- ℹ [CJS] dist/Protocol.d.cts 5.84 kB │ gzip: 1.34 kB
57
- ℹ [CJS] dist/Types.d.cts 5.72 kB │ gzip: 1.61 kB
58
- ℹ [CJS] dist/Errors.d.cts 4.86 kB │ gzip: 1.02 kB
59
- ℹ [CJS] dist/MimicServerEngine.d.cts 4.03 kB │ gzip: 1.20 kB
60
- ℹ [CJS] dist/DocumentInstance.d.cts 3.34 kB │ gzip: 1.10 kB
61
- ℹ [CJS] dist/HotStorage.d.cts 3.11 kB │ gzip: 1.23 kB
62
- ℹ [CJS] dist/testing/types.d.cts 2.76 kB │ gzip: 1.15 kB
63
- ℹ [CJS] dist/MimicAuthService.d.cts 2.70 kB │ gzip: 1.04 kB
64
- ℹ [CJS] dist/testing/HotStorageTestSuite.d.cts 1.93 kB │ gzip: 0.57 kB
65
- ℹ [CJS] dist/ColdStorage.d.cts 1.74 kB │ gzip: 0.70 kB
66
- ℹ [CJS] dist/Metrics.d.cts 1.65 kB │ gzip: 0.40 kB
67
- ℹ [CJS] dist/PresenceManager.d.cts 1.60 kB │ gzip: 0.63 kB
68
- ℹ [CJS] dist/testing/ColdStorageTestSuite.d.cts 1.55 kB │ gzip: 0.50 kB
69
- ℹ [CJS] dist/testing/FailingStorage.d.cts 1.44 kB │ gzip: 0.46 kB
70
- ℹ [CJS] dist/testing/StorageIntegrationTestSuite.d.cts 1.43 kB │ gzip: 0.57 kB
71
- ℹ [CJS] dist/MimicClusterServerEngine.d.cts 0.82 kB │ gzip: 0.33 kB
72
- ℹ [CJS] dist/MimicServer.d.cts 0.74 kB │ gzip: 0.31 kB
73
- ℹ [CJS] 36 files, total: 58.86 kB
74
- ✔ Build complete in 6299ms
75
- ℹ [ESM] dist/index.mjs  1.29 kB │ gzip: 0.34 kB
76
- ℹ [ESM] dist/testing/index.mjs  0.60 kB │ gzip: 0.19 kB
77
- ℹ [ESM] dist/testing/HotStorageTestSuite.mjs.map 67.12 kB │ gzip: 9.05 kB
78
- ℹ [ESM] dist/testing/HotStorageTestSuite.mjs 36.09 kB │ gzip: 5.26 kB
79
- ℹ [ESM] dist/testing/StorageIntegrationTestSuite.mjs.map 35.60 kB │ gzip: 6.44 kB
80
- ℹ [ESM] dist/testing/ColdStorageTestSuite.mjs.map 31.92 kB │ gzip: 5.21 kB
81
- ℹ [ESM] dist/MimicClusterServerEngine.mjs.map 29.67 kB │ gzip: 6.99 kB
82
- ℹ [ESM] dist/DocumentInstance.mjs.map 24.33 kB │ gzip: 6.31 kB
83
- ℹ [ESM] dist/MimicServer.mjs.map 21.35 kB │ gzip: 5.64 kB
84
- ℹ [ESM] dist/MimicServerEngine.mjs.map 20.00 kB │ gzip: 5.01 kB
85
- ℹ [ESM] dist/testing/StorageIntegrationTestSuite.mjs 18.49 kB │ gzip: 3.63 kB
86
- ℹ [ESM] dist/testing/ColdStorageTestSuite.mjs 16.50 kB │ gzip: 3.21 kB
87
- ℹ [ESM] dist/testing/FailingStorage.mjs.map 15.60 kB │ gzip: 3.07 kB
88
- ℹ [ESM] dist/MimicClusterServerEngine.mjs 14.26 kB │ gzip: 3.58 kB
89
- ℹ [ESM] dist/HotStorage.mjs.map 11.89 kB │ gzip: 3.36 kB
90
- ℹ [ESM] dist/DocumentInstance.mjs 10.19 kB │ gzip: 2.77 kB
91
- ℹ [ESM] dist/MimicServer.mjs  9.90 kB │ gzip: 2.88 kB
92
- ℹ [ESM] dist/PresenceManager.mjs.map  9.38 kB │ gzip: 2.38 kB
93
- ℹ [ESM] dist/Protocol.mjs.map  9.18 kB │ gzip: 2.15 kB
94
- ℹ [ESM] dist/MimicServerEngine.mjs  7.95 kB │ gzip: 2.23 kB
95
- ℹ [ESM] dist/testing/assertions.mjs.map  7.31 kB │ gzip: 2.01 kB
96
- ℹ [ESM] dist/testing/FailingStorage.mjs  6.49 kB │ gzip: 1.52 kB
97
- ℹ [ESM] dist/Metrics.mjs.map  6.35 kB │ gzip: 1.48 kB
98
- ℹ [ESM] dist/MimicAuthService.mjs.map  6.09 kB │ gzip: 1.85 kB
99
- ℹ [ESM] dist/ColdStorage.mjs.map  5.35 kB │ gzip: 1.64 kB
100
- ℹ [ESM] dist/Errors.mjs.map  4.00 kB │ gzip: 1.05 kB
101
- ℹ [ESM] dist/HotStorage.mjs  3.92 kB │ gzip: 1.32 kB
102
- ℹ [ESM] dist/Metrics.mjs  3.81 kB │ gzip: 1.05 kB
103
- ℹ [ESM] dist/PresenceManager.mjs  3.48 kB │ gzip: 1.04 kB
104
- ℹ [ESM] dist/testing/assertions.mjs  3.46 kB │ gzip: 1.15 kB
105
- ℹ [ESM] dist/Protocol.mjs  3.35 kB │ gzip: 1.06 kB
106
- ℹ [ESM] dist/testing/types.mjs.map  3.22 kB │ gzip: 1.15 kB
107
- ℹ [ESM] dist/MimicAuthService.mjs  2.23 kB │ gzip: 0.88 kB
108
- ℹ [ESM] dist/ColdStorage.mjs  2.01 kB │ gzip: 0.83 kB
109
- ℹ [ESM] dist/Errors.mjs  1.73 kB │ gzip: 0.61 kB
110
- ℹ [ESM] dist/Protocol.d.mts.map  1.57 kB │ gzip: 0.70 kB
111
- ℹ [ESM] dist/Types.d.mts.map  1.44 kB │ gzip: 0.66 kB
112
- ℹ [ESM] dist/DocumentInstance.d.mts.map  1.32 kB │ gzip: 0.59 kB
113
- ℹ [ESM] dist/MimicServerEngine.d.mts.map  0.93 kB │ gzip: 0.46 kB
114
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs  0.90 kB │ gzip: 0.42 kB
115
- ℹ [ESM] dist/ColdStorage.d.mts.map  0.70 kB │ gzip: 0.37 kB
116
- ℹ [ESM] dist/MimicAuthService.d.mts.map  0.61 kB │ gzip: 0.35 kB
117
- ℹ [ESM] dist/Errors.d.mts.map  0.60 kB │ gzip: 0.32 kB
118
- ℹ [ESM] dist/HotStorage.d.mts.map  0.55 kB │ gzip: 0.32 kB
119
- ℹ [ESM] dist/testing/HotStorageTestSuite.d.mts.map  0.48 kB │ gzip: 0.29 kB
120
- ℹ [ESM] dist/_virtual/rolldown_runtime.mjs  0.47 kB │ gzip: 0.30 kB
121
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs  0.47 kB │ gzip: 0.30 kB
122
- ℹ [ESM] dist/PresenceManager.d.mts.map  0.45 kB │ gzip: 0.27 kB
123
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs  0.43 kB │ gzip: 0.24 kB
124
- ℹ [ESM] dist/testing/types.d.mts.map  0.38 kB │ gzip: 0.23 kB
125
- ℹ [ESM] dist/testing/types.mjs  0.35 kB │ gzip: 0.25 kB
126
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs  0.35 kB │ gzip: 0.23 kB
127
- ℹ [ESM] dist/testing/ColdStorageTestSuite.d.mts.map  0.35 kB │ gzip: 0.25 kB
128
- ℹ [ESM] dist/testing/StorageIntegrationTestSuite.d.mts.map  0.32 kB │ gzip: 0.21 kB
129
- ℹ [ESM] dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs  0.30 kB │ gzip: 0.21 kB
130
- ℹ [ESM] dist/testing/FailingStorage.d.mts.map  0.26 kB │ gzip: 0.18 kB
131
- ℹ [ESM] dist/MimicClusterServerEngine.d.mts.map  0.25 kB │ gzip: 0.19 kB
132
- ℹ [ESM] dist/MimicServer.d.mts.map  0.22 kB │ gzip: 0.16 kB
133
- ℹ [ESM] dist/Metrics.d.mts.map  0.12 kB │ gzip: 0.12 kB
134
- ℹ [ESM] dist/index.d.mts  2.14 kB │ gzip: 0.53 kB
135
- ℹ [ESM] dist/testing/index.d.mts  0.91 kB │ gzip: 0.25 kB
136
- ℹ [ESM] dist/Protocol.d.mts  5.84 kB │ gzip: 1.34 kB
137
- ℹ [ESM] dist/Types.d.mts  5.72 kB │ gzip: 1.61 kB
138
- ℹ [ESM] dist/Errors.d.mts  4.86 kB │ gzip: 1.02 kB
139
- ℹ [ESM] dist/MimicServerEngine.d.mts  4.03 kB │ gzip: 1.20 kB
140
- ℹ [ESM] dist/DocumentInstance.d.mts  3.34 kB │ gzip: 1.10 kB
141
- ℹ [ESM] dist/HotStorage.d.mts  3.11 kB │ gzip: 1.23 kB
142
- ℹ [ESM] dist/testing/types.d.mts  2.76 kB │ gzip: 1.15 kB
143
- ℹ [ESM] dist/MimicAuthService.d.mts  2.70 kB │ gzip: 1.04 kB
144
- ℹ [ESM] dist/testing/HotStorageTestSuite.d.mts  1.93 kB │ gzip: 0.57 kB
145
- ℹ [ESM] dist/ColdStorage.d.mts  1.74 kB │ gzip: 0.70 kB
146
- ℹ [ESM] dist/Metrics.d.mts  1.65 kB │ gzip: 0.40 kB
147
- ℹ [ESM] dist/PresenceManager.d.mts  1.60 kB │ gzip: 0.63 kB
148
- ℹ [ESM] dist/testing/ColdStorageTestSuite.d.mts  1.55 kB │ gzip: 0.50 kB
149
- ℹ [ESM] dist/testing/FailingStorage.d.mts  1.44 kB │ gzip: 0.46 kB
150
- ℹ [ESM] dist/testing/StorageIntegrationTestSuite.d.mts  1.43 kB │ gzip: 0.57 kB
151
- ℹ [ESM] dist/MimicClusterServerEngine.d.mts  0.82 kB │ gzip: 0.33 kB
152
- ℹ [ESM] dist/MimicServer.d.mts  0.74 kB │ gzip: 0.31 kB
153
- ℹ [ESM] 78 files, total: 516.25 kB
154
- ✔ Build complete in 6318ms