effect 4.0.0-beta.67 → 4.0.0-beta.69

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 (1196) hide show
  1. package/dist/Array.d.ts +41 -42
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +23 -23
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +265 -265
  6. package/dist/BigDecimal.js +128 -128
  7. package/dist/BigInt.d.ts +175 -177
  8. package/dist/BigInt.d.ts.map +1 -1
  9. package/dist/BigInt.js +81 -79
  10. package/dist/BigInt.js.map +1 -1
  11. package/dist/Boolean.d.ts +127 -125
  12. package/dist/Boolean.d.ts.map +1 -1
  13. package/dist/Boolean.js +55 -53
  14. package/dist/Boolean.js.map +1 -1
  15. package/dist/Brand.d.ts +10 -4
  16. package/dist/Brand.d.ts.map +1 -1
  17. package/dist/Brand.js +3 -2
  18. package/dist/Brand.js.map +1 -1
  19. package/dist/Cache.d.ts +36 -36
  20. package/dist/Cache.js +17 -17
  21. package/dist/Cause.d.ts +17 -18
  22. package/dist/Cause.d.ts.map +1 -1
  23. package/dist/Cause.js +12 -12
  24. package/dist/Cause.js.map +1 -1
  25. package/dist/Channel.d.ts +234 -241
  26. package/dist/Channel.d.ts.map +1 -1
  27. package/dist/Channel.js +98 -102
  28. package/dist/Channel.js.map +1 -1
  29. package/dist/Chunk.d.ts +33 -56
  30. package/dist/Chunk.d.ts.map +1 -1
  31. package/dist/Chunk.js +17 -26
  32. package/dist/Chunk.js.map +1 -1
  33. package/dist/Clock.d.ts +1 -1
  34. package/dist/Clock.js +1 -1
  35. package/dist/Combiner.d.ts +9 -1
  36. package/dist/Combiner.d.ts.map +1 -1
  37. package/dist/Combiner.js +8 -0
  38. package/dist/Combiner.js.map +1 -1
  39. package/dist/Config.d.ts +78 -68
  40. package/dist/Config.d.ts.map +1 -1
  41. package/dist/Config.js +53 -49
  42. package/dist/Config.js.map +1 -1
  43. package/dist/ConfigProvider.d.ts +33 -32
  44. package/dist/ConfigProvider.d.ts.map +1 -1
  45. package/dist/ConfigProvider.js +19 -18
  46. package/dist/ConfigProvider.js.map +1 -1
  47. package/dist/Console.d.ts +19 -19
  48. package/dist/Console.js +19 -19
  49. package/dist/Context.d.ts +70 -108
  50. package/dist/Context.d.ts.map +1 -1
  51. package/dist/Context.js +30 -44
  52. package/dist/Context.js.map +1 -1
  53. package/dist/Cron.d.ts +3 -5
  54. package/dist/Cron.d.ts.map +1 -1
  55. package/dist/Cron.js +3 -5
  56. package/dist/Cron.js.map +1 -1
  57. package/dist/Crypto.d.ts +208 -0
  58. package/dist/Crypto.d.ts.map +1 -0
  59. package/dist/Crypto.js +157 -0
  60. package/dist/Crypto.js.map +1 -0
  61. package/dist/Data.d.ts +6 -1
  62. package/dist/Data.d.ts.map +1 -1
  63. package/dist/Data.js.map +1 -1
  64. package/dist/DateTime.d.ts +29 -31
  65. package/dist/DateTime.d.ts.map +1 -1
  66. package/dist/DateTime.js +19 -19
  67. package/dist/DateTime.js.map +1 -1
  68. package/dist/Deferred.d.ts +8 -9
  69. package/dist/Deferred.d.ts.map +1 -1
  70. package/dist/Deferred.js +6 -6
  71. package/dist/Deferred.js.map +1 -1
  72. package/dist/Differ.d.ts +2 -2
  73. package/dist/Duration.d.ts +30 -27
  74. package/dist/Duration.d.ts.map +1 -1
  75. package/dist/Duration.js +15 -12
  76. package/dist/Duration.js.map +1 -1
  77. package/dist/Effect.d.ts +879 -1137
  78. package/dist/Effect.d.ts.map +1 -1
  79. package/dist/Effect.js +375 -465
  80. package/dist/Effect.js.map +1 -1
  81. package/dist/Effectable.d.ts +2 -2
  82. package/dist/Effectable.js +2 -2
  83. package/dist/Encoding.d.ts +9 -9
  84. package/dist/Encoding.js +9 -9
  85. package/dist/Equal.d.ts +4 -3
  86. package/dist/Equal.d.ts.map +1 -1
  87. package/dist/Equal.js +4 -3
  88. package/dist/Equal.js.map +1 -1
  89. package/dist/Equivalence.d.ts +4 -5
  90. package/dist/Equivalence.d.ts.map +1 -1
  91. package/dist/Equivalence.js +2 -2
  92. package/dist/Equivalence.js.map +1 -1
  93. package/dist/ErrorReporter.d.ts +14 -14
  94. package/dist/ErrorReporter.js +9 -9
  95. package/dist/ExecutionPlan.d.ts +18 -9
  96. package/dist/ExecutionPlan.d.ts.map +1 -1
  97. package/dist/ExecutionPlan.js +6 -4
  98. package/dist/ExecutionPlan.js.map +1 -1
  99. package/dist/Exit.d.ts +0 -1
  100. package/dist/Exit.d.ts.map +1 -1
  101. package/dist/Exit.js.map +1 -1
  102. package/dist/Fiber.d.ts +1 -2
  103. package/dist/Fiber.d.ts.map +1 -1
  104. package/dist/Fiber.js +1 -1
  105. package/dist/Fiber.js.map +1 -1
  106. package/dist/FiberHandle.d.ts +5 -5
  107. package/dist/FiberHandle.js +3 -3
  108. package/dist/FiberMap.d.ts +10 -10
  109. package/dist/FiberMap.js +4 -4
  110. package/dist/FiberSet.d.ts +4 -4
  111. package/dist/FiberSet.js +2 -2
  112. package/dist/FileSystem.d.ts +10 -12
  113. package/dist/FileSystem.d.ts.map +1 -1
  114. package/dist/FileSystem.js +3 -3
  115. package/dist/FileSystem.js.map +1 -1
  116. package/dist/Filter.d.ts +54 -54
  117. package/dist/Filter.js +28 -28
  118. package/dist/Formatter.d.ts +4 -2
  119. package/dist/Formatter.d.ts.map +1 -1
  120. package/dist/Formatter.js +3 -69
  121. package/dist/Formatter.js.map +1 -1
  122. package/dist/Function.d.ts +64 -65
  123. package/dist/Function.d.ts.map +1 -1
  124. package/dist/Function.js +41 -41
  125. package/dist/Function.js.map +1 -1
  126. package/dist/Graph.d.ts +157 -175
  127. package/dist/Graph.d.ts.map +1 -1
  128. package/dist/Graph.js +72 -80
  129. package/dist/Graph.js.map +1 -1
  130. package/dist/Hash.d.ts +4 -6
  131. package/dist/Hash.d.ts.map +1 -1
  132. package/dist/Hash.js +2 -2
  133. package/dist/Hash.js.map +1 -1
  134. package/dist/HashMap.d.ts +121 -157
  135. package/dist/HashMap.d.ts.map +1 -1
  136. package/dist/HashMap.js +47 -59
  137. package/dist/HashMap.js.map +1 -1
  138. package/dist/HashRing.d.ts +34 -34
  139. package/dist/HashRing.js +16 -16
  140. package/dist/HashSet.d.ts +51 -55
  141. package/dist/HashSet.d.ts.map +1 -1
  142. package/dist/HashSet.js +19 -20
  143. package/dist/HashSet.js.map +1 -1
  144. package/dist/Inspectable.d.ts +6 -4
  145. package/dist/Inspectable.d.ts.map +1 -1
  146. package/dist/Inspectable.js +6 -4
  147. package/dist/Inspectable.js.map +1 -1
  148. package/dist/Iterable.d.ts +37 -83
  149. package/dist/Iterable.d.ts.map +1 -1
  150. package/dist/Iterable.js +21 -39
  151. package/dist/Iterable.js.map +1 -1
  152. package/dist/JsonPatch.d.ts +8 -6
  153. package/dist/JsonPatch.d.ts.map +1 -1
  154. package/dist/JsonPatch.js +5 -3
  155. package/dist/JsonPatch.js.map +1 -1
  156. package/dist/JsonPointer.d.ts +13 -11
  157. package/dist/JsonPointer.d.ts.map +1 -1
  158. package/dist/JsonPointer.js +13 -11
  159. package/dist/JsonPointer.js.map +1 -1
  160. package/dist/JsonSchema.d.ts +16 -0
  161. package/dist/JsonSchema.d.ts.map +1 -1
  162. package/dist/JsonSchema.js +10 -0
  163. package/dist/JsonSchema.js.map +1 -1
  164. package/dist/Latch.d.ts +4 -16
  165. package/dist/Latch.d.ts.map +1 -1
  166. package/dist/Latch.js +2 -14
  167. package/dist/Latch.js.map +1 -1
  168. package/dist/Layer.d.ts +94 -135
  169. package/dist/Layer.d.ts.map +1 -1
  170. package/dist/Layer.js +44 -61
  171. package/dist/Layer.js.map +1 -1
  172. package/dist/LayerMap.d.ts +15 -16
  173. package/dist/LayerMap.d.ts.map +1 -1
  174. package/dist/LayerMap.js +6 -6
  175. package/dist/LogLevel.d.ts +13 -13
  176. package/dist/LogLevel.js +4 -4
  177. package/dist/Logger.d.ts +10 -11
  178. package/dist/Logger.d.ts.map +1 -1
  179. package/dist/Logger.js +10 -11
  180. package/dist/Logger.js.map +1 -1
  181. package/dist/ManagedRuntime.d.ts +5 -4
  182. package/dist/ManagedRuntime.d.ts.map +1 -1
  183. package/dist/ManagedRuntime.js +4 -3
  184. package/dist/ManagedRuntime.js.map +1 -1
  185. package/dist/Match.d.ts +2 -4
  186. package/dist/Match.d.ts.map +1 -1
  187. package/dist/Match.js +1 -2
  188. package/dist/Match.js.map +1 -1
  189. package/dist/Metric.d.ts +48 -50
  190. package/dist/Metric.d.ts.map +1 -1
  191. package/dist/Metric.js +22 -22
  192. package/dist/Metric.js.map +1 -1
  193. package/dist/MutableHashMap.d.ts +30 -30
  194. package/dist/MutableHashMap.d.ts.map +1 -1
  195. package/dist/MutableHashMap.js +15 -14
  196. package/dist/MutableHashMap.js.map +1 -1
  197. package/dist/MutableHashSet.d.ts.map +1 -1
  198. package/dist/MutableHashSet.js +0 -2
  199. package/dist/MutableHashSet.js.map +1 -1
  200. package/dist/MutableList.d.ts +23 -24
  201. package/dist/MutableList.d.ts.map +1 -1
  202. package/dist/MutableList.js +17 -19
  203. package/dist/MutableList.js.map +1 -1
  204. package/dist/MutableRef.d.ts.map +1 -1
  205. package/dist/MutableRef.js +0 -1
  206. package/dist/MutableRef.js.map +1 -1
  207. package/dist/Newtype.d.ts +12 -2
  208. package/dist/Newtype.d.ts.map +1 -1
  209. package/dist/Newtype.js +8 -2
  210. package/dist/Newtype.js.map +1 -1
  211. package/dist/NonEmptyIterable.d.ts +5 -12
  212. package/dist/NonEmptyIterable.d.ts.map +1 -1
  213. package/dist/NonEmptyIterable.js +3 -8
  214. package/dist/NonEmptyIterable.js.map +1 -1
  215. package/dist/Number.d.ts +145 -141
  216. package/dist/Number.d.ts.map +1 -1
  217. package/dist/Number.js +65 -61
  218. package/dist/Number.js.map +1 -1
  219. package/dist/Optic.d.ts +5 -5
  220. package/dist/Optic.js +5 -5
  221. package/dist/Option.d.ts +105 -109
  222. package/dist/Option.d.ts.map +1 -1
  223. package/dist/Option.js +50 -52
  224. package/dist/Option.js.map +1 -1
  225. package/dist/Order.d.ts +6 -6
  226. package/dist/Order.js +6 -6
  227. package/dist/Ordering.d.ts +15 -19
  228. package/dist/Ordering.d.ts.map +1 -1
  229. package/dist/Ordering.js +6 -6
  230. package/dist/Ordering.js.map +1 -1
  231. package/dist/PartitionedSemaphore.d.ts +3 -3
  232. package/dist/PartitionedSemaphore.js +2 -2
  233. package/dist/Path.d.ts +4 -4
  234. package/dist/Path.d.ts.map +1 -1
  235. package/dist/Path.js +2 -1
  236. package/dist/Path.js.map +1 -1
  237. package/dist/Pipeable.d.ts +10 -7
  238. package/dist/Pipeable.d.ts.map +1 -1
  239. package/dist/Pipeable.js +6 -4
  240. package/dist/Pipeable.js.map +1 -1
  241. package/dist/PlatformError.d.ts +3 -3
  242. package/dist/PlatformError.js +2 -2
  243. package/dist/Predicate.d.ts +2 -4
  244. package/dist/Predicate.d.ts.map +1 -1
  245. package/dist/Predicate.js +3 -3
  246. package/dist/Predicate.js.map +1 -1
  247. package/dist/PrimaryKey.d.ts +2 -1
  248. package/dist/PrimaryKey.d.ts.map +1 -1
  249. package/dist/PrimaryKey.js +2 -1
  250. package/dist/PrimaryKey.js.map +1 -1
  251. package/dist/PubSub.d.ts +25 -51
  252. package/dist/PubSub.d.ts.map +1 -1
  253. package/dist/PubSub.js +17 -35
  254. package/dist/PubSub.js.map +1 -1
  255. package/dist/Queue.d.ts +45 -60
  256. package/dist/Queue.d.ts.map +1 -1
  257. package/dist/Queue.js +27 -33
  258. package/dist/Queue.js.map +1 -1
  259. package/dist/Random.d.ts +27 -38
  260. package/dist/Random.d.ts.map +1 -1
  261. package/dist/Random.js +17 -54
  262. package/dist/Random.js.map +1 -1
  263. package/dist/RcMap.d.ts +11 -11
  264. package/dist/RcMap.js +3 -3
  265. package/dist/RcRef.d.ts +0 -1
  266. package/dist/RcRef.d.ts.map +1 -1
  267. package/dist/RcRef.js.map +1 -1
  268. package/dist/Record.d.ts +9 -8
  269. package/dist/Record.d.ts.map +1 -1
  270. package/dist/Record.js +7 -5
  271. package/dist/Record.js.map +1 -1
  272. package/dist/Redactable.d.ts +7 -5
  273. package/dist/Redactable.d.ts.map +1 -1
  274. package/dist/Redactable.js +5 -3
  275. package/dist/Redactable.js.map +1 -1
  276. package/dist/Redacted.d.ts +2 -3
  277. package/dist/Redacted.d.ts.map +1 -1
  278. package/dist/Redacted.js +2 -2
  279. package/dist/Redacted.js.map +1 -1
  280. package/dist/Reducer.d.ts +3 -1
  281. package/dist/Reducer.d.ts.map +1 -1
  282. package/dist/Reducer.js +2 -0
  283. package/dist/Reducer.js.map +1 -1
  284. package/dist/Ref.d.ts +7 -17
  285. package/dist/Ref.d.ts.map +1 -1
  286. package/dist/Ref.js +5 -12
  287. package/dist/Ref.js.map +1 -1
  288. package/dist/RegExp.d.ts +1 -1
  289. package/dist/RegExp.js +1 -1
  290. package/dist/Request.d.ts +2 -1
  291. package/dist/Request.d.ts.map +1 -1
  292. package/dist/Request.js +1 -0
  293. package/dist/Request.js.map +1 -1
  294. package/dist/RequestResolver.d.ts +2 -3
  295. package/dist/RequestResolver.d.ts.map +1 -1
  296. package/dist/RequestResolver.js +1 -1
  297. package/dist/RequestResolver.js.map +1 -1
  298. package/dist/Resource.d.ts +1 -1
  299. package/dist/Resource.js +1 -1
  300. package/dist/Result.d.ts +124 -142
  301. package/dist/Result.d.ts.map +1 -1
  302. package/dist/Result.js +51 -63
  303. package/dist/Result.js.map +1 -1
  304. package/dist/Runtime.d.ts +2 -7
  305. package/dist/Runtime.d.ts.map +1 -1
  306. package/dist/Runtime.js +1 -3
  307. package/dist/Runtime.js.map +1 -1
  308. package/dist/Schedule.d.ts +69 -72
  309. package/dist/Schedule.d.ts.map +1 -1
  310. package/dist/Schedule.js +31 -33
  311. package/dist/Schedule.js.map +1 -1
  312. package/dist/Scheduler.d.ts +2 -2
  313. package/dist/Scheduler.js +2 -2
  314. package/dist/Schema.d.ts +491 -321
  315. package/dist/Schema.d.ts.map +1 -1
  316. package/dist/Schema.js +220 -172
  317. package/dist/Schema.js.map +1 -1
  318. package/dist/SchemaAST.d.ts +98 -77
  319. package/dist/SchemaAST.d.ts.map +1 -1
  320. package/dist/SchemaAST.js +89 -68
  321. package/dist/SchemaAST.js.map +1 -1
  322. package/dist/SchemaGetter.d.ts +23 -23
  323. package/dist/SchemaGetter.js +20 -20
  324. package/dist/SchemaIssue.d.ts +18 -16
  325. package/dist/SchemaIssue.d.ts.map +1 -1
  326. package/dist/SchemaIssue.js +16 -14
  327. package/dist/SchemaIssue.js.map +1 -1
  328. package/dist/SchemaParser.d.ts +39 -40
  329. package/dist/SchemaParser.d.ts.map +1 -1
  330. package/dist/SchemaParser.js +48 -51
  331. package/dist/SchemaParser.js.map +1 -1
  332. package/dist/SchemaRepresentation.d.ts +89 -77
  333. package/dist/SchemaRepresentation.d.ts.map +1 -1
  334. package/dist/SchemaRepresentation.js +47 -37
  335. package/dist/SchemaRepresentation.js.map +1 -1
  336. package/dist/SchemaTransformation.d.ts +36 -5
  337. package/dist/SchemaTransformation.d.ts.map +1 -1
  338. package/dist/SchemaTransformation.js +33 -5
  339. package/dist/SchemaTransformation.js.map +1 -1
  340. package/dist/SchemaUtils.d.ts +1 -1
  341. package/dist/SchemaUtils.js +1 -1
  342. package/dist/Scope.d.ts +12 -29
  343. package/dist/Scope.d.ts.map +1 -1
  344. package/dist/Scope.js +6 -11
  345. package/dist/Scope.js.map +1 -1
  346. package/dist/ScopedCache.d.ts +37 -37
  347. package/dist/ScopedCache.js +17 -17
  348. package/dist/Semaphore.d.ts +4 -16
  349. package/dist/Semaphore.d.ts.map +1 -1
  350. package/dist/Semaphore.js +2 -14
  351. package/dist/Semaphore.js.map +1 -1
  352. package/dist/Sink.d.ts +36 -39
  353. package/dist/Sink.d.ts.map +1 -1
  354. package/dist/Sink.js +18 -18
  355. package/dist/Sink.js.map +1 -1
  356. package/dist/Stdio.d.ts +6 -6
  357. package/dist/Stdio.js +4 -4
  358. package/dist/Stream.d.ts +671 -808
  359. package/dist/Stream.d.ts.map +1 -1
  360. package/dist/Stream.js +289 -363
  361. package/dist/Stream.js.map +1 -1
  362. package/dist/String.d.ts +3 -2
  363. package/dist/String.d.ts.map +1 -1
  364. package/dist/String.js +3 -2
  365. package/dist/String.js.map +1 -1
  366. package/dist/Struct.d.ts +20 -18
  367. package/dist/Struct.d.ts.map +1 -1
  368. package/dist/Struct.js +10 -8
  369. package/dist/Struct.js.map +1 -1
  370. package/dist/SubscriptionRef.d.ts +2 -2
  371. package/dist/SubscriptionRef.js +2 -2
  372. package/dist/Symbol.d.ts +3 -3
  373. package/dist/Symbol.js +3 -3
  374. package/dist/SynchronizedRef.d.ts +1 -1
  375. package/dist/SynchronizedRef.js +1 -1
  376. package/dist/Take.d.ts +2 -2
  377. package/dist/Take.js +1 -1
  378. package/dist/Terminal.d.ts +5 -5
  379. package/dist/Terminal.js +2 -2
  380. package/dist/Tracer.d.ts +9 -9
  381. package/dist/Tracer.js +2 -2
  382. package/dist/Trie.d.ts +70 -106
  383. package/dist/Trie.d.ts.map +1 -1
  384. package/dist/Trie.js +29 -43
  385. package/dist/Trie.js.map +1 -1
  386. package/dist/Tuple.d.ts +34 -32
  387. package/dist/Tuple.d.ts.map +1 -1
  388. package/dist/Tuple.js +16 -14
  389. package/dist/Tuple.js.map +1 -1
  390. package/dist/TxChunk.d.ts +27 -18
  391. package/dist/TxChunk.d.ts.map +1 -1
  392. package/dist/TxChunk.js +15 -10
  393. package/dist/TxChunk.js.map +1 -1
  394. package/dist/TxDeferred.d.ts +11 -11
  395. package/dist/TxDeferred.js +5 -5
  396. package/dist/TxHashMap.d.ts +60 -61
  397. package/dist/TxHashMap.d.ts.map +1 -1
  398. package/dist/TxHashMap.js +23 -23
  399. package/dist/TxHashMap.js.map +1 -1
  400. package/dist/TxHashSet.d.ts +28 -32
  401. package/dist/TxHashSet.d.ts.map +1 -1
  402. package/dist/TxHashSet.js +13 -16
  403. package/dist/TxHashSet.js.map +1 -1
  404. package/dist/TxPriorityQueue.d.ts +30 -30
  405. package/dist/TxPriorityQueue.js +18 -18
  406. package/dist/TxPubSub.d.ts +18 -18
  407. package/dist/TxPubSub.js +14 -14
  408. package/dist/TxQueue.d.ts +26 -29
  409. package/dist/TxQueue.d.ts.map +1 -1
  410. package/dist/TxQueue.js +17 -17
  411. package/dist/TxQueue.js.map +1 -1
  412. package/dist/TxReentrantLock.d.ts +21 -21
  413. package/dist/TxReentrantLock.js +15 -15
  414. package/dist/TxRef.d.ts +24 -24
  415. package/dist/TxRef.js +11 -11
  416. package/dist/TxSemaphore.d.ts +13 -74
  417. package/dist/TxSemaphore.d.ts.map +1 -1
  418. package/dist/TxSemaphore.js +9 -52
  419. package/dist/TxSemaphore.js.map +1 -1
  420. package/dist/TxSubscriptionRef.d.ts +24 -24
  421. package/dist/TxSubscriptionRef.js +11 -11
  422. package/dist/Types.d.ts +1 -4
  423. package/dist/Types.d.ts.map +1 -1
  424. package/dist/UndefinedOr.d.ts +14 -0
  425. package/dist/UndefinedOr.d.ts.map +1 -1
  426. package/dist/UndefinedOr.js +8 -0
  427. package/dist/UndefinedOr.js.map +1 -1
  428. package/dist/Unify.d.ts +8 -8
  429. package/dist/Unify.js +1 -1
  430. package/dist/Utils.d.ts +1 -2
  431. package/dist/Utils.d.ts.map +1 -1
  432. package/dist/Utils.js.map +1 -1
  433. package/dist/index.d.ts +1934 -436
  434. package/dist/index.d.ts.map +1 -1
  435. package/dist/index.js +1934 -436
  436. package/dist/index.js.map +1 -1
  437. package/dist/testing/FastCheck.d.ts +3 -3
  438. package/dist/testing/FastCheck.js +3 -3
  439. package/dist/testing/TestClock.d.ts +2 -3
  440. package/dist/testing/TestClock.d.ts.map +1 -1
  441. package/dist/testing/TestClock.js +1 -1
  442. package/dist/testing/TestClock.js.map +1 -1
  443. package/dist/testing/TestConsole.d.ts +8 -9
  444. package/dist/testing/TestConsole.d.ts.map +1 -1
  445. package/dist/testing/TestConsole.js +5 -5
  446. package/dist/testing/TestConsole.js.map +1 -1
  447. package/dist/testing/TestSchema.d.ts +2 -0
  448. package/dist/testing/TestSchema.d.ts.map +1 -1
  449. package/dist/testing/TestSchema.js +2 -0
  450. package/dist/testing/TestSchema.js.map +1 -1
  451. package/dist/testing/index.d.ts +34 -0
  452. package/dist/testing/index.d.ts.map +1 -1
  453. package/dist/testing/index.js +34 -0
  454. package/dist/testing/index.js.map +1 -1
  455. package/dist/unstable/ai/AiError.d.ts +10 -19
  456. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  457. package/dist/unstable/ai/AiError.js +0 -9
  458. package/dist/unstable/ai/AiError.js.map +1 -1
  459. package/dist/unstable/ai/Chat.d.ts +0 -1
  460. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  461. package/dist/unstable/ai/Chat.js.map +1 -1
  462. package/dist/unstable/ai/McpSchema.d.ts +3 -0
  463. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  464. package/dist/unstable/ai/McpSchema.js +2 -0
  465. package/dist/unstable/ai/McpSchema.js.map +1 -1
  466. package/dist/unstable/ai/McpServer.d.ts +3 -1
  467. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  468. package/dist/unstable/ai/McpServer.js +1 -1
  469. package/dist/unstable/ai/McpServer.js.map +1 -1
  470. package/dist/unstable/ai/Model.d.ts +2 -6
  471. package/dist/unstable/ai/Model.d.ts.map +1 -1
  472. package/dist/unstable/ai/Model.js +2 -2
  473. package/dist/unstable/ai/Model.js.map +1 -1
  474. package/dist/unstable/ai/Prompt.d.ts +8 -10
  475. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  476. package/dist/unstable/ai/Prompt.js +4 -4
  477. package/dist/unstable/ai/Prompt.js.map +1 -1
  478. package/dist/unstable/ai/Response.d.ts +20 -20
  479. package/dist/unstable/ai/ResponseIdTracker.d.ts +1 -1
  480. package/dist/unstable/ai/ResponseIdTracker.js +1 -1
  481. package/dist/unstable/ai/Telemetry.d.ts +5 -5
  482. package/dist/unstable/ai/Telemetry.js +3 -3
  483. package/dist/unstable/ai/Tokenizer.d.ts +1 -1
  484. package/dist/unstable/ai/Tool.d.ts +14 -12
  485. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  486. package/dist/unstable/ai/Tool.js +10 -9
  487. package/dist/unstable/ai/Tool.js.map +1 -1
  488. package/dist/unstable/ai/index.d.ts +80 -6
  489. package/dist/unstable/ai/index.d.ts.map +1 -1
  490. package/dist/unstable/ai/index.js +80 -6
  491. package/dist/unstable/ai/index.js.map +1 -1
  492. package/dist/unstable/cli/CliOutput.d.ts +5 -6
  493. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  494. package/dist/unstable/cli/CliOutput.js +2 -3
  495. package/dist/unstable/cli/CliOutput.js.map +1 -1
  496. package/dist/unstable/cli/Command.d.ts +3 -3
  497. package/dist/unstable/cli/Command.js +1 -1
  498. package/dist/unstable/cli/Flag.d.ts +23 -0
  499. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  500. package/dist/unstable/cli/Flag.js +23 -0
  501. package/dist/unstable/cli/Flag.js.map +1 -1
  502. package/dist/unstable/cli/HelpDoc.d.ts +4 -4
  503. package/dist/unstable/cli/Param.d.ts +33 -1
  504. package/dist/unstable/cli/Param.d.ts.map +1 -1
  505. package/dist/unstable/cli/Param.js +64 -38
  506. package/dist/unstable/cli/Param.js.map +1 -1
  507. package/dist/unstable/cli/Primitive.d.ts +1 -1
  508. package/dist/unstable/cli/Primitive.js +1 -1
  509. package/dist/unstable/cli/Prompt.d.ts +6 -14
  510. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  511. package/dist/unstable/cli/Prompt.js +2 -2
  512. package/dist/unstable/cli/Prompt.js.map +1 -1
  513. package/dist/unstable/cli/index.d.ts +212 -0
  514. package/dist/unstable/cli/index.d.ts.map +1 -1
  515. package/dist/unstable/cli/index.js +205 -6
  516. package/dist/unstable/cli/index.js.map +1 -1
  517. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  518. package/dist/unstable/cli/internal/command.js +3 -0
  519. package/dist/unstable/cli/internal/command.js.map +1 -1
  520. package/dist/unstable/cli/internal/completions/descriptor.js +3 -0
  521. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  522. package/dist/unstable/cli/internal/help.d.ts.map +1 -1
  523. package/dist/unstable/cli/internal/help.js +10 -0
  524. package/dist/unstable/cli/internal/help.js.map +1 -1
  525. package/dist/unstable/cli/internal/parser.js +3 -1
  526. package/dist/unstable/cli/internal/parser.js.map +1 -1
  527. package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
  528. package/dist/unstable/cluster/ClusterCron.js +1 -1
  529. package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
  530. package/dist/unstable/cluster/ClusterSchema.js +8 -8
  531. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +2 -2
  532. package/dist/unstable/cluster/ClusterWorkflowEngine.js +2 -2
  533. package/dist/unstable/cluster/Entity.d.ts +0 -1
  534. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  535. package/dist/unstable/cluster/Entity.js.map +1 -1
  536. package/dist/unstable/cluster/EntityProxy.d.ts +10 -14
  537. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  538. package/dist/unstable/cluster/EntityProxy.js +8 -14
  539. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  540. package/dist/unstable/cluster/EntityProxyServer.d.ts +3 -2
  541. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  542. package/dist/unstable/cluster/EntityProxyServer.js +2 -2
  543. package/dist/unstable/cluster/EntityResource.d.ts +2 -2
  544. package/dist/unstable/cluster/EntityResource.js +1 -1
  545. package/dist/unstable/cluster/Envelope.d.ts +1 -1
  546. package/dist/unstable/cluster/Envelope.js +1 -1
  547. package/dist/unstable/cluster/HttpRunner.d.ts +11 -11
  548. package/dist/unstable/cluster/HttpRunner.js +11 -11
  549. package/dist/unstable/cluster/K8sHttpClient.d.ts +5 -5
  550. package/dist/unstable/cluster/K8sHttpClient.js +5 -5
  551. package/dist/unstable/cluster/MachineId.d.ts +1 -1
  552. package/dist/unstable/cluster/MachineId.js +1 -1
  553. package/dist/unstable/cluster/MessageStorage.d.ts +1 -2
  554. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  555. package/dist/unstable/cluster/MessageStorage.js +1 -1
  556. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  557. package/dist/unstable/cluster/Runner.d.ts +1 -1
  558. package/dist/unstable/cluster/Runner.js +1 -1
  559. package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
  560. package/dist/unstable/cluster/RunnerHealth.js +2 -2
  561. package/dist/unstable/cluster/RunnerServer.d.ts +4 -4
  562. package/dist/unstable/cluster/RunnerServer.js +4 -4
  563. package/dist/unstable/cluster/Runners.d.ts +3 -3
  564. package/dist/unstable/cluster/Runners.js +3 -3
  565. package/dist/unstable/cluster/ShardId.d.ts +7 -5
  566. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  567. package/dist/unstable/cluster/ShardId.js +6 -4
  568. package/dist/unstable/cluster/ShardId.js.map +1 -1
  569. package/dist/unstable/cluster/Sharding.js +1 -1
  570. package/dist/unstable/cluster/ShardingConfig.d.ts +2 -2
  571. package/dist/unstable/cluster/ShardingConfig.js +2 -2
  572. package/dist/unstable/cluster/SingleRunner.d.ts +1 -1
  573. package/dist/unstable/cluster/SingleRunner.js +1 -1
  574. package/dist/unstable/cluster/Snowflake.d.ts +10 -9
  575. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  576. package/dist/unstable/cluster/Snowflake.js +4 -3
  577. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  578. package/dist/unstable/cluster/SocketRunner.d.ts +2 -2
  579. package/dist/unstable/cluster/SocketRunner.js +2 -2
  580. package/dist/unstable/cluster/SqlMessageStorage.d.ts +3 -3
  581. package/dist/unstable/cluster/SqlMessageStorage.js +3 -3
  582. package/dist/unstable/cluster/SqlRunnerStorage.d.ts +3 -3
  583. package/dist/unstable/cluster/SqlRunnerStorage.js +3 -3
  584. package/dist/unstable/cluster/TestRunner.d.ts +1 -1
  585. package/dist/unstable/cluster/TestRunner.js +1 -1
  586. package/dist/unstable/cluster/index.d.ts +790 -0
  587. package/dist/unstable/cluster/index.d.ts.map +1 -1
  588. package/dist/unstable/cluster/index.js +790 -0
  589. package/dist/unstable/cluster/index.js.map +1 -1
  590. package/dist/unstable/devtools/index.d.ts +58 -0
  591. package/dist/unstable/devtools/index.d.ts.map +1 -1
  592. package/dist/unstable/devtools/index.js +58 -0
  593. package/dist/unstable/devtools/index.js.map +1 -1
  594. package/dist/unstable/encoding/Sse.d.ts +16 -16
  595. package/dist/unstable/encoding/Sse.js +11 -11
  596. package/dist/unstable/encoding/index.d.ts +49 -0
  597. package/dist/unstable/encoding/index.d.ts.map +1 -1
  598. package/dist/unstable/encoding/index.js +49 -0
  599. package/dist/unstable/encoding/index.js.map +1 -1
  600. package/dist/unstable/eventlog/Event.d.ts +2 -2
  601. package/dist/unstable/eventlog/Event.js +1 -1
  602. package/dist/unstable/eventlog/EventGroup.d.ts +2 -2
  603. package/dist/unstable/eventlog/EventGroup.js +1 -1
  604. package/dist/unstable/eventlog/EventLog.d.ts +6 -7
  605. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  606. package/dist/unstable/eventlog/EventLog.js +4 -4
  607. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  608. package/dist/unstable/eventlog/EventLogRemote.d.ts +2 -2
  609. package/dist/unstable/eventlog/EventLogRemote.js +2 -2
  610. package/dist/unstable/eventlog/EventLogServer.d.ts +2 -2
  611. package/dist/unstable/eventlog/EventLogServer.js +2 -2
  612. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +2 -2
  613. package/dist/unstable/eventlog/EventLogServerEncrypted.js +2 -2
  614. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +1 -1
  615. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +1 -1
  616. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
  617. package/dist/unstable/eventlog/index.d.ts +240 -0
  618. package/dist/unstable/eventlog/index.d.ts.map +1 -1
  619. package/dist/unstable/eventlog/index.js +240 -0
  620. package/dist/unstable/eventlog/index.js.map +1 -1
  621. package/dist/unstable/http/Cookies.d.ts +6 -6
  622. package/dist/unstable/http/Cookies.js +4 -4
  623. package/dist/unstable/http/Etag.d.ts +2 -2
  624. package/dist/unstable/http/Etag.js +2 -2
  625. package/dist/unstable/http/Headers.d.ts +2 -2
  626. package/dist/unstable/http/Headers.js +1 -1
  627. package/dist/unstable/http/HttpClient.d.ts +5 -6
  628. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  629. package/dist/unstable/http/HttpClient.js +5 -4
  630. package/dist/unstable/http/HttpClient.js.map +1 -1
  631. package/dist/unstable/http/HttpClientError.d.ts +1 -1
  632. package/dist/unstable/http/HttpClientError.js +1 -1
  633. package/dist/unstable/http/HttpClientRequest.d.ts +4 -4
  634. package/dist/unstable/http/HttpClientRequest.js +4 -4
  635. package/dist/unstable/http/HttpClientResponse.d.ts +6 -6
  636. package/dist/unstable/http/HttpClientResponse.js +6 -6
  637. package/dist/unstable/http/HttpEffect.d.ts +5 -5
  638. package/dist/unstable/http/HttpEffect.js +5 -5
  639. package/dist/unstable/http/HttpIncomingMessage.d.ts +7 -6
  640. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  641. package/dist/unstable/http/HttpIncomingMessage.js +7 -6
  642. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  643. package/dist/unstable/http/HttpMethod.d.ts +4 -2
  644. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  645. package/dist/unstable/http/HttpMethod.js +4 -1
  646. package/dist/unstable/http/HttpMethod.js.map +1 -1
  647. package/dist/unstable/http/HttpMiddleware.d.ts +1 -0
  648. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  649. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  650. package/dist/unstable/http/HttpRouter.d.ts +23 -25
  651. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  652. package/dist/unstable/http/HttpRouter.js +23 -22
  653. package/dist/unstable/http/HttpRouter.js.map +1 -1
  654. package/dist/unstable/http/HttpServerError.d.ts +4 -1
  655. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  656. package/dist/unstable/http/HttpServerError.js +4 -1
  657. package/dist/unstable/http/HttpServerError.js.map +1 -1
  658. package/dist/unstable/http/HttpServerRequest.d.ts +15 -15
  659. package/dist/unstable/http/HttpServerRequest.js +15 -15
  660. package/dist/unstable/http/HttpServerRespondable.d.ts +1 -1
  661. package/dist/unstable/http/HttpServerRespondable.js +1 -1
  662. package/dist/unstable/http/HttpServerResponse.d.ts +5 -4
  663. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  664. package/dist/unstable/http/HttpServerResponse.js +5 -4
  665. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  666. package/dist/unstable/http/HttpStaticServer.d.ts +2 -4
  667. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  668. package/dist/unstable/http/HttpStaticServer.js +2 -4
  669. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  670. package/dist/unstable/http/Multipart.d.ts +20 -19
  671. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  672. package/dist/unstable/http/Multipart.js +19 -17
  673. package/dist/unstable/http/Multipart.js.map +1 -1
  674. package/dist/unstable/http/Template.d.ts +0 -1
  675. package/dist/unstable/http/Template.d.ts.map +1 -1
  676. package/dist/unstable/http/Template.js.map +1 -1
  677. package/dist/unstable/http/Url.d.ts +17 -17
  678. package/dist/unstable/http/Url.js +8 -8
  679. package/dist/unstable/http/UrlParams.d.ts +14 -12
  680. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  681. package/dist/unstable/http/UrlParams.js +12 -10
  682. package/dist/unstable/http/UrlParams.js.map +1 -1
  683. package/dist/unstable/http/index.d.ts +452 -0
  684. package/dist/unstable/http/index.d.ts.map +1 -1
  685. package/dist/unstable/http/index.js +452 -0
  686. package/dist/unstable/http/index.js.map +1 -1
  687. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +0 -1
  688. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  689. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  690. package/dist/unstable/httpapi/HttpApiClient.d.ts +0 -1
  691. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  692. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  693. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +4 -2
  694. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  695. package/dist/unstable/httpapi/HttpApiMiddleware.js +3 -1
  696. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  697. package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
  698. package/dist/unstable/httpapi/HttpApiSchema.d.ts +19 -8
  699. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  700. package/dist/unstable/httpapi/HttpApiSchema.js +11 -8
  701. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  702. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +0 -1
  703. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  704. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  705. package/dist/unstable/httpapi/HttpApiSwagger.d.ts +0 -2
  706. package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
  707. package/dist/unstable/httpapi/HttpApiSwagger.js +0 -2
  708. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  709. package/dist/unstable/httpapi/index.d.ts +310 -25
  710. package/dist/unstable/httpapi/index.d.ts.map +1 -1
  711. package/dist/unstable/httpapi/index.js +310 -25
  712. package/dist/unstable/httpapi/index.js.map +1 -1
  713. package/dist/unstable/observability/Otlp.d.ts +3 -3
  714. package/dist/unstable/observability/Otlp.js +3 -3
  715. package/dist/unstable/observability/OtlpExporter.d.ts +1 -1
  716. package/dist/unstable/observability/OtlpExporter.js +1 -1
  717. package/dist/unstable/observability/OtlpLogger.d.ts +3 -2
  718. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  719. package/dist/unstable/observability/OtlpLogger.js +2 -2
  720. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  721. package/dist/unstable/observability/OtlpMetrics.d.ts +5 -4
  722. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  723. package/dist/unstable/observability/OtlpMetrics.js +2 -2
  724. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  725. package/dist/unstable/observability/OtlpResource.d.ts +9 -9
  726. package/dist/unstable/observability/OtlpResource.js +2 -2
  727. package/dist/unstable/observability/OtlpSerialization.d.ts +3 -3
  728. package/dist/unstable/observability/OtlpSerialization.js +3 -3
  729. package/dist/unstable/observability/OtlpTracer.d.ts +5 -2
  730. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  731. package/dist/unstable/observability/OtlpTracer.js +2 -2
  732. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  733. package/dist/unstable/observability/PrometheusMetrics.d.ts +7 -7
  734. package/dist/unstable/observability/PrometheusMetrics.js +2 -2
  735. package/dist/unstable/observability/index.d.ts +159 -3
  736. package/dist/unstable/observability/index.d.ts.map +1 -1
  737. package/dist/unstable/observability/index.js +159 -3
  738. package/dist/unstable/observability/index.js.map +1 -1
  739. package/dist/unstable/persistence/KeyValueStore.d.ts +4 -4
  740. package/dist/unstable/persistence/KeyValueStore.js +1 -1
  741. package/dist/unstable/persistence/Persistable.d.ts +11 -11
  742. package/dist/unstable/persistence/Persistable.js +1 -1
  743. package/dist/unstable/persistence/PersistedCache.d.ts +2 -2
  744. package/dist/unstable/persistence/PersistedCache.js +1 -1
  745. package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
  746. package/dist/unstable/persistence/PersistedQueue.js +3 -3
  747. package/dist/unstable/persistence/Persistence.d.ts +2 -1
  748. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  749. package/dist/unstable/persistence/Persistence.js +2 -1
  750. package/dist/unstable/persistence/Persistence.js.map +1 -1
  751. package/dist/unstable/persistence/RateLimiter.d.ts +19 -15
  752. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  753. package/dist/unstable/persistence/RateLimiter.js +14 -10
  754. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  755. package/dist/unstable/persistence/Redis.d.ts +3 -3
  756. package/dist/unstable/persistence/Redis.js +3 -3
  757. package/dist/unstable/persistence/index.d.ts +147 -0
  758. package/dist/unstable/persistence/index.d.ts.map +1 -1
  759. package/dist/unstable/persistence/index.js +147 -0
  760. package/dist/unstable/persistence/index.js.map +1 -1
  761. package/dist/unstable/process/ChildProcess.d.ts +41 -41
  762. package/dist/unstable/process/ChildProcess.js +11 -11
  763. package/dist/unstable/process/ChildProcessSpawner.d.ts +10 -10
  764. package/dist/unstable/process/ChildProcessSpawner.js +5 -5
  765. package/dist/unstable/process/index.d.ts +1 -1
  766. package/dist/unstable/process/index.js +1 -1
  767. package/dist/unstable/reactivity/AsyncResult.d.ts +8 -6
  768. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  769. package/dist/unstable/reactivity/AsyncResult.js +3 -3
  770. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  771. package/dist/unstable/reactivity/Atom.d.ts +25 -20
  772. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  773. package/dist/unstable/reactivity/Atom.js +12 -12
  774. package/dist/unstable/reactivity/Atom.js.map +1 -1
  775. package/dist/unstable/reactivity/AtomHttpApi.d.ts +2 -2
  776. package/dist/unstable/reactivity/AtomHttpApi.js +1 -1
  777. package/dist/unstable/reactivity/AtomRef.d.ts +2 -2
  778. package/dist/unstable/reactivity/AtomRef.js +1 -1
  779. package/dist/unstable/reactivity/AtomRegistry.d.ts +16 -16
  780. package/dist/unstable/reactivity/AtomRegistry.js +7 -7
  781. package/dist/unstable/reactivity/AtomRpc.d.ts +2 -2
  782. package/dist/unstable/reactivity/AtomRpc.js +1 -1
  783. package/dist/unstable/reactivity/Reactivity.d.ts +2 -3
  784. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  785. package/dist/unstable/reactivity/Reactivity.js +2 -3
  786. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  787. package/dist/unstable/reactivity/index.d.ts +166 -0
  788. package/dist/unstable/reactivity/index.d.ts.map +1 -1
  789. package/dist/unstable/reactivity/index.js +166 -0
  790. package/dist/unstable/reactivity/index.js.map +1 -1
  791. package/dist/unstable/rpc/Rpc.d.ts +0 -1
  792. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  793. package/dist/unstable/rpc/Rpc.js.map +1 -1
  794. package/dist/unstable/rpc/RpcClient.d.ts +0 -1
  795. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  796. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  797. package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
  798. package/dist/unstable/rpc/RpcClientError.js +2 -2
  799. package/dist/unstable/rpc/RpcMiddleware.d.ts +2 -2
  800. package/dist/unstable/rpc/RpcMiddleware.js +1 -1
  801. package/dist/unstable/rpc/RpcWorker.d.ts +0 -1
  802. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  803. package/dist/unstable/rpc/RpcWorker.js +1 -1
  804. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  805. package/dist/unstable/rpc/Utils.d.ts +2 -0
  806. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  807. package/dist/unstable/rpc/Utils.js +2 -0
  808. package/dist/unstable/rpc/Utils.js.map +1 -1
  809. package/dist/unstable/rpc/index.d.ts +272 -0
  810. package/dist/unstable/rpc/index.d.ts.map +1 -1
  811. package/dist/unstable/rpc/index.js +272 -0
  812. package/dist/unstable/rpc/index.js.map +1 -1
  813. package/dist/unstable/schema/Model.d.ts +63 -8
  814. package/dist/unstable/schema/Model.d.ts.map +1 -1
  815. package/dist/unstable/schema/Model.js +44 -5
  816. package/dist/unstable/schema/Model.js.map +1 -1
  817. package/dist/unstable/schema/VariantSchema.d.ts +1 -4
  818. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  819. package/dist/unstable/schema/VariantSchema.js +1 -1
  820. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  821. package/dist/unstable/schema/index.d.ts +37 -0
  822. package/dist/unstable/schema/index.d.ts.map +1 -1
  823. package/dist/unstable/schema/index.js +37 -0
  824. package/dist/unstable/schema/index.js.map +1 -1
  825. package/dist/unstable/socket/Socket.d.ts +5 -4
  826. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  827. package/dist/unstable/socket/Socket.js +4 -3
  828. package/dist/unstable/socket/Socket.js.map +1 -1
  829. package/dist/unstable/socket/index.d.ts +44 -0
  830. package/dist/unstable/socket/index.d.ts.map +1 -1
  831. package/dist/unstable/socket/index.js +44 -0
  832. package/dist/unstable/socket/index.js.map +1 -1
  833. package/dist/unstable/sql/Migrator.d.ts +11 -9
  834. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  835. package/dist/unstable/sql/Migrator.js +10 -8
  836. package/dist/unstable/sql/Migrator.js.map +1 -1
  837. package/dist/unstable/sql/SqlClient.d.ts +4 -0
  838. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  839. package/dist/unstable/sql/SqlClient.js +2 -0
  840. package/dist/unstable/sql/SqlClient.js.map +1 -1
  841. package/dist/unstable/sql/SqlConnection.d.ts +3 -3
  842. package/dist/unstable/sql/SqlError.d.ts +18 -0
  843. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  844. package/dist/unstable/sql/SqlError.js +17 -0
  845. package/dist/unstable/sql/SqlError.js.map +1 -1
  846. package/dist/unstable/sql/SqlModel.d.ts +0 -1
  847. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  848. package/dist/unstable/sql/SqlModel.js.map +1 -1
  849. package/dist/unstable/sql/SqlSchema.d.ts +5 -5
  850. package/dist/unstable/sql/SqlSchema.js +5 -5
  851. package/dist/unstable/sql/SqlStream.d.ts +1 -0
  852. package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
  853. package/dist/unstable/sql/SqlStream.js +1 -0
  854. package/dist/unstable/sql/SqlStream.js.map +1 -1
  855. package/dist/unstable/sql/Statement.d.ts +27 -24
  856. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  857. package/dist/unstable/sql/Statement.js +9 -6
  858. package/dist/unstable/sql/Statement.js.map +1 -1
  859. package/dist/unstable/sql/index.d.ts +178 -1
  860. package/dist/unstable/sql/index.d.ts.map +1 -1
  861. package/dist/unstable/sql/index.js +178 -1
  862. package/dist/unstable/sql/index.js.map +1 -1
  863. package/dist/unstable/workers/Transferable.d.ts +7 -7
  864. package/dist/unstable/workers/Transferable.js +4 -4
  865. package/dist/unstable/workers/Worker.d.ts +1 -0
  866. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  867. package/dist/unstable/workers/Worker.js +1 -0
  868. package/dist/unstable/workers/Worker.js.map +1 -1
  869. package/dist/unstable/workers/WorkerError.d.ts +8 -8
  870. package/dist/unstable/workers/WorkerError.js +7 -7
  871. package/dist/unstable/workers/index.d.ts +80 -0
  872. package/dist/unstable/workers/index.d.ts.map +1 -1
  873. package/dist/unstable/workers/index.js +80 -0
  874. package/dist/unstable/workers/index.js.map +1 -1
  875. package/dist/unstable/workflow/Activity.d.ts +7 -7
  876. package/dist/unstable/workflow/Activity.js +2 -2
  877. package/dist/unstable/workflow/DurableClock.d.ts +2 -2
  878. package/dist/unstable/workflow/DurableClock.js +1 -1
  879. package/dist/unstable/workflow/DurableDeferred.d.ts +22 -20
  880. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  881. package/dist/unstable/workflow/DurableDeferred.js +8 -7
  882. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  883. package/dist/unstable/workflow/DurableQueue.d.ts +7 -5
  884. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  885. package/dist/unstable/workflow/DurableQueue.js +5 -3
  886. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  887. package/dist/unstable/workflow/Workflow.d.ts +12 -10
  888. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  889. package/dist/unstable/workflow/Workflow.js +3 -3
  890. package/dist/unstable/workflow/Workflow.js.map +1 -1
  891. package/dist/unstable/workflow/WorkflowEngine.d.ts +4 -4
  892. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  893. package/dist/unstable/workflow/WorkflowEngine.js +9 -13
  894. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  895. package/dist/unstable/workflow/WorkflowProxy.d.ts +10 -12
  896. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  897. package/dist/unstable/workflow/WorkflowProxy.js +8 -12
  898. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  899. package/dist/unstable/workflow/WorkflowProxyServer.d.ts +3 -2
  900. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  901. package/dist/unstable/workflow/WorkflowProxyServer.js +2 -2
  902. package/dist/unstable/workflow/index.d.ts +160 -0
  903. package/dist/unstable/workflow/index.d.ts.map +1 -1
  904. package/dist/unstable/workflow/index.js +160 -0
  905. package/dist/unstable/workflow/index.js.map +1 -1
  906. package/package.json +3 -3
  907. package/src/Array.ts +41 -42
  908. package/src/BigDecimal.ts +265 -265
  909. package/src/BigInt.ts +175 -177
  910. package/src/Boolean.ts +127 -125
  911. package/src/Brand.ts +10 -4
  912. package/src/Cache.ts +42 -42
  913. package/src/Cause.ts +17 -18
  914. package/src/Channel.ts +256 -257
  915. package/src/Chunk.ts +33 -56
  916. package/src/Clock.ts +1 -1
  917. package/src/Combiner.ts +9 -1
  918. package/src/Config.ts +78 -68
  919. package/src/ConfigProvider.ts +33 -32
  920. package/src/Console.ts +23 -23
  921. package/src/Context.ts +70 -108
  922. package/src/Cron.ts +3 -5
  923. package/src/Crypto.ts +327 -0
  924. package/src/Data.ts +6 -1
  925. package/src/DateTime.ts +29 -31
  926. package/src/Deferred.ts +8 -9
  927. package/src/Differ.ts +2 -2
  928. package/src/Duration.ts +30 -27
  929. package/src/Effect.ts +893 -1151
  930. package/src/Effectable.ts +2 -2
  931. package/src/Encoding.ts +9 -9
  932. package/src/Equal.ts +4 -3
  933. package/src/Equivalence.ts +4 -5
  934. package/src/ErrorReporter.ts +14 -14
  935. package/src/ExecutionPlan.ts +18 -9
  936. package/src/Exit.ts +0 -1
  937. package/src/Fiber.ts +1 -2
  938. package/src/FiberHandle.ts +5 -5
  939. package/src/FiberMap.ts +10 -10
  940. package/src/FiberSet.ts +4 -4
  941. package/src/FileSystem.ts +10 -12
  942. package/src/Filter.ts +54 -54
  943. package/src/Formatter.ts +4 -70
  944. package/src/Function.ts +64 -65
  945. package/src/Graph.ts +157 -175
  946. package/src/Hash.ts +4 -6
  947. package/src/HashMap.ts +121 -157
  948. package/src/HashRing.ts +34 -34
  949. package/src/HashSet.ts +51 -55
  950. package/src/Inspectable.ts +8 -7
  951. package/src/Iterable.ts +37 -83
  952. package/src/JsonPatch.ts +9 -7
  953. package/src/JsonPointer.ts +13 -11
  954. package/src/JsonSchema.ts +16 -0
  955. package/src/Latch.ts +4 -16
  956. package/src/Layer.ts +94 -135
  957. package/src/LayerMap.ts +15 -16
  958. package/src/LogLevel.ts +13 -13
  959. package/src/Logger.ts +16 -17
  960. package/src/ManagedRuntime.ts +5 -4
  961. package/src/Match.ts +2 -4
  962. package/src/Metric.ts +56 -58
  963. package/src/MutableHashMap.ts +42 -44
  964. package/src/MutableHashSet.ts +0 -2
  965. package/src/MutableList.ts +23 -26
  966. package/src/MutableRef.ts +0 -1
  967. package/src/Newtype.ts +12 -2
  968. package/src/NonEmptyIterable.ts +5 -12
  969. package/src/Number.ts +145 -141
  970. package/src/Optic.ts +5 -5
  971. package/src/Option.ts +105 -109
  972. package/src/Order.ts +6 -6
  973. package/src/Ordering.ts +15 -19
  974. package/src/PartitionedSemaphore.ts +3 -3
  975. package/src/Path.ts +4 -4
  976. package/src/Pipeable.ts +10 -7
  977. package/src/PlatformError.ts +3 -3
  978. package/src/Predicate.ts +3 -5
  979. package/src/PrimaryKey.ts +2 -1
  980. package/src/PubSub.ts +25 -51
  981. package/src/Queue.ts +45 -60
  982. package/src/Random.ts +31 -74
  983. package/src/RcMap.ts +11 -11
  984. package/src/RcRef.ts +0 -1
  985. package/src/Record.ts +9 -8
  986. package/src/Redactable.ts +7 -5
  987. package/src/Redacted.ts +2 -3
  988. package/src/Reducer.ts +3 -1
  989. package/src/Ref.ts +15 -33
  990. package/src/RegExp.ts +1 -1
  991. package/src/Request.ts +2 -1
  992. package/src/RequestResolver.ts +2 -3
  993. package/src/Resource.ts +1 -1
  994. package/src/Result.ts +124 -142
  995. package/src/Runtime.ts +2 -7
  996. package/src/Schedule.ts +74 -77
  997. package/src/Scheduler.ts +2 -2
  998. package/src/Schema.ts +491 -321
  999. package/src/SchemaAST.ts +98 -77
  1000. package/src/SchemaGetter.ts +23 -23
  1001. package/src/SchemaIssue.ts +18 -16
  1002. package/src/SchemaParser.ts +46 -49
  1003. package/src/SchemaRepresentation.ts +89 -77
  1004. package/src/SchemaTransformation.ts +36 -5
  1005. package/src/SchemaUtils.ts +1 -1
  1006. package/src/Scope.ts +12 -29
  1007. package/src/ScopedCache.ts +43 -43
  1008. package/src/Semaphore.ts +4 -16
  1009. package/src/Sink.ts +36 -39
  1010. package/src/Stdio.ts +6 -6
  1011. package/src/Stream.ts +789 -828
  1012. package/src/String.ts +3 -2
  1013. package/src/Struct.ts +20 -18
  1014. package/src/SubscriptionRef.ts +2 -2
  1015. package/src/Symbol.ts +3 -3
  1016. package/src/SynchronizedRef.ts +1 -1
  1017. package/src/Take.ts +2 -2
  1018. package/src/Terminal.ts +5 -5
  1019. package/src/Tracer.ts +9 -9
  1020. package/src/Trie.ts +70 -106
  1021. package/src/Tuple.ts +34 -32
  1022. package/src/TxChunk.ts +27 -18
  1023. package/src/TxDeferred.ts +11 -11
  1024. package/src/TxHashMap.ts +62 -63
  1025. package/src/TxHashSet.ts +38 -42
  1026. package/src/TxPriorityQueue.ts +31 -31
  1027. package/src/TxPubSub.ts +18 -18
  1028. package/src/TxQueue.ts +26 -29
  1029. package/src/TxReentrantLock.ts +21 -21
  1030. package/src/TxRef.ts +24 -24
  1031. package/src/TxSemaphore.ts +13 -74
  1032. package/src/TxSubscriptionRef.ts +24 -24
  1033. package/src/Types.ts +1 -4
  1034. package/src/UndefinedOr.ts +14 -0
  1035. package/src/Unify.ts +8 -8
  1036. package/src/Utils.ts +1 -2
  1037. package/src/index.ts +1932 -433
  1038. package/src/testing/FastCheck.ts +3 -3
  1039. package/src/testing/TestClock.ts +2 -3
  1040. package/src/testing/TestConsole.ts +8 -9
  1041. package/src/testing/TestSchema.ts +2 -0
  1042. package/src/testing/index.ts +34 -0
  1043. package/src/unstable/ai/AiError.ts +10 -19
  1044. package/src/unstable/ai/Chat.ts +0 -1
  1045. package/src/unstable/ai/McpSchema.ts +3 -0
  1046. package/src/unstable/ai/McpServer.ts +3 -1
  1047. package/src/unstable/ai/Model.ts +2 -6
  1048. package/src/unstable/ai/Prompt.ts +8 -10
  1049. package/src/unstable/ai/Response.ts +20 -20
  1050. package/src/unstable/ai/ResponseIdTracker.ts +1 -1
  1051. package/src/unstable/ai/Telemetry.ts +5 -5
  1052. package/src/unstable/ai/Tokenizer.ts +1 -1
  1053. package/src/unstable/ai/Tool.ts +14 -12
  1054. package/src/unstable/ai/index.ts +80 -6
  1055. package/src/unstable/cli/CliOutput.ts +5 -6
  1056. package/src/unstable/cli/Command.ts +3 -3
  1057. package/src/unstable/cli/Flag.ts +24 -0
  1058. package/src/unstable/cli/HelpDoc.ts +4 -4
  1059. package/src/unstable/cli/Param.ts +101 -72
  1060. package/src/unstable/cli/Primitive.ts +1 -1
  1061. package/src/unstable/cli/Prompt.ts +6 -14
  1062. package/src/unstable/cli/index.ts +205 -6
  1063. package/src/unstable/cli/internal/command.ts +3 -0
  1064. package/src/unstable/cli/internal/completions/descriptor.ts +3 -0
  1065. package/src/unstable/cli/internal/help.ts +10 -0
  1066. package/src/unstable/cli/internal/parser.ts +3 -1
  1067. package/src/unstable/cluster/ClusterCron.ts +1 -1
  1068. package/src/unstable/cluster/ClusterSchema.ts +8 -8
  1069. package/src/unstable/cluster/ClusterWorkflowEngine.ts +2 -2
  1070. package/src/unstable/cluster/Entity.ts +0 -1
  1071. package/src/unstable/cluster/EntityProxy.ts +10 -14
  1072. package/src/unstable/cluster/EntityProxyServer.ts +3 -2
  1073. package/src/unstable/cluster/EntityResource.ts +2 -2
  1074. package/src/unstable/cluster/Envelope.ts +1 -1
  1075. package/src/unstable/cluster/HttpRunner.ts +11 -11
  1076. package/src/unstable/cluster/K8sHttpClient.ts +5 -5
  1077. package/src/unstable/cluster/MachineId.ts +1 -1
  1078. package/src/unstable/cluster/MessageStorage.ts +1 -2
  1079. package/src/unstable/cluster/Runner.ts +1 -1
  1080. package/src/unstable/cluster/RunnerHealth.ts +2 -2
  1081. package/src/unstable/cluster/RunnerServer.ts +4 -4
  1082. package/src/unstable/cluster/Runners.ts +3 -3
  1083. package/src/unstable/cluster/ShardId.ts +7 -5
  1084. package/src/unstable/cluster/Sharding.ts +1 -1
  1085. package/src/unstable/cluster/ShardingConfig.ts +2 -2
  1086. package/src/unstable/cluster/SingleRunner.ts +1 -1
  1087. package/src/unstable/cluster/Snowflake.ts +10 -9
  1088. package/src/unstable/cluster/SocketRunner.ts +2 -2
  1089. package/src/unstable/cluster/SqlMessageStorage.ts +3 -3
  1090. package/src/unstable/cluster/SqlRunnerStorage.ts +3 -3
  1091. package/src/unstable/cluster/TestRunner.ts +1 -1
  1092. package/src/unstable/cluster/index.ts +790 -0
  1093. package/src/unstable/devtools/index.ts +58 -0
  1094. package/src/unstable/encoding/Sse.ts +16 -16
  1095. package/src/unstable/encoding/index.ts +49 -0
  1096. package/src/unstable/eventlog/Event.ts +2 -2
  1097. package/src/unstable/eventlog/EventGroup.ts +2 -2
  1098. package/src/unstable/eventlog/EventLog.ts +6 -7
  1099. package/src/unstable/eventlog/EventLogRemote.ts +2 -2
  1100. package/src/unstable/eventlog/EventLogServer.ts +2 -2
  1101. package/src/unstable/eventlog/EventLogServerEncrypted.ts +2 -2
  1102. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +1 -1
  1103. package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
  1104. package/src/unstable/eventlog/index.ts +240 -0
  1105. package/src/unstable/http/Cookies.ts +6 -6
  1106. package/src/unstable/http/Etag.ts +2 -2
  1107. package/src/unstable/http/Headers.ts +2 -2
  1108. package/src/unstable/http/HttpClient.ts +5 -6
  1109. package/src/unstable/http/HttpClientError.ts +1 -1
  1110. package/src/unstable/http/HttpClientRequest.ts +4 -4
  1111. package/src/unstable/http/HttpClientResponse.ts +6 -6
  1112. package/src/unstable/http/HttpEffect.ts +5 -5
  1113. package/src/unstable/http/HttpIncomingMessage.ts +7 -6
  1114. package/src/unstable/http/HttpMethod.ts +4 -2
  1115. package/src/unstable/http/HttpMiddleware.ts +1 -0
  1116. package/src/unstable/http/HttpRouter.ts +23 -25
  1117. package/src/unstable/http/HttpServerError.ts +4 -1
  1118. package/src/unstable/http/HttpServerRequest.ts +15 -15
  1119. package/src/unstable/http/HttpServerRespondable.ts +1 -1
  1120. package/src/unstable/http/HttpServerResponse.ts +5 -4
  1121. package/src/unstable/http/HttpStaticServer.ts +2 -4
  1122. package/src/unstable/http/Multipart.ts +20 -19
  1123. package/src/unstable/http/Template.ts +0 -1
  1124. package/src/unstable/http/Url.ts +17 -17
  1125. package/src/unstable/http/UrlParams.ts +14 -12
  1126. package/src/unstable/http/index.ts +452 -0
  1127. package/src/unstable/httpapi/HttpApiBuilder.ts +0 -1
  1128. package/src/unstable/httpapi/HttpApiClient.ts +0 -1
  1129. package/src/unstable/httpapi/HttpApiMiddleware.ts +4 -2
  1130. package/src/unstable/httpapi/HttpApiScalar.ts +2 -2
  1131. package/src/unstable/httpapi/HttpApiSchema.ts +19 -8
  1132. package/src/unstable/httpapi/HttpApiSecurity.ts +0 -1
  1133. package/src/unstable/httpapi/HttpApiSwagger.ts +0 -2
  1134. package/src/unstable/httpapi/index.ts +310 -25
  1135. package/src/unstable/observability/Otlp.ts +3 -3
  1136. package/src/unstable/observability/OtlpExporter.ts +1 -1
  1137. package/src/unstable/observability/OtlpLogger.ts +3 -2
  1138. package/src/unstable/observability/OtlpMetrics.ts +5 -4
  1139. package/src/unstable/observability/OtlpResource.ts +9 -9
  1140. package/src/unstable/observability/OtlpSerialization.ts +3 -3
  1141. package/src/unstable/observability/OtlpTracer.ts +5 -2
  1142. package/src/unstable/observability/PrometheusMetrics.ts +7 -7
  1143. package/src/unstable/observability/index.ts +159 -3
  1144. package/src/unstable/persistence/KeyValueStore.ts +4 -4
  1145. package/src/unstable/persistence/Persistable.ts +11 -11
  1146. package/src/unstable/persistence/PersistedCache.ts +2 -2
  1147. package/src/unstable/persistence/PersistedQueue.ts +6 -6
  1148. package/src/unstable/persistence/Persistence.ts +2 -1
  1149. package/src/unstable/persistence/RateLimiter.ts +19 -15
  1150. package/src/unstable/persistence/Redis.ts +3 -3
  1151. package/src/unstable/persistence/index.ts +147 -0
  1152. package/src/unstable/process/ChildProcess.ts +42 -42
  1153. package/src/unstable/process/ChildProcessSpawner.ts +10 -10
  1154. package/src/unstable/process/index.ts +1 -1
  1155. package/src/unstable/reactivity/AsyncResult.ts +8 -6
  1156. package/src/unstable/reactivity/Atom.ts +25 -20
  1157. package/src/unstable/reactivity/AtomHttpApi.ts +2 -2
  1158. package/src/unstable/reactivity/AtomRef.ts +2 -2
  1159. package/src/unstable/reactivity/AtomRegistry.ts +17 -17
  1160. package/src/unstable/reactivity/AtomRpc.ts +2 -2
  1161. package/src/unstable/reactivity/Reactivity.ts +2 -3
  1162. package/src/unstable/reactivity/index.ts +166 -0
  1163. package/src/unstable/rpc/Rpc.ts +0 -1
  1164. package/src/unstable/rpc/RpcClient.ts +0 -1
  1165. package/src/unstable/rpc/RpcClientError.ts +2 -2
  1166. package/src/unstable/rpc/RpcMiddleware.ts +2 -2
  1167. package/src/unstable/rpc/RpcWorker.ts +3 -2
  1168. package/src/unstable/rpc/Utils.ts +2 -0
  1169. package/src/unstable/rpc/index.ts +272 -0
  1170. package/src/unstable/schema/Model.ts +98 -10
  1171. package/src/unstable/schema/VariantSchema.ts +1 -4
  1172. package/src/unstable/schema/index.ts +37 -0
  1173. package/src/unstable/socket/Socket.ts +5 -4
  1174. package/src/unstable/socket/index.ts +44 -0
  1175. package/src/unstable/sql/Migrator.ts +14 -12
  1176. package/src/unstable/sql/SqlClient.ts +4 -0
  1177. package/src/unstable/sql/SqlConnection.ts +3 -3
  1178. package/src/unstable/sql/SqlError.ts +18 -0
  1179. package/src/unstable/sql/SqlModel.ts +0 -1
  1180. package/src/unstable/sql/SqlSchema.ts +5 -5
  1181. package/src/unstable/sql/SqlStream.ts +1 -0
  1182. package/src/unstable/sql/Statement.ts +27 -24
  1183. package/src/unstable/sql/index.ts +178 -1
  1184. package/src/unstable/workers/Transferable.ts +7 -7
  1185. package/src/unstable/workers/Worker.ts +1 -0
  1186. package/src/unstable/workers/WorkerError.ts +8 -8
  1187. package/src/unstable/workers/index.ts +80 -0
  1188. package/src/unstable/workflow/Activity.ts +7 -7
  1189. package/src/unstable/workflow/DurableClock.ts +2 -2
  1190. package/src/unstable/workflow/DurableDeferred.ts +22 -20
  1191. package/src/unstable/workflow/DurableQueue.ts +7 -5
  1192. package/src/unstable/workflow/Workflow.ts +12 -10
  1193. package/src/unstable/workflow/WorkflowEngine.ts +11 -15
  1194. package/src/unstable/workflow/WorkflowProxy.ts +10 -12
  1195. package/src/unstable/workflow/WorkflowProxyServer.ts +3 -2
  1196. package/src/unstable/workflow/index.ts +160 -0
