@evolu/common 8.9.0 → 8.11.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 (337) hide show
  1. package/dist/src/Bytes.d.ts +647 -0
  2. package/dist/src/Bytes.d.ts.map +1 -0
  3. package/dist/src/{Binary.js → Bytes.js} +266 -16
  4. package/dist/src/Config.d.ts +142 -0
  5. package/dist/src/Config.d.ts.map +1 -0
  6. package/dist/src/Config.js +181 -0
  7. package/dist/src/Console.d.ts +62 -7
  8. package/dist/src/Console.d.ts.map +1 -1
  9. package/dist/src/Console.js +20 -4
  10. package/dist/src/Crypto.d.ts +76 -4
  11. package/dist/src/Crypto.d.ts.map +1 -1
  12. package/dist/src/Crypto.js +55 -4
  13. package/dist/src/Error.d.ts +45 -0
  14. package/dist/src/Error.d.ts.map +1 -1
  15. package/dist/src/Error.js +69 -0
  16. package/dist/src/Fs.d.ts +376 -0
  17. package/dist/src/Fs.d.ts.map +1 -0
  18. package/dist/src/Fs.js +113 -0
  19. package/dist/src/Identicon.d.ts +2 -2
  20. package/dist/src/Identicon.js +2 -2
  21. package/dist/src/LeakDetector.d.ts +22 -3
  22. package/dist/src/LeakDetector.d.ts.map +1 -1
  23. package/dist/src/LeakDetector.js +12 -2
  24. package/dist/src/LockManager.d.ts +8 -0
  25. package/dist/src/LockManager.d.ts.map +1 -1
  26. package/dist/src/LockManager.js +6 -0
  27. package/dist/src/Number.d.ts +50 -7
  28. package/dist/src/Number.d.ts.map +1 -1
  29. package/dist/src/Number.js +47 -8
  30. package/dist/src/Object.d.ts +32 -0
  31. package/dist/src/Object.d.ts.map +1 -1
  32. package/dist/src/Object.js +46 -0
  33. package/dist/src/Platform.d.ts +47 -7
  34. package/dist/src/Platform.d.ts.map +1 -1
  35. package/dist/src/Platform.js +24 -5
  36. package/dist/src/Random.d.ts +25 -2
  37. package/dist/src/Random.d.ts.map +1 -1
  38. package/dist/src/Random.js +14 -2
  39. package/dist/src/Resource.d.ts +156 -1
  40. package/dist/src/Resource.d.ts.map +1 -1
  41. package/dist/src/Resource.js +201 -72
  42. package/dist/src/Schedule.d.ts +11 -10
  43. package/dist/src/Schedule.d.ts.map +1 -1
  44. package/dist/src/Schedule.js +1 -1
  45. package/dist/src/Sqlite.d.ts +132 -16
  46. package/dist/src/Sqlite.d.ts.map +1 -1
  47. package/dist/src/Sqlite.js +64 -10
  48. package/dist/src/Task.d.ts +15 -4
  49. package/dist/src/Task.d.ts.map +1 -1
  50. package/dist/src/Task.js +41 -15
  51. package/dist/src/Test.d.ts +9 -0
  52. package/dist/src/Test.d.ts.map +1 -1
  53. package/dist/src/Test.js +4 -0
  54. package/dist/src/Time.d.ts +179 -20
  55. package/dist/src/Time.d.ts.map +1 -1
  56. package/dist/src/Time.js +95 -6
  57. package/dist/src/Type.d.ts +3056 -1539
  58. package/dist/src/Type.d.ts.map +1 -1
  59. package/dist/src/Type.js +2548 -584
  60. package/dist/src/WebSocket.d.ts +164 -13
  61. package/dist/src/WebSocket.d.ts.map +1 -1
  62. package/dist/src/WebSocket.js +133 -24
  63. package/dist/src/Worker.d.ts +90 -8
  64. package/dist/src/Worker.d.ts.map +1 -1
  65. package/dist/src/Worker.js +28 -2
  66. package/dist/src/index.d.ts +9 -8
  67. package/dist/src/index.d.ts.map +1 -1
  68. package/dist/src/index.js +5 -4
  69. package/dist/src/intl/_en.d.ts +24 -1
  70. package/dist/src/intl/_en.d.ts.map +1 -1
  71. package/dist/src/intl/_en.js +20 -0
  72. package/dist/src/intl/ar.d.ts +24 -1
  73. package/dist/src/intl/ar.d.ts.map +1 -1
  74. package/dist/src/intl/ar.js +20 -0
  75. package/dist/src/intl/bn.d.ts +24 -1
  76. package/dist/src/intl/bn.d.ts.map +1 -1
  77. package/dist/src/intl/bn.js +20 -0
  78. package/dist/src/intl/ca.d.ts +24 -1
  79. package/dist/src/intl/ca.d.ts.map +1 -1
  80. package/dist/src/intl/ca.js +20 -0
  81. package/dist/src/intl/cs.d.ts +24 -1
  82. package/dist/src/intl/cs.d.ts.map +1 -1
  83. package/dist/src/intl/cs.js +20 -0
  84. package/dist/src/intl/da.d.ts +24 -1
  85. package/dist/src/intl/da.d.ts.map +1 -1
  86. package/dist/src/intl/da.js +20 -0
  87. package/dist/src/intl/de.d.ts +24 -1
  88. package/dist/src/intl/de.d.ts.map +1 -1
  89. package/dist/src/intl/de.js +20 -0
  90. package/dist/src/intl/el.d.ts +24 -1
  91. package/dist/src/intl/el.d.ts.map +1 -1
  92. package/dist/src/intl/el.js +20 -0
  93. package/dist/src/intl/es.d.ts +24 -1
  94. package/dist/src/intl/es.d.ts.map +1 -1
  95. package/dist/src/intl/es.js +20 -0
  96. package/dist/src/intl/fa.d.ts +24 -1
  97. package/dist/src/intl/fa.d.ts.map +1 -1
  98. package/dist/src/intl/fa.js +20 -0
  99. package/dist/src/intl/fi.d.ts +24 -1
  100. package/dist/src/intl/fi.d.ts.map +1 -1
  101. package/dist/src/intl/fi.js +20 -0
  102. package/dist/src/intl/fil.d.ts +24 -1
  103. package/dist/src/intl/fil.d.ts.map +1 -1
  104. package/dist/src/intl/fil.js +20 -0
  105. package/dist/src/intl/fr.d.ts +24 -1
  106. package/dist/src/intl/fr.d.ts.map +1 -1
  107. package/dist/src/intl/fr.js +20 -0
  108. package/dist/src/intl/he.d.ts +24 -1
  109. package/dist/src/intl/he.d.ts.map +1 -1
  110. package/dist/src/intl/he.js +20 -0
  111. package/dist/src/intl/hi.d.ts +24 -1
  112. package/dist/src/intl/hi.d.ts.map +1 -1
  113. package/dist/src/intl/hi.js +20 -0
  114. package/dist/src/intl/hr.d.ts +24 -1
  115. package/dist/src/intl/hr.d.ts.map +1 -1
  116. package/dist/src/intl/hr.js +20 -0
  117. package/dist/src/intl/hu.d.ts +22 -1
  118. package/dist/src/intl/hu.d.ts.map +1 -1
  119. package/dist/src/intl/hu.js +18 -0
  120. package/dist/src/intl/id.d.ts +24 -1
  121. package/dist/src/intl/id.d.ts.map +1 -1
  122. package/dist/src/intl/id.js +20 -0
  123. package/dist/src/intl/it.d.ts +24 -1
  124. package/dist/src/intl/it.d.ts.map +1 -1
  125. package/dist/src/intl/it.js +20 -0
  126. package/dist/src/intl/ja.d.ts +24 -1
  127. package/dist/src/intl/ja.d.ts.map +1 -1
  128. package/dist/src/intl/ja.js +20 -0
  129. package/dist/src/intl/ko.d.ts +24 -1
  130. package/dist/src/intl/ko.d.ts.map +1 -1
  131. package/dist/src/intl/ko.js +20 -0
  132. package/dist/src/intl/ml.d.ts +24 -1
  133. package/dist/src/intl/ml.d.ts.map +1 -1
  134. package/dist/src/intl/ml.js +20 -0
  135. package/dist/src/intl/mr.d.ts +24 -1
  136. package/dist/src/intl/mr.d.ts.map +1 -1
  137. package/dist/src/intl/mr.js +20 -0
  138. package/dist/src/intl/ms.d.ts +24 -1
  139. package/dist/src/intl/ms.d.ts.map +1 -1
  140. package/dist/src/intl/ms.js +20 -0
  141. package/dist/src/intl/nb.d.ts +22 -1
  142. package/dist/src/intl/nb.d.ts.map +1 -1
  143. package/dist/src/intl/nb.js +18 -0
  144. package/dist/src/intl/nl.d.ts +24 -1
  145. package/dist/src/intl/nl.d.ts.map +1 -1
  146. package/dist/src/intl/nl.js +20 -0
  147. package/dist/src/intl/pa.d.ts +24 -1
  148. package/dist/src/intl/pa.d.ts.map +1 -1
  149. package/dist/src/intl/pa.js +20 -0
  150. package/dist/src/intl/pl.d.ts +23 -0
  151. package/dist/src/intl/pl.d.ts.map +1 -1
  152. package/dist/src/intl/pl.js +20 -0
  153. package/dist/src/intl/pt-BR.d.ts +24 -1
  154. package/dist/src/intl/pt-BR.d.ts.map +1 -1
  155. package/dist/src/intl/pt-BR.js +20 -0
  156. package/dist/src/intl/pt.d.ts +24 -1
  157. package/dist/src/intl/pt.d.ts.map +1 -1
  158. package/dist/src/intl/pt.js +20 -0
  159. package/dist/src/intl/ro.d.ts +24 -1
  160. package/dist/src/intl/ro.d.ts.map +1 -1
  161. package/dist/src/intl/ro.js +20 -0
  162. package/dist/src/intl/sk.d.ts +24 -1
  163. package/dist/src/intl/sk.d.ts.map +1 -1
  164. package/dist/src/intl/sk.js +20 -0
  165. package/dist/src/intl/sl.d.ts +24 -1
  166. package/dist/src/intl/sl.d.ts.map +1 -1
  167. package/dist/src/intl/sl.js +20 -0
  168. package/dist/src/intl/sv.d.ts +24 -1
  169. package/dist/src/intl/sv.d.ts.map +1 -1
  170. package/dist/src/intl/sv.js +20 -0
  171. package/dist/src/intl/sw.d.ts +21 -0
  172. package/dist/src/intl/sw.d.ts.map +1 -1
  173. package/dist/src/intl/sw.js +18 -0
  174. package/dist/src/intl/ta.d.ts +24 -1
  175. package/dist/src/intl/ta.d.ts.map +1 -1
  176. package/dist/src/intl/ta.js +20 -0
  177. package/dist/src/intl/te.d.ts +24 -1
  178. package/dist/src/intl/te.d.ts.map +1 -1
  179. package/dist/src/intl/te.js +20 -0
  180. package/dist/src/intl/th.d.ts +24 -1
  181. package/dist/src/intl/th.d.ts.map +1 -1
  182. package/dist/src/intl/th.js +20 -0
  183. package/dist/src/intl/tr.d.ts +24 -1
  184. package/dist/src/intl/tr.d.ts.map +1 -1
  185. package/dist/src/intl/tr.js +20 -0
  186. package/dist/src/intl/uk.d.ts +80 -57
  187. package/dist/src/intl/uk.d.ts.map +1 -1
  188. package/dist/src/intl/uk.js +174 -149
  189. package/dist/src/intl/ur.d.ts +24 -1
  190. package/dist/src/intl/ur.d.ts.map +1 -1
  191. package/dist/src/intl/ur.js +20 -0
  192. package/dist/src/intl/vi.d.ts +24 -1
  193. package/dist/src/intl/vi.d.ts.map +1 -1
  194. package/dist/src/intl/vi.js +20 -0
  195. package/dist/src/intl/zh-CN.d.ts +24 -1
  196. package/dist/src/intl/zh-CN.d.ts.map +1 -1
  197. package/dist/src/intl/zh-CN.js +20 -0
  198. package/dist/src/intl/zh-TW.d.ts +24 -1
  199. package/dist/src/intl/zh-TW.d.ts.map +1 -1
  200. package/dist/src/intl/zh-TW.js +20 -0
  201. package/dist/src/local-first/Db.d.ts +52 -3
  202. package/dist/src/local-first/Db.d.ts.map +1 -1
  203. package/dist/src/local-first/Db.js +412 -137
  204. package/dist/src/local-first/Evolu.d.ts +336 -211
  205. package/dist/src/local-first/Evolu.d.ts.map +1 -1
  206. package/dist/src/local-first/Evolu.js +102 -15
  207. package/dist/src/local-first/Owner.d.ts +13 -30
  208. package/dist/src/local-first/Owner.d.ts.map +1 -1
  209. package/dist/src/local-first/Owner.js +13 -30
  210. package/dist/src/local-first/Protocol.d.ts +95 -17
  211. package/dist/src/local-first/Protocol.d.ts.map +1 -1
  212. package/dist/src/local-first/Protocol.js +119 -39
  213. package/dist/src/local-first/Query.d.ts +8 -15
  214. package/dist/src/local-first/Query.d.ts.map +1 -1
  215. package/dist/src/local-first/Schema.d.ts +345 -21
  216. package/dist/src/local-first/Schema.d.ts.map +1 -1
  217. package/dist/src/local-first/Schema.js +214 -17
  218. package/dist/src/local-first/Shared.d.ts +537 -22
  219. package/dist/src/local-first/Shared.d.ts.map +1 -1
  220. package/dist/src/local-first/Shared.js +1437 -234
  221. package/dist/src/local-first/Storage.d.ts +192 -14
  222. package/dist/src/local-first/Storage.d.ts.map +1 -1
  223. package/dist/src/local-first/Storage.js +82 -21
  224. package/dist/src/local-first/Timestamp.d.ts +392 -41
  225. package/dist/src/local-first/Timestamp.d.ts.map +1 -1
  226. package/dist/src/local-first/Timestamp.js +404 -82
  227. package/dist/src/local-first/index.d.ts +0 -1
  228. package/dist/src/local-first/index.d.ts.map +1 -1
  229. package/dist/src/local-first/index.js +0 -1
  230. package/package.json +1 -1
  231. package/src/Assert.test.ts +2 -5
  232. package/src/{Binary.test.ts → Bytes.test.ts} +286 -1
  233. package/src/{Binary.ts → Bytes.ts} +652 -21
  234. package/src/Config.test.ts +668 -0
  235. package/src/Config.ts +410 -0
  236. package/src/Console.ts +62 -7
  237. package/src/Crypto.ts +76 -4
  238. package/src/Eq.test.ts +2 -3
  239. package/src/Error.test.ts +76 -3
  240. package/src/Error.ts +71 -0
  241. package/src/Fs.test.ts +105 -0
  242. package/src/Fs.ts +488 -0
  243. package/src/Identicon.ts +2 -2
  244. package/src/LeakDetector.ts +22 -3
  245. package/src/LockManager.ts +8 -0
  246. package/src/Number.test.ts +82 -18
  247. package/src/Number.ts +76 -8
  248. package/src/Object.test.ts +139 -10
  249. package/src/Object.ts +49 -0
  250. package/src/Platform.ts +50 -8
  251. package/src/Random.ts +25 -2
  252. package/src/Resource.test.ts +837 -0
  253. package/src/Resource.ts +235 -15
  254. package/src/Schedule.test.ts +50 -12
  255. package/src/Schedule.ts +24 -14
  256. package/src/Sqlite.ts +138 -18
  257. package/src/Task.test.ts +189 -8
  258. package/src/Task.ts +56 -17
  259. package/src/Test.ts +9 -0
  260. package/src/Time.test.ts +82 -11
  261. package/src/Time.ts +246 -24
  262. package/src/Type.test.ts +3994 -1119
  263. package/src/Type.ts +7258 -3842
  264. package/src/Types.test.ts +4 -14
  265. package/src/WebSocket.ts +313 -40
  266. package/src/Worker.ts +90 -8
  267. package/src/index.ts +18 -7
  268. package/src/intl/_en.ts +70 -0
  269. package/src/intl/ar.ts +71 -0
  270. package/src/intl/bn.ts +70 -0
  271. package/src/intl/ca.ts +70 -0
  272. package/src/intl/cs.ts +70 -0
  273. package/src/intl/da.ts +70 -0
  274. package/src/intl/de.ts +70 -0
  275. package/src/intl/el.ts +70 -0
  276. package/src/intl/es.ts +70 -0
  277. package/src/intl/fa.ts +70 -0
  278. package/src/intl/fi.ts +70 -0
  279. package/src/intl/fil.ts +70 -0
  280. package/src/intl/fr.ts +70 -0
  281. package/src/intl/he.ts +70 -0
  282. package/src/intl/hi.ts +70 -0
  283. package/src/intl/hr.ts +70 -0
  284. package/src/intl/hu.ts +69 -0
  285. package/src/intl/id.ts +70 -0
  286. package/src/intl/intl.test.ts +819 -1
  287. package/src/intl/it.ts +70 -0
  288. package/src/intl/ja.ts +70 -0
  289. package/src/intl/ko.ts +68 -0
  290. package/src/intl/ml.ts +70 -0
  291. package/src/intl/mr.ts +70 -0
  292. package/src/intl/ms.ts +71 -0
  293. package/src/intl/nb.ts +69 -0
  294. package/src/intl/nl.ts +70 -0
  295. package/src/intl/pa.ts +70 -0
  296. package/src/intl/pl.ts +63 -0
  297. package/src/intl/pt-BR.ts +70 -0
  298. package/src/intl/pt.ts +71 -0
  299. package/src/intl/ro.ts +70 -0
  300. package/src/intl/sk.ts +71 -0
  301. package/src/intl/sl.ts +70 -0
  302. package/src/intl/sv.ts +70 -0
  303. package/src/intl/sw.ts +62 -0
  304. package/src/intl/ta.ts +70 -0
  305. package/src/intl/te.ts +70 -0
  306. package/src/intl/th.ts +68 -0
  307. package/src/intl/tr.ts +70 -0
  308. package/src/intl/uk.ts +228 -155
  309. package/src/intl/ur.ts +70 -0
  310. package/src/intl/vi.ts +70 -0
  311. package/src/intl/zh-CN.ts +68 -0
  312. package/src/intl/zh-TW.ts +68 -0
  313. package/src/local-first/Db.ts +644 -339
  314. package/src/local-first/Evolu.test.ts +686 -21
  315. package/src/local-first/Evolu.ts +450 -228
  316. package/src/local-first/Owner.ts +13 -30
  317. package/src/local-first/Protocol.test.ts +618 -11
  318. package/src/local-first/Protocol.ts +197 -73
  319. package/src/local-first/Query.ts +8 -15
  320. package/src/local-first/Schema.test.ts +143 -0
  321. package/src/local-first/Schema.ts +374 -24
  322. package/src/local-first/Shared.test.ts +7731 -559
  323. package/src/local-first/Shared.ts +2036 -267
  324. package/src/local-first/Storage.ts +219 -33
  325. package/src/local-first/Timestamp.test.ts +344 -70
  326. package/src/local-first/Timestamp.ts +435 -119
  327. package/src/local-first/index.ts +0 -1
  328. package/dist/src/Binary.d.ts +0 -254
  329. package/dist/src/Binary.d.ts.map +0 -1
  330. package/dist/src/local-first/Error.d.ts +0 -12
  331. package/dist/src/local-first/Error.d.ts.map +0 -1
  332. package/dist/src/local-first/Error.js +0 -6
  333. package/dist/src/local-first/LocalAuth.d.ts +0 -150
  334. package/dist/src/local-first/LocalAuth.d.ts.map +0 -1
  335. package/dist/src/local-first/LocalAuth.js +0 -179
  336. package/src/local-first/Error.ts +0 -17
  337. package/src/local-first/LocalAuth.ts +0 -457
