@evolu/common 7.4.1 → 8.0.0-next.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 (251) hide show
  1. package/README.md +4 -61
  2. package/dist/src/Array.d.ts +343 -102
  3. package/dist/src/Array.d.ts.map +1 -1
  4. package/dist/src/Array.js +181 -85
  5. package/dist/src/Assert.d.ts +57 -11
  6. package/dist/src/Assert.d.ts.map +1 -1
  7. package/dist/src/Assert.js +47 -11
  8. package/dist/src/BigInt.d.ts +6 -1
  9. package/dist/src/BigInt.d.ts.map +1 -1
  10. package/dist/src/BigInt.js +5 -0
  11. package/dist/src/Brand.d.ts +40 -12
  12. package/dist/src/Brand.d.ts.map +1 -1
  13. package/dist/src/Brand.js +5 -0
  14. package/dist/src/Buffer.d.ts +6 -1
  15. package/dist/src/Buffer.d.ts.map +1 -1
  16. package/dist/src/Buffer.js +7 -2
  17. package/dist/src/Cache.d.ts +10 -2
  18. package/dist/src/Cache.d.ts.map +1 -1
  19. package/dist/src/Cache.js +6 -0
  20. package/dist/src/Callbacks.d.ts +10 -7
  21. package/dist/src/Callbacks.d.ts.map +1 -1
  22. package/dist/src/Callbacks.js +23 -13
  23. package/dist/src/Console.d.ts +361 -69
  24. package/dist/src/Console.d.ts.map +1 -1
  25. package/dist/src/Console.js +217 -117
  26. package/dist/src/Crypto.d.ts +70 -21
  27. package/dist/src/Crypto.d.ts.map +1 -1
  28. package/dist/src/Crypto.js +72 -27
  29. package/dist/src/Eq.d.ts +22 -2
  30. package/dist/src/Eq.d.ts.map +1 -1
  31. package/dist/src/Eq.js +21 -1
  32. package/dist/src/Error.d.ts +23 -12
  33. package/dist/src/Error.d.ts.map +1 -1
  34. package/dist/src/Error.js +27 -11
  35. package/dist/src/Function.d.ts +128 -56
  36. package/dist/src/Function.d.ts.map +1 -1
  37. package/dist/src/Function.js +118 -14
  38. package/dist/src/Identicon.d.ts +5 -0
  39. package/dist/src/Identicon.d.ts.map +1 -1
  40. package/dist/src/Identicon.js +6 -1
  41. package/dist/src/Lookup.d.ts +160 -0
  42. package/dist/src/Lookup.d.ts.map +1 -0
  43. package/dist/src/Lookup.js +192 -0
  44. package/dist/src/Microtask.d.ts +21 -0
  45. package/dist/src/Microtask.d.ts.map +1 -0
  46. package/dist/src/Microtask.js +37 -0
  47. package/dist/src/Number.d.ts +18 -4
  48. package/dist/src/Number.d.ts.map +1 -1
  49. package/dist/src/Number.js +23 -1
  50. package/dist/src/Object.d.ts +110 -5
  51. package/dist/src/Object.d.ts.map +1 -1
  52. package/dist/src/Object.js +108 -5
  53. package/dist/src/Option.d.ts +58 -0
  54. package/dist/src/Option.d.ts.map +1 -0
  55. package/dist/src/Option.js +43 -0
  56. package/dist/src/Order.d.ts +5 -0
  57. package/dist/src/Order.d.ts.map +1 -1
  58. package/dist/src/Order.js +8 -3
  59. package/dist/src/Platform.d.ts +36 -2
  60. package/dist/src/Platform.d.ts.map +1 -1
  61. package/dist/src/Platform.js +10 -6
  62. package/dist/src/Polyfills.d.ts +27 -0
  63. package/dist/src/Polyfills.d.ts.map +1 -0
  64. package/dist/src/Polyfills.js +299 -0
  65. package/dist/src/Random.d.ts +18 -7
  66. package/dist/src/Random.d.ts.map +1 -1
  67. package/dist/src/Random.js +9 -7
  68. package/dist/src/Redacted.d.ts +7 -4
  69. package/dist/src/Redacted.d.ts.map +1 -1
  70. package/dist/src/Redacted.js +5 -0
  71. package/dist/src/Ref.d.ts +31 -16
  72. package/dist/src/Ref.d.ts.map +1 -1
  73. package/dist/src/Ref.js +35 -7
  74. package/dist/src/RefCount.d.ts +62 -0
  75. package/dist/src/RefCount.d.ts.map +1 -0
  76. package/dist/src/RefCount.js +83 -0
  77. package/dist/src/Relation.d.ts +84 -29
  78. package/dist/src/Relation.d.ts.map +1 -1
  79. package/dist/src/Relation.js +83 -105
  80. package/dist/src/Resource.d.ts +263 -0
  81. package/dist/src/Resource.d.ts.map +1 -0
  82. package/dist/src/Resource.js +389 -0
  83. package/dist/src/Result.d.ts +390 -374
  84. package/dist/src/Result.d.ts.map +1 -1
  85. package/dist/src/Result.js +142 -70
  86. package/dist/src/Schedule.d.ts +953 -0
  87. package/dist/src/Schedule.d.ts.map +1 -0
  88. package/dist/src/Schedule.js +1199 -0
  89. package/dist/src/Set.d.ts +181 -0
  90. package/dist/src/Set.d.ts.map +1 -0
  91. package/dist/src/Set.js +137 -0
  92. package/dist/src/Skiplist.d.ts +6 -1
  93. package/dist/src/Skiplist.d.ts.map +1 -1
  94. package/dist/src/Skiplist.js +5 -0
  95. package/dist/src/Sqlite.d.ts +160 -60
  96. package/dist/src/Sqlite.d.ts.map +1 -1
  97. package/dist/src/Sqlite.js +290 -190
  98. package/dist/src/Store.d.ts +36 -28
  99. package/dist/src/Store.d.ts.map +1 -1
  100. package/dist/src/Store.js +55 -15
  101. package/dist/src/String.d.ts +5 -0
  102. package/dist/src/String.d.ts.map +1 -1
  103. package/dist/src/String.js +5 -0
  104. package/dist/src/Task.d.ts +2263 -423
  105. package/dist/src/Task.d.ts.map +1 -1
  106. package/dist/src/Task.js +1488 -348
  107. package/dist/src/Test.d.ts +122 -0
  108. package/dist/src/Test.d.ts.map +1 -0
  109. package/dist/src/Test.js +66 -0
  110. package/dist/src/Time.d.ts +201 -48
  111. package/dist/src/Time.d.ts.map +1 -1
  112. package/dist/src/Time.js +190 -86
  113. package/dist/src/Tracer.d.ts +48 -0
  114. package/dist/src/Tracer.d.ts.map +1 -0
  115. package/dist/src/Tracer.js +6 -0
  116. package/dist/src/Type.d.ts +582 -209
  117. package/dist/src/Type.d.ts.map +1 -1
  118. package/dist/src/Type.js +362 -240
  119. package/dist/src/Types.d.ts +160 -6
  120. package/dist/src/Types.d.ts.map +1 -1
  121. package/dist/src/Types.js +22 -2
  122. package/dist/src/WebSocket.d.ts +113 -58
  123. package/dist/src/WebSocket.d.ts.map +1 -1
  124. package/dist/src/WebSocket.js +210 -118
  125. package/dist/src/Worker.d.ts +245 -60
  126. package/dist/src/Worker.d.ts.map +1 -1
  127. package/dist/src/Worker.js +220 -64
  128. package/dist/src/index.d.ts +25 -3
  129. package/dist/src/index.d.ts.map +1 -1
  130. package/dist/src/index.js +19 -3
  131. package/dist/src/local-first/Db.d.ts +24 -213
  132. package/dist/src/local-first/Db.d.ts.map +1 -1
  133. package/dist/src/local-first/Db.js +622 -293
  134. package/dist/src/local-first/Error.d.ts +12 -0
  135. package/dist/src/local-first/Error.d.ts.map +1 -0
  136. package/dist/src/local-first/Error.js +6 -0
  137. package/dist/src/local-first/Evolu.d.ts +330 -285
  138. package/dist/src/local-first/Evolu.d.ts.map +1 -1
  139. package/dist/src/local-first/Evolu.js +472 -402
  140. package/dist/src/local-first/LocalAuth.d.ts +10 -10
  141. package/dist/src/local-first/LocalAuth.d.ts.map +1 -1
  142. package/dist/src/local-first/LocalAuth.js +6 -1
  143. package/dist/src/local-first/Owner.d.ts +70 -27
  144. package/dist/src/local-first/Owner.d.ts.map +1 -1
  145. package/dist/src/local-first/Owner.js +27 -14
  146. package/dist/src/local-first/Protocol.d.ts +58 -50
  147. package/dist/src/local-first/Protocol.d.ts.map +1 -1
  148. package/dist/src/local-first/Protocol.js +253 -155
  149. package/dist/src/local-first/Query.d.ts +133 -43
  150. package/dist/src/local-first/Query.d.ts.map +1 -1
  151. package/dist/src/local-first/Query.js +139 -90
  152. package/dist/src/local-first/Relay.d.ts +18 -38
  153. package/dist/src/local-first/Relay.d.ts.map +1 -1
  154. package/dist/src/local-first/Relay.js +59 -171
  155. package/dist/src/local-first/Schema.d.ts +139 -144
  156. package/dist/src/local-first/Schema.d.ts.map +1 -1
  157. package/dist/src/local-first/Schema.js +78 -163
  158. package/dist/src/local-first/Shared.d.ts +125 -0
  159. package/dist/src/local-first/Shared.d.ts.map +1 -0
  160. package/dist/src/local-first/Shared.js +569 -0
  161. package/dist/src/local-first/Storage.d.ts +50 -53
  162. package/dist/src/local-first/Storage.d.ts.map +1 -1
  163. package/dist/src/local-first/Storage.js +121 -173
  164. package/dist/src/local-first/Timestamp.d.ts +28 -35
  165. package/dist/src/local-first/Timestamp.d.ts.map +1 -1
  166. package/dist/src/local-first/Timestamp.js +24 -25
  167. package/dist/src/local-first/index.d.ts +2 -15
  168. package/dist/src/local-first/index.d.ts.map +1 -1
  169. package/dist/src/local-first/index.js +2 -15
  170. package/package.json +36 -26
  171. package/src/Array.ts +467 -106
  172. package/src/Assert.ts +87 -12
  173. package/src/BigInt.ts +7 -1
  174. package/src/Brand.ts +41 -12
  175. package/src/Buffer.ts +10 -4
  176. package/src/Cache.ts +11 -2
  177. package/src/Callbacks.ts +33 -23
  178. package/src/Console.ts +567 -178
  179. package/src/Crypto.ts +111 -62
  180. package/src/Eq.ts +30 -3
  181. package/src/Error.ts +50 -34
  182. package/src/Function.ts +140 -68
  183. package/src/Identicon.ts +7 -1
  184. package/src/Lookup.ts +415 -0
  185. package/src/Microtask.ts +58 -0
  186. package/src/Number.ts +40 -7
  187. package/src/Object.ts +155 -16
  188. package/src/Option.ts +74 -0
  189. package/src/Order.ts +11 -3
  190. package/src/Platform.ts +43 -7
  191. package/src/Polyfills.ts +465 -0
  192. package/src/Random.ts +25 -11
  193. package/src/Redacted.ts +8 -4
  194. package/src/Ref.ts +72 -21
  195. package/src/RefCount.ts +170 -0
  196. package/src/Relation.ts +188 -136
  197. package/src/Resource.ts +864 -0
  198. package/src/Result.ts +548 -381
  199. package/src/Schedule.ts +1471 -0
  200. package/src/Set.ts +247 -0
  201. package/src/Skiplist.ts +7 -1
  202. package/src/Sqlite.ts +409 -304
  203. package/src/Store.ts +94 -48
  204. package/src/String.ts +6 -0
  205. package/src/Task.ts +3685 -740
  206. package/src/Test.ts +162 -0
  207. package/src/Time.ts +348 -145
  208. package/src/Tracer.ts +54 -0
  209. package/src/Type.ts +851 -430
  210. package/src/Types.ts +202 -7
  211. package/src/WebSocket.ts +311 -178
  212. package/src/Worker.ts +527 -147
  213. package/src/index.ts +74 -3
  214. package/src/local-first/Db.ts +871 -597
  215. package/src/local-first/Error.ts +17 -0
  216. package/src/local-first/Evolu.ts +884 -824
  217. package/src/local-first/LocalAuth.ts +10 -10
  218. package/src/local-first/Owner.ts +94 -42
  219. package/src/local-first/Protocol.ts +440 -303
  220. package/src/local-first/Query.ts +243 -194
  221. package/src/local-first/Relay.ts +91 -252
  222. package/src/local-first/Schema.ts +284 -394
  223. package/src/local-first/Shared.ts +932 -0
  224. package/src/local-first/Storage.ts +206 -277
  225. package/src/local-first/Timestamp.ts +38 -45
  226. package/src/local-first/index.ts +2 -16
  227. package/LICENSE +0 -21
  228. package/dist/src/Instances.d.ts +0 -34
  229. package/dist/src/Instances.d.ts.map +0 -1
  230. package/dist/src/Instances.js +0 -44
  231. package/dist/src/Resources.d.ts +0 -118
  232. package/dist/src/Resources.d.ts.map +0 -1
  233. package/dist/src/Resources.js +0 -197
  234. package/dist/src/local-first/Platform.d.ts +0 -25
  235. package/dist/src/local-first/Platform.d.ts.map +0 -1
  236. package/dist/src/local-first/Platform.js +0 -1
  237. package/dist/src/local-first/Public.d.ts +0 -22
  238. package/dist/src/local-first/Public.d.ts.map +0 -1
  239. package/dist/src/local-first/Public.js +0 -15
  240. package/dist/src/local-first/PublicKysely.d.ts +0 -148
  241. package/dist/src/local-first/PublicKysely.d.ts.map +0 -1
  242. package/dist/src/local-first/PublicKysely.js +0 -184
  243. package/dist/src/local-first/Sync.d.ts +0 -112
  244. package/dist/src/local-first/Sync.d.ts.map +0 -1
  245. package/dist/src/local-first/Sync.js +0 -526
  246. package/src/Instances.ts +0 -92
  247. package/src/Resources.ts +0 -367
  248. package/src/local-first/Platform.ts +0 -27
  249. package/src/local-first/Public.ts +0 -42
  250. package/src/local-first/PublicKysely.ts +0 -239
  251. package/src/local-first/Sync.ts +0 -949
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Cryptographic utilities
2
+ * Cryptographic utilities.
3
3
  *