package/dist/index.d.ts CHANGED
@@ -151,6 +151,41 @@ export * as Boolean from "./Boolean.ts";
151
151
  */
152
152
  export * as Brand from "./Brand.ts";
153
153
  /**
154
+ * The `Cache` module provides an effectful, mutable key-value cache for values
155
+ * that are computed by a lookup function. A `Cache<Key, A, E, R>` stores lookup
156
+ * results for keys, shares concurrent lookups for the same key, and manages
157
+ * entry lifetime with capacity limits and optional time-to-live policies.
158
+ *
159
+ * **Mental model**
160
+ *
161
+ * - A cache is created from a lookup function and a maximum capacity
162
+ * - {@link get} returns a cached value when present, or runs the lookup on a miss
163
+ * - Concurrent misses for the same key share one pending lookup
164
+ * - Lookup failures are cached as failures until the entry expires, is invalidated, or is refreshed
165
+ * - Entries can live forever, expire after a fixed duration, or use a dynamic TTL based on the lookup `Exit`
166
+ * - Capacity is enforced by removing the oldest stored entries when new entries are added
167
+ *
168
+ * **Common tasks**
169
+ *
170
+ * - Create a cache: {@link make}, {@link makeWith}
171
+ * - Read values: {@link get}, {@link getOption}, {@link getSuccess}
172
+ * - Seed or overwrite values: {@link set}
173
+ * - Refresh values: {@link refresh}
174
+ * - Remove entries: {@link invalidate}, {@link invalidateWhen}, {@link invalidateAll}
175
+ * - Inspect contents: {@link has}, {@link size}, {@link keys}, {@link values}, {@link entries}
176
+ *
177
+ * **Gotchas**
178
+ *
179
+ * - {@link getOption} does not run the lookup; it only reads an existing non-expired entry
180
+ * - {@link size} may include expired entries until they are observed and removed
181
+ * - {@link values} and {@link entries} include only successfully resolved entries
182
+ * - Use `Data` or another `Equal`-compatible key type when keys need structural equality
183
+ *
184
+ * **See also**
185
+ *
186
+ * - {@link Duration} for configuring fixed or dynamic time-to-live values
187
+ * - {@link Effect} for the lookup effects used to compute cached values
188
+ *
154
189
  * @since 4.0.0
155
190
  */