@@ -0,0 +1,181 @@
1
+ /**
2
+ * Strict configuration Types with explicit application policy.
3
+ *
4
+ * Decode configuration at startup, then pass validated values to constructors
5
+ * or Tasks. The application decides how to load configuration, combine sources,
6
+ * and apply defaults. Declare defaults with {@link withDefault}, or use `??`
7
+ * where a value is consumed. Invalid supplied values still fail decoding.
8
+ *
9
+ * Resolve source precedence before replacing absence with defaults. If a source
10
+ * Type already provides defaults and later composition needs to distinguish
11
+ * them from supplied values, use `strategy: "preserve"` and inspect
12
+ * `defaultUsed` explicitly. Preserving this evidence does not choose a merging
13
+ * policy: the application still decides which source wins.
14
+ *
15
+ * {@link env} creates a pure, reversible codec. It does not read global state,
16
+ * load files, merge sources, or introduce a Run dependency. Tests can pass
17
+ * ordinary objects; a Node.js entry point can pass `process.env`.
18
+ *
19
+ * @module
20
+ */
21
+ import { assert } from "./Assert.js";
22
+ import { createMutableRecord, filterObjectKeys, isPlainObject, } from "./Object.js";
23
+ import { ok } from "./Result.js";
24
+ import { CamelCaseIdentifier, camelCaseToConstantCase, ConstantCaseIdentifier, EvoluType, maxLength, object, objectKeys, String, transform, Unknown, } from "./Type.js";
25
+ /**
26
+ * An environment variable name in Evolu's configuration convention.
27
+ *
28
+ * Names are {@link ConstantCaseIdentifier}s of at most 255 characters, including
29
+ * the application prefix. This is an Evolu convention, not an operating-system
30
+ * limit. Double underscores do not introduce nesting.
31
+ *
32
+ * ### Example
33
+ *
34
+ * ```ts
35
+ * import { assertErr, assertOk, EnvName } from "@evolu/common";
36
+ *
37
+ * assertOk(
38
+ * EnvName.fromUnknown("APP_MAX_OWNER_BYTES"),
39
+ * "APP_MAX_OWNER_BYTES",
40
+ * );
41
+ * assertErr(EnvName.fromUnknown("APP_maxOwnerBytes"));
42
+ * assertErr(EnvName.fromUnknown("APP_DB__PORT"));
43
+ * ```
44
+ */
45
+ export const EnvName = /*#__PURE__*/ maxLength(255)(ConstantCaseIdentifier);
46
+ /**
47
+ * Creates a reversible environment-variable codec with a flat decoded output.
48
+ *
49
+ * Declare camelCase fields directly, or put them in one-level CONSTANT_CASE
50
+ * namespace groups. A direct `port` field reads `PORT`; a `maxOwnerBytes` field
51
+ * in an `EVOLU_RELAY` group reads `EVOLU_RELAY_MAX_OWNER_BYTES`. Groups affect
52
+ * external names only. Duplicate decoded fields or encoded names are rejected
53
+ * during construction, even when their Types are identical.
54
+ *
55
+ * Selects exact declared unprefixed names and all keys within declared
56
+ * namespaces. Namespace selection ignores casing so incorrectly cased names
57
+ * fail validation instead of being ignored. Selected names must match their
58
+ * exact declared spelling. Unrelated variables are ignored; misspelled
59
+ * unprefixed names or namespace prefixes can therefore still look absent.
60
+ *
61
+ * Field Types must encode to strings. Optional fields may be absent, but
62
+ * explicit `undefined` values are rejected. Empty strings remain present and
63
+ * must satisfy the field Type. Compose {@link withDefault} to supply defaults.
64
+ * Encoding emits canonical external names and string values, preserving absence
65
+ * when the field codec does. Errors retain external names and nested paths.
66
+ *
67
+ * Reads own string properties from any non-null object, including
68
+ * `process.env`. Selected properties must be enumerable data properties;
69
+ * getters are never read. Prototypes and internal contents such as Map entries
70
+ * are ignored. Non-object inputs fail with standard object errors. Schema names
71
+ * must satisfy {@link EnvName}; groups cannot be nested. Loading and source
72
+ * precedence remain explicit application code.
73
+ *
74
+ * ### Example
75
+ *
76
+ * ```ts
77
+ * import {
78
+ * assertEqual,
79
+ * assertErr,
80
+ * assertOk,
81
+ * assertType,
82
+ * ByteSizeLiteral,
83
+ * env,
84
+ * optional,
85
+ * Port,
86
+ * PortFromString,
87
+ * withDefault,
88
+ * } from "@evolu/common";
89
+ *
90
+ * const RelayEnv = env({
91
+ * port: withDefault(optional(PortFromString), Port.orThrow(4000)),
92
+ * EVOLU_RELAY: {
93
+ * maxOwnerBytes: optional(ByteSizeLiteral),
94
+ * },
95
+ * });
96
+ *
97
+ * const result = RelayEnv.fromUnknown({
98
+ * PORT: "04000",
99
+ * EVOLU_RELAY_MAX_OWNER_BYTES: "512KiB",
100
+ * HOME: "/home/evolu",
101
+ * });
102
+ *
103
+ * assertOk(result, { port: 4000, maxOwnerBytes: "512KiB" });
104
+ * assertType<typeof result.value.port, Port>();
105
+ * assertEqual(RelayEnv.to(result.value), {
106
+ * PORT: "4000",
107
+ * EVOLU_RELAY_MAX_OWNER_BYTES: "512KiB",
108
+ * });
109
+ *
110
+ * assertOk(RelayEnv.fromUnknown({}), { port: 4000 });
111
+ * assertErr(RelayEnv.fromUnknown({ PORT: "" }));
112
+ * assertErr(RelayEnv.fromUnknown({ EVOLU_RELAY_MAX_OWENR_BYTES: "1MiB" }));
113
+ * assertErr(RelayEnv.fromUnknown({ evolu_relay_max_owner_bytes: "1MiB" }));
114
+ * ```
115
+ */
116
+ export const env = (props, ..._validation) => {
117
+ assert(isPlainObject(props), "Environment properties must be a plain object.");
118
+ const flat = createMutableRecord();
119
+ const inputNameByOutputName = new Map();
120
+ const outputNameByInputName = new Map();
121
+ const prefixes = [];
122
+ const unprefixedNames = new Set();
123
+ for (const rootName of Reflect.ownKeys(props)) {
124
+ const descriptor = Object.getOwnPropertyDescriptor(props, rootName);
125
+ assert(typeof rootName === "string" &&
126
+ descriptor.enumerable &&
127
+ "value" in descriptor, "Environment properties must be enumerable string data properties.");
128
+ const grouped = ConstantCaseIdentifier.is(rootName);
129
+ assert(grouped || CamelCaseIdentifier.is(rootName), `Invalid environment schema name ${JSON.stringify(rootName)}. Expected a camelCase field or CONSTANT_CASE namespace.`);
130
+ const rootValue = descriptor.value;
131
+ const fields = grouped ? rootValue : { [rootName]: rootValue };
132
+ assert(isPlainObject(fields) && !EvoluType.is(fields), "Environment groups must be plain objects containing fields.");
133
+ if (grouped) {
134
+ assert(EnvName.is(rootName + "_A"), `Invalid environment namespace ${JSON.stringify(rootName)}. Names must fit within 255 characters.`);
135
+ prefixes.push(rootName + "_");
136
+ }
137
+ for (const name of Reflect.ownKeys(fields)) {
138
+ const field = Object.getOwnPropertyDescriptor(fields, name);
139
+ assert(typeof name === "string" && field.enumerable && "value" in field, "Environment fields must be enumerable string data properties.");
140
+ assert(CamelCaseIdentifier.is(name), `Invalid environment field ${JSON.stringify(name)}. Expected a camelCase identifier; groups cannot be nested.`);
141
+ assert(!inputNameByOutputName.has(name), `Duplicate environment field ${JSON.stringify(name)}.`);
142
+ const encoded = (grouped ? rootName + "_" : "") + camelCaseToConstantCase(name);
143
+ assert(EnvName.is(encoded), `Invalid environment schema name ${JSON.stringify(encoded)}. Expected a CONSTANT_CASE identifier of at most 255 characters.`);
144
+ assert(!outputNameByInputName.has(encoded), `Duplicate environment variable ${JSON.stringify(encoded)}.`);
145
+ const property = field.value;
146
+ const fieldType = EvoluType.is(property)
147
+ ? property
148
+ : isPlainObject(property)
149
+ ? Object.getOwnPropertyDescriptor(property, "type")?.value
150
+ : undefined;
151
+ assert(EvoluType.is(fieldType), `Invalid environment field ${JSON.stringify(name)}. Expected a Type or optional/defaulted property; groups must use CONSTANT_CASE names.`);
152
+ flat[name] = property;
153
+ inputNameByOutputName.set(name, encoded);
154
+ outputNameByInputName.set(encoded, name);
155
+ if (!grouped)
156
+ unprefixedNames.add(encoded);
157
+ }
158
+ }
159
+ // Runtime construction validates the flattened fields; the public signature
160
+ // checks their concrete Types and string encodings before flattening.
161
+ const output = object(flat);
162
+ const key = transform("EnvKey", String, CamelCaseIdentifier, {
163
+ // Identity fallback keeps this exposed codec round-trippable for other
164
+ // valid camelCase identifiers. objectKeys accepts only declared fields.
165
+ from: (value) => ok(outputNameByInputName.get(value) ?? value),
166
+ to: (value) => inputNameByOutputName.get(value) ?? value,
167
+ });
168
+ const withKeys = objectKeys(key)(output);
169
+ const type = transform("Env", Unknown, withKeys, {
170
+ from: (value) => {
171
+ if (typeof value !== "object" || value === null)
172
+ return ok(value);
173
+ return ok(filterObjectKeys(value, (key) => unprefixedNames.has(key) ||
174
+ prefixes.some((prefix) => key.toUpperCase().startsWith(prefix))));
175
+ },
176
+ to: (value) => value,
177
+ });
178
+ // The maps preserve each field's name and codec; only the static flattening
179
+ // cannot be expressed by the runtime loops above.
180
+ return type;
181
+ };
@@ -82,6 +82,7 @@ import { type Millis, type TimeDep } from "./Time.ts";
82
82
  * For testing, use {@link testCreateConsole} which creates a {@link TestConsole}