4
- * Type-safe cryptographic operations including random number generation, SLIP21
4
+ * Type-safe cryptographic operations including random bytes generation, SLIP21
5
5
  * key derivation, XChaCha20-Poly1305 symmetric encryption, PADMÉ padding, and
6
6
  * timing-safe comparisons.
7
7
  *
@@ -11,15 +11,24 @@ import { xchacha20poly1305 } from "@noble/ciphers/chacha.js";
11
11
  import { hmac } from "@noble/hashes/hmac.js";
12
12
  import { sha512 } from "@noble/hashes/sha2.js";
13
13
  import { randomBytes, utf8ToBytes } from "@noble/hashes/utils.js";
14
+ import { arrayFrom } from "./Array.js";
14
15
  import { trySync } from "./Result.js";
15
- import { brand, length, NonNegativeInt, Uint8Array } from "./Type.js";
16
- const Entropy = brand("Entropy", Uint8Array);
17
- export const Entropy16 = length(16)(Entropy);
18
- export const Entropy32 = length(32)(Entropy);
19
- export const Entropy64 = length(64)(Entropy);
16
+ import { brand, length, NonNegativeInt, Uint8Array, zeroNonNegativeInt, } from "./Type.js";
17
+ const Entropy = /*#__PURE__*/ brand("Entropy", Uint8Array);
18
+ export const Entropy16 = /*#__PURE__*/ length(16)(Entropy);
19
+ export const Entropy24 = /*#__PURE__*/ length(24)(Entropy);
20
+ export const Entropy32 = /*#__PURE__*/ length(32)(Entropy);
21
+ export const Entropy64 = /*#__PURE__*/ length(64)(Entropy);
20
22
  export const createRandomBytes = () => ({
21
23
  create: randomBytes,
22
24
  });
