effect 4.0.0-beta.5 → 4.0.0-beta.51

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 (1512) hide show
  1. package/dist/Array.d.ts +213 -385
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +149 -102
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +82 -45
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +105 -52
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +39 -32
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +36 -33
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Brand.d.ts +3 -5
  14. package/dist/Brand.d.ts.map +1 -1
  15. package/dist/Brand.js +1 -1
  16. package/dist/Brand.js.map +1 -1
  17. package/dist/Cache.d.ts +14 -45
  18. package/dist/Cache.d.ts.map +1 -1
  19. package/dist/Cache.js +21 -47
  20. package/dist/Cache.js.map +1 -1
  21. package/dist/Cause.d.ts +54 -23
  22. package/dist/Cause.d.ts.map +1 -1
  23. package/dist/Cause.js +108 -10
  24. package/dist/Cause.js.map +1 -1
  25. package/dist/Channel.d.ts +166 -48
  26. package/dist/Channel.d.ts.map +1 -1
  27. package/dist/Channel.js +182 -91
  28. package/dist/Channel.js.map +1 -1
  29. package/dist/Chunk.d.ts +112 -304
  30. package/dist/Chunk.d.ts.map +1 -1
  31. package/dist/Chunk.js +56 -88
  32. package/dist/Chunk.js.map +1 -1
  33. package/dist/Clock.d.ts +2 -2
  34. package/dist/Clock.d.ts.map +1 -1
  35. package/dist/Clock.js.map +1 -1
  36. package/dist/Combiner.d.ts +280 -13
  37. package/dist/Combiner.d.ts.map +1 -1
  38. package/dist/Combiner.js +198 -7
  39. package/dist/Combiner.js.map +1 -1
  40. package/dist/Config.d.ts +171 -11
  41. package/dist/Config.d.ts.map +1 -1
  42. package/dist/Config.js +69 -11
  43. package/dist/Config.js.map +1 -1
  44. package/dist/ConfigProvider.d.ts +6 -6
  45. package/dist/ConfigProvider.d.ts.map +1 -1
  46. package/dist/ConfigProvider.js +5 -5
  47. package/dist/ConfigProvider.js.map +1 -1
  48. package/dist/Console.d.ts +2 -2
  49. package/dist/Console.d.ts.map +1 -1
  50. package/dist/Console.js.map +1 -1
  51. package/dist/Context.d.ts +1150 -0
  52. package/dist/Context.d.ts.map +1 -0
  53. package/dist/{ServiceMap.js → Context.js} +181 -165
  54. package/dist/Context.js.map +1 -0
  55. package/dist/Cron.d.ts +11 -7
  56. package/dist/Cron.d.ts.map +1 -1
  57. package/dist/Cron.js +120 -63
  58. package/dist/Cron.js.map +1 -1
  59. package/dist/Data.d.ts +535 -366
  60. package/dist/Data.d.ts.map +1 -1
  61. package/dist/Data.js +132 -79
  62. package/dist/Data.js.map +1 -1
  63. package/dist/DateTime.d.ts +74 -255
  64. package/dist/DateTime.d.ts.map +1 -1
  65. package/dist/DateTime.js +17 -62
  66. package/dist/DateTime.js.map +1 -1
  67. package/dist/Deferred.d.ts +12 -5
  68. package/dist/Deferred.d.ts.map +1 -1
  69. package/dist/Deferred.js +13 -5
  70. package/dist/Deferred.js.map +1 -1
  71. package/dist/Duration.d.ts +62 -32
  72. package/dist/Duration.d.ts.map +1 -1
  73. package/dist/Duration.js +109 -79
  74. package/dist/Duration.js.map +1 -1
  75. package/dist/Effect.d.ts +1377 -1147
  76. package/dist/Effect.d.ts.map +1 -1
  77. package/dist/Effect.js +465 -446
  78. package/dist/Effect.js.map +1 -1
  79. package/dist/Encoding.d.ts +194 -0
  80. package/dist/Encoding.d.ts.map +1 -0
  81. package/dist/Encoding.js +352 -0
  82. package/dist/Encoding.js.map +1 -0
  83. package/dist/Equal.d.ts +276 -109
  84. package/dist/Equal.d.ts.map +1 -1
  85. package/dist/Equal.js +140 -48
  86. package/dist/Equal.js.map +1 -1
  87. package/dist/Equivalence.d.ts +60 -3
  88. package/dist/Equivalence.d.ts.map +1 -1
  89. package/dist/Equivalence.js +70 -13
  90. package/dist/Equivalence.js.map +1 -1
  91. package/dist/ErrorReporter.d.ts +374 -0
  92. package/dist/ErrorReporter.d.ts.map +1 -0
  93. package/dist/ErrorReporter.js +245 -0
  94. package/dist/ErrorReporter.js.map +1 -0
  95. package/dist/ExecutionPlan.d.ts +6 -6
  96. package/dist/ExecutionPlan.d.ts.map +1 -1
  97. package/dist/ExecutionPlan.js +4 -4
  98. package/dist/ExecutionPlan.js.map +1 -1
  99. package/dist/Exit.d.ts +24 -12
  100. package/dist/Exit.d.ts.map +1 -1
  101. package/dist/Exit.js +8 -4
  102. package/dist/Exit.js.map +1 -1
  103. package/dist/Fiber.d.ts +10 -8
  104. package/dist/Fiber.d.ts.map +1 -1
  105. package/dist/Fiber.js.map +1 -1
  106. package/dist/FiberHandle.d.ts +11 -10
  107. package/dist/FiberHandle.d.ts.map +1 -1
  108. package/dist/FiberHandle.js +12 -11
  109. package/dist/FiberHandle.js.map +1 -1
  110. package/dist/FiberMap.d.ts +22 -21
  111. package/dist/FiberMap.d.ts.map +1 -1
  112. package/dist/FiberMap.js +10 -10
  113. package/dist/FiberMap.js.map +1 -1
  114. package/dist/FiberSet.d.ts +2 -2
  115. package/dist/FiberSet.d.ts.map +1 -1
  116. package/dist/FiberSet.js +4 -4
  117. package/dist/FiberSet.js.map +1 -1
  118. package/dist/FileSystem.d.ts +20 -19
  119. package/dist/FileSystem.d.ts.map +1 -1
  120. package/dist/FileSystem.js +17 -13
  121. package/dist/FileSystem.js.map +1 -1
  122. package/dist/Filter.d.ts +4 -37
  123. package/dist/Filter.d.ts.map +1 -1
  124. package/dist/Filter.js +0 -13
  125. package/dist/Filter.js.map +1 -1
  126. package/dist/Formatter.d.ts +131 -47
  127. package/dist/Formatter.d.ts.map +1 -1
  128. package/dist/Formatter.js +229 -51
  129. package/dist/Formatter.js.map +1 -1
  130. package/dist/Function.d.ts +1 -9
  131. package/dist/Function.d.ts.map +1 -1
  132. package/dist/Function.js +2 -10
  133. package/dist/Function.js.map +1 -1
  134. package/dist/Graph.d.ts +65 -65
  135. package/dist/Graph.d.ts.map +1 -1
  136. package/dist/Graph.js +60 -62
  137. package/dist/Graph.js.map +1 -1
  138. package/dist/Hash.js +1 -1
  139. package/dist/Hash.js.map +1 -1
  140. package/dist/HashMap.d.ts +26 -19
  141. package/dist/HashMap.d.ts.map +1 -1
  142. package/dist/HashMap.js +7 -5
  143. package/dist/HashMap.js.map +1 -1
  144. package/dist/Iterable.d.ts +50 -50
  145. package/dist/Iterable.d.ts.map +1 -1
  146. package/dist/Iterable.js +106 -34
  147. package/dist/Iterable.js.map +1 -1
  148. package/dist/JsonSchema.d.ts +299 -10
  149. package/dist/JsonSchema.d.ts.map +1 -1
  150. package/dist/JsonSchema.js +323 -4
  151. package/dist/JsonSchema.js.map +1 -1
  152. package/dist/Latch.d.ts +175 -0
  153. package/dist/Latch.d.ts.map +1 -0
  154. package/dist/Latch.js +130 -0
  155. package/dist/Latch.js.map +1 -0
  156. package/dist/Layer.d.ts +599 -379
  157. package/dist/Layer.d.ts.map +1 -1
  158. package/dist/Layer.js +249 -180
  159. package/dist/Layer.js.map +1 -1
  160. package/dist/LayerMap.d.ts +27 -26
  161. package/dist/LayerMap.d.ts.map +1 -1
  162. package/dist/LayerMap.js +21 -18
  163. package/dist/LayerMap.js.map +1 -1
  164. package/dist/LogLevel.d.ts +32 -0
  165. package/dist/LogLevel.d.ts.map +1 -1
  166. package/dist/LogLevel.js +28 -100
  167. package/dist/LogLevel.js.map +1 -1
  168. package/dist/Logger.d.ts +31 -97
  169. package/dist/Logger.d.ts.map +1 -1
  170. package/dist/Logger.js +2 -3
  171. package/dist/Logger.js.map +1 -1
  172. package/dist/ManagedRuntime.d.ts +8 -8
  173. package/dist/ManagedRuntime.d.ts.map +1 -1
  174. package/dist/ManagedRuntime.js +34 -25
  175. package/dist/ManagedRuntime.js.map +1 -1
  176. package/dist/Metric.d.ts +23 -25
  177. package/dist/Metric.d.ts.map +1 -1
  178. package/dist/Metric.js +24 -26
  179. package/dist/Metric.js.map +1 -1
  180. package/dist/MutableHashMap.d.ts +7 -0
  181. package/dist/MutableHashMap.d.ts.map +1 -1
  182. package/dist/MutableHashMap.js +8 -0
  183. package/dist/MutableHashMap.js.map +1 -1
  184. package/dist/MutableHashSet.d.ts +7 -0
  185. package/dist/MutableHashSet.d.ts.map +1 -1
  186. package/dist/MutableHashSet.js +8 -0
  187. package/dist/MutableHashSet.js.map +1 -1
  188. package/dist/MutableList.d.ts.map +1 -1
  189. package/dist/MutableList.js +3 -0
  190. package/dist/MutableList.js.map +1 -1
  191. package/dist/Newtype.d.ts +291 -0
  192. package/dist/Newtype.d.ts.map +1 -0
  193. package/dist/Newtype.js +161 -0
  194. package/dist/Newtype.js.map +1 -0
  195. package/dist/Number.d.ts +74 -18
  196. package/dist/Number.d.ts.map +1 -1
  197. package/dist/Number.js +46 -18
  198. package/dist/Number.js.map +1 -1
  199. package/dist/Optic.d.ts +947 -18
  200. package/dist/Optic.d.ts.map +1 -1
  201. package/dist/Optic.js +454 -5
  202. package/dist/Optic.js.map +1 -1
  203. package/dist/Option.d.ts +25 -16
  204. package/dist/Option.d.ts.map +1 -1
  205. package/dist/Option.js +15 -9
  206. package/dist/Option.js.map +1 -1
  207. package/dist/Order.d.ts +6 -1
  208. package/dist/Order.d.ts.map +1 -1
  209. package/dist/Order.js +19 -14
  210. package/dist/Order.js.map +1 -1
  211. package/dist/PartitionedSemaphore.d.ts +146 -15
  212. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  213. package/dist/PartitionedSemaphore.js +174 -61
  214. package/dist/PartitionedSemaphore.js.map +1 -1
  215. package/dist/Path.d.ts +2 -2
  216. package/dist/Path.d.ts.map +1 -1
  217. package/dist/Path.js +2 -2
  218. package/dist/Path.js.map +1 -1
  219. package/dist/Pipeable.d.ts +17 -0
  220. package/dist/Pipeable.d.ts.map +1 -1
  221. package/dist/Pipeable.js +19 -1
  222. package/dist/Pipeable.js.map +1 -1
  223. package/dist/PlatformError.d.ts +2 -2
  224. package/dist/Pool.d.ts +6 -4
  225. package/dist/Pool.d.ts.map +1 -1
  226. package/dist/Pool.js +11 -9
  227. package/dist/Pool.js.map +1 -1
  228. package/dist/PubSub.d.ts +8 -6
  229. package/dist/PubSub.d.ts.map +1 -1
  230. package/dist/PubSub.js +18 -10
  231. package/dist/PubSub.js.map +1 -1
  232. package/dist/Pull.d.ts.map +1 -1
  233. package/dist/Pull.js +1 -1
  234. package/dist/Pull.js.map +1 -1
  235. package/dist/Queue.d.ts +9 -6
  236. package/dist/Queue.d.ts.map +1 -1
  237. package/dist/Queue.js +7 -5
  238. package/dist/Queue.js.map +1 -1
  239. package/dist/Random.d.ts +36 -2
  240. package/dist/Random.d.ts.map +1 -1
  241. package/dist/Random.js +46 -35
  242. package/dist/Random.js.map +1 -1
  243. package/dist/RcMap.d.ts +4 -4
  244. package/dist/RcMap.d.ts.map +1 -1
  245. package/dist/RcMap.js +13 -13
  246. package/dist/RcMap.js.map +1 -1
  247. package/dist/RcRef.d.ts +1 -1
  248. package/dist/RcRef.d.ts.map +1 -1
  249. package/dist/Record.d.ts +63 -160
  250. package/dist/Record.d.ts.map +1 -1
  251. package/dist/Record.js +37 -56
  252. package/dist/Record.js.map +1 -1
  253. package/dist/Redactable.d.ts +139 -62
  254. package/dist/Redactable.d.ts.map +1 -1
  255. package/dist/Redactable.js +59 -55
  256. package/dist/Redactable.js.map +1 -1
  257. package/dist/Reducer.d.ts +166 -7
  258. package/dist/Reducer.d.ts.map +1 -1
  259. package/dist/Reducer.js +135 -1
  260. package/dist/Reducer.js.map +1 -1
  261. package/dist/References.d.ts +257 -229
  262. package/dist/References.d.ts.map +1 -1
  263. package/dist/References.js +240 -259
  264. package/dist/References.js.map +1 -1
  265. package/dist/Request.d.ts +6 -6
  266. package/dist/Request.d.ts.map +1 -1
  267. package/dist/Request.js +2 -1
  268. package/dist/Request.js.map +1 -1
  269. package/dist/RequestResolver.d.ts +25 -45
  270. package/dist/RequestResolver.d.ts.map +1 -1
  271. package/dist/RequestResolver.js +15 -36
  272. package/dist/RequestResolver.js.map +1 -1
  273. package/dist/Resource.d.ts +0 -3
  274. package/dist/Resource.d.ts.map +1 -1
  275. package/dist/Resource.js +5 -4
  276. package/dist/Resource.js.map +1 -1
  277. package/dist/Result.d.ts +1 -1
  278. package/dist/Result.d.ts.map +1 -1
  279. package/dist/Result.js +1 -2
  280. package/dist/Result.js.map +1 -1
  281. package/dist/Runtime.d.ts +66 -0
  282. package/dist/Runtime.d.ts.map +1 -1
  283. package/dist/Runtime.js +79 -6
  284. package/dist/Runtime.js.map +1 -1
  285. package/dist/Schedule.d.ts +176 -293
  286. package/dist/Schedule.d.ts.map +1 -1
  287. package/dist/Schedule.js +162 -136
  288. package/dist/Schedule.js.map +1 -1
  289. package/dist/Scheduler.d.ts +36 -125
  290. package/dist/Scheduler.d.ts.map +1 -1
  291. package/dist/Scheduler.js +37 -126
  292. package/dist/Scheduler.js.map +1 -1
  293. package/dist/Schema.d.ts +3326 -383
  294. package/dist/Schema.d.ts.map +1 -1
  295. package/dist/Schema.js +2315 -283
  296. package/dist/Schema.js.map +1 -1
  297. package/dist/SchemaAST.d.ts +13 -2
  298. package/dist/SchemaAST.d.ts.map +1 -1
  299. package/dist/SchemaAST.js +340 -257
  300. package/dist/SchemaAST.js.map +1 -1
  301. package/dist/SchemaGetter.d.ts +57 -15
  302. package/dist/SchemaGetter.d.ts.map +1 -1
  303. package/dist/SchemaGetter.js +85 -25
  304. package/dist/SchemaGetter.js.map +1 -1
  305. package/dist/SchemaIssue.d.ts.map +1 -1
  306. package/dist/SchemaIssue.js +29 -11
  307. package/dist/SchemaIssue.js.map +1 -1
  308. package/dist/SchemaParser.d.ts +44 -54
  309. package/dist/SchemaParser.d.ts.map +1 -1
  310. package/dist/SchemaParser.js +69 -4
  311. package/dist/SchemaParser.js.map +1 -1
  312. package/dist/SchemaRepresentation.d.ts +46 -45
  313. package/dist/SchemaRepresentation.d.ts.map +1 -1
  314. package/dist/SchemaRepresentation.js +65 -38
  315. package/dist/SchemaRepresentation.js.map +1 -1
  316. package/dist/SchemaTransformation.d.ts +252 -3
  317. package/dist/SchemaTransformation.d.ts.map +1 -1
  318. package/dist/SchemaTransformation.js +319 -13
  319. package/dist/SchemaTransformation.js.map +1 -1
  320. package/dist/Scope.d.ts +2 -2
  321. package/dist/Scope.d.ts.map +1 -1
  322. package/dist/Scope.js.map +1 -1
  323. package/dist/ScopedCache.d.ts +2 -2
  324. package/dist/ScopedCache.d.ts.map +1 -1
  325. package/dist/ScopedCache.js +5 -5
  326. package/dist/ScopedCache.js.map +1 -1
  327. package/dist/Semaphore.d.ts +307 -0
  328. package/dist/Semaphore.d.ts.map +1 -0
  329. package/dist/Semaphore.js +220 -0
  330. package/dist/Semaphore.js.map +1 -0
  331. package/dist/Sink.d.ts +22 -19
  332. package/dist/Sink.d.ts.map +1 -1
  333. package/dist/Sink.js +54 -7
  334. package/dist/Sink.js.map +1 -1
  335. package/dist/Stdio.d.ts +18 -6
  336. package/dist/Stdio.d.ts.map +1 -1
  337. package/dist/Stdio.js +20 -2
  338. package/dist/Stdio.js.map +1 -1
  339. package/dist/Stream.d.ts +465 -542
  340. package/dist/Stream.d.ts.map +1 -1
  341. package/dist/Stream.js +321 -144
  342. package/dist/Stream.js.map +1 -1
  343. package/dist/String.d.ts +114 -47
  344. package/dist/String.d.ts.map +1 -1
  345. package/dist/String.js +29 -47
  346. package/dist/String.js.map +1 -1
  347. package/dist/Struct.d.ts +23 -7
  348. package/dist/Struct.d.ts.map +1 -1
  349. package/dist/Struct.js +22 -0
  350. package/dist/Struct.js.map +1 -1
  351. package/dist/SubscriptionRef.d.ts +3 -3
  352. package/dist/SubscriptionRef.d.ts.map +1 -1
  353. package/dist/SubscriptionRef.js +85 -117
  354. package/dist/SubscriptionRef.js.map +1 -1
  355. package/dist/SynchronizedRef.d.ts +2 -1
  356. package/dist/SynchronizedRef.d.ts.map +1 -1
  357. package/dist/SynchronizedRef.js +2 -1
  358. package/dist/SynchronizedRef.js.map +1 -1
  359. package/dist/Terminal.d.ts +5 -4
  360. package/dist/Terminal.d.ts.map +1 -1
  361. package/dist/Terminal.js +2 -2
  362. package/dist/Terminal.js.map +1 -1
  363. package/dist/Tracer.d.ts +21 -20
  364. package/dist/Tracer.d.ts.map +1 -1
  365. package/dist/Tracer.js +13 -9
  366. package/dist/Tracer.js.map +1 -1
  367. package/dist/Trie.d.ts +44 -31
  368. package/dist/Trie.d.ts.map +1 -1
  369. package/dist/Trie.js +13 -9
  370. package/dist/Trie.js.map +1 -1
  371. package/dist/TxChunk.d.ts +4 -4
  372. package/dist/TxChunk.d.ts.map +1 -1
  373. package/dist/TxChunk.js +4 -4
  374. package/dist/TxChunk.js.map +1 -1
  375. package/dist/TxDeferred.d.ts +328 -0
  376. package/dist/TxDeferred.d.ts.map +1 -0
  377. package/dist/TxDeferred.js +197 -0
  378. package/dist/TxDeferred.js.map +1 -0
  379. package/dist/TxHashMap.d.ts +105 -86
  380. package/dist/TxHashMap.d.ts.map +1 -1
  381. package/dist/TxHashMap.js +51 -44
  382. package/dist/TxHashMap.js.map +1 -1
  383. package/dist/TxHashSet.d.ts +2 -2
  384. package/dist/TxHashSet.d.ts.map +1 -1
  385. package/dist/TxHashSet.js +16 -15
  386. package/dist/TxHashSet.js.map +1 -1
  387. package/dist/TxPriorityQueue.d.ts +609 -0
  388. package/dist/TxPriorityQueue.d.ts.map +1 -0
  389. package/dist/TxPriorityQueue.js +416 -0
  390. package/dist/TxPriorityQueue.js.map +1 -0
  391. package/dist/TxPubSub.d.ts +585 -0
  392. package/dist/TxPubSub.d.ts.map +1 -0
  393. package/dist/TxPubSub.js +521 -0
  394. package/dist/TxPubSub.js.map +1 -0
  395. package/dist/TxQueue.d.ts +1 -1
  396. package/dist/TxQueue.d.ts.map +1 -1
  397. package/dist/TxQueue.js +42 -57
  398. package/dist/TxQueue.js.map +1 -1
  399. package/dist/TxReentrantLock.d.ts +500 -0
  400. package/dist/TxReentrantLock.d.ts.map +1 -0
  401. package/dist/TxReentrantLock.js +481 -0
  402. package/dist/TxReentrantLock.js.map +1 -0
  403. package/dist/TxRef.d.ts +14 -20
  404. package/dist/TxRef.d.ts.map +1 -1
  405. package/dist/TxRef.js +8 -10
  406. package/dist/TxRef.js.map +1 -1
  407. package/dist/TxSemaphore.d.ts +162 -2
  408. package/dist/TxSemaphore.d.ts.map +1 -1
  409. package/dist/TxSemaphore.js +25 -10
  410. package/dist/TxSemaphore.js.map +1 -1
  411. package/dist/TxSubscriptionRef.d.ts +508 -0
  412. package/dist/TxSubscriptionRef.d.ts.map +1 -0
  413. package/dist/TxSubscriptionRef.js +293 -0
  414. package/dist/TxSubscriptionRef.js.map +1 -0
  415. package/dist/Types.d.ts +83 -17
  416. package/dist/Types.d.ts.map +1 -1
  417. package/dist/Unify.d.ts +8 -2
  418. package/dist/Unify.d.ts.map +1 -1
  419. package/dist/Unify.js.map +1 -1
  420. package/dist/Utils.d.ts +137 -65
  421. package/dist/Utils.d.ts.map +1 -1
  422. package/dist/Utils.js +38 -66
  423. package/dist/Utils.js.map +1 -1
  424. package/dist/index.d.ts +888 -71
  425. package/dist/index.d.ts.map +1 -1
  426. package/dist/index.js +888 -71
  427. package/dist/index.js.map +1 -1
  428. package/dist/internal/core.js +11 -3
  429. package/dist/internal/core.js.map +1 -1
  430. package/dist/internal/dateTime.js +77 -71
  431. package/dist/internal/dateTime.js.map +1 -1
  432. package/dist/internal/effect.js +485 -325
  433. package/dist/internal/effect.js.map +1 -1
  434. package/dist/internal/hashMap.js +7 -5
  435. package/dist/internal/hashMap.js.map +1 -1
  436. package/dist/internal/layer.js +3 -3
  437. package/dist/internal/layer.js.map +1 -1
  438. package/dist/internal/option.js +6 -0
  439. package/dist/internal/option.js.map +1 -1
  440. package/dist/internal/random.d.ts +2 -0
  441. package/dist/internal/random.d.ts.map +1 -0
  442. package/dist/internal/random.js +13 -0
  443. package/dist/internal/random.js.map +1 -0
  444. package/dist/internal/rcRef.js +11 -10
  445. package/dist/internal/rcRef.js.map +1 -1
  446. package/dist/internal/references.d.ts +2 -0
  447. package/dist/internal/references.d.ts.map +1 -0
  448. package/dist/internal/references.js +51 -0
  449. package/dist/internal/references.js.map +1 -0
  450. package/dist/internal/request.js +6 -6
  451. package/dist/internal/request.js.map +1 -1
  452. package/dist/internal/schedule.js +1 -1
  453. package/dist/internal/schedule.js.map +1 -1
  454. package/dist/internal/schema/annotations.js +2 -0
  455. package/dist/internal/schema/annotations.js.map +1 -1
  456. package/dist/internal/schema/representation.js +86 -107
  457. package/dist/internal/schema/representation.js.map +1 -1
  458. package/dist/internal/schema/schema.d.ts +10 -1
  459. package/dist/internal/schema/schema.d.ts.map +1 -1
  460. package/dist/internal/schema/schema.js +22 -1
  461. package/dist/internal/schema/schema.js.map +1 -1
  462. package/dist/internal/schema/to-codec.js +7 -10
  463. package/dist/internal/schema/to-codec.js.map +1 -1
  464. package/dist/internal/trie.js +8 -7
  465. package/dist/internal/trie.js.map +1 -1
  466. package/dist/testing/TestClock.d.ts +8 -7
  467. package/dist/testing/TestClock.d.ts.map +1 -1
  468. package/dist/testing/TestClock.js +6 -4
  469. package/dist/testing/TestClock.js.map +1 -1
  470. package/dist/testing/TestSchema.d.ts +267 -33
  471. package/dist/testing/TestSchema.d.ts.map +1 -1
  472. package/dist/testing/TestSchema.js +296 -23
  473. package/dist/testing/TestSchema.js.map +1 -1
  474. package/dist/testing/index.d.ts +64 -1
  475. package/dist/testing/index.d.ts.map +1 -1
  476. package/dist/testing/index.js +64 -1
  477. package/dist/testing/index.js.map +1 -1
  478. package/dist/unstable/ai/AiError.d.ts +155 -73
  479. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  480. package/dist/unstable/ai/AiError.js +29 -23
  481. package/dist/unstable/ai/AiError.js.map +1 -1
  482. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  483. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  484. package/dist/unstable/ai/AnthropicStructuredOutput.js +9 -2
  485. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  486. package/dist/unstable/ai/Chat.d.ts +39 -11
  487. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  488. package/dist/unstable/ai/Chat.js +41 -47
  489. package/dist/unstable/ai/Chat.js.map +1 -1
  490. package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
  491. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
  492. package/dist/unstable/ai/EmbeddingModel.js +127 -0
  493. package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
  494. package/dist/unstable/ai/IdGenerator.d.ts +2 -2
  495. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  496. package/dist/unstable/ai/IdGenerator.js +2 -2
  497. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  498. package/dist/unstable/ai/LanguageModel.d.ts +119 -49
  499. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  500. package/dist/unstable/ai/LanguageModel.js +260 -61
  501. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  502. package/dist/unstable/ai/McpSchema.d.ts +236 -141
  503. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  504. package/dist/unstable/ai/McpSchema.js +71 -19
  505. package/dist/unstable/ai/McpSchema.js.map +1 -1
  506. package/dist/unstable/ai/McpServer.d.ts +68 -15
  507. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  508. package/dist/unstable/ai/McpServer.js +218 -73
  509. package/dist/unstable/ai/McpServer.js.map +1 -1
  510. package/dist/unstable/ai/Model.d.ts +27 -9
  511. package/dist/unstable/ai/Model.d.ts.map +1 -1
  512. package/dist/unstable/ai/Model.js +25 -9
  513. package/dist/unstable/ai/Model.js.map +1 -1
  514. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  515. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  516. package/dist/unstable/ai/OpenAiStructuredOutput.js +9 -1
  517. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  518. package/dist/unstable/ai/Prompt.d.ts +20 -20
  519. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  520. package/dist/unstable/ai/Prompt.js +6 -9
  521. package/dist/unstable/ai/Prompt.js.map +1 -1
  522. package/dist/unstable/ai/Response.d.ts +27 -27
  523. package/dist/unstable/ai/Response.d.ts.map +1 -1
  524. package/dist/unstable/ai/Response.js +7 -8
  525. package/dist/unstable/ai/Response.js.map +1 -1
  526. package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
  527. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
  528. package/dist/unstable/ai/ResponseIdTracker.js +68 -0
  529. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
  530. package/dist/unstable/ai/Telemetry.d.ts +35 -2
  531. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  532. package/dist/unstable/ai/Telemetry.js +2 -2
  533. package/dist/unstable/ai/Telemetry.js.map +1 -1
  534. package/dist/unstable/ai/Tokenizer.d.ts +2 -2
  535. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  536. package/dist/unstable/ai/Tokenizer.js +2 -2
  537. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  538. package/dist/unstable/ai/Tool.d.ts +46 -16
  539. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  540. package/dist/unstable/ai/Tool.js +68 -22
  541. package/dist/unstable/ai/Tool.js.map +1 -1
  542. package/dist/unstable/ai/Toolkit.d.ts +4 -4
  543. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  544. package/dist/unstable/ai/Toolkit.js +14 -21
  545. package/dist/unstable/ai/Toolkit.js.map +1 -1
  546. package/dist/unstable/ai/index.d.ts +22 -1
  547. package/dist/unstable/ai/index.d.ts.map +1 -1
  548. package/dist/unstable/ai/index.js +22 -1
  549. package/dist/unstable/ai/index.js.map +1 -1
  550. package/dist/unstable/ai/internal/codec-transformer.js +5 -7
  551. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  552. package/dist/unstable/cli/Argument.d.ts +4 -7
  553. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  554. package/dist/unstable/cli/Argument.js +1 -3
  555. package/dist/unstable/cli/Argument.js.map +1 -1
  556. package/dist/unstable/cli/CliError.d.ts +55 -67
  557. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  558. package/dist/unstable/cli/CliError.js +32 -57
  559. package/dist/unstable/cli/CliError.js.map +1 -1
  560. package/dist/unstable/cli/CliOutput.d.ts +5 -4
  561. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  562. package/dist/unstable/cli/CliOutput.js +67 -12
  563. package/dist/unstable/cli/CliOutput.js.map +1 -1
  564. package/dist/unstable/cli/Command.d.ts +372 -59
  565. package/dist/unstable/cli/Command.d.ts.map +1 -1
  566. package/dist/unstable/cli/Command.js +328 -66
  567. package/dist/unstable/cli/Command.js.map +1 -1
  568. package/dist/unstable/cli/Completions.d.ts +97 -0
  569. package/dist/unstable/cli/Completions.d.ts.map +1 -0
  570. package/dist/unstable/cli/Completions.js +25 -0
  571. package/dist/unstable/cli/Completions.js.map +1 -0
  572. package/dist/unstable/cli/Flag.d.ts +4 -5
  573. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  574. package/dist/unstable/cli/Flag.js +1 -1
  575. package/dist/unstable/cli/Flag.js.map +1 -1
  576. package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
  577. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
  578. package/dist/unstable/cli/GlobalFlag.js +118 -0
  579. package/dist/unstable/cli/GlobalFlag.js.map +1 -0
  580. package/dist/unstable/cli/HelpDoc.d.ts +81 -11
  581. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  582. package/dist/unstable/cli/Param.d.ts +34 -6
  583. package/dist/unstable/cli/Param.d.ts.map +1 -1
  584. package/dist/unstable/cli/Param.js +24 -14
  585. package/dist/unstable/cli/Param.js.map +1 -1
  586. package/dist/unstable/cli/Primitive.d.ts +2 -2
  587. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  588. package/dist/unstable/cli/Primitive.js +1 -1
  589. package/dist/unstable/cli/Primitive.js.map +1 -1
  590. package/dist/unstable/cli/Prompt.js +266 -86
  591. package/dist/unstable/cli/Prompt.js.map +1 -1
  592. package/dist/unstable/cli/index.d.ts +8 -0
  593. package/dist/unstable/cli/index.d.ts.map +1 -1
  594. package/dist/unstable/cli/index.js +8 -0
  595. package/dist/unstable/cli/index.js.map +1 -1
  596. package/dist/unstable/cli/internal/command.d.ts +41 -15
  597. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  598. package/dist/unstable/cli/internal/command.js +84 -47
  599. package/dist/unstable/cli/internal/command.js.map +1 -1
  600. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  601. package/dist/unstable/cli/internal/completions/descriptor.d.ts +2 -0
  602. package/dist/unstable/cli/internal/completions/descriptor.d.ts.map +1 -0
  603. package/dist/unstable/cli/internal/completions/{CommandDescriptor.js → descriptor.js} +17 -5
  604. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -0
  605. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  606. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  607. package/dist/unstable/cli/internal/config.js +42 -0
  608. package/dist/unstable/cli/internal/config.js.map +1 -1
  609. package/dist/unstable/cli/internal/help.d.ts +33 -0
  610. package/dist/unstable/cli/internal/help.d.ts.map +1 -0
  611. package/dist/unstable/cli/internal/help.js +125 -0
  612. package/dist/unstable/cli/internal/help.js.map +1 -0
  613. package/dist/unstable/cli/internal/parser.js +155 -58
  614. package/dist/unstable/cli/internal/parser.js.map +1 -1
  615. package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
  616. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  617. package/dist/unstable/cluster/ClusterCron.js +1 -1
  618. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  619. package/dist/unstable/cluster/ClusterError.d.ts +7 -7
  620. package/dist/unstable/cluster/ClusterSchema.d.ts +28 -7
  621. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  622. package/dist/unstable/cluster/ClusterSchema.js +28 -8
  623. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  624. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +4 -2
  625. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  626. package/dist/unstable/cluster/ClusterWorkflowEngine.js +97 -63
  627. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  628. package/dist/unstable/cluster/DeliverAt.js +1 -1
  629. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  630. package/dist/unstable/cluster/Entity.d.ts +18 -16
  631. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  632. package/dist/unstable/cluster/Entity.js +31 -25
  633. package/dist/unstable/cluster/Entity.js.map +1 -1
  634. package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
  635. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  636. package/dist/unstable/cluster/EntityAddress.js +1 -1
  637. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  638. package/dist/unstable/cluster/EntityProxy.js +3 -3
  639. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  640. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  641. package/dist/unstable/cluster/EntityProxyServer.js +4 -4
  642. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  643. package/dist/unstable/cluster/EntityResource.d.ts +4 -4
  644. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  645. package/dist/unstable/cluster/EntityResource.js +2 -2
  646. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  647. package/dist/unstable/cluster/Envelope.d.ts +4 -4
  648. package/dist/unstable/cluster/HttpRunner.js +2 -2
  649. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  650. package/dist/unstable/cluster/K8sHttpClient.d.ts +5 -5
  651. package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
  652. package/dist/unstable/cluster/K8sHttpClient.js +6 -6
  653. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  654. package/dist/unstable/cluster/Message.d.ts +21 -15
  655. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  656. package/dist/unstable/cluster/Message.js +16 -8
  657. package/dist/unstable/cluster/Message.js.map +1 -1
  658. package/dist/unstable/cluster/MessageStorage.d.ts +46 -23
  659. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  660. package/dist/unstable/cluster/MessageStorage.js +42 -26
  661. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  662. package/dist/unstable/cluster/Reply.d.ts +10 -9
  663. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  664. package/dist/unstable/cluster/Reply.js +8 -7
  665. package/dist/unstable/cluster/Reply.js.map +1 -1
  666. package/dist/unstable/cluster/Runner.d.ts +2 -2
  667. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  668. package/dist/unstable/cluster/Runner.js +1 -1
  669. package/dist/unstable/cluster/Runner.js.map +1 -1
  670. package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
  671. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  672. package/dist/unstable/cluster/RunnerAddress.js +1 -1
  673. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  674. package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
  675. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  676. package/dist/unstable/cluster/RunnerHealth.js +2 -2
  677. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  678. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  679. package/dist/unstable/cluster/RunnerServer.js +10 -9
  680. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  681. package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
  682. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  683. package/dist/unstable/cluster/RunnerStorage.js +3 -3
  684. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  685. package/dist/unstable/cluster/Runners.d.ts +5 -4
  686. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  687. package/dist/unstable/cluster/Runners.js +20 -17
  688. package/dist/unstable/cluster/Runners.js.map +1 -1
  689. package/dist/unstable/cluster/ShardId.d.ts +35 -49
  690. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  691. package/dist/unstable/cluster/ShardId.js +65 -67
  692. package/dist/unstable/cluster/ShardId.js.map +1 -1
  693. package/dist/unstable/cluster/Sharding.d.ts +4 -4
  694. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  695. package/dist/unstable/cluster/Sharding.js +66 -54
  696. package/dist/unstable/cluster/Sharding.js.map +1 -1
  697. package/dist/unstable/cluster/ShardingConfig.d.ts +28 -27
  698. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  699. package/dist/unstable/cluster/ShardingConfig.js +27 -27
  700. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  701. package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
  702. package/dist/unstable/cluster/Snowflake.d.ts +2 -2
  703. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  704. package/dist/unstable/cluster/Snowflake.js +2 -2
  705. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  706. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  707. package/dist/unstable/cluster/SqlMessageStorage.js +24 -20
  708. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  709. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  710. package/dist/unstable/cluster/SqlRunnerStorage.js +7 -7
  711. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  712. package/dist/unstable/cluster/internal/entityManager.js +34 -27
  713. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  714. package/dist/unstable/cluster/internal/entityReaper.js +4 -3
  715. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  716. package/dist/unstable/cluster/internal/resourceMap.js +3 -3
  717. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  718. package/dist/unstable/cluster/internal/resourceRef.js +2 -1
  719. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  720. package/dist/unstable/devtools/DevToolsClient.d.ts +2 -2
  721. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  722. package/dist/unstable/devtools/DevToolsClient.js +9 -8
  723. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  724. package/dist/unstable/devtools/DevToolsSchema.d.ts +40 -40
  725. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  726. package/dist/unstable/devtools/DevToolsSchema.js +9 -2
  727. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  728. package/dist/unstable/encoding/Msgpack.d.ts +1 -1
  729. package/dist/unstable/encoding/Ndjson.d.ts +9 -9
  730. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  731. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  732. package/dist/unstable/encoding/Sse.d.ts +4 -4
  733. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  734. package/dist/unstable/encoding/Sse.js +1 -1
  735. package/dist/unstable/encoding/Sse.js.map +1 -1
  736. package/dist/unstable/eventlog/Event.d.ts +0 -6
  737. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  738. package/dist/unstable/eventlog/Event.js +0 -5
  739. package/dist/unstable/eventlog/Event.js.map +1 -1
  740. package/dist/unstable/eventlog/EventGroup.d.ts +0 -2
  741. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  742. package/dist/unstable/eventlog/EventGroup.js +0 -2
  743. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  744. package/dist/unstable/eventlog/EventJournal.d.ts +28 -11
  745. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  746. package/dist/unstable/eventlog/EventJournal.js +130 -71
  747. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  748. package/dist/unstable/eventlog/EventLog.d.ts +94 -37
  749. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  750. package/dist/unstable/eventlog/EventLog.js +225 -150
  751. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  752. package/dist/unstable/eventlog/EventLogEncryption.d.ts +11 -9
  753. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  754. package/dist/unstable/eventlog/EventLogEncryption.js +15 -17
  755. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  756. package/dist/unstable/eventlog/EventLogMessage.d.ts +228 -0
  757. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -0
  758. package/dist/unstable/eventlog/EventLogMessage.js +214 -0
  759. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -0
  760. package/dist/unstable/eventlog/EventLogRemote.d.ts +112 -194
  761. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  762. package/dist/unstable/eventlog/EventLogRemote.js +168 -322
  763. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  764. package/dist/unstable/eventlog/EventLogServer.d.ts +26 -48
  765. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  766. package/dist/unstable/eventlog/EventLogServer.js +128 -199
  767. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  768. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +60 -0
  769. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -0
  770. package/dist/unstable/eventlog/EventLogServerEncrypted.js +166 -0
  771. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -0
  772. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +183 -0
  773. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -0
  774. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +461 -0
  775. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -0
  776. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +117 -0
  777. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -0
  778. package/dist/unstable/eventlog/EventLogSessionAuth.js +284 -0
  779. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -0
  780. package/dist/unstable/eventlog/{SqlEventLogJournal.d.ts → SqlEventJournal.d.ts} +2 -2
  781. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -0
  782. package/dist/unstable/eventlog/{SqlEventLogJournal.js → SqlEventJournal.js} +28 -21
  783. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
  784. package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
  785. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
  786. package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +69 -27
  787. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
  788. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
  789. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
  790. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +355 -0
  791. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
  792. package/dist/unstable/eventlog/index.d.ts +22 -2
  793. package/dist/unstable/eventlog/index.d.ts.map +1 -1
  794. package/dist/unstable/eventlog/index.js +22 -2
  795. package/dist/unstable/eventlog/index.js.map +1 -1
  796. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
  797. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
  798. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
  799. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
  800. package/dist/unstable/http/Cookies.d.ts +52 -7
  801. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  802. package/dist/unstable/http/Cookies.js +27 -6
  803. package/dist/unstable/http/Cookies.js.map +1 -1
  804. package/dist/unstable/http/Etag.d.ts +2 -2
  805. package/dist/unstable/http/Etag.d.ts.map +1 -1
  806. package/dist/unstable/http/Etag.js +7 -3
  807. package/dist/unstable/http/Etag.js.map +1 -1
  808. package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
  809. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  810. package/dist/unstable/http/FetchHttpClient.js +5 -5
  811. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  812. package/dist/unstable/http/Headers.d.ts +24 -4
  813. package/dist/unstable/http/Headers.d.ts.map +1 -1
  814. package/dist/unstable/http/Headers.js +42 -13
  815. package/dist/unstable/http/Headers.js.map +1 -1
  816. package/dist/unstable/http/HttpBody.d.ts +1 -1
  817. package/dist/unstable/http/HttpClient.d.ts +125 -21
  818. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  819. package/dist/unstable/http/HttpClient.js +197 -19
  820. package/dist/unstable/http/HttpClient.js.map +1 -1
  821. package/dist/unstable/http/HttpClientError.d.ts +8 -8
  822. package/dist/unstable/http/HttpClientRequest.d.ts +43 -15
  823. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  824. package/dist/unstable/http/HttpClientRequest.js +131 -21
  825. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  826. package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
  827. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  828. package/dist/unstable/http/HttpClientResponse.js +6 -1
  829. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  830. package/dist/unstable/http/HttpEffect.d.ts +13 -11
  831. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  832. package/dist/unstable/http/HttpEffect.js +67 -75
  833. package/dist/unstable/http/HttpEffect.js.map +1 -1
  834. package/dist/unstable/http/HttpIncomingMessage.d.ts +5 -4
  835. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  836. package/dist/unstable/http/HttpIncomingMessage.js +2 -2
  837. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  838. package/dist/unstable/http/HttpMethod.d.ts +4 -4
  839. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  840. package/dist/unstable/http/HttpMethod.js +3 -3
  841. package/dist/unstable/http/HttpMethod.js.map +1 -1
  842. package/dist/unstable/http/HttpMiddleware.d.ts +4 -9
  843. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  844. package/dist/unstable/http/HttpMiddleware.js +47 -43
  845. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  846. package/dist/unstable/http/HttpPlatform.d.ts +2 -2
  847. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  848. package/dist/unstable/http/HttpPlatform.js +5 -4
  849. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  850. package/dist/unstable/http/HttpRouter.d.ts +9 -8
  851. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  852. package/dist/unstable/http/HttpRouter.js +36 -36
  853. package/dist/unstable/http/HttpRouter.js.map +1 -1
  854. package/dist/unstable/http/HttpServer.d.ts +2 -2
  855. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  856. package/dist/unstable/http/HttpServer.js +4 -4
  857. package/dist/unstable/http/HttpServer.js.map +1 -1
  858. package/dist/unstable/http/HttpServerError.d.ts +22 -34
  859. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  860. package/dist/unstable/http/HttpServerError.js +39 -45
  861. package/dist/unstable/http/HttpServerError.js.map +1 -1
  862. package/dist/unstable/http/HttpServerRequest.d.ts +19 -7
  863. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  864. package/dist/unstable/http/HttpServerRequest.js +307 -13
  865. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  866. package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
  867. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  868. package/dist/unstable/http/HttpServerRespondable.js +5 -5
  869. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  870. package/dist/unstable/http/HttpServerResponse.d.ts +52 -5
  871. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  872. package/dist/unstable/http/HttpServerResponse.js +240 -5
  873. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  874. package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
  875. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
  876. package/dist/unstable/http/HttpStaticServer.js +353 -0
  877. package/dist/unstable/http/HttpStaticServer.js.map +1 -0
  878. package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
  879. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  880. package/dist/unstable/http/HttpTraceContext.js +27 -15
  881. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  882. package/dist/unstable/http/Multipart.d.ts +9 -9
  883. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  884. package/dist/unstable/http/Multipart.js +7 -7
  885. package/dist/unstable/http/Multipart.js.map +1 -1
  886. package/dist/unstable/http/Url.d.ts +604 -0
  887. package/dist/unstable/http/Url.d.ts.map +1 -0
  888. package/dist/unstable/http/Url.js +256 -0
  889. package/dist/unstable/http/Url.js.map +1 -0
  890. package/dist/unstable/http/UrlParams.d.ts +19 -10
  891. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  892. package/dist/unstable/http/UrlParams.js +6 -7
  893. package/dist/unstable/http/UrlParams.js.map +1 -1
  894. package/dist/unstable/http/index.d.ts +8 -0
  895. package/dist/unstable/http/index.d.ts.map +1 -1
  896. package/dist/unstable/http/index.js +8 -0
  897. package/dist/unstable/http/index.js.map +1 -1
  898. package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
  899. package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
  900. package/dist/unstable/http/internal/preResponseHandler.js +10 -0
  901. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
  902. package/dist/unstable/httpapi/HttpApi.d.ts +11 -11
  903. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  904. package/dist/unstable/httpapi/HttpApi.js +8 -8
  905. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  906. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +12 -9
  907. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  908. package/dist/unstable/httpapi/HttpApiBuilder.js +53 -39
  909. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  910. package/dist/unstable/httpapi/HttpApiClient.d.ts +83 -7
  911. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  912. package/dist/unstable/httpapi/HttpApiClient.js +79 -11
  913. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  914. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +211 -105
  915. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  916. package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -47
  917. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  918. package/dist/unstable/httpapi/HttpApiError.d.ts +43 -26
  919. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  920. package/dist/unstable/httpapi/HttpApiError.js +125 -32
  921. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  922. package/dist/unstable/httpapi/HttpApiGroup.d.ts +9 -8
  923. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  924. package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
  925. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  926. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -18
  927. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  928. package/dist/unstable/httpapi/HttpApiMiddleware.js +38 -8
  929. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  930. package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
  931. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  932. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  933. package/dist/unstable/httpapi/HttpApiSchema.d.ts +88 -9
  934. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  935. package/dist/unstable/httpapi/HttpApiSchema.js +86 -11
  936. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  937. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
  938. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  939. package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
  940. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  941. package/dist/unstable/httpapi/OpenApi.d.ts +17 -25
  942. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  943. package/dist/unstable/httpapi/OpenApi.js +59 -60
  944. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  945. package/dist/unstable/observability/Otlp.d.ts +12 -12
  946. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  947. package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
  948. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  949. package/dist/unstable/observability/OtlpExporter.js +8 -8
  950. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  951. package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
  952. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  953. package/dist/unstable/observability/OtlpLogger.js +7 -4
  954. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  955. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
  956. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  957. package/dist/unstable/observability/OtlpMetrics.js +2 -2
  958. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  959. package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
  960. package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
  961. package/dist/unstable/observability/OtlpSerialization.js +2 -2
  962. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  963. package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
  964. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  965. package/dist/unstable/observability/OtlpTracer.js +7 -3
  966. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  967. package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
  968. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  969. package/dist/unstable/observability/PrometheusMetrics.js +4 -33
  970. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  971. package/dist/unstable/observability/internal/protobuf.js +4 -4
  972. package/dist/unstable/observability/internal/protobuf.js.map +1 -1
  973. package/dist/unstable/persistence/KeyValueStore.d.ts +24 -3
  974. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  975. package/dist/unstable/persistence/KeyValueStore.js +148 -6
  976. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  977. package/dist/unstable/persistence/Persistable.d.ts +2 -2
  978. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  979. package/dist/unstable/persistence/Persistable.js +1 -1
  980. package/dist/unstable/persistence/Persistable.js.map +1 -1
  981. package/dist/unstable/persistence/PersistedCache.d.ts +6 -6
  982. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  983. package/dist/unstable/persistence/PersistedCache.js +12 -12
  984. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  985. package/dist/unstable/persistence/PersistedQueue.d.ts +16 -16
  986. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  987. package/dist/unstable/persistence/PersistedQueue.js +15 -14
  988. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  989. package/dist/unstable/persistence/Persistence.d.ts +5 -5
  990. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  991. package/dist/unstable/persistence/Persistence.js +5 -5
  992. package/dist/unstable/persistence/Persistence.js.map +1 -1
  993. package/dist/unstable/persistence/RateLimiter.d.ts +9 -9
  994. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  995. package/dist/unstable/persistence/RateLimiter.js +4 -4
  996. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  997. package/dist/unstable/persistence/Redis.d.ts +3 -3
  998. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  999. package/dist/unstable/persistence/Redis.js +2 -2
  1000. package/dist/unstable/persistence/Redis.js.map +1 -1
  1001. package/dist/unstable/process/ChildProcess.d.ts +5 -128
  1002. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1003. package/dist/unstable/process/ChildProcess.js +1 -65
  1004. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1005. package/dist/unstable/process/ChildProcessSpawner.d.ts +89 -8
  1006. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1007. package/dist/unstable/process/ChildProcessSpawner.js +22 -2
  1008. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1009. package/dist/unstable/reactivity/Atom.d.ts +108 -47
  1010. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1011. package/dist/unstable/reactivity/Atom.js +105 -25
  1012. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1013. package/dist/unstable/reactivity/AtomHttpApi.d.ts +22 -20
  1014. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1015. package/dist/unstable/reactivity/AtomHttpApi.js +58 -26
  1016. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1017. package/dist/unstable/reactivity/AtomRegistry.d.ts +8 -2
  1018. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  1019. package/dist/unstable/reactivity/AtomRegistry.js +57 -14
  1020. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1021. package/dist/unstable/reactivity/AtomRpc.d.ts +12 -12
  1022. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1023. package/dist/unstable/reactivity/AtomRpc.js +59 -31
  1024. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1025. package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
  1026. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  1027. package/dist/unstable/reactivity/Reactivity.js +6 -6
  1028. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1029. package/dist/unstable/reactivity/index.d.ts +2 -2
  1030. package/dist/unstable/reactivity/index.d.ts.map +1 -1
  1031. package/dist/unstable/reactivity/index.js +2 -2
  1032. package/dist/unstable/reactivity/index.js.map +1 -1
  1033. package/dist/unstable/rpc/Rpc.d.ts +47 -19
  1034. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1035. package/dist/unstable/rpc/Rpc.js +39 -7
  1036. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1037. package/dist/unstable/rpc/RpcClient.d.ts +26 -47
  1038. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1039. package/dist/unstable/rpc/RpcClient.js +120 -77
  1040. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1041. package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
  1042. package/dist/unstable/rpc/RpcGroup.d.ts +15 -11
  1043. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  1044. package/dist/unstable/rpc/RpcGroup.js +30 -20
  1045. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1046. package/dist/unstable/rpc/RpcMiddleware.d.ts +12 -12
  1047. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  1048. package/dist/unstable/rpc/RpcMiddleware.js +5 -5
  1049. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1050. package/dist/unstable/rpc/RpcSchema.d.ts +14 -1
  1051. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  1052. package/dist/unstable/rpc/RpcSchema.js +17 -2
  1053. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1054. package/dist/unstable/rpc/RpcSerialization.d.ts +13 -2
  1055. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1056. package/dist/unstable/rpc/RpcSerialization.js +60 -27
  1057. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1058. package/dist/unstable/rpc/RpcServer.d.ts +8 -12
  1059. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  1060. package/dist/unstable/rpc/RpcServer.js +78 -46
  1061. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1062. package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
  1063. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  1064. package/dist/unstable/rpc/RpcWorker.js +4 -4
  1065. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1066. package/dist/unstable/rpc/Utils.d.ts +6 -3
  1067. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  1068. package/dist/unstable/rpc/Utils.js +48 -6
  1069. package/dist/unstable/rpc/Utils.js.map +1 -1
  1070. package/dist/unstable/schema/Model.d.ts +24 -3
  1071. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1072. package/dist/unstable/schema/Model.js +17 -4
  1073. package/dist/unstable/schema/Model.js.map +1 -1
  1074. package/dist/unstable/schema/VariantSchema.d.ts +7 -7
  1075. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  1076. package/dist/unstable/schema/VariantSchema.js +7 -18
  1077. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1078. package/dist/unstable/socket/Socket.d.ts +16 -15
  1079. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1080. package/dist/unstable/socket/Socket.js +22 -19
  1081. package/dist/unstable/socket/Socket.js.map +1 -1
  1082. package/dist/unstable/socket/SocketServer.d.ts +8 -5
  1083. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  1084. package/dist/unstable/socket/SocketServer.js +2 -2
  1085. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1086. package/dist/unstable/sql/Migrator.d.ts +1 -1
  1087. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  1088. package/dist/unstable/sql/Migrator.js +2 -2
  1089. package/dist/unstable/sql/Migrator.js.map +1 -1
  1090. package/dist/unstable/sql/SqlClient.d.ts +5 -5
  1091. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1092. package/dist/unstable/sql/SqlClient.js +7 -7
  1093. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1094. package/dist/unstable/sql/SqlConnection.d.ts +2 -2
  1095. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  1096. package/dist/unstable/sql/SqlConnection.js +5 -2
  1097. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1098. package/dist/unstable/sql/SqlError.d.ts +237 -17
  1099. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  1100. package/dist/unstable/sql/SqlError.js +260 -4
  1101. package/dist/unstable/sql/SqlError.js.map +1 -1
  1102. package/dist/unstable/sql/SqlModel.d.ts +8 -9
  1103. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  1104. package/dist/unstable/sql/SqlModel.js +12 -38
  1105. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1106. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  1107. package/dist/unstable/sql/SqlResolver.js +26 -17
  1108. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1109. package/dist/unstable/sql/SqlSchema.d.ts +17 -6
  1110. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  1111. package/dist/unstable/sql/SqlSchema.js +17 -7
  1112. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1113. package/dist/unstable/sql/Statement.d.ts +2 -2
  1114. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  1115. package/dist/unstable/sql/Statement.js +2 -3
  1116. package/dist/unstable/sql/Statement.js.map +1 -1
  1117. package/dist/unstable/workers/Transferable.d.ts +4 -4
  1118. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  1119. package/dist/unstable/workers/Transferable.js +7 -7
  1120. package/dist/unstable/workers/Transferable.js.map +1 -1
  1121. package/dist/unstable/workers/Worker.d.ts +3 -3
  1122. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  1123. package/dist/unstable/workers/Worker.js +8 -4
  1124. package/dist/unstable/workers/Worker.js.map +1 -1
  1125. package/dist/unstable/workers/WorkerError.d.ts +5 -5
  1126. package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
  1127. package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
  1128. package/dist/unstable/workers/WorkerRunner.js +5 -2
  1129. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1130. package/dist/unstable/workflow/Activity.d.ts +7 -2
  1131. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  1132. package/dist/unstable/workflow/Activity.js +17 -4
  1133. package/dist/unstable/workflow/Activity.js.map +1 -1
  1134. package/dist/unstable/workflow/DurableClock.d.ts +3 -6
  1135. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  1136. package/dist/unstable/workflow/DurableClock.js +6 -6
  1137. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1138. package/dist/unstable/workflow/DurableDeferred.d.ts +1 -1
  1139. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  1140. package/dist/unstable/workflow/DurableDeferred.js +15 -15
  1141. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1142. package/dist/unstable/workflow/Workflow.d.ts +13 -12
  1143. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1144. package/dist/unstable/workflow/Workflow.js +18 -18
  1145. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1146. package/dist/unstable/workflow/WorkflowEngine.d.ts +26 -8
  1147. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  1148. package/dist/unstable/workflow/WorkflowEngine.js +167 -17
  1149. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1150. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  1151. package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
  1152. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1153. package/package.json +11 -11
  1154. package/src/Array.ts +304 -447
  1155. package/src/BigDecimal.ts +137 -82
  1156. package/src/BigInt.ts +53 -45
  1157. package/src/Brand.ts +3 -5
  1158. package/src/Cache.ts +27 -54
  1159. package/src/Cause.ts +58 -23
  1160. package/src/Channel.ts +693 -224
  1161. package/src/Chunk.ts +149 -331
  1162. package/src/Clock.ts +2 -2
  1163. package/src/Combiner.ts +280 -13
  1164. package/src/Config.ts +197 -27
  1165. package/src/ConfigProvider.ts +5 -5
  1166. package/src/Console.ts +2 -2
  1167. package/src/Context.ts +1454 -0
  1168. package/src/Cron.ts +155 -63
  1169. package/src/Data.ts +539 -376
  1170. package/src/DateTime.ts +77 -258
  1171. package/src/Deferred.ts +15 -6
  1172. package/src/Duration.ts +123 -67
  1173. package/src/Effect.ts +1629 -1355
  1174. package/src/Encoding.ts +879 -0
  1175. package/src/Equal.ts +295 -111
  1176. package/src/Equivalence.ts +114 -52
  1177. package/src/ErrorReporter.ts +458 -0
  1178. package/src/ExecutionPlan.ts +8 -9
  1179. package/src/Exit.ts +24 -12
  1180. package/src/Fiber.ts +17 -8
  1181. package/src/FiberHandle.ts +15 -14
  1182. package/src/FiberMap.ts +27 -27
  1183. package/src/FiberSet.ts +5 -5
  1184. package/src/FileSystem.ts +34 -30
  1185. package/src/Filter.ts +4 -62
  1186. package/src/Formatter.ts +253 -51
  1187. package/src/Function.ts +2 -10
  1188. package/src/Graph.ts +131 -117
  1189. package/src/Hash.ts +2 -2
  1190. package/src/HashMap.ts +26 -19
  1191. package/src/Iterable.ts +117 -63
  1192. package/src/JsonSchema.ts +383 -10
  1193. package/src/Latch.ts +194 -0
  1194. package/src/Layer.ts +728 -441
  1195. package/src/LayerMap.ts +38 -35
  1196. package/src/LogLevel.ts +37 -0
  1197. package/src/Logger.ts +35 -102
  1198. package/src/ManagedRuntime.ts +61 -48
  1199. package/src/Metric.ts +64 -66
  1200. package/src/MutableHashMap.ts +9 -0
  1201. package/src/MutableHashSet.ts +9 -0
  1202. package/src/MutableList.ts +3 -0
  1203. package/src/Newtype.ts +308 -0
  1204. package/src/Number.ts +98 -29
  1205. package/src/Optic.ts +948 -19
  1206. package/src/Option.ts +34 -24
  1207. package/src/Order.ts +39 -32
  1208. package/src/PartitionedSemaphore.ts +288 -56
  1209. package/src/Path.ts +2 -2
  1210. package/src/Pipeable.ts +32 -1
  1211. package/src/Pool.ts +18 -16
  1212. package/src/PubSub.ts +30 -20
  1213. package/src/Pull.ts +1 -1
  1214. package/src/Queue.ts +11 -9
  1215. package/src/Random.ts +51 -14
  1216. package/src/RcMap.ts +19 -19
  1217. package/src/RcRef.ts +1 -1
  1218. package/src/Record.ts +94 -199
  1219. package/src/Redactable.ts +146 -72
  1220. package/src/Reducer.ts +166 -7
  1221. package/src/References.ts +283 -287
  1222. package/src/Request.ts +8 -7
  1223. package/src/RequestResolver.ts +34 -55
  1224. package/src/Resource.ts +6 -5
  1225. package/src/Result.ts +2 -4
  1226. package/src/Runtime.ts +102 -6
  1227. package/src/Schedule.ts +460 -451
  1228. package/src/Scheduler.ts +52 -129
  1229. package/src/Schema.ts +4267 -752
  1230. package/src/SchemaAST.ts +480 -302
  1231. package/src/SchemaGetter.ts +92 -38
  1232. package/src/SchemaIssue.ts +28 -15
  1233. package/src/SchemaParser.ts +100 -29
  1234. package/src/SchemaRepresentation.ts +59 -32
  1235. package/src/SchemaTransformation.ts +364 -13
  1236. package/src/Scope.ts +2 -2
  1237. package/src/ScopedCache.ts +8 -8
  1238. package/src/Semaphore.ts +442 -0
  1239. package/src/Sink.ts +89 -34
  1240. package/src/Stdio.ts +29 -6
  1241. package/src/Stream.ts +898 -752
  1242. package/src/String.ts +122 -69
  1243. package/src/Struct.ts +33 -7
  1244. package/src/SubscriptionRef.ts +101 -120
  1245. package/src/SynchronizedRef.ts +3 -2
  1246. package/src/Terminal.ts +5 -4
  1247. package/src/Tracer.ts +23 -22
  1248. package/src/Trie.ts +44 -31
  1249. package/src/TxChunk.ts +26 -16
  1250. package/src/TxDeferred.ts +391 -0
  1251. package/src/TxHashMap.ts +347 -291
  1252. package/src/TxHashSet.ts +54 -61
  1253. package/src/TxPriorityQueue.ts +762 -0
  1254. package/src/TxPubSub.ts +787 -0
  1255. package/src/TxQueue.ts +221 -245
  1256. package/src/TxReentrantLock.ts +729 -0
  1257. package/src/TxRef.ts +31 -31
  1258. package/src/TxSemaphore.ts +203 -31
  1259. package/src/TxSubscriptionRef.ts +637 -0
  1260. package/src/Types.ts +78 -17
  1261. package/src/Unify.ts +26 -2
  1262. package/src/Utils.ts +137 -111
  1263. package/src/index.ts +898 -72
  1264. package/src/internal/core.ts +19 -12
  1265. package/src/internal/dateTime.ts +91 -96
  1266. package/src/internal/effect.ts +1150 -611
  1267. package/src/internal/hashMap.ts +12 -10
  1268. package/src/internal/layer.ts +7 -7
  1269. package/src/internal/option.ts +7 -0
  1270. package/src/internal/random.ts +20 -0
  1271. package/src/internal/rcRef.ts +14 -13
  1272. package/src/internal/references.ts +72 -0
  1273. package/src/internal/request.ts +8 -8
  1274. package/src/internal/schedule.ts +3 -1
  1275. package/src/internal/schema/annotations.ts +2 -0
  1276. package/src/internal/schema/representation.ts +81 -95
  1277. package/src/internal/schema/schema.ts +25 -1
  1278. package/src/internal/schema/to-codec.ts +7 -17
  1279. package/src/internal/trie.ts +21 -15
  1280. package/src/testing/TestClock.ts +13 -11
  1281. package/src/testing/TestSchema.ts +333 -36
  1282. package/src/testing/index.ts +64 -1
  1283. package/src/unstable/ai/AiError.ts +112 -54
  1284. package/src/unstable/ai/AnthropicStructuredOutput.ts +7 -3
  1285. package/src/unstable/ai/Chat.ts +137 -88
  1286. package/src/unstable/ai/EmbeddingModel.ts +209 -0
  1287. package/src/unstable/ai/IdGenerator.ts +2 -2
  1288. package/src/unstable/ai/LanguageModel.ts +685 -255
  1289. package/src/unstable/ai/McpSchema.ts +84 -22
  1290. package/src/unstable/ai/McpServer.ts +299 -87
  1291. package/src/unstable/ai/Model.ts +44 -13
  1292. package/src/unstable/ai/OpenAiStructuredOutput.ts +9 -2
  1293. package/src/unstable/ai/Prompt.ts +43 -49
  1294. package/src/unstable/ai/Response.ts +31 -33
  1295. package/src/unstable/ai/ResponseIdTracker.ts +95 -0
  1296. package/src/unstable/ai/Telemetry.ts +2 -2
  1297. package/src/unstable/ai/Tokenizer.ts +2 -2
  1298. package/src/unstable/ai/Tool.ts +62 -36
  1299. package/src/unstable/ai/Toolkit.ts +17 -26
  1300. package/src/unstable/ai/index.ts +24 -1
  1301. package/src/unstable/ai/internal/codec-transformer.ts +3 -9
  1302. package/src/unstable/cli/Argument.ts +5 -8
  1303. package/src/unstable/cli/CliError.ts +67 -66
  1304. package/src/unstable/cli/CliOutput.ts +87 -15
  1305. package/src/unstable/cli/Command.ts +808 -193
  1306. package/src/unstable/cli/Completions.ts +107 -0
  1307. package/src/unstable/cli/Flag.ts +5 -6
  1308. package/src/unstable/cli/GlobalFlag.ts +242 -0
  1309. package/src/unstable/cli/HelpDoc.ts +91 -11
  1310. package/src/unstable/cli/Param.ts +54 -27
  1311. package/src/unstable/cli/Primitive.ts +2 -2
  1312. package/src/unstable/cli/Prompt.ts +275 -104
  1313. package/src/unstable/cli/index.ts +10 -0
  1314. package/src/unstable/cli/internal/command.ts +125 -64
  1315. package/src/unstable/cli/internal/completions/bash.ts +7 -7
  1316. package/src/unstable/cli/internal/completions/{CommandDescriptor.ts → descriptor.ts} +16 -58
  1317. package/src/unstable/cli/internal/completions/fish.ts +7 -7
  1318. package/src/unstable/cli/internal/completions/zsh.ts +8 -14
  1319. package/src/unstable/cli/internal/config.ts +49 -0
  1320. package/src/unstable/cli/internal/help.ts +171 -0
  1321. package/src/unstable/cli/internal/parser.ts +201 -84
  1322. package/src/unstable/cluster/ClusterCron.ts +2 -2
  1323. package/src/unstable/cluster/ClusterSchema.ts +38 -10
  1324. package/src/unstable/cluster/ClusterWorkflowEngine.ts +144 -81
  1325. package/src/unstable/cluster/DeliverAt.ts +1 -1
  1326. package/src/unstable/cluster/Entity.ts +59 -45
  1327. package/src/unstable/cluster/EntityAddress.ts +1 -1
  1328. package/src/unstable/cluster/EntityProxy.ts +3 -3
  1329. package/src/unstable/cluster/EntityProxyServer.ts +4 -4
  1330. package/src/unstable/cluster/EntityResource.ts +6 -6
  1331. package/src/unstable/cluster/Envelope.ts +1 -1
  1332. package/src/unstable/cluster/HttpRunner.ts +2 -2
  1333. package/src/unstable/cluster/K8sHttpClient.ts +7 -7
  1334. package/src/unstable/cluster/Message.ts +30 -17
  1335. package/src/unstable/cluster/MessageStorage.ts +76 -46
  1336. package/src/unstable/cluster/Reply.ts +13 -10
  1337. package/src/unstable/cluster/Runner.ts +1 -1
  1338. package/src/unstable/cluster/RunnerAddress.ts +1 -1
  1339. package/src/unstable/cluster/RunnerHealth.ts +2 -2
  1340. package/src/unstable/cluster/RunnerServer.ts +11 -14
  1341. package/src/unstable/cluster/RunnerStorage.ts +9 -9
  1342. package/src/unstable/cluster/Runners.ts +28 -23
  1343. package/src/unstable/cluster/ShardId.ts +84 -74
  1344. package/src/unstable/cluster/Sharding.ts +83 -66
  1345. package/src/unstable/cluster/ShardingConfig.ts +39 -40
  1346. package/src/unstable/cluster/Snowflake.ts +2 -2
  1347. package/src/unstable/cluster/SqlMessageStorage.ts +29 -20
  1348. package/src/unstable/cluster/SqlRunnerStorage.ts +13 -7
  1349. package/src/unstable/cluster/internal/entityManager.ts +66 -46
  1350. package/src/unstable/cluster/internal/entityReaper.ts +4 -3
  1351. package/src/unstable/cluster/internal/resourceMap.ts +3 -3
  1352. package/src/unstable/cluster/internal/resourceRef.ts +2 -1
  1353. package/src/unstable/devtools/DevToolsClient.ts +26 -21
  1354. package/src/unstable/devtools/DevToolsSchema.ts +16 -3
  1355. package/src/unstable/encoding/Ndjson.ts +17 -17
  1356. package/src/unstable/encoding/Sse.ts +3 -5
  1357. package/src/unstable/eventlog/Event.ts +0 -8
  1358. package/src/unstable/eventlog/EventGroup.ts +0 -4
  1359. package/src/unstable/eventlog/EventJournal.ts +148 -80
  1360. package/src/unstable/eventlog/EventLog.ts +360 -233
  1361. package/src/unstable/eventlog/EventLogEncryption.ts +18 -32
  1362. package/src/unstable/eventlog/EventLogMessage.ts +277 -0
  1363. package/src/unstable/eventlog/EventLogRemote.ts +264 -410
  1364. package/src/unstable/eventlog/EventLogServer.ts +183 -275
  1365. package/src/unstable/eventlog/EventLogServerEncrypted.ts +206 -0
  1366. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +749 -0
  1367. package/src/unstable/eventlog/EventLogSessionAuth.ts +437 -0
  1368. package/src/unstable/eventlog/{SqlEventLogJournal.ts → SqlEventJournal.ts} +38 -22
  1369. package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +110 -43
  1370. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +506 -0
  1371. package/src/unstable/eventlog/index.ts +27 -2
  1372. package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
  1373. package/src/unstable/http/Cookies.ts +94 -11
  1374. package/src/unstable/http/Etag.ts +7 -5
  1375. package/src/unstable/http/FetchHttpClient.ts +5 -5
  1376. package/src/unstable/http/Headers.ts +70 -20
  1377. package/src/unstable/http/HttpClient.ts +385 -42
  1378. package/src/unstable/http/HttpClientRequest.ts +151 -39
  1379. package/src/unstable/http/HttpClientResponse.ts +12 -6
  1380. package/src/unstable/http/HttpEffect.ts +86 -100
  1381. package/src/unstable/http/HttpIncomingMessage.ts +5 -4
  1382. package/src/unstable/http/HttpMethod.ts +16 -4
  1383. package/src/unstable/http/HttpMiddleware.ts +50 -50
  1384. package/src/unstable/http/HttpPlatform.ts +5 -4
  1385. package/src/unstable/http/HttpRouter.ts +46 -46
  1386. package/src/unstable/http/HttpServer.ts +5 -11
  1387. package/src/unstable/http/HttpServerError.ts +45 -47
  1388. package/src/unstable/http/HttpServerRequest.ts +414 -23
  1389. package/src/unstable/http/HttpServerRespondable.ts +6 -6
  1390. package/src/unstable/http/HttpServerResponse.ts +351 -13
  1391. package/src/unstable/http/HttpStaticServer.ts +456 -0
  1392. package/src/unstable/http/HttpTraceContext.ts +31 -17
  1393. package/src/unstable/http/Multipart.ts +10 -10
  1394. package/src/unstable/http/Url.ts +650 -0
  1395. package/src/unstable/http/UrlParams.ts +31 -19
  1396. package/src/unstable/http/index.ts +10 -0
  1397. package/src/unstable/http/internal/preResponseHandler.ts +15 -0
  1398. package/src/unstable/httpapi/HttpApi.ts +21 -21
  1399. package/src/unstable/httpapi/HttpApiBuilder.ts +128 -55
  1400. package/src/unstable/httpapi/HttpApiClient.ts +186 -34
  1401. package/src/unstable/httpapi/HttpApiEndpoint.ts +225 -113
  1402. package/src/unstable/httpapi/HttpApiError.ts +108 -30
  1403. package/src/unstable/httpapi/HttpApiGroup.ts +18 -17
  1404. package/src/unstable/httpapi/HttpApiMiddleware.ts +95 -33
  1405. package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
  1406. package/src/unstable/httpapi/HttpApiSchema.ts +106 -11
  1407. package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
  1408. package/src/unstable/httpapi/OpenApi.ts +73 -72
  1409. package/src/unstable/observability/Otlp.ts +12 -12
  1410. package/src/unstable/observability/OtlpExporter.ts +14 -10
  1411. package/src/unstable/observability/OtlpLogger.ts +13 -9
  1412. package/src/unstable/observability/OtlpMetrics.ts +6 -6
  1413. package/src/unstable/observability/OtlpSerialization.ts +2 -2
  1414. package/src/unstable/observability/OtlpTracer.ts +14 -10
  1415. package/src/unstable/observability/PrometheusMetrics.ts +5 -5
  1416. package/src/unstable/observability/internal/protobuf.ts +4 -4
  1417. package/src/unstable/persistence/KeyValueStore.ts +230 -7
  1418. package/src/unstable/persistence/Persistable.ts +3 -3
  1419. package/src/unstable/persistence/PersistedCache.ts +35 -21
  1420. package/src/unstable/persistence/PersistedQueue.ts +28 -27
  1421. package/src/unstable/persistence/Persistence.ts +7 -7
  1422. package/src/unstable/persistence/RateLimiter.ts +7 -7
  1423. package/src/unstable/persistence/Redis.ts +2 -2
  1424. package/src/unstable/process/ChildProcess.ts +6 -208
  1425. package/src/unstable/process/ChildProcessSpawner.ts +120 -15
  1426. package/src/unstable/reactivity/Atom.ts +280 -124
  1427. package/src/unstable/reactivity/AtomHttpApi.ts +115 -59
  1428. package/src/unstable/reactivity/AtomRegistry.ts +70 -16
  1429. package/src/unstable/reactivity/AtomRpc.ts +82 -37
  1430. package/src/unstable/reactivity/Reactivity.ts +6 -6
  1431. package/src/unstable/reactivity/index.ts +2 -2
  1432. package/src/unstable/rpc/Rpc.ts +77 -32
  1433. package/src/unstable/rpc/RpcClient.ts +165 -145
  1434. package/src/unstable/rpc/RpcGroup.ts +51 -34
  1435. package/src/unstable/rpc/RpcMiddleware.ts +28 -22
  1436. package/src/unstable/rpc/RpcSchema.ts +24 -6
  1437. package/src/unstable/rpc/RpcSerialization.ts +97 -54
  1438. package/src/unstable/rpc/RpcServer.ts +97 -69
  1439. package/src/unstable/rpc/RpcWorker.ts +5 -5
  1440. package/src/unstable/rpc/Utils.ts +65 -5
  1441. package/src/unstable/schema/Model.ts +35 -6
  1442. package/src/unstable/schema/VariantSchema.ts +14 -27
  1443. package/src/unstable/socket/Socket.ts +42 -38
  1444. package/src/unstable/socket/SocketServer.ts +2 -2
  1445. package/src/unstable/sql/Migrator.ts +7 -5
  1446. package/src/unstable/sql/SqlClient.ts +13 -11
  1447. package/src/unstable/sql/SqlConnection.ts +2 -2
  1448. package/src/unstable/sql/SqlError.ts +365 -11
  1449. package/src/unstable/sql/SqlModel.ts +57 -85
  1450. package/src/unstable/sql/SqlResolver.ts +26 -16
  1451. package/src/unstable/sql/SqlSchema.ts +42 -26
  1452. package/src/unstable/sql/Statement.ts +2 -3
  1453. package/src/unstable/workers/Transferable.ts +17 -19
  1454. package/src/unstable/workers/Worker.ts +6 -5
  1455. package/src/unstable/workers/WorkerRunner.ts +2 -2
  1456. package/src/unstable/workflow/Activity.ts +27 -4
  1457. package/src/unstable/workflow/DurableClock.ts +11 -11
  1458. package/src/unstable/workflow/DurableDeferred.ts +16 -16
  1459. package/src/unstable/workflow/Workflow.ts +32 -25
  1460. package/src/unstable/workflow/WorkflowEngine.ts +239 -25
  1461. package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
  1462. package/dist/NullOr.d.ts +0 -149
  1463. package/dist/NullOr.d.ts.map +0 -1
  1464. package/dist/NullOr.js +0 -152
  1465. package/dist/NullOr.js.map +0 -1
  1466. package/dist/ServiceMap.d.ts +0 -1126
  1467. package/dist/ServiceMap.d.ts.map +0 -1
  1468. package/dist/ServiceMap.js.map +0 -1
  1469. package/dist/encoding/Base64.d.ts +0 -67
  1470. package/dist/encoding/Base64.d.ts.map +0 -1
  1471. package/dist/encoding/Base64.js +0 -146
  1472. package/dist/encoding/Base64.js.map +0 -1
  1473. package/dist/encoding/Base64Url.d.ts +0 -60
  1474. package/dist/encoding/Base64Url.d.ts.map +0 -1
  1475. package/dist/encoding/Base64Url.js +0 -89
  1476. package/dist/encoding/Base64Url.js.map +0 -1
  1477. package/dist/encoding/EncodingError.d.ts +0 -31
  1478. package/dist/encoding/EncodingError.d.ts.map +0 -1
  1479. package/dist/encoding/EncodingError.js +0 -22
  1480. package/dist/encoding/EncodingError.js.map +0 -1
  1481. package/dist/encoding/Hex.d.ts +0 -61
  1482. package/dist/encoding/Hex.d.ts.map +0 -1
  1483. package/dist/encoding/Hex.js +0 -115
  1484. package/dist/encoding/Hex.js.map +0 -1
  1485. package/dist/encoding/index.d.ts +0 -26
  1486. package/dist/encoding/index.d.ts.map +0 -1
  1487. package/dist/encoding/index.js +0 -27
  1488. package/dist/encoding/index.js.map +0 -1
  1489. package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
  1490. package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
  1491. package/dist/unstable/cli/internal/builtInFlags.js +0 -44
  1492. package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
  1493. package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts +0 -2
  1494. package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts.map +0 -1
  1495. package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +0 -1
  1496. package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
  1497. package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
  1498. package/dist/unstable/cli/internal/completions/Completions.js +0 -23
  1499. package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
  1500. package/dist/unstable/eventlog/SqlEventLogJournal.d.ts.map +0 -1
  1501. package/dist/unstable/eventlog/SqlEventLogJournal.js.map +0 -1
  1502. package/dist/unstable/eventlog/SqlEventLogServer.d.ts.map +0 -1
  1503. package/dist/unstable/eventlog/SqlEventLogServer.js.map +0 -1
  1504. package/src/NullOr.ts +0 -204
  1505. package/src/ServiceMap.ts +0 -1410
  1506. package/src/encoding/Base64.ts +0 -366
  1507. package/src/encoding/Base64Url.ts +0 -104
  1508. package/src/encoding/EncodingError.ts +0 -35
  1509. package/src/encoding/Hex.ts +0 -390
  1510. package/src/encoding/index.ts +0 -31
  1511. package/src/unstable/cli/internal/builtInFlags.ts +0 -78
  1512. package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/dist/Effect.d.ts CHANGED