156
191
  export * as Cache from "./Cache.ts";
@@ -296,6 +331,48 @@ export * as Cause from "./Cause.ts";
296
331
  */
297
332
  export * as Channel from "./Channel.ts";
298
333
  /**
334
+ * The `ChannelSchema` module provides helpers for applying `Schema` encoding
335
+ * and decoding at `Channel` boundaries. It is useful when a channel should
336
+ * expose typed values to application code while communicating with an upstream
337
+ * or downstream component through an encoded representation such as JSON-ready
338
+ * data, wire protocol values, or any other schema-defined format.
339
+ *
340
+ * **Mental model**
341
+ *
342
+ * - A channel schema adapter is a streaming boundary: chunks flow through a
343
+ * `Channel`, and each non-empty chunk is validated and transformed with a
344
+ * `Schema`
345
+ * - `encode` turns typed schema values into their encoded representation before
346
+ * they leave a typed part of a pipeline
347
+ * - `decode` turns encoded input into typed schema values before application
348
+ * code consumes them
349
+ * - `duplex` wraps a bidirectional channel so callers work with typed input and
350
+ * output while the wrapped channel continues to operate on encoded chunks
351
+ * - Schema failures are surfaced through the channel error type as
352
+ * `SchemaError`, and schema services are reflected in the channel
353
+ * requirements
354
+ *
355
+ * **Common tasks**
356
+ *
357
+ * - Encode typed channel input before sending it to an encoded transport:
358
+ * {@link encode}
359
+ * - Decode encoded channel output before handling it as domain data:
360
+ * {@link decode}
361
+ * - Use unknown encoded boundaries when static encoded types are intentionally
362
+ * erased: {@link encodeUnknown} and {@link decodeUnknown}
363
+ * - Wrap a bidirectional encoded channel with typed input and output schemas:
364
+ * {@link duplex} or {@link duplexUnknown}
365
+ *
366
+ * **Gotchas**
367
+ *
368
+ * - These helpers operate on `NonEmptyReadonlyArray` chunks, so schemas are
369
+ * applied to non-empty batches rather than individual scalar values
370
+ * - Encoding and decoding can require services from the schema; those
371
+ * requirements become part of the resulting channel type
372
+ * - `duplex` encodes values flowing into the wrapped channel and decodes values
373
+ * emitted by it, so choose `inputSchema` and `outputSchema` from the
374
+ * perspective of the typed caller
375
+ *
299
376
  * @since 4.0.0
300
377
  */
301
378
  export * as ChannelSchema from "./ChannelSchema.ts";
@@ -362,12 +439,11 @@ export * as ChannelSchema from "./ChannelSchema.ts";
362
439
  * import { Chunk, Effect } from "effect"
363
440
  *
364
441
  * // Working with Effects
365
- * const processChunk = (chunk: Chunk.Chunk<number>) =>
366
- * Effect.gen(function*() {
367
- * const mapped = Chunk.map(chunk, (n) => n * 2)
368
- * const filtered = Chunk.filter(mapped, (n) => n > 5)
369
- * return Chunk.toReadonlyArray(filtered)
370
- * })
442
+ * const processChunk = Effect.fnUntraced(function*(chunk: Chunk.Chunk<number>) {
443
+ * const mapped = Chunk.map(chunk, (n) => n * 2)
444
+ * const filtered = Chunk.filter(mapped, (n) => n > 5)
445
+ * return Chunk.toReadonlyArray(filtered)
446
+ * })
371
447
  * ```
372
448
  *
373
449
  * @since 2.0.0
@@ -741,9 +817,107 @@ export * as Console from "./Console.ts";
741
817
  */
742
818
  export * as Context from "./Context.ts";
743
819
  /**
820
+ * The `Cron` module provides utilities for representing recurring calendar
821
+ * schedules with cron expressions. A `Cron` value stores allowed seconds,
822
+ * minutes, hours, days of month, months, weekdays, and an optional time zone,
823
+ * then uses those constraints to test dates and find scheduled occurrences.
824
+ *
825
+ * **Mental model**
826
+ *
827
+ * - A cron schedule is a set of allowed values for each time field
828
+ * - Expressions may use five fields (`minute hour day month weekday`) or six
829
+ * fields (`second minute hour day month weekday`); five-field expressions
830
+ * default seconds to `0`
831
+ * - Each field supports `*`, comma-separated values, ranges, and step syntax
832
+ * - Month and weekday fields support aliases such as `JAN`, `DEC`, `SUN`, and
833
+ * `MON`
834
+ * - Empty internal field sets represent an unconstrained field, the same idea
835
+ * as `*`
836
+ * - When both day-of-month and weekday are constrained, matching uses cron's
837
+ * inclusive behavior: either field may match
838
+ *
839
+ * **Common tasks**
840
+ *
841
+ * - Build directly from field constraints: {@link make}
842
+ * - Parse expressions safely: {@link parse}
843
+ * - Parse expressions and throw on invalid input: {@link parseUnsafe}
844
+ * - Check whether a date satisfies a schedule: {@link match}
845
+ * - Find adjacent scheduled dates: {@link next}, {@link prev}
846
+ * - Iterate future scheduled dates: {@link sequence}
847
+ * - Compare schedule constraints: {@link equals}, {@link Equivalence}
848
+ * - Detect parse failures: {@link CronParseError}, {@link isCronParseError}
849
+ *
850
+ * **Gotchas**
851
+ *
852
+ * - Weekdays are numbered `0` through `6`, with `0` representing Sunday
853
+ * - Months are numbered `1` through `12`, while JavaScript `Date` months are
854
+ * zero-based
855
+ * - `*` normalizes to an empty set internally, so inspect schedules with the
856
+ * public helpers instead of assuming every allowed value is stored
857
+ * - `next` and `prev` search strictly after or before the provided instant
858
+ * - Time-zone-aware schedules account for daylight saving transitions; during
859
+ * a fall-back transition, repeated local times are emitted once when moving
860
+ * forward
861
+ *
744
862
  * @since 2.0.0
745
863
  */
746
864
  export * as Cron from "./Cron.ts";
865
+ /**
866
+ * The `Crypto` module provides a platform-agnostic service for cryptographic
867
+ * operations. Runtime packages such as `@effect/platform-node`,
868
+ * `@effect/platform-bun`, and `@effect/platform-browser` provide concrete
869
+ * implementations backed by the host platform's cryptography APIs.
870
+ *
871
+ * Use `Crypto` for cryptographic randomness, UUID generation, random values,
872
+ * and message digests. The base `Random` service is not cryptographically
873
+ * secure unless you replace it with a cryptographically secure implementation.
874
+ *
875
+ * **Example** (Providing a test Crypto service)
876
+ *
877
+ * ```ts
878
+ * import { Console, Crypto, Effect, Layer } from "effect"
879
+ *
880
+ * const TestCrypto = Layer.succeed(
881
+ * Crypto.Crypto,
882
+ * Crypto.make({
883
+ * randomBytes: (size) => new Uint8Array(size),
884
+ * digest: (_algorithm, data) => Effect.succeed(data)
885
+ * })
886
+ * )
887
+ *
888
+ * const program = Effect.gen(function*() {
889
+ * const crypto = yield* Crypto.Crypto
890
+ * const id = yield* crypto.randomUUIDv4
891
+ * yield* Console.log(`Created id: ${id}`)
892
+ * })
893
+ *
894
+ * Effect.runPromise(Effect.provide(program, TestCrypto))
895
+ * ```
896
+ *
897
+ * **Example** (Generating random bytes)
898
+ *
899
+ * ```ts
900
+ * import { Crypto, Effect, Layer } from "effect"
901
+ *
902
+ * const TestCrypto = Layer.succeed(
903
+ * Crypto.Crypto,
904
+ * Crypto.make({
905
+ * randomBytes: (size) => new Uint8Array(size),
906
+ * digest: (_algorithm, data) => Effect.succeed(data)
907
+ * })
908
+ * )
909
+ *
910
+ * const program = Effect.gen(function*() {
911
+ * const crypto = yield* Crypto.Crypto
912
+ * return yield* crypto.randomBytes(32)
913
+ * })
914
+ *
915
+ * Effect.runPromise(Effect.provide(program, TestCrypto))
916
+ * ```
917
+ *
918
+ * @since 4.0.0
919
+ */
920
+ export * as Crypto from "./Crypto.ts";
747
921
  /**
748
922
  * Immutable data constructors with discriminated-union support.
749
923
  *
@@ -819,6 +993,55 @@ export * as Cron from "./Cron.ts";
819
993
  */
820
994
  export * as Data from "./Data.ts";
821
995
  /**
996
+ * The `DateTime` module provides immutable data types and utilities for working
997
+ * with instants, UTC date-times, zoned date-times, and time zones. A
998
+ * `DateTime` is always an absolute point in time, represented internally by
999
+ * epoch milliseconds, and may also carry a `TimeZone` for zone-aware calendar
1000
+ * parts and formatting.
1001
+ *
1002
+ * **Mental model**
1003
+ *
1004
+ * - `DateTime` is a discriminated union: `Utc | Zoned`
1005
+ * - `Utc` stores an absolute instant without an associated time zone
1006
+ * - `Zoned` stores the same kind of absolute instant plus a `TimeZone`
1007
+ * - Time zones can be fixed offsets or named IANA zones such as `"Europe/Rome"`
1008
+ * - Comparison and ordering use the instant, so two values in different zones
1009
+ * can still be equivalent
1010
+ * - Calendar parts and formatted output depend on whether you ask for UTC parts
1011
+ * or zone-adjusted parts
1012
+ *
1013
+ * **Common tasks**
1014
+ *
1015
+ * - Construct values: {@link make}, {@link makeUnsafe}, {@link makeZoned}, {@link makeZonedUnsafe}
1016
+ * - Get the current instant: {@link now}, {@link nowInCurrentZone}
1017
+ * - Create time zones: {@link zoneMakeOffset}, {@link zoneMakeNamed}, {@link zoneFromString}
1018
+ * - Attach or change zones: {@link setZone}, {@link setZoneNamed}, {@link setZoneCurrent}, {@link toUtc}
1019
+ * - Convert to platform values or parts: {@link toDate}, {@link toDateUtc}, {@link toEpochMillis}, {@link toParts}, {@link toPartsUtc}
1020
+ * - Compare and bound values: {@link Equivalence}, {@link Order}, {@link distance}, {@link min}, {@link max}, {@link clamp}, {@link between}
1021
+ * - Transform values: {@link add}, {@link subtract}, {@link startOf}, {@link endOf}, {@link nearest}, {@link setParts}, {@link mutate}
1022
+ * - Format values: {@link format}, {@link formatUtc}, {@link formatLocal}, {@link formatIntl}, {@link formatIso}, {@link formatIsoZoned}
1023
+ * - Provide an application time zone: {@link CurrentTimeZone}, {@link withCurrentZone}, {@link layerCurrentZone}
1024
+ *
1025
+ * **Gotchas**
1026
+ *
1027
+ * - `make` and `makeZoned` return `Option`; unsafe constructors throw on invalid
1028
+ * input
1029
+ * - `DateTime` equality is instant-based, not display-time-based
1030
+ * - `setZone` changes the zone used for local parts and formatting without
1031
+ * changing the represented instant
1032
+ * - Use `adjustForTimeZone` with {@link makeZoned} when input parts should be
1033
+ * interpreted as wall-clock time in the target zone
1034
+ * - Daylight-saving gaps and repeated local times are resolved with
1035
+ * `Disambiguation`
1036
+ * - Prefer the Clock-backed {@link now} and `CurrentTimeZone` services in
1037
+ * Effect workflows; unsafe helpers read from the host environment directly
1038
+ *
1039
+ * **See also**
1040
+ *
1041
+ * - {@link DateTime} for the UTC/zoned data model
1042
+ * - {@link TimeZone} for offset and named time-zone values
1043
+ * - {@link Disambiguation} for daylight-saving ambiguity handling
1044
+ *
822
1045
  * @since 3.6.0
823
1046
  */
824
1047
  export * as DateTime from "./DateTime.ts";
@@ -893,6 +1116,42 @@ export * as DateTime from "./DateTime.ts";
893
1116
  */
894
1117
  export * as Deferred from "./Deferred.ts";
895
1118
  /**
1119
+ * The `Differ` module defines the core abstraction for describing changes to a
1120
+ * value. A `Differ<T, Patch>` knows how to compare two `T` values, produce a
1121
+ * patch that represents the difference, combine multiple patches, and apply a
1122
+ * patch to an old value to obtain the updated value.
1123
+ *
1124
+ * **Mental model**
1125
+ *
1126
+ * - A differ separates "what changed" from "the value after the change"
1127
+ * - `diff(oldValue, newValue)` produces a `Patch` that can later be applied
1128
+ * - `patch(oldValue, patch)` replays a patch against a value of the same domain
1129
+ * - `empty` is the identity patch: applying it should leave the value unchanged
1130
+ * - `combine(first, second)` composes patches in sequence, where `second`
1131
+ * represents changes that happen after `first`
1132
+ * - Patch types are chosen by the differ implementation and may be compact,
1133
+ * domain-specific, or compatible with a serialization format such as JSON
1134
+ * Patch
1135
+ *
1136
+ * **Common tasks**
1137
+ *
1138
+ * - Construct a differ by providing the four operations of the {@link Differ}
1139
+ * interface
1140
+ * - Compute a patch with `diff` when you have an old value and a new value
1141
+ * - Store, transmit, or aggregate patches instead of storing full replacement
1142
+ * values
1143
+ * - Combine incremental updates with `combine` before applying them
1144
+ * - Apply updates with `patch` to reconstruct the next value from a previous
1145
+ * value and a patch
1146
+ *
1147
+ * **Gotchas**
1148
+ *
1149
+ * - `combine` is order-sensitive for most patch formats
1150
+ * - A patch is generally meaningful only for values that belong to the same
1151
+ * domain and assumptions used by the differ that created it
1152
+ * - Differs should make `empty` a true identity and should make combined
1153
+ * patches behave the same as applying the original patches in order
1154
+ *
896
1155
  * @since 4.0.0
897
1156
  */
898
1157
  export * as Differ from "./Differ.ts";
@@ -934,7 +1193,7 @@ export * as Duration from "./Duration.ts";
934
1193
  * - **Testable**: Built-in support for testing with controlled environments
935
1194
  * - **Interruptible**: Effects can be safely interrupted and cancelled
936
1195
  *
937
- * **Example** (Usage)
1196
+ * **Example** (Creating and running effects)
938
1197
  *
939
1198
  * ```ts