25
+ /** Creates seeded random bytes for deterministic tests. */
26
+ export const testCreateRandomBytes = (deps) => ({
27
+ create: (bytesLength) => {
28
+ const array = arrayFrom(bytesLength, () => deps.randomLib.int(0, 255));
29
+ return new globalThis.Uint8Array(array);
30
+ },
31
+ });
23
32
  /**
24
33
  * SLIP21.
25
34
  *
@@ -45,29 +54,65 @@ export const deriveSlip21Node = (label, parentNode) => {
45
54
  message.set(labelBytes, 1);
46
55
  return hmac(sha512, parentNode.slice(0, 32), message);
47
56
  };
48
- /** The encryption key for {@link SymmetricCrypto}. */
49
- export const EncryptionKey = brand("EncryptionKey", Entropy32);
57
+ /** The encryption key for symmetric encryption. */
58
+ export const EncryptionKey = /*#__PURE__*/ brand("EncryptionKey", Entropy32);
59
+ /** The nonce length for XChaCha20-Poly1305 encryption. */
60
+ export const xChaCha20Poly1305NonceLength = 24;
61
+ /**
62
+ * Branded Uint8Array for XChaCha20-Poly1305 encryption.
63
+ *
64
+ * @see {@link encryptWithXChaCha20Poly1305}
65
+ */
66
+ export const XChaCha20Poly1305Ciphertext = /*#__PURE__*/ brand("XChaCha20Poly1305Ciphertext", Uint8Array);
50
67
  /**
51
- * XChaCha20-Poly1305 encryption
68
+ * Encrypts plaintext with XChaCha20-Poly1305.
69
+ *
70
+ * Generates a random nonce internally and returns both the ciphertext and
71
+ * nonce. The nonce must be stored alongside the ciphertext for decryption.
72
+ *
73
+ * ### Example
52
74
  *
53
- * https://github.com/paulmillr/noble-ciphers?tab=readme-ov-file#which-cipher-should-i-pick
75
+ * ```ts
76
+ * const deps = { randomBytes: createRandomBytes() };
77
+ * const [ciphertext, nonce] = encryptWithXChaCha20Poly1305(deps)(
78
+ * utf8ToBytes("secret message"),
79
+ * encryptionKey,
80
+ * );
81
+ * ```
82
+ *
83
+ * @see https://github.com/paulmillr/noble-ciphers
54
84
  */