@@ -40,12 +40,14 @@
40
40
  *
41
41
  * @example
42
42
  * ```ts
43
- * import { Effect } from "effect"
43
+ * import { Data, Effect } from "effect"
44
+ *
45
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
44
46
  *
45
47
  * // Effect that may fail
46
48
  * const divide = (a: number, b: number) =>
47
49
  * b === 0
48
- * ? Effect.fail(new Error("Division by zero"))
50
+ * ? Effect.fail(new DiscountRateError())
49
51
  * : Effect.succeed(a / b)
50
52
  *
51
53
  * // Error handling
@@ -69,6 +71,7 @@
69
71
  import type * as Arr from "./Array.ts";
70
72
  import type * as Cause from "./Cause.ts";
71
73
  import type { Clock } from "./Clock.ts";
74
+ import * as Context from "./Context.ts";
72
75
  import * as Duration from "./Duration.ts";
73
76
  import type { ExecutionPlan } from "./ExecutionPlan.ts";
74
77
  import * as Exit from "./Exit.ts";
@@ -78,7 +81,7 @@ import { type LazyArg } from "./Function.ts";
78
81
  import type { TypeLambda } from "./HKT.ts";
79
82
  import type * as Layer from "./Layer.ts";
80
83
  import type { Logger } from "./Logger.ts";
81
- import type { LogLevel } from "./LogLevel.ts";
84
+ import type { Severity } from "./LogLevel.ts";
82
85
  import * as Metric from "./Metric.ts";
83
86
  import type { Option } from "./Option.ts";
84
87
  import type { Pipeable } from "./Pipeable.ts";
@@ -89,10 +92,9 @@ import type * as Result from "./Result.ts";
89
92
  import type { Schedule } from "./Schedule.ts";
90
93
  import type { Scheduler } from "./Scheduler.ts";
91
94
  import type { Scope } from "./Scope.ts";
92
- import * as ServiceMap from "./ServiceMap.ts";
93
95
  import type { AnySpan, ParentSpan, Span, SpanLink, SpanOptions, SpanOptionsNoTrace, TraceOptions, Tracer } from "./Tracer.ts";
94
96
  import type { TxRef } from "./TxRef.ts";
95
- import type { Concurrency, Covariant, EqualsWith, ExcludeReason, ExcludeTag, ExtractReason, ExtractTag, NoInfer, ReasonOf, ReasonTags, Tags, unassigned } from "./Types.ts";
97
+ import type { Concurrency, Covariant, EqualsWith, ExcludeReason, ExcludeTag, ExtractReason, ExtractTag, NarrowReason, NoInfer, OmitReason, ReasonOf, ReasonTags, Simplify, Tags, unassigned } from "./Types.ts";
96
98
  import type * as Unify from "./Unify.ts";
97
99
  declare const TypeId: "~effect/Effect";
98
100
  /**
@@ -111,13 +113,15 @@ declare const TypeId: "~effect/Effect";
111
113
  *
112
114
  * @example
113
115
  * ```ts