940
1199
  * import { Console, Effect } from "effect"
@@ -953,7 +1212,7 @@ export * as Duration from "./Duration.ts";
953
1212
  * Effect.runPromise(program).then(console.log) // 13
954
1213
  * ```
955
1214
  *
956
- * **Example** (Usage)
1215
+ * **Example** (Handling typed failures)
957
1216
  *
958
1217
  * ```ts
959
1218
  * import { Data, Effect } from "effect"
@@ -986,6 +1245,41 @@ export * as Duration from "./Duration.ts";
986
1245
  */
987
1246
  export * as Effect from "./Effect.ts";
988
1247
  /**
1248
+ * The `Effectable` module provides low-level building blocks for defining
1249
+ * custom values that behave like `Effect`s. It is primarily used by library
1250
+ * authors who need domain-specific effect-like data types, such as service
1251
+ * keys, configuration descriptions, prompts, or other declarative programs
1252
+ * that can be yielded inside `Effect.gen`.
1253
+ *
1254
+ * **Mental model**
1255
+ *
1256
+ * - `Effectable` does not run effects by itself; it provides prototypes that
1257
+ * implement the internal Effect protocol.
1258
+ * - {@link Prototype} creates a primitive Effect prototype with a custom
1259
+ * evaluation function that receives the current `Fiber`.
1260
+ * - {@link Class} is an abstract base class for defining custom classes whose
1261
+ * instances are also `Effect` values.
1262
+ * - The success, error, and service requirements of the custom type are
1263
+ * preserved through the `Effect.Effect<A, E, R>` type parameters.
1264
+ *
1265
+ * **Common tasks**
1266
+ *
1267
+ * - Build an effect-like interface around a declarative data structure.
1268
+ * - Implement a custom `evaluate` hook that interprets the value in terms of
1269
+ * the current fiber and returns the underlying `Effect`.
1270
+ * - Extend {@link Class} when a nominal class-based API is more convenient
1271
+ * than manually wiring a prototype.
1272
+ *
1273
+ * **Gotchas**
1274
+ *
1275
+ * - This module is intentionally low-level; most application code should use
1276
+ * `Effect` constructors and combinators instead.
1277
+ * - `evaluate` must return an `Effect` with the same success, error, and
1278
+ * service types as the custom value.
1279
+ * - Because these APIs participate in the internal Effect protocol, keep
1280
+ * implementations small and follow existing modules such as `Config` and
1281
+ * `Context` when adding new effect-like types.
1282
+ *
989
1283
  * @since 4.0.0
990
1284
  */
991
1285
  export * as Effectable from "./Effectable.ts";
@@ -1174,6 +1468,43 @@ export * as Equivalence from "./Equivalence.ts";
1174
1468
  */
1175
1469
  export * as ErrorReporter from "./ErrorReporter.ts";
1176
1470
  /**
1471
+ * The `ExecutionPlan` module provides a way to describe ordered fallback
1472
+ * strategies for effects and streams that need different resources across
1473
+ * repeated attempts. An `ExecutionPlan` is a non-empty list of steps, where
1474
+ * each step supplies a `Context` or `Layer` and may control retries with an
1475
+ * attempt limit, a `Schedule`, or a `while` predicate.
1476
+ *
1477
+ * **Mental model**
1478
+ *
1479
+ * - A plan is evaluated step by step until the wrapped effect or stream
1480
+ * succeeds, or until every step has been exhausted
1481
+ * - Each step provides the services used while that step is active
1482
+ * - `attempts` limits how many times a step may be tried
1483
+ * - `schedule` controls retry timing and receives the failure input
1484
+ * - `while` can stop retrying a step based on the failure input
1485
+ * - `CurrentMetadata` exposes the current 1-based attempt and 0-based step
1486
+ * index to code running under a plan
1487
+ *
1488
+ * **Common tasks**
1489
+ *
1490
+ * - Build a plan with {@link make}
1491
+ * - Run an effect with a plan using `Effect.withExecutionPlan`
1492
+ * - Run a stream with a plan using `Stream.withExecutionPlan`
1493
+ * - Combine plans in order with {@link merge}
1494
+ * - Capture required services up front with `captureRequirements`
1495
+ * - Inspect the current attempt and step with {@link CurrentMetadata}
1496
+ *
1497
+ * **Gotchas**
1498
+ *
1499
+ * - Plans must contain at least one step
1500
+ * - `attempts` must be greater than zero when provided
1501
+ * - If `attempts` is omitted, a step is attempted once unless a `schedule` is
1502
+ * provided
1503
+ * - A `while` predicate returning `false` skips the remaining retries for that
1504
+ * step and moves the plan forward
1505
+ * - Layer, schedule, and predicate requirements are tracked in the plan type
1506
+ * until they are provided or captured
1507
+ *
1177
1508
  * @since 3.16.0
1178
1509
  */
1179
1510
  export * as ExecutionPlan from "./ExecutionPlan.ts";
@@ -1313,14 +1644,125 @@ export * as Exit from "./Exit.ts";
1313
1644
  */
1314
1645
  export * as Fiber from "./Fiber.ts";
1315
1646
  /**
1647
+ * The `FiberHandle` module provides a scoped handle for managing the lifecycle
1648
+ * of at most one fiber at a time. A `FiberHandle<A, E>` can hold one
1649
+ * `Fiber<A, E>`; when a new fiber is installed, the previous fiber is
1650
+ * interrupted unless the operation is configured with `onlyIfMissing`.
1651
+ *
1652
+ * **Mental model**
1653
+ *
1654
+ * - A handle is either open with zero or one current fiber, or closed by its
1655
+ * surrounding `Scope`
1656
+ * - Closing the scope interrupts the current fiber and prevents new work from
1657
+ * being accepted
1658
+ * - Completed fibers remove themselves from the handle, so the handle can be
1659
+ * reused for later work
1660
+ * - Replacing a fiber uses the handle's internal interruption id, allowing
1661
+ * expected replacement interruptions to be distinguished from real failures
1662
+ *
1663
+ * **Common tasks**
1664
+ *
1665
+ * - Create a scoped handle: {@link make}
1666
+ * - Fork an effect into the handle: {@link run}
1667
+ * - Store an existing fiber: {@link set}
1668
+ * - Read or clear the current fiber: {@link get}, {@link clear}
1669
+ * - Capture runtime-specific runners: {@link makeRuntime}, {@link runtime}
1670
+ * - Run handled effects as Promises: {@link makeRuntimePromise},
1671
+ * {@link runtimePromise}
1672
+ * - Wait for failure or closure: {@link join}
1673
+ * - Wait until the current fiber is gone: {@link awaitEmpty}
1674
+ *
1675
+ * **Gotchas**
1676
+ *
1677
+ * - The handle never contains more than one live fiber; starting or setting
1678
+ * another fiber interrupts the previous one by default
1679
+ * - Use `onlyIfMissing` when a call should leave an already running fiber in
1680
+ * place instead of replacing it
1681
+ * - `join` observes the handle's failure/close signal; successful fiber
1682
+ * completion only empties the handle
1683
+ * - `awaitEmpty` waits for the fiber that is current when it starts; later
1684
+ * calls to {@link run} or {@link set} can install new work
1685
+ *
1316
1686
  * @since 2.0.0
1317
1687
  */
1318
1688
  export * as FiberHandle from "./FiberHandle.ts";
1319
1689
  /**
1690
+ * The `FiberMap` module provides a scoped, mutable collection for managing
1691
+ * fibers by key. A `FiberMap<K, A, E>` owns a set of running fibers, interrupts
1692
+ * them when its scope closes, and automatically removes each entry when the
1693
+ * corresponding fiber completes.
1694
+ *
1695
+ * **Mental model**
1696
+ *
1697
+ * - A `FiberMap` is a keyed registry of fibers with lifecycle management
1698
+ * - Keys identify the currently active fiber for a logical task or resource
1699
+ * - Adding a fiber under an existing key interrupts the previous fiber by default
1700
+ * - Completed fibers remove themselves from the map if they are still current
1701
+ * - Closing the map's scope interrupts every fiber that remains in the map
1702
+ * - The map can surface the first non-ignored managed fiber failure via {@link join}
1703
+ *
1704
+ * **Common tasks**
1705
+ *
1706
+ * - Create a scoped map: {@link make}
1707
+ * - Fork effects into the map: {@link run}
1708
+ * - Add existing fibers: {@link set}
1709
+ * - Create captured runners: {@link makeRuntime}, {@link runtime}
1710
+ * - Bridge to Promise-based callers: {@link makeRuntimePromise}, {@link runtimePromise}
1711
+ * - Inspect entries: {@link get}, {@link has}, {@link size}
1712
+ * - Stop work: {@link remove}, {@link clear}
1713
+ * - Coordinate completion or failure: {@link awaitEmpty}, {@link join}
1714
+ *
1715
+ * **Gotchas**
1716
+ *
1717
+ * - `FiberMap` is scoped; use it with `Effect.scoped` or another scope owner so
1718
+ * managed fibers are interrupted when the scope closes
1719
+ * - Reusing a key is a replacement operation unless `onlyIfMissing` is enabled
1720
+ * - `join` waits for the map to fail or close; use {@link awaitEmpty} to wait
1721
+ * until all currently managed fibers have completed
1722
+ * - The `Unsafe` variants mutate synchronously and should only be used when the
1723
+ * caller already controls the surrounding execution context
1724
+ *
1320
1725
  * @since 2.0.0
1321
1726
  */
1322
1727
  export * as FiberMap from "./FiberMap.ts";
1323
1728
  /**
1729
+ * The `FiberSet` module provides a scoped container for managing many fibers as
1730
+ * one lifecycle. A `FiberSet<A, E>` tracks fibers whose successful values are
1731
+ * compatible with `A` and whose failures are compatible with `E`, removes each
1732
+ * fiber when it completes, and interrupts all still-running fibers when the
1733
+ * owning `Scope` closes.
1734
+ *
1735
+ * **Mental model**
1736
+ *
1737
+ * - A `FiberSet` is an owned, scoped collection of fibers
1738
+ * - Fibers can be added directly with {@link add} / {@link addUnsafe}
1739
+ * - Effects can be forked into the set with {@link run}, {@link runtime}, or
1740
+ * {@link runtimePromise}
1741
+ * - Completed fibers are automatically removed from the set
1742
+ * - Closing the scope or calling {@link clear} interrupts the currently tracked
1743
+ * fibers
1744
+ * - {@link join} waits for the set's first non-ignored failure, while
1745
+ * {@link awaitEmpty} waits until all tracked fibers have completed
1746
+ *
1747
+ * **Common tasks**
1748
+ *
1749
+ * - Create a scoped set: {@link make}
1750
+ * - Create scoped runners: {@link makeRuntime}, {@link makeRuntimePromise}
1751
+ * - Add an existing fiber: {@link add}
1752
+ * - Fork an effect into the set: {@link run}
1753
+ * - Interrupt tracked fibers: {@link clear}
1754
+ * - Observe the set: {@link size}, {@link awaitEmpty}, {@link join}
1755
+ * - Check a value: {@link isFiberSet}
1756
+ *
1757
+ * **Gotchas**
1758
+ *
1759
+ * - `FiberSet` values are scoped; use them inside `Effect.scoped` or another
1760
+ * scope owner so their fibers are interrupted reliably
1761
+ * - Adding or running into a closed set interrupts the fiber immediately
1762
+ * - By default, interruptions are not treated as failures for {@link join};
1763
+ * use the `propagateInterruption` option when interruption should be
1764
+ * propagated
1765
+ *
1324
1766
  * @since 2.0.0
1325
1767
  */
1326
1768
  export * as FiberSet from "./FiberSet.ts";
@@ -1364,6 +1806,40 @@ export * as FiberSet from "./FiberSet.ts";
1364
1806
  */
1365
1807
  export * as FileSystem from "./FileSystem.ts";
1366
1808
  /**
1809
+ * The `Filter` module provides composable functions for accepting, rejecting,
1810
+ * narrowing, and transforming values. A `Filter<Input, Pass, Fail>` receives an
1811
+ * input and returns a `Result`: success means the value passed the filter, while
1812
+ * failure means the value was filtered out.
1813
+ *
1814
+ * **Mental model**
1815
+ *
1816
+ * - A filter is a typed predicate that can also transform the successful value
1817
+ * - Predicate-based filters pass the original input when the predicate returns `true`
1818
+ * - Refinement-based filters narrow the successful type, for example from `unknown` to `string`
1819
+ * - Custom filters return `Result.succeed(pass)` or `Result.fail(fail)` directly
1820
+ * - Filters compose with logical and sequential combinators instead of throwing exceptions
1821
+ * - `FilterEffect` is the effectful form for filters that need asynchronous work, errors, or services
1822
+ *
1823
+ * **Common tasks**
1824
+ *
1825
+ * - Build filters: {@link make}, {@link makeEffect}, {@link fromPredicate}, {@link fromPredicateOption}
1826
+ * - Narrow unknown values: {@link string}, {@link number}, {@link boolean}, {@link bigint}, {@link symbol}, {@link date}
1827
+ * - Match shapes and variants: {@link instanceOf}, {@link tagged}, {@link reason}, {@link has}
1828
+ * - Match exact values: {@link equals}, {@link equalsStrict}
1829
+ * - Combine alternatives: {@link or}
1830
+ * - Require multiple filters: {@link zip}, {@link zipWith}, {@link andLeft}, {@link andRight}
1831
+ * - Run filters in sequence: {@link compose}, {@link composePassthrough}
1832
+ * - Convert results: {@link toPredicate}, {@link toOption}, {@link toResult}
1833
+ * - Adjust failure values: {@link mapFail}
1834
+ *
1835
+ * **Gotchas**
1836
+ *
1837
+ * - A failed filter is data in the `Result` failure channel; it is not an exception
1838
+ * - `compose` preserves intermediate failure values, while {@link composePassthrough} fails with the original input
1839
+ * - `equalsStrict` uses JavaScript `===`; use {@link equals} for structural equality
1840
+ * - `fromPredicateOption` fails with the original input when the returned `Option` is `None`
1841
+ * - Prefer refinement predicates when you want TypeScript to narrow the successful value type
1842
+ *
1367
1843
  * @since 4.0.0
1368
1844
  */
1369
1845
  export * as Filter from "./Filter.ts";
@@ -1423,10 +1899,105 @@ export * as Filter from "./Filter.ts";
1423
1899
  */
1424
1900
  export * as Formatter from "./Formatter.ts";
1425
1901
  /**
1902
+ * The `Function` module provides small, pure helpers for defining, composing,
1903
+ * adapting, and reusing TypeScript functions. It is the foundation for the
1904
+ * data-first and data-last APIs used throughout Effect, and it includes the
1905
+ * core pipeline utilities that make those APIs ergonomic.
1906
+ *
1907
+ * **Mental model**
1908
+ *
1909
+ * - {@link pipe} starts with a value and passes it through one unary function at
1910
+ * a time
1911
+ * - {@link flow} composes unary functions into a reusable function
1912
+ * - {@link dual} builds APIs that support both direct calls and `pipe`-friendly
1913
+ * data-last calls
1914
+ * - {@link identity}, {@link constant}, and the `const*` helpers model common
1915
+ * identity and thunk patterns without allocating ad hoc callbacks
1916
+ * - {@link tupled}, {@link untupled}, {@link flip}, and {@link apply} adapt
1917
+ * call shapes without changing the underlying behavior
1918
+ * - Type helpers such as {@link LazyArg}, {@link FunctionN}, {@link satisfies},
1919
+ * and {@link cast} describe or constrain functions at the type level
1920
+ *
1921
+ * **Common tasks**
1922
+ *
1923
+ * - Build readable transformation pipelines: {@link pipe}
1924
+ * - Create reusable composed functions: {@link flow}, {@link compose}
1925
+ * - Define functions callable in both data-first and data-last style: {@link dual}
1926
+ * - Return a value unchanged: {@link identity}
1927
+ * - Create thunks and common constant functions: {@link constant},
1928
+ * {@link constTrue}, {@link constFalse}, {@link constNull},
1929
+ * {@link constUndefined}, {@link constVoid}
1930
+ * - Convert between rest-argument and tuple-argument functions: {@link tupled},
1931
+ * {@link untupled}
1932
+ * - Express impossible branches: {@link absurd}
1933
+ * - Cache results for object keys: {@link memoize}
1934
+ *
1935
+ * **Gotchas**
1936
+ *
1937
+ * - Functions passed to {@link pipe} and {@link flow} are applied left-to-right
1938
+ * and should be unary at each step
1939
+ * - {@link dual} uses either an arity or a predicate to decide whether a call is
1940
+ * data-first or data-last; use a predicate when optional arguments make arity
1941
+ * ambiguous
1942
+ * - {@link cast} changes only the static TypeScript type and performs no runtime
1943
+ * validation
1944
+ * - {@link memoize} is intended for object keys and stores cached values in a
1945
+ * `WeakMap`
1946
+ *
1426
1947
  * @since 2.0.0
1427
1948
  */
1428
1949
  export * as Function from "./Function.ts";
1429
1950
  /**
1951
+ * The `Graph` module provides immutable and scoped-mutable graph data
1952
+ * structures for modeling relationships between indexed nodes and edges. A
1953
+ * graph can be directed or undirected, stores user-defined data on both nodes
1954
+ * and edges, and exposes traversal, analysis, path finding, transformation, and
1955
+ * diagram export utilities.
1956
+ *
1957
+ * **Mental model**
1958
+ *
1959
+ * - Nodes and edges are addressed by stable numeric indices: {@link NodeIndex}
1960
+ * and {@link EdgeIndex}
1961
+ * - Node data has type `N`; edge data has type `E`
1962
+ * - {@link Graph} values are immutable snapshots; use {@link MutableGraph}
1963
+ * through {@link mutate}, {@link beginMutation}, or constructor callbacks to
1964
+ * add, remove, or update nodes and edges
1965
+ * - Directed graphs follow edge direction for neighbors and traversals, while
1966
+ * undirected graphs treat each edge as connecting both endpoints
1967
+ * - Missing lookups return `Option`, while structurally invalid operations such
1968
+ * as adding an edge to a missing node throw {@link GraphError}
1969
+ *
1970
+ * **Common tasks**
1971
+ *
1972
+ * - Create graphs: {@link directed}, {@link undirected}
1973
+ * - Mutate safely: {@link mutate}, {@link addNode}, {@link addEdge},
1974
+ * {@link removeNode}, {@link removeEdge}
1975
+ * - Query contents: {@link getNode}, {@link getEdge}, {@link hasNode},
1976
+ * {@link hasEdge}, {@link nodeCount}, {@link edgeCount}, {@link neighbors}
1977
+ * - Transform data: {@link updateNode}, {@link updateEdge}, {@link mapNodes},
1978
+ * {@link mapEdges}, {@link filterNodes}, {@link filterEdges},
1979
+ * {@link filterMapNodes}, {@link filterMapEdges}
1980
+ * - Traverse lazily: {@link dfs}, {@link bfs}, {@link topo},
1981
+ * {@link dfsPostOrder}, {@link nodes}, {@link edges}, {@link Walker}
1982
+ * - Analyze structure: {@link isAcyclic}, {@link isBipartite},
1983
+ * {@link connectedComponents}, {@link stronglyConnectedComponents},
1984
+ * {@link externals}
1985
+ * - Find paths: {@link dijkstra}, {@link astar}, {@link bellmanFord},
1986
+ * {@link floydWarshall}
1987
+ * - Export diagrams: {@link toGraphViz}, {@link toMermaid}
1988
+ *
1989
+ * **Gotchas**
1990
+ *
1991
+ * - Only mutable graphs can be changed. Create one with {@link mutate} or by
1992
+ * passing a callback to {@link directed} / {@link undirected}.
1993
+ * - Traversal APIs return lazy {@link Walker} values. Use {@link indices},
1994
+ * {@link values}, or {@link entries} to choose what each iteration yields.
1995
+ * - `NodeIndex` and `EdgeIndex` values are identifiers, not array offsets. They
1996
+ * are not reused after removals.
1997
+ * - Shortest-path algorithms require a cost function. {@link dijkstra} and
1998
+ * {@link astar} reject negative weights; use {@link bellmanFord} or
1999
+ * {@link floydWarshall} when negative weights are part of the model.
2000
+ *
1430
2001
  * @since 4.0.0
1431
2002
  */
1432
2003
  export * as Graph from "./Graph.ts";
@@ -1441,14 +2012,182 @@ export * as Graph from "./Graph.ts";
1441
2012
  */
1442
2013
  export * as Hash from "./Hash.ts";
1443
2014
  /**
2015
+ * The `HashMap` module provides an immutable key-value data structure with
2016
+ * efficient lookup, insertion, removal, and transformation operations. A
2017
+ * `HashMap<Key, Value>` stores entries by hashing keys and resolving matches
2018
+ * with Effect's structural equality semantics.
2019
+ *
2020
+ * **Mental model**
2021
+ *
2022
+ * - A `HashMap<Key, Value>` is an immutable collection of key-value pairs
2023
+ * - Operations such as {@link set}, {@link remove}, and {@link modifyAt} return
2024
+ * new maps; existing maps are not mutated
2025
+ * - Keys are compared using the `Equal` protocol and are grouped by hashes from
2026
+ * the `Hash` protocol
2027
+ * - Plain JavaScript primitives work as keys, and custom objects can define
2028
+ * `Equal` / `Hash` behavior for structural lookup
2029
+ * - Lookups with {@link get} return an `Option`, making missing keys explicit
2030
+ * - Iteration order is based on the map's internal hash structure and should
2031
+ * not be treated as insertion order
2032
+ *
2033
+ * **Common tasks**
2034
+ *
2035
+ * - Create maps: {@link empty}, {@link make}, {@link fromIterable}
2036
+ * - Read values: {@link get}, {@link getUnsafe}, {@link has}, {@link hasBy}
2037
+ * - Add or update entries: {@link set}, {@link modify}, {@link modifyAt}, {@link setMany}
2038
+ * - Remove entries: {@link remove}, {@link removeMany}
2039
+ * - Combine maps: {@link union}
2040
+ * - Iterate or convert: {@link keys}, {@link values}, {@link entries}, {@link toValues}, {@link toEntries}
2041
+ * - Transform values: {@link map}, {@link flatMap}, {@link filter}, {@link filterMap}, {@link compact}
2042
+ * - Fold and search: {@link reduce}, {@link findFirst}, {@link some}, {@link every}
2043
+ * - Batch updates efficiently: {@link mutate}, {@link beginMutation}, {@link endMutation}
2044
+ *
2045
+ * **Gotchas**
2046
+ *
2047
+ * - {@link getUnsafe} throws when the key is absent; prefer {@link get} unless
2048
+ * absence is impossible by construction
2049
+ * - Mutating a key object after insertion can make future lookups fail if its
2050
+ * equality or hash changes
2051
+ * - Hash collisions are handled by equality checks, so matching hashes alone do
2052
+ * not make two keys equal
2053
+ * - Use {@link getHash} and {@link hasHash} only when you already have the
2054
+ * correct hash for the same key
2055
+ * - Convert entries to an array and sort them when deterministic presentation is
2056
+ * required
2057
+ *
2058
+ * **Quickstart**
2059
+ *
2060
+ * **Example** (Working with immutable maps)
2061
+ *
2062
+ * ```ts
2063
+ * import { HashMap, Option } from "effect"
2064
+ *
2065
+ * const scores = HashMap.make(["alice", 10], ["bob", 15])
2066
+ *
2067
+ * const updated = scores.pipe(
2068
+ * HashMap.set("carol", 20),
2069
+ * HashMap.modify("alice", (score) => score + 1)
2070
+ * )
2071
+ *
2072
+ * console.log(HashMap.get(updated, "alice"))
2073
+ * // Output: Option.some(11)
2074
+ *
2075
+ * console.log(HashMap.get(scores, "carol"))
2076
+ * // Output: Option.none()
2077
+ *
2078
+ * console.log(Option.getOrElse(HashMap.get(updated, "dave"), () => 0))
2079
+ * // Output: 0
2080
+ * ```
2081
+ *
2082
+ * **See also**
2083
+ *
2084
+ * - {@link HashSet} for immutable sets backed by hash semantics
2085
+ * - {@link Equal} for structural equality
2086
+ * - {@link Hash} for hash implementations used by hashed collections
2087
+ *
1444
2088
  * @since 2.0.0
1445
2089
  */