55
- export const createSymmetricCrypto = (deps) => {
56
- const nonceLength = NonNegativeInt.orThrow(24);
57
- const symmetricCrypto = {
58
- nonceLength,
59
- encrypt: (plaintext, encryptionKey) => {
60
- const nonce = deps.randomBytes.create(nonceLength);
61
- const ciphertext = xchacha20poly1305(encryptionKey, nonce).encrypt(plaintext);
62
- return { nonce, ciphertext };
63
- },
64
- decrypt: (ciphertext, encryptionKey, nonce) => trySync(() => xchacha20poly1305(encryptionKey, nonce).decrypt(ciphertext), (error) => ({
65
- type: "SymmetricCryptoDecryptError",
66
- error,
67
- })),
68
- };
69
- return symmetricCrypto;
85
+ export const encryptWithXChaCha20Poly1305 = (deps) => (plaintext, encryptionKey) => {
86
+ const nonce = deps.randomBytes.create(xChaCha20Poly1305NonceLength);
87
+ const ciphertext = XChaCha20Poly1305Ciphertext.orThrow(xchacha20poly1305(encryptionKey, nonce).encrypt(plaintext));
88
+ return [ciphertext, nonce];
70
89
  };
90
+ /**
91
+ * Decrypts ciphertext with XChaCha20-Poly1305.
92
+ *
93
+ * Requires the same nonce that was used during encryption. Returns a
94
+ * {@link Result} that may contain a decryption error if the ciphertext was
95
+ * tampered with or the wrong key/nonce was used.
96
+ *
97
+ * ### Example
98
+ *
99
+ * ```ts
100
+ * const result = decryptWithXChaCha20Poly1305(
101
+ * ciphertext,
102
+ * nonce,
103
+ * encryptionKey,
104
+ * );
105
+ * if (!result.ok) {
106
+ * // Handle decryption error
107
+ * return result;
108
+ * }
109
+ * const plaintext = result.value;
110
+ * ```
111
+ */
112
+ export const decryptWithXChaCha20Poly1305 = (ciphertext, nonce, encryptionKey) => trySync(() => xchacha20poly1305(encryptionKey, nonce).decrypt(ciphertext), (error) => ({
113
+ type: "DecryptWithXChaCha20Poly1305Error",
114
+ error,
115
+ }));
71
116
  /**
72
117
  * Returns the PADMÉ padded length for a given input length.
73
118
  *
@@ -78,7 +123,7 @@ export const createSymmetricCrypto = (deps) => {
78
123
  */
79
124
  export const createPadmePaddedLength = (length) => {
80
125
  if (length <= 0)
81
- return NonNegativeInt.orThrow(0);
126
+ return zeroNonNegativeInt;
82
127
  const e = 31 - Math.clz32(length >>> 0);
83
128
  const s = 32 - Math.clz32(e >>> 0);
84
129
  const z = Math.max(0, e - s);
package/dist/src/Eq.d.ts CHANGED
@@ -1,5 +1,10 @@
1
- import { JsonValue, JsonValueInput } from "./Type.js";
2
- import { Order } from "./Order.js";
1
+ /**
2
+ * Equality comparison functions and utilities.
3
+ *
4
+ * @module
5
+ */
6
+ import type { Order } from "./Order.js";
7
+ import type { JsonValue, JsonValueInput } from "./Type.js";
3
8
  /**
4
9
  * Compares two values of the same type `A` for equality.
5
10
  *
@@ -31,6 +36,21 @@ export declare const eqFromOrder: <A>(order: Order<A>) => Eq<A>;
31
36
  * ```
32
37
  */
33
38
  export declare const createEqArrayLike: <A>(item: Eq<A>) => Eq<ArrayLike<A>>;
39
+ /**
40
+ * Compares two array-like structures by strict reference equality (`===`).
41
+ *
42
+ * Useful for structural sharing checks where elements are compared by identity.
43
+ *
44
+ * ### Example
45
+ *
46
+ * ```ts
47
+ * const a = { x: 1 };
48
+ * const b = { x: 1 };
49
+ * eqArrayStrict([a, a], [a, a]); // true (same references)
50
+ * eqArrayStrict([a], [b]); // false (different references, even if equal values)
51
+ * ```
52
+ */
53
+ export declare const eqArrayStrict: <A>(x: ArrayLike<A>, y: ArrayLike<A>) => boolean;
34
54
  /**
35
55
  * Compares two array-like structures of numbers for equality.
36
56
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Eq.d.ts","sourceRoot":"","sources":["../../src/Eq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;AAE/C,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,KAAG,OAAkB,CAAC;AAE5D,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAY,CAAC;AAC7C,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAY,CAAC;AAC7C,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAY,CAAC;AAC7C,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,OAAO,CAAY,CAAC;AAC/C,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,SAAS,CAAY,CAAC;AACnD,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,IAAI,CAAY,CAAC;AAEzC,mDAAmD;AACnD,eAAO,MAAM,WAAW,GACrB,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,K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sD,CAAC"}
package/dist/src/Eq.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Equality comparison functions and utilities.
3
+ *
4
+ * @module
5
+ */
1
6
  export const eqStrict = (x, y) => x === y;
2
7
  export const eqString = eqStrict;
3
8
  export const eqNumber = eqStrict;
@@ -31,6 +36,21 @@ export const createEqArrayLike = (item) => (x, y) => {
31
36
  }
32
37
  return true;
33
38
  };
39
+ /**
40
+ * Compares two array-like structures by strict reference equality (`===`).
41
+ *
42
+ * Useful for structural sharing checks where elements are compared by identity.
43
+ *
44
+ * ### Example
45
+ *
46
+ * ```ts
47
+ * const a = { x: 1 };
48
+ * const b = { x: 1 };
49
+ * eqArrayStrict([a, a], [a, a]); // true (same references)
50
+ * eqArrayStrict([a], [b]); // false (different references, even if equal values)
51
+ * ```
52
+ */
53
+ export const eqArrayStrict = /*#__PURE__*/ createEqArrayLike(eqStrict);
34
54
  /**
35
55
  * Compares two array-like structures of numbers for equality.
36
56
  *
@@ -42,7 +62,7 @@ export const createEqArrayLike = (item) => (x, y) => {
42
62
  * eqArrayNumber([1, 2, 3], [1, 2, 4]); // false
43
63
  * ```
44
64
  */
45
- export const eqArrayNumber = createEqArrayLike(eqNumber);
65
+ export const eqArrayNumber = /*#__PURE__*/ createEqArrayLike(eqNumber);
46
66
  /**
47
67
  * Creates an equivalence function for objects based on an equivalence for their
48
68
  * fields.
@@ -1,19 +1,30 @@
1
1
  /**
2
- * A serializable representation of an error for safe transfer between execution
3
- * contexts, such as Web Workers and the main thread.
2
+ * Error types and utilities for safe error handling.
4
3
  *
5
- * Use this type for unknown (unexpected) errors that need to be transferred
6
- * across boundaries where native Error objects cannot be sent directly. Not
7
- * intended for regular (expected) errors.
4
+ * @module
5
+ */
6
+ import type { Typed } from "./Type.js";
7
+ /**
8
+ * A wrapper for unknown errors caught at runtime.
9
+ *
10
+ * When catching errors from unsafe code (third-party libraries, worker
11
+ * boundaries, etc.), we wrap them in `UnknownError` so they can be used in
12
+ * union types and distinguished from other error types.
13
+ *
14
+ * The `error` property contains error details (including `message`, `stack`,
15
+ * and `cause` if available), a string, or a fallback value.
8
16
  *
9
- * The `error` property contains a plain object with error details, a string, or
10
- * a fallback value if serialization fails to preserve as much debugging
11
- * information as possible.
17
+ * Use {@link createUnknownError} to create instances.
12
18
  */
13
- export interface TransferableError {
14
- readonly type: "TransferableError";
19
+ export interface UnknownError extends Typed<"UnknownError"> {
15
20
  readonly error: unknown;
16
21
  }
17
- /** Creates a {@link TransferableError} from an unknown error. */
18
- export declare const createTransferableError: (error: unknown) => TransferableError;
22
+ /**
23
+ * Creates an {@link UnknownError} from an unknown error.
24
+ *
25
+ * Error objects cannot be directly structured-cloned (for worker messaging) or
26
+ * JSON-serialized because their properties (`message`, `stack`, `cause`) are
27
+ * non-enumerable. This function extracts those properties into a plain object.
28
+ */
29
+ export declare const createUnknownError: (error: unknown) => UnknownError;
19
30
  //# sourceMappingURL=Error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,iEAAiE;AACjE,eAAO,MAAM,uBAAuB,GAAI,OAAO,OAAO,KAAG,iBA+CxD,CAAC"}
1
+ {"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC;IACzD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,YAkDnD,CAAC"}
package/dist/src/Error.js CHANGED
@@ -1,7 +1,18 @@
1
- /** Creates a {@link TransferableError} from an unknown error. */
2
- export const createTransferableError = (error) => {
1
+ /**
2
+ * Error types and utilities for safe error handling.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Creates an {@link UnknownError} from an unknown error.
8
+ *
9
+ * Error objects cannot be directly structured-cloned (for worker messaging) or
10
+ * JSON-serialized because their properties (`message`, `stack`, `cause`) are
11
+ * non-enumerable. This function extracts those properties into a plain object.
12
+ */
13
+ export const createUnknownError = (error) => {
3
14
  const convertError = (err) => {
4
- const transferableError = Object.getOwnPropertyNames(err).reduce((acc, key) => {
15
+ const result = Object.getOwnPropertyNames(err).reduce((acc, key) => {
5
16
  const value = err[key];
6
17
  if (key === "cause" && value instanceof Error) {
7
18
  // Recursively process the `cause` property
@@ -12,33 +23,38 @@ export const createTransferableError = (error) => {
12
23
  }
13
24
  return acc;
14
25
  }, {});
15
- return transferableError;
26
+ // Firefox defines `stack` as a getter on Error.prototype, not as an own
27
+ // property, so getOwnPropertyNames misses it. Explicitly include it.
28
+ if (err.stack !== undefined && !("stack" in result)) {
29
+ result.stack = err.stack;
30
+ }
31
+ return result;
16
32
  };
17
33
  if (error instanceof Error) {
18
34
  return {
19
- type: "TransferableError",
35
+ type: "UnknownError",
20
36
  error: convertError(error),
21
37
  };
22
38
  }
23
39
  try {
24
- // Clone other values that are transferable
40
+ // Clone other values that are structured-clonable
25
41
  return {
26
- type: "TransferableError",
42
+ type: "UnknownError",
27
43
  error: structuredClone(error),
28
44
  };
29
45
  }
30
46
  catch {
31
- // Fallback for non-transferable or problematic values
47
+ // Fallback for non-clonable values
32
48
  try {
33
49
  return {
34
- type: "TransferableError",
35
- error: String(error), // Attempt to convert to a string
50
+ type: "UnknownError",
51
+ error: String(error),
36
52
  };
37
53
  }
38
54
  catch {
39
55
  // Final fallback if even `String(error)` fails
40
56
  return {
41
- type: "TransferableError",
57
+ type: "UnknownError",
42
58
  error: "[Unserializable Object]",
43
59
  };
44
60
  }
@@ -1,18 +1,18 @@
1
- import { NonEmptyArray, NonEmptyReadonlyArray } from "./Array.js";
2
- import { ReadonlyRecord } from "./Object.js";
1
+ /**
2
+ * Function utilities including exhaustive checks and composition.
3
+ *
4
+ * @module
5
+ */
3
6
  /**
4
7
  * Helper function to ensure exhaustive matching in a switch statement. Throws
5
8
  * an error if an unhandled case is encountered.
6
9
  *
7
- * Remember, it's useful only when we don't return anything from the switch
8
- * statement. Otherwise, a return type of a function is enough.
9
- *
10
10
  * ### Example
11
11
  *
12
12
  * ```ts
13
13
  * type Color = "red" | "green" | "blue";
14
14
  *
15
- * function handleColor(color: Color): void {
15
+ * const handleColor = (color: Color): void => {
16
16
  * switch (color) {
17
17
  * case "red":
18
18
  * console.log("Handling red");
@@ -26,12 +26,68 @@ import { ReadonlyRecord } from "./Object.js";
26
26
  * default:
27
27
  * exhaustiveCheck(color); // Ensures all cases are handled
28
28
  * }
29
- * }
29
+ * };
30
+ * ```
31
+ *
32
+ * Use this primarily in side-effect switches (`void` branches). For
33
+ * value-producing switches, TypeScript can enforce exhaustiveness without a
34
+ * `default` branch.
35
+ *
36
+ * ### Example
37
+ *
38
+ * Return from each case for value-producing switches.
39
+ *
40
+ * ```ts
41
+ * type Color = "red" | "green" | "blue";
42
+ *
43
+ * const colorToHex = (color: Color): string => {
44
+ * switch (color) {
45
+ * case "red":
46
+ * return "#ff0000";
47
+ * case "green":
48
+ * return "#00ff00";
49
+ * case "blue":
50
+ * return "#0000ff";
51
+ * }
52
+ * };
53
+ * ```
54
+ *
55
+ * ### Example
56
+ *
57
+ * Use assignment + no `default` to get exhaustiveness by definite assignment.
58
+ *
59
+ * ```ts
60
+ * type Input =
61
+ * | { readonly type: "Mutate" }
62
+ * | { readonly type: "Query" }
63
+ * | { readonly type: "Export" };
64
+ *
65
+ * const onInput = (input: Input): void => {
66
+ * let result: "A" | "B" | "C";
67
+ *
68
+ * switch (input.type) {
69
+ * case "Mutate":
70
+ * result = "A";
71
+ * break;
72
+ * case "Query":
73
+ * result = "B";
74
+ * break;
75
+ * case "Export":
76
+ * result = "C";
77
+ * break;
78
+ * }
79
+ *
80
+ * handleKind(result);
81
+ * };
82
+ *
83
+ * const handleKind = (kind: "A" | "B" | "C"): void => {
84
+ * console.log(kind);
85
+ * };
30
86
  * ```
31
87
  */
32
88
  export declare const exhaustiveCheck: (value: never) => never;
33
89
  /**
34
- * Returns the input value unchanged.
90
+ * Returns the value unchanged.
35
91
  *
36
92
  * Useful as a default transformation, placeholder callback, or when a function
37
93
  * is required but no transformation is needed.
@@ -48,68 +104,84 @@ export declare const exhaustiveCheck: (value: never) => never;
48
104
  */
49
105
  export declare const identity: <A>(a: A) => A;
50
106
  /**
51
- * Casts an array, set, record, or map to its readonly counterpart.
107
+ * A function that takes no arguments and returns a value of type T. Also known
108
+ * as a thunk.
109
+ *
110
+ * Useful for:
52
111
  *
53
- * Zero runtime cost returns the same value with a readonly type. Use this to
54
- * enforce immutability at the type level. Preserves {@link NonEmptyArray} as
55
- * {@link NonEmptyReadonlyArray}.
112
+ * - Providing default callbacks (see {@link lazyVoid}, {@link lazyTrue}, etc.)
113
+ * - Delaying expensive operations until actually needed
114
+ * - Deferring side effects so the callee controls when they run
56
115
  *
57
116
  * ### Example
58
117
  *
59
118
  * ```ts
60
- * // Array literals become NonEmptyReadonlyArray
61
- * const items = readonly([1, 2, 3]);
62
- * // Type: NonEmptyReadonlyArray<number>
63
- *
64
- * // NonEmptyArray is preserved as NonEmptyReadonlyArray
65
- * const nonEmpty: NonEmptyArray<number> = [1, 2, 3];
66
- * const readonlyNonEmpty = readonly(nonEmpty);
67
- * // Type: NonEmptyReadonlyArray<number>
68
- *
69
- * // Regular arrays become ReadonlyArray
70
- * const arr: Array<number> = getNumbers();
71
- * const readonlyArr = readonly(arr);
72
- * // Type: ReadonlyArray<number>
73
- *
74
- * // Sets, Records, and Maps
75
- * const ids = readonly(new Set(["a", "b"]));
76
- * // Type: ReadonlySet<string>
77
- *
78
- * const users: Record<UserId, string> = { ... };
79
- * const readonlyUsers = readonly(users);
80
- * // Type: ReadonlyRecord<UserId, string>
81
- *
82
- * const lookup = readonly(new Map([["key", "value"]]));
83
- * // Type: ReadonlyMap<string, string>
119
+ * // Default callback
120
+ * const notify = (onDone: Lazy<void> = lazyVoid) => {
121
+ * onDone();
122
+ * };
123
+ *
124
+ * // Delay computation
125
+ * const getData: Lazy<Data> = () => compute();
126
+ * const data = getData();
127
+ *
128
+ * // Defer side effects
129
+ * const schedule = (job: Lazy<void>) => {
130
+ * queueMicrotask(job);
131
+ * };
132
+ * schedule(() => logMetric("loaded"));
84
133
  * ```
85
- *
86
- * @experimental
87
134
  */
88
- export declare function readonly<T>(array: NonEmptyArray<T>): NonEmptyReadonlyArray<T>;
89
- export declare function readonly<T>(array: Array<T>): ReadonlyArray<T>;
90
- export declare function readonly<T>(set: Set<T>): ReadonlySet<T>;
91
- export declare function readonly<K, V>(map: Map<K, V>): ReadonlyMap<K, V>;
92
- export declare function readonly<K extends keyof any, V>(record: Record<K, V>): ReadonlyRecord<K, V>;
135
+ export type Lazy<T> = () => T;
93
136
  /**
94
- * A function that delays computation and returns a value of type T.
137
+ * Creates a {@link Lazy} from a precomputed value.
95
138
  *
96
- * Useful for:
139
+ * Use when the value is expensive to compute and want to compute it once at
140
+ * definition time rather than on every call.
97
141
  *
98
- * - Lazy evaluation
99
- * - Returning constant values
100
- * - Providing default or placeholder behaviors
142
+ * ### Example
143
+ *
144
+ * ```ts
145
+ * // Computed once at definition, returned on every call
146
+ * const getConfig = lazy(parseConfig(rawConfig));
147
+ *
148
+ * // vs. computed on every call
149
+ * const getConfig = () => parseConfig(rawConfig);
150
+ * ```
151
+ */
152
+ export declare const lazy: <T>(value: T) => Lazy<T>;
153
+ /** A {@link Lazy} that returns `true`. */
154
+ export declare const lazyTrue: Lazy<true>;
155
+ /** A {@link Lazy} that returns `false`. */
156
+ export declare const lazyFalse: Lazy<false>;
157
+ /** A {@link Lazy} that returns `null`. */
158
+ export declare const lazyNull: Lazy<null>;
159
+ /** A {@link Lazy} that returns `undefined`. */
160
+ export declare const lazyUndefined: Lazy<undefined>;
161
+ /** A {@link Lazy} that returns `undefined` for void callbacks. */
162
+ export declare const lazyVoid: Lazy<void>;
163
+ /**
164
+ * Development placeholder that always throws.
165
+ *
166
+ * Use to sketch function bodies before implementing them. TypeScript infers the
167
+ * return type from context, so surrounding code still type-checks. Use an
168
+ * explicit generic when there is no return type annotation.
101
169
  *
102
170
  * ### Example
103
171
  *
104
172
  * ```ts
105
- * const getRandomNumber: LazyValue<number> = () => Math.random();
106
- * const randomValue = getRandomNumber();
173
+ * // Type inferred from return type annotation
174
+ * const fetchUser = (id: UserId): Result<User, FetchError> => todo();
175
+ *
176
+ * expectTypeOf(fetchUser).returns.toEqualTypeOf<
177
+ * Result<User, FetchError>
178
+ * >();
179
+ *
180
+ * // Explicit generic when no return type
181
+ * const getConfig = () => todo<Config>();
182
+ *
183
+ * expectTypeOf(getConfig).returns.toEqualTypeOf<Config>();
107
184
  * ```
108
185
  */
109
- export type LazyValue<T> = () => T;
110
- export declare const constVoid: LazyValue<void>;
111
- export declare const constUndefined: LazyValue<undefined>;
112
- export declare const constNull: LazyValue<null>;
113
- export declare const constTrue: LazyValue<true>;
114
- export declare const constFalse: LazyValue<false>;
186
+ export declare const todo: <T>() => T;
115
187
  //# sourceMappingURL=Function.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Function.d.ts","sourceRoot":"","sources":["../../src/Function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,KAAK,KAAG,KAE9C,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,GAAI,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