@evolu/common 8.0.0-next.4 → 8.0.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 (237) hide show
  1. package/dist/src/Array.d.ts +279 -173
  2. package/dist/src/Array.d.ts.map +1 -1
  3. package/dist/src/Array.js +105 -101
  4. package/dist/src/Assert.d.ts +44 -44
  5. package/dist/src/Assert.d.ts.map +1 -1
  6. package/dist/src/Assert.js +44 -32
  7. package/dist/src/BigInt.d.ts +6 -3
  8. package/dist/src/BigInt.d.ts.map +1 -1
  9. package/dist/src/BigInt.js +5 -2
  10. package/dist/src/Brand.d.ts +27 -40
  11. package/dist/src/Brand.d.ts.map +1 -1
  12. package/dist/src/Buffer.d.ts +27 -11
  13. package/dist/src/Buffer.d.ts.map +1 -1
  14. package/dist/src/Cache.d.ts +9 -4
  15. package/dist/src/Cache.d.ts.map +1 -1
  16. package/dist/src/Cache.js +8 -3
  17. package/dist/src/Callbacks.d.ts +30 -19
  18. package/dist/src/Callbacks.d.ts.map +1 -1
  19. package/dist/src/Console.d.ts +145 -66
  20. package/dist/src/Console.d.ts.map +1 -1
  21. package/dist/src/Console.js +91 -43
  22. package/dist/src/Crypto.d.ts +85 -42
  23. package/dist/src/Crypto.d.ts.map +1 -1
  24. package/dist/src/Crypto.js +44 -20
  25. package/dist/src/Eq.d.ts +87 -21
  26. package/dist/src/Eq.d.ts.map +1 -1
  27. package/dist/src/Eq.js +67 -19
  28. package/dist/src/Error.d.ts +5 -3
  29. package/dist/src/Error.d.ts.map +1 -1
  30. package/dist/src/Error.js +16 -0
  31. package/dist/src/Function.d.ts +119 -58
  32. package/dist/src/Function.d.ts.map +1 -1
  33. package/dist/src/Function.js +86 -43
  34. package/dist/src/Http.d.ts +394 -0
  35. package/dist/src/Http.d.ts.map +1 -0
  36. package/dist/src/Http.js +102 -0
  37. package/dist/src/Identicon.d.ts +16 -7
  38. package/dist/src/Identicon.d.ts.map +1 -1
  39. package/dist/src/Identicon.js +14 -5
  40. package/dist/src/LeakDetector.d.ts +88 -0
  41. package/dist/src/LeakDetector.d.ts.map +1 -0
  42. package/dist/src/LeakDetector.js +86 -0
  43. package/dist/src/LockManager.d.ts +18 -9
  44. package/dist/src/LockManager.d.ts.map +1 -1
  45. package/dist/src/LockManager.js +7 -8
  46. package/dist/src/Lookup.d.ts +43 -13
  47. package/dist/src/Lookup.d.ts.map +1 -1
  48. package/dist/src/Lookup.js +28 -8
  49. package/dist/src/Microtask.d.ts +1 -1
  50. package/dist/src/Microtask.d.ts.map +1 -1
  51. package/dist/src/Microtask.js +3 -7
  52. package/dist/src/Number.d.ts +49 -13
  53. package/dist/src/Number.d.ts.map +1 -1
  54. package/dist/src/Number.js +34 -5
  55. package/dist/src/Object.d.ts +160 -40
  56. package/dist/src/Object.d.ts.map +1 -1
  57. package/dist/src/Object.js +92 -46
  58. package/dist/src/Option.d.ts +10 -7
  59. package/dist/src/Option.d.ts.map +1 -1
  60. package/dist/src/Option.js +9 -6
  61. package/dist/src/Order.d.ts +21 -21
  62. package/dist/src/Order.d.ts.map +1 -1
  63. package/dist/src/Order.js +18 -21
  64. package/dist/src/Platform.d.ts +31 -0
  65. package/dist/src/Platform.d.ts.map +1 -1
  66. package/dist/src/Platform.js +98 -0
  67. package/dist/src/Random.d.ts +32 -17
  68. package/dist/src/Random.d.ts.map +1 -1
  69. package/dist/src/Random.js +12 -8
  70. package/dist/src/Redacted.d.ts +43 -29
  71. package/dist/src/Redacted.d.ts.map +1 -1
  72. package/dist/src/Redacted.js +14 -3
  73. package/dist/src/Ref.d.ts +11 -3
  74. package/dist/src/Ref.d.ts.map +1 -1
  75. package/dist/src/Ref.js +2 -2
  76. package/dist/src/RefCount.d.ts +2 -6
  77. package/dist/src/RefCount.d.ts.map +1 -1
  78. package/dist/src/RefCount.js +33 -90
  79. package/dist/src/Relation.d.ts +70 -5
  80. package/dist/src/Relation.d.ts.map +1 -1
  81. package/dist/src/Relation.js +77 -2
  82. package/dist/src/Resource.d.ts +590 -155
  83. package/dist/src/Resource.d.ts.map +1 -1
  84. package/dist/src/Resource.js +592 -343
  85. package/dist/src/Result.d.ts +838 -191
  86. package/dist/src/Result.d.ts.map +1 -1
  87. package/dist/src/Result.js +163 -102
  88. package/dist/src/Schedule.d.ts +684 -231
  89. package/dist/src/Schedule.d.ts.map +1 -1
  90. package/dist/src/Schedule.js +766 -295
  91. package/dist/src/Set.d.ts +89 -40
  92. package/dist/src/Set.d.ts.map +1 -1
  93. package/dist/src/Set.js +50 -29
  94. package/dist/src/Sqlite.d.ts +29 -72
  95. package/dist/src/Sqlite.d.ts.map +1 -1
  96. package/dist/src/Sqlite.js +41 -46
  97. package/dist/src/StackTrace.d.ts +40 -0
  98. package/dist/src/StackTrace.d.ts.map +1 -0
  99. package/dist/src/StackTrace.js +140 -0
  100. package/dist/src/Store.d.ts +5 -4
  101. package/dist/src/Store.d.ts.map +1 -1
  102. package/dist/src/Store.js +5 -4
  103. package/dist/src/String.d.ts +7 -1
  104. package/dist/src/String.d.ts.map +1 -1
  105. package/dist/src/String.js +20 -7
  106. package/dist/src/Task.d.ts +3572 -1770
  107. package/dist/src/Task.d.ts.map +1 -1
  108. package/dist/src/Task.js +1879 -1274
  109. package/dist/src/Test.d.ts +17 -125
  110. package/dist/src/Test.d.ts.map +1 -1
  111. package/dist/src/Test.js +17 -68
  112. package/dist/src/Time.d.ts +108 -49
  113. package/dist/src/Time.d.ts.map +1 -1
  114. package/dist/src/Time.js +172 -73
  115. package/dist/src/Type.d.ts +3542 -1926
  116. package/dist/src/Type.d.ts.map +1 -1
  117. package/dist/src/Type.js +3070 -1784
  118. package/dist/src/Types.d.ts +200 -108
  119. package/dist/src/Types.d.ts.map +1 -1
  120. package/dist/src/Types.js +39 -8
  121. package/dist/src/WebSocket.d.ts +48 -23
  122. package/dist/src/WebSocket.d.ts.map +1 -1
  123. package/dist/src/WebSocket.js +15 -6
  124. package/dist/src/Worker.d.ts +94 -36
  125. package/dist/src/Worker.d.ts.map +1 -1
  126. package/dist/src/Worker.js +58 -24
  127. package/dist/src/index.d.ts +55 -52
  128. package/dist/src/index.d.ts.map +1 -1
  129. package/dist/src/index.js +3 -1
  130. package/dist/src/intl/cs.d.ts +94 -0
  131. package/dist/src/intl/cs.d.ts.map +1 -0
  132. package/dist/src/intl/cs.js +220 -0
  133. package/dist/src/intl/index.d.ts +7 -0
  134. package/dist/src/intl/index.d.ts.map +1 -0
  135. package/dist/src/intl/index.js +6 -0
  136. package/dist/src/local-first/Db.d.ts +12 -8
  137. package/dist/src/local-first/Db.d.ts.map +1 -1
  138. package/dist/src/local-first/Db.js +109 -132
  139. package/dist/src/local-first/Error.d.ts +4 -4
  140. package/dist/src/local-first/Evolu.d.ts +338 -92
  141. package/dist/src/local-first/Evolu.d.ts.map +1 -1
  142. package/dist/src/local-first/Evolu.js +47 -55
  143. package/dist/src/local-first/LocalAuth.d.ts +4 -4
  144. package/dist/src/local-first/LocalAuth.d.ts.map +1 -1
  145. package/dist/src/local-first/Owner.d.ts +61 -24
  146. package/dist/src/local-first/Owner.d.ts.map +1 -1
  147. package/dist/src/local-first/Owner.js +45 -8
  148. package/dist/src/local-first/Protocol.d.ts +44 -31
  149. package/dist/src/local-first/Protocol.d.ts.map +1 -1
  150. package/dist/src/local-first/Protocol.js +36 -13
  151. package/dist/src/local-first/Query.d.ts +147 -62
  152. package/dist/src/local-first/Query.d.ts.map +1 -1
  153. package/dist/src/local-first/Query.js +112 -58
  154. package/dist/src/local-first/Relay.d.ts +44 -14
  155. package/dist/src/local-first/Relay.d.ts.map +1 -1
  156. package/dist/src/local-first/Schema.d.ts +92 -41
  157. package/dist/src/local-first/Schema.d.ts.map +1 -1
  158. package/dist/src/local-first/Schema.js +25 -8
  159. package/dist/src/local-first/Shared.d.ts +23 -21
  160. package/dist/src/local-first/Shared.d.ts.map +1 -1
  161. package/dist/src/local-first/Shared.js +100 -57
  162. package/dist/src/local-first/Storage.d.ts +53 -32
  163. package/dist/src/local-first/Storage.d.ts.map +1 -1
  164. package/dist/src/local-first/Storage.js +194 -234
  165. package/dist/src/local-first/Timestamp.d.ts +21 -21
  166. package/dist/src/local-first/Timestamp.d.ts.map +1 -1
  167. package/dist/src/local-first/Timestamp.js +2 -2
  168. package/dist/src/local-first/index.d.ts +11 -11
  169. package/package.json +14 -13
  170. package/src/Array.ts +306 -205
  171. package/src/Assert.ts +54 -69
  172. package/src/BigInt.ts +6 -3
  173. package/src/Brand.ts +27 -40
  174. package/src/Buffer.ts +28 -12
  175. package/src/Cache.ts +9 -4
  176. package/src/Callbacks.ts +30 -19
  177. package/src/Console.ts +156 -84
  178. package/src/Crypto.ts +83 -41
  179. package/src/Eq.ts +95 -22
  180. package/src/Error.ts +8 -4
  181. package/src/Function.ts +167 -59
  182. package/src/Http.ts +549 -0
  183. package/src/Identicon.ts +16 -7
  184. package/src/LeakDetector.ts +182 -0
  185. package/src/LockManager.ts +43 -39
  186. package/src/Lookup.ts +62 -28
  187. package/src/Microtask.ts +19 -23
  188. package/src/Number.ts +64 -12
  189. package/src/Object.ts +173 -49
  190. package/src/Option.ts +10 -7
  191. package/src/Order.ts +23 -21
  192. package/src/Platform.ts +136 -0
  193. package/src/Polyfills.ts +6 -12
  194. package/src/Random.ts +32 -19
  195. package/src/Redacted.ts +44 -30
  196. package/src/Ref.ts +14 -6
  197. package/src/RefCount.ts +38 -80
  198. package/src/Relation.ts +202 -10
  199. package/src/Resource.ts +1199 -591
  200. package/src/Result.ts +930 -271
  201. package/src/Schedule.ts +859 -343
  202. package/src/Set.ts +89 -40
  203. package/src/Sqlite.ts +144 -138
  204. package/src/StackTrace.ts +230 -0
  205. package/src/Store.ts +8 -7
  206. package/src/String.ts +22 -5
  207. package/src/Task.ts +5101 -2832
  208. package/src/Test.ts +20 -168
  209. package/src/Time.ts +293 -90
  210. package/src/Type.ts +10034 -4117
  211. package/src/Types.ts +227 -110
  212. package/src/WebSocket.ts +64 -36
  213. package/src/Worker.ts +180 -72
  214. package/src/index.ts +55 -52
  215. package/src/intl/cs.ts +388 -0
  216. package/src/intl/index.ts +7 -0
  217. package/src/local-first/Db.ts +152 -179
  218. package/src/local-first/Error.ts +4 -4
  219. package/src/local-first/Evolu.ts +495 -250
  220. package/src/local-first/LocalAuth.ts +6 -12
  221. package/src/local-first/Owner.ts +58 -21
  222. package/src/local-first/Protocol.ts +49 -31
  223. package/src/local-first/Query.ts +146 -61
  224. package/src/local-first/Relay.ts +51 -21
  225. package/src/local-first/Schema.ts +109 -51
  226. package/src/local-first/Shared.ts +266 -226
  227. package/src/local-first/Storage.ts +266 -264
  228. package/src/local-first/Timestamp.ts +25 -18
  229. package/src/local-first/index.ts +11 -11
  230. package/dist/src/Skiplist.d.ts +0 -28
  231. package/dist/src/Skiplist.d.ts.map +0 -1
  232. package/dist/src/Skiplist.js +0 -64
  233. package/dist/src/Tracer.d.ts +0 -48
  234. package/dist/src/Tracer.d.ts.map +0 -1
  235. package/dist/src/Tracer.js +0 -6
  236. package/src/Skiplist.ts +0 -108
  237. package/src/Tracer.ts +0 -54