1446
2090
  export * as HashMap from "./HashMap.ts";
1447
2091
  /**
2092
+ * The `HashRing` module provides a weighted consistent-hashing data structure
2093
+ * for assigning arbitrary string inputs to a changing set of nodes. A hash ring
2094
+ * minimizes remapping when nodes are added, removed, or reweighted, which makes
2095
+ * it useful for routing requests, partitioning keys, and distributing shards
2096
+ * across service instances or storage backends.
2097
+ *
2098
+ * **Mental model**
2099
+ *
2100
+ * - Each node is identified by its {@link PrimaryKey.PrimaryKey} value
2101
+ * - {@link add} and {@link addMany} place weighted virtual points on the ring
2102
+ * - {@link get} hashes an input string and returns the nearest node on the ring
2103
+ * - {@link getShards} assigns a fixed number of shard indexes across the nodes
2104
+ * - Higher weights receive proportionally more virtual points and shard
2105
+ * allocations
2106
+ * - Operations mutate and return the same ring instance
2107
+ *
2108
+ * **Common tasks**
2109
+ *
2110
+ * - Create an empty ring: {@link make}
2111
+ * - Add or update nodes: {@link add}, {@link addMany}
2112
+ * - Remove nodes: {@link remove}
2113
+ * - Check membership by primary key: {@link has}
2114
+ * - Route an input key to a node: {@link get}
2115
+ * - Precompute shard ownership: {@link getShards}
2116
+ * - Guard unknown values: {@link isHashRing}
2117
+ *
2118
+ * **Gotchas**
2119
+ *
2120
+ * - Empty rings return `undefined` from {@link get} and {@link getShards}
2121
+ * - Nodes with the same primary key represent the same ring member
2122
+ * - Weights are clamped to a positive minimum so a node remains represented
2123
+ * - Mutating a ring in place is intentional; create a new ring when independent
2124
+ * snapshots are required
2125
+ *
2126
+ * **Quickstart**
2127
+ *
2128
+ * **Example** (Routing keys across nodes)
2129
+ *
2130
+ * ```ts
2131
+ * import { HashRing, PrimaryKey } from "effect"
2132
+ *
2133
+ * class Node implements PrimaryKey.PrimaryKey {
2134
+ * constructor(readonly id: string) {}
2135
+ *
2136
+ * [PrimaryKey.symbol](): string {
2137
+ * return this.id
2138
+ * }
2139
+ * }
2140
+ *
2141
+ * const ring = HashRing.make<Node>().pipe(
2142
+ * HashRing.add(new Node("node-a")),
2143
+ * HashRing.add(new Node("node-b"), { weight: 2 })
2144
+ * )
2145
+ *
2146
+ * const owner = HashRing.get(ring, "user:123")
2147
+ * console.log(owner ? PrimaryKey.value(owner) : undefined)
2148
+ * ```
2149
+ *
1448
2150
  * @since 4.0.0
1449
2151
  */
1450
2152
  export * as HashRing from "./HashRing.ts";
1451
2153
  /**
2154
+ * The `HashSet` module provides an immutable set data structure for storing
2155
+ * unique values with efficient membership checks, additions, removals, and set
2156
+ * operations. A `HashSet<A>` contains at most one value for each equality class
2157
+ * as determined by Effect's `Equal` / `Hash` semantics.
2158
+ *
2159
+ * **Mental model**
2160
+ *
2161
+ * - `HashSet<A>` is an immutable collection of unique values of type `A`
2162
+ * - Operations such as {@link add}, {@link remove}, {@link union}, and
2163
+ * {@link difference} return new sets; the input set is never mutated
2164
+ * - Membership is checked with {@link has}, using Effect equality and hashing
2165
+ * rather than array-style linear scanning
2166
+ * - Duplicate values are collapsed when using {@link make}, {@link fromIterable},
2167
+ * {@link add}, or {@link map}
2168
+ * - `HashSet` is iterable, but iteration order is not a sorting guarantee
2169
+ *
2170
+ * **Common tasks**
2171
+ *
2172
+ * - Create sets: {@link empty}, {@link make}, {@link fromIterable}
2173
+ * - Check membership and size: {@link has}, {@link size}, {@link isEmpty}
2174
+ * - Add or remove values: {@link add}, {@link remove}
2175
+ * - Combine sets: {@link union}, {@link intersection}, {@link difference}
2176
+ * - Compare sets: {@link isSubset}
2177
+ * - Transform or select values: {@link map}, {@link filter}
2178
+ * - Test values: {@link some}, {@link every}
2179
+ * - Fold values: {@link reduce}
2180
+ *
2181
+ * **Gotchas**
2182
+ *
2183
+ * - Values that should compare structurally should implement compatible
2184
+ * `Equal` and `Hash` behavior; otherwise object identity may affect whether
2185
+ * values are considered distinct
2186
+ * - {@link map} may reduce the set size when multiple input values map to the
2187
+ * same output value
2188
+ * - Do not rely on iteration order for deterministic presentation; sort the
2189
+ * values after converting to an array when order matters
2190
+ *
1452
2191
  * @since 2.0.0
1453
2192
  */
1454
2193
  export * as HashSet from "./HashSet.ts";
@@ -1503,8 +2242,7 @@ export * as HKT from "./HKT.ts";
1503
2242
  * **Example** (Creating inspectable values)
1504
2243
  *
1505
2244
  * ```ts
1506
- * import { Inspectable } from "effect"
1507
- * import { format } from "effect/Formatter"
2245
+ * import { Formatter, Inspectable } from "effect"
1508
2246
  *
1509
2247
  * class User extends Inspectable.Class {
1510
2248
  * constructor(
@@ -1525,7 +2263,7 @@ export * as HKT from "./HKT.ts";
1525
2263
  *
1526
2264
  * const user = new User("Alice", "alice@example.com")
1527
2265
  * console.log(user.toString()) // Pretty printed JSON
1528
- * console.log(format(user)) // Same as toString()
2266
+ * console.log(Formatter.format(user)) // Same as toString()
1529
2267
  * ```
1530
2268
  *
1531
2269
  * @since 2.0.0
@@ -1599,7 +2337,7 @@ export * as Iterable from "./Iterable.ts";
1599
2337
  * **Example** (Computing and applying a patch)
1600
2338
  *
1601
2339
  * ```ts
1602
- * import * as JsonPatch from "effect/JsonPatch"
2340
+ * import { JsonPatch } from "effect"
1603
2341
  *
1604
2342
  * const oldValue = { name: "Alice", age: 30 }
1605
2343
  * const newValue = { name: "Alice", age: 31, city: "NYC" }
@@ -1653,15 +2391,15 @@ export * as JsonPatch from "./JsonPatch.ts";
1653
2391
  * **Example** (Building and parsing a JSON Pointer)
1654
2392
  *
1655
2393
  * ```ts
1656
- * import { escapeToken, unescapeToken } from "effect/JsonPointer"
2394
+ * import { JsonPointer } from "effect"
1657
2395
  *
1658
2396
  * // Build a JSON Pointer from path segments
1659
2397
  * const segments = ["users", "name/alias", "value"]
1660
- * const pointer = "/" + segments.map(escapeToken).join("/")
2398
+ * const pointer = "/" + segments.map(JsonPointer.escapeToken).join("/")
1661
2399
  * // "/users/name~1alias/value"
1662
2400
  *
1663
2401
  * // Parse a JSON Pointer back to segments
1664
- * const tokens = pointer.split("/").slice(1).map(unescapeToken)
2402
+ * const tokens = pointer.split("/").slice(1).map(JsonPointer.unescapeToken)
1665
2403
  * // ["users", "name/alias", "value"]
1666
2404
  * ```
1667
2405
  *
@@ -1761,7 +2499,39 @@ export * as JsonPointer from "./JsonPointer.ts";
1761
2499
  */
1762
2500
  export * as JsonSchema from "./JsonSchema.ts";
1763
2501
  /**
1764
- * @since 3.8.0
2502
+ * The `Latch` module provides a reusable synchronization primitive for
2503
+ * coordinating fibers. A `Latch` is either open or closed: when it is closed,
2504
+ * fibers that use {@link await} or {@link whenOpen} suspend until the latch is
2505
+ * opened or the current waiters are released.
2506
+ *
2507
+ * **Mental model**
2508
+ *
2509
+ * - An open latch lets current and future waiters continue immediately
2510
+ * - A closed latch causes `await` and `whenOpen` to suspend
2511
+ * - {@link open} permanently opens the latch until it is closed again
2512
+ * - {@link release} wakes only the fibers currently waiting and leaves the
2513
+ * latch closed for future waiters
2514
+ * - {@link close} resets the latch so later waiters suspend again
2515
+ *
2516
+ * **Common tasks**
2517
+ *
2518
+ * - Create a latch inside `Effect`: {@link make}
2519
+ * - Create a latch synchronously: {@link makeUnsafe}
2520
+ * - Wait for a signal before continuing: {@link await}
2521
+ * - Guard an effect so it runs only after the latch is open: {@link whenOpen}
2522
+ * - Let all current and future waiters proceed: {@link open}
2523
+ * - Let only the current waiters proceed: {@link release}
2524
+ * - Re-enable waiting after opening: {@link close}
2525
+ *
2526
+ * **Gotchas**
2527
+ *
2528
+ * - `release` is not the same as `open`; new waiters still suspend after the
2529
+ * current waiters are released
2530
+ * - `open` and `close` report whether they changed the latch state
2531
+ * - Prefer the effectful APIs unless synchronous allocation or mutation is
2532
+ * required
2533
+ *
2534
+ * @since 4.0.0
1765
2535
  */
1766
2536
  export * as Latch from "./Latch.ts";
1767
2537
  /**
@@ -1785,228 +2555,207 @@ export * as Latch from "./Latch.ts";
1785
2555
  */
1786
2556
  export * as Layer from "./Layer.ts";
1787
2557
  /**
1788
- * @since 3.14.0
1789
- */
1790
- export * as LayerMap from "./LayerMap.ts";
1791
- /**
1792
- * @since 2.0.0
1793
- *
1794
- * The `Logger` module provides a robust and flexible logging system for Effect applications.
1795
- * It offers structured logging, multiple output formats, and seamless integration with the
1796
- * Effect runtime's tracing and context management.
1797
- *
1798
- * ## Key Features
2558
+ * The `LayerMap` module provides utilities for managing scoped resources that
2559
+ * are selected by key and built from `Layer` values. A `LayerMap<K, I, E>` turns
2560
+ * a key into a cached service `Context<I>`, so applications can lazily acquire
2561
+ * and reuse different resource instances such as tenant clients, regional
2562
+ * connections, environment-specific services, or other keyed infrastructure.
1799
2563
  *
1800
- * - **Structured Logging**: Built-in support for structured log messages with metadata
1801
- * - **Multiple Formats**: JSON, LogFmt, Pretty, and custom formatting options
1802
- * - **Context Integration**: Automatic capture of fiber context, spans, and annotations
1803
- * - **Batching**: Efficient log aggregation and batch processing
1804
- * - **File Output**: Direct file writing with configurable batch windows
1805
- * - **Composable**: Transform and compose loggers using functional patterns
2564
+ * **Mental model**
1806
2565
  *
1807
- * ## Basic Usage
2566
+ * - A `LayerMap` is a scoped, reference-counted cache of contexts produced by layers
2567
+ * - Keys identify which layer-backed resource set should be acquired
2568
+ * - Resources are acquired on demand when a key is requested
2569
+ * - The same key reuses the cached context while it remains live
2570
+ * - Cached resources are finalized when invalidated, when their scope closes, or after idle expiration
2571
+ * - The layers built by a `LayerMap` share the current layer memoization map
1808
2572
  *
1809
- * **Example** (Logging messages with structured data)
2573
+ * **Common tasks**
1810
2574
  *
1811
- * ```ts
1812
- * import { Effect } from "effect"
2575
+ * - Create from a lookup function: {@link make}
2576
+ * - Create from a fixed record of layers: {@link fromRecord}
2577
+ * - Define a service wrapper with accessor helpers: {@link Service}
2578
+ * - Retrieve a layer for a key: {@link LayerMap.get}
2579
+ * - Retrieve a scoped context directly: {@link LayerMap.contextEffect}
2580
+ * - Force a cached entry to be rebuilt later: {@link LayerMap.invalidate}
2581
+ * - Remove idle entries automatically with the `idleTimeToLive` option
2582
+ * - Eagerly build known entries with `preloadKeys` or `preload`
1813
2583
  *
1814
- * // Basic logging
1815
- * const program = Effect.gen(function*() {
1816
- * yield* Effect.log("Application started")
1817
- * yield* Effect.logInfo("Processing user request")
1818
- * yield* Effect.logWarning("Resource limit approaching")
1819
- * yield* Effect.logError("Database connection failed")
1820
- * })
2584
+ * **Gotchas**
1821
2585
  *
1822
- * // With structured data
1823
- * const structuredLog = Effect.gen(function*() {
1824
- * yield* Effect.log("User action", { userId: 123, action: "login" })
1825
- * yield* Effect.logInfo("Request processed", { duration: 150, statusCode: 200 })
1826
- * })
1827
- * ```
2586
+ * - `contextEffect` requires a `Scope.Scope` because it exposes the acquired context directly
2587
+ * - `get` returns a `Layer` that can be provided to programs expecting the keyed services
2588
+ * - Invalidating a key finalizes the current cached resources for that key; the next access rebuilds them
2589
+ * - Preloading moves layer construction errors to `LayerMap` creation instead of first use
1828
2590
  *
1829
- * ## Custom Loggers
2591
+ * @since 3.14.0
2592
+ */
2593
+ export * as LayerMap from "./LayerMap.ts";
2594
+ /**
2595
+ * The `Logger` module defines the logging model used by the Effect runtime and
2596
+ * provides constructors for formatting, routing, batching, and installing
2597
+ * loggers. A `Logger<Message, Output>` receives each runtime log event as an
2598
+ * {@link Options} value and transforms it into an output such as a string,
2599
+ * structured object, JSON line, console write, file write, or trace span event.
1830
2600
  *
1831
- * **Example** (Creating and providing custom loggers)
2601
+ * **Mental model**
1832
2602
  *
1833
- * ```ts
1834
- * import { Effect, Logger } from "effect"
2603
+ * - Effect programs emit log events with APIs such as `Effect.log`,
2604
+ * `Effect.logInfo`, `Effect.logWarning`, and `Effect.logError`
2605
+ * - Each event contains a message, log level, cause, fiber, and timestamp
2606
+ * - Loggers are ordinary values created with {@link make} and installed with
2607
+ * {@link layer}
2608
+ * - Multiple loggers can be active at once by providing a layer with several
2609
+ * logger values
2610
+ * - Formatter loggers such as {@link formatLogFmt}, {@link formatStructured},
2611
+ * and {@link formatJson} return formatted data without writing it anywhere
2612
+ * - Console loggers such as {@link consolePretty}, {@link consoleLogFmt},
2613
+ * {@link consoleStructured}, and {@link consoleJson} write formatted output
2614
+ * to the active Effect console
2615
+ *
2616
+ * **Log output structure**
2617
+ *
2618
+ * Built-in formatters include the log level, timestamp, fiber identifier, and
2619
+ * logged message. When present, they also include the pretty-printed cause,
2620
+ * active log annotations, and active log spans. Structured and JSON loggers keep
2621
+ * these fields as machine-readable data, while logfmt and pretty loggers render
2622
+ * them as human-readable text.
1835
2623
  *
1836
- * // Create a custom logger
1837
- * const customLogger = Logger.make((options) => {
1838
- * console.log(`[${options.logLevel}] ${options.message}`)
1839
- * })
2624
+ * **Common tasks**
1840
2625
  *
1841
- * // Use JSON format for production
1842
- * const jsonLogger = Logger.consoleJson
2626
+ * - Create a custom logger: {@link make}
2627
+ * - Transform logger output: {@link map}
2628
+ * - Write formatter output to the console: {@link withConsoleLog},
2629
+ * {@link withConsoleError}, {@link withLeveledConsole}
2630
+ * - Use built-in console loggers: {@link consolePretty}, {@link consoleLogFmt},
2631
+ * {@link consoleStructured}, {@link consoleJson}
2632
+ * - Use built-in formatter loggers: {@link formatSimple}, {@link formatLogFmt},
2633
+ * {@link formatStructured}, {@link formatJson}
2634
+ * - Batch logger output before flushing to a sink: {@link batched}
2635
+ * - Write string logger output to a file: {@link toFile}
2636
+ * - Preserve trace correlation by including {@link tracerLogger}
2637
+ * - Install or replace loggers for an effect: {@link layer}
1843
2638
  *
1844
- * // Pretty format for development
1845
- * const prettyLogger = Logger.consolePretty()
2639
+ * **Gotchas**
1846
2640
  *
1847
- * const program = Effect.log("Hello World").pipe(
1848
- * Effect.provide(Logger.layer([jsonLogger]))
1849
- * )
1850
- * ```
2641
+ * - {@link layer} replaces the current logger set by default; pass
2642
+ * `mergeWithExisting: true` when adding loggers to the existing runtime
2643
+ * loggers
2644
+ * - Formatter loggers only produce values; wrap them with console, file, batch,
2645
+ * or custom sink loggers when output should be written somewhere
2646
+ * - {@link batched} and {@link toFile} are scoped; keep their scope open while
2647
+ * logs are being emitted so buffered entries can flush reliably
2648
+ * - {@link toFile} accepts only loggers that output strings, so pair it with
2649
+ * string formatters such as {@link formatJson} or {@link formatLogFmt}
2650
+ * - The default runtime logger set includes {@link tracerLogger}; replacing
2651
+ * loggers without merging may remove automatic log-to-trace-span recording
1851
2652
  *
1852
- * ## Multiple Loggers
2653
+ * **Quickstart**
1853
2654
  *
1854
- * **Example** (Combining multiple loggers)
2655
+ * **Example** (Installing a JSON console logger)
1855
2656
  *
1856
2657
  * ```ts
1857
2658
  * import { Effect, Logger } from "effect"
1858
2659
  *
1859
- * // Combine multiple loggers
1860
- * const CombinedLoggerLive = Logger.layer([
1861
- * Logger.consoleJson,
1862
- * Logger.consolePretty()
1863
- * ])
1864
- *
1865
- * const program = Effect.log("Application event").pipe(
1866
- * Effect.provide(CombinedLoggerLive)
2660
+ * const program = Effect.gen(function*() {
2661
+ * yield* Effect.logInfo("request started", { method: "GET", path: "/users" })
2662
+ * yield* Effect.logError("request failed", { status: 500 })
2663
+ * }).pipe(
2664
+ * Effect.annotateLogs("service", "users-api"),
2665
+ * Effect.withLogSpan("http.request"),
2666
+ * Effect.provide(Logger.layer([Logger.consoleJson]))
1867
2667
  * )
1868
2668
  * ```
1869
2669
  *
1870
- * ## Batched Logging
1871
- *
1872
- * **Example** (Batching log messages)
2670
+ * **See also**
1873
2671
  *
1874
- * ```ts
1875
- * import { Duration, Effect, Logger } from "effect"
1876
- *
1877
- * const batchedLogger = Logger.batched(Logger.formatJson, {
1878
- * window: Duration.seconds(5),
1879
- * flush: (messages) =>
1880
- * Effect.sync(() => {
1881
- * // Process batch of log messages
1882
- * console.log("Flushing", messages.length, "log entries")
1883
- * })
1884
- * })
2672
+ * - {@link make} for defining custom loggers
2673
+ * - {@link layer} for installing loggers
2674
+ * - {@link formatJson} and {@link consoleJson} for structured production logs
2675
+ * - {@link consolePretty} for readable local logs
1885
2676
  *
1886
- * const program = Effect.gen(function*() {
1887
- * const logger = yield* batchedLogger
1888
- * yield* Effect.provide(
1889
- * Effect.all([
1890
- * Effect.log("Event 1"),
1891
- * Effect.log("Event 2"),
1892
- * Effect.log("Event 3")
1893
- * ]),
1894
- * Logger.layer([logger])
1895
- * )
1896
- * })
1897
- * ```
2677
+ * @since 2.0.0
1898
2678
  */
1899
2679
  export * as Logger from "./Logger.ts";
1900
2680
  /**
1901
- * @since 2.0.0
1902
- *
1903
- * The `LogLevel` module provides utilities for managing log levels in Effect applications.
1904
- * It defines a hierarchy of log levels and provides functions for comparing and filtering logs
1905
- * based on their severity.
1906
- *
1907
- * ## Log Level Hierarchy
1908
- *
1909
- * The log levels are ordered from most severe to least severe:
1910
- *
1911
- * 1. **All** - Special level that allows all messages
1912
- * 2. **Fatal** - System is unusable, immediate attention required
1913
- * 3. **Error** - Error conditions that should be investigated
1914
- * 4. **Warn** - Warning conditions that may indicate problems
1915
- * 5. **Info** - Informational messages about normal operation
1916
- * 6. **Debug** - Debug information useful during development
1917
- * 7. **Trace** - Very detailed trace information
1918
- * 8. **None** - Special level that suppresses all messages
1919
- *
1920
- * ## Basic Usage
1921
- *
1922
- * **Example** (Logging at different levels)
2681
+ * The `LogLevel` module defines the levels used by Effect logging and the
2682
+ * ordering operations used to compare, filter, and enable log output.
1923
2683
  *
1924
- * ```ts
1925
- * import { Effect } from "effect"
1926
- *
1927
- * // Basic log level usage
1928
- * const program = Effect.gen(function*() {
1929
- * yield* Effect.logFatal("System is shutting down")
1930
- * yield* Effect.logError("Database connection failed")
1931
- * yield* Effect.logWarning("Memory usage is high")
1932
- * yield* Effect.logInfo("User logged in")
1933
- * yield* Effect.logDebug("Processing request")
1934
- * yield* Effect.logTrace("Variable value: xyz")
1935
- * })
1936
- * ```
1937
- *
1938
- * ## Level Comparison
1939
- *
1940
- * **Example** (Comparing log levels)
1941
- *
1942
- * ```ts
1943
- * import { LogLevel } from "effect"
1944
- *
1945
- * // Check if one level is more severe than another
1946
- * console.log(LogLevel.isGreaterThan("Error", "Info")) // true
1947
- * console.log(LogLevel.isGreaterThan("Debug", "Error")) // false
2684
+ * **Mental model**
1948
2685
  *
1949
- * // Check if level meets minimum threshold
1950
- * console.log(LogLevel.isGreaterThanOrEqualTo("Info", "Debug")) // true
1951
- * console.log(LogLevel.isLessThan("Trace", "Info")) // true
1952
- * ```
2686
+ * - A `LogLevel` is one of `All`, `Fatal`, `Error`, `Warn`, `Info`, `Debug`,
2687
+ * `Trace`, or `None`
2688
+ * - `Fatal` is the most severe concrete level and `Trace` is the least severe
2689
+ * - `All` and `None` are sentinel levels: `All` enables every message and
2690
+ * `None` disables every message
2691
+ * - Ordering follows logging severity, so higher levels are more important and
2692
+ * lower levels are more verbose
2693
+ * - Filtering is usually expressed as "log this message when its level is
2694
+ * greater than or equal to the configured minimum"
1953
2695
  *
1954
- * ## Filtering by Level
2696
+ * **Common tasks**
1955
2697
  *
1956
- * **Example** (Filtering logger output)
2698
+ * - Enumerate levels with {@link values}
2699
+ * - Compare exact levels with {@link Equivalence}
2700
+ * - Sort or compare by severity with {@link Order} and {@link getOrdinal}
2701
+ * - Check thresholds with {@link isGreaterThanOrEqualTo} and
2702
+ * {@link isLessThanOrEqualTo}
2703
+ * - Test whether a level is enabled for the current fiber with
2704
+ * {@link isEnabled}
1957
2705
  *
1958
- * ```ts
1959
- * import { Logger, LogLevel } from "effect"
2706
+ * **Gotchas**
1960
2707
  *
1961
- * // Create a logger that only logs Error and above
1962
- * const errorLogger = Logger.make((options) => {
1963
- * if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, "Error")) {
1964
- * console.log(`[${options.logLevel}] ${options.message}`)
1965
- * }
1966
- * })
2708
+ * - `All` and `None` are useful for configuration boundaries, but they are not
2709
+ * concrete message severities; use {@link Severity} when only emitted message
2710
+ * levels are valid
2711
+ * - The comparison helpers compare severity, not declaration position in source
2712
+ * code or alphabetical order
2713
+ * - `isEnabled` reads the current fiber's `MinimumLogLevel` reference, so it is
2714
+ * context-sensitive; use the pure comparison helpers when checking an
2715
+ * explicit threshold
1967
2716
  *
