@voidhash/mimic-effect 1.0.0-beta.1 → 1.0.0-beta.3

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 (111) hide show
  1. package/.turbo/turbo-build.log +102 -60
  2. package/dist/DocumentManager.cjs +109 -39
  3. package/dist/DocumentManager.d.cts +12 -4
  4. package/dist/DocumentManager.d.cts.map +1 -1
  5. package/dist/DocumentManager.d.mts +12 -4
  6. package/dist/DocumentManager.d.mts.map +1 -1
  7. package/dist/DocumentManager.mjs +110 -40
  8. package/dist/DocumentManager.mjs.map +1 -1
  9. package/dist/Errors.cjs +10 -1
  10. package/dist/Errors.d.cts +18 -3
  11. package/dist/Errors.d.cts.map +1 -1
  12. package/dist/Errors.d.mts +18 -3
  13. package/dist/Errors.d.mts.map +1 -1
  14. package/dist/Errors.mjs +9 -1
  15. package/dist/Errors.mjs.map +1 -1
  16. package/dist/HotStorage.cjs +23 -0
  17. package/dist/HotStorage.d.cts +17 -1
  18. package/dist/HotStorage.d.cts.map +1 -1
  19. package/dist/HotStorage.d.mts +17 -1
  20. package/dist/HotStorage.d.mts.map +1 -1
  21. package/dist/HotStorage.mjs +23 -0
  22. package/dist/HotStorage.mjs.map +1 -1
  23. package/dist/Metrics.cjs +23 -1
  24. package/dist/Metrics.d.cts +4 -0
  25. package/dist/Metrics.d.cts.map +1 -1
  26. package/dist/Metrics.d.mts +4 -0
  27. package/dist/Metrics.d.mts.map +1 -1
  28. package/dist/Metrics.mjs +21 -1
  29. package/dist/Metrics.mjs.map +1 -1
  30. package/dist/MimicClusterServerEngine.cjs +114 -36
  31. package/dist/MimicClusterServerEngine.d.cts.map +1 -1
  32. package/dist/MimicClusterServerEngine.d.mts +1 -1
  33. package/dist/MimicClusterServerEngine.d.mts.map +1 -1
  34. package/dist/MimicClusterServerEngine.mjs +119 -41
  35. package/dist/MimicClusterServerEngine.mjs.map +1 -1
  36. package/dist/MimicServer.cjs +1 -1
  37. package/dist/MimicServer.d.cts +1 -1
  38. package/dist/MimicServer.d.cts.map +1 -1
  39. package/dist/MimicServer.d.mts +1 -1
  40. package/dist/MimicServer.d.mts.map +1 -1
  41. package/dist/MimicServer.mjs +1 -1
  42. package/dist/MimicServerEngine.d.cts +7 -4
  43. package/dist/MimicServerEngine.d.cts.map +1 -1
  44. package/dist/MimicServerEngine.d.mts +7 -4
  45. package/dist/MimicServerEngine.d.mts.map +1 -1
  46. package/dist/MimicServerEngine.mjs.map +1 -1
  47. package/dist/index.cjs +3 -2
  48. package/dist/index.d.cts +2 -2
  49. package/dist/index.d.mts +2 -2
  50. package/dist/index.mjs +2 -2
  51. package/dist/testing/ColdStorageTestSuite.cjs +508 -0
  52. package/dist/testing/ColdStorageTestSuite.d.cts +36 -0
  53. package/dist/testing/ColdStorageTestSuite.d.cts.map +1 -0
  54. package/dist/testing/ColdStorageTestSuite.d.mts +36 -0
  55. package/dist/testing/ColdStorageTestSuite.d.mts.map +1 -0
  56. package/dist/testing/ColdStorageTestSuite.mjs +508 -0
  57. package/dist/testing/ColdStorageTestSuite.mjs.map +1 -0
  58. package/dist/testing/FailingStorage.cjs +135 -0
  59. package/dist/testing/FailingStorage.d.cts +43 -0
  60. package/dist/testing/FailingStorage.d.cts.map +1 -0
  61. package/dist/testing/FailingStorage.d.mts +43 -0
  62. package/dist/testing/FailingStorage.d.mts.map +1 -0
  63. package/dist/testing/FailingStorage.mjs +136 -0
  64. package/dist/testing/FailingStorage.mjs.map +1 -0
  65. package/dist/testing/HotStorageTestSuite.cjs +585 -0
  66. package/dist/testing/HotStorageTestSuite.d.cts +40 -0
  67. package/dist/testing/HotStorageTestSuite.d.cts.map +1 -0
  68. package/dist/testing/HotStorageTestSuite.d.mts +40 -0
  69. package/dist/testing/HotStorageTestSuite.d.mts.map +1 -0
  70. package/dist/testing/HotStorageTestSuite.mjs +585 -0
  71. package/dist/testing/HotStorageTestSuite.mjs.map +1 -0
  72. package/dist/testing/StorageIntegrationTestSuite.cjs +349 -0
  73. package/dist/testing/StorageIntegrationTestSuite.d.cts +35 -0
  74. package/dist/testing/StorageIntegrationTestSuite.d.cts.map +1 -0
  75. package/dist/testing/StorageIntegrationTestSuite.d.mts +35 -0
  76. package/dist/testing/StorageIntegrationTestSuite.d.mts.map +1 -0
  77. package/dist/testing/StorageIntegrationTestSuite.mjs +349 -0
  78. package/dist/testing/StorageIntegrationTestSuite.mjs.map +1 -0
  79. package/dist/testing/assertions.cjs +114 -0
  80. package/dist/testing/assertions.mjs +109 -0
  81. package/dist/testing/assertions.mjs.map +1 -0
  82. package/dist/testing/index.cjs +14 -0
  83. package/dist/testing/index.d.cts +6 -0
  84. package/dist/testing/index.d.mts +6 -0
  85. package/dist/testing/index.mjs +7 -0
  86. package/dist/testing/types.cjs +15 -0
  87. package/dist/testing/types.d.cts +90 -0
  88. package/dist/testing/types.d.cts.map +1 -0
  89. package/dist/testing/types.d.mts +90 -0
  90. package/dist/testing/types.d.mts.map +1 -0
  91. package/dist/testing/types.mjs +16 -0
  92. package/dist/testing/types.mjs.map +1 -0
  93. package/package.json +8 -3
  94. package/src/DocumentManager.ts +195 -87
  95. package/src/Errors.ts +15 -1
  96. package/src/HotStorage.ts +75 -1
  97. package/src/Metrics.ts +24 -0
  98. package/src/MimicClusterServerEngine.ts +178 -56
  99. package/src/MimicServerEngine.ts +7 -3
  100. package/src/index.ts +2 -31
  101. package/src/testing/ColdStorageTestSuite.ts +589 -0
  102. package/src/testing/FailingStorage.ts +286 -0
  103. package/src/testing/HotStorageTestSuite.ts +762 -0
  104. package/src/testing/StorageIntegrationTestSuite.ts +504 -0
  105. package/src/testing/assertions.ts +181 -0
  106. package/src/testing/index.ts +83 -0
  107. package/src/testing/types.ts +100 -0
  108. package/tests/ColdStorage.test.ts +8 -120
  109. package/tests/HotStorage.test.ts +7 -126
  110. package/tests/StorageIntegration.test.ts +259 -0
  111. package/tsdown.config.ts +1 -1