@@ -1,127 +1,14 @@
1
1
  /**
2
- * Test utilities for deterministic testing.
2
+ * Cross-module test utilities for deterministic testing.
3
+ *
4
+ * Test helpers are usually colocated with the code they test. Helpers that
5
+ * cannot be colocated because they would create dependency cycles belong here.
3
6
  *
4
7
  * @module
5
8
  */
6
- import type { Brand } from "./Brand.js";
7
- import { type TestConsoleDep } from "./Console.js";
8
- import { type RandomLibDep } from "./Random.js";
9
- import { type Run, type RunDeps } from "./Task.js";
10
- import { type Duration, type TestTimeDep } from "./Time.js";
11
- import { type Id } from "./Type.js";
9
+ import type { Brand } from "./Brand.ts";
10
+ import { type Id } from "./Type.ts";
12
11
  export type TestCreateId = <B extends string = never>() => [B] extends [never] ? Id : Id & Brand<B>;
13
- /**
14
- * Cheap deterministic baseline deps for tests.
15
- *
16
- * `TestDeps` includes test-friendly replacements for {@link RunDeps}, such as
17
- * {@link TestConsole} and {@link TestTime}, plus extra helpers commonly useful in
18
- * tests and fixtures, such as `randomLib` (only that for now).
19
- *
20
- * Use it directly for synchronous test setup, fixtures, and helpers. It is also
21
- * intentionally the base deps used by {@link testCreateRun}.
22
- */
23
- export type TestDeps = Omit<RunDeps, "console" | "time"> & TestConsoleDep & TestTimeDep & RandomLibDep;
24
- /**
25
- * Creates deterministic {@link TestDeps}.
26
- *
27
- * Each call creates fresh instances, so tests don't share state.
28
- *
29
- * Includes these deps:
30
- *
31
- * - `console`: {@link TestConsole}
32
- * - `random`: {@link Random}
33
- * - `randomLib`: seeded `random` package instance
34
- * - `randomBytes`: {@link RandomBytes}
35
- * - `time`: {@link TestTime}
36
- *
37
- * Use this for synchronous code that accepts deps directly. For tests that run
38
- * Tasks, use {@link testCreateRun}.
39
- *
40
- * ### Example
41
- *
42
- * ```ts
43
- * test("Callbacks with no argument", () => {
44
- * const deps = testCreateDeps();
45
- * const callbacks = createCallbacks(deps);
46
- *
47
- * let called = false;
48
- * const id = callbacks.register(() => {
49
- * called = true;
50
- * });
51
- *
52
- * callbacks.execute(id);
53
- * expect(called).toBe(true);
54
- * });
55
- * ```
56
- */
57
- export declare const testCreateDeps: (options?: {
58
- readonly seed?: string;
59
- }) => TestDeps;
60
- /**
61
- * Creates a test {@link Run} with deterministic default deps or optional custom
62
- * deps.
63
- *
64
- * Use this as the default composition root in tests. Each call creates fresh
65
- * {@link TestDeps} via {@link testCreateDeps}, then merges any provided custom
66
- * deps.
67
- *
68
- * ### Example
69
- *
70
- * ```ts
71
- * // Built-in TestTime
72
- * await using run = testCreateRun();
73
- * const fiber = run(sleep("1s"));
74
- * run.deps.time.advance("1s");
75
- * await fiber;
76
- *
77
- * // For a single test, create the dependency using the Run.
78
- * await using run = testCreateRun();
79
- * await using foo = await run.orThrow(createFoo());
80
- * const runWithFoo = run.addDeps({ foo });
81
- *
82
- * expect(runWithFoo.deps.foo).toBe(foo);
83
- *
84
- * // If multiple tests need the same setup, create a disposable helper.
85
- * // Then `await using setup` disposes everything the helper owns.
86
- * const setupFoo = async () => {
87
- * await using disposer = new AsyncDisposableStack();
88
- * const run = disposer.use(testCreateRun());
89
- * const foo = disposer.use(await run.orThrow(createFoo()));
90
- * const disposables = disposer.move();
91
- *
92
- * // Return whatever the tests need: a Run with the dependency,
93
- * // the dependency itself, or both.
94
- * return {
95
- * run: run.addDeps({ foo }),
96
- * foo,
97
- * [Symbol.asyncDispose]: () => moved.disposeAsync(),
98
- * };
99
- * };
100
- *
101
- * await using setup = await setupFoo();
102
- * const { run, foo } = setup;
103
- * expect(run.deps.foo).toBe(foo);
104
- * ```
105
- *
106
- * Name reusable setup helpers after what they set up:
107
- *
108
- * - `setupFoo` for reusable test setup for `Foo`
109
- * - `testSetupFoo` when a library module exports the helper as part of its public
110
- * test API, e.g. `testSetupSqlite`.
111
- */
112
- export declare function testCreateRun(): Run<TestDeps>;
113
- /** With custom dependencies merged into {@link TestDeps}. */
114
- export declare function testCreateRun<D>(deps: D): Run<TestDeps & D>;
115
- /**
116
- * Returns a Promise that resolves after a macrotask delay.
117
- *
118
- * Use this to model a real async boundary in a test double, for example an
119
- * async disposer that should not complete in the same turn.
120
- *
121
- * Avoid using it to coordinate assertions. Waiting for a macrotask tends to
122
- * make tests indirect and brittle.
123
- */
124
- export declare const testWaitForMacrotask: (duration?: Duration) => Promise<void>;
125
12
  /**
126
13
  * Creates a deterministic `createId` helper.
127
14
  *
@@ -137,13 +24,18 @@ export declare const testWaitForMacrotask: (duration?: Duration) => Promise<void
137
24
  * ### Example
138
25
  *
139
26
  * ```ts
140
- * test("creates stable ids", () => {
141
- * const createId = testCreateId();
27
+ * import { testCreateId, type Brand, type Id } from "@evolu/common";
28
+ *
29
+ * const createId = testCreateId();
30
+ *
31
+ * const callbackId = createId();
32
+ * const secondCallbackId = createId();
33
+ * const todoId = createId<"Todo">();
34
+ * expect(new Set([callbackId, secondCallbackId, todoId]).size).toBe(3);
142
35
  *
143
- * const callbackId = createId();
144
- * const secondCallbackId = createId();
145
- * const todoId = createId<"Todo">();
146
- * });
36
+ * const replayCreateId = testCreateId();
37
+ * expect(replayCreateId()).toBe(callbackId);
38
+ * expectTypeOf(todoId).toEqualTypeOf<Id & Brand<"Todo">>();
147
39
  * ```
148
40
  */