1968
- * // Production logger - Info and above
1969
- * const productionLogger = Logger.make((options) => {
1970
- * if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, "Info")) {
1971
- * console.log(
1972
- * `${options.date.toISOString()} [${options.logLevel}] ${options.message}`
1973
- * )
1974
- * }
1975
- * })
2717
+ * @since 2.0.0
2718
+ */
2719
+ export * as LogLevel from "./LogLevel.ts";
2720
+ /**
2721
+ * The `ManagedRuntime` module provides a way to build a reusable runtime from
2722
+ * a `Layer` and use it to run effects that require the services produced by
2723
+ * that layer. A `ManagedRuntime<R, ER>` owns the lifecycle of the layer-built
2724
+ * resources, caches the resulting `Context<R>`, and exposes runners for
2725
+ * integrating Effect programs with JavaScript entry points.
1976
2726
  *
1977
- * // Development logger - Debug and above
1978
- * const devLogger = Logger.make((options) => {
1979
- * if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, "Debug")) {
1980
- * console.log(`[${options.logLevel}] ${options.message}`)
1981
- * }
1982
- * })
1983
- * ```
2727
+ * **Mental model**
1984
2728
  *
1985
- * ## Runtime Configuration
2729
+ * - A managed runtime is created from a `Layer` with {@link make}
2730
+ * - The layer is built lazily the first time the runtime is used
2731
+ * - The built context is cached and reused for subsequent effect executions
2732
+ * - Resources acquired by the layer are owned by the runtime's internal scope
2733
+ * - Disposing the runtime closes that scope and releases all managed resources
2734
+ * - Effects run through the runtime receive the layer's services automatically
1986
2735
  *
1987
- * **Example** (Configuring log level from the environment)
2736
+ * **Common tasks**
1988
2737
  *
1989
- * ```ts
1990
- * import { Config, Effect, Logger, LogLevel } from "effect"
2738
+ * - Create a runtime from application services: {@link make}
2739
+ * - Run an effect as a `Promise`: {@link ManagedRuntime.runPromise}
2740
+ * - Run an effect and keep its `Exit`: {@link ManagedRuntime.runPromiseExit}
2741
+ * - Fork an effect into a `Fiber`: {@link ManagedRuntime.runFork}
2742
+ * - Bridge callback-style APIs: {@link ManagedRuntime.runCallback}
2743
+ * - Run synchronous effects at program boundaries: {@link ManagedRuntime.runSync},
2744
+ * {@link ManagedRuntime.runSyncExit}
2745
+ * - Access the cached service context: {@link ManagedRuntime.context}
2746
+ * - Release layer resources: {@link ManagedRuntime.dispose},
2747
+ * {@link ManagedRuntime.disposeEffect}
1991
2748
  *
1992
- * // Configure log level from environment
1993
- * const logLevelConfig = Config.string("LOG_LEVEL").pipe(
1994
- * Config.withDefault("Info")
1995
- * )
2749
+ * **Gotchas**
1996
2750
  *
1997
- * const configurableLogger = Effect.gen(function*() {
1998
- * const minLevel = yield* logLevelConfig
2751
+ * - Always dispose a managed runtime when it is no longer needed, especially
2752
+ * when the layer acquires resources such as connections, servers, or files
2753
+ * - Layer construction errors are included in the error channel of runtime
2754
+ * runners, so `ER` is combined with the effect's own error type
2755
+ * - `runSync` can only execute effects without asynchronous boundaries; use
2756
+ * `runPromise` for asynchronous programs
2757
+ * - After disposal, the runtime cannot be reused
1999
2758
  *
2000
- * return Logger.make((options) => {
2001
- * if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, minLevel)) {
2002
- * console.log(`[${options.logLevel}] ${options.message}`)
2003
- * }
2004
- * })
2005
- * })
2006
- * ```
2007
- */
2008
- export * as LogLevel from "./LogLevel.ts";
2009
- /**
2010
2759
  * @since 2.0.0
2011
2760
  */
2012
2761
  export * as ManagedRuntime from "./ManagedRuntime.ts";
@@ -2040,51 +2789,56 @@ export * as ManagedRuntime from "./ManagedRuntime.ts";
2040
2789
  */
2041
2790
  export * as Match from "./Match.ts";
2042
2791
  /**
2043
- * @since 2.0.0
2792
+ * The `Metric` module provides tools for defining, updating, tagging, and
2793
+ * reading application metrics from Effect programs. A `Metric<Input, State>`
2794
+ * accepts typed input values and aggregates them into a typed state that can be
2795
+ * read directly or exported from a snapshot.
2044
2796
  *
2045
- * The `Metric` module provides a comprehensive system for collecting, aggregating, and observing
2046
- * application metrics in Effect applications. It offers type-safe, concurrent metrics that can
2047
- * be used to monitor performance, track business metrics, and gain insights into application behavior.
2048
- *
2049
- * ## Key Features
2050
- *
2051
- * - **Five Metric Types**: Counters, Gauges, Frequencies, Histograms, and Summaries
2052
- * - **Type Safety**: Fully typed metrics with compile-time guarantees
2053
- * - **Concurrency Safe**: Thread-safe metrics that work with Effect's concurrency model
2054
- * - **Attributes**: Tag metrics with key-value attributes for filtering and grouping
2055
- * - **Snapshots**: Take point-in-time snapshots of all metrics for reporting
2056
- * - **Runtime Integration**: Automatic fiber runtime metrics collection
2057
- *
2058
- * ## Metric Types
2797
+ * **Mental model**
2059
2798
  *
2060
- * ### Counter
2061
- * Tracks cumulative values that only increase or can be reset to zero.
2062
- * Perfect for counting events, requests, errors, etc.
2799
+ * - A metric has an identifier, a type, an optional description, optional attributes, and mutable aggregate state
2800
+ * - Use counters for cumulative values such as requests, errors, retries, or bytes processed
2801
+ * - Use gauges for point-in-time values that can rise or fall, such as active connections or queue size
2802
+ * - Use frequencies to count occurrences of discrete string values, such as status codes or action names
2803
+ * - Use histograms to bucket numeric observations and inspect count, min, max, and sum
2804
+ * - Use summaries to calculate quantiles over a bounded, time-based observation window
2805
+ * - Metrics are updated from effects with {@link update} and {@link modify}, and read with {@link value}
2806
+ * - Attributes tag metrics with key-value dimensions so the same logical metric can be grouped by service, endpoint, method, or other labels
2807
+ * - Snapshots capture the currently registered metrics and their aggregate states for reporting or export
2063
2808
  *
2064
- * ### Gauge
2065
- * Represents a single numerical value that can go up or down.
2066
- * Ideal for current resource usage, temperature, queue sizes, etc.
2809
+ * **Common tasks**
2067
2810
  *
2068
- * ### Frequency
2069
- * Counts occurrences of discrete string values.
2070
- * Useful for tracking categorical data like HTTP status codes, user actions, etc.
2811
+ * - Create counters: {@link counter}
2812
+ * - Create gauges: {@link gauge}
2813
+ * - Create frequencies: {@link frequency}
2814
+ * - Create histograms: {@link histogram}, {@link linearBoundaries}, {@link exponentialBoundaries}
2815
+ * - Create summaries: {@link summary}, {@link summaryWithTimestamp}
2816
+ * - Measure effect duration: {@link timer}
2817
+ * - Update a metric: {@link update}
2818
+ * - Apply relative updates where supported: {@link modify}
2819
+ * - Read one metric: {@link value}
2820
+ * - Tag a metric: {@link withAttributes}
2821
+ * - Transform accepted input values: {@link mapInput}
2822
+ * - Record a constant input for repeated events: {@link withConstantInput}
2823
+ * - Inspect all registered metrics: {@link snapshot}, {@link dump}
2824
+ * - Enable fiber runtime metrics: {@link enableRuntimeMetrics}
2071
2825
  *
2072
- * ### Histogram
2073
- * Records observations in configurable buckets to analyze distribution.
2074
- * Great for response times, request sizes, and other measured values.
2826
+ * **Gotchas**
2075
2827
  *
2076
- * ### Summary
2077
- * Calculates quantiles over a sliding time window.
2078
- * Provides statistical insights into value distributions over time.
2828
+ * - Counter and gauge metrics can use `number` inputs by default or `bigint` inputs with the `bigint` option
2829
+ * - Incremental counters ignore negative updates; use non-incremental counters only when decreases are meaningful
2830
+ * - {@link update} sets a gauge to an absolute value, while {@link modify} changes it relative to its current value
2831
+ * - Histogram buckets are cumulative and depend on the boundaries supplied when the metric is created
2832
+ * - Summary quantiles are calculated from the configured sliding window, so old observations expire
2833
+ * - Prefer low-cardinality attributes; using unbounded values such as request IDs can create too many metric series
2079
2834
  *
2080
- * ## Basic Usage
2835
+ * **Quickstart**
2081
2836
  *
2082
2837
  * **Example** (Creating and updating metrics)
2083
2838
  *
2084
2839
  * ```ts
2085
2840
  * import { Effect, Metric } from "effect"
2086
2841
  *
2087
- * // Create metrics
2088
2842
  * const requestCount = Metric.counter("http_requests_total", {
2089
2843
  * description: "Total number of HTTP requests"
2090
2844
  * })
@@ -2094,33 +2848,7 @@ export * as Match from "./Match.ts";
2094
2848
  * boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 20 })
2095
2849
  * })
2096
2850
  *
2097
- * // Use metrics in your application
2098
2851
  * const handleRequest = Effect.gen(function*() {
2099
- * yield* Metric.update(requestCount, 1)
2100
- *
2101
- * const startTime = yield* Effect.clockWith((clock) => clock.currentTimeMillis)
2102
- *
2103
- * // Process request...
2104
- * yield* Effect.sleep("100 millis")
2105
- *
2106
- * const endTime = yield* Effect.clockWith((clock) => clock.currentTimeMillis)
2107
- * yield* Metric.update(responseTime, endTime - startTime)
2108
- * })
2109
- * ```
2110
- *
2111
- * ## Attributes and Tagging
2112
- *
2113
- * **Example** (Tagging metrics with attributes)
2114
- *
2115
- * ```ts
2116
- * import { Effect, Metric } from "effect"
2117
- *
2118
- * const requestCount = Metric.counter("requests", {
2119
- * description: "Number of requests by endpoint and method"
2120
- * })
2121
- *
2122
- * const program = Effect.gen(function*() {
2123
- * // Add attributes to metrics
2124
2852
  * yield* Metric.update(
2125
2853
  * Metric.withAttributes(requestCount, {
2126
2854
  * endpoint: "/api/users",
@@ -2129,59 +2857,21 @@ export * as Match from "./Match.ts";
2129
2857
  * 1
2130
2858
  * )
2131
2859
  *
2132
- * // Or use withAttributes for compile-time attributes
2133
- * const taggedCounter = Metric.withAttributes(requestCount, {
2134
- * endpoint: "/api/posts",
2135
- * method: "POST"
2136
- * })
2137
- * yield* Metric.update(taggedCounter, 1)
2138
- * })
2139
- * ```
2140
- *
2141
- * ## Advanced Examples
2860
+ * yield* Metric.update(responseTime, 125)
2142
2861
  *
2143
- * **Example** (Recording business and performance metrics)
2144
- *
2145
- * ```ts
2146
- * import { Effect, Metric } from "effect"
2147
- *
2148
- * // Business metrics
2149
- * const userSignups = Metric.counter("user_signups_total")
2150
- * const activeUsers = Metric.gauge("active_users_current")
2151
- * const featureUsage = Metric.frequency("feature_usage")
2152
- *
2153
- * // Performance metrics
2154
- * const dbQueryTime = Metric.summary("db_query_duration", {
2155
- * maxAge: "5 minutes",
2156
- * maxSize: 1000,
2157
- * quantiles: [0.5, 0.9, 0.95, 0.99]
2862
+ * return yield* Metric.value(requestCount)
2158
2863
  * })
2864
+ * ```
2159
2865
  *
2160
- * const program = Effect.gen(function*() {
2161
- * // Track user signup
2162
- * yield* Metric.update(userSignups, 1)
2163
- *
2164
- * // Update active user count
2165
- * yield* Metric.update(activeUsers, 1250)
2166
- *
2167
- * // Record feature usage
2168
- * yield* Metric.update(featureUsage, "dashboard_view")
2169
- *
2170
- * // Measure database query time
2171
- * yield* Effect.timed(performDatabaseQuery).pipe(
2172
- * Effect.tap(([duration]) => Metric.update(dbQueryTime, duration))
2173
- * )
2174
- * })
2866
+ * **See also**
2175
2867
  *
2176
- * // Get metric snapshots
2177
- * const getMetrics = Effect.gen(function*() {
2178
- * const snapshots = yield* Metric.snapshot
2868
+ * - {@link counter} / {@link gauge} / {@link frequency} for common metric types
2869
+ * - {@link histogram} / {@link summary} for distribution metrics
2870
+ * - {@link update} / {@link modify} / {@link value} for working with metric state
2871
+ * - {@link withAttributes} for adding dimensions
2872
+ * - {@link snapshot} for exporting all registered metric values
2179
2873
  *
2180
- * for (const metric of snapshots) {
2181
- * console.log(`${metric.id}: ${JSON.stringify(metric.state)}`)
2182
- * }
2183
- * })
2184
- * ```
2874
+ * @since 2.0.0
2185
2875
  */
2186
2876
  export * as Metric from "./Metric.ts";
2187
2877
  /**
@@ -2200,111 +2890,172 @@ export * as Metric from "./Metric.ts";
2200
2890
  * - Iterable interface for easy traversal
2201
2891
  * - Memory-efficient storage with automatic bucket management
2202
2892
  *
2203
- * Performance Characteristics:
2204
- * - Get/Set/Has: O(1) average, O(n) worst case (hash collisions)
2205
- * - Remove: O(1) average, O(n) worst case
2206
- * - Clear: O(1)
2207
- * - Size: O(1)
2208
- * - Iteration: O(n)
2893
+ * Performance Characteristics:
2894
+ * - Get/Set/Has: O(1) average, O(n) worst case (hash collisions)
2895
+ * - Remove: O(1) average, O(n) worst case
2896
+ * - Clear: O(1)
2897
+ * - Size: O(1)
2898
+ * - Iteration: O(n)
2899
+ *
2900
+ * @since 2.0.0
2901
+ */
2902
+ export * as MutableHashMap from "./MutableHashMap.ts";
2903
+ /**
2904
+ * The `MutableHashSet` module provides a mutable hash set for storing unique
2905
+ * values with efficient membership checks, insertion, removal, and iteration.
2906
+ * It is built on {@link MutableHashMap}: each set value is stored as a map key,
2907
+ * so uniqueness follows the same hashing and equality rules as the underlying
2908
+ * mutable hash map.
2909
+ *
2910
+ * **Mental model**
2911
+ *
2912
+ * - `MutableHashSet<V>` is a mutable collection of unique values of type `V`
2913
+ * - Operations such as {@link add}, {@link remove}, and {@link clear} mutate
2914
+ * the set in place
2915
+ * - Duplicate values are ignored according to Effect equality and hashing semantics
2916
+ * - Values that implement `Equal` / `Hash` are compared structurally
2917
+ * - Primitive values and references that do not implement Effect equality use
2918
+ * the normal hash map behavior
2919
+ * - The set is iterable, so `Array.from(set)` or `for...of` can be used to
2920
+ * inspect its values
2921
+ *
2922
+ * **Common tasks**
2923
+ *
2924
+ * - Create an empty set: {@link empty}
2925
+ * - Create from values: {@link make}
2926
+ * - Create from any iterable: {@link fromIterable}
2927
+ * - Add a value: {@link add}
2928
+ * - Check membership: {@link has}
2929
+ * - Remove a value: {@link remove}
2930
+ * - Remove all values: {@link clear}
2931
+ * - Count unique values: {@link size}
2932
+ * - Narrow unknown values: {@link isMutableHashSet}
2933
+ *
2934
+ * **Gotchas**
2935
+ *
2936
+ * - This data structure is intentionally mutable; keep ownership clear when
2937
+ * sharing it between callers
2938
+ * - Mutating operations return the same set instance for convenient piping, not
2939
+ * a copy
2940
+ * - Iteration order should not be used as a stable sorting mechanism
2941
+ * - For immutable set operations, use Effect's immutable collection modules
2942
+ * instead
2943
+ *
2944
+ * **Performance**
2945
+ *
2946
+ * - Add, membership checks, and removal are O(1) on average and O(n) in the
2947
+ * presence of hash collisions
2948
+ * - Clearing and reading the size are O(1)
2949
+ * - Iteration is O(n)
2950
+ *
2951
+ * **Quickstart**
2952
+ *
2953
+ * **Example** (Tracking unique values)
2954
+ *
2955
+ * ```ts
2956
+ * import { MutableHashSet } from "effect"
2957
+ *
2958
+ * const set = MutableHashSet.make("apple", "banana", "apple")
2209
2959
  *
2210
- * @category data-structures
2211
- * @since 2.0.0
2212
- */
2213
- export * as MutableHashMap from "./MutableHashMap.ts";
2214
- /**
2215
- * @fileoverview
2216
- * MutableHashSet is a high-performance, mutable set implementation that provides efficient storage
2217
- * and retrieval of unique values. Built on top of MutableHashMap, it inherits the same performance
2218
- * characteristics and support for both structural and referential equality.
2960
+ * MutableHashSet.add(set, "cherry")
2961
+ * MutableHashSet.remove(set, "banana")
2219
2962
  *
2220
- * The implementation uses a MutableHashMap internally where each value is stored as a key with a
2221
- * boolean flag, providing O(1) average-case performance for all operations.
2963
+ * console.log(MutableHashSet.has(set, "apple"))
2964
+ * // Output: true
2222
2965
  *
2223
- * Key Features:
2224
- * - Mutable operations for performance-critical scenarios
2225
- * - Supports both structural and referential equality
2226
- * - Efficient duplicate detection and removal
2227
- * - Iterable interface for easy traversal
2228
- * - Memory-efficient storage with automatic deduplication
2229
- * - Seamless integration with Effect's Equal and Hash interfaces
2966
+ * console.log(MutableHashSet.size(set))
2967
+ * // Output: 2
2230
2968
  *
2231
- * Performance Characteristics:
2232
- * - Add/Has/Remove: O(1) average, O(n) worst case (hash collisions)
2233
- * - Clear: O(1)
2234
- * - Size: O(1)
2235
- * - Iteration: O(n)
2969
+ * console.log(Array.from(set))
2970
+ * // Output: ["apple", "cherry"]
2971
+ * ```
2236
2972
  *
2237
- * @category data-structures
2238
2973
  * @since 2.0.0
2239
2974
  */
2240
2975
  export * as MutableHashSet from "./MutableHashSet.ts";
2241
2976
  /**
2242
- * @fileoverview
2243
- * MutableList is an efficient, mutable linked list implementation optimized for high-throughput
2244
- * scenarios like logging, queuing, and streaming. It uses a bucket-based architecture where
2245
- * elements are stored in arrays (buckets) linked together, providing optimal performance for
2246
- * both append and prepend operations.
2977
+ * The `MutableList` module provides a mutable linked list for accumulating,
2978
+ * ordering, inspecting, and draining values with efficient operations at both
2979
+ * ends of the list.
2247
2980
  *
2248
- * The implementation uses a sophisticated bucket system:
2249
- * - Each bucket contains an array of elements with an offset pointer
2250
- * - Buckets can be marked as mutable or immutable for optimization
2251
- * - Elements are taken from the head and added to the tail
2252
- * - Memory is efficiently managed through bucket reuse and cleanup
2981
+ * A `MutableList<A>` stores values in linked buckets of arrays. Appending adds
2982
+ * values to the tail, prepending adds values to the head, and taking removes
2983
+ * values from the head. Unlike persistent collections, every mutation updates
2984
+ * the list object in place: operations such as {@link append}, {@link prepend},
2985
+ * {@link take}, {@link takeN}, {@link clear}, {@link filter}, and {@link remove}
2986
+ * change the same `MutableList` instance and update its `length`.
2253
2987
  *
2254
- * Key Features:
2255
- * - Highly optimized for high-frequency append/prepend operations
2256
- * - Memory efficient with automatic cleanup of consumed elements
2257
- * - Support for bulk operations (appendAll, prependAll, takeN)
2258
- * - Filtering and removal operations
2259
- * - Zero-copy optimizations for certain scenarios
2988
+ * **Mental model**
2260
2989
  *
2261
- * Performance Characteristics:
2262
- * - Append/Prepend: O(1) amortized
2263
- * - Take/TakeN: O(1) per element taken
2264
- * - Length: O(1)
2265
- * - Clear: O(1)
2266
- * - Filter: O(n)
2990
+ * - `MutableList<A>` is a stateful container with `head`, `tail`, and `length`
2991
+ * - Values are consumed from the head with {@link take}, {@link takeN}, or
2992
+ * {@link takeAll}
2993
+ * - {@link append} and {@link appendAll} preserve FIFO queue order for normal
2994
+ * producer-consumer use cases
2995
+ * - {@link prepend} and {@link prependAll} place values before the current
2996
+ * contents, which is useful for priority work or restoring items to the front
2997
+ * - {@link toArray} and {@link toArrayN} copy values without modifying the list
2998
+ * - The `head` and `tail` bucket fields are exposed for advanced use, but most
2999
+ * code should treat them as implementation details
2267
3000
  *
2268
- * Ideal Use Cases:
2269
- * - High-throughput logging systems
2270
- * - Producer-consumer queues
2271
- * - Streaming data buffers
2272
- * - Real-time data processing pipelines
3001
+ * **Common tasks**
3002
+ *
3003
+ * - Create an empty list: {@link make}
3004
+ * - Add one value: {@link append}, {@link prepend}
3005
+ * - Add many values: {@link appendAll}, {@link prependAll}
3006
+ * - Drain one value: {@link take}
3007
+ * - Drain many values: {@link takeN}, {@link takeAll}
3008
+ * - Inspect without draining: {@link toArrayN}, {@link toArray}
3009
+ * - Reset the list: {@link clear}
3010
+ * - Mutate contents in place: {@link filter}, {@link remove}
3011
+ *
3012
+ * **Gotchas**
3013
+ *
3014
+ * - `MutableList` is intentionally mutable; sharing a list means sharing its
3015
+ * changing state
3016
+ * - {@link take} returns the {@link Empty} symbol when the list has no value, so
3017
+ * compare with `MutableList.Empty` instead of relying on falsy checks
3018
+ * - {@link appendAllUnsafe} and {@link prependAllUnsafe} may reuse the provided
3019
+ * array when `mutable` is `true`; only enable that optimization when callers
3020
+ * will not keep using the array independently
3021
+ * - {@link remove} uses JavaScript strict equality semantics, not structural
3022
+ * equality
2273
3023
  *
2274
- * @category data-structures
2275
3024
  * @since 4.0.0
2276
3025
  */
2277
3026
  export * as MutableList from "./MutableList.ts";
2278
3027
  /**
2279
- * @fileoverview
2280
- * MutableRef provides a mutable reference container that allows safe mutation of values
2281
- * in functional programming contexts. It serves as a bridge between functional and imperative
2282
- * programming paradigms, offering atomic operations for state management.
3028
+ * The `MutableRef` module provides a small synchronous container for mutable
3029
+ * state. A `MutableRef<A>` stores one current value of type `A`, exposes that
3030
+ * value through `.current`, and offers pipeable helpers for reading, replacing,
3031
+ * and transforming the value in place.
2283
3032
  *
2284
- * Unlike regular variables, MutableRef encapsulates mutable state and provides controlled
2285
- * access through a standardized API. It supports atomic compare-and-set operations for
2286
- * thread-safe updates and integrates seamlessly with Effect's ecosystem.
3033
+ * **Mental model**
2287
3034
  *
2288
- * Key Features:
2289
- * - Mutable reference semantics with functional API
2290
- * - Atomic compare-and-set operations for safe concurrent updates
2291
- * - Specialized operations for numeric and boolean values
2292
- * - Chainable operations that return the reference or the value
2293
- * - Integration with Effect's Equal interface for value comparison
2294
- *
2295
- * Common Use Cases:
2296
- * - State containers in functional applications
2297
- * - Counters and accumulators
2298
- * - Configuration that needs to be updated at runtime
2299
- * - Caching and memoization scenarios
2300
- * - Inter-module communication via shared references
3035
+ * - `MutableRef<A>` is a stable reference whose `.current` field may change over time
3036
+ * - Reads and writes are synchronous and return immediately
3037
+ * - `set`, `update`, `increment`, `decrement`, and `toggle` mutate the same reference in place
3038
+ * - `getAnd*` helpers return the previous value, while `*AndGet` helpers return the new value
3039
+ * - `compareAndSet` updates only when the current value is equal to the expected value using `Equal.equals`
3040
+ * - A `MutableRef` is useful for local mutable state, but it does not make updates transactional or effectful
2301
3041
  *
2302
- * Performance Characteristics:
2303
- * - Get/Set: O(1)
2304
- * - Compare-and-set: O(1)
2305
- * - All operations: O(1)
3042
+ * **Common tasks**
3043
+ *
3044
+ * - Create a reference: {@link make}
3045
+ * - Read the current value: {@link get} or `.current`
3046
+ * - Replace the current value: {@link set}, {@link setAndGet}, {@link getAndSet}
3047
+ * - Transform the current value: {@link update}, {@link updateAndGet}, {@link getAndUpdate}
3048
+ * - Coordinate conditional replacement: {@link compareAndSet}
3049
+ * - Work with counters: {@link increment}, {@link decrement}, {@link incrementAndGet}, {@link decrementAndGet}
3050
+ * - Work with boolean flags: {@link toggle}
3051
+ *
3052
+ * **Gotchas**
3053
+ *
3054
+ * - All updates are imperative mutations; aliases to the same `MutableRef` observe the same changing value
3055
+ * - Updating object or array values does not clone them unless the update function creates a new value
3056
+ * - `compareAndSet` compares with Effect equality semantics, not only JavaScript reference equality
3057
+ * - For state that must participate in `Effect` workflows, interruption, or fiber coordination, prefer higher-level Effect data types
2306
3058
  *
2307
- * @category data-structures
2308
3059
  * @since 2.0.0
2309
3060
  */
2310
3061
  export * as MutableRef from "./MutableRef.ts";
@@ -2375,33 +3126,39 @@ export * as MutableRef from "./MutableRef.ts";
2375
3126
  */
2376
3127
  export * as Newtype from "./Newtype.ts";
2377
3128
  /**
2378
- * @since 2.0.0
3129
+ * The `NonEmptyIterable` module provides a type-level representation of any
3130
+ * JavaScript `Iterable` that is known to contain at least one element. A
3131
+ * `NonEmptyIterable<A>` can be consumed anywhere an `Iterable<A>` is expected,
3132
+ * while also carrying the guarantee that reading the first element is safe.
2379
3133
  *
2380
- * The `NonEmptyIterable` module provides types and utilities for working with iterables
2381
- * that are guaranteed to contain at least one element. This provides compile-time
2382
- * safety when working with collections that must not be empty.
3134
+ * **Mental model**
2383
3135
  *
2384
- * ## Key Features
3136
+ * - `NonEmptyIterable<A>` is an `Iterable<A>` branded with a non-empty guarantee
3137
+ * - The guarantee is static: values should only be typed this way when construction or validation proves at least one element exists
3138
+ * - The iterable can be an array, string, set, map, generator, or any custom iterable
3139
+ * - `unprepend` safely separates the first element from an iterator for the remaining elements
3140
+ * - Operations that may remove elements, such as filtering, usually return ordinary collections because they can become empty
2385
3141
  *
2386
- * - **Type Safety**: Compile-time guarantee that the iterable contains at least one element
2387
- * - **Iterator Protocol**: Fully compatible with JavaScript's built-in iteration protocol
2388
- * - **Functional Operations**: Safe operations that preserve the non-empty property
2389
- * - **Lightweight**: Minimal overhead with maximum type safety
3142
+ * **Common tasks**
3143
+ *
3144
+ * - Accept inputs that must contain at least one value
3145
+ * - Extract a head element and process the remaining iterator with {@link unprepend}
3146
+ * - Model APIs such as reductions, comparisons, or aggregation that are undefined for empty inputs
3147
+ * - Preserve compatibility with the JavaScript iteration protocol while documenting the stronger invariant
2390
3148
  *
2391
- * ## Why NonEmptyIterable?
3149
+ * **Gotchas**
2392
3150
  *
2393
- * Many operations require non-empty collections to be meaningful:
2394
- * - Finding the maximum or minimum value
2395
- * - Getting the first or last element
2396
- * - Reducing without an initial value
2397
- * - Operations that would otherwise need runtime checks
3151
+ * - A type assertion does not make an empty iterable non-empty; only assert after a trusted check or constructor
3152
+ * - Iterators are stateful, so calling {@link unprepend} consumes the first yielded value from that iterator
3153
+ * - The order of the first element follows the source iterable's iteration order, for example insertion order for `Map` and `Set`
3154
+ * - Some transformations preserve non-emptiness, but transformations that can discard elements must account for the empty case
2398
3155
  *
2399
- * ## Basic Usage
3156
+ * **Quickstart**
2400
3157
  *
2401
3158
  * **Example** (Requiring a non-empty iterable)
2402
3159
  *
2403
3160
  * ```ts
2404
- * import * as NonEmptyIterable from "effect/NonEmptyIterable"
3161
+ * import { NonEmptyIterable } from "effect"
2405
3162
  *
2406
3163
  * // NonEmptyIterable is a type that represents any iterable with at least one element
2407
3164
  * function processNonEmpty<A>(data: NonEmptyIterable.NonEmptyIterable<A>): A {
@@ -2487,7 +3244,7 @@ export * as Newtype from "./Newtype.ts";
2487
3244
  *
2488
3245
  * ```ts
2489
3246
  * import { Array, pipe } from "effect"
2490
- * import type * as NonEmptyIterable from "effect/NonEmptyIterable"
3247
+ * import type { NonEmptyIterable } from "effect"
2491
3248
  *
2492
3249
  * // Many Array functions work with NonEmptyIterable
2493
3250
  * declare const nonEmptyData: NonEmptyIterable.NonEmptyIterable<number>
@@ -2508,6 +3265,8 @@ export * as Newtype from "./Newtype.ts";
2508
3265
  * // This would still be non-empty if the source was non-empty
2509
3266
  * )
2510
3267
  * ```
3268
+ *
3269
+ * @since 2.0.0
2511
3270
  */