83
83
  * with array output and snapshot helpers.
84
84
  *
85
+ * @group Core
85
86
  * @see {@link createConsole}
86
87
  */
87
88
  export interface Console {
@@ -145,6 +146,11 @@ export interface Console {
145
146
  */
146
147
  readonly write: (entry: ConsoleEntry) => void;
147
148
  }
149
+ /**
150
+ * Dependency wrapper for {@link Console}.
151
+ *
152
+ * @group Core
153
+ */
148
154
  export interface ConsoleDep {
149
155
  readonly console: Console;
150
156
  }
@@ -161,6 +167,8 @@ export interface ConsoleDep {
161
167
  * - `"warn"` — Recoverable issues that may need attention
162
168
  * - `"error"` — Failures requiring immediate attention
163
169
  * - `"silent"` — Disables all logging
170
+ *
171
+ * @group Core
164
172
  */
165
173
  export type ConsoleLevel = "trace" | "debug" | "log" | "info" | "warn" | "error" | "silent";
166
174
  /**
@@ -168,6 +176,8 @@ export type ConsoleLevel = "trace" | "debug" | "log" | "info" | "warn" | "error"
168
176
  *
169
177
  * Contains all information needed for outputs to route the log: method for
170
178
  * routing, path for context, and the original arguments.
179
+ *
180
+ * @group Core
171
181
  */
172
182
  export interface ConsoleEntry {
173
183
  /** The console method that was called. */
@@ -182,6 +192,8 @@ export interface ConsoleEntry {
182
192
  *
183
193
  * Used in {@link ConsoleEntry} to identify which console method was invoked.
184
194
  * Outputs can route or format differently based on the method.
195
+ *
196
+ * @group Core
185
197
  */
186
198
  export type ConsoleMethod = "trace" | "debug" | "log" | "info" | "warn" | "error" | "dir" | "table" | "time" | "timeLog" | "timeEnd" | "count" | "countReset";
187
199
  /**
@@ -191,6 +203,8 @@ export type ConsoleMethod = "trace" | "debug" | "log" | "info" | "warn" | "error
191
203
  * array for testing, etc.).
192
204
  *
193
205
  * Use {@link createNativeConsoleOutput} for native console output.
206
+ *
207
+ * @group Output
194
208
  */
195
209
  export interface ConsoleOutput {
196
210
  /** Write a log entry to this output. */
@@ -201,9 +215,15 @@ export interface ConsoleOutput {
201
215
  *
202
216
  * Used by {@link ConsoleConfig.formatter} and {@link ConsoleOutput.write}. Create
203
217
  * one with {@link createConsoleFormatter}.
218
+ *
219
+ * @group Output
204
220
  */
205
221
  export type ConsoleFormatter = (entry: ConsoleEntry) => ReadonlyArray<unknown>;
206
- /** Configuration for {@link createConsole}. */
222
+ /**
223
+ * Configuration for {@link createConsole}.
224
+ *
225
+ * @group Core
226
+ */
207
227
  export interface ConsoleConfig {
208
228
  /** Name of this console. Defaults to empty string. */
209
229
  readonly name?: string;
@@ -225,7 +245,11 @@ export interface ConsoleConfig {
225
245
  */
226
246
  readonly formatter?: ConsoleFormatter;
227
247
  }
228
- /** Configuration for {@link createConsoleFormatter}. */
248
+ /**
249
+ * Configuration for {@link createConsoleFormatter}.
250
+ *
251
+ * @group Output
252
+ */
229
253
  export interface ConsoleFormatterConfig {
230
254
  /**
231
255
  * Timestamp format to prepend to log messages.
@@ -244,7 +268,11 @@ export interface ConsoleFormatterConfig {
244
268
  */
245
269
  readonly startTime?: Millis;
246
270
  }
247
- /** Timestamp format for {@link ConsoleFormatterConfig}. */
271
+ /**
272
+ * Timestamp format for {@link ConsoleFormatterConfig}.
273
+ *
274
+ * @group Output
275
+ */
248
276
  export type ConsoleEntryTimestampFormat = "relative" | "absolute" | "iso" | "none";
249
277
  /**
250
278
  * A {@link ConsoleOutput} that stores the latest entry in a
@@ -279,6 +307,8 @@ export type ConsoleEntryTimestampFormat = "relative" | "absolute" | "iso" | "non
279
307
  * args: ["connected"],
280
308
  * });
281
309
  * ```
310
+ *
311
+ * @group Output
282
312
  */
283
313
  export interface ConsoleStoreOutput extends ConsoleOutput {
284
314
  /** Latest entry written to this output. */
@@ -287,6 +317,8 @@ export interface ConsoleStoreOutput extends ConsoleOutput {
287
317
  /**
288
318
  * Dependency providing the latest {@link ConsoleEntry} from a
289
319
  * {@link ConsoleStoreOutput}.
320
+ *
321
+ * @group Output
290
322
  */
291
323
  export interface ConsoleStoreOutputEntryDep {
292
324
  readonly consoleStoreOutputEntry: ReadonlyStore<ConsoleEntry | null>;
@@ -295,6 +327,8 @@ export interface ConsoleStoreOutputEntryDep {
295
327
  * A test console that captures all output for assertions.
296
328
  *
297
329
  * Use as a drop-in replacement for {@link Console} in tests.
330
+ *
331
+ * @group Testing
298
332
  */
299
333
  export interface TestConsole extends Console {
300
334
  /** Gets all captured entries and clears the internal buffer. */
@@ -302,10 +336,19 @@ export interface TestConsole extends Console {
302
336
  /** Clears all captured entries. */
303
337
  readonly clearEntries: () => void;
304
338
  }
339
+ /**
340
+ * Dependency wrapper for {@link TestConsole}.
341
+ *
342
+ * @group Testing
343
+ */
305
344
  export interface TestConsoleDep {
306
345
  readonly console: TestConsole;
307
346
  }
308
- /** Creates a {@link Console}. */
347
+ /**
348
+ * Creates a {@link Console}.
349
+ *
350
+ * @group Core
351
+ */
309
352
  export declare const createConsole: ({ name, level, output, path, formatter, }?: ConsoleConfig) => Console;
310
353
  /**
311
354
  * Creates a {@link ConsoleOutput} that writes to `globalThis.console`.
@@ -318,7 +361,6 @@ export declare const createConsole: ({ name, level, output, path, formatter, }?:
318
361
  *
319
362
  * ```ts
320
363
  * import {
321
- * assertEqual,
322
364
  * assertType,
323
365
  * createNativeConsoleOutput,
324
366
  * type ConsoleOutput,
@@ -327,8 +369,9 @@ export declare const createConsole: ({ name, level, output, path, formatter, }?:
327
369
  * const output = createNativeConsoleOutput();
328
370
  *
329
371
  * assertType<typeof output, ConsoleOutput>();
330
- * assertEqual(typeof output.write, "function");
331
372
  * ```
373
+ *
374
+ * @group Output
332
375
  */
333
376
  export declare const createNativeConsoleOutput: () => ConsoleOutput;
334
377
  /**
@@ -379,9 +422,15 @@ export declare const createNativeConsoleOutput: () => ConsoleOutput;
379
422
  * assertType(Data, absolute);
380
423
  * assertEqual(absolute, ["14:30:15.123 [relay]", "connected"]);
381
424
  * ```
425
+ *
426
+ * @group Output
382
427
  */
383
428
  export declare const createConsoleFormatter: ({ time }?: Partial<TimeDep>) => (config?: ConsoleFormatterConfig) => ConsoleFormatter;
384
- /** Creates a {@link ConsoleStoreOutput}. */
429
+ /**
430
+ * Creates a {@link ConsoleStoreOutput}.
431
+ *
432
+ * @group Output
433
+ */
385
434
  export declare const createConsoleStoreOutput: () => ConsoleStoreOutput;
386
435
  /**
387
436
  * Creates a {@link ConsoleOutput} that captures entries to an array.
@@ -408,6 +457,8 @@ export declare const createConsoleStoreOutput: () => ConsoleStoreOutput;
408
457
  * { method: "info", path: [], args: ["connected"] },
409
458
  * ]);
410
459
  * ```
460
+ *
461
+ * @group Output
411
462
  */
412
463
  export declare const createConsoleArrayOutput: (entries: Array<ConsoleEntry>) => ConsoleOutput;
413
464
  /**
@@ -445,6 +496,8 @@ export declare const createConsoleArrayOutput: (entries: Array<ConsoleEntry>) =>
445
496
  * assertType(Data, entries[0]);
446
497
  * assertEqual(storedEntry, entries[0]);
447
498
  * ```
499
+ *
500
+ * @group Output
448
501
  */
449
502
  export declare const createMultiOutput: (outputs: ReadonlyArray<ConsoleOutput>) => ConsoleOutput;
450
503
  /**
@@ -466,6 +519,8 @@ export declare const createMultiOutput: (outputs: ReadonlyArray<ConsoleOutput>)
466
519
  * { method: "info", path: ["relay"], args: ["connected"] },
467
520
  * ]);
468
521
  * ```
522
+ *
523
+ * @group Testing
469
524
  */
470
525
  export declare const testCreateConsole: ({ level, }?: {
471
526
  level?: ConsoleLevel;
@@ -1 +1 @@
1
- {"version":3,"file":"Console.d.ts","sourceRoot":"","sources":["../../src/Console.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,OAAO,EACb,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,wBAAwB,YAC1B,KAAK,CAAC,YAAY,CAAC,KAC3B,aAID,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,iBAAiB,YACnB,aAAa,CAAC,aAAa,CAAC,KACpC,aAID,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,iBAAiB,gBAE3B;IACD,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,KAAQ,WAkBR,CAAC"}
@@ -15,7 +15,11 @@ const levelOrder = {
15
15
  error: 5,
16
16
  silent: 6,
17
17
  };
18
- /** Creates a {@link Console}. */
18
+ /**
19
+ * Creates a {@link Console}.
20
+ *
21
+ * @group Core
22
+ */
19
23
  export const createConsole = ({ name = "", level = "log", output = createNativeConsoleOutput(), path = [], formatter, } = {}) => {
20
24
  const childrenSet = new Set();
21
25
  let ownLevel = null;
@@ -63,7 +67,6 @@ export const createConsole = ({ name = "", level = "log", output = createNativeC
63
67
  *
64
68
  * ```ts
65
69
  * import {
66
- * assertEqual,
67
70
  * assertType,
68
71
  * createNativeConsoleOutput,
69
72
  * type ConsoleOutput,
@@ -72,8 +75,9 @@ export const createConsole = ({ name = "", level = "log", output = createNativeC
72
75
  * const output = createNativeConsoleOutput();
73
76
  *
74
77
  * assertType<typeof output, ConsoleOutput>();
75
- * assertEqual(typeof output.write, "function");
76
78
  * ```
79
+ *
80
+ * @group Output
77
81
  */
78
82
  export const createNativeConsoleOutput = () => ({
79
83
  write: (entry, formatter) => {
@@ -131,6 +135,8 @@ export const createNativeConsoleOutput = () => ({
131
135
  * assertType(Data, absolute);
132
136
  * assertEqual(absolute, ["14:30:15.123 [relay]", "connected"]);
133
137
  * ```
138
+ *
139
+ * @group Output
134
140
  */
135
141
  export const createConsoleFormatter = ({ time = createTime() } = {}) => (config = {}) => {
136
142
  const format = config.timestampFormat ?? "none";
@@ -158,7 +164,11 @@ export const createConsoleFormatter = ({ time = createTime() } = {}) => (config
158
164
  return prefix ? [prefix, ...entry.args] : entry.args;
159
165
  };
160
166
  };
161
- /** Creates a {@link ConsoleStoreOutput}. */
167
+ /**
168
+ * Creates a {@link ConsoleStoreOutput}.
169
+ *
170
+ * @group Output
171
+ */
162
172
  export const createConsoleStoreOutput = () => {
163
173
  const entry = createStore(null);
164
174
  return {
@@ -191,6 +201,8 @@ export const createConsoleStoreOutput = () => {
191
201
  * { method: "info", path: [], args: ["connected"] },
192
202
  * ]);
193
203
  * ```
204
+ *
205
+ * @group Output
194
206
  */
195
207
  export const createConsoleArrayOutput = (entries) => ({
196
208
  write: (entry) => {
@@ -232,6 +244,8 @@ export const createConsoleArrayOutput = (entries) => ({
232
244
  * assertType(Data, entries[0]);
233
245
  * assertEqual(storedEntry, entries[0]);
234
246
  * ```
247
+ *
248
+ * @group Output
235
249
  */
236
250
  export const createMultiOutput = (outputs) => ({
237
251
  write: (entry, formatter) => {
@@ -258,6 +272,8 @@ export const createMultiOutput = (outputs) => ({
258
272
  * { method: "info", path: ["relay"], args: ["connected"] },
259
273
  * ]);
260
274
  * ```
275
+ *
276
+ * @group Testing
261
277
  */
262
278
  export const testCreateConsole = ({ level = "trace", } = {}) => {
263
279
  const entries = [];
@@ -10,6 +10,11 @@
10
10
  import type { RandomLibDep } from "./Random.ts";
11
11
  import type { Result } from "./Result.ts";
12
12
  import { NonNegativeInt, type Typed } from "./Type.ts";
13
+ /**
14
+ * Cryptographically secure random bytes with length-branded results.
15
+ *
16
+ * @group Random bytes
17
+ */
13
18
  export interface RandomBytes {
14
19
  /**
15
20
  * Creates cryptographically secure random bytes with type-safe length
@@ -62,42 +67,89 @@ export interface RandomBytes {
62
67
  create(bytesLength: 64): Entropy64;
63
68
  create(bytesLength: number): Entropy;
64
69
  }
70
+ /**
71
+ * Dependency wrapper for {@link RandomBytes}.
72
+ *
73
+ * @group Random bytes
74
+ */
65
75
  export interface RandomBytesDep {
66
76
  readonly randomBytes: RandomBytes;
67
77
  }
68
78
  declare const Entropy: import("./Type.ts").BrandType<import("./Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("./Type.ts").ObjectTagError<"Uint8Array">, null, import("./Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>;
69
79
  type Entropy = typeof Entropy.Output;
80
+ /**
81
+ * Cryptographic entropy of exactly 16 bytes.
82
+ *
83
+ * @group Random bytes
84
+ */
70
85
  export declare const Entropy16: import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("./Type.ts").ObjectTagError<"Uint8Array">, null, import("./Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length16", import("./Type.ts").LengthError<16>>;
71
86
  export type Entropy16 = typeof Entropy16.Output;
87
+ /**
88
+ * Cryptographic entropy of exactly 24 bytes.
89
+ *
90
+ * @group Random bytes
91
+ */
72
92
  export declare const Entropy24: import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("./Type.ts").ObjectTagError<"Uint8Array">, null, import("./Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length24", import("./Type.ts").LengthError<24>>;
73
93
  export type Entropy24 = typeof Entropy24.Output;
94
+ /**
95
+ * Cryptographic entropy of exactly 32 bytes.
96
+ *
97
+ * @group Random bytes
98
+ */
74
99
  export declare const Entropy32: import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("./Type.ts").ObjectTagError<"Uint8Array">, null, import("./Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length32", import("./Type.ts").LengthError<32>>;
75
100
  export type Entropy32 = typeof Entropy32.Output;
101
+ /**
102
+ * Cryptographic entropy of exactly 64 bytes.
103
+ *
104
+ * @group Random bytes
105
+ */
76
106
  export declare const Entropy64: import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("./Type.ts").ObjectTagError<"Uint8Array">, null, import("./Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length64", import("./Type.ts").LengthError<64>>;
77
107
  export type Entropy64 = typeof Entropy64.Output;
108
+ /**
109
+ * Creates {@link RandomBytes} backed by the platform's secure random number
110
+ * generator.
111
+ *
112
+ * @group Random bytes
113
+ */
78
114
  export declare const createRandomBytes: () => RandomBytes;
79
- /** Creates seeded random bytes for deterministic tests. */
115
+ /**
116
+ * Creates seeded random bytes for deterministic tests.
117
+ *
118
+ * @group Testing
119
+ */
80
120
  export declare const testCreateRandomBytes: (deps: RandomLibDep) => RandomBytes;
81
121
  /**
82
122
  * SLIP21.
83
123
  *
84
124
  * https://github.com/satoshilabs/slips/blob/master/slip-0021.md
125
+ *
126
+ * @group Key derivation
85
127
  */
86
128
  export declare const createSlip21: (seed: Entropy16 | Entropy32 | Entropy64, path: ReadonlyArray<string | number>) => Entropy32;
87
129
  /**
88
130
  * Derives a single node in the SLIP-21 hierarchical key derivation.
89
131
  *
132
+ * @group Key derivation
90
133
  * @see {@link createSlip21}
91
134
  */
92
135
  export declare const deriveSlip21Node: (label: string, parentNode: Entropy64) => Entropy64;
93
- /** The encryption key for symmetric encryption. */
136
+ /**
137
+ * The encryption key for symmetric encryption.
138
+ *
139
+ * @group Encryption
140
+ */
94
141
  export declare const EncryptionKey: import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").BrandType<import("./Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("./Type.ts").ObjectTagError<"Uint8Array">, null, import("./Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length32", import("./Type.ts").LengthError<32>>, "EncryptionKey", never>;
95
142
  export type EncryptionKey = typeof EncryptionKey.Output;
96
- /** The nonce length for XChaCha20-Poly1305 encryption. */
143
+ /**
144
+ * The nonce length for XChaCha20-Poly1305 encryption.
145
+ *
146
+ * @group Encryption
147
+ */
97
148
  export declare const xChaCha20Poly1305NonceLength = 24;
98
149
  /**
99
150
  * Branded Uint8Array for XChaCha20-Poly1305 encryption.
100
151
  *
152
+ * @group Encryption
101
153
  * @see {@link encryptWithXChaCha20Poly1305}
102
154
  */
103
155
  export declare const XChaCha20Poly1305Ciphertext: import("./Type.ts").BrandType<import("./Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("./Type.ts").ObjectTagError<"Uint8Array">, null, import("./Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "XChaCha20Poly1305Ciphertext", never>;
@@ -131,9 +183,15 @@ export type XChaCha20Poly1305Ciphertext = typeof XChaCha20Poly1305Ciphertext.Out
131
183
  * assertEqual(nonce.length, 24);
132
184
  * ```
133
185
  *
186
+ * @group Encryption
134
187
  * @see https://github.com/paulmillr/noble-ciphers
135
188
  */
136
189
  export declare const encryptWithXChaCha20Poly1305: (deps: RandomBytesDep) => (plaintext: Uint8Array, encryptionKey: EncryptionKey) => [XChaCha20Poly1305Ciphertext, Entropy24];
190
+ /**
191
+ * Error returned by {@link decryptWithXChaCha20Poly1305} when decryption fails.
192
+ *
193
+ * @group Encryption
194
+ */
137
195
  export interface DecryptWithXChaCha20Poly1305Error extends Typed<"DecryptWithXChaCha20Poly1305Error"> {
138
196
  readonly error: unknown;
139
197
  }
@@ -176,6 +234,8 @@ export interface DecryptWithXChaCha20Poly1305Error extends Typed<"DecryptWithXCh
176
234
  *
177
235
  * assertOk(decryptMessage(), "secret message");
178
236
  * ```
237
+ *
238
+ * @group Encryption
179
239
  */
180
240
  export declare const decryptWithXChaCha20Poly1305: (ciphertext: XChaCha20Poly1305Ciphertext, nonce: Entropy24, encryptionKey: EncryptionKey) => Result<Uint8Array, DecryptWithXChaCha20Poly1305Error>;
181
241
  /**
@@ -185,18 +245,30 @@ export declare const decryptWithXChaCha20Poly1305: (ciphertext: XChaCha20Poly130
185
245
  * wide range of encrypted data sizes.
186
246
  *
187
247
  * See the PURBs paper for details: https://bford.info/pub/sec/purb.pdf
248
+ *
249
+ * @group Padding
188
250
  */
189
251
  export declare const createPadmePaddedLength: (length: NonNegativeInt) => NonNegativeInt;
190
- /** Creates a PADMÉ padding array of zeros for the given input length. */
252
+ /**
253
+ * Creates a PADMÉ padding array of zeros for the given input length.
254
+ *
255
+ * @group Padding
256
+ */
191
257
  export declare const createPadmePadding: (length: NonNegativeInt) => Uint8Array;
192
258
  /**
193
259
  * Performs a timing-safe comparison of two Uint8Arrays. Returns true if they
194
260
  * are equal, false otherwise. Takes constant time regardless of where the
195
261
  * arrays differ.
196
262
  *
263
+ * @group Comparison
197
264
  * @see https://nodejs.org/api/crypto.html#cryptotimingsafeequala-b
198
265
  */
199
266
  export type TimingSafeEqual = (a: Uint8Array, b: Uint8Array) => boolean;
267
+ /**
268
+ * Dependency wrapper for {@link TimingSafeEqual}.
269
+ *
270
+ * @group Comparison
271
+ */
200
272
  export interface TimingSafeEqualDep {
201
273
  readonly timingSafeEqual: TimingSafeEqual;
202
274
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Crypto.d.ts","sourceRoot":"","sources":["../../src/Crypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE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