114
- * import { Effect } from "effect"
116
+ * import { Data, Effect } from "effect"
117
+ *
118
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
115
119
  *
116
120
  * // A simple effect that succeeds with a value
117
121
  * const success = Effect.succeed(42)
118
122
  *
119
- * // An effect that may fail
120
- * const risky = Effect.fail(new Error("Something went wrong"))
123
+ * // An effect that will always fail
124
+ * const risky = Effect.fail(new TaskError({ message: "Something went wrong" }))
121
125
  *
122
126
  * // Effects can be composed using generator functions
123
127
  * const program = Effect.gen(function*() {
@@ -134,7 +138,7 @@ export interface Effect<out A, out E = never, out R = never> extends Pipeable, Y
134
138
  readonly [TypeId]: Variance<A, E, R>;
135
139
  [Unify.typeSymbol]?: unknown;
136
140
  [Unify.unifySymbol]?: EffectUnify<this>;
137
- [Unify.ignoreSymbol]?: EffectUnifyIgnore;
141
+ [Unify.ignoreSymbol]?: {};
138
142
  }
139
143
  /**
140
144
  * A type that can be yielded in an Effect generator function.
@@ -191,21 +195,6 @@ export interface EffectUnify<A extends {
191
195
  }> {
192
196
  Effect?: () => A[Unify.typeSymbol] extends Effect<infer A0, infer E0, infer R0> | infer _ ? Effect<A0, E0, R0> : never;
193
197
  }
194
- /**
195
- * @category Models
196
- * @since 2.0.0
197
- * @example
198
- * ```ts
199
- * import type { Effect } from "effect"
200
- *
201
- * // EffectUnifyIgnore is used internally to control type unification
202
- * // It prevents certain types from being unified with Effect types
203
- * declare const ignored: Effect.EffectUnifyIgnore
204
- * ```
205
- */
206
- export interface EffectUnifyIgnore {
207
- Effect?: true;
208
- }
209
198
  /**
210
199
  * @category Type Lambdas
211
200
  * @since 2.0.0
@@ -367,13 +356,15 @@ export declare namespace All {
367
356
  * @category Models
368
357
  * @example
369
358
  * ```ts
370
- * import { Effect } from "effect"
359
+ * import { Data, Effect } from "effect"
360
+ *
361
+ * class OopsError extends Data.TaggedError("OopsError")<{}> {}
371
362
  *
372
363
  * // EffectAny represents an Effect with any type parameters
373
364
  * const effects: Array<Effect.All.EffectAny> = [
374
365
  * Effect.succeed(42),
375
366
  * Effect.succeed("hello"),
376
- * Effect.fail(new Error("oops"))
367
+ * Effect.fail(new OopsError())
377
368
  * ]
378
369
  * ```
379
370
  */
@@ -625,7 +616,6 @@ export declare namespace All {
625
616
  * ```
626
617
  *
627
618
  * @see {@link forEach} for iterating over elements and applying an effect.
628
- * @see {@link allWith} for a data-last version of this function.
629
619
  *
630
620
  * @since 2.0.0
631
621
  * @category Collecting
@@ -724,6 +714,291 @@ export declare const partition: {
724
714
  readonly concurrency?: Concurrency | undefined;
725
715
  }): Effect<[excluded: Array<E>, satisfying: Array<B>], never, R>;
726
716
  };
717
+ /**
718
+ * Applies an effectful function to each element and accumulates all failures.
719
+ *
720
+ * This function always evaluates every element. If at least one effect fails,
721
+ * all failures are returned as a non-empty array and successes are discarded.
722
+ * If all effects succeed, it returns all collected successes.
723
+ *
724
+ * Use `discard: true` to ignore successful values while still validating all
725
+ * elements.
726
+ *
727
+ * @example
728
+ * ```ts
729
+ * import { Effect } from "effect"
730
+ *
731
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
732
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
733
+ * )
734
+ *
735
+ * Effect.runPromiseExit(program).then(console.log)
736
+ * // {
737
+ * // _id: 'Exit',
738
+ * // _tag: 'Failure',
739
+ * // cause: {
740
+ * // _id: 'Cause',
741
+ * // reasons: [
742
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
743
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
744
+ * // ]
745
+ * // }
746
+ * // }
747
+ * ```
748
+ *
749
+ * @since 4.0.0
750
+ * @category Error Accumulation
751
+ */
752
+ export declare const validate: {
753
+ /**
754
+ * Applies an effectful function to each element and accumulates all failures.
755
+ *
756
+ * This function always evaluates every element. If at least one effect fails,
757
+ * all failures are returned as a non-empty array and successes are discarded.
758
+ * If all effects succeed, it returns all collected successes.
759
+ *
760
+ * Use `discard: true` to ignore successful values while still validating all
761
+ * elements.
762
+ *
763
+ * @example
764
+ * ```ts
765
+ * import { Effect } from "effect"
766
+ *
767
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
768
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
769
+ * )
770
+ *
771
+ * Effect.runPromiseExit(program).then(console.log)
772
+ * // {
773
+ * // _id: 'Exit',
774
+ * // _tag: 'Failure',
775
+ * // cause: {
776
+ * // _id: 'Cause',
777
+ * // reasons: [
778
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
779
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
780
+ * // ]
781
+ * // }
782
+ * // }
783
+ * ```
784
+ *
785
+ * @since 4.0.0
786
+ * @category Error Accumulation
787
+ */
788
+ <A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options?: {
789
+ readonly concurrency?: Concurrency | undefined;
790
+ readonly discard?: false | undefined;
791
+ } | undefined): (elements: Iterable<A>) => Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
792
+ /**
793
+ * Applies an effectful function to each element and accumulates all failures.
794
+ *
795
+ * This function always evaluates every element. If at least one effect fails,
796
+ * all failures are returned as a non-empty array and successes are discarded.
797
+ * If all effects succeed, it returns all collected successes.
798
+ *
799
+ * Use `discard: true` to ignore successful values while still validating all
800
+ * elements.
801
+ *
802
+ * @example
803
+ * ```ts
804
+ * import { Effect } from "effect"
805
+ *
806
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
807
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
808
+ * )
809
+ *
810
+ * Effect.runPromiseExit(program).then(console.log)
811
+ * // {
812
+ * // _id: 'Exit',
813
+ * // _tag: 'Failure',
814
+ * // cause: {
815
+ * // _id: 'Cause',
816
+ * // reasons: [
817
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
818
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
819
+ * // ]
820
+ * // }
821
+ * // }
822
+ * ```
823
+ *
824
+ * @since 4.0.0
825
+ * @category Error Accumulation
826
+ */
827
+ <A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options: {
828
+ readonly concurrency?: Concurrency | undefined;
829
+ readonly discard: true;
830
+ }): (elements: Iterable<A>) => Effect<void, Arr.NonEmptyArray<E>, R>;
831
+ /**
832
+ * Applies an effectful function to each element and accumulates all failures.
833
+ *
834
+ * This function always evaluates every element. If at least one effect fails,
835
+ * all failures are returned as a non-empty array and successes are discarded.
836
+ * If all effects succeed, it returns all collected successes.
837
+ *
838
+ * Use `discard: true` to ignore successful values while still validating all
839
+ * elements.
840
+ *
841
+ * @example
842
+ * ```ts
843
+ * import { Effect } from "effect"
844
+ *
845
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
846
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
847
+ * )
848
+ *
849
+ * Effect.runPromiseExit(program).then(console.log)
850
+ * // {
851
+ * // _id: 'Exit',
852
+ * // _tag: 'Failure',
853
+ * // cause: {
854
+ * // _id: 'Cause',
855
+ * // reasons: [
856
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
857
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
858
+ * // ]
859
+ * // }
860
+ * // }
861
+ * ```
862
+ *
863
+ * @since 4.0.0
864
+ * @category Error Accumulation
865
+ */
866
+ <A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options?: {
867
+ readonly concurrency?: Concurrency | undefined;
868
+ readonly discard?: false | undefined;
869
+ } | undefined): Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
870
+ /**
871
+ * Applies an effectful function to each element and accumulates all failures.
872
+ *
873
+ * This function always evaluates every element. If at least one effect fails,
874
+ * all failures are returned as a non-empty array and successes are discarded.
875
+ * If all effects succeed, it returns all collected successes.
876
+ *
877
+ * Use `discard: true` to ignore successful values while still validating all
878
+ * elements.
879
+ *
880
+ * @example
881
+ * ```ts
882
+ * import { Effect } from "effect"
883
+ *
884
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
885
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
886
+ * )
887
+ *
888
+ * Effect.runPromiseExit(program).then(console.log)
889
+ * // {
890
+ * // _id: 'Exit',
891
+ * // _tag: 'Failure',
892
+ * // cause: {
893
+ * // _id: 'Cause',
894
+ * // reasons: [
895
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
896
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
897
+ * // ]
898
+ * // }
899
+ * // }
900
+ * ```
901
+ *
902
+ * @since 4.0.0
903
+ * @category Error Accumulation
904
+ */
905
+ <A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options: {
906
+ readonly concurrency?: Concurrency | undefined;
907
+ readonly discard: true;
908
+ }): Effect<void, Arr.NonEmptyArray<E>, R>;
909
+ };
910
+ /**
911
+ * Returns the first element that satisfies an effectful predicate.
912
+ *
913
+ * The predicate receives the element and its index. Evaluation short-circuits
914
+ * as soon as an element matches.
915
+ *
916
+ * @example
917
+ * ```ts
918
+ * import { Effect } from "effect"
919
+ *
920
+ * const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
921
+ *
922
+ * Effect.runPromise(program).then(console.log)
923
+ * // { _id: 'Option', _tag: 'Some', value: 3 }
924
+ * ```
925
+ *
926
+ * @since 2.0.0
927
+ * @category Collecting
928
+ */
929
+ export declare const findFirst: {
930
+ /**
931
+ * Returns the first element that satisfies an effectful predicate.
932
+ *
933
+ * The predicate receives the element and its index. Evaluation short-circuits
934
+ * as soon as an element matches.
935
+ *
936
+ * @example
937
+ * ```ts
938
+ * import { Effect } from "effect"
939
+ *
940
+ * const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
941
+ *
942
+ * Effect.runPromise(program).then(console.log)
943
+ * // { _id: 'Option', _tag: 'Some', value: 3 }
944
+ * ```
945
+ *
946
+ * @since 2.0.0
947
+ * @category Collecting
948
+ */
949
+ <A, E, R>(predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>): (elements: Iterable<A>) => Effect<Option<A>, E, R>;
950
+ /**
951
+ * Returns the first element that satisfies an effectful predicate.
952
+ *
953
+ * The predicate receives the element and its index. Evaluation short-circuits
954
+ * as soon as an element matches.
955
+ *
956
+ * @example
957
+ * ```ts
958
+ * import { Effect } from "effect"
959
+ *
960
+ * const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
961
+ *
962
+ * Effect.runPromise(program).then(console.log)
963
+ * // { _id: 'Option', _tag: 'Some', value: 3 }
964
+ * ```
965
+ *
966
+ * @since 2.0.0
967
+ * @category Collecting
968
+ */
969
+ <A, E, R>(elements: Iterable<A>, predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>): Effect<Option<A>, E, R>;
970
+ };
971
+ /**
972
+ * Returns the first value that passes an effectful `FilterEffect`.
973
+ *
974
+ * The filter receives the element and index. Evaluation short-circuits on the
975
+ * first `Result.succeed` and returns the transformed value in `Option.some`.
976
+ *
977
+ * @since 4.0.0
978
+ * @category Collecting
979
+ */
980
+ export declare const findFirstFilter: {
981
+ /**
982
+ * Returns the first value that passes an effectful `FilterEffect`.
983
+ *
984
+ * The filter receives the element and index. Evaluation short-circuits on the
985
+ * first `Result.succeed` and returns the transformed value in `Option.some`.
986
+ *
987
+ * @since 4.0.0
988
+ * @category Collecting
989
+ */
990
+ <A, B, X, E, R>(filter: (input: NoInfer<A>, i: number) => Effect<Result.Result<B, X>, E, R>): (elements: Iterable<A>) => Effect<Option<B>, E, R>;
991
+ /**
992
+ * Returns the first value that passes an effectful `FilterEffect`.
993
+ *
994
+ * The filter receives the element and index. Evaluation short-circuits on the
995
+ * first `Result.succeed` and returns the transformed value in `Option.some`.
996
+ *
997
+ * @since 4.0.0
998
+ * @category Collecting
999
+ */
1000
+ <A, B, X, E, R>(elements: Iterable<A>, filter: (input: NoInfer<A>, i: number) => Effect<Result.Result<B, X>, E, R>): Effect<Option<B>, E, R>;
1001
+ };
727
1002
  /**
728
1003
  * Executes an effectful operation for each element in an `Iterable`.
729
1004
  *
@@ -1068,16 +1343,18 @@ export declare const promise: <A>(evaluate: (signal: AbortSignal) => PromiseLike
1068
1343
  *
1069
1344
  * @example Custom Error Handling
1070
1345
  * ```ts
1071
- * import { Effect } from "effect"
1346
+ * import { Data, Effect } from "effect"
1347
+ *
1348
+ * class TodoFetchError extends Data.TaggedError("TodoFetchError")<{ readonly cause: unknown }> {}
1072
1349
  *
1073
1350
  * const getTodo = (id: number) =>
1074
1351
  * Effect.tryPromise({
1075
1352
  * try: () => fetch(`https://jsonplaceholder.typicode.com/todos/${id}`),
1076
1353
  * // remap the error
1077
- * catch: (unknown) => new Error(`something went wrong ${unknown}`)
1354
+ * catch: (cause) => new TodoFetchError({ cause })
1078
1355
  * })
1079
1356
  *
1080
- * // ┌─── Effect<Response, Error, never>
1357
+ * // ┌─── Effect<Response, TodoFetchError, never>
1081
1358
  * // ▼
1082
1359
  * const program = getTodo(1)
1083
1360
  * ```
@@ -1307,8 +1584,13 @@ undefined_ as undefined };
1307
1584
  *
1308
1585
  * **When to Use**
1309
1586
  *
1310
- * Use `Effect.async` when dealing with APIs that use callback-style instead of
1587
+ * Use `Effect.callback` when dealing with APIs that use callback-style instead of
1311
1588
  * `async/await` or `Promise`.
1589
+ * * **Previously Known As**
1590
+ *
1591
+ * This API replaces the following from Effect 3.x:
1592
+ *
1593
+ * - `Effect.async`
1312
1594
  *
1313
1595
  * @example
1314
1596
  * ```ts