2512
3271
  export * as NonEmptyIterable from "./NonEmptyIterable.ts";
2513
3272
  /**
@@ -2740,50 +3499,200 @@ export * as Option from "./Option.ts";
2740
3499
  */
2741
3500
  export * as Order from "./Order.ts";
2742
3501
  /**
2743
- * @fileoverview
2744
- * The Ordering module provides utilities for working with comparison results and ordering operations.
2745
- * An Ordering represents the result of comparing two values, expressing whether the first value is
2746
- * less than (-1), equal to (0), or greater than (1) the second value.
3502
+ * The `Ordering` module provides the standard representation for the result of
3503
+ * comparing two values. An `Ordering` is one of three numeric literals: `-1`
3504
+ * when the first value is less than the second, `0` when both values compare as
3505
+ * equal, and `1` when the first value is greater than the second.
2747
3506
  *
2748
- * This module is fundamental for building comparison functions, sorting algorithms, and implementing
2749
- * ordered data structures. It provides composable operations for combining multiple comparison results
2750
- * and pattern matching on ordering outcomes.
3507
+ * **Mental model**
3508
+ *
3509
+ * - `Ordering` describes the relationship between two compared values, not the
3510
+ * values themselves
3511
+ * - Negative means "less than", zero means "equal", and positive means "greater
3512
+ * than"
3513
+ * - Unlike JavaScript comparators, this type is normalized to exactly `-1`, `0`,
3514
+ * or `1`
3515
+ * - `0` is neutral when combining comparisons; the first non-zero ordering
3516
+ * determines the result
3517
+ *
3518
+ * **Common tasks**
3519
+ *
3520
+ * - Interpret a comparison result with {@link match}
3521
+ * - Reverse ascending and descending order with {@link reverse}
3522
+ * - Combine multiple comparison criteria with {@link Reducer}
3523
+ * - Build custom comparison functions for sorting, ordered collections, and
3524
+ * domain-specific ordering rules
3525
+ *
3526
+ * **Gotchas**
3527
+ *
3528
+ * - Do not cast arbitrary comparator results such as `a.localeCompare(b)`
3529
+ * directly unless they have been normalized to `-1`, `0`, or `1`
3530
+ * - In comparator-style APIs, `-1` means the left value should come before the
3531
+ * right value, while `1` means it should come after
3532
+ * - Reversing an `Ordering` swaps `-1` and `1`, but leaves `0` unchanged
2751
3533
  *
2752
- * Key Features:
2753
- * - Type-safe representation of comparison results (-1, 0, 1)
2754
- * - Composable operations for combining multiple orderings
2755
- * - Pattern matching utilities for handling different ordering cases
2756
- * - Ordering reversal and combination functions
2757
- * - Integration with Effect's functional programming patterns
2758
- *
2759
- * Common Use Cases:
2760
- * - Implementing custom comparison functions
2761
- * - Building complex sorting criteria
2762
- * - Combining multiple comparison results
2763
- * - Creating ordered data structures
2764
- * - Pattern matching on comparison outcomes
2765
- *
2766
- * @category utilities
2767
3534
  * @since 2.0.0
2768
3535
  */
2769
3536
  export * as Ordering from "./Ordering.ts";
2770
3537
  /**
3538
+ * The `PartitionedSemaphore` module provides a semaphore for limiting
3539
+ * concurrency across a shared permit pool while keeping waiters grouped by
3540
+ * partition key. A `PartitionedSemaphore<K>` is useful when many independent
3541
+ * groups of work compete for the same bounded resource and each group should
3542
+ * make progress without one busy group monopolizing released permits.
3543
+ *
3544
+ * **Mental model**
3545
+ *
3546
+ * - The semaphore has a fixed shared capacity measured in permits
3547
+ * - Work acquires permits with a partition key of type `K`
3548
+ * - Waiting acquisitions are tracked per partition
3549
+ * - Released permits are assigned to waiting partitions in round-robin order
3550
+ * - `withPermit` and `withPermits` acquire permits around an effect and
3551
+ * release them when the effect exits, fails, or is interrupted
3552
+ *
3553
+ * **Common tasks**
3554
+ *
3555
+ * - Create a semaphore: {@link make}, {@link makeUnsafe}
3556
+ * - Inspect capacity and availability: {@link capacity}, {@link available}
3557
+ * - Acquire and release manually: {@link take}, {@link release}
3558
+ * - Limit a single operation per partition: {@link withPermit}
3559
+ * - Limit weighted work per partition: {@link withPermits}
3560
+ * - Run only when permits are immediately available:
3561
+ * {@link withPermitsIfAvailable}
3562
+ *
3563
+ * **Gotchas**
3564
+ *
3565
+ * - `withPermitsIfAvailable` does not use a partition key; it only succeeds
3566
+ * when the shared pool has enough permits immediately
3567
+ * - Acquiring more permits than the semaphore capacity never completes
3568
+ * - Requests for zero or negative permits complete without acquiring anything
3569
+ * - Non-finite capacities create an unbounded semaphore whose acquire and
3570
+ * release operations complete immediately
3571
+ *
2771
3572
  * @since 4.0.0
2772
3573
  */
2773
3574
  export * as PartitionedSemaphore from "./PartitionedSemaphore.ts";
2774
3575
  /**
3576
+ * The `Path` module provides a platform path service for manipulating file
3577
+ * system paths through Effect's environment. It models path operations as a
3578
+ * replaceable service so programs can depend on path behavior without directly
3579
+ * coupling to a particular runtime implementation.
3580
+ *
3581
+ * **Mental model**
3582
+ *
3583
+ * - `Path.Path` is a `Context.Service` tag used to access the current path implementation
3584
+ * - The service offers familiar path operations such as joining, resolving, parsing, and formatting
3585
+ * - Most operations are pure string transformations and follow POSIX-style path semantics
3586
+ * - File URL conversions return `Effect`s because invalid paths or URLs can fail with `BadArgument`
3587
+ * - Custom implementations can be provided with `Layer.succeed` for alternate platforms or tests
3588
+ *
3589
+ * **Common tasks**
3590
+ *
3591
+ * - Combine path segments with `join` or turn segments into an absolute path with `resolve`
3592
+ * - Normalize `.` and `..` segments with `normalize`
3593
+ * - Inspect paths with `basename`, `dirname`, `extname`, and `isAbsolute`
3594
+ * - Convert between structured path parts and strings with `parse` and `format`
3595
+ * - Compute relative paths with `relative`
3596
+ * - Convert between file paths and `file:` URLs with `toFileUrl` and `fromFileUrl`
3597
+ *
3598
+ * **Gotchas**
3599
+ *
3600
+ * - Path strings are not checked against the file system; these operations only manipulate syntax
3601
+ * - `resolve` may consult the host current working directory when no absolute segment is supplied
3602
+ * - `fromFileUrl` only accepts valid `file:` URLs and rejects encoded path separators
3603
+ * - Use the service from the environment when writing portable Effect code instead of importing
3604
+ * host-specific path APIs directly
3605
+ *
2775
3606
  * @since 4.0.0
2776
3607
  */
2777
3608
  export * as Path from "./Path.ts";
2778
3609
  /**
3610
+ * The `Pipeable` module defines the shared interface and implementation helpers
3611
+ * for values that support Effect-style method chaining with `.pipe(...)`.
3612
+ *
3613
+ * A `Pipeable` value can pass itself through a sequence of unary functions from
3614
+ * left to right, so code can be written as `value.pipe(f, g, h)` instead of
3615
+ * deeply nesting calls. This is the method form used by many Effect data types
3616
+ * to compose transformations, validations, and effectful operations while
3617
+ * keeping the original value as the starting point of the pipeline.
3618
+ *
3619
+ * **Common tasks**
3620
+ *
3621
+ * - Type values that expose a `.pipe(...)` method with the {@link Pipeable} interface
3622
+ * - Implement a custom `.pipe(...)` method with {@link pipeArguments}
3623
+ * - Reuse the standard implementation through {@link Prototype}, {@link Class}, or {@link Mixin}
3624
+ *
3625
+ * **Gotchas**
3626
+ *
3627
+ * - Each function receives the result of the previous function, not the original value
3628
+ * - The overloads preserve precise types for long pipelines, but very long chains may be easier to read when split
3629
+ *
2779
3630
  * @since 2.0.0
2780
3631
  */
2781
3632
  export * as Pipeable from "./Pipeable.ts";
2782
3633
  /**
3634
+ * The `PlatformError` module defines the normalized error model used by
3635
+ * platform APIs when adapting host operations into Effect programs. It gives
3636
+ * callers a stable `PlatformError` wrapper whose `reason` is either a
3637
+ * `BadArgument`, for invalid inputs rejected before an operation runs, or a
3638
+ * `SystemError`, for failures reported by the host platform or operating
3639
+ * system.
3640
+ *
3641
+ * Use this module when implementing or consuming platform services such as
3642
+ * file systems, terminal access, sockets, or other environment-specific APIs.
3643
+ * `SystemError` intentionally groups many low-level failures into a small set
3644
+ * of portable tags like `NotFound`, `PermissionDenied`, and `TimedOut`, while
3645
+ * still preserving operation details such as the module, method, syscall, path
3646
+ * or descriptor, description, and original cause when available.
3647
+ *
3648
+ * **Common tasks**
3649
+ *
3650
+ * - Create platform failures from system operations with {@link systemError}
3651
+ * - Report rejected caller input with {@link badArgument}
3652
+ * - Inspect the underlying reason via {@link PlatformError.reason}
3653
+ * - Match normalized system failures with {@link SystemErrorTag}
3654
+ *
3655
+ * **Gotchas**
3656
+ *
3657
+ * - `PlatformError` is a wrapper; inspect `reason` to distinguish
3658
+ * `BadArgument` from `SystemError`
3659
+ * - `SystemErrorTag` values are normalized categories, not necessarily raw
3660
+ * platform error codes
3661
+ * - The original cause is preserved when provided, but portable handling
3662
+ * should rely on the normalized fields
3663
+ *
2783
3664
  * @since 4.0.0
2784
3665
  */
2785
3666
  export * as PlatformError from "./PlatformError.ts";
2786
3667
  /**
3668
+ * The `Pool` module provides scoped resource pools for sharing expensive or
3669
+ * limited resources across fibers. A `Pool<A, E>` manages values of type `A`
3670
+ * acquired by an effect that may fail with `E`, automatically releasing all
3671
+ * allocated resources when the surrounding `Scope` closes.
3672
+ *
3673
+ * **Mental model**
3674
+ *
3675
+ * - A pool owns a bounded set of acquired items and hands them out with {@link get}
3676
+ * - Each checkout is scoped; leaving the scope returns the item to the pool
3677
+ * - `concurrency` controls how many fibers may use the same item at once
3678
+ * - `targetUtilization` controls when the pool grows between its minimum and maximum sizes
3679
+ * - {@link invalidate} removes a specific item so it can be replaced lazily
3680
+ *
3681
+ * **Common tasks**
3682
+ *
3683
+ * - Create a fixed-size pool with {@link make}
3684
+ * - Create an elastic pool with time-to-live reclamation using {@link makeWithTTL}
3685
+ * - Implement custom resizing and reclamation behavior with {@link makeWithStrategy}
3686
+ * - Borrow resources safely in scoped effects with {@link get}
3687
+ *
3688
+ * **Gotchas**
3689
+ *
3690
+ * - Pool construction and item checkout require `Scope`; closing the scope shuts
3691
+ * down the pool or returns the borrowed item
3692
+ * - Failed acquisitions are represented by the `get` effect failing with the
3693
+ * acquisition error, and retrying `get` can retry acquisition
3694
+ * - Resource finalization order during shutdown is unspecified
3695
+ *
2787
3696
  * @since 2.0.0
2788
3697
  */
2789
3698
  export * as Pool from "./Pool.ts";
@@ -2816,7 +3725,7 @@ export * as Pool from "./Pool.ts";
2816
3725
  * **Example** (Filter by a predicate)
2817
3726
  *