149
41
  export declare const testCreateId: () => TestCreateId;
@@ -1 +1 @@
1
- {"version":3,"file":"Test.d.ts","sourceRoot":"","sources":["../../src/Test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAa,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAIL,KAAK,QAAQ,EAEb,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAY,KAAK,EAAE,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAC1E,EAAE,GACF,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAElB;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,CAAC,GACtD,cAAc,GACd,WAAW,GACX,YAAY,CAAC;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU;IACvC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB,KAAG,QAQH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,aAAa,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;AAE/C,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;AAO7D;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAC/B,WAAU,QAAoB,KAC7B,OAAO,CAAC,IAAI,CAAyB,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,YAAY,QAAO,YAQ/B,CAAC"}
1
+ {"version":3,"file":"Test.d.ts","sourceRoot":"","sources":["../../src/Test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EAAY,KAAK,EAAE,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAC1E,EAAE,GACF,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY,QAAO,YAM/B,CAAC"}
package/dist/src/Test.js CHANGED
@@ -1,70 +1,14 @@
1
1
  /**
2
- * Test utilities for deterministic testing.
2
+ * Cross-module test utilities for deterministic testing.
3
+ *
4
+ * Test helpers are usually colocated with the code they test. Helpers that
5
+ * cannot be colocated because they would create dependency cycles belong here.
3
6
  *
4
7
  * @module
5
8
  */
6
- import { testCreateConsole, } from "./Console.js";
7
9
  import { testCreateRandomBytes } from "./Crypto.js";
8
- import { testCreateRandom, testCreateRandomLib, } from "./Random.js";
9
- import { createRun } from "./Task.js";
10
- import { minMillis, setTimeout, testCreateTime, } from "./Time.js";
10
+ import { testCreateRandomLib } from "./Random.js";
11
11
  import { createId } from "./Type.js";
12
- /**
13
- * Creates deterministic {@link TestDeps}.
14
- *
15
- * Each call creates fresh instances, so tests don't share state.
16
- *
17
- * Includes these deps:
18
- *
19
- * - `console`: {@link TestConsole}
20
- * - `random`: {@link Random}
21
- * - `randomLib`: seeded `random` package instance
22
- * - `randomBytes`: {@link RandomBytes}
23
- * - `time`: {@link TestTime}
24
- *
25
- * Use this for synchronous code that accepts deps directly. For tests that run
26
- * Tasks, use {@link testCreateRun}.
27
- *
28
- * ### Example
29
- *
30
- * ```ts
31
- * test("Callbacks with no argument", () => {
32
- * const deps = testCreateDeps();
33
- * const callbacks = createCallbacks(deps);
34
- *
35
- * let called = false;
36
- * const id = callbacks.register(() => {
37
- * called = true;
38
- * });
39
- *
40
- * callbacks.execute(id);
41
- * expect(called).toBe(true);
42
- * });
43
- * ```
44
- */
45
- export const testCreateDeps = (options) => {
46
- const seed = options?.seed ?? "evolu";
47
- const console = testCreateConsole();
48
- const random = testCreateRandom(seed);
49
- const randomLib = testCreateRandomLib(seed);
50
- const randomBytes = testCreateRandomBytes({ randomLib });
51
- const time = testCreateTime();
52
- return { console, randomBytes, random, randomLib, time };
53
- };
54
- export function testCreateRun(deps) {
55
- const defaults = testCreateDeps();
56
- return createRun({ ...defaults, ...deps });
57
- }
58
- /**
59
- * Returns a Promise that resolves after a macrotask delay.
60
- *
61
- * Use this to model a real async boundary in a test double, for example an
62
- * async disposer that should not complete in the same turn.
63
- *
64
- * Avoid using it to coordinate assertions. Waiting for a macrotask tends to
65
- * make tests indirect and brittle.
66
- */
67
- export const testWaitForMacrotask = (duration = minMillis) => setTimeout(duration);
68
12
  /**
69
13
  * Creates a deterministic `createId` helper.
70
14
  *
@@ -80,18 +24,23 @@ export const testWaitForMacrotask = (duration = minMillis) => setTimeout(duratio
80
24
  * ### Example
81
25
  *
82
26
  * ```ts
83
- * test("creates stable ids", () => {
84
- * const createId = testCreateId();
27
+ * import { testCreateId, type Brand, type Id } from "@evolu/common";
28
+ *
29
+ * const createId = testCreateId();
30
+ *
31
+ * const callbackId = createId();
32
+ * const secondCallbackId = createId();
33
+ * const todoId = createId<"Todo">();
34
+ * expect(new Set([callbackId, secondCallbackId, todoId]).size).toBe(3);
85
35
  *
86
- * const callbackId = createId();
87
- * const secondCallbackId = createId();
88
- * const todoId = createId<"Todo">();
89
- * });
36
+ * const replayCreateId = testCreateId();
37
+ * expect(replayCreateId()).toBe(callbackId);
38
+ * expectTypeOf(todoId).toEqualTypeOf<Id & Brand<"Todo">>();
90
39
  * ```
91
40
  */
92
41
  export const testCreateId = () => {
93
42
  const randomBytes = testCreateRandomBytes({
94
43
  randomLib: testCreateRandomLib(),
95
44
  });
96
- return () => createId({ randomBytes });
45
+ return (() => createId({ randomBytes }));
97
46
  };
@@ -3,18 +3,39 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import type { Brand } from "./Brand.js";
7
- import { type DateIso } from "./Type.js";
8
- import type { Digit, Digit1To23, Digit1To51, Digit1To59, Digit1To6, Digit1To9, Digit1To99 } from "./Types.js";
6
+ import type { Brand } from "./Brand.ts";
7
+ import { type DateIso, type NonNaNNumber } from "./Type.ts";
8
+ import type { Digit, Digit1To23, Digit1To51, Digit1To59, Digit1To6, Digit1To9, Digit1To99 } from "./Types.ts";
9
9
  /** Time and timer operations. */
10
10
  export interface Time {
11
- /** Returns current time as Unix epoch milliseconds. */
12
- readonly now: () => Millis;
13
- /** Returns current time as an ISO 8601 UTC string. */
14
- readonly nowDateIso: () => DateIso;
15
- /** Schedules a callback after the specified delay. */
16
- readonly setTimeout: (fn: () => void, delay: Duration) => TimeoutId;
17
- /** Cancels a timeout scheduled with {@link Time.setTimeout}. */
11
+ readonly now: {
12
+ /** Returns current time as Unix epoch milliseconds. */
13
+ (): Millis;
14
+ /** Returns current time as an ISO 8601 UTC string. */
15
+ (type: "DateIso"): DateIso;
16
+ };
17
+ readonly performance: {
18
+ /** Unix epoch timestamp used as the origin for `performance.now()`. */
19
+ readonly timeOrigin: PerformanceTimeOrigin;
20
+ /**
21
+ * Returns a high-resolution timestamp in milliseconds relative to
22
+ * `performance.timeOrigin`.
23
+ *
24
+ * Unlike {@link Time.now}, this value is not Unix epoch time and is
25
+ * unaffected by system clock adjustments. Like Node.js
26
+ * `process.hrtime.bigint()`, it is suitable for measuring elapsed time, but
27
+ * it uses the Web Performance API's number representation rather than
28
+ * nanoseconds as a bigint.
29
+ */
30
+ readonly now: () => PerformanceTime;
31
+ };
32
+ /** Schedules a callback after the specified positive delay. */
33
+ readonly setTimeout: (fn: () => void, delay: PositiveDuration) => TimeoutId;
34
+ /**
35
+ * Cancels a timeout scheduled with this instance's {@link Time.setTimeout}.
36
+ *
37
+ * Throws if the timeout was scheduled by another {@link Time} instance.
38
+ */
18
39
  readonly clearTimeout: (id: TimeoutId) => void;
19
40
  }
20
41
  export interface TimeDep {
@@ -27,7 +48,13 @@ export interface TimeDep {
27
48
  */
28
49
  export type TimeoutId = Brand<"TimeoutId">;
29
50
  /**
30
- * Creates a {@link Time} using `Date.now()` and `globalThis.setTimeout`.
51
+ * Creates a {@link Time} using `Date.now()`, `performance`, and
52
+ * `globalThis.setTimeout`.
53
+ *
54
+ * Long timeouts are split into native timer chunks and tracked against an
55
+ * absolute wall-clock deadline so late callback execution and system suspension
56
+ * do not extend the requested delay. System clock adjustments can therefore
57
+ * shorten or lengthen long timeouts.
31
58
  *
32
59
  * Throws if the system clock returns an out-of-range value. This is intentional
33
60
  * — there's no reasonable fallback for a misconfigured clock.
@@ -39,7 +66,12 @@ export declare const createTime: () => Time;
39
66
  * Call `advance(ms)` to move time forward and trigger any pending timeouts.
40
67
  */
41
68
  export interface TestTime extends Time {
42
- /** Advances time by the specified duration, triggering pending timeouts. */
69
+ /**
70
+ * Advances time by the specified duration, triggering pending timeouts.
71
+ *
72
+ * Timeout callback errors propagate and leave time at the callback's
73
+ * deadline. Throws if called while another advance is in progress.
74
+ */
43
75
  readonly advance: (duration: Duration) => void;
44
76
  }
45
77
  export interface TestTimeDep {
@@ -52,17 +84,17 @@ export interface TestTimeDep {
52
84
  * called. Timeouts scheduled via `setTimeout` fire when time is advanced past
53
85
  * their deadline.
54
86
  *
55
- * Set `autoIncrement` to automatically increment time by 1ms after each `now()`
56
- * call. `"microtask"` increments after the current turn, while `"sync"`
57
- * increments immediately after each read. Omit it to keep time fixed until
58
- * `advance()` is called.
87
+ * Set `autoIncrement` to automatically increment time by 1ms after each
88
+ * wall-clock or performance `now()` call. `"microtask"` increments after the
89
+ * current turn, while `"sync"` increments immediately after each read. Omit it
90
+ * to keep time fixed until `advance()` is called.
59
91
  */
60
92
  export declare const testCreateTime: (options?: {
61
93
  readonly startAt?: Millis;
62
94
  readonly autoIncrement?: "microtask" | "sync";
63
95
  }) => TestTime;
64
96
  /**
65
- * Milliseconds timestamp, like `Date.now()`.
97
+ * Non-negative integer milliseconds used for timestamps and durations.
66
98
  *
67
99
  * The maximum value is 281474976710654 (281474976710655 - 1, reserved for
68
100
  * infinity). This enables efficient binary serialization, saving 2 bytes
@@ -73,8 +105,11 @@ export declare const testCreateTime: (options?: {
73
105
  * If a system clock exceeds this range, operations will throw. This is
74
106
  * intentional — there's no reasonable fallback for a misconfigured clock.
75
107
  */
76
- export declare const Millis: import("./Type.js").BrandType<import("./Type.js").BrandType<import("./Type.js").Type<"Brand", number & Brand<"Int"> & Brand<"NonNegative">, number, import("./Type.js").NonNegativeError, number & Brand<"Int">, import("./Type.js").NumberError | import("./Type.js").IntError>, "LessThan281474976710655", import("./Type.js").LessThanError<281474976710655>, import("./Type.js").NumberError | import("./Type.js").NonNegativeError | import("./Type.js").IntError>, "Millis", import("./Type.js").BrandWithoutRefineError<"Millis", import("./Type.js").NumberError | import("./Type.js").LessThanError<281474976710655> | import("./Type.js").NonNegativeError | import("./Type.js").IntError>, never>;
77
- export type Millis = typeof Millis.Type;
108
+ export declare const Millis: import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").Type<"Number", number, number, import("./Type.ts").TypeOfError<"Number">, null, import("./Type.ts").TypeOfError<"Number">, never, number, true>, "NonNaN", import("./Type.ts").NonNaNError>, "Finite", import("./Type.ts").FiniteError>, "Int", import("./Type.ts").IntError>, "NonNegative", import("./Type.ts").NonNegativeError>, "LessThan281474976710655", import("./Type.ts").LessThanError<281474976710655>>, "Millis", never>;
109
+ export type Millis = typeof Millis.Output;
110
+ /** Positive {@link Millis} value. */
111
+ export declare const PositiveMillis: import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").Type<"Number", number, number, import("./Type.ts").TypeOfError<"Number">, null, import("./Type.ts").TypeOfError<"Number">, never, number, true>, "NonNaN", import("./Type.ts").NonNaNError>, "Finite", import("./Type.ts").FiniteError>, "Int", import("./Type.ts").IntError>, "NonNegative", import("./Type.ts").NonNegativeError>, "LessThan281474976710655", import("./Type.ts").LessThanError<281474976710655>>, "Millis", never>, "Positive", import("./Type.ts").PositiveError>;
112
+ export type PositiveMillis = typeof PositiveMillis.Output;
78
113
  /** Minimum {@link Millis} value. */
79
114
  export declare const minMillis: Millis;
80
115
  /** Maximum {@link Millis} value. */
@@ -83,7 +118,7 @@ export declare const maxMillis: Millis;
83
118
  * Converts a number to {@link Millis}, rounding to the nearest millisecond and
84
119
  * saturating overflow at {@link maxMillis}.
85
120
  */
86
- export declare const saturateMillis: (value: number) => Millis;
121
+ export declare const saturateMillis: (value: NonNaNNumber) => Millis;
87
122
  /**
88
123
  * Converts {@link Millis} to {@link DateIso}.
89
124
  *
@@ -91,11 +126,25 @@ export declare const saturateMillis: (value: number) => Millis;
91
126
  * that always produces a valid ISO string.
92
127
  */
93
128
  export declare const millisToDateIso: (value: Millis) => DateIso;
129
+ /** Unix epoch milliseconds used as the origin for {@link PerformanceTime}. */
130
+ export type PerformanceTimeOrigin = number & Brand<"PerformanceTimeOrigin">;
131
+ /** High-resolution milliseconds elapsed since {@link PerformanceTimeOrigin}. */
132
+ export type PerformanceTime = number & Brand<"PerformanceTime">;
133
+ /** Elapsed fractional milliseconds measured using {@link PerformanceTime}. */
134
+ export type PerformanceDuration = number & Brand<"PerformanceDuration">;
135
+ /**
136
+ * Returns the elapsed fractional milliseconds between two performance times.
137
+ *
138
+ * Throws if `end` precedes `start`.
139
+ */
140
+ export declare const performanceDurationBetween: (start: PerformanceTime, end: PerformanceTime) => PerformanceDuration;
94
141
  /**
95
142
  * Duration can be either a {@link DurationLiteral} or milliseconds as
96
143
  * {@link Millis}.
97
144
  */
98
145
  export type Duration = DurationLiteral | Millis;
146
+ /** Positive duration accepted by timer-based APIs. */
147
+ export type PositiveDuration = DurationLiteral | PositiveMillis;
99
148
  /**
100
149
  * Duration literal with compile-time validation.
101
150
  *
@@ -110,9 +159,9 @@ export type Duration = DurationLiteral | Millis;
110
159
  * - Months: not supported (variable length)
111
160
  * - Years: `1y`, `99y`, `1.5y` (1-99, 1.1-99.9)
112
161
  *
113
- * Each unit is limited to values that can't be expressed in the next larger
114
- * unit, ensuring every duration has exactly one canonical representation (e.g.,
115
- * 1000ms must be written as `"1s"`, not `"1000ms"`).
162
+ * Each unit uses a bounded range. Where units convert exactly, this avoids
163
+ * equivalent representations (e.g., 1000ms must be written as `"1s"`, not
164
+ * `"1000ms"`).
116
165
  *
117
166
  * Decimal values cover cases like 1.5s (1500ms) or 1.5h (90 minutes) without
118
167
  * allowing redundant forms. For precise values that don't fit (e.g., 1050ms),
@@ -166,29 +215,17 @@ export type DurationLiteralYears = `${Digit1To99}y` | `${Digit1To99}.${Digit1To9
166
215
  * ### Example
167
216
  *
168
217
  * ```ts
169
- * durationToMillis("1ms"); // 1
170
- * durationToMillis("500ms"); // 500
171
- * durationToMillis("1.5s"); // 1500
172
- * durationToMillis("30s"); // 30000
173
- * durationToMillis("5m"); // 300000
174
- * durationToMillis("12h"); // 43200000
175
- * durationToMillis("7d"); // 604800000
176
- * durationToMillis(Millis.orThrow(5000)); // 5000 (already Millis)
177
- * ```
178
- */
179
- export declare const durationToMillis: (duration: Duration) => Millis;
180
- /**
181
- * Returns a Promise that resolves after the specified duration.
218
+ * import { durationToMillis, Millis } from "@evolu/common";
182
219
  *
183
- * Uses {@link Duration} parsing and `globalThis.setTimeout`.
184
- *
185
- * ### Example
186
- *
187
- * ```ts
188
- * await setTimeout("1ms");
220
+ * expect(durationToMillis("1.5s")).toBe(1500);
221
+ * expect(durationToMillis("5m")).toBe(300000);
222
+ * expect(durationToMillis("12h")).toBe(43200000);
223
+ * expect(durationToMillis("1w")).toBe(604800000);
224
+ * expect(durationToMillis(Millis.orThrow(5000))).toBe(5000);
189
225
  * ```
190
226
  */
191
- export declare const setTimeout: (duration: Duration) => Promise<void>;
227
+ export declare function durationToMillis(duration: DurationLiteral | PositiveMillis): PositiveMillis;
228
+ export declare function durationToMillis(duration: Duration): Millis;
192
229
  /**
193
230
  * Frame budget at 60fps (16ms).
194
231
  *
@@ -215,24 +252,46 @@ export declare const msLongTask: Millis;
215
252
  *
216
253
  * - Under 1 minute: `1.234s`
217
254
  * - Under 1 hour: `1m30.000s`
218
- * - 1 hour or more: `1h30m45.000s`
255
+ * - Under 1 day: `1h30m45.000s`
256
+ * - Under 1 week: `1d2h30m45.000s`
257
+ * - Under 1 year: `1w2d3h30m45.000s`
258
+ * - 1 year or more: `1y2w3d4h30m45.000s`
259
+ *
260
+ * Weeks are 7 days and years are 365 days.
219
261
  *
220
262
  * ### Example
221
263
  *
222
264
  * ```ts
223
- * formatMillisAsDuration(1234 as Millis); // "1.234s"
224
- * formatMillisAsDuration(90000 as Millis); // "1m30.000s"
225
- * formatMillisAsDuration(3661000 as Millis); // "1h1m1.000s"
265
+ * import { formatMillisAsDuration, Millis } from "@evolu/common";
266
+ *
267
+ * expect(formatMillisAsDuration(Millis.orThrow(1234))).toBe("1.234s");
268
+ * expect(formatMillisAsDuration(Millis.orThrow(90000))).toBe("1m30.000s");
269
+ * expect(formatMillisAsDuration(Millis.orThrow(90061000))).toBe(
270
+ * "1d1h1m1.000s",
271
+ * );
226
272
  * ```
227
273
  */
228
274
  export declare const formatMillisAsDuration: (millis: Millis) => string;
229
275
  /**
230
- * Formats {@link Millis} as `HH:MM:SS.mmm`.
276
+ * Formats {@link Millis} as local time in `HH:MM:SS.mmm` format.
231
277
  *
232
278
  * ### Example
233
279
  *
234
280
  * ```ts
235
- * formatMillisAsClockTime(Millis.orThrow(Date.now())); // "14:32:15.234"
281
+ * import { formatMillisAsClockTime, Millis } from "@evolu/common";
282
+ *
283
+ * const timestamp = new globalThis.Date(
284
+ * 2026,
285
+ * 0,
286
+ * 28,
287
+ * 14,
288
+ * 32,
289
+ * 15,
290
+ * 234,
291
+ * ).getTime();
292
+ * expect(formatMillisAsClockTime(Millis.orThrow(timestamp))).toBe(
293
+ * "14:32:15.234",
294
+ * );
236
295
  * ```
237
296
  */
238
297
  export declare const formatMillisAsClockTime: (millis: Millis) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"Time.d.ts","sourceRoot":"","sources":["../../src/Time.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAS,KAAK,OAAO,EAA4B,MAAM,WAAW,CAAC;AAC1E,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB,iCAAiC;AACjC,MAAM,WAAW,IAAI;IACnB,uDAAuD;IACvD,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;IAE3B,sDAAsD;IACtD,QAAQ,CAAC,UAAU,EAAE,MAAM,OAAO,CAAC;IAEnC,sDAAsD;IACtD,QAAQ,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,QAAQ,KAAK,SAAS,CAAC;IAEpE,gEAAgE;IAChE,QAAQ,CAAC,YAAY,EAAE,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