@@ -0,0 +1,7 @@
1
+ import { TestError } from "./types.mjs";
2
+ import { Categories, ColdStorageTestSuite } from "./ColdStorageTestSuite.mjs";
3
+ import { Categories as Categories$1, HotStorageTestSuite } from "./HotStorageTestSuite.mjs";
4
+ import { Categories as Categories$2, StorageIntegrationTestSuite } from "./StorageIntegrationTestSuite.mjs";
5
+ import { FailingStorage } from "./FailingStorage.mjs";
6
+
7
+ export { Categories as ColdStorageCategories, ColdStorageTestSuite, FailingStorage, Categories$1 as HotStorageCategories, HotStorageTestSuite, Categories$2 as IntegrationCategories, StorageIntegrationTestSuite, TestError };
@@ -0,0 +1,15 @@
1
+ let effect = require("effect");
2
+
3
+ //#region src/testing/types.ts
4
+ /**
5
+ * @voidhash/mimic-effect/testing - Core Types
6
+ *
7
+ * Types used by the storage adapter test utilities.
8
+ */
9
+ /**
10
+ * Error thrown when a test assertion fails.
11
+ */
12
+ var TestError = class extends effect.Data.TaggedError("TestError") {};
13
+
14
+ //#endregion
15
+ exports.TestError = TestError;
@@ -0,0 +1,90 @@
1
+ import { Effect } from "effect";
2
+ import * as effect_Types7 from "effect/Types";
3
+ import * as effect_Cause7 from "effect/Cause";
4
+
5
+ //#region src/testing/types.d.ts
6
+
7
+ declare const TestError_base: new <A extends Record<string, any> = {}>(args: effect_Types7.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause7.YieldableError & {
8
+ readonly _tag: "TestError";
9
+ } & Readonly<A>;
10
+ /**
11
+ * Error thrown when a test assertion fails.
12
+ */
13
+ declare class TestError extends TestError_base<{
14
+ /** Description of what failed */
15
+ readonly message: string;
16
+ /** Expected value (if applicable) */
17
+ readonly expected?: unknown;
18
+ /** Actual value received (if applicable) */
19
+ readonly actual?: unknown;
20
+ }> {}
21
+ /**
22
+ * A single storage adapter test case.
23
+ *
24
+ * Test cases are framework-agnostic Effects that can be run with any test runner.
25
+ *
26
+ * @template E - The error type for this test case
27
+ * @template R - The Effect requirements (e.g., ColdStorageTag or HotStorageTag)
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Using with vitest
32
+ * const tests = ColdStorageTestSuite.makeTests();
33
+ *
34
+ * describe("MyAdapter", () => {
35
+ * for (const test of tests) {
36
+ * it(test.name, () =>
37
+ * Effect.runPromise(test.run.pipe(Effect.provide(myAdapterLayer)))
38
+ * );
39
+ * }
40
+ * });
41
+ * ```
42
+ */
43
+ interface StorageTestCase<E, R> {
44
+ /** Human-readable test name */
45
+ readonly name: string;
46
+ /** Category for grouping (e.g., "Basic Operations", "Data Integrity") */
47
+ readonly category: string;
48
+ /** The test as an Effect - succeeds if test passes, fails with error if not */
49
+ readonly run: Effect.Effect<void, E, R>;
50
+ }
51
+ /**
52
+ * Result of a failed test.
53
+ */
54
+ interface FailedTest<E, R> {
55
+ /** The test case that failed */
56
+ readonly test: StorageTestCase<E, R>;
57
+ /** The error that caused the failure */
58
+ readonly error: E;
59
+ }
60
+ /**
61
+ * Results from running all tests in a suite.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * const results = await Effect.runPromise(
66
+ * ColdStorageTestSuite.runAll().pipe(Effect.provide(myAdapterLayer))
67
+ * );
68
+ *
69
+ * console.log(`Passed: ${results.passCount}/${results.total}`);
70
+ *
71
+ * for (const { test, error } of results.failed) {
72
+ * console.error(`FAIL: ${test.name} - ${error._tag}`);
73
+ * }
74
+ * ```
75
+ */
76
+ interface TestResults<E, R> {
77
+ /** Tests that passed */
78
+ readonly passed: StorageTestCase<E, R>[];
79
+ /** Tests that failed with their errors */
80
+ readonly failed: FailedTest<E, R>[];
81
+ /** Total number of tests run */
82
+ readonly total: number;
83
+ /** Number of tests that passed */
84
+ readonly passCount: number;
85
+ /** Number of tests that failed */
86
+ readonly failCount: number;
87
+ }
88
+ //#endregion
89
+ export { FailedTest, StorageTestCase, TestError, TestResults };
90
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/testing/types.ts"],"sourcesContent":[],"mappings":";;;;;;cAKsC;;;;;;cASzB,SAAA,SAAkB;;;;;;EAAlB,SAAA,MAAU,CAAA,EAAA,OAAQ;AAmC/B,CAAA,CAAA,CAAA;;;;AAgBA;;;;;;AAuBA;;;;;;;;;;;;;UAvCiB;;;;;;gBAMD,MAAA,CAAO,aAAa,GAAG;;;;;UAUtB;;iBAEA,gBAAgB,GAAG;;kBAElB;;;;;;;;;;;;;;;;;;UAmBD;;mBAEE,gBAAgB,GAAG;;mBAEnB,WAAW,GAAG"}
@@ -0,0 +1,90 @@
1
+ import { Effect } from "effect";
2
+ import * as effect_Types0 from "effect/Types";
3
+ import * as effect_Cause0 from "effect/Cause";
4
+
5
+ //#region src/testing/types.d.ts
6
+
7
+ declare const TestError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
8
+ readonly _tag: "TestError";
9
+ } & Readonly<A>;
10
+ /**
11
+ * Error thrown when a test assertion fails.
12
+ */
13
+ declare class TestError extends TestError_base<{
14
+ /** Description of what failed */
15
+ readonly message: string;
16
+ /** Expected value (if applicable) */
17
+ readonly expected?: unknown;
18
+ /** Actual value received (if applicable) */
19
+ readonly actual?: unknown;
20
+ }> {}
21
+ /**
22
+ * A single storage adapter test case.
23
+ *
24
+ * Test cases are framework-agnostic Effects that can be run with any test runner.
25
+ *
26
+ * @template E - The error type for this test case
27
+ * @template R - The Effect requirements (e.g., ColdStorageTag or HotStorageTag)
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Using with vitest
32
+ * const tests = ColdStorageTestSuite.makeTests();
33
+ *
34
+ * describe("MyAdapter", () => {
35
+ * for (const test of tests) {
36
+ * it(test.name, () =>
37
+ * Effect.runPromise(test.run.pipe(Effect.provide(myAdapterLayer)))
38
+ * );
39
+ * }
40
+ * });
41
+ * ```
42
+ */
43
+ interface StorageTestCase<E, R> {
44
+ /** Human-readable test name */
45
+ readonly name: string;
46
+ /** Category for grouping (e.g., "Basic Operations", "Data Integrity") */
47
+ readonly category: string;
48
+ /** The test as an Effect - succeeds if test passes, fails with error if not */
49
+ readonly run: Effect.Effect<void, E, R>;
50
+ }
51
+ /**
52
+ * Result of a failed test.
53
+ */
54
+ interface FailedTest<E, R> {
55
+ /** The test case that failed */
56
+ readonly test: StorageTestCase<E, R>;
57
+ /** The error that caused the failure */
58
+ readonly error: E;
59
+ }
60
+ /**
61
+ * Results from running all tests in a suite.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * const results = await Effect.runPromise(
66
+ * ColdStorageTestSuite.runAll().pipe(Effect.provide(myAdapterLayer))
67
+ * );
68
+ *
69
+ * console.log(`Passed: ${results.passCount}/${results.total}`);
70
+ *
71
+ * for (const { test, error } of results.failed) {
72
+ * console.error(`FAIL: ${test.name} - ${error._tag}`);
73
+ * }
74
+ * ```
75
+ */
76
+ interface TestResults<E, R> {
77
+ /** Tests that passed */
78
+ readonly passed: StorageTestCase<E, R>[];
79
+ /** Tests that failed with their errors */
80
+ readonly failed: FailedTest<E, R>[];
81
+ /** Total number of tests run */
82
+ readonly total: number;
83
+ /** Number of tests that passed */
84
+ readonly passCount: number;
85
+ /** Number of tests that failed */
86
+ readonly failCount: number;
87
+ }
88
+ //#endregion
89
+ export { FailedTest, StorageTestCase, TestError, TestResults };
90
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/testing/types.ts"],"sourcesContent":[],"mappings":";;;;;;cAKsC;;;;;;cASzB,SAAA,SAAkB;;;;;;EAAlB,SAAA,MAAU,CAAA,EAAA,OAAQ;AAmC/B,CAAA,CAAA,CAAA;;;;AAgBA;;;;;;AAuBA;;;;;;;;;;;;;UAvCiB;;;;;;gBAMD,MAAA,CAAO,aAAa,GAAG;;;;;UAUtB;;iBAEA,gBAAgB,GAAG;;kBAElB;;;;;;;;;;;;;;;;;;UAmBD;;mBAEE,gBAAgB,GAAG;;mBAEnB,WAAW,GAAG"}
@@ -0,0 +1,16 @@
1
+ import { Data } from "effect";
2
+
3
+ //#region src/testing/types.ts
4
+ /**
5
+ * @voidhash/mimic-effect/testing - Core Types
6
+ *
7
+ * Types used by the storage adapter test utilities.
8
+ */
9
+ /**
10
+ * Error thrown when a test assertion fails.
11
+ */
12
+ var TestError = class extends Data.TaggedError("TestError") {};
13
+
14
+ //#endregion
15
+ export { TestError };
16
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","names":[],"sources":["../../src/testing/types.ts"],"sourcesContent":["/**\n * @voidhash/mimic-effect/testing - Core Types\n *\n * Types used by the storage adapter test utilities.\n */\nimport { Data, Effect } from \"effect\";\n\n// =============================================================================\n// Error Types\n// =============================================================================\n\n/**\n * Error thrown when a test assertion fails.\n */\nexport class TestError extends Data.TaggedError(\"TestError\")<{\n /** Description of what failed */\n readonly message: string;\n /** Expected value (if applicable) */\n readonly expected?: unknown;\n /** Actual value received (if applicable) */\n readonly actual?: unknown;\n}> {}\n\n// =============================================================================\n// Test Case Types\n// =============================================================================\n\n/**\n * A single storage adapter test case.\n *\n * Test cases are framework-agnostic Effects that can be run with any test runner.\n *\n * @template E - The error type for this test case\n * @template R - The Effect requirements (e.g., ColdStorageTag or HotStorageTag)\n *\n * @example\n * ```typescript\n * // Using with vitest\n * const tests = ColdStorageTestSuite.makeTests();\n *\n * describe(\"MyAdapter\", () => {\n * for (const test of tests) {\n * it(test.name, () =>\n * Effect.runPromise(test.run.pipe(Effect.provide(myAdapterLayer)))\n * );\n * }\n * });\n * ```\n */\nexport interface StorageTestCase<E, R> {\n /** Human-readable test name */\n readonly name: string;\n /** Category for grouping (e.g., \"Basic Operations\", \"Data Integrity\") */\n readonly category: string;\n /** The test as an Effect - succeeds if test passes, fails with error if not */\n readonly run: Effect.Effect<void, E, R>;\n}\n\n// =============================================================================\n// Test Results Types\n// =============================================================================\n\n/**\n * Result of a failed test.\n */\nexport interface FailedTest<E, R> {\n /** The test case that failed */\n readonly test: StorageTestCase<E, R>;\n /** The error that caused the failure */\n readonly error: E;\n}\n\n/**\n * Results from running all tests in a suite.\n *\n * @example\n * ```typescript\n * const results = await Effect.runPromise(\n * ColdStorageTestSuite.runAll().pipe(Effect.provide(myAdapterLayer))\n * );\n *\n * console.log(`Passed: ${results.passCount}/${results.total}`);\n *\n * for (const { test, error } of results.failed) {\n * console.error(`FAIL: ${test.name} - ${error._tag}`);\n * }\n * ```\n */\nexport interface TestResults<E, R> {\n /** Tests that passed */\n readonly passed: StorageTestCase<E, R>[];\n /** Tests that failed with their errors */\n readonly failed: FailedTest<E, R>[];\n /** Total number of tests run */\n readonly total: number;\n /** Number of tests that passed */\n readonly passCount: number;\n /** Number of tests that failed */\n readonly failCount: number;\n}\n"],"mappings":";;;;;;;;;;;AAcA,IAAa,YAAb,cAA+B,KAAK,YAAY,YAAY,CAOzD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidhash/mimic-effect",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.3",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,6 +13,11 @@
13
13
  "types": "./dist/index.d.mts",
14
14
  "import": "./dist/index.mjs",
15
15
  "require": "./dist/index.cjs"
16
+ },
17
+ "./testing": {
18
+ "types": "./dist/testing/index.d.mts",
19
+ "import": "./dist/testing/index.mjs",
20
+ "require": "./dist/testing/index.cjs"
16
21
  }
17
22
  },
18
23
  "devDependencies": {
@@ -21,14 +26,14 @@
21
26
  "typescript": "5.8.3",
22
27
  "vite-tsconfig-paths": "^5.1.4",
23
28
  "vitest": "^3.2.4",
24
- "@voidhash/tsconfig": "1.0.0-beta.1"
29
+ "@voidhash/tsconfig": "1.0.0-beta.3"
25
30
  },
26
31
  "peerDependencies": {
27
32
  "@effect/platform": "^0.93.8",
28
33
  "@effect/cluster": "^0.55.0",
29
34
  "@effect/rpc": "^0.72.2",
30
35
  "effect": "^3.19.12",
31
- "@voidhash/mimic": "1.0.0-beta.1"
36
+ "@voidhash/mimic": "1.0.0-beta.3"
32
37
  },
33
38
  "peerDependenciesMeta": {
34
39
  "@effect/cluster": {