2818
3727
  * ```ts
2819
- * import * as Predicate from "effect/Predicate"
3728
+ * import { Predicate } from "effect"
2820
3729
  *
2821
3730
  * const isPositive = (n: number) => n > 0
2822
3731
  * const data = [2, -1, 3]
@@ -2856,13 +3765,14 @@ export * as PrimaryKey from "./PrimaryKey.ts";
2856
3765
  * const program = Effect.gen(function*() {
2857
3766
  * const pubsub = yield* PubSub.bounded<string>(10)
2858
3767
  *
2859
- * // Publisher
2860
- * yield* PubSub.publish(pubsub, "Hello")
2861
- * yield* PubSub.publish(pubsub, "World")
2862
- *
2863
- * // Subscriber
2864
3768
  * yield* Effect.scoped(Effect.gen(function*() {
2865
3769
  * const subscription = yield* PubSub.subscribe(pubsub)
3770
+ *
3771
+ * // Publisher
3772
+ * yield* PubSub.publish(pubsub, "Hello")
3773
+ * yield* PubSub.publish(pubsub, "World")
3774
+ *
3775
+ * // Subscriber
2866
3776
  * const message1 = yield* PubSub.take(subscription)
2867
3777
  * const message2 = yield* PubSub.take(subscription)
2868
3778
  * console.log(message1, message2) // "Hello", "World"
@@ -2874,17 +3784,103 @@ export * as PrimaryKey from "./PrimaryKey.ts";
2874
3784
  */
2875
3785
  export * as PubSub from "./PubSub.ts";
2876
3786
  /**
3787
+ * The `Pull` module provides the low-level pull-step abstraction used by
3788
+ * stream-like consumers. A `Pull<A, E, Done, R>` is an `Effect` that can
3789
+ * produce one value of type `A`, fail with an ordinary error `E`, or signal
3790
+ * end-of-input with a `Cause.Done<Done>` value.
3791
+ *
3792
+ * **Mental model**
3793
+ *
3794
+ * - `Pull` is an `Effect` with a distinguished completion signal in the error channel
3795
+ * - ordinary failures and completion are both represented by `Cause`, but can be separated with the helpers in this module
3796
+ * - the `Done` value can carry leftover state or a final value needed by a downstream consumer
3797
+ * - `Pull` is useful when repeatedly evaluating an effect until it either produces values, fails, or reports that no more input is available
3798
+ *
3799
+ * **Common tasks**
3800
+ *
3801
+ * - Extract type parameters from a pull: {@link Success}, {@link Error}, {@link Leftover}, {@link Services}
3802
+ * - Detect and filter completion: {@link isDoneCause}, {@link filterDone}, {@link filterNoDone}
3803
+ * - Recover from completion while preserving ordinary failures: {@link catchDone}
3804
+ * - Convert done causes to successful exits: {@link doneExitFromCause}
3805
+ * - Handle all outcomes explicitly: {@link matchEffect}
3806
+ *
3807
+ * **Gotchas**
3808
+ *
3809
+ * - `Cause.Done` is not an ordinary failure; use this module's helpers before treating a pull failure as an error
3810
+ * - `Done` lives in the error channel, so generic `Effect` error handling can catch it unless you filter it deliberately
3811
+ * - `Pull` is a low-level primitive; most user-facing stream workflows should prefer higher-level stream APIs when available
3812
+ *
2877
3813
  * @since 4.0.0
2878
3814
  */
2879
3815
  export * as Pull from "./Pull.ts";
2880
3816
  /**
3817
+ * The `Queue` module provides asynchronous queues for communicating between
3818
+ * fibers. A `Queue<A, E>` can receive values of type `A`, deliver them to
3819
+ * consumers in order, and eventually complete or fail with an error of type
3820
+ * `E`.
3821
+ *
3822
+ * **Mental model**
3823
+ *
3824
+ * - A queue is a fiber-aware channel with one write side ({@link Enqueue}) and
3825
+ * one read side ({@link Dequeue})
3826
+ * - Producers add values with {@link offer} or {@link offerAll}; consumers
3827
+ * remove values with {@link take}, {@link takeN}, {@link takeBetween}, or
3828
+ * {@link takeAll}
3829
+ * - Bounded queues use an overflow strategy: {@link bounded} suspends
3830
+ * producers, {@link dropping} rejects new values, and {@link sliding} drops
3831
+ * old values
3832
+ * - Queues can be completed with {@link end}, failed with {@link fail} or
3833
+ * {@link failCause}, interrupted with {@link interrupt}, and shut down with
3834
+ * {@link shutdown}
3835
+ * - Operations are expressed as `Effect` values so waiting producers and
3836
+ * consumers compose with interruption, scheduling, and structured
3837
+ * concurrency
3838
+ *
3839
+ * **Common tasks**
3840
+ *
3841
+ * - Create queues: {@link make}, {@link bounded}, {@link dropping},
3842
+ * {@link sliding}, {@link unbounded}
3843
+ * - Restrict capabilities: {@link asEnqueue}, {@link asDequeue}
3844
+ * - Produce values: {@link offer}, {@link offerAll}
3845
+ * - Consume values: {@link take}, {@link takeN}, {@link takeBetween},
3846
+ * {@link takeAll}, {@link poll}, {@link peek}
3847
+ * - Drain or reset buffered values: {@link collect}, {@link clear}
3848
+ * - Signal lifecycle: {@link end}, {@link fail}, {@link failCause},
3849
+ * {@link interrupt}, {@link shutdown}
3850
+ * - Inspect state: {@link size}, {@link isFull}
3851
+ *
3852
+ * **Gotchas**
3853
+ *
3854
+ * - `take` waits when the queue is empty; use {@link poll} when absence should
3855
+ * be represented as `Option.None`
3856
+ * - `dropping` and `sliding` queues can lose values by design; use
3857
+ * {@link bounded} when every offered value must be preserved
3858
+ * - Completion and failure are observed by consumers through the queue's error
3859
+ * channel, so include `Cause.Done` in the error type when using {@link end}
3860
+ * - The `Unsafe` variants are synchronous, low-level operations; prefer the
3861
+ * effectful APIs in application code
3862
+ *
3863
+ * **See also**
3864
+ *
3865
+ * - {@link Enqueue} for write-only queue handles
3866
+ * - {@link Dequeue} for read-only queue handles
3867
+ * - {@link Pull} for stream-style completion errors
3868
+ *
2881
3869
  * @since 3.8.0
2882
3870
  */
2883
3871
  export * as Queue from "./Queue.ts";
2884
3872
  /**
2885
- * The Random module provides a service for generating random numbers in Effect
2886
- * programs. It offers a testable and composable way to work with randomness,
2887
- * supporting integers, floating-point numbers, and range-based generation.
3873
+ * The `Random` module provides a service for generating pseudo-random numbers
3874
+ * in Effect programs. It offers a testable and composable way to work with
3875
+ * randomness, supporting integers, floating-point numbers, and range-based
3876
+ * generation.
3877
+ *
3878
+ * The default `Random` service is not cryptographically secure. Do not use it
3879
+ * for secrets, tokens, UUIDs, session identifiers, or other security-sensitive
3880
+ * values. For cryptographically secure random generation, replace the service
3881
+ * with a cryptographically secure implementation such as the platform `Crypto`
3882
+ * service. `Random.withSeed` also replaces the service, but predictable seeds
3883
+ * remain deterministic and must not be treated as cryptographically secure.
2888
3884
  *
2889
3885
  * **Example** (Generating random values)
2890
3886
  *
@@ -2907,10 +3903,44 @@ export * as Queue from "./Queue.ts";
2907
3903
  */
2908
3904
  export * as Random from "./Random.ts";
2909
3905
  /**
3906
+ * The `RcMap` module provides a scoped, reference-counted map for sharing
3907
+ * resources by key. It is useful when many fibers may request the same
3908
+ * resource, such as a connection, client, session, or cached handle, and the
3909
+ * resource should be acquired once, reused while it has active references, and
3910
+ * released automatically when it is no longer needed.
3911
+ *
3912
+ * Each key is resolved with a user-provided lookup effect on first access via
3913
+ * {@link get}. Further accesses to the same key share the in-flight or acquired
3914
+ * resource and increment its reference count for the caller's current
3915
+ * `Scope`. When those scopes close, references are released; resources can be
3916
+ * closed immediately, kept alive for an idle time-to-live, invalidated
3917
+ * explicitly, or bounded by a maximum capacity.
3918
+ *
3919
+ * `RcMap` is designed for Effect resource lifecycles rather than general
3920
+ * mutable caching. The map itself is scoped, lookups require a `Scope`, and
3921
+ * complex keys should provide `Equal` / `Hash` behavior when they need
3922
+ * value-based lookup semantics.
3923
+ *
2910
3924
  * @since 3.5.0
2911
3925
  */
2912
3926
  export * as RcMap from "./RcMap.ts";
2913
3927
  /**
3928
+ * The `RcRef` module provides reference-counted access to a shared resource
3929
+ * whose lifecycle is managed by `Scope`. An `RcRef<A, E>` lazily acquires its
3930
+ * resource the first time it is requested, shares that resource across active
3931
+ * users, and releases it when the final scope holding a reference closes.
3932
+ *
3933
+ * Use `RcRef` when several scoped operations should reuse the same expensive
3934
+ * or stateful resource, such as a connection, client, cache, or worker, without
3935
+ * making each operation acquire and release its own copy. `make` defines how
3936
+ * the resource is acquired, `get` borrows the current resource for the active
3937
+ * scope, and `invalidate` forces a future `get` to acquire a fresh resource.
3938
+ *
3939
+ * The resource is tied to scopes rather than ordinary object reachability:
3940
+ * every `get` must run with a `Scope`, and the reference count is decremented
3941
+ * when that scope closes. If `idleTimeToLive` is configured, a resource whose
3942
+ * reference count reaches zero can remain cached briefly before release.
3943
+ *
2914
3944
  * @since 3.5.0
2915
3945
  */
2916
3946
  export * as RcRef from "./RcRef.ts";
@@ -3135,10 +4165,85 @@ export * as RegExp from "./RegExp.ts";
3135
4165
  */
3136
4166
  export * as Request from "./Request.ts";
3137
4167
  /**
4168
+ * The `RequestResolver` module provides the data-loading side of
4169
+ * `Effect.request`. A `Request` describes what a fiber needs, while a
4170
+ * `RequestResolver` describes how to collect, batch, execute, cache, trace,
4171
+ * and complete those requests.
4172
+ *
4173
+ * **Mental model**
4174
+ *
4175
+ * - A resolver receives one or more `Request.Entry` values and must complete
4176
+ * each entry with either a success or failure
4177
+ * - Concurrent requests made with the same resolver can be gathered into a
4178
+ * batch before the resolver is run
4179
+ * - Batch keys split pending requests into independent groups, which is useful
4180
+ * when different backends, tenants, or query shapes must be resolved
4181
+ * separately
4182
+ * - Delays and `batchN` tune how long requests are collected and how large
4183
+ * each batch may become
4184
+ * - Resolvers can be wrapped with tracing, in-memory caching, cache services,
4185
+ * and persistence without changing the request type
4186
+ *
4187
+ * **Common tasks**
4188
+ *
4189
+ * - Create a resolver from batch logic: {@link make}
4190
+ * - Create grouped batch logic: {@link makeGrouped} or {@link grouped}
4191
+ * - Create a resolver from pure logic: {@link fromFunction} or
4192
+ * {@link fromFunctionBatched}
4193
+ * - Create a resolver from effectful logic: {@link fromEffect} or
4194
+ * {@link fromEffectTagged}
4195
+ * - Control batching: {@link setDelay}, {@link setDelayEffect},
4196
+ * {@link batchN}
4197
+ * - Add operational behavior: {@link around}, {@link race}, {@link withSpan}
4198
+ * - Reuse results: {@link withCache}, {@link asCache}, {@link persisted}
4199
+ *
4200
+ * **Gotchas**
4201
+ *
4202
+ * - Every entry passed to a resolver must be completed; leaving an entry
4203
+ * incomplete causes the waiting request to fail
4204
+ * - Batched result collections must line up with the input entries in order
4205
+ * and length when using the batched helper constructors
4206
+ * - Grouping controls which requests share a resolver run; choose stable keys
4207
+ * for requests that can safely be handled together
4208
+ * - Caching and persistence depend on request identity and the request's
4209
+ * equality semantics, so model request values deliberately when cached
4210
+ *
3138
4211
  * @since 2.0.0
3139
4212
  */
3140
4213
  export * as RequestResolver from "./RequestResolver.ts";
3141
4214
  /**
4215
+ * The `Resource` module provides refreshable, scoped values. A
4216
+ * `Resource<A, E>` stores the latest successful or failed acquisition result and
4217
+ * can be read with {@link get}, refreshed manually with {@link refresh}, or
4218
+ * refreshed automatically with {@link auto}.
4219
+ *
4220
+ * **Mental model**
4221
+ *
4222
+ * - A `Resource` wraps an acquisition `Effect` whose result is kept in a
4223
+ * `ScopedRef`
4224
+ * - Each refresh re-runs acquisition and replaces the stored `Exit`
4225
+ * - Replacing the stored value releases resources associated with the previous
4226
+ * scoped value
4227
+ * - Reading a resource returns the current acquired value or fails with the
4228
+ * current acquisition error
4229
+ *
4230
+ * **Common tasks**
4231
+ *
4232
+ * - Create a manually refreshed resource with {@link manual}
4233
+ * - Create a schedule-driven resource with {@link auto}
4234
+ * - Read the current value with {@link get}
4235
+ * - Force a reload with {@link refresh}
4236
+ * - Check whether an unknown value is a resource with {@link isResource}
4237
+ *
4238
+ * **Gotchas**
4239
+ *
4240
+ * - Creating a resource requires a `Scope`; when the scope closes, scoped
4241
+ * values held by the resource are released
4242
+ * - Failed acquisitions are stored too, so subsequent {@link get} calls fail
4243
+ * until a refresh succeeds
4244
+ * - Automatic refreshes run in the resource scope and stop when that scope is
4245
+ * closed
4246
+ *
3142
4247
  * @since 2.0.0
3143
4248
  */
3144
4249
  export * as Resource from "./Resource.ts";
@@ -3276,6 +4381,25 @@ export * as Runtime from "./Runtime.ts";
3276
4381
  */
3277
4382
  export * as Schedule from "./Schedule.ts";
3278
4383
  /**
4384
+ * The `Scheduler` module defines the runtime scheduling services used by
4385
+ * Effect fibers. A scheduler decides how runnable tasks are enqueued, when they
4386
+ * are dispatched, and whether a fiber should yield after consuming its
4387
+ * operation budget.
4388
+ *
4389
+ * **Common tasks**
4390
+ *
4391
+ * - Use {@link Scheduler} to provide a custom runtime scheduler
4392
+ * - Use {@link MixedScheduler} for the default priority-aware scheduler
4393
+ * - Use {@link MaxOpsBeforeYield} to tune fairness for CPU-bound fibers
4394
+ * - Use {@link PreventSchedulerYield} only when a runtime should bypass yield checks
4395
+ *
4396
+ * **Gotchas**
4397
+ *
4398
+ * - Scheduler priorities affect the order of queued runtime tasks, not the
4399
+ * semantic result of an `Effect`
4400
+ * - Disabling scheduler yields can improve throughput for controlled workloads,
4401
+ * but it can also let long-running fibers monopolize the JavaScript thread
4402
+ *
3279
4403
  * @since 2.0.0
3280
4404
  */
3281
4405
  export * as Scheduler from "./Scheduler.ts";
@@ -3610,6 +4734,25 @@ export * as SchemaGetter from "./SchemaGetter.ts";
3610
4734
  */
3611
4735
  export * as SchemaIssue from "./SchemaIssue.ts";
3612
4736
  /**
4737
+ * The `SchemaParser` module turns schemas into reusable runtime operations for
4738
+ * constructing, validating, decoding, and encoding values. It is the execution
4739
+ * layer behind a schema's AST: parsers walk the schema structure, apply
4740
+ * transformations, honor parse options, run checks, and report failures as
4741
+ * `SchemaIssue.Issue` values.
4742
+ *
4743
+ * Use this module when you need a parser with a specific result shape:
4744
+ * `Effect` for effectful parsing and service requirements, `Promise` for
4745
+ * JavaScript interop, `Exit` or `Result` when failures should stay in data,
4746
+ * `Option` for yes/no validation, and synchronous helpers when throwing is the
4747
+ * desired boundary.
4748
+ *
4749
+ * Decoding reads from the encoded/input side of a schema into its decoded
4750
+ * `Type`, while encoding runs the schema in the opposite direction. The
4751
+ * `make*` helpers construct decoded values and apply constructor defaults before
4752
+ * validation. Parse options supplied when a parser is created are merged with
4753
+ * options supplied at call time, and schema-level parse annotations can further
4754
+ * refine behavior.
4755
+ *
3613
4756
  * @since 4.0.0
3614
4757
  */
3615
4758
  export * as SchemaParser from "./SchemaParser.ts";
@@ -3790,6 +4933,22 @@ export * as SchemaRepresentation from "./SchemaRepresentation.ts";
3790
4933
  */
3791
4934
  export * as SchemaTransformation from "./SchemaTransformation.ts";
3792
4935
  /**
4936
+ * The `SchemaUtils` module contains focused helpers for schema patterns that
4937
+ * are useful but too specialized for the core `Schema` API surface.
4938
+ *
4939
+ * Use this module when you need to describe a native class with a schema while
4940
+ * keeping a plain struct as its encoded representation. This is especially
4941
+ * useful for classes such as `Data.Error` subclasses that should decode from
4942
+ * structured data, encode back to that data, and still preserve class identity
4943
+ * for instance checks and schema optics.
4944
+ *
4945
+ * **Gotchas**
4946
+ *
4947
+ * - The constructor is called with the decoded struct fields as a single
4948
+ * argument, so the class constructor must accept that shape.
4949
+ * - Encoding uses the instance itself as the encoded shape, so the instance
4950
+ * should expose properties compatible with the provided struct schema.
4951
+ *
3793
4952
  * @since 4.0.0
3794
4953
  */
3795
4954
  export * as SchemaUtils from "./SchemaUtils.ts";
@@ -3810,26 +4969,173 @@ export * as SchemaUtils from "./SchemaUtils.ts";
3810
4969
  */
3811
4970
  export * as Scope from "./Scope.ts";
3812
4971
  /**
4972
+ * The `ScopedCache` module provides a cache for values that acquire scoped
4973
+ * resources during lookup. Each cached entry owns a `Scope`, so resources
4974
+ * created while computing a value stay alive for as long as that entry remains
4975
+ * cached and are released when the entry is removed.
4976
+ *
4977
+ * A `ScopedCache` is itself created inside a scope. Calls to {@link get} run the
4978
+ * lookup effect on cache misses, share the same in-flight lookup among
4979
+ * concurrent callers for the same key, and store the resulting exit according
4980
+ * to a time-to-live policy. Entries can be inserted manually with {@link set},
4981
+ * refreshed with {@link refresh}, inspected without triggering lookup with
4982
+ * {@link getOption}, and removed with {@link invalidate} or
4983
+ * {@link invalidateAll}. Capacity limits evict the oldest entries.
4984
+ *
4985
+ * **Lifecycle notes**
4986
+ *
4987
+ * - Entry scopes are closed when entries expire, are invalidated, are evicted,
4988
+ * are replaced, or when the cache's owning scope closes
4989
+ * - Successful and failed lookup exits are both cached according to the
4990
+ * configured TTL
4991
+ * - Expired entries may remain counted by {@link size} until a cache operation
4992
+ * observes and removes them
4993
+ * - Once the owning scope closes, the cache is closed and lookup-style
4994
+ * operations interrupt instead of acquiring new values
4995
+ *
3813
4996
  * @since 4.0.0
3814
4997
  */
3815
4998
  export * as ScopedCache from "./ScopedCache.ts";
3816
4999
  /**
5000
+ * The `ScopedRef` module provides a mutable reference for values that are tied
5001
+ * to scoped resources. Each value stored in a `ScopedRef` is acquired within its
5002
+ * own `Scope`, and replacing the value safely releases the resources associated
5003
+ * with the previous value.
5004
+ *
5005
+ * Use `ScopedRef` when an application needs to keep a current resource-backed
5006
+ * value, such as a live client, connection, subscription, or cached handle, and
5007
+ * later swap it for a newly acquired value without leaking the old resources.
5008
+ * Reads are simple, while updates are synchronized and resource-safe.
5009
+ *
5010
+ * **Gotchas**
5011
+ *
5012
+ * - A `ScopedRef` must itself be created and used within a `Scope`; when that
5013
+ * scope closes, the currently stored value is finalized.
5014
+ * - Use {@link fromAcquire} or {@link set} for resourceful values so acquisition
5015
+ * and finalization are tracked correctly.
5016
+ * - Use {@link make} only for values that do not acquire resources.
5017
+ * - Updating a `ScopedRef` waits for the replacement acquisition and old
5018
+ * finalization to complete before returning.
5019
+ *
3817
5020
  * @since 2.0.0
3818
5021
  */
3819
5022
  export * as ScopedRef from "./ScopedRef.ts";
3820
5023
  /**
3821
- * @since 2.0.0
5024
+ * The `Semaphore` module provides a counting semaphore for coordinating
5025
+ * concurrent access to shared or limited resources. A semaphore tracks a fixed
5026
+ * number of permits: effects acquire permits before entering a critical section
5027
+ * and release them when they leave.
5028
+ *
5029
+ * Use semaphores to bound parallel work, protect rate-limited services, or
5030
+ * serialize access to resources that cannot safely handle unlimited
5031
+ * concurrency. Prefer {@link withPermit} and {@link withPermits} when possible,
5032
+ * because they release permits automatically when the protected effect exits.
5033
+ * Use {@link take} and {@link release} for lower-level protocols that need
5034
+ * manual control.
5035
+ *
5036
+ * **Gotchas**
5037
+ *
5038
+ * - Pending acquisitions wait until enough permits are available.
5039
+ * - {@link withPermitsIfAvailable} does not wait; it returns `Option.none` when
5040
+ * the requested permits cannot be acquired immediately.
5041
+ * - Manual `take` / `release` usage must keep permit counts balanced.
5042
+ *
5043
+ * @since 4.0.0
3822
5044
  */
3823
5045
  export * as Semaphore from "./Semaphore.ts";
3824
5046
  /**
5047
+ * The `Sink` module provides composable consumers for `Stream` values. A
5048
+ * `Sink<A, In, L, E, R>` pulls input elements of type `In`, may require
5049
+ * services `R`, may fail with `E`, and eventually produces a result `A` plus
5050
+ * any leftover input `L` that was read but not consumed.
5051
+ *
5052
+ * **Mental model**
5053
+ *
5054
+ * - A sink is the terminal consumer used by `Stream.run`
5055
+ * - Sinks can consume zero, one, many, or all input elements before finishing
5056
+ * - Leftovers allow one sink to stop early without losing already-pulled input
5057
+ * - Sink composition preserves typed errors and service requirements
5058
+ * - Most sinks are built from `Channel` internally, but users compose them with
5059
+ * the higher-level APIs in this module
5060
+ *
5061
+ * **Common tasks**
5062
+ *
5063
+ * - Create simple sinks: {@link succeed}, {@link fail}, {@link fromEffect}
5064
+ * - Fold input: {@link fold}
5065
+ * - Collect values: {@link collect}
5066
+ * - Count or drain input: {@link count}, {@link drain}
5067
+ * - Transform results: {@link map}, {@link mapEffect}, {@link as}
5068
+ * - Adapt input before consumption: {@link mapInput}, {@link mapInputEffect}
5069
+ *
5070
+ * **Gotchas**
5071
+ *
5072
+ * - A sink can finish before the stream is exhausted; check leftover-aware
5073
+ * combinators when composing parsers or protocol decoders
5074
+ * - `In` is contravariant, so a sink that accepts broader input can be used
5075
+ * where narrower input is expected
5076
+ * - Resource and service requirements are tracked in the `R` type parameter
5077
+ *
3825
5078
  * @since 2.0.0
3826
5079
  */
3827
5080
  export * as Sink from "./Sink.ts";
3828
5081
  /**
5082
+ * The `Stdio` module defines the service interface used by Effect programs to
5083
+ * interact with process standard I/O. It models command-line arguments,
5084
+ * standard output, standard error, and standard input as Effects, Sinks, and
5085
+ * Streams so programs can depend on console I/O through `Context` instead of
5086
+ * directly coupling to a specific runtime.
5087
+ *
5088
+ * Use this module when building command-line programs, tests, or platform
5089
+ * integrations that need to read bytes from stdin, write text or bytes to
5090
+ * stdout/stderr, or provide deterministic replacements for those capabilities.
5091
+ * The `layerTest` helper is useful for tests because it supplies inert defaults
5092
+ * and lets individual fields be overridden.
5093
+ *
5094
+ * Standard I/O operations are platform capabilities and may fail with
5095
+ * `PlatformError`; handle those failures in the Effect error channel rather than
5096
+ * assuming writes or reads are infallible.
5097
+ *
3829
5098
  * @since 4.0.0
3830
5099
  */
3831
5100
  export * as Stdio from "./Stdio.ts";
3832
5101
  /**
5102
+ * The `Stream` module provides a typed, composable way to describe effectful
5103
+ * sequences of values. A `Stream<A, E, R>` can emit zero or more `A` values,
5104
+ * fail with an `E`, and require services from `R` while preserving
5105
+ * backpressure and resource safety.
5106
+ *
5107
+ * **Mental model**
5108
+ *
5109
+ * - A stream is a lazy description; it runs only when consumed with a `run*` function
5110
+ * - Streams are pull-based and emit chunks internally for efficient throughput
5111
+ * - `A` is the element type, `E` is the failure type, and `R` is the required context
5112
+ * - Stream composition mirrors `Effect`: use `map`, `flatMap`, error handling, and `pipe`
5113
+ * - Resource scopes, interruption, and finalizers are tracked by the Effect runtime
5114
+ * - Interop functions connect streams to queues, pub/subs, web streams, async iterables, and channels
5115
+ *
5116
+ * **Common tasks**
5117
+ *
5118
+ * - Create streams: {@link make}, {@link fromIterable}, {@link fromEffect}, {@link fromQueue}
5119
+ * - Transform values: {@link map}, {@link mapEffect}, {@link flatMap}, {@link filter}
5120
+ * - Combine streams: {@link concat}, {@link merge}, {@link zip}, {@link race}
5121
+ * - Control demand and timing: {@link take}, {@link drop}, {@link debounce}, {@link throttle}
5122
+ * - Manage errors: {@link catchCause}, {@link catchIf}, {@link mapError}, {@link retry}
5123
+ * - Manage resources and services: {@link scoped}, {@link ensuring}, {@link provide}
5124
+ * - Consume streams: {@link runCollect}, {@link runForEach}, {@link runFold}, {@link runDrain}
5125
+ *
5126
+ * **Gotchas**
5127
+ *
5128
+ * - A stream is not a collection; constructors and operators build a description until it is run
5129
+ * - Re-running a stream re-executes its effects unless it is explicitly shared or backed by external state
5130
+ * - Operators such as {@link merge}, {@link race}, and {@link broadcast} introduce concurrency and interruption semantics
5131
+ * - Prefer bounded constructors and sinks for large or infinite streams instead of collecting everything into memory
5132
+ *
5133
+ * **See also**
5134
+ *
5135
+ * - {@link Effect.Effect} for single-result effectful programs
5136
+ * - {@link Sink.Sink} for consuming and folding streams
5137
+ * - {@link Channel.Channel} for the lower-level primitive underlying streams
5138
+ *
3833
5139
  * @since 2.0.0
3834
5140
  */
3835
5141
  export * as Stream from "./Stream.ts";
@@ -3917,26 +5223,142 @@ export * as String from "./String.ts";
3917
5223
  */
3918
5224
  export * as Struct from "./Struct.ts";
3919
5225
  /**
5226
+ * The `SubscriptionRef` module provides a mutable reference that can be read
5227
+ * and updated like a `Ref`, while also exposing a stream of its current value
5228
+ * and every subsequent change. It is useful when one part of an application
5229
+ * owns evolving state and many fibers need to subscribe to consistent updates,
5230
+ * such as configuration, coordination state, cached snapshots, or UI models.
5231
+ *
5232
+ * Updates are serialized with an internal semaphore and each update is
5233
+ * published to subscribers. The {@link changes} stream replays the latest value
5234
+ * first, then emits future updates, so new subscribers can start from the
5235
+ * current state without performing a separate read. Prefer the effectful
5236
+ * getters and update operations for concurrent code; the unsafe helpers bypass
5237
+ * synchronization and should only be used when the caller already controls
5238
+ * access.
5239
+ *
3920
5240
  * @since 2.0.0
3921
5241
  */
3922
5242
  export * as SubscriptionRef from "./SubscriptionRef.ts";
3923
5243
  /**
5244
+ * The `Symbol` module provides a small runtime guard for working with
5245
+ * JavaScript `symbol` values. Use {@link isSymbol} when validating unknown
5246
+ * input, narrowing union types, or building predicates that need to recognize
5247
+ * primitive symbols such as those created by `Symbol()` or `Symbol.for`.
5248
+ *
5249
+ * The guard checks for the primitive `symbol` type; boxed objects created with
5250
+ * `Object(Symbol())` are objects and do not satisfy this predicate.
5251
+ *
3924
5252
  * @since 2.0.0
3925
5253
  */
3926
5254
  export * as Symbol from "./Symbol.ts";
3927
5255
  /**
5256
+ * The `SynchronizedRef` module provides mutable references whose updates are
5257
+ * serialized, including updates that run effects before deciding the next
5258
+ * value. A `SynchronizedRef<A>` behaves like a `Ref<A>` for reading and basic
5259
+ * updates, but uses an internal semaphore so concurrent modifications observe a
5260
+ * consistent current value and apply one at a time.
5261
+ *
5262
+ * **When to use**
5263
+ *
5264
+ * - Coordinating shared state that may be updated by many fibers
5265
+ * - Running effectful state transitions that must not overlap
5266
+ * - Computing both a return value and a new stored value atomically
5267
+ * - Applying partial updates with `Option`, where `None` leaves the value
5268
+ * unchanged
5269
+ *
5270
+ * **Gotchas**
5271
+ *
5272
+ * - Effectful update functions run while the semaphore is held, so long-running
5273
+ * effects delay other updates to the same ref
5274
+ * - Failed effectful updates do not replace the stored value
5275
+ * - `getUnsafe` and `makeUnsafe` bypass the `Effect` API and should be reserved
5276
+ * for low-level or carefully controlled code
5277
+ *
3928
5278
  * @since 2.0.0
3929
5279
  */
3930
5280
  export * as SynchronizedRef from "./SynchronizedRef.ts";
3931
5281
  /**
5282
+ * The `Take` module provides the representation used by stream-like producers
5283
+ * to describe a single pull result. A `Take<A, E, Done>` is either a
5284
+ * non-empty batch of emitted values, a failed `Exit`, or a successful `Exit`
5285
+ * carrying the stream's completion value.
5286
+ *
5287
+ * `Take` is useful at boundaries where pull results need to be stored,
5288
+ * transferred, or interpreted later while preserving the distinction between
5289
+ * emitted elements, failures, and normal completion. Use {@link toPull} to turn
5290
+ * a `Take` back into a `Pull`: value batches become successful pulls, failure
5291
+ * exits are propagated, and successful exits signal completion with `Done`.
5292
+ *
5293
+ * **Gotchas**
5294
+ *
5295
+ * - A value batch is always represented by a `NonEmptyReadonlyArray`; empty
5296
+ * batches are not valid `Take` values.
5297
+ * - Successful `Exit` values do not emit elements. They represent pull
5298
+ * completion and carry the `Done` value.
5299
+ *
3932
5300
  * @since 2.0.0
3933
5301
  */
3934
5302
  export * as Take from "./Take.ts";
3935
5303
  /**
5304
+ * The `Terminal` module defines the service interface used by platform
5305
+ * integrations to model command-line input and output. It gives programs a
5306
+ * uniform way to query terminal dimensions, read lines, stream low-level key
5307
+ * events, and write text without depending directly on Node, the browser, or a
5308
+ * test-specific console implementation.
5309
+ *
5310
+ * Use this module when building interactive command-line tools, prompts, or
5311
+ * platform abstractions that need terminal capabilities as an Effect service.
5312
+ * Implementations are supplied through context, so application code can depend
5313
+ * on `Terminal` while tests and runtimes provide the concrete behavior.
5314
+ *
5315
+ * `readLine` can fail with {@link QuitError} when the user requests to quit,
5316
+ * commonly via `Ctrl+C`. For lower-level interaction, `readInput` returns a
5317
+ * scoped stream of {@link UserInput} values containing parsed key metadata and
5318
+ * any raw character input.
5319
+ *
3936
5320
  * @since 4.0.0
3937
5321
  */
3938
5322
  export * as Terminal from "./Terminal.ts";
3939
5323
  /**
5324
+ * The `Tracer` module defines the low-level tracing model used by Effect to
5325
+ * describe and propagate spans. A span records the lifetime of an operation,
5326
+ * including its name, parent, attributes, links, annotations, sampling decision,
5327
+ * kind, and completion status.
5328
+ *
5329
+ * **Mental model**
5330
+ *
5331
+ * - `Tracer` is the backend interface responsible for creating spans
5332
+ * - `Span` values represent Effect-managed operations with mutable lifecycle
5333
+ * hooks for ending spans and adding attributes, events, or links
5334
+ * - `ExternalSpan` represents trace context imported from another tracing
5335
+ * system so Effect spans can be parented by or linked to external work
5336
+ * - `ParentSpan`, `Tracer`, and related context references control propagation,
5337
+ * sampling, and trace-level filtering through the Effect context
5338
+ *
5339
+ * **Common tasks**
5340
+ *
5341
+ * - Implement a custom tracing backend with {@link make}
5342
+ * - Provide or inspect parent span context with {@link ParentSpan}
5343
+ * - Convert external trace identifiers into Effect span values with
5344
+ * {@link externalSpan}
5345
+ * - Configure span metadata with {@link SpanOptions}, {@link SpanKind}, and
5346
+ * {@link SpanLink}
5347
+ * - Disable propagation or adjust trace filtering with
5348
+ * {@link DisablePropagation}, {@link CurrentTraceLevel}, and
5349
+ * {@link MinimumTraceLevel}
5350
+ *
5351
+ * **Gotchas**
5352
+ *
5353
+ * - This module exposes the tracing data model and backend hooks; most
5354
+ * application code should create spans through higher-level Effect APIs such
5355
+ * as `Effect.withSpan`
5356
+ * - `ExternalSpan` only carries identity and metadata from another system; it
5357
+ * does not have lifecycle methods like `Span`
5358
+ * - Propagation and sampling are context-dependent, so parent selection can be
5359
+ * affected by disabled propagation, root span options, and trace-level
5360
+ * thresholds
5361
+ *
3940
5362
  * @since 2.0.0
3941
5363
  */
3942
5364
  export * as Tracer from "./Tracer.ts";
@@ -4050,10 +5472,55 @@ export * as TxChunk from "./TxChunk.ts";
4050
5472
  */
4051
5473
  export * as TxDeferred from "./TxDeferred.ts";
4052
5474
  /**
5475
+ * The `TxHashMap` module provides a transactional hash map for storing and
5476
+ * updating key-value pairs inside Effect transactions. It is useful when
5477
+ * multiple fibers need to coordinate shared map state and each read-modify-write
5478
+ * sequence must be committed atomically.
5479
+ *
5480
+ * A `TxHashMap<K, V>` has the familiar shape of a `HashMap<K, V>`, but every
5481
+ * operation returns an `Effect` and participates in transaction semantics
5482
+ * through `TxRef`. Use it for concurrent registries, caches, counters, indexes,
5483
+ * and other mutable maps whose updates should compose safely with other
5484
+ * transactional references.
5485
+ *
5486
+ * **Common tasks**
5487
+ *
5488
+ * - Create maps with {@link empty}, {@link fromIterable}, or {@link make}
5489
+ * - Read entries with {@link get}, {@link has}, {@link keys}, {@link values}, and {@link entries}
5490
+ * - Update entries with {@link set}, {@link modify}, {@link modifyAt}, and {@link remove}
5491
+ * - Inspect aggregate state with {@link size}, {@link isEmpty}, and {@link reduce}
5492
+ *
5493
+ * **Gotchas**
5494
+ *
5495
+ * - Operations are effectful; run them in `Effect.gen` and wrap multi-step
5496
+ * transactions with `Effect.tx` when the whole sequence must commit together.
5497
+ * - Reads that may be absent return `Option`, so handle both `Some` and `None`
5498
+ * instead of assuming a key exists.
5499
+ *
4053
5500
  * @since 2.0.0
4054
5501
  */
4055
5502
  export * as TxHashMap from "./TxHashMap.ts";
4056
5503
  /**
5504
+ * The `TxHashSet` module provides a transactional hash set for storing unique
5505
+ * values inside Effect transactions. A `TxHashSet<A>` wraps a `HashSet<A>` in a
5506
+ * transactional reference, so reads and writes can be composed with other
5507
+ * transactional operations and committed atomically.
5508
+ *
5509
+ * **Common tasks**
5510
+ *
5511
+ * - Create transactional sets with {@link empty}, {@link make}, or {@link fromIterable}
5512
+ * - Mutate an existing set with {@link add}, {@link remove}, and {@link clear}
5513
+ * - Query membership and size with {@link has}, {@link size}, and {@link isEmpty}
5514
+ * - Derive new sets with {@link map}, {@link filter}, {@link union}, {@link intersection}, and {@link difference}
5515
+ * - Fold or collect values with {@link reduce} and {@link toHashSet}
5516
+ *
5517
+ * **Gotchas**
5518
+ *
5519
+ * - Mutation operations update the same transactional set; transform operations
5520
+ * return a new `TxHashSet`
5521
+ * - Operations are `Effect` values and must be yielded, piped, or run to take effect
5522
+ * - Use `Effect.tx` when several operations must observe and commit one atomic transaction
5523
+ *
4057
5524
  * @since 2.0.0
4058
5525
  */
4059
5526
  export * as TxHashSet from "./TxHashSet.ts";
@@ -4107,6 +5574,24 @@ export * as TxReentrantLock from "./TxReentrantLock.ts";
4107
5574
  */
4108
5575
  export * as TxRef from "./TxRef.ts";
4109
5576
  /**
5577
+ * The `TxSemaphore` module provides a transactional semaphore for coordinating
5578
+ * access to limited resources from within Effect transactions. A semaphore
5579
+ * tracks a fixed number of permits, and transactional operations can acquire,
5580
+ * release, or inspect those permits atomically with other transactional state.
5581
+ *
5582
+ * Use `TxSemaphore` when permit accounting needs to compose with `TxRef` and
5583
+ * other transactional updates, such as guarding resource pools, rate-limited
5584
+ * sections, or workflows that must reserve capacity consistently before
5585
+ * committing related state changes.
5586
+ *
5587
+ * **Gotchas**
5588
+ *
5589
+ * - Permit operations are intended for transactional workflows and are wrapped
5590
+ * with `Effect.tx`.
5591
+ * - The semaphore capacity is fixed at construction time; releasing more
5592
+ * permits than the original capacity fails.
5593
+ * - Creating a semaphore with a negative number of permits defects.
5594
+ *
4110
5595
  * @since 4.0.0
4111
5596
  */
4112
5597
  export * as TxSemaphore from "./TxSemaphore.ts";
@@ -4203,6 +5688,19 @@ export * as Types from "./Types.ts";
4203
5688
  */
4204
5689
  export * as UndefinedOr from "./UndefinedOr.ts";
4205
5690
  /**
5691
+ * The `Unify` module contains the type-level protocol Effect uses to normalize
5692
+ * unions of data types that opt in to unification. It is primarily a library
5693
+ * authoring tool: data types expose hidden symbol properties describing how
5694
+ * their variants should be widened, and {@link Unify} turns those protocol
5695
+ * entries into the user-facing union type that TypeScript should infer.
5696
+ *
5697
+ * Most application code does not need to interact with these symbols directly.
5698
+ * The main runtime helper, {@link unify}, is an identity function that preserves
5699
+ * values and functions at runtime while applying {@link Unify} to the relevant
5700
+ * static type. This is useful when authoring APIs that return branded or
5701
+ * protocol-enabled values and need inference to collapse to the public Effect
5702
+ * data type rather than exposing implementation details.
5703
+ *
4206
5704
  * @since 2.0.0
4207
5705
  */
4208
5706
  export * as Unify from "./Unify.ts";