@@ -1352,6 +1634,90 @@ export declare const callback: <A, E = never, R = never>(register: (this: Schedu
1352
1634
  * @category Creating Effects
1353
1635
  */
1354
1636
  export declare const never: Effect<never>;
1637
+ /**
1638
+ * An `Effect` containing an empty record `{}`, used as the starting point for
1639
+ * do notation chains.
1640
+ *
1641
+ * @example
1642
+ * ```ts
1643
+ * import { Effect } from "effect"
1644
+ * import { pipe } from "effect/Function"
1645
+ *
1646
+ * const program = pipe(
1647
+ * Effect.Do,
1648
+ * Effect.bind("x", () => Effect.succeed(2)),
1649
+ * Effect.bind("y", ({ x }) => Effect.succeed(x + 1)),
1650
+ * Effect.let("sum", ({ x, y }) => x + y)
1651
+ * )
1652
+ * ```
1653
+ *
1654
+ * @since 4.0.0
1655
+ * @category Do notation
1656
+ */
1657
+ export declare const Do: Effect<{}>;
1658
+ /**
1659
+ * Gives a name to the success value of an `Effect`, creating a single-key
1660
+ * record used in do notation pipelines.
1661
+ *
1662
+ * @since 4.0.0
1663
+ * @category Do notation
1664
+ */
1665
+ export declare const bindTo: {
1666
+ /**
1667
+ * Gives a name to the success value of an `Effect`, creating a single-key
1668
+ * record used in do notation pipelines.
1669
+ *
1670
+ * @since 4.0.0
1671
+ * @category Do notation
1672
+ */
1673
+ <N extends string>(name: N): <A, E, R>(self: Effect<A, E, R>) => Effect<{
1674
+ [K in N]: A;
1675
+ }, E, R>;
1676
+ /**
1677
+ * Gives a name to the success value of an `Effect`, creating a single-key
1678
+ * record used in do notation pipelines.
1679
+ *
1680
+ * @since 4.0.0
1681
+ * @category Do notation
1682
+ */
1683
+ <A, E, R, N extends string>(self: Effect<A, E, R>, name: N): Effect<{
1684
+ [K in N]: A;
1685
+ }, E, R>;
1686
+ };
1687
+ declare const let_: {
1688
+ <N extends string, A extends Record<string, any>, B>(name: N, f: (a: NoInfer<A>) => B): <E, R>(self: Effect<A, E, R>) => Effect<Simplify<Omit<A, N> & Record<N, B>>, E, R>;
1689
+ <A extends Record<string, any>, E, R, B, N extends string>(self: Effect<A, E, R>, name: N, f: (a: NoInfer<A>) => B): Effect<Simplify<Omit<A, N> & Record<N, B>>, E, R>;
1690
+ };
1691
+ export {
1692
+ /**
1693
+ * Adds a computed plain value to the do notation record.
1694
+ *
1695
+ * @since 4.0.0
1696
+ * @category Do notation
1697
+ */
1698
+ let_ as let };
1699
+ /**
1700
+ * Adds an `Effect` value to the do notation record under a given name.
1701
+ *
1702
+ * @since 4.0.0
1703
+ * @category Do notation
1704
+ */
1705
+ export declare const bind: {
1706
+ /**
1707
+ * Adds an `Effect` value to the do notation record under a given name.
1708
+ *
1709
+ * @since 4.0.0
1710
+ * @category Do notation
1711
+ */
1712
+ <N extends string, A extends Record<string, any>, B, E2, R2>(name: N, f: (a: NoInfer<A>) => Effect<B, E2, R2>): <E, R>(self: Effect<A, E, R>) => Effect<Simplify<Omit<A, N> & Record<N, B>>, E | E2, R | R2>;
1713
+ /**
1714
+ * Adds an `Effect` value to the do notation record under a given name.
1715
+ *
1716
+ * @since 4.0.0
1717
+ * @category Do notation
1718
+ */
1719
+ <A extends Record<string, any>, E, R, B, E2, R2, N extends string>(self: Effect<A, E, R>, name: N, f: (a: NoInfer<A>) => Effect<B, E2, R2>): Effect<Simplify<Omit<A, N> & Record<N, B>>, E | E2, R | R2>;
1720
+ };
1355
1721
  /**
1356
1722
  * Provides a way to write effectful code using generator functions, simplifying
1357
1723
  * control flow and error handling.
@@ -1369,16 +1735,18 @@ export declare const never: Effect<never>;
1369
1735
  *
1370
1736
  * @example
1371
1737
  * ```ts
1372
- * import { Effect } from "effect"
1738
+ * import { Data, Effect } from "effect"
1739
+ *
1740
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1373
1741
  *
1374
1742
  * const addServiceCharge = (amount: number) => amount + 1
1375
1743
  *
1376
1744
  * const applyDiscount = (
1377
1745
  * total: number,
1378
1746
  * discountRate: number
1379
- * ): Effect.Effect<number, Error> =>
1747
+ * ): Effect.Effect<number, DiscountRateError> =>
1380
1748
  * discountRate === 0
1381
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
1749
+ * ? Effect.fail(new DiscountRateError())
1382
1750
  * : Effect.succeed(total - (total * discountRate) / 100)
1383
1751
  *
1384
1752
  * const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))
@@ -1418,16 +1786,18 @@ export declare const gen: {
1418
1786
  *
1419
1787
  * @example
1420
1788
  * ```ts
1421
- * import { Effect } from "effect"
1789
+ * import { Data, Effect } from "effect"
1790
+ *
1791
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1422
1792
  *
1423
1793
  * const addServiceCharge = (amount: number) => amount + 1
1424
1794
  *
1425
1795
  * const applyDiscount = (
1426
1796
  * total: number,
1427
1797
  * discountRate: number
1428
- * ): Effect.Effect<number, Error> =>
1798
+ * ): Effect.Effect<number, DiscountRateError> =>
1429
1799
  * discountRate === 0
1430
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
1800
+ * ? Effect.fail(new DiscountRateError())
1431
1801
  * : Effect.succeed(total - (total * discountRate) / 100)
1432
1802
  *
1433
1803
  * const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))
@@ -1471,16 +1841,18 @@ export declare const gen: {
1471
1841
  *
1472
1842
  * @example
1473
1843
  * ```ts
1474
- * import { Effect } from "effect"
1844
+ * import { Data, Effect } from "effect"
1845
+ *
1846
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1475
1847
  *
1476
1848
  * const addServiceCharge = (amount: number) => amount + 1
1477
1849
  *
1478
1850
  * const applyDiscount = (
1479
1851
  * total: number,
1480
1852
  * discountRate: number
1481
- * ): Effect.Effect<number, Error> =>
1853
+ * ): Effect.Effect<number, DiscountRateError> =>
1482
1854
  * discountRate === 0
1483
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
1855
+ * ? Effect.fail(new DiscountRateError())
1484
1856
  * : Effect.succeed(total - (total * discountRate) / 100)
1485
1857
  *
1486
1858
  * const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))
@@ -1535,12 +1907,14 @@ export declare namespace gen {
1535
1907
  * @example
1536
1908
  * ```ts
1537
1909
  * // Title: Creating a Failed Effect
1538
- * import { Effect } from "effect"
1910
+ * import { Data, Effect } from "effect"
1911
+ *
1912
+ * class OperationFailedError extends Data.TaggedError("OperationFailedError")<{}> {}
1539
1913
  *
1540
- * // ┌─── Effect<never, Error, never>
1914
+ * // ┌─── Effect<never, OperationFailedError, never>
1541
1915
  * // ▼
1542
1916
  * const failure = Effect.fail(
1543
- * new Error("Operation failed due to network error")
1917
+ * new OperationFailedError()
1544
1918
  * )
1545
1919
  * ```
1546
1920
  *
@@ -1556,9 +1930,11 @@ export declare const fail: <E>(error: E) => Effect<never, E>;
1556
1930
  *
1557
1931
  * @example
1558
1932
  * ```ts
1559
- * import { Effect } from "effect"
1933
+ * import { Data, Effect } from "effect"
1560
1934
  *
1561
- * const program = Effect.failSync(() => new Error("Something went wrong"))
1935
+ * class ProgramError extends Data.TaggedError("ProgramError")<{ readonly failedAt: Date }> {}
1936
+ *
1937
+ * const program = Effect.failSync(() => new ProgramError({ failedAt: new Date() }))
1562
1938
  *
1563
1939
  * Effect.runPromiseExit(program).then(console.log)
1564
1940
  * // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
@@ -1705,12 +2081,14 @@ export {
1705
2081
  *
1706
2082
  * @example Custom Error Handling
1707
2083
  * ```ts
1708
- * import { Effect } from "effect"
2084
+ * import { Data, Effect } from "effect"
2085
+ *
2086
+ * class JsonParsingError extends Data.TaggedError("JsonParsingError")<{ readonly cause: unknown }> {}
1709
2087
  *
1710
2088
  * const parseJSON = (input: string) =>
1711
2089
  * Effect.try({
1712
2090
  * try: () => JSON.parse(input),
1713
- * catch: (error) => new Error(`JSON parsing failed: ${error}`)
2091
+ * catch: (cause) => new JsonParsingError({ cause })
1714
2092
  * })
1715
2093
  *
1716
2094
  * Effect.runPromiseExit(parseJSON("invalid json")).then(console.log)
@@ -1832,17 +2210,17 @@ export declare const fromOption: <A>(option: Option<A>) => Effect<A, Cause.NoSuc
1832
2210
  * ```ts
1833
2211
  * import { Console, Effect } from "effect"
1834
2212
  *
1835
- * const input: string | null = null
1836
- *
1837
- * const program = Effect.gen(function*() {
2213
+ * const program = Effect.fn(function*(input: string | null) {
1838
2214
  * const value = yield* Effect.fromNullishOr(input)
1839
2215
  * yield* Console.log(value)
1840
- * }).pipe(
2216
+ * },
1841
2217
  * Effect.catch(() => Console.log("missing"))
1842
2218
  * )
1843
2219
  *
1844
- * Effect.runPromise(program)
2220
+ * Effect.runPromise(program(null))
1845
2221
  * // Output: missing
2222
+ * Effect.runPromise(program("hello"))
2223
+ * // Output: hello
1846
2224
  * ```
1847
2225
  *
1848
2226
  * @since 4.0.0
@@ -1903,15 +2281,17 @@ export declare const fromYieldable: <Self extends Yieldable.Any, A, E, R>(yielda
1903
2281
  *
1904
2282
  * @example
1905
2283
  * ```ts
1906
- * import { Effect, pipe } from "effect"
2284
+ * import { Data, Effect, pipe } from "effect"
2285
+ *
2286
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1907
2287
  *
1908
2288
  * // Function to apply a discount safely to a transaction amount
1909
2289
  * const applyDiscount = (
1910
2290
  * total: number,
1911
2291
  * discountRate: number
1912
- * ): Effect.Effect<number, Error> =>
2292
+ * ): Effect.Effect<number, DiscountRateError> =>
1913
2293
  * discountRate === 0
1914
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2294
+ * ? Effect.fail(new DiscountRateError())
1915
2295
  * : Effect.succeed(total - (total * discountRate) / 100)
1916
2296
  *
1917
2297
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -1965,15 +2345,17 @@ export declare const flatMap: {
1965
2345
  *
1966
2346
  * @example
1967
2347
  * ```ts
1968
- * import { Effect, pipe } from "effect"
2348
+ * import { Data, Effect, pipe } from "effect"
2349
+ *
2350
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1969
2351
  *
1970
2352
  * // Function to apply a discount safely to a transaction amount
1971
2353
  * const applyDiscount = (
1972
2354
  * total: number,
1973
2355
  * discountRate: number
1974
- * ): Effect.Effect<number, Error> =>
2356
+ * ): Effect.Effect<number, DiscountRateError> =>
1975
2357
  * discountRate === 0
1976
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2358
+ * ? Effect.fail(new DiscountRateError())
1977
2359
  * : Effect.succeed(total - (total * discountRate) / 100)
1978
2360
  *
1979
2361
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2027,15 +2409,17 @@ export declare const flatMap: {
2027
2409
  *
2028
2410
  * @example
2029
2411
  * ```ts
2030
- * import { Effect, pipe } from "effect"
2412
+ * import { Data, Effect, pipe } from "effect"
2413
+ *
2414
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
2031
2415
  *
2032
2416
  * // Function to apply a discount safely to a transaction amount
2033
2417
  * const applyDiscount = (
2034
2418
  * total: number,
2035
2419
  * discountRate: number
2036
- * ): Effect.Effect<number, Error> =>
2420
+ * ): Effect.Effect<number, DiscountRateError> =>
2037
2421
  * discountRate === 0
2038
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2422
+ * ? Effect.fail(new DiscountRateError())
2039
2423
  * : Effect.succeed(total - (total * discountRate) / 100)
2040
2424
  *
2041
2425
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2120,15 +2504,17 @@ export declare const flatten: <A, E, R, E2, R2>(self: Effect<Effect<A, E, R>, E2
2120
2504
  *
2121
2505
  * @example Applying a Discount Based on Fetched Amount
2122
2506
  * ```ts
2123
- * import { Effect, pipe } from "effect"
2507
+ * import { Data, Effect, pipe } from "effect"
2508
+ *
2509
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
2124
2510
  *
2125
2511
  * // Function to apply a discount safely to a transaction amount
2126
2512
  * const applyDiscount = (
2127
2513
  * total: number,
2128
2514
  * discountRate: number
2129
- * ): Effect.Effect<number, Error> =>
2515
+ * ): Effect.Effect<number, DiscountRateError> =>
2130
2516
  * discountRate === 0
2131
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2517
+ * ? Effect.fail(new DiscountRateError())
2132
2518
  * : Effect.succeed(total - (total * discountRate) / 100)
2133
2519
  *
2134
2520
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2201,15 +2587,17 @@ export declare const andThen: {
2201
2587
  *
2202
2588
  * @example Applying a Discount Based on Fetched Amount
2203
2589
  * ```ts
2204
- * import { Effect, pipe } from "effect"
2590
+ * import { Data, Effect, pipe } from "effect"
2591
+ *
2592
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
2205
2593
  *
2206
2594
  * // Function to apply a discount safely to a transaction amount
2207
2595
  * const applyDiscount = (
2208
2596
  * total: number,
2209
2597
  * discountRate: number
2210
- * ): Effect.Effect<number, Error> =>
2598
+ * ): Effect.Effect<number, DiscountRateError> =>
2211
2599
  * discountRate === 0
2212
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2600
+ * ? Effect.fail(new DiscountRateError())
2213
2601
  * : Effect.succeed(total - (total * discountRate) / 100)
2214
2602
  *
2215
2603
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2282,15 +2670,17 @@ export declare const andThen: {
2282
2670
  *
2283
2671
  * @example Applying a Discount Based on Fetched Amount
2284
2672
  * ```ts
2285
- * import { Effect, pipe } from "effect"
2673
+ * import { Data, Effect, pipe } from "effect"
2674
+ *
2675
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
2286
2676
  *
2287
2677
  * // Function to apply a discount safely to a transaction amount
2288
2678
  * const applyDiscount = (
2289
2679
  * total: number,
2290
2680
  * discountRate: number
2291
- * ): Effect.Effect<number, Error> =>
2681
+ * ): Effect.Effect<number, DiscountRateError> =>
2292
2682
  * discountRate === 0
2293
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2683
+ * ? Effect.fail(new DiscountRateError())
2294
2684
  * : Effect.succeed(total - (total * discountRate) / 100)
2295
2685
  *
2296
2686
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2363,15 +2753,17 @@ export declare const andThen: {
2363
2753
  *
2364
2754
  * @example Applying a Discount Based on Fetched Amount
2365
2755
  * ```ts
2366
- * import { Effect, pipe } from "effect"
2756
+ * import { Data, Effect, pipe } from "effect"
2757
+ *
2758
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
2367
2759
  *
2368
2760
  * // Function to apply a discount safely to a transaction amount
2369
2761
  * const applyDiscount = (
2370
2762
  * total: number,
2371
2763
  * discountRate: number
2372
- * ): Effect.Effect<number, Error> =>
2764
+ * ): Effect.Effect<number, DiscountRateError> =>
2373
2765
  * discountRate === 0
2374
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2766
+ * ? Effect.fail(new DiscountRateError())
2375
2767
  * : Effect.succeed(total - (total * discountRate) / 100)
2376
2768
  *
2377
2769
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2444,15 +2836,17 @@ export declare const andThen: {
2444
2836
  *
2445
2837
  * @example Applying a Discount Based on Fetched Amount
2446
2838
  * ```ts
2447
- * import { Effect, pipe } from "effect"
2839
+ * import { Data, Effect, pipe } from "effect"
2840
+ *
2841
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
2448
2842
  *
2449
2843
  * // Function to apply a discount safely to a transaction amount
2450
2844
  * const applyDiscount = (
2451
2845
  * total: number,
2452
2846
  * discountRate: number
2453
- * ): Effect.Effect<number, Error> =>
2847
+ * ): Effect.Effect<number, DiscountRateError> =>
2454
2848
  * discountRate === 0
2455
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2849
+ * ? Effect.fail(new DiscountRateError())
2456
2850
  * : Effect.succeed(total - (total * discountRate) / 100)
2457
2851
  *
2458
2852
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2510,16 +2904,18 @@ export declare const andThen: {
2510
2904
  * @example
2511
2905
  * ```ts
2512
2906
  * // Title: Logging a step in a pipeline
2513
- * import { Effect, pipe } from "effect"
2907
+ * import { Data, Effect, pipe } from "effect"
2514
2908
  * import { Console } from "effect"
2515
2909
  *
2910
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
2911
+ *
2516
2912
  * // Function to apply a discount safely to a transaction amount
2517
2913
  * const applyDiscount = (
2518
2914
  * total: number,
2519
2915
  * discountRate: number
2520
- * ): Effect.Effect<number, Error> =>
2916
+ * ): Effect.Effect<number, DiscountRateError> =>
2521
2917
  * discountRate === 0
2522
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2918
+ * ? Effect.fail(new DiscountRateError())
2523
2919
  * : Effect.succeed(total - (total * discountRate) / 100)
2524
2920
  *
2525
2921
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2569,16 +2965,18 @@ export declare const tap: {
2569
2965
  * @example
2570
2966
  * ```ts
2571
2967
  * // Title: Logging a step in a pipeline
2572
- * import { Effect, pipe } from "effect"
2968
+ * import { Data, Effect, pipe } from "effect"
2573
2969
  * import { Console } from "effect"
2574
2970
  *
2971
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
2972
+ *
2575
2973
  * // Function to apply a discount safely to a transaction amount
2576
2974
  * const applyDiscount = (
2577
2975
  * total: number,
2578
2976
  * discountRate: number
2579
- * ): Effect.Effect<number, Error> =>
2977
+ * ): Effect.Effect<number, DiscountRateError> =>
2580
2978
  * discountRate === 0
2581
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
2979
+ * ? Effect.fail(new DiscountRateError())
2582
2980
  * : Effect.succeed(total - (total * discountRate) / 100)
2583
2981
  *
2584
2982
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2628,16 +3026,18 @@ export declare const tap: {
2628
3026
  * @example
2629
3027
  * ```ts
2630
3028
  * // Title: Logging a step in a pipeline
2631
- * import { Effect, pipe } from "effect"
3029
+ * import { Data, Effect, pipe } from "effect"
2632
3030
  * import { Console } from "effect"
2633
3031
  *
3032
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
3033
+ *
2634
3034
  * // Function to apply a discount safely to a transaction amount
2635
3035
  * const applyDiscount = (
2636
3036
  * total: number,
2637
3037
  * discountRate: number
2638
- * ): Effect.Effect<number, Error> =>
3038
+ * ): Effect.Effect<number, DiscountRateError> =>
2639
3039
  * discountRate === 0
2640
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
3040
+ * ? Effect.fail(new DiscountRateError())
2641
3041
  * : Effect.succeed(total - (total * discountRate) / 100)
2642
3042
  *
2643
3043
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2687,16 +3087,18 @@ export declare const tap: {
2687
3087
  * @example
2688
3088
  * ```ts
2689
3089
  * // Title: Logging a step in a pipeline
2690
- * import { Effect, pipe } from "effect"
3090
+ * import { Data, Effect, pipe } from "effect"
2691
3091
  * import { Console } from "effect"
2692
3092
  *
3093
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
3094
+ *
2693
3095
  * // Function to apply a discount safely to a transaction amount
2694
3096
  * const applyDiscount = (
2695
3097
  * total: number,
2696
3098
  * discountRate: number
2697
- * ): Effect.Effect<number, Error> =>
3099
+ * ): Effect.Effect<number, DiscountRateError> =>
2698
3100
  * discountRate === 0
2699
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
3101
+ * ? Effect.fail(new DiscountRateError())
2700
3102
  * : Effect.succeed(total - (total * discountRate) / 100)
2701
3103
  *
2702
3104
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -2746,16 +3148,18 @@ export declare const tap: {
2746
3148
  * @example
2747
3149
  * ```ts
2748
3150
  * // Title: Logging a step in a pipeline
2749
- * import { Effect, pipe } from "effect"
3151
+ * import { Data, Effect, pipe } from "effect"
2750
3152
  * import { Console } from "effect"
2751
3153
  *
3154
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
3155
+ *
2752
3156
  * // Function to apply a discount safely to a transaction amount
2753
3157
  * const applyDiscount = (
2754
3158
  * total: number,
2755
3159
  * discountRate: number
2756
- * ): Effect.Effect<number, Error> =>
3160
+ * ): Effect.Effect<number, DiscountRateError> =>
2757
3161
  * discountRate === 0
2758
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
3162
+ * ? Effect.fail(new DiscountRateError())
2759
3163
  * : Effect.succeed(total - (total * discountRate) / 100)
2760
3164
  *
2761
3165
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -3538,12 +3942,12 @@ export {
3538
3942
  *
3539
3943
  * **Details**
3540
3944
  *
3541
- * The `catchAll` function catches any errors that may occur during the
3945
+ * The `catch` function catches any errors that may occur during the
3542
3946
  * execution of an effect and allows you to handle them by specifying a fallback
3543
3947
  * effect. This ensures that the program continues without failing by recovering
3544
3948
  * from errors using the provided fallback logic.
3545
3949
  *
3546
- * **Note**: `catchAll` only handles recoverable errors. It will not recover
3950
+ * **Note**: `catch` only handles recoverable errors. It will not recover
3547
3951
  * from unrecoverable defects.
3548
3952
  *
3549
3953
  * @see {@link catchCause} for a version that can recover from both recoverable and unrecoverable errors.
@@ -3691,7 +4095,8 @@ export declare const catchTag: {
3691
4095
  * once. Instead of using {@link catchTag} multiple times, you can pass an
3692
4096
  * object where each key is an error type's `_tag`, and the value is the handler
3693
4097
  * for that specific error. This allows you to catch and recover from multiple
3694
- * error types in a single call.
4098
+ * error types in a single call. You can also provide a fallback handler for
4099
+ * unhandled errors.
3695
4100
  *
3696
4101
  * The error type must have a readonly `_tag` field to use `catchTag`. This
3697
4102
  * field is used to identify and match errors.
@@ -3733,7 +4138,8 @@ export declare const catchTags: {
3733
4138
  * once. Instead of using {@link catchTag} multiple times, you can pass an
3734
4139
  * object where each key is an error type's `_tag`, and the value is the handler
3735
4140
  * for that specific error. This allows you to catch and recover from multiple
3736
- * error types in a single call.
4141
+ * error types in a single call. You can also provide a fallback handler for
4142
+ * unhandled errors.
3737
4143
  *
3738
4144
  * The error type must have a readonly `_tag` field to use `catchTag`. This
3739
4145
  * field is used to identify and match errors.
@@ -3775,13 +4181,15 @@ export declare const catchTags: {
3775
4181
  [K in Exclude<keyof Cases, Extract<E, {
3776
4182
  _tag: string;
3777
4183
  }>["_tag"]>]: never;
3778
- })>(cases: Cases): <A, R>(self: Effect<A, E, R>) => Effect<A | {
3779
- [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
3780
- }[keyof Cases], Exclude<E, {
4184
+ }), A2 = never, E2 = Exclude<E, {
4185
+ _tag: keyof Cases;
4186
+ }>, R2 = never>(cases: Cases, orElse?: ((e: Exclude<E, {
3781
4187
  _tag: keyof Cases;
3782
- }> | {
4188
+ }>) => Effect<A2, E2, R2>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | {
4189
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
4190
+ }[keyof Cases], E2 | {
3783
4191
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
3784
- }[keyof Cases], R | {
4192
+ }[keyof Cases], R | R2 | {
3785
4193
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<any, any, infer R> ? R : never;
3786
4194
  }[keyof Cases]>;
3787
4195
  /**
@@ -3793,7 +4201,8 @@ export declare const catchTags: {
3793
4201
  * once. Instead of using {@link catchTag} multiple times, you can pass an
3794
4202
  * object where each key is an error type's `_tag`, and the value is the handler
3795
4203
  * for that specific error. This allows you to catch and recover from multiple
3796
- * error types in a single call.
4204
+ * error types in a single call. You can also provide a fallback handler for
4205
+ * unhandled errors.
3797
4206
  *
3798
4207
  * The error type must have a readonly `_tag` field to use `catchTag`. This
3799
4208
  * field is used to identify and match errors.
@@ -3835,13 +4244,15 @@ export declare const catchTags: {
3835
4244
  [K in Exclude<keyof Cases, Extract<E, {
3836
4245
  _tag: string;
3837
4246
  }>["_tag"]>]: never;
3838
- })>(self: Effect<A, E, R>, cases: Cases): Effect<A | {
3839
- [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
3840
- }[keyof Cases], Exclude<E, {
4247
+ }), A2 = never, E2 = Exclude<E, {
4248
+ _tag: keyof Cases;
4249
+ }>, R2 = never>(self: Effect<A, E, R>, cases: Cases, orElse?: ((e: Exclude<E, {
3841
4250
  _tag: keyof Cases;
3842
- }> | {
4251
+ }>) => Effect<A2, E2, R2>) | undefined): Effect<A | A2 | {
4252
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
4253
+ }[keyof Cases], E2 | {
3843
4254
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
3844
- }[keyof Cases], R | {
4255
+ }[keyof Cases], R | R2 | {
3845
4256
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect<any, any, infer R> ? R : never;
3846
4257
  }[keyof Cases]>;
3847
4258
  };
@@ -3916,7 +4327,7 @@ export declare const catchReason: {
3916
4327
  * @since 4.0.0
3917
4328
  * @category Error Handling
3918
4329
  */
3919
- <K extends Tags<E>, E, RK extends ReasonTags<ExtractTag<NoInfer<E>, K>>, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(errorTag: K, reasonTag: RK, f: (reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<A2, E2, R2>, orElse?: ((reasons: ExcludeReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>;
4330
+ <K extends Tags<E>, E, RK extends ReasonTags<ExtractTag<NoInfer<E>, K>>, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(errorTag: K, reasonTag: RK, f: (reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>, error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<A2, E2, R2>, orElse?: ((reasons: ExcludeReason<ExtractTag<NoInfer<E>, K>, RK>, error: OmitReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>;
3920
4331
  /**
3921
4332
  * Catches a specific reason within a tagged error.
3922
4333
  *
@@ -3952,7 +4363,7 @@ export declare const catchReason: {
3952
4363
  * @since 4.0.0
3953
4364
  * @category Error Handling
3954
4365
  */
3955
- <A, E, R, K extends Tags<E>, RK extends ReasonTags<ExtractTag<E, K>>, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(self: Effect<A, E, R>, errorTag: K, reasonTag: RK, f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Effect<A2, E2, R2>, orElse?: ((reasons: ExcludeReason<ExtractTag<E, K>, RK>) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>;
4366
+ <A, E, R, K extends Tags<E>, RK extends ReasonTags<ExtractTag<E, K>>, A2, E2, R2, A3 = unassigned, E3 = never, R3 = never>(self: Effect<A, E, R>, errorTag: K, reasonTag: RK, f: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Effect<A2, E2, R2>, orElse?: ((reasons: ExcludeReason<ExtractTag<E, K>, RK>, error: OmitReason<ExtractTag<E, K>, RK>) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>;
3956
4367
  };
3957
4368
  /**
3958
4369
  * Catches multiple reasons within a tagged error using an object of handlers.
@@ -4024,8 +4435,8 @@ export declare const catchReasons: {
4024
4435
  * @category Error Handling
4025
4436
  */
4026
4437
  <K extends Tags<E>, E, Cases extends {
4027
- [RK in ReasonTags<ExtractTag<NoInfer<E>, K>>]+?: (reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<any, any, any>;
4028
- }, A2 = unassigned, E2 = never, R2 = never>(errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Effect<A2, E2, R2>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | Exclude<A2, unassigned> | {
4438
+ [RK in ReasonTags<ExtractTag<NoInfer<E>, K>>]+?: (reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>, error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>) => Effect<any, any, any>;
4439
+ }, A2 = unassigned, E2 = never, R2 = never>(errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>, error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Effect<A2, E2, R2>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | Exclude<A2, unassigned> | {
4029
4440
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
4030
4441
  }[keyof Cases], (A2 extends unassigned ? E : ExcludeTag<E, K>) | E2 | {
4031
4442
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
@@ -4067,8 +4478,8 @@ export declare const catchReasons: {
4067
4478
  * @category Error Handling
4068
4479
  */
4069
4480
  <A, E, R, K extends Tags<E>, Cases extends {
4070
- [RK in ReasonTags<ExtractTag<E, K>>]+?: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Effect<any, any, any>;
4071
- }, A2 = unassigned, E2 = never, R2 = never>(self: Effect<A, E, R>, errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Effect<A2, E2, R2>) | undefined): Effect<A | Exclude<A2, unassigned> | {
4481
+ [RK in ReasonTags<ExtractTag<E, K>>]+?: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Effect<any, any, any>;
4482
+ }, A2 = unassigned, E2 = never, R2 = never>(self: Effect<A, E, R>, errorTag: K, cases: Cases, orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>, error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Effect<A2, E2, R2>) | undefined): Effect<A | Exclude<A2, unassigned> | {
4072
4483
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
4073
4484
  }[keyof Cases], (A2 extends unassigned ? E : ExcludeTag<E, K>) | E2 | {
4074
4485
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
@@ -4469,15 +4880,14 @@ export declare const catchDefect: {
4469
4880
  <A, E, R, A2, E2, R2>(self: Effect<A, E, R>, f: (defect: unknown) => Effect<A2, E2, R2>): Effect<A | A2, E | E2, R | R2>;
4470
4881
  };
4471
4882
  /**
4472
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4473
- * `Refinement`.
4883
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4474
4884
  *
4475
4885
  * **When to Use**
4476
4886
  *
4477
- * `catchIf` lets you recover from errors that match a condition. Pass a
4478
- * `Filter` for transformation, a `Refinement` for type narrowing, or a
4479
- * `Predicate` for simple boolean matching. Non-matching errors re-fail with
4480
- * the original cause. Defects and interrupts are not caught.
4887
+ * `catchIf` lets you recover from errors that match a condition. Use a
4888
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4889
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4890
+ * interrupts are not caught.
4481
4891
  *
4482
4892
  * **Previously Known As**
4483
4893
  *
@@ -4504,7 +4914,7 @@ export declare const catchDefect: {
4504
4914
  *
4505
4915
  * // With a Filter
4506
4916
  * const recovered2 = program.pipe(
4507
- * Effect.catchIf(
4917
+ * Effect.catchFilter(
4508
4918
  * Filter.tagged("NotFound"),
4509
4919
  * (error) => Effect.succeed(`missing:${error.id}`)
4510
4920
  * )
@@ -4516,15 +4926,14 @@ export declare const catchDefect: {
4516
4926
  */
4517
4927
  export declare const catchIf: {
4518
4928
  /**
4519
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4520
- * `Refinement`.
4929
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4521
4930
  *
4522
4931
  * **When to Use**
4523
4932
  *
4524
- * `catchIf` lets you recover from errors that match a condition. Pass a
4525
- * `Filter` for transformation, a `Refinement` for type narrowing, or a
4526
- * `Predicate` for simple boolean matching. Non-matching errors re-fail with
4527
- * the original cause. Defects and interrupts are not caught.
4933
+ * `catchIf` lets you recover from errors that match a condition. Use a
4934
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4935
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4936
+ * interrupts are not caught.
4528
4937
  *
4529
4938
  * **Previously Known As**
4530
4939
  *
@@ -4551,7 +4960,7 @@ export declare const catchIf: {
4551
4960
  *
4552
4961
  * // With a Filter
4553
4962
  * const recovered2 = program.pipe(
4554
- * Effect.catchIf(
4963
+ * Effect.catchFilter(
4555
4964
  * Filter.tagged("NotFound"),
4556
4965
  * (error) => Effect.succeed(`missing:${error.id}`)
4557
4966
  * )
@@ -4563,15 +4972,14 @@ export declare const catchIf: {
4563
4972
  */
4564
4973
  <E, EB extends E, A2, E2, R2, A3 = never, E3 = Exclude<E, EB>, R3 = never>(refinement: Predicate.Refinement<NoInfer<E>, EB>, f: (e: EB) => Effect<A2, E2, R2>, orElse?: ((e: Exclude<E, EB>) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
4565
4974
  /**
4566
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4567
- * `Refinement`.
4975
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4568
4976
  *
4569
4977
  * **When to Use**
4570
4978
  *
4571
- * `catchIf` lets you recover from errors that match a condition. Pass a
4572
- * `Filter` for transformation, a `Refinement` for type narrowing, or a
4573
- * `Predicate` for simple boolean matching. Non-matching errors re-fail with
4574
- * the original cause. Defects and interrupts are not caught.
4979
+ * `catchIf` lets you recover from errors that match a condition. Use a
4980
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4981
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4982
+ * interrupts are not caught.
4575
4983
  *
4576
4984
  * **Previously Known As**
4577
4985
  *
@@ -4598,7 +5006,7 @@ export declare const catchIf: {
4598
5006
  *
4599
5007
  * // With a Filter
4600
5008
  * const recovered2 = program.pipe(
4601
- * Effect.catchIf(
5009
+ * Effect.catchFilter(
4602
5010
  * Filter.tagged("NotFound"),
4603
5011
  * (error) => Effect.succeed(`missing:${error.id}`)
4604
5012
  * )
@@ -4608,17 +5016,16 @@ export declare const catchIf: {
4608
5016
  * @since 2.0.0
4609
5017
  * @category Error Handling
4610
5018
  */
4611
- <E, Result extends Filter.ResultOrBool, A2, E2, R2, A3 = never, E3 = Filter.Fail<E, Result>, R3 = never>(filter: Filter.OrPredicate<NoInfer<E>, Result>, f: (e: Filter.Pass<E, Result>) => Effect<A2, E2, R2>, orElse?: ((e: Filter.Fail<E, Result>) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
5019
+ <E, A2, E2, R2, A3 = never, E3 = E, R3 = never>(predicate: Predicate.Predicate<NoInfer<E>>, f: (e: NoInfer<E>) => Effect<A2, E2, R2>, orElse?: ((e: NoInfer<E>) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
4612
5020
  /**
4613
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4614
- * `Refinement`.
5021
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4615
5022
  *
4616
5023
  * **When to Use**
4617
5024
  *
4618
- * `catchIf` lets you recover from errors that match a condition. Pass a
4619
- * `Filter` for transformation, a `Refinement` for type narrowing, or a
4620
- * `Predicate` for simple boolean matching. Non-matching errors re-fail with
4621
- * the original cause. Defects and interrupts are not caught.
5025
+ * `catchIf` lets you recover from errors that match a condition. Use a
5026
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
5027
+ * matching. Non-matching errors re-fail with the original cause. Defects and
5028
+ * interrupts are not caught.
4622
5029
  *
4623
5030
  * **Previously Known As**
4624
5031
  *
@@ -4645,7 +5052,7 @@ export declare const catchIf: {
4645
5052
  *
4646
5053
  * // With a Filter
4647
5054
  * const recovered2 = program.pipe(
4648
- * Effect.catchIf(
5055
+ * Effect.catchFilter(
4649
5056
  * Filter.tagged("NotFound"),
4650
5057
  * (error) => Effect.succeed(`missing:${error.id}`)
4651
5058
  * )
@@ -4657,15 +5064,14 @@ export declare const catchIf: {
4657
5064
  */
4658
5065
  <A, E, R, EB extends E, A2, E2, R2, A3 = never, E3 = Exclude<E, EB>, R3 = never>(self: Effect<A, E, R>, refinement: Predicate.Refinement<E, EB>, f: (e: EB) => Effect<A2, E2, R2>, orElse?: ((e: Exclude<E, EB>) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
4659
5066
  /**
4660
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4661
- * `Refinement`.
5067
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4662
5068
  *
4663
5069
  * **When to Use**
4664
5070
  *
4665
- * `catchIf` lets you recover from errors that match a condition. Pass a
4666
- * `Filter` for transformation, a `Refinement` for type narrowing, or a
4667
- * `Predicate` for simple boolean matching. Non-matching errors re-fail with
4668
- * the original cause. Defects and interrupts are not caught.
5071
+ * `catchIf` lets you recover from errors that match a condition. Use a
5072
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
5073
+ * matching. Non-matching errors re-fail with the original cause. Defects and
5074
+ * interrupts are not caught.
4669
5075
  *
4670
5076
  * **Previously Known As**
4671
5077
  *
@@ -4692,7 +5098,7 @@ export declare const catchIf: {
4692
5098
  *
4693
5099
  * // With a Filter
4694
5100
  * const recovered2 = program.pipe(
4695
- * Effect.catchIf(
5101
+ * Effect.catchFilter(
4696
5102
  * Filter.tagged("NotFound"),
4697
5103
  * (error) => Effect.succeed(`missing:${error.id}`)
4698
5104
  * )
@@ -4702,7 +5108,29 @@ export declare const catchIf: {
4702
5108
  * @since 2.0.0
4703
5109
  * @category Error Handling
4704
5110
  */
4705
- <A, E, R, Result extends Filter.ResultOrBool, A2, E2, R2, A3 = never, E3 = Filter.Fail<E, Result>, R3 = never>(self: Effect<A, E, R>, filter: Filter.OrPredicate<NoInfer<E>, Result>, f: (e: Filter.Pass<E, Result>) => Effect<A2, E2, R2>, orElse?: ((e: Filter.Fail<E, Result>) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
5111
+ <A, E, R, A2, E2, R2, A3 = never, E3 = E, R3 = never>(self: Effect<A, E, R>, predicate: Predicate.Predicate<E>, f: (e: E) => Effect<A2, E2, R2>, orElse?: ((e: E) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
5112
+ };
5113
+ /**
5114
+ * Recovers from specific errors using a `Filter`.
5115
+ *
5116
+ * @since 4.0.0
5117
+ * @category Error Handling
5118
+ */
5119
+ export declare const catchFilter: {
5120
+ /**
5121
+ * Recovers from specific errors using a `Filter`.
5122
+ *
5123
+ * @since 4.0.0
5124
+ * @category Error Handling
5125
+ */
5126
+ <E, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(filter: Filter.Filter<NoInfer<E>, EB, X>, f: (e: EB) => Effect<A2, E2, R2>, orElse?: ((e: X) => Effect<A3, E3, R3>) | undefined): <A, R>(self: Effect<A, E, R>) => Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
5127
+ /**
5128
+ * Recovers from specific errors using a `Filter`.
5129
+ *
5130
+ * @since 4.0.0
5131
+ * @category Error Handling
5132
+ */
5133
+ <A, E, R, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(self: Effect<A, E, R>, filter: Filter.Filter<NoInfer<E>, EB, X>, f: (e: EB) => Effect<A2, E2, R2>, orElse?: ((e: X) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
4706
5134
  };
4707
5135
  /**
4708
5136
  * Catches `NoSuchElementError` failures and converts them to `Option.none`.
@@ -4808,7 +5236,7 @@ export declare const catchCauseIf: {
4808
5236
  * @since 4.0.0
4809
5237
  * @category Error Handling
4810
5238
  */
4811
- <E, Result extends Filter.ResultOrBool<Cause.Cause<any>>, B, E2, R2>(filter: Filter.OrPredicate<Cause.Cause<E>, Result>, f: (failure: Filter.Pass<Cause.Cause<E>, Result>, cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A | B, Cause.Cause.Error<Filter.Fail<Cause.Cause<E>, Result>> | E2, R | R2>;
5239
+ <E, B, E2, R2>(predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A | B, E | E2, R | R2>;
4812
5240
  /**
4813
5241
  * Recovers from specific failures based on a predicate.
4814
5242
  *
@@ -4847,7 +5275,29 @@ export declare const catchCauseIf: {
4847
5275
  * @since 4.0.0
4848
5276
  * @category Error Handling
4849
5277
  */
4850
- <A, E, R, B, E2, R2, Result extends Filter.ResultOrBool<Cause.Cause<any>>>(self: Effect<A, E, R>, filter: Filter.OrPredicate<Cause.Cause<E>, Result>, f: (failure: Filter.Pass<Cause.Cause<E>, Result>, cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A | B, Cause.Cause.Error<Filter.Fail<Cause.Cause<E>, Result>> | E2, R | R2>;
5278
+ <A, E, R, B, E2, R2>(self: Effect<A, E, R>, predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A | B, E | E2, R | R2>;
5279
+ };
5280
+ /**
5281
+ * Recovers from specific failures based on a `Filter`.
5282
+ *
5283
+ * @since 4.0.0
5284
+ * @category Error Handling
5285
+ */
5286
+ export declare const catchCauseFilter: {
5287
+ /**
5288
+ * Recovers from specific failures based on a `Filter`.
5289
+ *
5290
+ * @since 4.0.0
5291
+ * @category Error Handling
5292
+ */
5293
+ <E, B, E2, R2, EB, X extends Cause.Cause<any>>(filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (failure: EB, cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A | B, Cause.Cause.Error<X> | E2, R | R2>;
5294
+ /**
5295
+ * Recovers from specific failures based on a `Filter`.
5296
+ *
5297
+ * @since 4.0.0
5298
+ * @category Error Handling
5299
+ */
5300
+ <A, E, R, B, E2, R2, EB, X extends Cause.Cause<any>>(self: Effect<A, E, R>, filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (failure: EB, cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A | B, Cause.Cause.Error<X> | E2, R | R2>;
4851
5301
  };
4852
5302
  /**
4853
5303
  * The `mapError` function is used to transform or modify the error
@@ -4864,17 +5314,19 @@ export declare const catchCauseIf: {
4864
5314
  *
4865
5315
  * @example
4866
5316
  * ```ts
4867
- * import { Effect } from "effect"
5317
+ * import { Data, Effect } from "effect"
5318
+ *
5319
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
4868
5320
  *
4869
5321
  * // ┌─── Effect<number, string, never>
4870
5322
  * // ▼
4871
5323
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
4872
5324
  *
4873
- * // ┌─── Effect<number, Error, never>
5325
+ * // ┌─── Effect<number, TaskError, never>
4874
5326
  * // ▼
4875
5327
  * const mapped = Effect.mapError(
4876
5328
  * simulatedTask,
4877
- * (message) => new Error(message)
5329
+ * (message) => new TaskError({ message })
4878
5330
  * )
4879
5331
  * ```
4880
5332
  *
@@ -4897,17 +5349,19 @@ export declare const mapError: {
4897
5349
  *
4898
5350
  * @example
4899
5351
  * ```ts
4900
- * import { Effect } from "effect"
5352
+ * import { Data, Effect } from "effect"
5353
+ *
5354
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
4901
5355
  *
4902
5356
  * // ┌─── Effect<number, string, never>
4903
5357
  * // ▼
4904
5358
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
4905
5359
  *
4906
- * // ┌─── Effect<number, Error, never>
5360
+ * // ┌─── Effect<number, TaskError, never>
4907
5361
  * // ▼
4908
5362
  * const mapped = Effect.mapError(
4909
5363
  * simulatedTask,
4910
- * (message) => new Error(message)
5364
+ * (message) => new TaskError({ message })
4911
5365
  * )
4912
5366
  * ```
4913
5367
  *
@@ -4930,17 +5384,19 @@ export declare const mapError: {
4930
5384
  *
4931
5385
  * @example
4932
5386
  * ```ts
4933
- * import { Effect } from "effect"
5387
+ * import { Data, Effect } from "effect"
5388
+ *
5389
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
4934
5390
  *
4935
5391
  * // ┌─── Effect<number, string, never>
4936
5392
  * // ▼
4937
5393
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
4938
5394
  *
4939
- * // ┌─── Effect<number, Error, never>
5395
+ * // ┌─── Effect<number, TaskError, never>
4940
5396
  * // ▼
4941
5397
  * const mapped = Effect.mapError(
4942
5398
  * simulatedTask,
4943
- * (message) => new Error(message)
5399
+ * (message) => new TaskError({ message })
4944
5400
  * )
4945
5401
  * ```
4946
5402
  *
@@ -4961,16 +5417,18 @@ export declare const mapError: {
4961
5417
  *
4962
5418
  * @example
4963
5419
  * ```ts
4964
- * import { Effect } from "effect"
5420
+ * import { Data, Effect } from "effect"
5421
+ *
5422
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
4965
5423
  *
4966
5424
  * // ┌─── Effect<number, string, never>
4967
5425
  * // ▼
4968
5426
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
4969
5427
  *
4970
- * // ┌─── Effect<boolean, Error, never>
5428
+ * // ┌─── Effect<boolean, TaskError, never>
4971
5429
  * // ▼
4972
5430
  * const modified = Effect.mapBoth(simulatedTask, {
4973
- * onFailure: (message) => new Error(message),
5431
+ * onFailure: (message) => new TaskError({ message }),
4974
5432
  * onSuccess: (n) => n > 0
4975
5433
  * })
4976
5434
  * ```
@@ -4994,16 +5452,18 @@ export declare const mapBoth: {
4994
5452
  *
4995
5453
  * @example
4996
5454
  * ```ts
4997
- * import { Effect } from "effect"
5455
+ * import { Data, Effect } from "effect"
5456
+ *
5457
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
4998
5458
  *
4999
5459
  * // ┌─── Effect<number, string, never>
5000
5460
  * // ▼
5001
5461
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
5002
5462
  *
5003
- * // ┌─── Effect<boolean, Error, never>
5463
+ * // ┌─── Effect<boolean, TaskError, never>
5004
5464
  * // ▼
5005
5465
  * const modified = Effect.mapBoth(simulatedTask, {
5006
- * onFailure: (message) => new Error(message),
5466
+ * onFailure: (message) => new TaskError({ message }),
5007
5467
  * onSuccess: (n) => n > 0
5008
5468
  * })
5009
5469
  * ```
@@ -5030,16 +5490,18 @@ export declare const mapBoth: {
5030
5490
  *
5031
5491
  * @example
5032
5492
  * ```ts
5033
- * import { Effect } from "effect"
5493
+ * import { Data, Effect } from "effect"
5494
+ *
5495
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
5034
5496
  *
5035
5497
  * // ┌─── Effect<number, string, never>
5036
5498
  * // ▼
5037
5499
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
5038
5500
  *
5039
- * // ┌─── Effect<boolean, Error, never>
5501
+ * // ┌─── Effect<boolean, TaskError, never>
5040
5502
  * // ▼
5041
5503
  * const modified = Effect.mapBoth(simulatedTask, {
5042
- * onFailure: (message) => new Error(message),
5504
+ * onFailure: (message) => new TaskError({ message }),
5043
5505
  * onSuccess: (n) => n > 0
5044
5506
  * })
5045
5507
  * ```
@@ -5073,11 +5535,13 @@ export declare const mapBoth: {
5073
5535
  * @example
5074
5536
  * ```ts
5075
5537
  * // Title: Propagating an Error as a Defect
5076
- * import { Effect } from "effect"
5538
+ * import { Data, Effect } from "effect"
5539
+ *
5540
+ * class DivideByZeroError extends Data.TaggedError("DivideByZeroError")<{}> {}
5077
5541
  *
5078
5542
  * const divide = (a: number, b: number) =>
5079
5543
  * b === 0
5080
- * ? Effect.fail(new Error("Cannot divide by zero"))
5544
+ * ? Effect.fail(new DivideByZeroError())
5081
5545
  * : Effect.succeed(a / b)
5082
5546
  *
5083
5547
  * // ┌─── Effect<number, never, never>
@@ -5086,7 +5550,7 @@ export declare const mapBoth: {
5086
5550
  *
5087
5551
  * Effect.runPromise(program).catch(console.error)
5088
5552
  * // Output:
5089
- * // (FiberFailure) Error: Cannot divide by zero
5553
+ * // (FiberFailure) DivideByZeroError
5090
5554
  * // ...stack trace...
5091
5555
  * ```
5092
5556
  *
@@ -5454,7 +5918,7 @@ export declare const tapCauseIf: {
5454
5918
  * @since 4.0.0
5455
5919
  * @category Sequencing
5456
5920
  */
5457
- <E, Result extends Filter.ResultOrBool, B, E2, R2>(filter: Filter.OrPredicate<Cause.Cause<E>, Result>, f: (a: Filter.Pass<Cause.Cause<E>, Result>, cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A, E | E2, R | R2>;
5921
+ <E, B, E2, R2>(predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A, E | E2, R | R2>;
5458
5922
  /**
5459
5923
  * Conditionally executes a side effect based on the cause of a failed effect.
5460
5924
  *
@@ -5483,7 +5947,29 @@ export declare const tapCauseIf: {
5483
5947
  * @since 4.0.0
5484
5948
  * @category Sequencing
5485
5949
  */
5486
- <A, E, R, Result extends Filter.ResultOrBool, B, E2, R2>(self: Effect<A, E, R>, filter: Filter.OrPredicate<Cause.Cause<E>, Result>, f: (a: Filter.Pass<Cause.Cause<E>, Result>, cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A, E | E2, R | R2>;
5950
+ <A, E, R, B, E2, R2>(self: Effect<A, E, R>, predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A, E | E2, R | R2>;
5951
+ };
5952
+ /**
5953
+ * Conditionally executes a side effect based on the cause of a failed effect.
5954
+ *
5955
+ * @since 4.0.0
5956
+ * @category Sequencing
5957
+ */
5958
+ export declare const tapCauseFilter: {
5959
+ /**
5960
+ * Conditionally executes a side effect based on the cause of a failed effect.
5961
+ *
5962
+ * @since 4.0.0
5963
+ * @category Sequencing
5964
+ */
5965
+ <E, B, E2, R2, EB, X extends Cause.Cause<any>>(filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (a: EB, cause: Cause.Cause<E>) => Effect<B, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A, E | E2, R | R2>;
5966
+ /**
5967
+ * Conditionally executes a side effect based on the cause of a failed effect.
5968
+ *
5969
+ * @since 4.0.0
5970
+ * @category Sequencing
5971
+ */
5972
+ <A, E, R, B, E2, R2, EB, X extends Cause.Cause<any>>(self: Effect<A, E, R>, filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (a: EB, cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A, E | E2, R | R2>;
5487
5973
  };
5488
5974
  /**
5489
5975
  * Inspect severe errors or defects (non-recoverable failures) in an effect.
@@ -5660,7 +6146,7 @@ export declare const tapDefect: {
5660
6146
  * attempts++
5661
6147
  * yield* Console.log(`Attempt ${attempts}`)
5662
6148
  * if (attempts < 3) {
5663
- * yield* Effect.fail("Not ready")
6149
+ * return yield* Effect.fail("Not ready")
5664
6150
  * }
5665
6151
  * return "Ready"
5666
6152
  * })
@@ -5708,9 +6194,13 @@ export declare namespace Retry {
5708
6194
  */
5709
6195
  type Return<R, E, A, O extends Options<E>> = Effect<A, (O extends {
5710
6196
  schedule: Schedule<infer _O, infer _I, infer _E1, infer _R>;
5711
- } ? E | _E1 : O extends {
6197
+ } ? E : O extends {
6198
+ times: number;
6199
+ } ? E : O extends {
5712
6200
  until: Predicate.Refinement<E, infer E2>;
5713
- } ? E2 : E) | (O extends {
6201
+ } ? E2 : O extends {
6202
+ while: Predicate.Refinement<E, infer E2>;
6203
+ } ? Exclude<E, E2> : E) | (O extends {
5714
6204
  schedule: Schedule<infer _O, infer _I, infer E, infer _R>;
5715
6205
  } ? E : never) | (O extends {
5716
6206
  while: (...args: Array<any>) => Effect<infer _A, infer E, infer _R>;
@@ -5769,13 +6259,15 @@ export declare namespace Retry {
5769
6259
  *
5770
6260
  * @example
5771
6261
  * ```ts
5772
- * import { Effect, Schedule } from "effect"
6262
+ * import { Data, Effect, Schedule } from "effect"
6263
+ *
6264
+ * class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
5773
6265
  *
5774
6266
  * let attempt = 0
5775
- * const task = Effect.callback<string, Error>((resume) => {
6267
+ * const task = Effect.callback<string, AttemptError>((resume) => {
5776
6268
  * attempt++
5777
6269
  * if (attempt <= 2) {
5778
- * resume(Effect.fail(new Error(`Attempt ${attempt} failed`)))
6270
+ * resume(Effect.fail(new AttemptError({ attempt })))
5779
6271
  * } else {
5780
6272
  * resume(Effect.succeed("Success!"))
5781
6273
  * }
@@ -5818,13 +6310,15 @@ export declare const retry: {
5818
6310
  *
5819
6311
  * @example
5820
6312
  * ```ts
5821
- * import { Effect, Schedule } from "effect"
6313
+ * import { Data, Effect, Schedule } from "effect"
6314
+ *
6315
+ * class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
5822
6316
  *
5823
6317
  * let attempt = 0
5824
- * const task = Effect.callback<string, Error>((resume) => {
6318
+ * const task = Effect.callback<string, AttemptError>((resume) => {
5825
6319
  * attempt++
5826
6320
  * if (attempt <= 2) {
5827
- * resume(Effect.fail(new Error(`Attempt ${attempt} failed`)))
6321
+ * resume(Effect.fail(new AttemptError({ attempt })))
5828
6322
  * } else {
5829
6323
  * resume(Effect.succeed("Success!"))
5830
6324
  * }
@@ -5867,13 +6361,15 @@ export declare const retry: {
5867
6361
  *
5868
6362
  * @example
5869
6363
  * ```ts
5870
- * import { Effect, Schedule } from "effect"
6364
+ * import { Data, Effect, Schedule } from "effect"
6365
+ *
6366
+ * class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
5871
6367
  *
5872
6368
  * let attempt = 0
5873
- * const task = Effect.callback<string, Error>((resume) => {
6369
+ * const task = Effect.callback<string, AttemptError>((resume) => {
5874
6370
  * attempt++
5875
6371
  * if (attempt <= 2) {
5876
- * resume(Effect.fail(new Error(`Attempt ${attempt} failed`)))
6372
+ * resume(Effect.fail(new AttemptError({ attempt })))
5877
6373
  * } else {
5878
6374
  * resume(Effect.succeed("Success!"))
5879
6375
  * }
@@ -5916,13 +6412,15 @@ export declare const retry: {
5916
6412
  *
5917
6413
  * @example
5918
6414
  * ```ts
5919
- * import { Effect, Schedule } from "effect"
6415
+ * import { Data, Effect, Schedule } from "effect"
6416
+ *
6417
+ * class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
5920
6418
  *
5921
6419
  * let attempt = 0
5922
- * const task = Effect.callback<string, Error>((resume) => {
6420
+ * const task = Effect.callback<string, AttemptError>((resume) => {
5923
6421
  * attempt++
5924
6422
  * if (attempt <= 2) {
5925
- * resume(Effect.fail(new Error(`Attempt ${attempt} failed`)))
6423
+ * resume(Effect.fail(new AttemptError({ attempt })))
5926
6424
  * } else {
5927
6425
  * resume(Effect.succeed("Success!"))
5928
6426
  * }
@@ -5965,13 +6463,15 @@ export declare const retry: {
5965
6463
  *
5966
6464
  * @example
5967
6465
  * ```ts
5968
- * import { Effect, Schedule } from "effect"
6466
+ * import { Data, Effect, Schedule } from "effect"
6467
+ *
6468
+ * class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
5969
6469
  *
5970
6470
  * let attempt = 0
5971
- * const task = Effect.callback<string, Error>((resume) => {
6471
+ * const task = Effect.callback<string, AttemptError>((resume) => {
5972
6472
  * attempt++
5973
6473
  * if (attempt <= 2) {
5974
- * resume(Effect.fail(new Error(`Attempt ${attempt} failed`)))
6474
+ * resume(Effect.fail(new AttemptError({ attempt })))
5975
6475
  * } else {
5976
6476
  * resume(Effect.succeed("Success!"))
5977
6477
  * }
@@ -6014,13 +6514,15 @@ export declare const retry: {
6014
6514
  *
6015
6515
  * @example
6016
6516
  * ```ts
6017
- * import { Effect, Schedule } from "effect"
6517
+ * import { Data, Effect, Schedule } from "effect"
6518
+ *
6519
+ * class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
6018
6520
  *
6019
6521
  * let attempt = 0
6020
- * const task = Effect.callback<string, Error>((resume) => {
6522
+ * const task = Effect.callback<string, AttemptError>((resume) => {
6021
6523
  * attempt++
6022
6524
  * if (attempt <= 2) {
6023
- * resume(Effect.fail(new Error(`Attempt ${attempt} failed`)))
6525
+ * resume(Effect.fail(new AttemptError({ attempt })))
6024
6526
  * } else {
6025
6527
  * resume(Effect.succeed("Success!"))
6026
6528
  * }
@@ -6063,13 +6565,15 @@ export declare const retry: {
6063
6565
  *
6064
6566
  * @example
6065
6567
  * ```ts
6066
- * import { Effect, Schedule } from "effect"
6568
+ * import { Data, Effect, Schedule } from "effect"
6569
+ *
6570
+ * class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
6067
6571
  *
6068
6572
  * let attempt = 0
6069
- * const task = Effect.callback<string, Error>((resume) => {
6573
+ * const task = Effect.callback<string, AttemptError>((resume) => {
6070
6574
  * attempt++
6071
6575
  * if (attempt <= 2) {
6072
- * resume(Effect.fail(new Error(`Attempt ${attempt} failed`)))
6576
+ * resume(Effect.fail(new AttemptError({ attempt })))
6073
6577
  * } else {
6074
6578
  * resume(Effect.succeed("Success!"))
6075
6579
  * }
@@ -6110,14 +6614,16 @@ export declare const retry: {
6110
6614
  *
6111
6615
  * @example
6112
6616
  * ```ts
6113
- * import { Console, Effect, Schedule } from "effect"
6617
+ * import { Console, Data, Effect, Schedule } from "effect"
6618
+ *
6619
+ * class NetworkTimeoutError extends Data.TaggedError("NetworkTimeoutError")<{}> {}
6114
6620
  *
6115
6621
  * let attempt = 0
6116
6622
  * const networkRequest = Effect.gen(function*() {
6117
6623
  * attempt++
6118
6624
  * yield* Console.log(`Network attempt ${attempt}`)
6119
6625
  * if (attempt < 3) {
6120
- * return yield* Effect.fail(new Error("Network timeout"))
6626
+ * return yield* Effect.fail(new NetworkTimeoutError())
6121
6627
  * }
6122
6628
  * return "Network data"
6123
6629
  * })
@@ -6165,14 +6671,16 @@ export declare const retryOrElse: {
6165
6671
  *
6166
6672
  * @example
6167
6673
  * ```ts
6168
- * import { Console, Effect, Schedule } from "effect"
6674
+ * import { Console, Data, Effect, Schedule } from "effect"
6675
+ *
6676
+ * class NetworkTimeoutError extends Data.TaggedError("NetworkTimeoutError")<{}> {}
6169
6677
  *
6170
6678
  * let attempt = 0
6171
6679
  * const networkRequest = Effect.gen(function*() {
6172
6680
  * attempt++
6173
6681
  * yield* Console.log(`Network attempt ${attempt}`)
6174
6682
  * if (attempt < 3) {
6175
- * return yield* Effect.fail(new Error("Network timeout"))
6683
+ * return yield* Effect.fail(new NetworkTimeoutError())
6176
6684
  * }
6177
6685
  * return "Network data"
6178
6686
  * })
@@ -6220,14 +6728,16 @@ export declare const retryOrElse: {
6220
6728
  *
6221
6729
  * @example
6222
6730
  * ```ts
6223
- * import { Console, Effect, Schedule } from "effect"
6731
+ * import { Console, Data, Effect, Schedule } from "effect"
6732
+ *
6733
+ * class NetworkTimeoutError extends Data.TaggedError("NetworkTimeoutError")<{}> {}
6224
6734
  *
6225
6735
  * let attempt = 0
6226
6736
  * const networkRequest = Effect.gen(function*() {
6227
6737
  * attempt++
6228
6738
  * yield* Console.log(`Network attempt ${attempt}`)
6229
6739
  * if (attempt < 3) {
6230
- * return yield* Effect.fail(new Error("Network timeout"))
6740
+ * return yield* Effect.fail(new NetworkTimeoutError())
6231
6741
  * }
6232
6742
  * return "Network data"
6233
6743
  * })
@@ -6300,7 +6810,8 @@ export declare const sandbox: <A, E, R>(self: Effect<A, E, R>) => Effect<A, Caus
6300
6810
  * it succeeds or fails. This is useful when you only care about the side
6301
6811
  * effects of the effect and do not need to handle or process its outcome.
6302
6812
  *
6303
- * Use the `log` option to emit the full {@link Cause} when the effect fails.
6813
+ * Use the `log` option to emit the full {@link Cause} when the effect fails,
6814
+ * and `message` to prepend a custom log message.
6304
6815
  *
6305
6816
  * @example
6306
6817
  * ```ts
@@ -6324,7 +6835,7 @@ export declare const sandbox: <A, E, R>(self: Effect<A, E, R>) => Effect<A, Caus
6324
6835
  * const task = Effect.fail("Uh oh!")
6325
6836
  *
6326
6837
  * const program = task.pipe(Effect.ignore({ log: true }))
6327
- * const programWarn = task.pipe(Effect.ignore({ log: "Warn" }))
6838
+ * const programWarn = task.pipe(Effect.ignore({ log: "Warn", message: "Ignoring task failure" }))
6328
6839
  * ```
6329
6840
  *
6330
6841
  * **Previously Known As**
@@ -6337,16 +6848,20 @@ export declare const sandbox: <A, E, R>(self: Effect<A, E, R>) => Effect<A, Caus
6337
6848
  * @category Error Handling
6338
6849
  */
6339
6850
  export declare const ignore: <Arg extends Effect<any, any, any> | {
6340
- readonly log?: boolean | LogLevel | undefined;
6851
+ readonly log?: boolean | Severity | undefined;
6852
+ readonly message?: string | undefined;
6341
6853
  } | undefined = {
6342
- readonly log?: boolean | LogLevel | undefined;
6854
+ readonly log?: boolean | Severity | undefined;
6855
+ readonly message?: string | undefined;
6343
6856
  }>(effectOrOptions?: Arg, options?: {
6344
- readonly log?: boolean | LogLevel | undefined;
6857
+ readonly log?: boolean | Severity | undefined;
6858
+ readonly message?: string | undefined;
6345
6859
  } | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>;
6346
6860
  /**
6347
6861
  * Ignores the effect's failure cause, including defects and interruptions.
6348
6862
  *
6349
- * Use the `log` option to emit the full {@link Cause} when the effect fails.
6863
+ * Use the `log` option to emit the full {@link Cause} when the effect fails,
6864
+ * and `message` to prepend a custom log message.
6350
6865
  *
6351
6866
  * @example
6352
6867
  * ```ts
@@ -6355,18 +6870,21 @@ export declare const ignore: <Arg extends Effect<any, any, any> | {
6355
6870
  * const task = Effect.fail("boom")
6356
6871
  *
6357
6872
  * const program = task.pipe(Effect.ignoreCause)
6358
- * const programLog = task.pipe(Effect.ignoreCause({ log: true }))
6873
+ * const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
6359
6874
  * ```
6360
6875
  *
6361
6876
  * @since 4.0.0
6362
6877
  * @category Error Handling
6363
6878
  */
6364
6879
  export declare const ignoreCause: <Arg extends Effect<any, any, any> | {
6365
- readonly log?: boolean | LogLevel | undefined;
6880
+ readonly log?: boolean | Severity | undefined;
6881
+ readonly message?: string | undefined;
6366
6882
  } | undefined = {
6367
- readonly log?: boolean | LogLevel | undefined;
6883
+ readonly log?: boolean | Severity | undefined;
6884
+ readonly message?: string | undefined;
6368
6885
  }>(effectOrOptions?: Arg, options?: {
6369
- readonly log?: boolean | LogLevel | undefined;
6886
+ readonly log?: boolean | Severity | undefined;
6887
+ readonly message?: string | undefined;
6370
6888
  } | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<void, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<void, never, R>;
6371
6889
  /**
6372
6890
  * Apply an `ExecutionPlan` to an effect, retrying with step-provided resources
@@ -6378,13 +6896,16 @@ export declare const ignoreCause: <Arg extends Effect<any, any, any> | {
6378
6896
  *
6379
6897
  * @example
6380
6898
  * ```ts
6381
- * import { Effect, ExecutionPlan, Layer, ServiceMap } from "effect"
6899
+ * import { Effect, ExecutionPlan, Layer, Context } from "effect"
6382
6900
  *
6383
- * const Endpoint = ServiceMap.Service<{ url: string }>("Endpoint")
6901
+ * const Endpoint = Context.Service<{ url: string }>("Endpoint")
6384
6902
  *
6385
6903
  * const fetchUrl = Effect.gen(function*() {
6386
6904
  * const endpoint = yield* Effect.service(Endpoint)
6387
- * return endpoint.url === "bad" ? yield* Effect.fail("Unavailable") : endpoint.url
6905
+ * if (endpoint.url === "bad") {
6906
+ * return yield* Effect.fail("Unavailable")
6907
+ * }
6908
+ * return endpoint.url
6388
6909
  * })
6389
6910
  *
6390
6911
  * const plan = ExecutionPlan.make(
@@ -6409,13 +6930,16 @@ export declare const withExecutionPlan: {
6409
6930
  *
6410
6931
  * @example
6411
6932
  * ```ts
6412
- * import { Effect, ExecutionPlan, Layer, ServiceMap } from "effect"
6933
+ * import { Effect, ExecutionPlan, Layer, Context } from "effect"
6413
6934
  *
6414
- * const Endpoint = ServiceMap.Service<{ url: string }>("Endpoint")
6935
+ * const Endpoint = Context.Service<{ url: string }>("Endpoint")
6415
6936
  *
6416
6937
  * const fetchUrl = Effect.gen(function*() {
6417
6938
  * const endpoint = yield* Effect.service(Endpoint)
6418
- * return endpoint.url === "bad" ? yield* Effect.fail("Unavailable") : endpoint.url
6939
+ * if (endpoint.url === "bad") {
6940
+ * return yield* Effect.fail("Unavailable")
6941
+ * }
6942
+ * return endpoint.url
6419
6943
  * })
6420
6944
  *
6421
6945
  * const plan = ExecutionPlan.make(
@@ -6445,13 +6969,16 @@ export declare const withExecutionPlan: {
6445
6969
  *
6446
6970
  * @example
6447
6971
  * ```ts
6448
- * import { Effect, ExecutionPlan, Layer, ServiceMap } from "effect"
6972
+ * import { Effect, ExecutionPlan, Layer, Context } from "effect"
6449
6973
  *
6450
- * const Endpoint = ServiceMap.Service<{ url: string }>("Endpoint")
6974
+ * const Endpoint = Context.Service<{ url: string }>("Endpoint")
6451
6975
  *
6452
6976
  * const fetchUrl = Effect.gen(function*() {
6453
6977
  * const endpoint = yield* Effect.service(Endpoint)
6454
- * return endpoint.url === "bad" ? yield* Effect.fail("Unavailable") : endpoint.url
6978
+ * if (endpoint.url === "bad") {
6979
+ * return yield* Effect.fail("Unavailable")
6980
+ * }
6981
+ * return endpoint.url
6455
6982
  * })
6456
6983
  *
6457
6984
  * const plan = ExecutionPlan.make(
@@ -6472,6 +6999,22 @@ export declare const withExecutionPlan: {
6472
6999
  requirements: PlanR;
6473
7000
  }>): Effect<A, E | PlanE, Exclude<R, Provides> | PlanR>;
6474
7001
  };
7002
+ /**
7003
+ * Runs an effect and reports any errors to the configured `ErrorReporter`s.
7004
+ *
7005
+ * If the `defectsOnly` option is set to `true`, only defects (unrecoverable
7006
+ * errors) will be reported, while regular failures will be ignored.
7007
+ *
7008
+ * @since 4.0.0
7009
+ * @category Error Handling
7010
+ */
7011
+ export declare const withErrorReporting: <Arg extends Effect<any, any, any> | {
7012
+ readonly defectsOnly?: boolean | undefined;
7013
+ } | undefined = {
7014
+ readonly defectsOnly?: boolean | undefined;
7015
+ }>(effectOrOptions: Arg, options?: {
7016
+ readonly defectsOnly?: boolean | undefined;
7017
+ } | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Arg : <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
6475
7018
  /**
6476
7019
  * Replaces the original failure with a success value, ensuring the effect
6477
7020
  * cannot fail.
@@ -6692,7 +7235,7 @@ export declare const timeout: {
6692
7235
  * @since 2.0.0
6693
7236
  * @category Delays & Timeouts
6694
7237
  */
6695
- (duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | Cause.TimeoutError, R>;
7238
+ (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | Cause.TimeoutError, R>;
6696
7239
  /**
6697
7240
  * Adds a time limit to an effect, triggering a timeout if the effect exceeds
6698
7241
  * the duration.
@@ -6739,7 +7282,7 @@ export declare const timeout: {
6739
7282
  * @since 2.0.0
6740
7283
  * @category Delays & Timeouts
6741
7284
  */
6742
- <A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<A, E | Cause.TimeoutError, R>;
7285
+ <A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<A, E | Cause.TimeoutError, R>;
6743
7286
  };
6744
7287
  /**
6745
7288
  * Handles timeouts by returning an `Option` that represents either the result
@@ -6840,7 +7383,7 @@ export declare const timeoutOption: {
6840
7383
  * @since 3.1.0
6841
7384
  * @category Delays & Timeouts
6842
7385
  */
6843
- (duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, E, R>;
7386
+ (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, E, R>;
6844
7387
  /**
6845
7388
  * Handles timeouts by returning an `Option` that represents either the result
6846
7389
  * or a timeout.
@@ -6890,7 +7433,7 @@ export declare const timeoutOption: {
6890
7433
  * @since 3.1.0
6891
7434
  * @category Delays & Timeouts
6892
7435
  */
6893
- <A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<Option<A>, E, R>;
7436
+ <A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<Option<A>, E, R>;
6894
7437
  };
6895
7438
  /**
6896
7439
  * Applies a timeout to an effect, with a fallback effect executed if the timeout is reached.
@@ -6911,7 +7454,7 @@ export declare const timeoutOption: {
6911
7454
  * // Use cached data as fallback when timeout is reached
6912
7455
  * const program = Effect.timeoutOrElse(slowQuery, {
6913
7456
  * duration: "2 seconds",
6914
- * onTimeout: () =>
7457
+ * orElse: () =>
6915
7458
  * Effect.gen(function*() {
6916
7459
  * yield* Console.log("Query timed out, using cached data")
6917
7460
  * return "Cached result"
@@ -6948,7 +7491,7 @@ export declare const timeoutOrElse: {
6948
7491
  * // Use cached data as fallback when timeout is reached
6949
7492
  * const program = Effect.timeoutOrElse(slowQuery, {
6950
7493
  * duration: "2 seconds",
6951
- * onTimeout: () =>
7494
+ * orElse: () =>
6952
7495
  * Effect.gen(function*() {
6953
7496
  * yield* Console.log("Query timed out, using cached data")
6954
7497
  * return "Cached result"
@@ -6966,8 +7509,8 @@ export declare const timeoutOrElse: {
6966
7509
  * @category Delays & Timeouts
6967
7510
  */
6968
7511
  <A2, E2, R2>(options: {
6969
- readonly duration: Duration.DurationInput;
6970
- readonly onTimeout: LazyArg<Effect<A2, E2, R2>>;
7512
+ readonly duration: Duration.Input;
7513
+ readonly orElse: LazyArg<Effect<A2, E2, R2>>;
6971
7514
  }): <A, E, R>(self: Effect<A, E, R>) => Effect<A | A2, E | E2, R | R2>;
6972
7515
  /**
6973
7516
  * Applies a timeout to an effect, with a fallback effect executed if the timeout is reached.
@@ -6988,7 +7531,7 @@ export declare const timeoutOrElse: {
6988
7531
  * // Use cached data as fallback when timeout is reached
6989
7532
  * const program = Effect.timeoutOrElse(slowQuery, {
6990
7533
  * duration: "2 seconds",
6991
- * onTimeout: () =>
7534
+ * orElse: () =>
6992
7535
  * Effect.gen(function*() {
6993
7536
  * yield* Console.log("Query timed out, using cached data")
6994
7537
  * return "Cached result"
@@ -7006,8 +7549,8 @@ export declare const timeoutOrElse: {
7006
7549
  * @category Delays & Timeouts
7007
7550
  */
7008
7551
  <A, E, R, A2, E2, R2>(self: Effect<A, E, R>, options: {
7009
- readonly duration: Duration.DurationInput;
7010
- readonly onTimeout: LazyArg<Effect<A2, E2, R2>>;
7552
+ readonly duration: Duration.Input;
7553
+ readonly orElse: LazyArg<Effect<A2, E2, R2>>;
7011
7554
  }): Effect<A | A2, E | E2, R | R2>;
7012
7555
  };
7013
7556
  /**
@@ -7051,7 +7594,7 @@ export declare const delay: {
7051
7594
  * @since 2.0.0
7052
7595
  * @category Delays & Timeouts
7053
7596
  */
7054
- (duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
7597
+ (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
7055
7598
  /**
7056
7599
  * Returns an effect that is delayed from this effect by the specified
7057
7600
  * `Duration`.
@@ -7072,7 +7615,7 @@ export declare const delay: {
7072
7615
  * @since 2.0.0
7073
7616
  * @category Delays & Timeouts
7074
7617
  */
7075
- <A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<A, E, R>;
7618
+ <A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<A, E, R>;
7076
7619
  };
7077
7620
  /**
7078
7621
  * Returns an effect that suspends for the specified duration. This method is
@@ -7096,7 +7639,7 @@ export declare const delay: {
7096
7639
  * @since 2.0.0
7097
7640
  * @category Delays & Timeouts
7098
7641
  */
7099
- export declare const sleep: (duration: Duration.DurationInput) => Effect<void>;
7642
+ export declare const sleep: (duration: Duration.Input) => Effect<void>;
7100
7643
  /**
7101
7644
  * Measures the runtime of an effect and returns the duration with its result.
7102
7645
  *
@@ -7389,12 +7932,12 @@ export declare const raceFirst: {
7389
7932
  }): Effect<A | A2, E | E2, R | R2>;
7390
7933
  };
7391
7934
  /**
7392
- * Filters elements of an iterable using a predicate, refinement, effectful
7393
- * predicate, or `Filter.FilterEffect`.
7935
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7936
+ * predicate.
7394
7937
  *
7395
7938
  * @example
7396
7939
  * ```ts
7397
- * import { Effect, Filter, Result } from "effect"
7940
+ * import { Effect } from "effect"
7398
7941
  *
7399
7942
  * // Sync predicate
7400
7943
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7402,10 +7945,7 @@ export declare const raceFirst: {
7402
7945
  * // Effectful predicate
7403
7946
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7404
7947
  *
7405
- * // FilterEffect
7406
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7407
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7408
- * )
7948
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7409
7949
  * ```
7410
7950
  *
7411
7951
  * @since 2.0.0
@@ -7413,12 +7953,12 @@ export declare const raceFirst: {
7413
7953
  */
7414
7954
  export declare const filter: {
7415
7955
  /**
7416
- * Filters elements of an iterable using a predicate, refinement, effectful
7417
- * predicate, or `Filter.FilterEffect`.
7956
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7957
+ * predicate.
7418
7958
  *
7419
7959
  * @example
7420
7960
  * ```ts
7421
- * import { Effect, Filter, Result } from "effect"
7961
+ * import { Effect } from "effect"
7422
7962
  *
7423
7963
  * // Sync predicate
7424
7964
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7426,10 +7966,7 @@ export declare const filter: {
7426
7966
  * // Effectful predicate
7427
7967
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7428
7968
  *
7429
- * // FilterEffect
7430
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7431
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7432
- * )
7969
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7433
7970
  * ```
7434
7971
  *
7435
7972
  * @since 2.0.0
@@ -7437,12 +7974,12 @@ export declare const filter: {
7437
7974
  */
7438
7975
  <A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): (elements: Iterable<A>) => Effect<Array<B>>;
7439
7976
  /**
7440
- * Filters elements of an iterable using a predicate, refinement, effectful
7441
- * predicate, or `Filter.FilterEffect`.
7977
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7978
+ * predicate.
7442
7979
  *
7443
7980
  * @example
7444
7981
  * ```ts
7445
- * import { Effect, Filter, Result } from "effect"
7982
+ * import { Effect } from "effect"
7446
7983
  *
7447
7984
  * // Sync predicate
7448
7985
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7450,10 +7987,7 @@ export declare const filter: {
7450
7987
  * // Effectful predicate
7451
7988
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7452
7989
  *
7453
- * // FilterEffect
7454
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7455
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7456
- * )
7990
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7457
7991
  * ```
7458
7992
  *
7459
7993
  * @since 2.0.0
@@ -7461,64 +7995,12 @@ export declare const filter: {
7461
7995
  */
7462
7996
  <A>(predicate: Predicate.Predicate<NoInfer<A>>): (elements: Iterable<A>) => Effect<Array<A>>;
7463
7997
  /**
7464
- * Filters elements of an iterable using a predicate, refinement, effectful
7465
- * predicate, or `Filter.FilterEffect`.
7466
- *
7467
- * @example
7468
- * ```ts
7469
- * import { Effect, Filter, Result } from "effect"
7470
- *
7471
- * // Sync predicate
7472
- * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
7473
- *
7474
- * // Effectful predicate
7475
- * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7476
- *
7477
- * // FilterEffect
7478
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7479
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7480
- * )
7481
- * ```
7482
- *
7483
- * @since 2.0.0
7484
- * @category Filtering
7485
- */
7486
- <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>, options?: {
7487
- readonly concurrency?: Concurrency | undefined;
7488
- }): (elements: Iterable<A>) => Effect<Array<B>>;
7489
- /**
7490
- * Filters elements of an iterable using a predicate, refinement, effectful
7491
- * predicate, or `Filter.FilterEffect`.
7998
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7999
+ * predicate.
7492
8000
  *
7493
8001
  * @example
7494
8002
  * ```ts
7495
- * import { Effect, Filter, Result } from "effect"
7496
- *
7497
- * // Sync predicate
7498
- * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
7499
- *
7500
- * // Effectful predicate
7501
- * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7502
- *
7503
- * // FilterEffect
7504
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7505
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7506
- * )
7507
- * ```
7508
- *
7509
- * @since 2.0.0
7510
- * @category Filtering
7511
- */
7512
- <A, B, X, E, R>(filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
7513
- readonly concurrency?: Concurrency | undefined;
7514
- }): (elements: Iterable<A>) => Effect<Array<B>, E, R>;
7515
- /**
7516
- * Filters elements of an iterable using a predicate, refinement, effectful
7517
- * predicate, or `Filter.FilterEffect`.
7518
- *
7519
- * @example
7520
- * ```ts
7521
- * import { Effect, Filter, Result } from "effect"
8003
+ * import { Effect } from "effect"
7522
8004
  *
7523
8005
  * // Sync predicate
7524
8006
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7526,10 +8008,7 @@ export declare const filter: {
7526
8008
  * // Effectful predicate
7527
8009
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7528
8010
  *
7529
- * // FilterEffect
7530
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7531
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7532
- * )
8011
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7533
8012
  * ```
7534
8013
  *
7535
8014
  * @since 2.0.0
@@ -7539,12 +8018,12 @@ export declare const filter: {
7539
8018
  readonly concurrency?: Concurrency | undefined;
7540
8019
  }): (iterable: Iterable<A>) => Effect<Array<A>, E, R>;
7541
8020
  /**
7542
- * Filters elements of an iterable using a predicate, refinement, effectful
7543
- * predicate, or `Filter.FilterEffect`.
8021
+ * Filters elements of an iterable using a predicate, refinement, or effectful
8022
+ * predicate.
7544
8023
  *
7545
8024
  * @example
7546
8025
  * ```ts
7547
- * import { Effect, Filter, Result } from "effect"
8026
+ * import { Effect } from "effect"
7548
8027
  *
7549
8028
  * // Sync predicate
7550
8029
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7552,10 +8031,7 @@ export declare const filter: {
7552
8031
  * // Effectful predicate
7553
8032
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7554
8033
  *
7555
- * // FilterEffect
7556
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7557
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7558
- * )
8034
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7559
8035
  * ```
7560
8036
  *
7561
8037
  * @since 2.0.0
@@ -7563,60 +8039,12 @@ export declare const filter: {
7563
8039
  */
7564
8040
  <A, B extends A>(elements: Iterable<A>, refinement: Predicate.Refinement<A, B>): Effect<Array<B>>;
7565
8041
  /**
7566
- * Filters elements of an iterable using a predicate, refinement, effectful
7567
- * predicate, or `Filter.FilterEffect`.
7568
- *
7569
- * @example
7570
- * ```ts
7571
- * import { Effect, Filter, Result } from "effect"
7572
- *
7573
- * // Sync predicate
7574
- * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
7575
- *
7576
- * // Effectful predicate
7577
- * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7578
- *
7579
- * // FilterEffect
7580
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7581
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7582
- * )
7583
- * ```
7584
- *
7585
- * @since 2.0.0
7586
- * @category Filtering
7587
- */
7588
- <A>(elements: Iterable<A>, predicate: Predicate.Predicate<A>): Effect<Array<A>>;
7589
- /**
7590
- * Filters elements of an iterable using a predicate, refinement, effectful
7591
- * predicate, or `Filter.FilterEffect`.
8042
+ * Filters elements of an iterable using a predicate, refinement, or effectful
8043
+ * predicate.
7592
8044
  *
7593
8045
  * @example
7594
8046
  * ```ts
7595
- * import { Effect, Filter, Result } from "effect"
7596
- *
7597
- * // Sync predicate
7598
- * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
7599
- *
7600
- * // Effectful predicate
7601
- * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7602
- *
7603
- * // FilterEffect
7604
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7605
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7606
- * )
7607
- * ```
7608
- *
7609
- * @since 2.0.0
7610
- * @category Filtering
7611
- */
7612
- <A, B, X>(elements: Iterable<A>, filter: Filter.Filter<NoInfer<A>, B, X>): Effect<Array<B>>;
7613
- /**
7614
- * Filters elements of an iterable using a predicate, refinement, effectful
7615
- * predicate, or `Filter.FilterEffect`.
7616
- *
7617
- * @example
7618
- * ```ts
7619
- * import { Effect, Filter, Result } from "effect"
8047
+ * import { Effect } from "effect"
7620
8048
  *
7621
8049
  * // Sync predicate
7622
8050
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7624,25 +8052,20 @@ export declare const filter: {
7624
8052
  * // Effectful predicate
7625
8053
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7626
8054
  *
7627
- * // FilterEffect
7628
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7629
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7630
- * )
8055
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7631
8056
  * ```
7632
8057
  *
7633
8058
  * @since 2.0.0
7634
8059
  * @category Filtering
7635
8060
  */
7636
- <A, B, X, E, R>(elements: Iterable<A>, filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
7637
- readonly concurrency?: Concurrency | undefined;
7638
- }): Effect<Array<B>, E, R>;
8061
+ <A>(elements: Iterable<A>, predicate: Predicate.Predicate<A>): Effect<Array<A>>;
7639
8062
  /**
7640
- * Filters elements of an iterable using a predicate, refinement, effectful
7641
- * predicate, or `Filter.FilterEffect`.
8063
+ * Filters elements of an iterable using a predicate, refinement, or effectful
8064
+ * predicate.
7642
8065
  *
7643
8066
  * @example
7644
8067
  * ```ts
7645
- * import { Effect, Filter, Result } from "effect"
8068
+ * import { Effect } from "effect"
7646
8069
  *
7647
8070
  * // Sync predicate
7648
8071
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7650,10 +8073,7 @@ export declare const filter: {
7650
8073
  * // Effectful predicate
7651
8074
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7652
8075
  *
7653
- * // FilterEffect
7654
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7655
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7656
- * )
8076
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7657
8077
  * ```
7658
8078
  *
7659
8079
  * @since 2.0.0
@@ -7663,6 +8083,54 @@ export declare const filter: {
7663
8083
  readonly concurrency?: Concurrency | undefined;
7664
8084
  }): Effect<Array<A>, E, R>;
7665
8085
  };
8086
+ /**
8087
+ * Filters and maps elements of an iterable with a `Filter`.
8088
+ *
8089
+ * @since 4.0.0
8090
+ * @category Filtering
8091
+ */
8092
+ export declare const filterMap: {
8093
+ /**
8094
+ * Filters and maps elements of an iterable with a `Filter`.
8095
+ *
8096
+ * @since 4.0.0
8097
+ * @category Filtering
8098
+ */
8099
+ <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): (elements: Iterable<A>) => Effect<Array<B>>;
8100
+ /**
8101
+ * Filters and maps elements of an iterable with a `Filter`.
8102
+ *
8103
+ * @since 4.0.0
8104
+ * @category Filtering
8105
+ */
8106
+ <A, B, X>(elements: Iterable<A>, filter: Filter.Filter<NoInfer<A>, B, X>): Effect<Array<B>>;
8107
+ };
8108
+ /**
8109
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
8110
+ *
8111
+ * @since 4.0.0
8112
+ * @category Filtering
8113
+ */
8114
+ export declare const filterMapEffect: {
8115
+ /**
8116
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
8117
+ *
8118
+ * @since 4.0.0
8119
+ * @category Filtering
8120
+ */
8121
+ <A, B, X, E, R>(filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
8122
+ readonly concurrency?: Concurrency | undefined;
8123
+ }): (elements: Iterable<A>) => Effect<Array<B>, E, R>;
8124
+ /**
8125
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
8126
+ *
8127
+ * @since 4.0.0
8128
+ * @category Filtering
8129
+ */
8130
+ <A, B, X, E, R>(elements: Iterable<A>, filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
8131
+ readonly concurrency?: Concurrency | undefined;
8132
+ }): Effect<Array<B>, E, R>;
8133
+ };
7666
8134
  /**
7667
8135
  * Filters an effect, providing an alternative effect if the predicate fails.
7668
8136
  *
@@ -7755,7 +8223,7 @@ export declare const filterOrElse: {
7755
8223
  * @since 2.0.0
7756
8224
  * @category Filtering
7757
8225
  */
7758
- <A, Result extends Filter.ResultOrBool, C, E2, R2>(filter: Filter.OrPredicate<NoInfer<A>, Result>, orElse: (a: Filter.Fail<A, Result>) => Effect<C, E2, R2>): <E, R>(self: Effect<A, E, R>) => Effect<Filter.Pass<A, Result> | C, E2 | E, R2 | R>;
8226
+ <A, C, E2, R2>(predicate: Predicate.Predicate<NoInfer<A>>, orElse: (a: NoInfer<A>) => Effect<C, E2, R2>): <E, R>(self: Effect<A, E, R>) => Effect<A | C, E2 | E, R2 | R>;
7759
8227
  /**
7760
8228
  * Filters an effect, providing an alternative effect if the predicate fails.
7761
8229
  *
@@ -7817,7 +8285,29 @@ export declare const filterOrElse: {
7817
8285
  * @since 2.0.0
7818
8286
  * @category Filtering
7819
8287
  */
7820
- <A, E, R, Result extends Filter.ResultOrBool, C, E2, R2>(self: Effect<A, E, R>, filter: Filter.OrPredicate<NoInfer<A>, Result>, orElse: (a: Filter.Fail<A, Result>) => Effect<C, E2, R2>): Effect<Filter.Pass<A, Result> | C, E | E2, R | R2>;
8288
+ <A, E, R, C, E2, R2>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>, orElse: (a: NoInfer<A>) => Effect<C, E2, R2>): Effect<A | C, E | E2, R | R2>;
8289
+ };
8290
+ /**
8291
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
8292
+ *
8293
+ * @since 4.0.0
8294
+ * @category Filtering
8295
+ */
8296
+ export declare const filterMapOrElse: {
8297
+ /**
8298
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
8299
+ *
8300
+ * @since 4.0.0
8301
+ * @category Filtering
8302
+ */
8303
+ <A, B, X, C, E2, R2>(filter: Filter.Filter<NoInfer<A>, B, X>, orElse: (x: X) => Effect<C, E2, R2>): <E, R>(self: Effect<A, E, R>) => Effect<B | C, E2 | E, R2 | R>;
8304
+ /**
8305
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
8306
+ *
8307
+ * @since 4.0.0
8308
+ * @category Filtering
8309
+ */
8310
+ <A, E, R, B, X, C, E2, R2>(self: Effect<A, E, R>, filter: Filter.Filter<NoInfer<A>, B, X>, orElse: (x: X) => Effect<C, E2, R2>): Effect<B | C, E | E2, R | R2>;
7821
8311
  };
7822
8312
  /**
7823
8313
  * Filters an effect, failing with a custom error if the predicate fails.
@@ -7938,7 +8428,7 @@ export declare const filterOrFail: {
7938
8428
  * @since 2.0.0
7939
8429
  * @category Filtering
7940
8430
  */
7941
- <A, B, X, E2>(filter: Filter.Filter<NoInfer<A>, B, X>, orFailWith: (x: X) => E2): <E, R>(self: Effect<A, E, R>) => Effect<B, E2 | E, R>;
8431
+ <A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
7942
8432
  /**
7943
8433
  * Filters an effect, failing with a custom error if the predicate fails.
7944
8434
  *
@@ -7968,7 +8458,7 @@ export declare const filterOrFail: {
7968
8458
  * @since 2.0.0
7969
8459
  * @category Filtering
7970
8460
  */
7971
- <A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
8461
+ <A>(predicate: Predicate.Predicate<NoInfer<A>>): <E, R>(self: Effect<A, E, R>) => Effect<A, Cause.NoSuchElementError | E, R>;
7972
8462
  /**
7973
8463
  * Filters an effect, failing with a custom error if the predicate fails.
7974
8464
  *
@@ -7998,7 +8488,7 @@ export declare const filterOrFail: {
7998
8488
  * @since 2.0.0
7999
8489
  * @category Filtering
8000
8490
  */
8001
- <A>(predicate: Predicate.Predicate<NoInfer<A>>): <E, R>(self: Effect<A, E, R>) => Effect<A, Cause.NoSuchElementError | E, R>;
8491
+ <A, E, R, E2, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>, orFailWith: (a: NoInfer<A>) => E2): Effect<B, E2 | E, R>;
8002
8492
  /**
8003
8493
  * Filters an effect, failing with a custom error if the predicate fails.
8004
8494
  *
@@ -8028,7 +8518,7 @@ export declare const filterOrFail: {
8028
8518
  * @since 2.0.0
8029
8519
  * @category Filtering
8030
8520
  */
8031
- <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
8521
+ <A, E, R, E2>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>, orFailWith: (a: NoInfer<A>) => E2): Effect<A, E2 | E, R>;
8032
8522
  /**
8033
8523
  * Filters an effect, failing with a custom error if the predicate fails.
8034
8524
  *
@@ -8058,7 +8548,7 @@ export declare const filterOrFail: {
8058
8548
  * @since 2.0.0
8059
8549
  * @category Filtering
8060
8550
  */
8061
- <A, E, R, E2, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>, orFailWith: (a: NoInfer<A>) => E2): Effect<B, E2 | E, R>;
8551
+ <A, E, R, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>): Effect<B, E | Cause.NoSuchElementError, R>;
8062
8552
  /**
8063
8553
  * Filters an effect, failing with a custom error if the predicate fails.
8064
8554
  *
@@ -8088,127 +8578,43 @@ export declare const filterOrFail: {
8088
8578
  * @since 2.0.0
8089
8579
  * @category Filtering
8090
8580
  */
8091
- <A, E, R, E2>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>, orFailWith: (a: NoInfer<A>) => E2): Effect<A, E2 | E, R>;
8581
+ <A, E, R>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>): Effect<A, E | Cause.NoSuchElementError, R>;
8582
+ };
8583
+ /**
8584
+ * Filters an effect with a `Filter`, failing when the filter fails.
8585
+ *
8586
+ * @since 4.0.0
8587
+ * @category Filtering
8588
+ */
8589
+ export declare const filterMapOrFail: {
8092
8590
  /**
8093
- * Filters an effect, failing with a custom error if the predicate fails.
8094
- *
8095
- * **Details**
8096
- *
8097
- * This function applies a predicate to the result of an effect. If the
8098
- * predicate evaluates to `false`, the effect fails with either a custom
8099
- * error (if `orFailWith` is provided) or a `NoSuchElementError`.
8100
- *
8101
- * @example
8102
- * ```ts
8103
- * import { Effect } from "effect"
8104
- *
8105
- * // An effect that produces a number
8106
- * const program = Effect.succeed(5)
8107
- *
8108
- * // Filter for even numbers, fail for odd numbers
8109
- * const filtered = Effect.filterOrFail(
8110
- * program,
8111
- * (n) => n % 2 === 0,
8112
- * (n) => `Expected even number, got ${n}`
8113
- * )
8591
+ * Filters an effect with a `Filter`, failing when the filter fails.
8114
8592
  *
8115
- * // Result: Effect.fail("Expected even number, got 5")
8116
- * ```
8117
- *
8118
- * @since 2.0.0
8593
+ * @since 4.0.0
8119
8594
  * @category Filtering
8120
8595
  */
8121
- <A, E, R, B, X, E2>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>, orFailWith: (x: X) => E2): Effect<B, E2 | E, R>;
8596
+ <A, B, X, E2>(filter: Filter.Filter<NoInfer<A>, B, X>, orFailWith: (x: X) => E2): <E, R>(self: Effect<A, E, R>) => Effect<B, E2 | E, R>;
8122
8597
  /**
8123
- * Filters an effect, failing with a custom error if the predicate fails.
8124
- *
8125
- * **Details**
8126
- *
8127
- * This function applies a predicate to the result of an effect. If the
8128
- * predicate evaluates to `false`, the effect fails with either a custom
8129
- * error (if `orFailWith` is provided) or a `NoSuchElementError`.
8130
- *
8131
- * @example
8132
- * ```ts
8133
- * import { Effect } from "effect"
8134
- *
8135
- * // An effect that produces a number
8136
- * const program = Effect.succeed(5)
8137
- *
8138
- * // Filter for even numbers, fail for odd numbers
8139
- * const filtered = Effect.filterOrFail(
8140
- * program,
8141
- * (n) => n % 2 === 0,
8142
- * (n) => `Expected even number, got ${n}`
8143
- * )
8598
+ * Filters an effect with a `Filter`, failing when the filter fails.
8144
8599
  *
8145
- * // Result: Effect.fail("Expected even number, got 5")
8146
- * ```
8147
- *
8148
- * @since 2.0.0
8600
+ * @since 4.0.0
8149
8601
  * @category Filtering
8150
8602
  */
8151
- <A, E, R, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>): Effect<B, E | Cause.NoSuchElementError, R>;
8603
+ <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
8152
8604
  /**
8153
- * Filters an effect, failing with a custom error if the predicate fails.
8154
- *
8155
- * **Details**
8156
- *
8157
- * This function applies a predicate to the result of an effect. If the
8158
- * predicate evaluates to `false`, the effect fails with either a custom
8159
- * error (if `orFailWith` is provided) or a `NoSuchElementError`.
8160
- *
8161
- * @example
8162
- * ```ts
8163
- * import { Effect } from "effect"
8164
- *
8165
- * // An effect that produces a number
8166
- * const program = Effect.succeed(5)
8167
- *
8168
- * // Filter for even numbers, fail for odd numbers
8169
- * const filtered = Effect.filterOrFail(
8170
- * program,
8171
- * (n) => n % 2 === 0,
8172
- * (n) => `Expected even number, got ${n}`
8173
- * )
8605
+ * Filters an effect with a `Filter`, failing when the filter fails.
8174
8606
  *
8175
- * // Result: Effect.fail("Expected even number, got 5")
8176
- * ```
8177
- *
8178
- * @since 2.0.0
8607
+ * @since 4.0.0
8179
8608
  * @category Filtering
8180
8609
  */
8181
- <A, E, R>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>): Effect<A, E | Cause.NoSuchElementError, R>;
8610
+ <A, E, R, B, X, E2>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>, orFailWith: (x: X) => E2): Effect<B, E2 | E, R>;
8182
8611
  /**
8183
- * Filters an effect, failing with a custom error if the predicate fails.
8184
- *
8185
- * **Details**
8186
- *
8187
- * This function applies a predicate to the result of an effect. If the
8188
- * predicate evaluates to `false`, the effect fails with either a custom
8189
- * error (if `orFailWith` is provided) or a `NoSuchElementError`.
8190
- *
8191
- * @example
8192
- * ```ts
8193
- * import { Effect } from "effect"
8194
- *
8195
- * // An effect that produces a number
8196
- * const program = Effect.succeed(5)
8197
- *
8198
- * // Filter for even numbers, fail for odd numbers
8199
- * const filtered = Effect.filterOrFail(
8200
- * program,
8201
- * (n) => n % 2 === 0,
8202
- * (n) => `Expected even number, got ${n}`
8203
- * )
8612
+ * Filters an effect with a `Filter`, failing when the filter fails.
8204
8613
  *
8205
- * // Result: Effect.fail("Expected even number, got 5")
8206
- * ```
8207
- *
8208
- * @since 2.0.0
8614
+ * @since 4.0.0
8209
8615
  * @category Filtering
8210
8616
  */
8211
- <A, E, R, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>): Effect<B, E | Cause.NoSuchElementError, R>;
8617
+ <A, E, R, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>): Effect<B, Cause.NoSuchElementError | E, R>;
8212
8618
  };
8213
8619
  /**
8214
8620
  * Conditionally executes an effect based on a boolean condition.
@@ -8349,9 +8755,11 @@ export declare const when: {
8349
8755
  * @example
8350
8756
  * ```ts
8351
8757
  * // Title: Handling Both Success and Failure Cases
8352
- * import { Effect } from "effect"
8758
+ * import { Data, Effect } from "effect"
8759
+ *
8760
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
8353
8761
  *
8354
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
8762
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
8355
8763
  *
8356
8764
  * const program1 = Effect.match(success, {
8357
8765
  * onFailure: (error) => `failure: ${error.message}`,
@@ -8362,8 +8770,8 @@ export declare const when: {
8362
8770
  * Effect.runPromise(program1).then(console.log)
8363
8771
  * // Output: "success: 42"
8364
8772
  *
8365
- * const failure: Effect.Effect<number, Error> = Effect.fail(
8366
- * new Error("Uh oh!")
8773
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
8774
+ * new ExampleError({ message: "Uh oh!" })
8367
8775
  * )
8368
8776
  *
8369
8777
  * const program2 = Effect.match(failure, {
@@ -8401,9 +8809,11 @@ export declare const match: {
8401
8809
  * @example
8402
8810
  * ```ts
8403
8811
  * // Title: Handling Both Success and Failure Cases
8404
- * import { Effect } from "effect"
8812
+ * import { Data, Effect } from "effect"
8405
8813
  *
8406
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
8814
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
8815
+ *
8816
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
8407
8817
  *
8408
8818
  * const program1 = Effect.match(success, {
8409
8819
  * onFailure: (error) => `failure: ${error.message}`,
@@ -8414,8 +8824,8 @@ export declare const match: {
8414
8824
  * Effect.runPromise(program1).then(console.log)
8415
8825
  * // Output: "success: 42"
8416
8826
  *
8417
- * const failure: Effect.Effect<number, Error> = Effect.fail(
8418
- * new Error("Uh oh!")
8827
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
8828
+ * new ExampleError({ message: "Uh oh!" })
8419
8829
  * )
8420
8830
  *
8421
8831
  * const program2 = Effect.match(failure, {
@@ -8456,9 +8866,11 @@ export declare const match: {
8456
8866
  * @example
8457
8867
  * ```ts
8458
8868
  * // Title: Handling Both Success and Failure Cases
8459
- * import { Effect } from "effect"
8869
+ * import { Data, Effect } from "effect"
8870
+ *
8871
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
8460
8872
  *
8461
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
8873
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
8462
8874
  *
8463
8875
  * const program1 = Effect.match(success, {
8464
8876
  * onFailure: (error) => `failure: ${error.message}`,
@@ -8469,8 +8881,8 @@ export declare const match: {
8469
8881
  * Effect.runPromise(program1).then(console.log)
8470
8882
  * // Output: "success: 42"
8471
8883
  *
8472
- * const failure: Effect.Effect<number, Error> = Effect.fail(
8473
- * new Error("Uh oh!")
8884
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
8885
+ * new ExampleError({ message: "Uh oh!" })
8474
8886
  * )
8475
8887
  *
8476
8888
  * const program2 = Effect.match(failure, {
@@ -8872,9 +9284,11 @@ export declare const matchCauseEffectEager: {
8872
9284
  *
8873
9285
  * @example
8874
9286
  * ```ts
8875
- * import { Cause, Console, Effect, Result } from "effect"
9287
+ * import { Cause, Console, Data, Effect, Result } from "effect"
8876
9288
  *
8877
- * const task = Effect.fail(new Error("Task failed"))
9289
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
9290
+ *
9291
+ * const task = Effect.fail(new TaskError({ message: "Task failed" }))
8878
9292
  *
8879
9293
  * const program = Effect.matchCauseEffect(task, {
8880
9294
  * onFailure: (cause) =>
@@ -8924,9 +9338,11 @@ export declare const matchCauseEffect: {
8924
9338
  *
8925
9339
  * @example
8926
9340
  * ```ts
8927
- * import { Cause, Console, Effect, Result } from "effect"
9341
+ * import { Cause, Console, Data, Effect, Result } from "effect"
9342
+ *
9343
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
8928
9344
  *
8929
- * const task = Effect.fail(new Error("Task failed"))
9345
+ * const task = Effect.fail(new TaskError({ message: "Task failed" }))
8930
9346
  *
8931
9347
  * const program = Effect.matchCauseEffect(task, {
8932
9348
  * onFailure: (cause) =>
@@ -8979,9 +9395,11 @@ export declare const matchCauseEffect: {
8979
9395
  *
8980
9396
  * @example
8981
9397
  * ```ts
8982
- * import { Cause, Console, Effect, Result } from "effect"
9398
+ * import { Cause, Console, Data, Effect, Result } from "effect"
8983
9399
  *
8984
- * const task = Effect.fail(new Error("Task failed"))
9400
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
9401
+ *
9402
+ * const task = Effect.fail(new TaskError({ message: "Task failed" }))
8985
9403
  *
8986
9404
  * const program = Effect.matchCauseEffect(task, {
8987
9405
  * onFailure: (cause) =>
@@ -9041,11 +9459,13 @@ export declare const matchCauseEffect: {
9041
9459
  * @example
9042
9460
  * ```ts
9043
9461
  * // Title: Handling Both Success and Failure Cases with Side Effects
9044
- * import { Effect } from "effect"
9462
+ * import { Data, Effect } from "effect"
9463
+ *
9464
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
9045
9465
  *
9046
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
9047
- * const failure: Effect.Effect<number, Error> = Effect.fail(
9048
- * new Error("Uh oh!")
9466
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
9467
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
9468
+ * new ExampleError({ message: "Uh oh!" })
9049
9469
  * )
9050
9470
  *
9051
9471
  * const program1 = Effect.matchEffect(success, {
@@ -9101,11 +9521,13 @@ export declare const matchEffect: {
9101
9521
  * @example
9102
9522
  * ```ts
9103
9523
  * // Title: Handling Both Success and Failure Cases with Side Effects
9104
- * import { Effect } from "effect"
9524
+ * import { Data, Effect } from "effect"
9105
9525
  *
9106
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
9107
- * const failure: Effect.Effect<number, Error> = Effect.fail(
9108
- * new Error("Uh oh!")
9526
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
9527
+ *
9528
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
9529
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
9530
+ * new ExampleError({ message: "Uh oh!" })
9109
9531
  * )
9110
9532
  *
9111
9533
  * const program1 = Effect.matchEffect(success, {
@@ -9164,11 +9586,13 @@ export declare const matchEffect: {
9164
9586
  * @example
9165
9587
  * ```ts
9166
9588
  * // Title: Handling Both Success and Failure Cases with Side Effects
9167
- * import { Effect } from "effect"
9589
+ * import { Data, Effect } from "effect"
9590
+ *
9591
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
9168
9592
  *
9169
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
9170
- * const failure: Effect.Effect<number, Error> = Effect.fail(
9171
- * new Error("Uh oh!")
9593
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
9594
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
9595
+ * new ExampleError({ message: "Uh oh!" })
9172
9596
  * )
9173
9597
  *
9174
9598
  * const program1 = Effect.matchEffect(success, {
@@ -9260,7 +9684,7 @@ export declare const isFailure: <A, E, R>(self: Effect<A, E, R>) => Effect<boole
9260
9684
  */
9261
9685
  export declare const isSuccess: <A, E, R>(self: Effect<A, E, R>) => Effect<boolean, never, R>;
9262
9686
  /**
9263
- * Returns the complete service map from the current context.
9687
+ * Returns the complete context.
9264
9688
  *
9265
9689
  * This function allows you to access all services that are currently available
9266
9690
  * in the effect's environment. This can be useful for debugging, introspection,
@@ -9268,56 +9692,56 @@ export declare const isSuccess: <A, E, R>(self: Effect<A, E, R>) => Effect<boole
9268
9692
  *
9269
9693
  * @example
9270
9694
  * ```ts
9271
- * import { Console, Effect, Option, ServiceMap } from "effect"
9695
+ * import { Console, Effect, Option, Context } from "effect"
9272
9696
  *
9273
- * const Logger = ServiceMap.Service<{
9697
+ * const Logger = Context.Service<{
9274
9698
  * log: (msg: string) => void
9275
9699
  * }>("Logger")
9276
- * const Database = ServiceMap.Service<{
9700
+ * const Database = Context.Service<{
9277
9701
  * query: (sql: string) => string
9278
9702
  * }>("Database")
9279
9703
  *
9280
9704
  * const program = Effect.gen(function*() {
9281
- * const allServices = yield* Effect.services()
9705
+ * const allServices = yield* Effect.context()
9282
9706
  *
9283
9707
  * // Check if specific services are available
9284
- * const loggerOption = ServiceMap.getOption(allServices, Logger)
9285
- * const databaseOption = ServiceMap.getOption(allServices, Database)
9708
+ * const loggerOption = Context.getOption(allServices, Logger)
9709
+ * const databaseOption = Context.getOption(allServices, Database)
9286
9710
  *
9287
9711
  * yield* Console.log(`Logger available: ${Option.isSome(loggerOption)}`)
9288
9712
  * yield* Console.log(`Database available: ${Option.isSome(databaseOption)}`)
9289
9713
  * })
9290
9714
  *
9291
- * const serviceMap = ServiceMap.make(Logger, { log: console.log })
9292
- * .pipe(ServiceMap.add(Database, { query: () => "result" }))
9715
+ * const context = Context.make(Logger, { log: console.log })
9716
+ * .pipe(Context.add(Database, { query: () => "result" }))
9293
9717
  *
9294
- * const provided = Effect.provideServices(program, serviceMap)
9718
+ * const provided = Effect.provideContext(program, context)
9295
9719
  * ```
9296
9720
  *
9297
9721
  * @since 2.0.0
9298
9722
  * @category Environment
9299
9723
  */
9300
- export declare const services: <R>() => Effect<ServiceMap.ServiceMap<R>, never, R>;
9724
+ export declare const context: <R = never>() => Effect<Context.Context<R>, never, R>;
9301
9725
  /**
9302
- * Transforms the current service map using the provided function.
9726
+ * Transforms the current context using the provided function.
9303
9727
  *
9304
- * This function allows you to access the complete service map and perform
9728
+ * This function allows you to access the complete context and perform
9305
9729
  * computations based on all available services. This is useful when you need
9306
9730
  * to conditionally execute logic based on what services are available.
9307
9731
  *
9308
9732
  * @example
9309
9733
  * ```ts
9310
- * import { Console, Effect, Option, ServiceMap } from "effect"
9734
+ * import { Console, Effect, Option, Context } from "effect"
9311
9735
  *
9312
- * const Logger = ServiceMap.Service<{
9736
+ * const Logger = Context.Service<{
9313
9737
  * log: (msg: string) => void
9314
9738
  * }>("Logger")
9315
- * const Cache = ServiceMap.Service<{
9739
+ * const Cache = Context.Service<{
9316
9740
  * get: (key: string) => string | null
9317
9741
  * }>("Cache")
9318
9742
  *
9319
- * const program = Effect.servicesWith((services) => {
9320
- * const cacheOption = ServiceMap.getOption(services, Cache)
9743
+ * const program = Effect.contextWith((services) => {
9744
+ * const cacheOption = Context.getOption(services, Cache)
9321
9745
  * const hasCache = Option.isSome(cacheOption)
9322
9746
  *
9323
9747
  * if (hasCache) {
@@ -9342,7 +9766,7 @@ export declare const services: <R>() => Effect<ServiceMap.ServiceMap<R>, never,
9342
9766
  * @since 2.0.0
9343
9767
  * @category Environment
9344
9768
  */
9345
- export declare const servicesWith: <R, A, E, R2>(f: (services: ServiceMap.ServiceMap<R>) => Effect<A, E, R2>) => Effect<A, E, R | R2>;
9769
+ export declare const contextWith: <R, A, E, R2>(f: (context: Context.Context<R>) => Effect<A, E, R2>) => Effect<A, E, R | R2>;
9346
9770
  /**
9347
9771
  * Provides dependencies to an effect using layers or a context. Use `options.local`
9348
9772
  * to build the layer every time; by default, layers are shared between provide
@@ -9350,16 +9774,16 @@ export declare const servicesWith: <R, A, E, R2>(f: (services: ServiceMap.Servic
9350
9774
  *
9351
9775
  * @example
9352
9776
  * ```ts
9353
- * import { Effect, Layer, ServiceMap } from "effect"
9777
+ * import { Effect, Layer, Context } from "effect"
9354
9778
  *
9355
9779
  * interface Database {
9356
9780
  * readonly query: (sql: string) => Effect.Effect<string>
9357
9781
  * }
9358
9782
  *
9359
- * const Database = ServiceMap.Service<Database>("Database")
9783
+ * const Database = Context.Service<Database>("Database")
9360
9784
  *
9361
9785
  * const DatabaseLive = Layer.succeed(Database)({
9362
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
9786
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
9363
9787
  * })
9364
9788
  *
9365
9789
  * const program = Effect.gen(function*() {
@@ -9384,16 +9808,16 @@ export declare const provide: {
9384
9808
  *
9385
9809
  * @example
9386
9810
  * ```ts
9387
- * import { Effect, Layer, ServiceMap } from "effect"
9811
+ * import { Effect, Layer, Context } from "effect"
9388
9812
  *
9389
9813
  * interface Database {
9390
9814
  * readonly query: (sql: string) => Effect.Effect<string>
9391
9815
  * }
9392
9816
  *
9393
- * const Database = ServiceMap.Service<Database>("Database")
9817
+ * const Database = Context.Service<Database>("Database")
9394
9818
  *
9395
9819
  * const DatabaseLive = Layer.succeed(Database)({
9396
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
9820
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
9397
9821
  * })
9398
9822
  *
9399
9823
  * const program = Effect.gen(function*() {
@@ -9420,16 +9844,16 @@ export declare const provide: {
9420
9844
  *
9421
9845
  * @example
9422
9846
  * ```ts
9423
- * import { Effect, Layer, ServiceMap } from "effect"
9847
+ * import { Effect, Layer, Context } from "effect"
9424
9848
  *
9425
9849
  * interface Database {
9426
9850
  * readonly query: (sql: string) => Effect.Effect<string>
9427
9851
  * }
9428
9852
  *
9429
- * const Database = ServiceMap.Service<Database>("Database")
9853
+ * const Database = Context.Service<Database>("Database")
9430
9854
  *
9431
9855
  * const DatabaseLive = Layer.succeed(Database)({
9432
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
9856
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
9433
9857
  * })
9434
9858
  *
9435
9859
  * const program = Effect.gen(function*() {
@@ -9456,16 +9880,16 @@ export declare const provide: {
9456
9880
  *
9457
9881
  * @example
9458
9882
  * ```ts
9459
- * import { Effect, Layer, ServiceMap } from "effect"
9883
+ * import { Effect, Layer, Context } from "effect"
9460
9884
  *
9461
9885
  * interface Database {
9462
9886
  * readonly query: (sql: string) => Effect.Effect<string>
9463
9887
  * }
9464
9888
  *
9465
- * const Database = ServiceMap.Service<Database>("Database")
9889
+ * const Database = Context.Service<Database>("Database")
9466
9890
  *
9467
9891
  * const DatabaseLive = Layer.succeed(Database)({
9468
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
9892
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
9469
9893
  * })
9470
9894
  *
9471
9895
  * const program = Effect.gen(function*() {
@@ -9482,7 +9906,7 @@ export declare const provide: {
9482
9906
  * @since 2.0.0
9483
9907
  * @category Environment
9484
9908
  */
9485
- <R2>(context: ServiceMap.ServiceMap<R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, R2>>;
9909
+ <R2>(context: Context.Context<R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, R2>>;
9486
9910
  /**
9487
9911
  * Provides dependencies to an effect using layers or a context. Use `options.local`
9488
9912
  * to build the layer every time; by default, layers are shared between provide
@@ -9490,16 +9914,16 @@ export declare const provide: {
9490
9914
  *
9491
9915
  * @example
9492
9916
  * ```ts
9493
- * import { Effect, Layer, ServiceMap } from "effect"
9917
+ * import { Effect, Layer, Context } from "effect"
9494
9918
  *
9495
9919
  * interface Database {
9496
9920
  * readonly query: (sql: string) => Effect.Effect<string>
9497
9921
  * }
9498
9922
  *
9499
- * const Database = ServiceMap.Service<Database>("Database")
9923
+ * const Database = Context.Service<Database>("Database")
9500
9924
  *
9501
9925
  * const DatabaseLive = Layer.succeed(Database)({
9502
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
9926
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
9503
9927
  * })
9504
9928
  *
9505
9929
  * const program = Effect.gen(function*() {
@@ -9526,16 +9950,16 @@ export declare const provide: {
9526
9950
  *
9527
9951
  * @example
9528
9952
  * ```ts
9529
- * import { Effect, Layer, ServiceMap } from "effect"
9953
+ * import { Effect, Layer, Context } from "effect"
9530
9954
  *
9531
9955
  * interface Database {
9532
9956
  * readonly query: (sql: string) => Effect.Effect<string>
9533
9957
  * }
9534
9958
  *
9535
- * const Database = ServiceMap.Service<Database>("Database")
9959
+ * const Database = Context.Service<Database>("Database")
9536
9960
  *
9537
9961
  * const DatabaseLive = Layer.succeed(Database)({
9538
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
9962
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
9539
9963
  * })
9540
9964
  *
9541
9965
  * const program = Effect.gen(function*() {
@@ -9562,16 +9986,16 @@ export declare const provide: {
9562
9986
  *
9563
9987
  * @example
9564
9988
  * ```ts
9565
- * import { Effect, Layer, ServiceMap } from "effect"
9989
+ * import { Effect, Layer, Context } from "effect"
9566
9990
  *
9567
9991
  * interface Database {
9568
9992
  * readonly query: (sql: string) => Effect.Effect<string>
9569
9993
  * }
9570
9994
  *
9571
- * const Database = ServiceMap.Service<Database>("Database")
9995
+ * const Database = Context.Service<Database>("Database")
9572
9996
  *
9573
9997
  * const DatabaseLive = Layer.succeed(Database)({
9574
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
9998
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
9575
9999
  * })
9576
10000
  *
9577
10001
  * const program = Effect.gen(function*() {
@@ -9588,32 +10012,32 @@ export declare const provide: {
9588
10012
  * @since 2.0.0
9589
10013
  * @category Environment
9590
10014
  */
9591
- <A, E, R, R2>(self: Effect<A, E, R>, context: ServiceMap.ServiceMap<R2>): Effect<A, E, Exclude<R, R2>>;
10015
+ <A, E, R, R2>(self: Effect<A, E, R>, context: Context.Context<R2>): Effect<A, E, Exclude<R, R2>>;
9592
10016
  };
9593
10017
  /**
9594
- * Provides a service map to an effect, fulfilling its service requirements.
10018
+ * Provides a context to an effect, fulfilling its service requirements.
9595
10019
  *
9596
10020
  * **Details**
9597
10021
  *
9598
- * This function provides multiple services at once by supplying a service map
10022
+ * This function provides multiple services at once by supplying a context
9599
10023
  * that contains all the required services. It removes the provided services
9600
10024
  * from the effect's requirements, making them available to the effect.
9601
10025
  *
9602
10026
  * @example
9603
10027
  * ```ts
9604
- * import { Effect, ServiceMap } from "effect"
10028
+ * import { Effect, Context } from "effect"
9605
10029
  *
9606
10030
  * // Define service keys
9607
- * const Logger = ServiceMap.Service<{
10031
+ * const Logger = Context.Service<{
9608
10032
  * log: (msg: string) => void
9609
10033
  * }>("Logger")
9610
- * const Database = ServiceMap.Service<{
10034
+ * const Database = Context.Service<{
9611
10035
  * query: (sql: string) => string
9612
10036
  * }>("Database")
9613
10037
  *
9614
- * // Create service map with multiple services
9615
- * const serviceMap = ServiceMap.make(Logger, { log: console.log })
9616
- * .pipe(ServiceMap.add(Database, { query: () => "result" }))
10038
+ * // Create a context with multiple services
10039
+ * const context = Context.make(Logger, { log: console.log })
10040
+ * .pipe(Context.add(Database, { query: () => "result" }))
9617
10041
  *
9618
10042
  * // An effect that requires both services
9619
10043
  * const program = Effect.gen(function*() {
@@ -9623,37 +10047,37 @@ export declare const provide: {
9623
10047
  * return db.query("SELECT * FROM users")
9624
10048
  * })
9625
10049
  *
9626
- * const provided = Effect.provideServices(program, serviceMap)
10050
+ * const provided = Effect.provideContext(program, context)
9627
10051
  * ```
9628
10052
  *
9629
10053
  * @since 2.0.0
9630
10054
  * @category Environment
9631
10055
  */
9632
- export declare const provideServices: {
10056
+ export declare const provideContext: {
9633
10057
  /**
9634
- * Provides a service map to an effect, fulfilling its service requirements.
10058
+ * Provides a context to an effect, fulfilling its service requirements.
9635
10059
  *
9636
10060
  * **Details**
9637
10061
  *
9638
- * This function provides multiple services at once by supplying a service map
10062
+ * This function provides multiple services at once by supplying a context
9639
10063
  * that contains all the required services. It removes the provided services
9640
10064
  * from the effect's requirements, making them available to the effect.
9641
10065
  *
9642
10066
  * @example
9643
10067
  * ```ts
9644
- * import { Effect, ServiceMap } from "effect"
10068
+ * import { Effect, Context } from "effect"
9645
10069
  *
9646
10070
  * // Define service keys
9647
- * const Logger = ServiceMap.Service<{
10071
+ * const Logger = Context.Service<{
9648
10072
  * log: (msg: string) => void
9649
10073
  * }>("Logger")
9650
- * const Database = ServiceMap.Service<{
10074
+ * const Database = Context.Service<{
9651
10075
  * query: (sql: string) => string
9652
10076
  * }>("Database")
9653
10077
  *
9654
- * // Create service map with multiple services
9655
- * const serviceMap = ServiceMap.make(Logger, { log: console.log })
9656
- * .pipe(ServiceMap.add(Database, { query: () => "result" }))
10078
+ * // Create a context with multiple services
10079
+ * const context = Context.make(Logger, { log: console.log })
10080
+ * .pipe(Context.add(Database, { query: () => "result" }))
9657
10081
  *
9658
10082
  * // An effect that requires both services
9659
10083
  * const program = Effect.gen(function*() {
@@ -9663,37 +10087,37 @@ export declare const provideServices: {
9663
10087
  * return db.query("SELECT * FROM users")
9664
10088
  * })
9665
10089
  *
9666
- * const provided = Effect.provideServices(program, serviceMap)
10090
+ * const provided = Effect.provideContext(program, context)
9667
10091
  * ```
9668
10092
  *
9669
10093
  * @since 2.0.0
9670
10094
  * @category Environment
9671
10095
  */
9672
- <XR>(context: ServiceMap.ServiceMap<XR>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, XR>>;
10096
+ <XR>(context: Context.Context<XR>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, XR>>;
9673
10097
  /**
9674
- * Provides a service map to an effect, fulfilling its service requirements.
10098
+ * Provides a context to an effect, fulfilling its service requirements.
9675
10099
  *
9676
10100
  * **Details**
9677
10101
  *
9678
- * This function provides multiple services at once by supplying a service map
10102
+ * This function provides multiple services at once by supplying a context
9679
10103
  * that contains all the required services. It removes the provided services
9680
10104
  * from the effect's requirements, making them available to the effect.
9681
10105
  *
9682
10106
  * @example
9683
10107
  * ```ts
9684
- * import { Effect, ServiceMap } from "effect"
10108
+ * import { Effect, Context } from "effect"
9685
10109
  *
9686
10110
  * // Define service keys
9687
- * const Logger = ServiceMap.Service<{
10111
+ * const Logger = Context.Service<{
9688
10112
  * log: (msg: string) => void
9689
10113
  * }>("Logger")
9690
- * const Database = ServiceMap.Service<{
10114
+ * const Database = Context.Service<{
9691
10115
  * query: (sql: string) => string
9692
10116
  * }>("Database")
9693
10117
  *
9694
- * // Create service map with multiple services
9695
- * const serviceMap = ServiceMap.make(Logger, { log: console.log })
9696
- * .pipe(ServiceMap.add(Database, { query: () => "result" }))
10118
+ * // Create a context with multiple services
10119
+ * const context = Context.make(Logger, { log: console.log })
10120
+ * .pipe(Context.add(Database, { query: () => "result" }))
9697
10121
  *
9698
10122
  * // An effect that requires both services
9699
10123
  * const program = Effect.gen(function*() {
@@ -9703,26 +10127,26 @@ export declare const provideServices: {
9703
10127
  * return db.query("SELECT * FROM users")
9704
10128
  * })
9705
10129
  *
9706
- * const provided = Effect.provideServices(program, serviceMap)
10130
+ * const provided = Effect.provideContext(program, context)
9707
10131
  * ```
9708
10132
  *
9709
10133
  * @since 2.0.0
9710
10134
  * @category Environment
9711
10135
  */
9712
- <A, E, R, XR>(self: Effect<A, E, R>, context: ServiceMap.ServiceMap<XR>): Effect<A, E, Exclude<R, XR>>;
10136
+ <A, E, R, XR>(self: Effect<A, E, R>, context: Context.Context<XR>): Effect<A, E, Exclude<R, XR>>;
9713
10137
  };
9714
10138
  /**
9715
10139
  * Accesses a service from the context.
9716
10140
  *
9717
10141
  * @example
9718
10142
  * ```ts
9719
- * import { Effect, ServiceMap } from "effect"
10143
+ * import { Effect, Context } from "effect"
9720
10144
  *
9721
10145
  * interface Database {
9722
10146
  * readonly query: (sql: string) => Effect.Effect<string>
9723
10147
  * }
9724
10148
  *
9725
- * const Database = ServiceMap.Service<Database>("Database")
10149
+ * const Database = Context.Service<Database>("Database")
9726
10150
  *
9727
10151
  * const program = Effect.gen(function*() {
9728
10152
  * const db = yield* Effect.service(Database)
@@ -9731,9 +10155,9 @@ export declare const provideServices: {
9731
10155
  * ```
9732
10156
  *
9733
10157
  * @since 4.0.0
9734
- * @category ServiceMap
10158
+ * @category Context
9735
10159
  */
9736
- export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effect<S, never, I>;
10160
+ export declare const service: <I, S>(service: Context.Key<I, S>) => Effect<S, never, I>;
9737
10161
  /**
9738
10162
  * Optionally accesses a service from the environment.
9739
10163
  *
@@ -9746,10 +10170,10 @@ export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effec
9746
10170
  *
9747
10171
  * @example
9748
10172
  * ```ts
9749
- * import { Effect, Option, ServiceMap } from "effect"
10173
+ * import { Effect, Option, Context } from "effect"
9750
10174
  *
9751
10175
  * // Define a service key
9752
- * const Logger = ServiceMap.Service<{
10176
+ * const Logger = Context.Service<{
9753
10177
  * log: (msg: string) => void
9754
10178
  * }>("Logger")
9755
10179
  *
@@ -9766,9 +10190,9 @@ export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effec
9766
10190
  * ```
9767
10191
  *
9768
10192
  * @since 2.0.0
9769
- * @category ServiceMap
10193
+ * @category Context
9770
10194
  */
9771
- export declare const serviceOption: <I, S>(key: ServiceMap.Service<I, S>) => Effect<Option<S>>;
10195
+ export declare const serviceOption: <I, S>(key: Context.Key<I, S>) => Effect<Option<S>>;
9772
10196
  /**
9773
10197
  * Provides part of the required context while leaving the rest unchanged.
9774
10198
  *
@@ -9779,13 +10203,13 @@ export declare const serviceOption: <I, S>(key: ServiceMap.Service<I, S>) => Eff
9779
10203
  *
9780
10204
  * @example
9781
10205
  * ```ts
9782
- * import { Effect, ServiceMap } from "effect"
10206
+ * import { Effect, Context } from "effect"
9783
10207
  *
9784
10208
  * // Define services
9785
- * const Logger = ServiceMap.Service<{
10209
+ * const Logger = Context.Service<{
9786
10210
  * log: (msg: string) => void
9787
10211
  * }>("Logger")
9788
- * const Config = ServiceMap.Service<{
10212
+ * const Config = Context.Service<{
9789
10213
  * name: string
9790
10214
  * }>("Config")
9791
10215
  *
@@ -9795,8 +10219,8 @@ export declare const serviceOption: <I, S>(key: ServiceMap.Service<I, S>) => Eff
9795
10219
  *
9796
10220
  * // Transform services by providing Config while keeping Logger requirement
9797
10221
  * const configured = program.pipe(
9798
- * Effect.updateServices((services: ServiceMap.ServiceMap<typeof Logger>) =>
9799
- * ServiceMap.add(services, Config, { name: "World" })
10222
+ * Effect.updateContext((context: Context.Context<typeof Logger>) =>
10223
+ * Context.add(context, Config, { name: "World" })
9800
10224
  * )
9801
10225
  * )
9802
10226
  *
@@ -9807,9 +10231,9 @@ export declare const serviceOption: <I, S>(key: ServiceMap.Service<I, S>) => Eff
9807
10231
  * ```
9808
10232
  *
9809
10233
  * @since 4.0.0
9810
- * @category ServiceMap
10234
+ * @category Context
9811
10235
  */
9812
- export declare const updateServices: {
10236
+ export declare const updateContext: {
9813
10237
  /**
9814
10238
  * Provides part of the required context while leaving the rest unchanged.
9815
10239
  *
@@ -9820,13 +10244,13 @@ export declare const updateServices: {
9820
10244
  *
9821
10245
  * @example
9822
10246
  * ```ts
9823
- * import { Effect, ServiceMap } from "effect"
10247
+ * import { Effect, Context } from "effect"
9824
10248
  *
9825
10249
  * // Define services
9826
- * const Logger = ServiceMap.Service<{
10250
+ * const Logger = Context.Service<{
9827
10251
  * log: (msg: string) => void
9828
10252
  * }>("Logger")
9829
- * const Config = ServiceMap.Service<{
10253
+ * const Config = Context.Service<{
9830
10254
  * name: string
9831
10255
  * }>("Config")
9832
10256
  *
@@ -9836,8 +10260,8 @@ export declare const updateServices: {
9836
10260
  *
9837
10261
  * // Transform services by providing Config while keeping Logger requirement
9838
10262
  * const configured = program.pipe(
9839
- * Effect.updateServices((services: ServiceMap.ServiceMap<typeof Logger>) =>
9840
- * ServiceMap.add(services, Config, { name: "World" })
10263
+ * Effect.updateContext((context: Context.Context<typeof Logger>) =>
10264
+ * Context.add(context, Config, { name: "World" })
9841
10265
  * )
9842
10266
  * )
9843
10267
  *
@@ -9848,9 +10272,9 @@ export declare const updateServices: {
9848
10272
  * ```
9849
10273
  *
9850
10274
  * @since 4.0.0
9851
- * @category ServiceMap
10275
+ * @category Context
9852
10276
  */
9853
- <R2, R>(f: (services: ServiceMap.ServiceMap<R2>) => ServiceMap.ServiceMap<NoInfer<R>>): <A, E>(self: Effect<A, E, R>) => Effect<A, E, R2>;
10277
+ <R2, R>(f: (context: Context.Context<R2>) => Context.Context<NoInfer<R>>): <A, E>(self: Effect<A, E, R>) => Effect<A, E, R2>;
9854
10278
  /**
9855
10279
  * Provides part of the required context while leaving the rest unchanged.
9856
10280
  *
@@ -9861,13 +10285,13 @@ export declare const updateServices: {
9861
10285
  *
9862
10286
  * @example
9863
10287
  * ```ts
9864
- * import { Effect, ServiceMap } from "effect"
10288
+ * import { Effect, Context } from "effect"
9865
10289
  *
9866
10290
  * // Define services
9867
- * const Logger = ServiceMap.Service<{
10291
+ * const Logger = Context.Service<{
9868
10292
  * log: (msg: string) => void
9869
10293
  * }>("Logger")
9870
- * const Config = ServiceMap.Service<{
10294
+ * const Config = Context.Service<{
9871
10295
  * name: string
9872
10296
  * }>("Config")
9873
10297
  *
@@ -9877,8 +10301,8 @@ export declare const updateServices: {
9877
10301
  *
9878
10302
  * // Transform services by providing Config while keeping Logger requirement
9879
10303
  * const configured = program.pipe(
9880
- * Effect.updateServices((services: ServiceMap.ServiceMap<typeof Logger>) =>
9881
- * ServiceMap.add(services, Config, { name: "World" })
10304
+ * Effect.updateContext((context: Context.Context<typeof Logger>) =>
10305
+ * Context.add(context, Config, { name: "World" })
9882
10306
  * )
9883
10307
  * )
9884
10308
  *
@@ -9889,19 +10313,19 @@ export declare const updateServices: {
9889
10313
  * ```
9890
10314
  *
9891
10315
  * @since 4.0.0
9892
- * @category ServiceMap
10316
+ * @category Context
9893
10317
  */
9894
- <A, E, R, R2>(self: Effect<A, E, R>, f: (services: ServiceMap.ServiceMap<R2>) => ServiceMap.ServiceMap<NoInfer<R>>): Effect<A, E, R2>;
10318
+ <A, E, R, R2>(self: Effect<A, E, R>, f: (context: Context.Context<R2>) => Context.Context<NoInfer<R>>): Effect<A, E, R2>;
9895
10319
  };
9896
10320
  /**
9897
10321
  * Updates the service with the required service entry.
9898
10322
  *
9899
10323
  * @example
9900
10324
  * ```ts
9901
- * import { Console, Effect, ServiceMap } from "effect"
10325
+ * import { Console, Effect, Context } from "effect"
9902
10326
  *
9903
10327
  * // Define a counter service
9904
- * const Counter = ServiceMap.Service<{ count: number }>("Counter")
10328
+ * const Counter = Context.Service<{ count: number }>("Counter")
9905
10329
  *
9906
10330
  * const program = Effect.gen(function*() {
9907
10331
  * const updatedCounter = yield* Effect.service(Counter)
@@ -9919,7 +10343,7 @@ export declare const updateServices: {
9919
10343
  * ```
9920
10344
  *
9921
10345
  * @since 2.0.0
9922
- * @category ServiceMap
10346
+ * @category Context
9923
10347
  */
9924
10348
  export declare const updateService: {
9925
10349
  /**
@@ -9927,10 +10351,10 @@ export declare const updateService: {
9927
10351
  *
9928
10352
  * @example
9929
10353
  * ```ts
9930
- * import { Console, Effect, ServiceMap } from "effect"
10354
+ * import { Console, Effect, Context } from "effect"
9931
10355
  *
9932
10356
  * // Define a counter service
9933
- * const Counter = ServiceMap.Service<{ count: number }>("Counter")
10357
+ * const Counter = Context.Service<{ count: number }>("Counter")
9934
10358
  *
9935
10359
  * const program = Effect.gen(function*() {
9936
10360
  * const updatedCounter = yield* Effect.service(Counter)
@@ -9948,18 +10372,18 @@ export declare const updateService: {
9948
10372
  * ```
9949
10373
  *
9950
10374
  * @since 2.0.0
9951
- * @category ServiceMap
10375
+ * @category Context
9952
10376
  */
9953
- <I, A>(service: ServiceMap.Service<I, A>, f: (value: A) => A): <XA, E, R>(self: Effect<XA, E, R>) => Effect<XA, E, R | I>;
10377
+ <I, A>(service: Context.Key<I, A>, f: (value: A) => A): <XA, E, R>(self: Effect<XA, E, R>) => Effect<XA, E, R | I>;
9954
10378
  /**
9955
10379
  * Updates the service with the required service entry.
9956
10380
  *
9957
10381
  * @example
9958
10382
  * ```ts
9959
- * import { Console, Effect, ServiceMap } from "effect"
10383
+ * import { Console, Effect, Context } from "effect"
9960
10384
  *
9961
10385
  * // Define a counter service
9962
- * const Counter = ServiceMap.Service<{ count: number }>("Counter")
10386
+ * const Counter = Context.Service<{ count: number }>("Counter")
9963
10387
  *
9964
10388
  * const program = Effect.gen(function*() {
9965
10389
  * const updatedCounter = yield* Effect.service(Counter)
@@ -9977,9 +10401,9 @@ export declare const updateService: {
9977
10401
  * ```
9978
10402
  *
9979
10403
  * @since 2.0.0
9980
- * @category ServiceMap
10404
+ * @category Context
9981
10405
  */
9982
- <XA, E, R, I, A>(self: Effect<XA, E, R>, service: ServiceMap.Service<I, A>, f: (value: A) => A): Effect<XA, E, R | I>;
10406
+ <XA, E, R, I, A>(self: Effect<XA, E, R>, service: Context.Key<I, A>, f: (value: A) => A): Effect<XA, E, R | I>;
9983
10407
  };
9984
10408
  /**
9985
10409
  * The `provideService` function is used to provide an actual
@@ -9995,10 +10419,10 @@ export declare const updateService: {
9995
10419
  *
9996
10420
  * @example
9997
10421
  * ```ts
9998
- * import { Console, Effect, ServiceMap } from "effect"
10422
+ * import { Console, Effect, Context } from "effect"
9999
10423
  *
10000
10424
  * // Define a service for configuration
10001
- * const Config = ServiceMap.Service<{
10425
+ * const Config = Context.Service<{
10002
10426
  * apiUrl: string
10003
10427
  * timeout: number
10004
10428
  * }>("Config")
@@ -10024,7 +10448,7 @@ export declare const updateService: {
10024
10448
  * ```
10025
10449
  *
10026
10450
  * @since 2.0.0
10027
- * @category ServiceMap
10451
+ * @category Context
10028
10452
  */
10029
10453
  export declare const provideService: {
10030
10454
  /**
@@ -10041,10 +10465,10 @@ export declare const provideService: {
10041
10465
  *
10042
10466
  * @example
10043
10467
  * ```ts
10044
- * import { Console, Effect, ServiceMap } from "effect"
10468
+ * import { Console, Effect, Context } from "effect"
10045
10469
  *
10046
10470
  * // Define a service for configuration
10047
- * const Config = ServiceMap.Service<{
10471
+ * const Config = Context.Service<{
10048
10472
  * apiUrl: string
10049
10473
  * timeout: number
10050
10474
  * }>("Config")
@@ -10070,9 +10494,9 @@ export declare const provideService: {
10070
10494
  * ```
10071
10495
  *
10072
10496
  * @since 2.0.0
10073
- * @category ServiceMap
10497
+ * @category Context
10074
10498
  */
10075
- <I, S>(service: ServiceMap.Service<I, S>): {
10499
+ <I, S>(service: Context.Key<I, S>): {
10076
10500
  /**
10077
10501
  * The `provideService` function is used to provide an actual
10078
10502
  * implementation for a service in the context of an effect.
@@ -10087,10 +10511,10 @@ export declare const provideService: {
10087
10511
  *
10088
10512
  * @example
10089
10513
  * ```ts
10090
- * import { Console, Effect, ServiceMap } from "effect"
10514
+ * import { Console, Effect, Context } from "effect"
10091
10515
  *
10092
10516
  * // Define a service for configuration
10093
- * const Config = ServiceMap.Service<{
10517
+ * const Config = Context.Service<{
10094
10518
  * apiUrl: string
10095
10519
  * timeout: number
10096
10520
  * }>("Config")
@@ -10116,7 +10540,7 @@ export declare const provideService: {
10116
10540
  * ```
10117
10541
  *
10118
10542
  * @since 2.0.0
10119
- * @category ServiceMap
10543
+ * @category Context
10120
10544
  */
10121
10545
  (implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
10122
10546
  /**
@@ -10133,10 +10557,10 @@ export declare const provideService: {
10133
10557
  *
10134
10558
  * @example
10135
10559
  * ```ts
10136
- * import { Console, Effect, ServiceMap } from "effect"
10560
+ * import { Console, Effect, Context } from "effect"
10137
10561
  *
10138
10562
  * // Define a service for configuration
10139
- * const Config = ServiceMap.Service<{
10563
+ * const Config = Context.Service<{
10140
10564
  * apiUrl: string
10141
10565
  * timeout: number
10142
10566
  * }>("Config")
@@ -10162,7 +10586,7 @@ export declare const provideService: {
10162
10586
  * ```
10163
10587
  *
10164
10588
  * @since 2.0.0
10165
- * @category ServiceMap
10589
+ * @category Context
10166
10590
  */
10167
10591
  <A, E, R>(self: Effect<A, E, R>, implementation: S): Effect<A, E, Exclude<R, I>>;
10168
10592
  };
@@ -10180,10 +10604,10 @@ export declare const provideService: {
10180
10604
  *
10181
10605
  * @example
10182
10606
  * ```ts
10183
- * import { Console, Effect, ServiceMap } from "effect"
10607
+ * import { Console, Effect, Context } from "effect"
10184
10608
  *
10185
10609
  * // Define a service for configuration
10186
- * const Config = ServiceMap.Service<{
10610
+ * const Config = Context.Service<{
10187
10611
  * apiUrl: string
10188
10612
  * timeout: number
10189
10613
  * }>("Config")
@@ -10209,9 +10633,9 @@ export declare const provideService: {
10209
10633
  * ```
10210
10634
  *
10211
10635
  * @since 2.0.0
10212
- * @category ServiceMap
10636
+ * @category Context
10213
10637
  */
10214
- <I, S>(service: ServiceMap.Service<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
10638
+ <I, S>(service: Context.Key<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
10215
10639
  /**
10216
10640
  * The `provideService` function is used to provide an actual
10217
10641
  * implementation for a service in the context of an effect.
@@ -10226,10 +10650,10 @@ export declare const provideService: {
10226
10650
  *
10227
10651
  * @example
10228
10652
  * ```ts
10229
- * import { Console, Effect, ServiceMap } from "effect"
10653
+ * import { Console, Effect, Context } from "effect"
10230
10654
  *
10231
10655
  * // Define a service for configuration
10232
- * const Config = ServiceMap.Service<{
10656
+ * const Config = Context.Service<{
10233
10657
  * apiUrl: string
10234
10658
  * timeout: number
10235
10659
  * }>("Config")
@@ -10255,9 +10679,9 @@ export declare const provideService: {
10255
10679
  * ```
10256
10680
  *
10257
10681
  * @since 2.0.0
10258
- * @category ServiceMap
10682
+ * @category Context
10259
10683
  */
10260
- <A, E, R, I, S>(self: Effect<A, E, R>, service: ServiceMap.Service<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>;
10684
+ <A, E, R, I, S>(self: Effect<A, E, R>, service: Context.Key<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>;
10261
10685
  };
10262
10686
  /**
10263
10687
  * Provides the effect with the single service it requires. If the effect
@@ -10271,13 +10695,13 @@ export declare const provideService: {
10271
10695
  *
10272
10696
  * @example
10273
10697
  * ```ts
10274
- * import { Console, Effect, ServiceMap } from "effect"
10698
+ * import { Console, Effect, Context } from "effect"
10275
10699
  *
10276
10700
  * // Define a database connection service
10277
10701
  * interface DatabaseConnection {
10278
10702
  * readonly query: (sql: string) => Effect.Effect<string>
10279
10703
  * }
10280
- * const Database = ServiceMap.Service<DatabaseConnection>("Database")
10704
+ * const Database = Context.Service<DatabaseConnection>("Database")
10281
10705
  *
10282
10706
  * // Effect that creates a database connection
10283
10707
  * const createConnection = Effect.gen(function*() {
@@ -10309,7 +10733,7 @@ export declare const provideService: {
10309
10733
  * ```
10310
10734
  *
10311
10735
  * @since 2.0.0
10312
- * @category ServiceMap
10736
+ * @category Context
10313
10737
  */
10314
10738
  export declare const provideServiceEffect: {
10315
10739
  /**
@@ -10324,13 +10748,13 @@ export declare const provideServiceEffect: {
10324
10748
  *
10325
10749
  * @example
10326
10750
  * ```ts
10327
- * import { Console, Effect, ServiceMap } from "effect"
10751
+ * import { Console, Effect, Context } from "effect"
10328
10752
  *
10329
10753
  * // Define a database connection service
10330
10754
  * interface DatabaseConnection {
10331
10755
  * readonly query: (sql: string) => Effect.Effect<string>
10332
10756
  * }
10333
- * const Database = ServiceMap.Service<DatabaseConnection>("Database")
10757
+ * const Database = Context.Service<DatabaseConnection>("Database")
10334
10758
  *
10335
10759
  * // Effect that creates a database connection
10336
10760
  * const createConnection = Effect.gen(function*() {
@@ -10362,9 +10786,9 @@ export declare const provideServiceEffect: {
10362
10786
  * ```
10363
10787
  *
10364
10788
  * @since 2.0.0
10365
- * @category ServiceMap
10789
+ * @category Context
10366
10790
  */
10367
- <I, S, E2, R2>(service: ServiceMap.Service<I, S>, acquire: Effect<S, E2, R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | E2, Exclude<R, I> | R2>;
10791
+ <I, S, E2, R2>(service: Context.Key<I, S>, acquire: Effect<S, E2, R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | E2, Exclude<R, I> | R2>;
10368
10792
  /**
10369
10793
  * Provides the effect with the single service it requires. If the effect
10370
10794
  * requires more than one service use `provide` instead.
@@ -10377,13 +10801,13 @@ export declare const provideServiceEffect: {
10377
10801
  *
10378
10802
  * @example
10379
10803
  * ```ts
10380
- * import { Console, Effect, ServiceMap } from "effect"
10804
+ * import { Console, Effect, Context } from "effect"
10381
10805
  *
10382
10806
  * // Define a database connection service
10383
10807
  * interface DatabaseConnection {
10384
10808
  * readonly query: (sql: string) => Effect.Effect<string>
10385
10809
  * }
10386
- * const Database = ServiceMap.Service<DatabaseConnection>("Database")
10810
+ * const Database = Context.Service<DatabaseConnection>("Database")
10387
10811
  *
10388
10812
  * // Effect that creates a database connection
10389
10813
  * const createConnection = Effect.gen(function*() {
@@ -10415,9 +10839,9 @@ export declare const provideServiceEffect: {
10415
10839
  * ```
10416
10840
  *
10417
10841
  * @since 2.0.0
10418
- * @category ServiceMap
10842
+ * @category Context
10419
10843
  */
10420
- <A, E, R, I, S, E2, R2>(self: Effect<A, E, R>, service: ServiceMap.Service<I, S>, acquire: Effect<S, E2, R2>): Effect<A, E | E2, Exclude<R, I> | R2>;
10844
+ <A, E, R, I, S, E2, R2>(self: Effect<A, E, R>, service: Context.Key<I, S>, acquire: Effect<S, E2, R2>): Effect<A, E | E2, Exclude<R, I> | R2>;
10421
10845
  };
10422
10846
  /**
10423
10847
  * Sets the concurrency level for parallel operations within an effect.
@@ -10672,7 +11096,9 @@ export declare const scopedWith: <A, E, R>(f: (scope: Scope) => Effect<A, E, R>)
10672
11096
  * @since 2.0.0
10673
11097
  * @category Resource Management & Finalization
10674
11098
  */
10675
- export declare const acquireRelease: <A, E, R>(acquire: Effect<A, E, R>, release: (a: A, exit: Exit.Exit<unknown, unknown>) => Effect<unknown>) => Effect<A, E, R | Scope>;
11099
+ export declare const acquireRelease: <A, E, R, R2>(acquire: Effect<A, E, R>, release: (a: A, exit: Exit.Exit<unknown, unknown>) => Effect<unknown, never, R2>, options?: {
11100
+ readonly interruptible?: boolean;
11101
+ }) => Effect<A, E, R | R2 | Scope>;
10676
11102
  /**
10677
11103
  * This function is used to ensure that an `Effect` value that represents the
10678
11104
  * acquisition of a resource (for example, opening a file, launching a thread,
@@ -10914,9 +11340,11 @@ export declare const ensuring: {
10914
11340
  *
10915
11341
  * @example
10916
11342
  * ```ts
10917
- * import { Cause, Console, Effect } from "effect"
11343
+ * import { Cause, Data, Console, Effect } from "effect"
11344
+ *
11345
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
10918
11346
  *
10919
- * const task = Effect.fail(new Error("Something went wrong"))
11347
+ * const task = Effect.fail(new TaskError({ message: "Something went wrong" }))
10920
11348
  *
10921
11349
  * const program = Effect.onError(
10922
11350
  * task,
@@ -10925,8 +11353,8 @@ export declare const ensuring: {
10925
11353
  *
10926
11354
  * Effect.runPromise(program).catch(console.error)
10927
11355
  * // Output:
10928
- * // Cleanup on error: Error: Something went wrong
10929
- * // Error: Something went wrong
11356
+ * // Cleanup on error: TaskError: Something went wrong
11357
+ * // TaskError: Something went wrong
10930
11358
  * ```
10931
11359
  *
10932
11360
  * @since 2.0.0
@@ -10939,9 +11367,11 @@ export declare const onError: {
10939
11367
  *
10940
11368
  * @example
10941
11369
  * ```ts
10942
- * import { Cause, Console, Effect } from "effect"
11370
+ * import { Cause, Data, Console, Effect } from "effect"
11371
+ *
11372
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
10943
11373
  *
10944
- * const task = Effect.fail(new Error("Something went wrong"))
11374
+ * const task = Effect.fail(new TaskError({ message: "Something went wrong" }))
10945
11375
  *
10946
11376
  * const program = Effect.onError(
10947
11377
  * task,
@@ -10950,8 +11380,8 @@ export declare const onError: {
10950
11380
  *
10951
11381
  * Effect.runPromise(program).catch(console.error)
10952
11382
  * // Output:
10953
- * // Cleanup on error: Error: Something went wrong
10954
- * // Error: Something went wrong
11383
+ * // Cleanup on error: TaskError: Something went wrong
11384
+ * // TaskError: Something went wrong
10955
11385
  * ```
10956
11386
  *
10957
11387
  * @since 2.0.0
@@ -10964,9 +11394,11 @@ export declare const onError: {
10964
11394
  *
10965
11395
  * @example
10966
11396
  * ```ts
10967
- * import { Cause, Console, Effect } from "effect"
11397
+ * import { Cause, Data, Console, Effect } from "effect"
11398
+ *
11399
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
10968
11400
  *
10969
- * const task = Effect.fail(new Error("Something went wrong"))
11401
+ * const task = Effect.fail(new TaskError({ message: "Something went wrong" }))
10970
11402
  *
10971
11403
  * const program = Effect.onError(
10972
11404
  * task,
@@ -10975,8 +11407,8 @@ export declare const onError: {
10975
11407
  *
10976
11408
  * Effect.runPromise(program).catch(console.error)
10977
11409
  * // Output:
10978
- * // Cleanup on error: Error: Something went wrong
10979
- * // Error: Something went wrong
11410
+ * // Cleanup on error: TaskError: Something went wrong
11411
+ * // TaskError: Something went wrong
10980
11412
  * ```
10981
11413
  *
10982
11414
  * @since 2.0.0
@@ -10986,7 +11418,7 @@ export declare const onError: {
10986
11418
  };
10987
11419
  /**
10988
11420
  * Runs the finalizer only when this effect fails and the `Cause` matches the
10989
- * filter, passing the filtered failure and the original cause.
11421
+ * provided predicate.
10990
11422
  *
10991
11423
  * @example
10992
11424
  * ```ts
@@ -11010,7 +11442,7 @@ export declare const onError: {
11010
11442
  export declare const onErrorIf: {
11011
11443
  /**
11012
11444
  * Runs the finalizer only when this effect fails and the `Cause` matches the
11013
- * filter, passing the filtered failure and the original cause.
11445
+ * provided predicate.
11014
11446
  *
11015
11447
  * @example
11016
11448
  * ```ts
@@ -11031,10 +11463,10 @@ export declare const onErrorIf: {
11031
11463
  * @since 4.0.0
11032
11464
  * @category Resource Management & Finalization
11033
11465
  */
11034
- <E, Result extends Filter.ResultOrBool, XE, XR>(filter: Filter.OrPredicate<Cause.Cause<E>, Result>, f: (failure: Filter.Pass<Cause.Cause<E>, Result>, cause: Cause.Cause<E>) => Effect<void, XE, XR>): <A, R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
11466
+ <E, XE, XR>(predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<void, XE, XR>): <A, R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
11035
11467
  /**
11036
11468
  * Runs the finalizer only when this effect fails and the `Cause` matches the
11037
- * filter, passing the filtered failure and the original cause.
11469
+ * provided predicate.
11038
11470
  *
11039
11471
  * @example
11040
11472
  * ```ts
@@ -11055,7 +11487,29 @@ export declare const onErrorIf: {
11055
11487
  * @since 4.0.0
11056
11488
  * @category Resource Management & Finalization
11057
11489
  */
11058
- <A, E, R, XE, XR, Result extends Filter.ResultOrBool>(self: Effect<A, E, R>, filter: Filter.OrPredicate<Cause.Cause<E>, Result>, f: (failure: Filter.Pass<Cause.Cause<E>, Result>, cause: Cause.Cause<E>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
11490
+ <A, E, R, XE, XR>(self: Effect<A, E, R>, predicate: Predicate.Predicate<Cause.Cause<E>>, f: (cause: Cause.Cause<E>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
11491
+ };
11492
+ /**
11493
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
11494
+ *
11495
+ * @since 4.0.0
11496
+ * @category Resource Management & Finalization
11497
+ */
11498
+ export declare const onErrorFilter: {
11499
+ /**
11500
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
11501
+ *
11502
+ * @since 4.0.0
11503
+ * @category Resource Management & Finalization
11504
+ */
11505
+ <A, E, EB, X, XE, XR>(filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (failure: EB, cause: Cause.Cause<E>) => Effect<void, XE, XR>): <R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
11506
+ /**
11507
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
11508
+ *
11509
+ * @since 4.0.0
11510
+ * @category Resource Management & Finalization
11511
+ */
11512
+ <A, E, R, EB, X, XE, XR>(self: Effect<A, E, R>, filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (failure: EB, cause: Cause.Cause<E>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
11059
11513
  };
11060
11514
  /**
11061
11515
  * The low level primitive that powers `onExit`.
@@ -11149,20 +11603,20 @@ export declare const onExit: {
11149
11603
  <A, E, R, XE = never, XR = never>(self: Effect<A, E, R>, f: (exit: Exit.Exit<A, E>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
11150
11604
  };
11151
11605
  /**
11152
- * Runs the cleanup effect only when the `Exit` passes the provided filter.
11153
- *
11154
- * The cleanup is skipped when the filter returns `Filter.fail`.
11606
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
11607
+ * predicate.
11155
11608
  *
11156
11609
  * @example
11157
11610
  * ```ts
11158
- * import { Console, Effect, Exit, Filter } from "effect"
11159
- *
11160
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
11611
+ * import { Console, Effect, Exit } from "effect"
11161
11612
  *
11162
11613
  * const program = Effect.onExitIf(
11163
11614
  * Effect.succeed(42),
11164
- * exitFilter,
11165
- * (success) => Console.log(`Succeeded with: ${success.value}`)
11615
+ * Exit.isSuccess,
11616
+ * (exit) =>
11617
+ * Exit.isSuccess(exit)
11618
+ * ? Console.log(`Succeeded with: ${exit.value}`)
11619
+ * : Effect.void
11166
11620
  * )
11167
11621
  * ```
11168
11622
  *
@@ -11171,49 +11625,71 @@ export declare const onExit: {
11171
11625
  */
11172
11626
  export declare const onExitIf: {
11173
11627
  /**
11174
- * Runs the cleanup effect only when the `Exit` passes the provided filter.
11175
- *
11176
- * The cleanup is skipped when the filter returns `Filter.fail`.
11628
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
11629
+ * predicate.
11177
11630
  *
11178
11631
  * @example
11179
11632
  * ```ts
11180
- * import { Console, Effect, Exit, Filter } from "effect"
11181
- *
11182
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
11633
+ * import { Console, Effect, Exit } from "effect"
11183
11634
  *
11184
11635
  * const program = Effect.onExitIf(
11185
11636
  * Effect.succeed(42),
11186
- * exitFilter,
11187
- * (success) => Console.log(`Succeeded with: ${success.value}`)
11637
+ * Exit.isSuccess,
11638
+ * (exit) =>
11639
+ * Exit.isSuccess(exit)
11640
+ * ? Console.log(`Succeeded with: ${exit.value}`)
11641
+ * : Effect.void
11188
11642
  * )
11189
11643
  * ```
11190
11644
  *
11191
11645
  * @since 4.0.0
11192
11646
  * @category Resource Management & Finalization
11193
11647
  */
11194
- <A, E, XE, XR, Result extends Filter.ResultOrBool>(filter: Filter.OrPredicate<Exit.Exit<NoInfer<A>, NoInfer<E>>, Result>, f: (pass: Filter.Pass<Exit.Exit<NoInfer<A>, NoInfer<E>>, Result>, exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): <R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
11648
+ <A, E, XE, XR>(predicate: Predicate.Predicate<Exit.Exit<NoInfer<A>, NoInfer<E>>>, f: (exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): <R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
11195
11649
  /**
11196
- * Runs the cleanup effect only when the `Exit` passes the provided filter.
11197
- *
11198
- * The cleanup is skipped when the filter returns `Filter.fail`.
11650
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
11651
+ * predicate.
11199
11652
  *
11200
11653
  * @example
11201
11654
  * ```ts
11202
- * import { Console, Effect, Exit, Filter } from "effect"
11203
- *
11204
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
11655
+ * import { Console, Effect, Exit } from "effect"
11205
11656
  *
11206
11657
  * const program = Effect.onExitIf(
11207
11658
  * Effect.succeed(42),
11208
- * exitFilter,
11209
- * (success) => Console.log(`Succeeded with: ${success.value}`)
11659
+ * Exit.isSuccess,
11660
+ * (exit) =>
11661
+ * Exit.isSuccess(exit)
11662
+ * ? Console.log(`Succeeded with: ${exit.value}`)
11663
+ * : Effect.void
11210
11664
  * )
11211
11665
  * ```
11212
11666
  *
11213
11667
  * @since 4.0.0
11214
11668
  * @category Resource Management & Finalization
11215
11669
  */
11216
- <A, E, R, XE, XR, Result extends Filter.ResultOrBool>(self: Effect<A, E, R>, filter: Filter.OrPredicate<Exit.Exit<NoInfer<A>, NoInfer<E>>, Result>, f: (pass: Filter.Pass<Exit.Exit<NoInfer<A>, NoInfer<E>>, Result>, exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
11670
+ <A, E, R, XE, XR>(self: Effect<A, E, R>, predicate: Predicate.Predicate<Exit.Exit<NoInfer<A>, NoInfer<E>>>, f: (exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
11671
+ };
11672
+ /**
11673
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
11674
+ *
11675
+ * @since 4.0.0
11676
+ * @category Resource Management & Finalization
11677
+ */
11678
+ export declare const onExitFilter: {
11679
+ /**
11680
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
11681
+ *
11682
+ * @since 4.0.0
11683
+ * @category Resource Management & Finalization
11684
+ */
11685
+ <A, E, XE, XR, B, X>(filter: Filter.Filter<Exit.Exit<NoInfer<A>, NoInfer<E>>, B, X>, f: (b: B, exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): <R>(self: Effect<A, E, R>) => Effect<A, E | XE, R | XR>;
11686
+ /**
11687
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
11688
+ *
11689
+ * @since 4.0.0
11690
+ * @category Resource Management & Finalization
11691
+ */
11692
+ <A, E, R, XE, XR, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<Exit.Exit<NoInfer<A>, NoInfer<E>>, B, X>, f: (b: B, exit: Exit.Exit<NoInfer<A>, NoInfer<E>>) => Effect<void, XE, XR>): Effect<A, E | XE, R | XR>;
11217
11693
  };
11218
11694
  /**
11219
11695
  * Returns an effect that lazily computes a result and caches it for subsequent
@@ -11412,7 +11888,7 @@ export declare const cachedWithTTL: {
11412
11888
  * @since 2.0.0
11413
11889
  * @category Caching
11414
11890
  */
11415
- (timeToLive: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<A, E, R>>;
11891
+ (timeToLive: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<A, E, R>>;
11416
11892
  /**
11417
11893
  * Returns an effect that caches its result for a specified `Duration`,
11418
11894
  * known as "timeToLive" (TTL).
@@ -11479,7 +11955,7 @@ export declare const cachedWithTTL: {
11479
11955
  * @since 2.0.0
11480
11956
  * @category Caching
11481
11957
  */
11482
- <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.DurationInput): Effect<Effect<A, E, R>>;
11958
+ <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.Input): Effect<Effect<A, E, R>>;
11483
11959
  };
11484
11960
  /**
11485
11961
  * Caches an effect's result for a specified duration and allows manual
@@ -11620,7 +12096,7 @@ export declare const cachedInvalidateWithTTL: {
11620
12096
  * @since 2.0.0
11621
12097
  * @category Caching
11622
12098
  */
11623
- (timeToLive: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<[Effect<A, E, R>, Effect<void>]>;
12099
+ (timeToLive: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<[Effect<A, E, R>, Effect<void>]>;
11624
12100
  /**
11625
12101
  * Caches an effect's result for a specified duration and allows manual
11626
12102
  * invalidation before expiration.
@@ -11690,7 +12166,7 @@ export declare const cachedInvalidateWithTTL: {
11690
12166
  * @since 2.0.0
11691
12167
  * @category Caching
11692
12168
  */
11693
- <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.DurationInput): Effect<[Effect<A, E, R>, Effect<void>]>;
12169
+ <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.Input): Effect<[Effect<A, E, R>, Effect<void>]>;
11694
12170
  };
11695
12171
  /**
11696
12172
  * Returns an effect that is immediately interrupted.
@@ -11700,8 +12176,8 @@ export declare const cachedInvalidateWithTTL: {
11700
12176
  * import { Effect } from "effect"
11701
12177
  *
11702
12178
  * const program = Effect.gen(function*() {
11703
- * yield* Effect.interrupt
11704
- * yield* Effect.succeed("This won't execute")
12179
+ * return yield* Effect.interrupt
12180
+ * yield* Effect.succeed("This won't execute and is unreachable")
11705
12181
  * })
11706
12182
  *
11707
12183
  * Effect.runPromise(program).catch(console.error)
@@ -11890,232 +12366,6 @@ export declare const uninterruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(ef
11890
12366
  * @category Interruption
11891
12367
  */
11892
12368
  export declare const interruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(effect: Effect<AX, EX, RX>) => Effect<AX, EX, RX>) => Effect<A, E, R>) => Effect<A, E, R>;
11893
- /**
11894
- * @category Semaphore
11895
- * @since 2.0.0
11896
- * @example
11897
- * ```ts
11898
- * import { Effect } from "effect"
11899
- *
11900
- * // Create and use a semaphore for controlling concurrent access
11901
- * const program = Effect.gen(function*() {
11902
- * const semaphore = yield* Effect.makeSemaphore(2)
11903
- *
11904
- * return yield* semaphore.withPermits(1)(
11905
- * Effect.succeed("Resource accessed")
11906
- * )
11907
- * })
11908
- * ```
11909
- */
11910
- export interface Semaphore {
11911
- /**
11912
- * Adjusts the number of permits available in the semaphore.
11913
- */
11914
- resize(permits: number): Effect<void>;
11915
- /**
11916
- * Runs an effect with the given number of permits and releases the permits
11917
- * when the effect completes.
11918
- *
11919
- * **Details**
11920
- *
11921
- * This function acquires the specified number of permits before executing
11922
- * the provided effect. Once the effect finishes, the permits are released.
11923
- * If insufficient permits are available, the function will wait until they
11924
- * are released by other tasks.
11925
- */
11926
- withPermits(permits: number): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
11927
- /**
11928
- * Runs an effect with the given number of permits and releases the permits
11929
- * when the effect completes.
11930
- *
11931
- * **Details**
11932
- *
11933
- * This function acquires the specified number of permits before executing
11934
- * the provided effect. Once the effect finishes, the permits are released.
11935
- * If insufficient permits are available, the function will wait until they
11936
- * are released by other tasks.
11937
- */
11938
- withPermit<A, E, R>(self: Effect<A, E, R>): Effect<A, E, R>;
11939
- /**
11940
- * Runs an effect only if the specified number of permits are immediately
11941
- * available.
11942
- *
11943
- * **Details**
11944
- *
11945
- * This function attempts to acquire the specified number of permits. If they
11946
- * are available, it runs the effect and releases the permits after the effect
11947
- * completes. If permits are not available, the effect does not execute, and
11948
- * the result is `Option.none`.
11949
- */
11950
- withPermitsIfAvailable(permits: number): <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, E, R>;
11951
- /**
11952
- * Acquires the specified number of permits and returns the resulting
11953
- * available permits, suspending the task if they are not yet available.
11954
- * Concurrent pending `take` calls are processed in a first-in, first-out manner.
11955
- */
11956
- take(permits: number): Effect<number>;
11957
- /**
11958
- * Releases the specified number of permits and returns the resulting
11959
- * available permits.
11960
- */
11961
- release(permits: number): Effect<number>;
11962
- /**
11963
- * Releases all permits held by this semaphore and returns the resulting available permits.
11964
- */
11965
- releaseAll: Effect<number>;
11966
- }
11967
- /**
11968
- * Unsafely creates a new Semaphore.
11969
- *
11970
- * @example
11971
- * ```ts
11972
- * import { Effect } from "effect"
11973
- *
11974
- * const semaphore = Effect.makeSemaphoreUnsafe(3)
11975
- *
11976
- * const task = (id: number) =>
11977
- * semaphore.withPermits(1)(
11978
- * Effect.gen(function*() {
11979
- * yield* Effect.log(`Task ${id} started`)
11980
- * yield* Effect.sleep("1 second")
11981
- * yield* Effect.log(`Task ${id} completed`)
11982
- * })
11983
- * )
11984
- *
11985
- * // Only 3 tasks can run concurrently
11986
- * const program = Effect.all([
11987
- * task(1),
11988
- * task(2),
11989
- * task(3),
11990
- * task(4),
11991
- * task(5)
11992
- * ], { concurrency: "unbounded" })
11993
- * ```
11994
- *
11995
- * @since 2.0.0
11996
- * @category Semaphore
11997
- */
11998
- export declare const makeSemaphoreUnsafe: (permits: number) => Semaphore;
11999
- /**
12000
- * Creates a new Semaphore.
12001
- *
12002
- * @example
12003
- * ```ts
12004
- * import { Effect } from "effect"
12005
- *
12006
- * const program = Effect.gen(function*() {
12007
- * const semaphore = yield* Effect.makeSemaphore(2)
12008
- *
12009
- * const task = (id: number) =>
12010
- * semaphore.withPermits(1)(
12011
- * Effect.gen(function*() {
12012
- * yield* Effect.log(`Task ${id} acquired permit`)
12013
- * yield* Effect.sleep("1 second")
12014
- * yield* Effect.log(`Task ${id} releasing permit`)
12015
- * })
12016
- * )
12017
- *
12018
- * // Run 4 tasks, but only 2 can run concurrently
12019
- * yield* Effect.all([task(1), task(2), task(3), task(4)])
12020
- * })
12021
- * ```
12022
- *
12023
- * @since 2.0.0
12024
- * @category Semaphore
12025
- */
12026
- export declare const makeSemaphore: (permits: number) => Effect<Semaphore>;
12027
- /**
12028
- * @category Latch
12029
- * @since 3.8.0
12030
- * @example
12031
- * ```ts
12032
- * import { Effect } from "effect"
12033
- *
12034
- * // Create and use a latch for coordination between fibers
12035
- * const program = Effect.gen(function*() {
12036
- * const latch = yield* Effect.makeLatch()
12037
- *
12038
- * // Wait for the latch to be opened
12039
- * yield* latch.await
12040
- *
12041
- * return "Latch was opened!"
12042
- * })
12043
- * ```
12044
- */
12045
- export interface Latch {
12046
- /** open the latch, releasing all fibers waiting on it */
12047
- readonly open: Effect<boolean>;
12048
- /** open the latch, releasing all fibers waiting on it */
12049
- readonly openUnsafe: () => boolean;
12050
- /** release all fibers waiting on the latch, without opening it */
12051
- readonly release: Effect<boolean>;
12052
- /** wait for the latch to be opened */
12053
- readonly await: Effect<void>;
12054
- /** close the latch */
12055
- readonly close: Effect<boolean>;
12056
- /** close the latch */
12057
- readonly closeUnsafe: () => boolean;
12058
- /** only run the given effect when the latch is open */
12059
- readonly whenOpen: <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
12060
- }
12061
- /**
12062
- * Creates a new Latch.
12063
- *
12064
- * @example
12065
- * ```ts
12066
- * import { Effect } from "effect"
12067
- *
12068
- * const latch = Effect.makeLatchUnsafe(false)
12069
- *
12070
- * const waiter = Effect.gen(function*() {
12071
- * yield* Effect.log("Waiting for latch to open...")
12072
- * yield* latch.await
12073
- * yield* Effect.log("Latch opened! Continuing...")
12074
- * })
12075
- *
12076
- * const opener = Effect.gen(function*() {
12077
- * yield* Effect.sleep("2 seconds")
12078
- * yield* Effect.log("Opening latch...")
12079
- * yield* latch.open
12080
- * })
12081
- *
12082
- * const program = Effect.all([waiter, opener])
12083
- * ```
12084
- *
12085
- * @category Latch
12086
- * @since 3.8.0
12087
- */
12088
- export declare const makeLatchUnsafe: (open?: boolean | undefined) => Latch;
12089
- /**
12090
- * Creates a new Latch.
12091
- *
12092
- * @example
12093
- * ```ts
12094
- * import { Effect } from "effect"
12095
- *
12096
- * const program = Effect.gen(function*() {
12097
- * const latch = yield* Effect.makeLatch(false)
12098
- *
12099
- * const waiter = Effect.gen(function*() {
12100
- * yield* Effect.log("Waiting for latch to open...")
12101
- * yield* latch.await
12102
- * yield* Effect.log("Latch opened! Continuing...")
12103
- * })
12104
- *
12105
- * const opener = Effect.gen(function*() {
12106
- * yield* Effect.sleep("2 seconds")
12107
- * yield* Effect.log("Opening latch...")
12108
- * yield* latch.open
12109
- * })
12110
- *
12111
- * yield* Effect.all([waiter, opener])
12112
- * })
12113
- * ```
12114
- *
12115
- * @category Latch
12116
- * @since 3.8.0
12117
- */
12118
- export declare const makeLatch: (open?: boolean | undefined) => Effect<Latch>;
12119
12369
  /**
12120
12370
  * @since 2.0.0
12121
12371
  * @category Repetition / Recursion
@@ -12144,10 +12394,10 @@ export declare namespace Repeat {
12144
12394
  * ```
12145
12395
  */
12146
12396
  type Return<R, E, A, O extends Options<A>> = Effect<O extends {
12147
- schedule: Schedule<infer Out, infer _I, infer _E, infer _R>;
12148
- } ? Out : O extends {
12149
12397
  until: Predicate.Refinement<A, infer B>;
12150
- } ? B : A, E | (O extends {
12398
+ } ? B : O extends {
12399
+ while: Predicate.Refinement<A, infer B>;
12400
+ } ? Exclude<A, B> : A, E | (O extends {
12151
12401
  schedule: Schedule<infer _Out, infer _I, infer E, infer _R>;
12152
12402
  } ? E : never) | (O extends {
12153
12403
  while: (...args: Array<any>) => Effect<infer _A, infer E, infer _R>;
@@ -12696,7 +12946,7 @@ export declare const repeat: {
12696
12946
  * attempt++
12697
12947
  * if (attempt <= 2) {
12698
12948
  * yield* Console.log(`Attempt ${attempt} failed`)
12699
- * yield* Effect.fail(`Error ${attempt}`)
12949
+ * return yield* Effect.fail(`Error ${attempt}`)
12700
12950
  * }
12701
12951
  * yield* Console.log(`Attempt ${attempt} succeeded`)
12702
12952
  * return "success"
@@ -12746,7 +12996,7 @@ export declare const repeatOrElse: {
12746
12996
  * attempt++
12747
12997
  * if (attempt <= 2) {
12748
12998
  * yield* Console.log(`Attempt ${attempt} failed`)
12749
- * yield* Effect.fail(`Error ${attempt}`)
12999
+ * return yield* Effect.fail(`Error ${attempt}`)
12750
13000
  * }
12751
13001
  * yield* Console.log(`Attempt ${attempt} succeeded`)
12752
13002
  * return "success"
@@ -12796,7 +13046,7 @@ export declare const repeatOrElse: {
12796
13046
  * attempt++
12797
13047
  * if (attempt <= 2) {
12798
13048
  * yield* Console.log(`Attempt ${attempt} failed`)
12799
- * yield* Effect.fail(`Error ${attempt}`)
13049
+ * return yield* Effect.fail(`Error ${attempt}`)
12800
13050
  * }
12801
13051
  * yield* Console.log(`Attempt ${attempt} succeeded`)
12802
13052
  * return "success"
@@ -14195,7 +14445,7 @@ export declare const withParentSpan: {
14195
14445
  * )
14196
14446
  *
14197
14447
  * const program = Effect.gen(function*() {
14198
- * const name = yield* Effect.request(GetUser({ id: 1 }), Effect.succeed(resolver))
14448
+ * const name = yield* Effect.request(GetUser({ id: 1 }), resolver)
14199
14449
  * yield* Console.log(name)
14200
14450
  * })
14201
14451
  * ```
@@ -14226,7 +14476,7 @@ export declare const request: {
14226
14476
  * )
14227
14477
  *
14228
14478
  * const program = Effect.gen(function*() {
14229
- * const name = yield* Effect.request(GetUser({ id: 1 }), Effect.succeed(resolver))
14479
+ * const name = yield* Effect.request(GetUser({ id: 1 }), resolver)
14230
14480
  * yield* Console.log(name)
14231
14481
  * })
14232
14482
  * ```
@@ -14257,7 +14507,7 @@ export declare const request: {
14257
14507
  * )
14258
14508
  *
14259
14509
  * const program = Effect.gen(function*() {
14260
- * const name = yield* Effect.request(GetUser({ id: 1 }), Effect.succeed(resolver))
14510
+ * const name = yield* Effect.request(GetUser({ id: 1 }), resolver)
14261
14511
  * yield* Console.log(name)
14262
14512
  * })
14263
14513
  * ```
@@ -14266,7 +14516,7 @@ export declare const request: {
14266
14516
  };
14267
14517
  /**
14268
14518
  * Low-level entry point that registers a request with a resolver and delivers the exit value via `onExit`.
14269
- * Use this when you already have a `ServiceMap` and need to enqueue a request outside an `Effect`.
14519
+ * Use this when you already have a `Context` and need to enqueue a request outside an `Effect`.
14270
14520
  *
14271
14521
  * It returns a canceler that removes the pending request entry.
14272
14522
  *
@@ -14276,7 +14526,7 @@ export declare const request: {
14276
14526
  export declare const requestUnsafe: <A extends Request.Any>(self: A, options: {
14277
14527
  readonly resolver: RequestResolver<A>;
14278
14528
  readonly onExit: (exit: Exit.Exit<Request.Success<A>, Request.Error<A>>) => void;
14279
- readonly services: ServiceMap.ServiceMap<never>;
14529
+ readonly context: Context.Context<never>;
14280
14530
  }) => () => void;
14281
14531
  /**
14282
14532
  * Returns an effect that forks this effect into its own separate fiber,
@@ -14466,7 +14716,7 @@ export declare const forkScoped: <Arg extends Effect<any, any, any> | {
14466
14716
  }>(effectOrOptions?: Arg, options?: {
14467
14717
  readonly startImmediately?: boolean | undefined;
14468
14718
  readonly uninterruptible?: boolean | "inherit" | undefined;
14469
- } | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<Fiber<_A, _E>, never, _R> : <A, E, R>(self: Effect<A, E, R>) => Effect<Fiber<A, E>, never, R | Scope>;
14719
+ } | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Effect<Fiber<_A, _E>, never, _R | Scope> : <A, E, R>(self: Effect<A, E, R>) => Effect<Fiber<A, E>, never, R | Scope>;
14470
14720
  /**
14471
14721
  * Forks the effect into a new fiber attached to the global scope. Because the
14472
14722
  * new fiber is attached to the global scope, when the fiber executing the
@@ -14586,6 +14836,7 @@ export interface RunOptions {
14586
14836
  readonly signal?: AbortSignal | undefined;
14587
14837
  readonly scheduler?: Scheduler | undefined;
14588
14838
  readonly uninterruptible?: boolean | undefined;
14839
+ readonly onFiberStart?: ((fiber: Fiber<unknown, unknown>) => void) | undefined;
14589
14840
  }
14590
14841
  /**
14591
14842
  * The foundational function for running effects, returning a "fiber" that can
@@ -14633,15 +14884,15 @@ export declare const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunO
14633
14884
  *
14634
14885
  * @example
14635
14886
  * ```ts
14636
- * import { Effect, ServiceMap } from "effect"
14887
+ * import { Effect, Context } from "effect"
14637
14888
  *
14638
14889
  * interface Logger {
14639
14890
  * log: (message: string) => void
14640
14891
  * }
14641
14892
  *
14642
- * const Logger = ServiceMap.Service<Logger>("Logger")
14893
+ * const Logger = Context.Service<Logger>("Logger")
14643
14894
  *
14644
- * const services = ServiceMap.make(Logger, {
14895
+ * const services = Context.make(Logger, {
14645
14896
  * log: (message) => console.log(message)
14646
14897
  * })
14647
14898
  *
@@ -14657,7 +14908,7 @@ export declare const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunO
14657
14908
  * @since 4.0.0
14658
14909
  * @category Running Effects
14659
14910
  */
14660
- export declare const runForkWith: <R>(services: ServiceMap.ServiceMap<R>) => <A, E>(effect: Effect<A, E, R>, options?: RunOptions | undefined) => Fiber<A, E>;
14911
+ export declare const runForkWith: <R>(context: Context.Context<R>) => <A, E>(effect: Effect<A, E, R>, options?: RunOptions | undefined) => Fiber<A, E>;
14661
14912
  /**
14662
14913
  * Forks an effect with the provided services, registers `onExit` as a fiber observer, and returns an interruptor.
14663
14914
  *
@@ -14665,15 +14916,15 @@ export declare const runForkWith: <R>(services: ServiceMap.ServiceMap<R>) => <A,
14665
14916
  *
14666
14917
  * @example
14667
14918
  * ```ts
14668
- * import { Console, Effect, Exit, ServiceMap } from "effect"
14919
+ * import { Console, Effect, Exit, Context } from "effect"
14669
14920
  *
14670
14921
  * interface Logger {
14671
14922
  * log: (message: string) => Effect.Effect<void>
14672
14923
  * }
14673
14924
  *
14674
- * const Logger = ServiceMap.Service<Logger>("Logger")
14925
+ * const Logger = Context.Service<Logger>("Logger")
14675
14926
  *
14676
- * const services = ServiceMap.make(Logger, {
14927
+ * const services = Context.make(Logger, {
14677
14928
  * log: (message) => Console.log(message)
14678
14929
  * })
14679
14930
  *
@@ -14698,7 +14949,7 @@ export declare const runForkWith: <R>(services: ServiceMap.ServiceMap<R>) => <A,
14698
14949
  * @since 4.0.0
14699
14950
  * @category Running Effects
14700
14951
  */
14701
- export declare const runCallbackWith: <R>(services: ServiceMap.ServiceMap<R>) => <A, E>(effect: Effect<A, E, R>, options?: (RunOptions & {
14952
+ export declare const runCallbackWith: <R>(context: Context.Context<R>) => <A, E>(effect: Effect<A, E, R>, options?: (RunOptions & {
14702
14953
  readonly onExit: (exit: Exit.Exit<A, E>) => void;
14703
14954
  }) | undefined) => (interruptor?: number | undefined) => void;
14704
14955
  /**
@@ -14781,15 +15032,15 @@ export declare const runPromise: <A, E>(effect: Effect<A, E>, options?: RunOptio
14781
15032
  *
14782
15033
  * @example
14783
15034
  * ```ts
14784
- * import { Effect, ServiceMap } from "effect"
15035
+ * import { Effect, Context } from "effect"
14785
15036
  *
14786
15037
  * interface Config {
14787
15038
  * apiUrl: string
14788
15039
  * }
14789
15040
  *
14790
- * const Config = ServiceMap.Service<Config>("Config")
15041
+ * const Config = Context.Service<Config>("Config")
14791
15042
  *
14792
- * const services = ServiceMap.make(Config, {
15043
+ * const context = Context.make(Config, {
14793
15044
  * apiUrl: "https://api.example.com"
14794
15045
  * })
14795
15046
  *
@@ -14798,13 +15049,13 @@ export declare const runPromise: <A, E>(effect: Effect<A, E>, options?: RunOptio
14798
15049
  * return `Connecting to ${config.apiUrl}`
14799
15050
  * })
14800
15051
  *
14801
- * Effect.runPromiseWith(services)(program).then(console.log)
15052
+ * Effect.runPromiseWith(context)(program).then(console.log)
14802
15053
  * ```
14803
15054
  *
14804
15055
  * @since 4.0.0
14805
15056
  * @category Running Effects
14806
15057
  */
14807
- export declare const runPromiseWith: <R>(services: ServiceMap.ServiceMap<R>) => <A, E>(effect: Effect<A, E, R>, options?: RunOptions | undefined) => Promise<A>;
15058
+ export declare const runPromiseWith: <R>(context: Context.Context<R>) => <A, E>(effect: Effect<A, E, R>, options?: RunOptions | undefined) => Promise<A>;
14808
15059
  /**
14809
15060
  * Runs an effect and returns a `Promise` that resolves to an `Exit`, which
14810
15061
  * represents the outcome (success or failure) of the effect.
@@ -14858,15 +15109,15 @@ export declare const runPromiseExit: <A, E>(effect: Effect<A, E>, options?: RunO
14858
15109
  *
14859
15110
  * @example
14860
15111
  * ```ts
14861
- * import { Effect, Exit, ServiceMap } from "effect"
15112
+ * import { Effect, Exit, Context } from "effect"
14862
15113
  *
14863
15114
  * interface Database {
14864
15115
  * query: (sql: string) => string
14865
15116
  * }
14866
15117
  *
14867
- * const Database = ServiceMap.Service<Database>("Database")
15118
+ * const Database = Context.Service<Database>("Database")
14868
15119
  *
14869
- * const services = ServiceMap.make(Database, {
15120
+ * const services = Context.make(Database, {
14870
15121
  * query: (sql) => `Result for: ${sql}`
14871
15122
  * })
14872
15123
  *
@@ -14885,7 +15136,7 @@ export declare const runPromiseExit: <A, E>(effect: Effect<A, E>, options?: RunO
14885
15136
  * @since 4.0.0
14886
15137
  * @category Running Effects
14887
15138
  */
14888
- export declare const runPromiseExitWith: <R>(services: ServiceMap.ServiceMap<R>) => <A, E>(effect: Effect<A, E, R>, options?: RunOptions | undefined) => Promise<Exit.Exit<A, E>>;
15139
+ export declare const runPromiseExitWith: <R>(context: Context.Context<R>) => <A, E>(effect: Effect<A, E, R>, options?: RunOptions | undefined) => Promise<Exit.Exit<A, E>>;
14889
15140
  /**
14890
15141
  * Executes an effect synchronously, running it immediately and returning the
14891
15142
  * result.
@@ -14949,15 +15200,15 @@ export declare const runSync: <A, E>(effect: Effect<A, E>) => A;
14949
15200
  *
14950
15201
  * @example
14951
15202
  * ```ts
14952
- * import { Effect, ServiceMap } from "effect"
15203
+ * import { Effect, Context } from "effect"
14953
15204
  *
14954
15205
  * interface MathService {
14955
15206
  * add: (a: number, b: number) => number
14956
15207
  * }
14957
15208
  *
14958
- * const MathService = ServiceMap.Service<MathService>("MathService")
15209
+ * const MathService = Context.Service<MathService>("MathService")
14959
15210
  *
14960
- * const services = ServiceMap.make(MathService, {
15211
+ * const context = Context.make(MathService, {
14961
15212
  * add: (a, b) => a + b
14962
15213
  * })
14963
15214
  *
@@ -14966,14 +15217,14 @@ export declare const runSync: <A, E>(effect: Effect<A, E>) => A;
14966
15217
  * return math.add(2, 3)
14967
15218
  * })
14968
15219
  *
14969
- * const result = Effect.runSyncWith(services)(program)
15220
+ * const result = Effect.runSyncWith(context)(program)
14970
15221
  * console.log(result) // 5
14971
15222
  * ```
14972
15223
  *
14973
15224
  * @since 4.0.0
14974
15225
  * @category Running Effects
14975
15226
  */
14976
- export declare const runSyncWith: <R>(services: ServiceMap.ServiceMap<R>) => <A, E>(effect: Effect<A, E, R>) => A;
15227
+ export declare const runSyncWith: <R>(context: Context.Context<R>) => <A, E>(effect: Effect<A, E, R>) => A;
14977
15228
  /**
14978
15229
  * Runs an effect synchronously and returns the result as an `Exit` type, which
14979
15230
  * represents the outcome (success or failure) of the effect.
@@ -15049,10 +15300,10 @@ export declare const runSyncExit: <A, E>(effect: Effect<A, E>) => Exit.Exit<A, E
15049
15300
  *
15050
15301
  * @example
15051
15302
  * ```ts
15052
- * import { Effect, Exit, ServiceMap } from "effect"
15303
+ * import { Effect, Exit, Context } from "effect"
15053
15304
  *
15054
15305
  * // Define a logger service
15055
- * const Logger = ServiceMap.Service<{
15306
+ * const Logger = Context.Service<{
15056
15307
  * log: (msg: string) => void
15057
15308
  * }>("Logger")
15058
15309
  *
@@ -15062,12 +15313,12 @@ export declare const runSyncExit: <A, E>(effect: Effect<A, E>) => Exit.Exit<A, E
15062
15313
  * return 42
15063
15314
  * })
15064
15315
  *
15065
- * // Prepare services
15066
- * const services = ServiceMap.make(Logger, {
15316
+ * // Prepare context
15317
+ * const context = Context.make(Logger, {
15067
15318
  * log: (msg) => console.log(`[LOG] ${msg}`)
15068
15319
  * })
15069
15320
  *
15070
- * const exit = Effect.runSyncExitWith(services)(program)
15321
+ * const exit = Effect.runSyncExitWith(context)(program)
15071
15322
  *
15072
15323
  * if (Exit.isSuccess(exit)) {
15073
15324
  * console.log(`Success: ${exit.value}`)
@@ -15082,7 +15333,7 @@ export declare const runSyncExit: <A, E>(effect: Effect<A, E>) => Exit.Exit<A, E
15082
15333
  * @since 4.0.0
15083
15334
  * @category Running Effects
15084
15335
  */
15085
- export declare const runSyncExitWith: <R>(services: ServiceMap.ServiceMap<R>) => <A, E>(effect: Effect<A, E, R>) => Exit.Exit<A, E>;
15336
+ export declare const runSyncExitWith: <R>(context: Context.Context<R>) => <A, E>(effect: Effect<A, E, R>) => Exit.Exit<A, E>;
15086
15337
  /**
15087
15338
  * Type helpers for functions built with `Effect.fn` and `Effect.fnUntraced`.
15088
15339
  *
@@ -15772,7 +16023,7 @@ export declare const clockWith: <A, E, R>(f: (clock: Clock) => Effect<A, E, R>)
15772
16023
  * @since 2.0.0
15773
16024
  * @category Logging
15774
16025
  */
15775
- export declare const logWithLevel: (level?: LogLevel) => (...message: ReadonlyArray<any>) => Effect<void>;
16026
+ export declare const logWithLevel: (level?: Severity) => (...message: ReadonlyArray<any>) => Effect<void>;
15776
16027
  /**
15777
16028
  * Logs one or more messages using the default log level.
15778
16029
  *
@@ -16039,6 +16290,85 @@ export declare const annotateLogs: {
16039
16290
  <A, E, R>(effect: Effect<A, E, R>, key: string, value: unknown): Effect<A, E, R>;
16040
16291
  <A, E, R>(effect: Effect<A, E, R>, values: Record<string, unknown>): Effect<A, E, R>;
16041
16292
  };
16293
+ /**
16294
+ * Adds log annotations to the current scope.
16295
+ *
16296
+ * This differs from `annotateLogs`, which only annotates a specific effect.
16297
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
16298
+ * restores the previous annotations when the scope closes.
16299
+ *
16300
+ * @example
16301
+ * ```ts
16302
+ * import { Effect } from "effect"
16303
+ *
16304
+ * const program = Effect.scoped(
16305
+ * Effect.gen(function*() {
16306
+ * yield* Effect.log("before")
16307
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
16308
+ * yield* Effect.log("inside scope")
16309
+ * })
16310
+ * )
16311
+ *
16312
+ * Effect.runPromise(program)
16313
+ * ```
16314
+ *
16315
+ * @since 4.0.0
16316
+ * @category Logging
16317
+ */
16318
+ export declare const annotateLogsScoped: {
16319
+ /**
16320
+ * Adds log annotations to the current scope.
16321
+ *
16322
+ * This differs from `annotateLogs`, which only annotates a specific effect.
16323
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
16324
+ * restores the previous annotations when the scope closes.
16325
+ *
16326
+ * @example
16327
+ * ```ts
16328
+ * import { Effect } from "effect"
16329
+ *
16330
+ * const program = Effect.scoped(
16331
+ * Effect.gen(function*() {
16332
+ * yield* Effect.log("before")
16333
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
16334
+ * yield* Effect.log("inside scope")
16335
+ * })
16336
+ * )
16337
+ *
16338
+ * Effect.runPromise(program)
16339
+ * ```
16340
+ *
16341
+ * @since 4.0.0
16342
+ * @category Logging
16343
+ */
16344
+ (key: string, value: unknown): Effect<void, never, Scope>;
16345
+ /**
16346
+ * Adds log annotations to the current scope.
16347
+ *
16348
+ * This differs from `annotateLogs`, which only annotates a specific effect.
16349
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
16350
+ * restores the previous annotations when the scope closes.
16351
+ *
16352
+ * @example
16353
+ * ```ts
16354
+ * import { Effect } from "effect"
16355
+ *
16356
+ * const program = Effect.scoped(
16357
+ * Effect.gen(function*() {
16358
+ * yield* Effect.log("before")
16359
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
16360
+ * yield* Effect.log("inside scope")
16361
+ * })
16362
+ * )
16363
+ *
16364
+ * Effect.runPromise(program)
16365
+ * ```
16366
+ *
16367
+ * @since 4.0.0
16368
+ * @category Logging
16369
+ */
16370
+ (values: Record<string, unknown>): Effect<void, never, Scope>;
16371
+ };
16042
16372
  /**
16043
16373
  * Adds a span to each log line in this effect.
16044
16374
  *
@@ -16574,18 +16904,20 @@ export declare const trackSuccesses: {
16574
16904
  *
16575
16905
  * @example
16576
16906
  * ```ts
16577
- * import { Effect, Metric } from "effect"
16907
+ * import { Data, Effect, Metric } from "effect"
16908
+ *
16909
+ * class ConnectionFailedError extends Data.TaggedError("ConnectionFailedError")<{}> {}
16578
16910
  *
16579
16911
  * // Track error types using frequency metric
16580
16912
  * const errorTypeFrequency = Metric.frequency("error_types")
16581
16913
  *
16582
- * const program = Effect.fail(new Error("Connection failed")).pipe(
16583
- * Effect.trackErrors(errorTypeFrequency, (error: Error) => error.name)
16914
+ * const program = Effect.fail(new ConnectionFailedError()).pipe(
16915
+ * Effect.trackErrors(errorTypeFrequency, (error: ConnectionFailedError) => error._tag)
16584
16916
  * )
16585
16917
  *
16586
16918
  * Effect.runPromiseExit(program).then(() =>
16587
16919
  * Effect.runPromise(Metric.value(errorTypeFrequency)).then(console.log)
16588
- * // Output: { occurrences: Map(1) { "Error" => 1 } }
16920
+ * // Output: { occurrences: Map(1) { "ConnectionFailedError" => 1 } }
16589
16921
  * )
16590
16922
  * ```
16591
16923
  *
@@ -16620,18 +16952,20 @@ export declare const trackErrors: {
16620
16952
  *
16621
16953
  * @example
16622
16954
  * ```ts
16623
- * import { Effect, Metric } from "effect"
16955
+ * import { Data, Effect, Metric } from "effect"
16956
+ *
16957
+ * class ConnectionFailedError extends Data.TaggedError("ConnectionFailedError")<{}> {}
16624
16958
  *
16625
16959
  * // Track error types using frequency metric
16626
16960
  * const errorTypeFrequency = Metric.frequency("error_types")
16627
16961
  *
16628
- * const program = Effect.fail(new Error("Connection failed")).pipe(
16629
- * Effect.trackErrors(errorTypeFrequency, (error: Error) => error.name)
16962
+ * const program = Effect.fail(new ConnectionFailedError()).pipe(
16963
+ * Effect.trackErrors(errorTypeFrequency, (error: ConnectionFailedError) => error._tag)
16630
16964
  * )
16631
16965
  *
16632
16966
  * Effect.runPromiseExit(program).then(() =>
16633
16967
  * Effect.runPromise(Metric.value(errorTypeFrequency)).then(console.log)
16634
- * // Output: { occurrences: Map(1) { "Error" => 1 } }
16968
+ * // Output: { occurrences: Map(1) { "ConnectionFailedError" => 1 } }
16635
16969
  * )
16636
16970
  * ```
16637
16971
  *
@@ -16666,18 +17000,20 @@ export declare const trackErrors: {
16666
17000
  *
16667
17001
  * @example
16668
17002
  * ```ts
16669
- * import { Effect, Metric } from "effect"
17003
+ * import { Data, Effect, Metric } from "effect"
17004
+ *
17005
+ * class ConnectionFailedError extends Data.TaggedError("ConnectionFailedError")<{}> {}
16670
17006
  *
16671
17007
  * // Track error types using frequency metric
16672
17008
  * const errorTypeFrequency = Metric.frequency("error_types")
16673
17009
  *
16674
- * const program = Effect.fail(new Error("Connection failed")).pipe(
16675
- * Effect.trackErrors(errorTypeFrequency, (error: Error) => error.name)
17010
+ * const program = Effect.fail(new ConnectionFailedError()).pipe(
17011
+ * Effect.trackErrors(errorTypeFrequency, (error: ConnectionFailedError) => error._tag)
16676
17012
  * )
16677
17013
  *
16678
17014
  * Effect.runPromiseExit(program).then(() =>
16679
17015
  * Effect.runPromise(Metric.value(errorTypeFrequency)).then(console.log)
16680
- * // Output: { occurrences: Map(1) { "Error" => 1 } }
17016
+ * // Output: { occurrences: Map(1) { "ConnectionFailedError" => 1 } }
16681
17017
  * )
16682
17018
  * ```
16683
17019
  *
@@ -16712,18 +17048,20 @@ export declare const trackErrors: {
16712
17048
  *
16713
17049
  * @example
16714
17050
  * ```ts
16715
- * import { Effect, Metric } from "effect"
17051
+ * import { Data, Effect, Metric } from "effect"
17052
+ *
17053
+ * class ConnectionFailedError extends Data.TaggedError("ConnectionFailedError")<{}> {}
16716
17054
  *
16717
17055
  * // Track error types using frequency metric
16718
17056
  * const errorTypeFrequency = Metric.frequency("error_types")
16719
17057
  *
16720
- * const program = Effect.fail(new Error("Connection failed")).pipe(
16721
- * Effect.trackErrors(errorTypeFrequency, (error: Error) => error.name)
17058
+ * const program = Effect.fail(new ConnectionFailedError()).pipe(
17059
+ * Effect.trackErrors(errorTypeFrequency, (error: ConnectionFailedError) => error._tag)
16722
17060
  * )
16723
17061
  *
16724
17062
  * Effect.runPromiseExit(program).then(() =>
16725
17063
  * Effect.runPromise(Metric.value(errorTypeFrequency)).then(console.log)
16726
- * // Output: { occurrences: Map(1) { "Error" => 1 } }
17064
+ * // Output: { occurrences: Map(1) { "ConnectionFailedError" => 1 } }
16727
17065
  * )
16728
17066
  * ```
16729
17067
  *
@@ -16758,18 +17096,20 @@ export declare const trackErrors: {
16758
17096
  *
16759
17097
  * @example
16760
17098
  * ```ts
16761
- * import { Effect, Metric } from "effect"
17099
+ * import { Data, Effect, Metric } from "effect"
17100
+ *
17101
+ * class ConnectionFailedError extends Data.TaggedError("ConnectionFailedError")<{}> {}
16762
17102
  *
16763
17103
  * // Track error types using frequency metric
16764
17104
  * const errorTypeFrequency = Metric.frequency("error_types")
16765
17105
  *
16766
- * const program = Effect.fail(new Error("Connection failed")).pipe(
16767
- * Effect.trackErrors(errorTypeFrequency, (error: Error) => error.name)
17106
+ * const program = Effect.fail(new ConnectionFailedError()).pipe(
17107
+ * Effect.trackErrors(errorTypeFrequency, (error: ConnectionFailedError) => error._tag)
16768
17108
  * )
16769
17109
  *
16770
17110
  * Effect.runPromiseExit(program).then(() =>
16771
17111
  * Effect.runPromise(Metric.value(errorTypeFrequency)).then(console.log)
16772
- * // Output: { occurrences: Map(1) { "Error" => 1 } }
17112
+ * // Output: { occurrences: Map(1) { "ConnectionFailedError" => 1 } }
16773
17113
  * )
16774
17114
  * ```
16775
17115
  *
@@ -17250,7 +17590,7 @@ export declare const trackDuration: {
17250
17590
  */
17251
17591
  <A, E, R, State>(self: Effect<A, E, R>, metric: Metric.Metric<Duration.Duration, State>): Effect<A, E, R>;
17252
17592
  };
17253
- declare const Transaction_base: ServiceMap.ServiceClass<Transaction, "effect/Effect/Transaction", {
17593
+ declare const Transaction_base: Context.ServiceClass<Transaction, "effect/Effect/Transaction", {
17254
17594
  retry: boolean;
17255
17595
  readonly journal: Map<TxRef<any>, {
17256
17596
  readonly version: number;
@@ -17281,19 +17621,22 @@ declare const Transaction_base: ServiceMap.ServiceClass<Transaction, "effect/Eff
17281
17621
  export declare class Transaction extends Transaction_base {
17282
17622
  }
17283
17623
  /**
17284
- * Defines a transaction. Transactions are "all or nothing" with respect to changes made to
17285
- * transactional values (i.e. TxRef) that occur within the transaction body.
17624
+ * Defines a transaction boundary. Transactions are "all or nothing" with respect to changes
17625
+ * made to transactional values (i.e. TxRef) that occur within the transaction body.
17626
+ *
17627
+ * If called inside an active transaction, `tx` composes with the current transaction and reuses
17628
+ * its journal and retry state instead of creating a nested boundary.
17286
17629
  *
17287
17630
  * In Effect transactions are optimistic with retry, that means transactions are retried when:
17288
17631
  *
17289
- * - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
17632
+ * - the body of the transaction explicitely calls to `Effect.txRetry` and any of the
17290
17633
  * accessed transactional values changes.
17291
17634
  *
17292
17635
  * - any of the accessed transactional values change during the execution of the transaction
17293
17636
  * due to a different transaction committing before the current.
17294
17637
  *
17295
- * - parent transaction retry, if you have a transaction within another transaction and
17296
- * the parent retries the child will also retry together with the parent.
17638
+ * The outermost `tx` call creates the transaction boundary and commits or rolls back the full
17639
+ * composed transaction.
17297
17640
  *
17298
17641
  * @example
17299
17642
  * ```ts
@@ -17303,10 +17646,10 @@ export declare class Transaction extends Transaction_base {
17303
17646
  * const ref1 = yield* TxRef.make(0)
17304
17647
  * const ref2 = yield* TxRef.make(0)
17305
17648
  *
17306
- * // All operations within atomic block succeed or fail together
17307
- * yield* Effect.atomic(Effect.gen(function*() {
17649
+ * // Nested tx calls compose into the same transaction
17650
+ * yield* Effect.tx(Effect.gen(function*() {
17308
17651
  * yield* TxRef.set(ref1, 10)
17309
- * yield* TxRef.set(ref2, 20)
17652
+ * yield* Effect.tx(TxRef.set(ref2, 20))
17310
17653
  * const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
17311
17654
  * console.log(`Transaction sum: ${sum}`)
17312
17655
  * }))
@@ -17319,122 +17662,7 @@ export declare class Transaction extends Transaction_base {
17319
17662
  * @since 4.0.0
17320
17663
  * @category Transactions
17321
17664
  */
17322
- export declare const atomic: <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
17323
- /**
17324
- * Executes a function within a transaction context, providing access to the transaction state.
17325
- *
17326
- * @example
17327
- * ```ts
17328
- * import { Effect, TxRef } from "effect"
17329
- *
17330
- * const program = Effect.atomicWith((txState) =>
17331
- * Effect.gen(function*() {
17332
- * const ref = yield* TxRef.make(0)
17333
- *
17334
- * // Access transaction state for debugging
17335
- * console.log(`Journal size: ${txState.journal.size}`)
17336
- * console.log(`Retry flag: ${txState.retry}`)
17337
- *
17338
- * yield* TxRef.set(ref, 42)
17339
- * return yield* TxRef.get(ref)
17340
- * })
17341
- * )
17342
- *
17343
- * Effect.runPromise(program).then(console.log) // 42
17344
- * ```
17345
- *
17346
- * @since 4.0.0
17347
- * @category Transactions
17348
- */
17349
- export declare const atomicWith: <A, E, R>(f: (state: Transaction["Service"]) => Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
17350
- /**
17351
- * Creates an isolated transaction that never composes with parent transactions.
17352
- *
17353
- * **Details**
17354
- *
17355
- * Unlike `Effect.atomic`, which composes with parent transactions when nested,
17356
- * `Effect.transaction` always creates a new isolated transaction boundary.
17357
- * This ensures complete isolation between different transaction scopes.
17358
- *
17359
- * **Key Differences from Effect.atomic:**
17360
- * - Always creates a new transaction, even when called within another transaction
17361
- * - Parent transaction failures don't affect isolated transactions
17362
- * - Isolated transaction failures don't affect parent transactions
17363
- * - Each transaction has its own journal and retry logic
17364
- *
17365
- * **When to Use:**
17366
- * - When you need guaranteed isolation between transaction scopes
17367
- * - For implementing independent operations that shouldn't be affected by outer transactions
17368
- * - When building transaction-based systems where isolation is critical
17369
- *
17370
- * @example
17371
- * ```ts
17372
- * import { Effect, TxRef } from "effect"
17373
- *
17374
- * const program = Effect.gen(function*() {
17375
- * const ref1 = yield* TxRef.make(0)
17376
- * const ref2 = yield* TxRef.make(100)
17377
- *
17378
- * // Nested atomic transaction - ref1 will be part of outer transaction
17379
- * yield* Effect.atomic(Effect.gen(function*() {
17380
- * yield* TxRef.set(ref1, 10)
17381
- *
17382
- * // This atomic operation composes with the parent
17383
- * yield* Effect.atomic(Effect.gen(function*() {
17384
- * yield* TxRef.set(ref1, 20) // Part of same transaction
17385
- * }))
17386
- * }))
17387
- *
17388
- * // Isolated transaction - ref2 will be in its own transaction
17389
- * yield* Effect.transaction(Effect.gen(function*() {
17390
- * yield* TxRef.set(ref2, 200)
17391
- * }))
17392
- *
17393
- * const val1 = yield* TxRef.get(ref1) // 20
17394
- * const val2 = yield* TxRef.get(ref2) // 200
17395
- * return { ref1: val1, ref2: val2 }
17396
- * })
17397
- * ```
17398
- *
17399
- * @since 4.0.0
17400
- * @category Transactions
17401
- */
17402
- export declare const transaction: <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
17403
- /**
17404
- * Executes a function within an isolated transaction context, providing access to the transaction state.
17405
- *
17406
- * This function always creates a new transaction boundary, regardless of whether it's called
17407
- * within another transaction. This ensures complete isolation between transaction scopes.
17408
- *
17409
- * @example
17410
- * ```ts
17411
- * import { Effect, TxRef } from "effect"
17412
- *
17413
- * const program = Effect.transactionWith((txState) =>
17414
- * Effect.gen(function*() {
17415
- * const ref = yield* TxRef.make(0)
17416
- *
17417
- * // This transaction is isolated - it has its own journal
17418
- * // txState.journal is independent of any parent transaction
17419
- *
17420
- * yield* TxRef.set(ref, 42)
17421
- * return yield* TxRef.get(ref)
17422
- * })
17423
- * )
17424
- *
17425
- * // Even when nested in another atomic block, this transaction is isolated
17426
- * const nestedProgram = Effect.atomic(
17427
- * Effect.gen(function*() {
17428
- * const result = yield* program // Runs in its own isolated transaction
17429
- * return result
17430
- * })
17431
- * )
17432
- * ```
17433
- *
17434
- * @since 4.0.0
17435
- * @category Transactions
17436
- */
17437
- export declare const transactionWith: <A, E, R>(f: (state: Transaction["Service"]) => Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
17665
+ export declare const tx: <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
17438
17666
  /**
17439
17667
  * Signals that the current transaction needs to be retried.
17440
17668
  *
@@ -17455,15 +17683,15 @@ export declare const transactionWith: <A, E, R>(f: (state: Transaction["Service"
17455
17683
  * // forks a fiber that increases the value of `ref` every 100 millis
17456
17684
  * yield* Effect.forkChild(Effect.forever(
17457
17685
  * // update to transactional value
17458
- * TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis"))
17686
+ * Effect.tx(TxRef.update(ref, (n) => n + 1)).pipe(Effect.delay("100 millis"))
17459
17687
  * ))
17460
17688
  *
17461
17689
  * // the following will retry 10 times until the `ref` value is 10
17462
- * yield* Effect.atomic(Effect.gen(function*() {
17690
+ * yield* Effect.tx(Effect.gen(function*() {
17463
17691
  * const value = yield* TxRef.get(ref)
17464
17692
  * if (value < 10) {
17465
17693
  * yield* Effect.log(`retry due to value: ${value}`)
17466
- * return yield* Effect.retryTransaction
17694
+ * return yield* Effect.txRetry
17467
17695
  * }
17468
17696
  * yield* Effect.log(`transaction done with value: ${value}`)
17469
17697
  * }))
@@ -17472,7 +17700,7 @@ export declare const transactionWith: <A, E, R>(f: (state: Transaction["Service"
17472
17700
  * Effect.runPromise(program).catch(console.error)
17473
17701
  * ```
17474
17702
  */
17475
- export declare const retryTransaction: Effect<never, never, Transaction>;
17703
+ export declare const txRetry: Effect<never, never, Transaction>;
17476
17704
  /**
17477
17705
  * @since 4.0.0
17478
17706
  * @category Effectify
@@ -17912,18 +18140,20 @@ export declare const satisfiesSuccessType: <A>() => <A2 extends A, E, R>(effect:
17912
18140
  *
17913
18141
  * @example
17914
18142
  * ```ts
17915
- * import { Effect } from "effect"
18143
+ * import { Data, Effect } from "effect"
18144
+ *
18145
+ * class ValidationError extends Data.TaggedError("ValidationError")<{}> {}
17916
18146
  *
17917
- * // Define a constraint that the error type must be an Error
17918
- * const satisfiesError = Effect.satisfiesErrorType<Error>()
18147
+ * // Define a constraint that the error type must be a ValidationError
18148
+ * const satisfiesError = Effect.satisfiesErrorType<ValidationError>()
17919
18149
  *
17920
- * // This works - Effect<number, TypeError, never> extends Effect<number, Error, never>
17921
- * const validEffect = satisfiesError(Effect.fail(new TypeError("Invalid type")))
18150
+ * // This works - Effect<number, ValidationError, never> extends the constrained type
18151
+ * const validEffect = satisfiesError(Effect.fail(new ValidationError()))
17922
18152
  *
17923
18153
  * // This would cause a TypeScript compilation error:
17924
18154
  * // const invalidEffect = satisfiesError(Effect.fail("string error"))
17925
18155
  * // ^^^^^^^^^^^^^^^^^^^^^^^^^^^
17926
- * // Type 'string' is not assignable to type 'Error'
18156
+ * // Type 'string' is not assignable to type 'ValidationError'
17927
18157
  * ```
17928
18158
  *
17929
18159
  * @since 4.0.0