effect 4.0.0-beta.2 → 4.0.0-beta.21

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 (881) hide show
  1. package/dist/Array.d.ts +127 -299
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +102 -62
  4. package/dist/Array.js.map +1 -1
  5. package/dist/Cache.d.ts +2 -2
  6. package/dist/Cache.d.ts.map +1 -1
  7. package/dist/Cache.js +6 -5
  8. package/dist/Cache.js.map +1 -1
  9. package/dist/Cause.d.ts +1 -1
  10. package/dist/Cause.d.ts.map +1 -1
  11. package/dist/Channel.d.ts +116 -30
  12. package/dist/Channel.d.ts.map +1 -1
  13. package/dist/Channel.js +82 -37
  14. package/dist/Channel.js.map +1 -1
  15. package/dist/Chunk.d.ts +54 -247
  16. package/dist/Chunk.d.ts.map +1 -1
  17. package/dist/Chunk.js +36 -67
  18. package/dist/Chunk.js.map +1 -1
  19. package/dist/Combiner.d.ts +280 -13
  20. package/dist/Combiner.d.ts.map +1 -1
  21. package/dist/Combiner.js +198 -7
  22. package/dist/Combiner.js.map +1 -1
  23. package/dist/Config.d.ts +165 -9
  24. package/dist/Config.d.ts.map +1 -1
  25. package/dist/Config.js +62 -7
  26. package/dist/Config.js.map +1 -1
  27. package/dist/ConfigProvider.d.ts +1 -1
  28. package/dist/Cron.d.ts +1 -1
  29. package/dist/Data.d.ts +534 -365
  30. package/dist/Data.d.ts.map +1 -1
  31. package/dist/Data.js +132 -79
  32. package/dist/Data.js.map +1 -1
  33. package/dist/DateTime.d.ts +23 -161
  34. package/dist/DateTime.d.ts.map +1 -1
  35. package/dist/DateTime.js +6 -51
  36. package/dist/DateTime.js.map +1 -1
  37. package/dist/Duration.d.ts +12 -12
  38. package/dist/Duration.d.ts.map +1 -1
  39. package/dist/Duration.js +12 -12
  40. package/dist/Duration.js.map +1 -1
  41. package/dist/Effect.d.ts +829 -692
  42. package/dist/Effect.d.ts.map +1 -1
  43. package/dist/Effect.js +263 -251
  44. package/dist/Effect.js.map +1 -1
  45. package/dist/Encoding.d.ts +194 -0
  46. package/dist/Encoding.d.ts.map +1 -0
  47. package/dist/Encoding.js +352 -0
  48. package/dist/Encoding.js.map +1 -0
  49. package/dist/Equal.d.ts +276 -109
  50. package/dist/Equal.d.ts.map +1 -1
  51. package/dist/Equal.js +124 -48
  52. package/dist/Equal.js.map +1 -1
  53. package/dist/ErrorReporter.d.ts +376 -0
  54. package/dist/ErrorReporter.d.ts.map +1 -0
  55. package/dist/ErrorReporter.js +246 -0
  56. package/dist/ErrorReporter.js.map +1 -0
  57. package/dist/Fiber.d.ts +2 -2
  58. package/dist/Fiber.d.ts.map +1 -1
  59. package/dist/Fiber.js.map +1 -1
  60. package/dist/FileSystem.d.ts +1 -1
  61. package/dist/FileSystem.d.ts.map +1 -1
  62. package/dist/FileSystem.js +5 -5
  63. package/dist/FileSystem.js.map +1 -1
  64. package/dist/Filter.d.ts +30 -34
  65. package/dist/Filter.d.ts.map +1 -1
  66. package/dist/Filter.js +15 -13
  67. package/dist/Filter.js.map +1 -1
  68. package/dist/Formatter.d.ts +131 -47
  69. package/dist/Formatter.d.ts.map +1 -1
  70. package/dist/Formatter.js +229 -51
  71. package/dist/Formatter.js.map +1 -1
  72. package/dist/Graph.d.ts +1 -1
  73. package/dist/Graph.d.ts.map +1 -1
  74. package/dist/Graph.js +5 -8
  75. package/dist/Graph.js.map +1 -1
  76. package/dist/HashMap.d.ts +15 -14
  77. package/dist/HashMap.d.ts.map +1 -1
  78. package/dist/HashMap.js +4 -4
  79. package/dist/HashMap.js.map +1 -1
  80. package/dist/Iterable.d.ts +40 -39
  81. package/dist/Iterable.d.ts.map +1 -1
  82. package/dist/Iterable.js +94 -22
  83. package/dist/Iterable.js.map +1 -1
  84. package/dist/JsonSchema.d.ts +299 -10
  85. package/dist/JsonSchema.d.ts.map +1 -1
  86. package/dist/JsonSchema.js +323 -4
  87. package/dist/JsonSchema.js.map +1 -1
  88. package/dist/Latch.d.ts +109 -0
  89. package/dist/Latch.d.ts.map +1 -0
  90. package/dist/Latch.js +72 -0
  91. package/dist/Latch.js.map +1 -0
  92. package/dist/Layer.d.ts +9 -9
  93. package/dist/Layer.d.ts.map +1 -1
  94. package/dist/Layer.js.map +1 -1
  95. package/dist/LayerMap.d.ts +4 -4
  96. package/dist/LayerMap.d.ts.map +1 -1
  97. package/dist/LogLevel.d.ts +32 -0
  98. package/dist/LogLevel.d.ts.map +1 -1
  99. package/dist/LogLevel.js +28 -100
  100. package/dist/LogLevel.js.map +1 -1
  101. package/dist/Logger.d.ts +29 -95
  102. package/dist/Logger.d.ts.map +1 -1
  103. package/dist/Logger.js +2 -3
  104. package/dist/Logger.js.map +1 -1
  105. package/dist/ManagedRuntime.d.ts +1 -1
  106. package/dist/ManagedRuntime.js +1 -1
  107. package/dist/Metric.d.ts +2 -2
  108. package/dist/Metric.d.ts.map +1 -1
  109. package/dist/Metric.js +1 -1
  110. package/dist/Metric.js.map +1 -1
  111. package/dist/Optic.d.ts +947 -18
  112. package/dist/Optic.d.ts.map +1 -1
  113. package/dist/Optic.js +454 -5
  114. package/dist/Optic.js.map +1 -1
  115. package/dist/Option.d.ts +22 -15
  116. package/dist/Option.d.ts.map +1 -1
  117. package/dist/Option.js +14 -7
  118. package/dist/Option.js.map +1 -1
  119. package/dist/Pipeable.d.ts +17 -0
  120. package/dist/Pipeable.d.ts.map +1 -1
  121. package/dist/Pipeable.js +19 -1
  122. package/dist/Pipeable.js.map +1 -1
  123. package/dist/PlatformError.d.ts +10 -9
  124. package/dist/PlatformError.d.ts.map +1 -1
  125. package/dist/PlatformError.js +2 -2
  126. package/dist/PlatformError.js.map +1 -1
  127. package/dist/Pool.d.ts +6 -4
  128. package/dist/Pool.d.ts.map +1 -1
  129. package/dist/Pool.js +7 -5
  130. package/dist/Pool.js.map +1 -1
  131. package/dist/PubSub.d.ts +3 -2
  132. package/dist/PubSub.d.ts.map +1 -1
  133. package/dist/PubSub.js +3 -2
  134. package/dist/PubSub.js.map +1 -1
  135. package/dist/Pull.d.ts.map +1 -1
  136. package/dist/Pull.js +1 -1
  137. package/dist/Pull.js.map +1 -1
  138. package/dist/Queue.d.ts.map +1 -1
  139. package/dist/Queue.js +0 -1
  140. package/dist/Queue.js.map +1 -1
  141. package/dist/Random.d.ts +35 -1
  142. package/dist/Random.d.ts.map +1 -1
  143. package/dist/Random.js +46 -12
  144. package/dist/Random.js.map +1 -1
  145. package/dist/RcMap.d.ts +2 -2
  146. package/dist/RcMap.d.ts.map +1 -1
  147. package/dist/RcMap.js +1 -1
  148. package/dist/RcMap.js.map +1 -1
  149. package/dist/RcRef.d.ts +1 -1
  150. package/dist/RcRef.d.ts.map +1 -1
  151. package/dist/Record.d.ts +24 -120
  152. package/dist/Record.d.ts.map +1 -1
  153. package/dist/Record.js +21 -41
  154. package/dist/Record.js.map +1 -1
  155. package/dist/Reducer.d.ts +166 -7
  156. package/dist/Reducer.d.ts.map +1 -1
  157. package/dist/Reducer.js +135 -1
  158. package/dist/Reducer.js.map +1 -1
  159. package/dist/References.d.ts +3 -3
  160. package/dist/References.d.ts.map +1 -1
  161. package/dist/Request.d.ts +1 -1
  162. package/dist/Request.d.ts.map +1 -1
  163. package/dist/Request.js +2 -1
  164. package/dist/Request.js.map +1 -1
  165. package/dist/RequestResolver.d.ts +6 -26
  166. package/dist/RequestResolver.d.ts.map +1 -1
  167. package/dist/RequestResolver.js +0 -20
  168. package/dist/RequestResolver.js.map +1 -1
  169. package/dist/Result.d.ts +12 -0
  170. package/dist/Result.d.ts.map +1 -1
  171. package/dist/Result.js +12 -0
  172. package/dist/Result.js.map +1 -1
  173. package/dist/Schedule.d.ts +47 -20
  174. package/dist/Schedule.d.ts.map +1 -1
  175. package/dist/Schedule.js +94 -34
  176. package/dist/Schedule.js.map +1 -1
  177. package/dist/Schema.d.ts +266 -50
  178. package/dist/Schema.d.ts.map +1 -1
  179. package/dist/Schema.js +426 -74
  180. package/dist/Schema.js.map +1 -1
  181. package/dist/SchemaAST.d.ts.map +1 -1
  182. package/dist/SchemaAST.js +7 -6
  183. package/dist/SchemaAST.js.map +1 -1
  184. package/dist/SchemaGetter.d.ts +2 -2
  185. package/dist/SchemaGetter.d.ts.map +1 -1
  186. package/dist/SchemaGetter.js +12 -14
  187. package/dist/SchemaGetter.js.map +1 -1
  188. package/dist/SchemaParser.d.ts +5 -0
  189. package/dist/SchemaParser.d.ts.map +1 -1
  190. package/dist/SchemaParser.js +10 -0
  191. package/dist/SchemaParser.js.map +1 -1
  192. package/dist/SchemaRepresentation.d.ts +44 -43
  193. package/dist/SchemaRepresentation.d.ts.map +1 -1
  194. package/dist/SchemaRepresentation.js +43 -24
  195. package/dist/SchemaRepresentation.js.map +1 -1
  196. package/dist/SchemaTransformation.d.ts +107 -3
  197. package/dist/SchemaTransformation.d.ts.map +1 -1
  198. package/dist/SchemaTransformation.js +159 -4
  199. package/dist/SchemaTransformation.js.map +1 -1
  200. package/dist/ScopedCache.d.ts +2 -2
  201. package/dist/ScopedCache.d.ts.map +1 -1
  202. package/dist/ScopedCache.js +1 -1
  203. package/dist/ScopedCache.js.map +1 -1
  204. package/dist/Semaphore.d.ts +211 -0
  205. package/dist/Semaphore.d.ts.map +1 -0
  206. package/dist/{PartitionedSemaphore.js → Semaphore.js} +97 -13
  207. package/dist/Semaphore.js.map +1 -0
  208. package/dist/ServiceMap.d.ts +39 -30
  209. package/dist/ServiceMap.d.ts.map +1 -1
  210. package/dist/ServiceMap.js +3 -3
  211. package/dist/ServiceMap.js.map +1 -1
  212. package/dist/Sink.d.ts +13 -13
  213. package/dist/Sink.d.ts.map +1 -1
  214. package/dist/Sink.js +53 -6
  215. package/dist/Sink.js.map +1 -1
  216. package/dist/Stream.d.ts +235 -423
  217. package/dist/Stream.d.ts.map +1 -1
  218. package/dist/Stream.js +124 -77
  219. package/dist/Stream.js.map +1 -1
  220. package/dist/Struct.d.ts +16 -0
  221. package/dist/Struct.d.ts.map +1 -1
  222. package/dist/Struct.js +22 -0
  223. package/dist/Struct.js.map +1 -1
  224. package/dist/SubscriptionRef.d.ts +2 -1
  225. package/dist/SubscriptionRef.d.ts.map +1 -1
  226. package/dist/SubscriptionRef.js +2 -1
  227. package/dist/SubscriptionRef.js.map +1 -1
  228. package/dist/SynchronizedRef.d.ts +2 -1
  229. package/dist/SynchronizedRef.d.ts.map +1 -1
  230. package/dist/SynchronizedRef.js +2 -1
  231. package/dist/SynchronizedRef.js.map +1 -1
  232. package/dist/Trie.d.ts +18 -17
  233. package/dist/Trie.d.ts.map +1 -1
  234. package/dist/Trie.js +5 -5
  235. package/dist/Trie.js.map +1 -1
  236. package/dist/TxChunk.d.ts +37 -37
  237. package/dist/TxChunk.d.ts.map +1 -1
  238. package/dist/TxChunk.js +3 -3
  239. package/dist/TxChunk.js.map +1 -1
  240. package/dist/TxDeferred.d.ts +328 -0
  241. package/dist/TxDeferred.d.ts.map +1 -0
  242. package/dist/TxDeferred.js +196 -0
  243. package/dist/TxDeferred.js.map +1 -0
  244. package/dist/TxHashMap.d.ts +84 -83
  245. package/dist/TxHashMap.d.ts.map +1 -1
  246. package/dist/TxHashMap.js +24 -24
  247. package/dist/TxHashMap.js.map +1 -1
  248. package/dist/TxHashSet.d.ts +35 -35
  249. package/dist/TxHashSet.d.ts.map +1 -1
  250. package/dist/TxHashSet.js +14 -14
  251. package/dist/TxHashSet.js.map +1 -1
  252. package/dist/TxPriorityQueue.d.ts +609 -0
  253. package/dist/TxPriorityQueue.d.ts.map +1 -0
  254. package/dist/TxPriorityQueue.js +415 -0
  255. package/dist/TxPriorityQueue.js.map +1 -0
  256. package/dist/TxPubSub.d.ts +585 -0
  257. package/dist/TxPubSub.d.ts.map +1 -0
  258. package/dist/TxPubSub.js +521 -0
  259. package/dist/TxPubSub.js.map +1 -0
  260. package/dist/TxQueue.d.ts +32 -32
  261. package/dist/TxQueue.d.ts.map +1 -1
  262. package/dist/TxQueue.js +26 -26
  263. package/dist/TxQueue.js.map +1 -1
  264. package/dist/TxReentrantLock.d.ts +523 -0
  265. package/dist/TxReentrantLock.d.ts.map +1 -0
  266. package/dist/TxReentrantLock.js +504 -0
  267. package/dist/TxReentrantLock.js.map +1 -0
  268. package/dist/TxRef.d.ts +34 -34
  269. package/dist/TxRef.d.ts.map +1 -1
  270. package/dist/TxRef.js +21 -14
  271. package/dist/TxRef.js.map +1 -1
  272. package/dist/TxSemaphore.d.ts +8 -8
  273. package/dist/TxSemaphore.d.ts.map +1 -1
  274. package/dist/TxSemaphore.js +7 -7
  275. package/dist/TxSemaphore.js.map +1 -1
  276. package/dist/TxSubscriptionRef.d.ts +508 -0
  277. package/dist/TxSubscriptionRef.d.ts.map +1 -0
  278. package/dist/TxSubscriptionRef.js +293 -0
  279. package/dist/TxSubscriptionRef.js.map +1 -0
  280. package/dist/Types.d.ts +84 -6
  281. package/dist/Types.d.ts.map +1 -1
  282. package/dist/index.d.ts +591 -20
  283. package/dist/index.d.ts.map +1 -1
  284. package/dist/index.js +591 -20
  285. package/dist/index.js.map +1 -1
  286. package/dist/internal/core.js +11 -3
  287. package/dist/internal/core.js.map +1 -1
  288. package/dist/internal/dateTime.js +3 -11
  289. package/dist/internal/dateTime.js.map +1 -1
  290. package/dist/internal/effect.js +263 -99
  291. package/dist/internal/effect.js.map +1 -1
  292. package/dist/internal/hashMap.js +5 -4
  293. package/dist/internal/hashMap.js.map +1 -1
  294. package/dist/internal/random.d.ts +2 -0
  295. package/dist/internal/random.d.ts.map +1 -0
  296. package/dist/internal/random.js +13 -0
  297. package/dist/internal/random.js.map +1 -0
  298. package/dist/internal/rcRef.js +3 -2
  299. package/dist/internal/rcRef.js.map +1 -1
  300. package/dist/internal/request.js +2 -2
  301. package/dist/internal/request.js.map +1 -1
  302. package/dist/internal/schema/annotations.js +2 -0
  303. package/dist/internal/schema/annotations.js.map +1 -1
  304. package/dist/internal/schema/schema.js +1 -0
  305. package/dist/internal/schema/schema.js.map +1 -1
  306. package/dist/internal/trie.js +5 -4
  307. package/dist/internal/trie.js.map +1 -1
  308. package/dist/testing/TestClock.d.ts +7 -6
  309. package/dist/testing/TestClock.d.ts.map +1 -1
  310. package/dist/testing/TestClock.js +6 -4
  311. package/dist/testing/TestClock.js.map +1 -1
  312. package/dist/testing/TestSchema.d.ts +8 -8
  313. package/dist/testing/TestSchema.d.ts.map +1 -1
  314. package/dist/testing/TestSchema.js.map +1 -1
  315. package/dist/unstable/ai/AiError.d.ts +128 -48
  316. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  317. package/dist/unstable/ai/AiError.js +11 -12
  318. package/dist/unstable/ai/AiError.js.map +1 -1
  319. package/dist/unstable/ai/Chat.d.ts +3 -3
  320. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  321. package/dist/unstable/ai/Chat.js +4 -3
  322. package/dist/unstable/ai/Chat.js.map +1 -1
  323. package/dist/unstable/ai/LanguageModel.d.ts +4 -2
  324. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  325. package/dist/unstable/ai/LanguageModel.js +86 -14
  326. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  327. package/dist/unstable/ai/McpSchema.d.ts +163 -87
  328. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  329. package/dist/unstable/ai/McpSchema.js +49 -12
  330. package/dist/unstable/ai/McpSchema.js.map +1 -1
  331. package/dist/unstable/ai/McpServer.d.ts +1 -1
  332. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  333. package/dist/unstable/ai/McpServer.js +35 -7
  334. package/dist/unstable/ai/McpServer.js.map +1 -1
  335. package/dist/unstable/ai/Model.d.ts +25 -7
  336. package/dist/unstable/ai/Model.d.ts.map +1 -1
  337. package/dist/unstable/ai/Model.js +22 -6
  338. package/dist/unstable/ai/Model.js.map +1 -1
  339. package/dist/unstable/ai/Prompt.d.ts +20 -20
  340. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  341. package/dist/unstable/ai/Response.d.ts +26 -26
  342. package/dist/unstable/ai/Response.d.ts.map +1 -1
  343. package/dist/unstable/ai/Response.js +1 -1
  344. package/dist/unstable/ai/Response.js.map +1 -1
  345. package/dist/unstable/ai/Tool.d.ts +19 -3
  346. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  347. package/dist/unstable/ai/Tool.js +14 -9
  348. package/dist/unstable/ai/Tool.js.map +1 -1
  349. package/dist/unstable/ai/index.d.ts +1 -1
  350. package/dist/unstable/ai/index.js +1 -1
  351. package/dist/unstable/cli/CliError.d.ts +5 -5
  352. package/dist/unstable/cli/CliOutput.js +59 -6
  353. package/dist/unstable/cli/CliOutput.js.map +1 -1
  354. package/dist/unstable/cli/Command.d.ts +276 -19
  355. package/dist/unstable/cli/Command.d.ts.map +1 -1
  356. package/dist/unstable/cli/Command.js +234 -36
  357. package/dist/unstable/cli/Command.js.map +1 -1
  358. package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
  359. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
  360. package/dist/unstable/cli/GlobalFlag.js +118 -0
  361. package/dist/unstable/cli/GlobalFlag.js.map +1 -0
  362. package/dist/unstable/cli/HelpDoc.d.ts +70 -2
  363. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  364. package/dist/unstable/cli/index.d.ts +4 -0
  365. package/dist/unstable/cli/index.d.ts.map +1 -1
  366. package/dist/unstable/cli/index.js +4 -0
  367. package/dist/unstable/cli/index.js.map +1 -1
  368. package/dist/unstable/cli/internal/command.d.ts +17 -8
  369. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  370. package/dist/unstable/cli/internal/command.js +32 -23
  371. package/dist/unstable/cli/internal/command.js.map +1 -1
  372. package/dist/unstable/cli/internal/completions/CommandDescriptor.js +7 -2
  373. package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
  374. package/dist/unstable/cli/internal/help.d.ts +33 -0
  375. package/dist/unstable/cli/internal/help.d.ts.map +1 -0
  376. package/dist/unstable/cli/internal/help.js +107 -0
  377. package/dist/unstable/cli/internal/help.js.map +1 -0
  378. package/dist/unstable/cli/internal/parser.js +29 -36
  379. package/dist/unstable/cli/internal/parser.js.map +1 -1
  380. package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
  381. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  382. package/dist/unstable/cluster/ClusterCron.js +1 -1
  383. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  384. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  385. package/dist/unstable/cluster/ClusterWorkflowEngine.js +4 -3
  386. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  387. package/dist/unstable/cluster/Entity.d.ts +7 -6
  388. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  389. package/dist/unstable/cluster/Entity.js.map +1 -1
  390. package/dist/unstable/cluster/EntityResource.d.ts +2 -2
  391. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  392. package/dist/unstable/cluster/Envelope.d.ts +1 -1
  393. package/dist/unstable/cluster/K8sHttpClient.d.ts +1 -1
  394. package/dist/unstable/cluster/K8sHttpClient.js +4 -4
  395. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  396. package/dist/unstable/cluster/Message.d.ts +10 -10
  397. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  398. package/dist/unstable/cluster/MessageStorage.js +2 -1
  399. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  400. package/dist/unstable/cluster/Reply.d.ts +6 -6
  401. package/dist/unstable/cluster/Runner.d.ts +1 -1
  402. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  403. package/dist/unstable/cluster/Runners.js +4 -3
  404. package/dist/unstable/cluster/Runners.js.map +1 -1
  405. package/dist/unstable/cluster/Sharding.d.ts +2 -2
  406. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  407. package/dist/unstable/cluster/Sharding.js +9 -7
  408. package/dist/unstable/cluster/Sharding.js.map +1 -1
  409. package/dist/unstable/cluster/ShardingConfig.d.ts +21 -21
  410. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  411. package/dist/unstable/cluster/ShardingConfig.js +20 -20
  412. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  413. package/dist/unstable/cluster/SqlRunnerStorage.js +1 -1
  414. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  415. package/dist/unstable/cluster/internal/entityManager.js +5 -4
  416. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  417. package/dist/unstable/cluster/internal/entityReaper.js +2 -1
  418. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  419. package/dist/unstable/cluster/internal/resourceRef.js +2 -1
  420. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  421. package/dist/unstable/devtools/DevToolsSchema.d.ts +36 -36
  422. package/dist/unstable/encoding/Msgpack.d.ts +1 -1
  423. package/dist/unstable/encoding/Ndjson.d.ts +1 -1
  424. package/dist/unstable/encoding/Sse.d.ts +4 -4
  425. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  426. package/dist/unstable/encoding/Sse.js +1 -1
  427. package/dist/unstable/encoding/Sse.js.map +1 -1
  428. package/dist/unstable/eventlog/EventJournal.d.ts +2 -2
  429. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  430. package/dist/unstable/eventlog/EventLog.js +2 -1
  431. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  432. package/dist/unstable/eventlog/EventLogRemote.d.ts +6 -6
  433. package/dist/unstable/http/Cookies.d.ts +3 -3
  434. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  435. package/dist/unstable/http/Cookies.js +2 -2
  436. package/dist/unstable/http/Cookies.js.map +1 -1
  437. package/dist/unstable/http/Headers.d.ts.map +1 -1
  438. package/dist/unstable/http/Headers.js +27 -10
  439. package/dist/unstable/http/Headers.js.map +1 -1
  440. package/dist/unstable/http/HttpBody.d.ts +17 -2
  441. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  442. package/dist/unstable/http/HttpBody.js +28 -1
  443. package/dist/unstable/http/HttpBody.js.map +1 -1
  444. package/dist/unstable/http/HttpClient.d.ts +37 -13
  445. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  446. package/dist/unstable/http/HttpClient.js +4 -4
  447. package/dist/unstable/http/HttpClient.js.map +1 -1
  448. package/dist/unstable/http/HttpClientError.d.ts +7 -7
  449. package/dist/unstable/http/HttpClientRequest.d.ts +27 -11
  450. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  451. package/dist/unstable/http/HttpClientRequest.js +15 -3
  452. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  453. package/dist/unstable/http/HttpEffect.d.ts +3 -8
  454. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  455. package/dist/unstable/http/HttpEffect.js +42 -56
  456. package/dist/unstable/http/HttpEffect.js.map +1 -1
  457. package/dist/unstable/http/HttpMethod.d.ts +4 -4
  458. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  459. package/dist/unstable/http/HttpMethod.js +3 -3
  460. package/dist/unstable/http/HttpMethod.js.map +1 -1
  461. package/dist/unstable/http/HttpMiddleware.d.ts +1 -6
  462. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  463. package/dist/unstable/http/HttpMiddleware.js +8 -17
  464. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  465. package/dist/unstable/http/HttpServerError.d.ts +20 -33
  466. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  467. package/dist/unstable/http/HttpServerError.js +37 -44
  468. package/dist/unstable/http/HttpServerError.js.map +1 -1
  469. package/dist/unstable/http/HttpServerRequest.d.ts +1 -1
  470. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  471. package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
  472. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  473. package/dist/unstable/http/HttpServerRespondable.js +5 -5
  474. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  475. package/dist/unstable/http/HttpServerResponse.d.ts +2 -1
  476. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  477. package/dist/unstable/http/HttpServerResponse.js +3 -1
  478. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  479. package/dist/unstable/http/Multipart.d.ts +3 -3
  480. package/dist/unstable/http/UrlParams.d.ts +14 -6
  481. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  482. package/dist/unstable/http/UrlParams.js +1 -1
  483. package/dist/unstable/http/UrlParams.js.map +1 -1
  484. package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
  485. package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
  486. package/dist/unstable/http/internal/preResponseHandler.js +10 -0
  487. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
  488. package/dist/unstable/httpapi/HttpApi.d.ts +3 -3
  489. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  490. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  491. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +11 -5
  492. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  493. package/dist/unstable/httpapi/HttpApiBuilder.js +23 -12
  494. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  495. package/dist/unstable/httpapi/HttpApiClient.d.ts +7 -2
  496. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  497. package/dist/unstable/httpapi/HttpApiClient.js +3 -3
  498. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  499. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +31 -44
  500. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  501. package/dist/unstable/httpapi/HttpApiEndpoint.js +15 -24
  502. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  503. package/dist/unstable/httpapi/HttpApiError.d.ts +11 -0
  504. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  505. package/dist/unstable/httpapi/HttpApiError.js +29 -9
  506. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  507. package/dist/unstable/httpapi/HttpApiGroup.d.ts +3 -3
  508. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  509. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  510. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +4 -4
  511. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  512. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  513. package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
  514. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  515. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  516. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +2 -2
  517. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  518. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  519. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  520. package/dist/unstable/httpapi/OpenApi.js +32 -21
  521. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  522. package/dist/unstable/observability/Otlp.d.ts +12 -12
  523. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  524. package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
  525. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  526. package/dist/unstable/observability/OtlpExporter.js +1 -1
  527. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  528. package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
  529. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  530. package/dist/unstable/observability/OtlpLogger.js +7 -4
  531. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  532. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
  533. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  534. package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
  535. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  536. package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
  537. package/dist/unstable/persistence/KeyValueStore.js +6 -6
  538. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  539. package/dist/unstable/persistence/Persistable.d.ts +2 -2
  540. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  541. package/dist/unstable/persistence/PersistedCache.d.ts +6 -5
  542. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  543. package/dist/unstable/persistence/PersistedCache.js +2 -1
  544. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  545. package/dist/unstable/persistence/PersistedQueue.d.ts +12 -12
  546. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  547. package/dist/unstable/persistence/PersistedQueue.js +12 -11
  548. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  549. package/dist/unstable/persistence/Persistence.d.ts +1 -1
  550. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  551. package/dist/unstable/persistence/Persistence.js +2 -2
  552. package/dist/unstable/persistence/Persistence.js.map +1 -1
  553. package/dist/unstable/persistence/RateLimiter.d.ts +3 -3
  554. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  555. package/dist/unstable/persistence/RateLimiter.js +1 -1
  556. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  557. package/dist/unstable/process/ChildProcess.d.ts +5 -128
  558. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  559. package/dist/unstable/process/ChildProcess.js +1 -65
  560. package/dist/unstable/process/ChildProcess.js.map +1 -1
  561. package/dist/unstable/process/ChildProcessSpawner.d.ts +45 -7
  562. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  563. package/dist/unstable/process/ChildProcessSpawner.js +21 -1
  564. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  565. package/dist/unstable/reactivity/Atom.d.ts +10 -10
  566. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  567. package/dist/unstable/reactivity/Atom.js +16 -13
  568. package/dist/unstable/reactivity/Atom.js.map +1 -1
  569. package/dist/unstable/reactivity/AtomHttpApi.d.ts +8 -8
  570. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  571. package/dist/unstable/reactivity/AtomHttpApi.js +3 -3
  572. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  573. package/dist/unstable/reactivity/AtomRegistry.d.ts +6 -0
  574. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  575. package/dist/unstable/reactivity/AtomRegistry.js +24 -7
  576. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  577. package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
  578. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  579. package/dist/unstable/reactivity/AtomRpc.js +1 -1
  580. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  581. package/dist/unstable/reactivity/Hydration.d.ts +39 -0
  582. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -0
  583. package/dist/unstable/reactivity/Hydration.js +76 -0
  584. package/dist/unstable/reactivity/Hydration.js.map +1 -0
  585. package/dist/unstable/reactivity/index.d.ts +4 -0
  586. package/dist/unstable/reactivity/index.d.ts.map +1 -1
  587. package/dist/unstable/reactivity/index.js +4 -0
  588. package/dist/unstable/reactivity/index.js.map +1 -1
  589. package/dist/unstable/rpc/Rpc.d.ts +4 -4
  590. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  591. package/dist/unstable/rpc/Rpc.js.map +1 -1
  592. package/dist/unstable/rpc/RpcClient.d.ts +5 -26
  593. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  594. package/dist/unstable/rpc/RpcClient.js +6 -13
  595. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  596. package/dist/unstable/rpc/RpcGroup.d.ts +2 -2
  597. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  598. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  599. package/dist/unstable/rpc/RpcMiddleware.d.ts +3 -3
  600. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  601. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  602. package/dist/unstable/rpc/RpcSchema.d.ts +13 -0
  603. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  604. package/dist/unstable/rpc/RpcSchema.js +14 -0
  605. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  606. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  607. package/dist/unstable/rpc/RpcSerialization.js +34 -9
  608. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  609. package/dist/unstable/rpc/RpcServer.d.ts +0 -7
  610. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  611. package/dist/unstable/rpc/RpcServer.js +15 -15
  612. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  613. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  614. package/dist/unstable/rpc/Utils.js +2 -1
  615. package/dist/unstable/rpc/Utils.js.map +1 -1
  616. package/dist/unstable/schema/Model.d.ts +1 -1
  617. package/dist/unstable/schema/Model.d.ts.map +1 -1
  618. package/dist/unstable/schema/VariantSchema.d.ts +3 -3
  619. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  620. package/dist/unstable/schema/VariantSchema.js +3 -3
  621. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  622. package/dist/unstable/socket/Socket.d.ts +4 -4
  623. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  624. package/dist/unstable/socket/Socket.js +6 -5
  625. package/dist/unstable/socket/Socket.js.map +1 -1
  626. package/dist/unstable/socket/SocketServer.d.ts +3 -3
  627. package/dist/unstable/sql/Migrator.d.ts +1 -1
  628. package/dist/unstable/sql/SqlClient.d.ts +1 -1
  629. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  630. package/dist/unstable/sql/SqlError.d.ts +14 -14
  631. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  632. package/dist/unstable/sql/SqlError.js +9 -3
  633. package/dist/unstable/sql/SqlError.js.map +1 -1
  634. package/dist/unstable/sql/SqlModel.d.ts +2 -2
  635. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  636. package/dist/unstable/sql/SqlModel.js +3 -3
  637. package/dist/unstable/sql/SqlModel.js.map +1 -1
  638. package/dist/unstable/sql/SqlSchema.d.ts +16 -5
  639. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  640. package/dist/unstable/sql/SqlSchema.js +17 -7
  641. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  642. package/dist/unstable/sql/Statement.js +0 -1
  643. package/dist/unstable/sql/Statement.js.map +1 -1
  644. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  645. package/dist/unstable/workers/Worker.js +2 -1
  646. package/dist/unstable/workers/Worker.js.map +1 -1
  647. package/dist/unstable/workflow/DurableClock.d.ts +3 -3
  648. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  649. package/dist/unstable/workflow/DurableClock.js +3 -3
  650. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  651. package/dist/unstable/workflow/DurableDeferred.js +2 -2
  652. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  653. package/dist/unstable/workflow/Workflow.d.ts +3 -3
  654. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  655. package/dist/unstable/workflow/Workflow.js +1 -1
  656. package/dist/unstable/workflow/Workflow.js.map +1 -1
  657. package/dist/unstable/workflow/WorkflowEngine.d.ts +12 -1
  658. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  659. package/dist/unstable/workflow/WorkflowEngine.js +137 -1
  660. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  661. package/package.json +2 -2
  662. package/src/Array.ts +190 -342
  663. package/src/Cache.ts +9 -8
  664. package/src/Cause.ts +1 -1
  665. package/src/Channel.ts +554 -138
  666. package/src/Chunk.ts +81 -268
  667. package/src/Combiner.ts +280 -13
  668. package/src/Config.ts +183 -21
  669. package/src/Data.ts +538 -374
  670. package/src/DateTime.ts +24 -164
  671. package/src/Duration.ts +15 -15
  672. package/src/Effect.ts +991 -800
  673. package/src/Encoding.ts +879 -0
  674. package/src/Equal.ts +278 -111
  675. package/src/ErrorReporter.ts +459 -0
  676. package/src/Fiber.ts +9 -2
  677. package/src/FileSystem.ts +7 -8
  678. package/src/Filter.ts +48 -58
  679. package/src/Formatter.ts +253 -51
  680. package/src/Graph.ts +24 -11
  681. package/src/HashMap.ts +15 -14
  682. package/src/Iterable.ts +105 -50
  683. package/src/JsonSchema.ts +383 -10
  684. package/src/Latch.ts +112 -0
  685. package/src/Layer.ts +11 -15
  686. package/src/LayerMap.ts +5 -5
  687. package/src/LogLevel.ts +37 -0
  688. package/src/Logger.ts +33 -100
  689. package/src/ManagedRuntime.ts +1 -1
  690. package/src/Metric.ts +4 -4
  691. package/src/Optic.ts +948 -19
  692. package/src/Option.ts +30 -20
  693. package/src/Pipeable.ts +32 -1
  694. package/src/PlatformError.ts +5 -5
  695. package/src/Pool.ts +13 -11
  696. package/src/PubSub.ts +10 -9
  697. package/src/Pull.ts +1 -1
  698. package/src/Queue.ts +0 -1
  699. package/src/Random.ts +51 -14
  700. package/src/RcMap.ts +5 -5
  701. package/src/RcRef.ts +1 -1
  702. package/src/Record.ts +43 -152
  703. package/src/Reducer.ts +166 -7
  704. package/src/References.ts +4 -4
  705. package/src/Request.ts +3 -2
  706. package/src/RequestResolver.ts +9 -29
  707. package/src/Result.ts +13 -0
  708. package/src/Schedule.ts +318 -160
  709. package/src/Schema.ts +661 -116
  710. package/src/SchemaAST.ts +7 -6
  711. package/src/SchemaGetter.ts +12 -14
  712. package/src/SchemaParser.ts +11 -0
  713. package/src/SchemaRepresentation.ts +43 -24
  714. package/src/SchemaTransformation.ts +189 -4
  715. package/src/ScopedCache.ts +3 -3
  716. package/src/Semaphore.ts +356 -0
  717. package/src/ServiceMap.ts +47 -38
  718. package/src/Sink.ts +78 -26
  719. package/src/Stream.ts +566 -601
  720. package/src/Struct.ts +26 -0
  721. package/src/SubscriptionRef.ts +3 -2
  722. package/src/SynchronizedRef.ts +3 -2
  723. package/src/Trie.ts +18 -17
  724. package/src/TxChunk.ts +72 -53
  725. package/src/TxDeferred.ts +394 -0
  726. package/src/TxHashMap.ts +332 -285
  727. package/src/TxHashSet.ts +111 -116
  728. package/src/TxPriorityQueue.ts +767 -0
  729. package/src/TxPubSub.ts +789 -0
  730. package/src/TxQueue.ts +241 -251
  731. package/src/TxReentrantLock.ts +753 -0
  732. package/src/TxRef.ts +50 -38
  733. package/src/TxSemaphore.ts +29 -32
  734. package/src/TxSubscriptionRef.ts +639 -0
  735. package/src/Types.ts +78 -2
  736. package/src/index.ts +600 -21
  737. package/src/internal/core.ts +12 -5
  738. package/src/internal/dateTime.ts +9 -30
  739. package/src/internal/effect.ts +744 -265
  740. package/src/internal/hashMap.ts +9 -7
  741. package/src/internal/random.ts +20 -0
  742. package/src/internal/rcRef.ts +4 -3
  743. package/src/internal/request.ts +2 -2
  744. package/src/internal/schema/annotations.ts +2 -0
  745. package/src/internal/schema/schema.ts +1 -0
  746. package/src/internal/trie.ts +16 -9
  747. package/src/testing/TestClock.ts +13 -11
  748. package/src/testing/TestSchema.ts +10 -10
  749. package/src/unstable/ai/AiError.ts +97 -44
  750. package/src/unstable/ai/Chat.ts +12 -11
  751. package/src/unstable/ai/LanguageModel.ts +129 -25
  752. package/src/unstable/ai/McpSchema.ts +59 -13
  753. package/src/unstable/ai/McpServer.ts +48 -9
  754. package/src/unstable/ai/Model.ts +40 -9
  755. package/src/unstable/ai/Prompt.ts +37 -37
  756. package/src/unstable/ai/Response.ts +25 -25
  757. package/src/unstable/ai/Tool.ts +19 -13
  758. package/src/unstable/ai/index.ts +1 -1
  759. package/src/unstable/cli/CliOutput.ts +75 -6
  760. package/src/unstable/cli/Command.ts +501 -60
  761. package/src/unstable/cli/GlobalFlag.ts +243 -0
  762. package/src/unstable/cli/HelpDoc.ts +80 -2
  763. package/src/unstable/cli/index.ts +5 -0
  764. package/src/unstable/cli/internal/command.ts +50 -34
  765. package/src/unstable/cli/internal/completions/CommandDescriptor.ts +7 -2
  766. package/src/unstable/cli/internal/help.ts +146 -0
  767. package/src/unstable/cli/internal/parser.ts +33 -54
  768. package/src/unstable/cluster/ClusterCron.ts +2 -2
  769. package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -4
  770. package/src/unstable/cluster/Entity.ts +11 -10
  771. package/src/unstable/cluster/EntityResource.ts +4 -4
  772. package/src/unstable/cluster/Envelope.ts +1 -1
  773. package/src/unstable/cluster/K8sHttpClient.ts +5 -5
  774. package/src/unstable/cluster/MessageStorage.ts +3 -5
  775. package/src/unstable/cluster/Runners.ts +6 -5
  776. package/src/unstable/cluster/Sharding.ts +12 -10
  777. package/src/unstable/cluster/ShardingConfig.ts +30 -31
  778. package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
  779. package/src/unstable/cluster/internal/entityManager.ts +9 -8
  780. package/src/unstable/cluster/internal/entityReaper.ts +2 -1
  781. package/src/unstable/cluster/internal/resourceRef.ts +2 -1
  782. package/src/unstable/encoding/Sse.ts +3 -5
  783. package/src/unstable/eventlog/EventLog.ts +2 -1
  784. package/src/unstable/http/Cookies.ts +3 -3
  785. package/src/unstable/http/Headers.ts +28 -13
  786. package/src/unstable/http/HttpBody.ts +42 -1
  787. package/src/unstable/http/HttpClient.ts +58 -23
  788. package/src/unstable/http/HttpClientRequest.ts +38 -13
  789. package/src/unstable/http/HttpEffect.ts +46 -68
  790. package/src/unstable/http/HttpMethod.ts +16 -4
  791. package/src/unstable/http/HttpMiddleware.ts +9 -24
  792. package/src/unstable/http/HttpServerError.ts +42 -45
  793. package/src/unstable/http/HttpServerRequest.ts +1 -1
  794. package/src/unstable/http/HttpServerRespondable.ts +6 -6
  795. package/src/unstable/http/HttpServerResponse.ts +4 -2
  796. package/src/unstable/http/Multipart.ts +2 -2
  797. package/src/unstable/http/UrlParams.ts +20 -5
  798. package/src/unstable/http/internal/preResponseHandler.ts +15 -0
  799. package/src/unstable/httpapi/HttpApi.ts +5 -5
  800. package/src/unstable/httpapi/HttpApiBuilder.ts +77 -21
  801. package/src/unstable/httpapi/HttpApiClient.ts +14 -6
  802. package/src/unstable/httpapi/HttpApiEndpoint.ts +67 -83
  803. package/src/unstable/httpapi/HttpApiError.ts +30 -9
  804. package/src/unstable/httpapi/HttpApiGroup.ts +6 -6
  805. package/src/unstable/httpapi/HttpApiMiddleware.ts +4 -4
  806. package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
  807. package/src/unstable/httpapi/HttpApiSecurity.ts +3 -3
  808. package/src/unstable/httpapi/OpenApi.ts +41 -23
  809. package/src/unstable/observability/Otlp.ts +12 -12
  810. package/src/unstable/observability/OtlpExporter.ts +3 -3
  811. package/src/unstable/observability/OtlpLogger.ts +13 -9
  812. package/src/unstable/observability/OtlpMetrics.ts +4 -4
  813. package/src/unstable/observability/OtlpTracer.ts +4 -4
  814. package/src/unstable/persistence/KeyValueStore.ts +6 -6
  815. package/src/unstable/persistence/Persistable.ts +2 -2
  816. package/src/unstable/persistence/PersistedCache.ts +20 -9
  817. package/src/unstable/persistence/PersistedQueue.ts +25 -24
  818. package/src/unstable/persistence/Persistence.ts +3 -3
  819. package/src/unstable/persistence/RateLimiter.ts +4 -4
  820. package/src/unstable/process/ChildProcess.ts +6 -208
  821. package/src/unstable/process/ChildProcessSpawner.ts +75 -14
  822. package/src/unstable/reactivity/Atom.ts +27 -25
  823. package/src/unstable/reactivity/AtomHttpApi.ts +21 -20
  824. package/src/unstable/reactivity/AtomRegistry.ts +31 -7
  825. package/src/unstable/reactivity/AtomRpc.ts +3 -3
  826. package/src/unstable/reactivity/Hydration.ts +112 -0
  827. package/src/unstable/reactivity/index.ts +5 -0
  828. package/src/unstable/rpc/Rpc.ts +6 -6
  829. package/src/unstable/rpc/RpcClient.ts +12 -54
  830. package/src/unstable/rpc/RpcGroup.ts +4 -4
  831. package/src/unstable/rpc/RpcMiddleware.ts +3 -3
  832. package/src/unstable/rpc/RpcSchema.ts +17 -0
  833. package/src/unstable/rpc/RpcSerialization.ts +44 -9
  834. package/src/unstable/rpc/RpcServer.ts +21 -30
  835. package/src/unstable/rpc/Utils.ts +2 -1
  836. package/src/unstable/schema/VariantSchema.ts +6 -6
  837. package/src/unstable/socket/Socket.ts +16 -17
  838. package/src/unstable/sql/SqlClient.ts +1 -1
  839. package/src/unstable/sql/SqlError.ts +11 -9
  840. package/src/unstable/sql/SqlModel.ts +5 -5
  841. package/src/unstable/sql/SqlSchema.ts +41 -25
  842. package/src/unstable/sql/Statement.ts +0 -1
  843. package/src/unstable/workers/Worker.ts +2 -1
  844. package/src/unstable/workflow/DurableClock.ts +8 -8
  845. package/src/unstable/workflow/DurableDeferred.ts +2 -2
  846. package/src/unstable/workflow/Workflow.ts +6 -2
  847. package/src/unstable/workflow/WorkflowEngine.ts +185 -2
  848. package/dist/PartitionedSemaphore.d.ts +0 -52
  849. package/dist/PartitionedSemaphore.d.ts.map +0 -1
  850. package/dist/PartitionedSemaphore.js.map +0 -1
  851. package/dist/encoding/Base64.d.ts +0 -67
  852. package/dist/encoding/Base64.d.ts.map +0 -1
  853. package/dist/encoding/Base64.js +0 -146
  854. package/dist/encoding/Base64.js.map +0 -1
  855. package/dist/encoding/Base64Url.d.ts +0 -60
  856. package/dist/encoding/Base64Url.d.ts.map +0 -1
  857. package/dist/encoding/Base64Url.js +0 -89
  858. package/dist/encoding/Base64Url.js.map +0 -1
  859. package/dist/encoding/EncodingError.d.ts +0 -31
  860. package/dist/encoding/EncodingError.d.ts.map +0 -1
  861. package/dist/encoding/EncodingError.js +0 -22
  862. package/dist/encoding/EncodingError.js.map +0 -1
  863. package/dist/encoding/Hex.d.ts +0 -61
  864. package/dist/encoding/Hex.d.ts.map +0 -1
  865. package/dist/encoding/Hex.js +0 -115
  866. package/dist/encoding/Hex.js.map +0 -1
  867. package/dist/encoding/index.d.ts +0 -26
  868. package/dist/encoding/index.d.ts.map +0 -1
  869. package/dist/encoding/index.js +0 -27
  870. package/dist/encoding/index.js.map +0 -1
  871. package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
  872. package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
  873. package/dist/unstable/cli/internal/builtInFlags.js +0 -44
  874. package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
  875. package/src/PartitionedSemaphore.ts +0 -182
  876. package/src/encoding/Base64.ts +0 -366
  877. package/src/encoding/Base64Url.ts +0 -104
  878. package/src/encoding/EncodingError.ts +0 -35
  879. package/src/encoding/Hex.ts +0 -390
  880. package/src/encoding/index.ts +0 -31
  881. package/src/unstable/cli/internal/builtInFlags.ts +0 -78
package/dist/Effect.d.ts CHANGED
@@ -78,7 +78,7 @@ import { type LazyArg } from "./Function.ts";
78
78
  import type { TypeLambda } from "./HKT.ts";
79
79
  import type * as Layer from "./Layer.ts";
80
80
  import type { Logger } from "./Logger.ts";
81
- import type { LogLevel } from "./LogLevel.ts";
81
+ import type { Severity } from "./LogLevel.ts";
82
82
  import * as Metric from "./Metric.ts";
83
83
  import type { Option } from "./Option.ts";
84
84
  import type { Pipeable } from "./Pipeable.ts";
@@ -92,7 +92,7 @@ import type { Scope } from "./Scope.ts";
92
92
  import * as ServiceMap from "./ServiceMap.ts";
93
93
  import type { AnySpan, ParentSpan, Span, SpanLink, SpanOptions, SpanOptionsNoTrace, TraceOptions, Tracer } from "./Tracer.ts";
94
94
  import type { TxRef } from "./TxRef.ts";
95
- import type { Concurrency, Covariant, EqualsWith, ExcludeReason, ExcludeTag, ExtractReason, ExtractTag, NoInfer, ReasonOf, ReasonTags, Tags, unassigned } from "./Types.ts";
95
+ import type { Concurrency, Covariant, EqualsWith, ExcludeReason, ExcludeTag, ExtractReason, ExtractTag, NarrowReason, NoInfer, OmitReason, ReasonOf, ReasonTags, Simplify, Tags, unassigned } from "./Types.ts";
96
96
  import type * as Unify from "./Unify.ts";
97
97
  declare const TypeId: "~effect/Effect";
98
98
  /**
@@ -625,7 +625,6 @@ export declare namespace All {
625
625
  * ```
626
626
  *
627
627
  * @see {@link forEach} for iterating over elements and applying an effect.
628
- * @see {@link allWith} for a data-last version of this function.
629
628
  *
630
629
  * @since 2.0.0
631
630
  * @category Collecting
@@ -724,6 +723,291 @@ export declare const partition: {
724
723
  readonly concurrency?: Concurrency | undefined;
725
724
  }): Effect<[excluded: Array<E>, satisfying: Array<B>], never, R>;
726
725
  };
726
+ /**
727
+ * Applies an effectful function to each element and accumulates all failures.
728
+ *
729
+ * This function always evaluates every element. If at least one effect fails,
730
+ * all failures are returned as a non-empty array and successes are discarded.
731
+ * If all effects succeed, it returns all collected successes.
732
+ *
733
+ * Use `discard: true` to ignore successful values while still validating all
734
+ * elements.
735
+ *
736
+ * @example
737
+ * ```ts
738
+ * import { Effect } from "effect"
739
+ *
740
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
741
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
742
+ * )
743
+ *
744
+ * Effect.runPromiseExit(program).then(console.log)
745
+ * // {
746
+ * // _id: 'Exit',
747
+ * // _tag: 'Failure',
748
+ * // cause: {
749
+ * // _id: 'Cause',
750
+ * // reasons: [
751
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
752
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
753
+ * // ]
754
+ * // }
755
+ * // }
756
+ * ```
757
+ *
758
+ * @since 4.0.0
759
+ * @category Error Accumulation
760
+ */
761
+ export declare const validate: {
762
+ /**
763
+ * Applies an effectful function to each element and accumulates all failures.
764
+ *
765
+ * This function always evaluates every element. If at least one effect fails,
766
+ * all failures are returned as a non-empty array and successes are discarded.
767
+ * If all effects succeed, it returns all collected successes.
768
+ *
769
+ * Use `discard: true` to ignore successful values while still validating all
770
+ * elements.
771
+ *
772
+ * @example
773
+ * ```ts
774
+ * import { Effect } from "effect"
775
+ *
776
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
777
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
778
+ * )
779
+ *
780
+ * Effect.runPromiseExit(program).then(console.log)
781
+ * // {
782
+ * // _id: 'Exit',
783
+ * // _tag: 'Failure',
784
+ * // cause: {
785
+ * // _id: 'Cause',
786
+ * // reasons: [
787
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
788
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
789
+ * // ]
790
+ * // }
791
+ * // }
792
+ * ```
793
+ *
794
+ * @since 4.0.0
795
+ * @category Error Accumulation
796
+ */
797
+ <A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options?: {
798
+ readonly concurrency?: Concurrency | undefined;
799
+ readonly discard?: false | undefined;
800
+ } | undefined): (elements: Iterable<A>) => Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
801
+ /**
802
+ * Applies an effectful function to each element and accumulates all failures.
803
+ *
804
+ * This function always evaluates every element. If at least one effect fails,
805
+ * all failures are returned as a non-empty array and successes are discarded.
806
+ * If all effects succeed, it returns all collected successes.
807
+ *
808
+ * Use `discard: true` to ignore successful values while still validating all
809
+ * elements.
810
+ *
811
+ * @example
812
+ * ```ts
813
+ * import { Effect } from "effect"
814
+ *
815
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
816
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
817
+ * )
818
+ *
819
+ * Effect.runPromiseExit(program).then(console.log)
820
+ * // {
821
+ * // _id: 'Exit',
822
+ * // _tag: 'Failure',
823
+ * // cause: {
824
+ * // _id: 'Cause',
825
+ * // reasons: [
826
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
827
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
828
+ * // ]
829
+ * // }
830
+ * // }
831
+ * ```
832
+ *
833
+ * @since 4.0.0
834
+ * @category Error Accumulation
835
+ */
836
+ <A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options: {
837
+ readonly concurrency?: Concurrency | undefined;
838
+ readonly discard: true;
839
+ }): (elements: Iterable<A>) => Effect<void, Arr.NonEmptyArray<E>, R>;
840
+ /**
841
+ * Applies an effectful function to each element and accumulates all failures.
842
+ *
843
+ * This function always evaluates every element. If at least one effect fails,
844
+ * all failures are returned as a non-empty array and successes are discarded.
845
+ * If all effects succeed, it returns all collected successes.
846
+ *
847
+ * Use `discard: true` to ignore successful values while still validating all
848
+ * elements.
849
+ *
850
+ * @example
851
+ * ```ts
852
+ * import { Effect } from "effect"
853
+ *
854
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
855
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
856
+ * )
857
+ *
858
+ * Effect.runPromiseExit(program).then(console.log)
859
+ * // {
860
+ * // _id: 'Exit',
861
+ * // _tag: 'Failure',
862
+ * // cause: {
863
+ * // _id: 'Cause',
864
+ * // reasons: [
865
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
866
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
867
+ * // ]
868
+ * // }
869
+ * // }
870
+ * ```
871
+ *
872
+ * @since 4.0.0
873
+ * @category Error Accumulation
874
+ */
875
+ <A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options?: {
876
+ readonly concurrency?: Concurrency | undefined;
877
+ readonly discard?: false | undefined;
878
+ } | undefined): Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
879
+ /**
880
+ * Applies an effectful function to each element and accumulates all failures.
881
+ *
882
+ * This function always evaluates every element. If at least one effect fails,
883
+ * all failures are returned as a non-empty array and successes are discarded.
884
+ * If all effects succeed, it returns all collected successes.
885
+ *
886
+ * Use `discard: true` to ignore successful values while still validating all
887
+ * elements.
888
+ *
889
+ * @example
890
+ * ```ts
891
+ * import { Effect } from "effect"
892
+ *
893
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
894
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
895
+ * )
896
+ *
897
+ * Effect.runPromiseExit(program).then(console.log)
898
+ * // {
899
+ * // _id: 'Exit',
900
+ * // _tag: 'Failure',
901
+ * // cause: {
902
+ * // _id: 'Cause',
903
+ * // reasons: [
904
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
905
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
906
+ * // ]
907
+ * // }
908
+ * // }
909
+ * ```
910
+ *
911
+ * @since 4.0.0
912
+ * @category Error Accumulation
913
+ */
914
+ <A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options: {
915
+ readonly concurrency?: Concurrency | undefined;
916
+ readonly discard: true;
917
+ }): Effect<void, Arr.NonEmptyArray<E>, R>;
918
+ };
919
+ /**
920
+ * Returns the first element that satisfies an effectful predicate.
921
+ *
922
+ * The predicate receives the element and its index. Evaluation short-circuits
923
+ * as soon as an element matches.
924
+ *
925
+ * @example
926
+ * ```ts
927
+ * import { Effect } from "effect"
928
+ *
929
+ * const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
930
+ *
931
+ * Effect.runPromise(program).then(console.log)
932
+ * // { _id: 'Option', _tag: 'Some', value: 3 }
933
+ * ```
934
+ *
935
+ * @since 2.0.0
936
+ * @category Collecting
937
+ */
938
+ export declare const findFirst: {
939
+ /**
940
+ * Returns the first element that satisfies an effectful predicate.
941
+ *
942
+ * The predicate receives the element and its index. Evaluation short-circuits
943
+ * as soon as an element matches.
944
+ *
945
+ * @example
946
+ * ```ts
947
+ * import { Effect } from "effect"
948
+ *
949
+ * const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
950
+ *
951
+ * Effect.runPromise(program).then(console.log)
952
+ * // { _id: 'Option', _tag: 'Some', value: 3 }
953
+ * ```
954
+ *
955
+ * @since 2.0.0
956
+ * @category Collecting
957
+ */
958
+ <A, E, R>(predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>): (elements: Iterable<A>) => Effect<Option<A>, E, R>;
959
+ /**
960
+ * Returns the first element that satisfies an effectful predicate.
961
+ *
962
+ * The predicate receives the element and its index. Evaluation short-circuits
963
+ * as soon as an element matches.
964
+ *
965
+ * @example
966
+ * ```ts
967
+ * import { Effect } from "effect"
968
+ *
969
+ * const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
970
+ *
971
+ * Effect.runPromise(program).then(console.log)
972
+ * // { _id: 'Option', _tag: 'Some', value: 3 }
973
+ * ```
974
+ *
975
+ * @since 2.0.0
976
+ * @category Collecting
977
+ */
978
+ <A, E, R>(elements: Iterable<A>, predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>): Effect<Option<A>, E, R>;
979
+ };
980
+ /**
981
+ * Returns the first value that passes an effectful `FilterEffect`.
982
+ *
983
+ * The filter receives the element and index. Evaluation short-circuits on the
984
+ * first `Result.succeed` and returns the transformed value in `Option.some`.
985
+ *
986
+ * @since 4.0.0
987
+ * @category Collecting
988
+ */
989
+ export declare const findFirstFilter: {
990
+ /**
991
+ * Returns the first value that passes an effectful `FilterEffect`.
992
+ *
993
+ * The filter receives the element and index. Evaluation short-circuits on the
994
+ * first `Result.succeed` and returns the transformed value in `Option.some`.
995
+ *
996
+ * @since 4.0.0
997
+ * @category Collecting
998
+ */
999
+ <A, B, X, E, R>(filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R, [i: number]>): (elements: Iterable<A>) => Effect<Option<B>, E, R>;
1000
+ /**
1001
+ * Returns the first value that passes an effectful `FilterEffect`.
1002
+ *
1003
+ * The filter receives the element and index. Evaluation short-circuits on the
1004
+ * first `Result.succeed` and returns the transformed value in `Option.some`.
1005
+ *
1006
+ * @since 4.0.0
1007
+ * @category Collecting
1008
+ */
1009
+ <A, B, X, E, R>(elements: Iterable<A>, filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R, [i: number]>): Effect<Option<B>, E, R>;
1010
+ };
727
1011
  /**
728
1012
  * Executes an effectful operation for each element in an `Iterable`.
729
1013
  *
@@ -1352,6 +1636,90 @@ export declare const callback: <A, E = never, R = never>(register: (this: Schedu
1352
1636
  * @category Creating Effects
1353
1637
  */
1354
1638
  export declare const never: Effect<never>;
1639
+ /**
1640
+ * An `Effect` containing an empty record `{}`, used as the starting point for
1641
+ * do notation chains.
1642
+ *
1643
+ * @example
1644
+ * ```ts
1645
+ * import { Effect } from "effect"
1646
+ * import { pipe } from "effect/Function"
1647
+ *
1648
+ * const program = pipe(
1649
+ * Effect.Do,
1650
+ * Effect.bind("x", () => Effect.succeed(2)),
1651
+ * Effect.bind("y", ({ x }) => Effect.succeed(x + 1)),
1652
+ * Effect.let("sum", ({ x, y }) => x + y)
1653
+ * )
1654
+ * ```
1655
+ *
1656
+ * @since 4.0.0
1657
+ * @category Do notation
1658
+ */
1659
+ export declare const Do: Effect<{}>;
1660
+ /**
1661
+ * Gives a name to the success value of an `Effect`, creating a single-key
1662
+ * record used in do notation pipelines.
1663
+ *
1664
+ * @since 4.0.0
1665
+ * @category Do notation
1666
+ */
1667
+ export declare const bindTo: {
1668
+ /**
1669
+ * Gives a name to the success value of an `Effect`, creating a single-key
1670
+ * record used in do notation pipelines.
1671
+ *
1672
+ * @since 4.0.0
1673
+ * @category Do notation
1674
+ */
1675
+ <N extends string>(name: N): <A, E, R>(self: Effect<A, E, R>) => Effect<{
1676
+ [K in N]: A;
1677
+ }, E, R>;
1678
+ /**
1679
+ * Gives a name to the success value of an `Effect`, creating a single-key
1680
+ * record used in do notation pipelines.
1681
+ *
1682
+ * @since 4.0.0
1683
+ * @category Do notation
1684
+ */
1685
+ <A, E, R, N extends string>(self: Effect<A, E, R>, name: N): Effect<{
1686
+ [K in N]: A;
1687
+ }, E, R>;
1688
+ };
1689
+ declare const let_: {
1690
+ <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>;
1691
+ <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>;
1692
+ };
1693
+ export {
1694
+ /**
1695
+ * Adds a computed plain value to the do notation record.
1696
+ *
1697
+ * @since 4.0.0
1698
+ * @category Do notation
1699
+ */
1700
+ let_ as let };
1701
+ /**
1702
+ * Adds an `Effect` value to the do notation record under a given name.
1703
+ *
1704
+ * @since 4.0.0
1705
+ * @category Do notation
1706
+ */
1707
+ export declare const bind: {
1708
+ /**
1709
+ * Adds an `Effect` value to the do notation record under a given name.
1710
+ *
1711
+ * @since 4.0.0
1712
+ * @category Do notation
1713
+ */
1714
+ <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>;
1715
+ /**
1716
+ * Adds an `Effect` value to the do notation record under a given name.
1717
+ *
1718
+ * @since 4.0.0
1719
+ * @category Do notation
1720
+ */
1721
+ <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>;
1722
+ };
1355
1723
  /**
1356
1724
  * Provides a way to write effectful code using generator functions, simplifying
1357
1725
  * control flow and error handling.
@@ -3916,7 +4284,7 @@ export declare const catchReason: {
3916
4284
  * @since 4.0.0
3917
4285
  * @category Error Handling
3918
4286
  */
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>;
4287
+ <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
4288
  /**
3921
4289
  * Catches a specific reason within a tagged error.
3922
4290
  *
@@ -3952,7 +4320,7 @@ export declare const catchReason: {
3952
4320
  * @since 4.0.0
3953
4321
  * @category Error Handling
3954
4322
  */
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>;
4323
+ <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
4324
  };
3957
4325
  /**
3958
4326
  * Catches multiple reasons within a tagged error using an object of handlers.
@@ -4024,8 +4392,8 @@ export declare const catchReasons: {
4024
4392
  * @category Error Handling
4025
4393
  */
4026
4394
  <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> | {
4395
+ [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>;
4396
+ }, 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
4397
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
4030
4398
  }[keyof Cases], (A2 extends unassigned ? E : ExcludeTag<E, K>) | E2 | {
4031
4399
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
@@ -4067,8 +4435,8 @@ export declare const catchReasons: {
4067
4435
  * @category Error Handling
4068
4436
  */
4069
4437
  <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> | {
4438
+ [RK in ReasonTags<ExtractTag<E, K>>]+?: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Effect<any, any, any>;
4439
+ }, 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
4440
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
4073
4441
  }[keyof Cases], (A2 extends unassigned ? E : ExcludeTag<E, K>) | E2 | {
4074
4442
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
@@ -4469,15 +4837,14 @@ export declare const catchDefect: {
4469
4837
  <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
4838
  };
4471
4839
  /**
4472
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4473
- * `Refinement`.
4840
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4474
4841
  *
4475
4842
  * **When to Use**
4476
4843
  *
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.
4844
+ * `catchIf` lets you recover from errors that match a condition. Use a
4845
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4846
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4847
+ * interrupts are not caught.
4481
4848
  *
4482
4849
  * **Previously Known As**
4483
4850
  *
@@ -4504,7 +4871,7 @@ export declare const catchDefect: {
4504
4871
  *
4505
4872
  * // With a Filter
4506
4873
  * const recovered2 = program.pipe(
4507
- * Effect.catchIf(
4874
+ * Effect.catchFilter(
4508
4875
  * Filter.tagged("NotFound"),
4509
4876
  * (error) => Effect.succeed(`missing:${error.id}`)
4510
4877
  * )
@@ -4516,15 +4883,14 @@ export declare const catchDefect: {
4516
4883
  */
4517
4884
  export declare const catchIf: {
4518
4885
  /**
4519
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4520
- * `Refinement`.
4886
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4521
4887
  *
4522
4888
  * **When to Use**
4523
4889
  *
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.
4890
+ * `catchIf` lets you recover from errors that match a condition. Use a
4891
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4892
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4893
+ * interrupts are not caught.
4528
4894
  *
4529
4895
  * **Previously Known As**
4530
4896
  *
@@ -4551,7 +4917,7 @@ export declare const catchIf: {
4551
4917
  *
4552
4918
  * // With a Filter
4553
4919
  * const recovered2 = program.pipe(
4554
- * Effect.catchIf(
4920
+ * Effect.catchFilter(
4555
4921
  * Filter.tagged("NotFound"),
4556
4922
  * (error) => Effect.succeed(`missing:${error.id}`)
4557
4923
  * )
@@ -4563,15 +4929,14 @@ export declare const catchIf: {
4563
4929
  */
4564
4930
  <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
4931
  /**
4566
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4567
- * `Refinement`.
4932
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4568
4933
  *
4569
4934
  * **When to Use**
4570
4935
  *
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.
4936
+ * `catchIf` lets you recover from errors that match a condition. Use a
4937
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4938
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4939
+ * interrupts are not caught.
4575
4940
  *
4576
4941
  * **Previously Known As**
4577
4942
  *
@@ -4598,7 +4963,7 @@ export declare const catchIf: {
4598
4963
  *
4599
4964
  * // With a Filter
4600
4965
  * const recovered2 = program.pipe(
4601
- * Effect.catchIf(
4966
+ * Effect.catchFilter(
4602
4967
  * Filter.tagged("NotFound"),
4603
4968
  * (error) => Effect.succeed(`missing:${error.id}`)
4604
4969
  * )
@@ -4608,17 +4973,16 @@ export declare const catchIf: {
4608
4973
  * @since 2.0.0
4609
4974
  * @category Error Handling
4610
4975
  */
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>;
4976
+ <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
4977
  /**
4613
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4614
- * `Refinement`.
4978
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4615
4979
  *
4616
4980
  * **When to Use**
4617
4981
  *
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.
4982
+ * `catchIf` lets you recover from errors that match a condition. Use a
4983
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4984
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4985
+ * interrupts are not caught.
4622
4986
  *
4623
4987
  * **Previously Known As**
4624
4988
  *
@@ -4645,7 +5009,7 @@ export declare const catchIf: {
4645
5009
  *
4646
5010
  * // With a Filter
4647
5011
  * const recovered2 = program.pipe(
4648
- * Effect.catchIf(
5012
+ * Effect.catchFilter(
4649
5013
  * Filter.tagged("NotFound"),
4650
5014
  * (error) => Effect.succeed(`missing:${error.id}`)
4651
5015
  * )
@@ -4657,15 +5021,14 @@ export declare const catchIf: {
4657
5021
  */
4658
5022
  <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
5023
  /**
4660
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4661
- * `Refinement`.
5024
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4662
5025
  *
4663
5026
  * **When to Use**
4664
5027
  *
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.
5028
+ * `catchIf` lets you recover from errors that match a condition. Use a
5029
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
5030
+ * matching. Non-matching errors re-fail with the original cause. Defects and
5031
+ * interrupts are not caught.
4669
5032
  *
4670
5033
  * **Previously Known As**
4671
5034
  *
@@ -4692,7 +5055,7 @@ export declare const catchIf: {
4692
5055
  *
4693
5056
  * // With a Filter
4694
5057
  * const recovered2 = program.pipe(
4695
- * Effect.catchIf(
5058
+ * Effect.catchFilter(
4696
5059
  * Filter.tagged("NotFound"),
4697
5060
  * (error) => Effect.succeed(`missing:${error.id}`)
4698
5061
  * )
@@ -4702,7 +5065,29 @@ export declare const catchIf: {
4702
5065
  * @since 2.0.0
4703
5066
  * @category Error Handling
4704
5067
  */
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>;
5068
+ <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>;
5069
+ };
5070
+ /**
5071
+ * Recovers from specific errors using a `Filter`.
5072
+ *
5073
+ * @since 4.0.0
5074
+ * @category Error Handling
5075
+ */
5076
+ export declare const catchFilter: {
5077
+ /**
5078
+ * Recovers from specific errors using a `Filter`.
5079
+ *
5080
+ * @since 4.0.0
5081
+ * @category Error Handling
5082
+ */
5083
+ <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>;
5084
+ /**
5085
+ * Recovers from specific errors using a `Filter`.
5086
+ *
5087
+ * @since 4.0.0
5088
+ * @category Error Handling
5089
+ */
5090
+ <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
5091
  };
4707
5092
  /**
4708
5093
  * Catches `NoSuchElementError` failures and converts them to `Option.none`.
@@ -4808,7 +5193,7 @@ export declare const catchCauseIf: {
4808
5193
  * @since 4.0.0
4809
5194
  * @category Error Handling
4810
5195
  */
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>;
5196
+ <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
5197
  /**
4813
5198
  * Recovers from specific failures based on a predicate.
4814
5199
  *
@@ -4847,14 +5232,36 @@ export declare const catchCauseIf: {
4847
5232
  * @since 4.0.0
4848
5233
  * @category Error Handling
4849
5234
  */
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>;
5235
+ <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>;
4851
5236
  };
4852
5237
  /**
4853
- * The `mapError` function is used to transform or modify the error
4854
- * produced by an effect, without affecting its success value.
5238
+ * Recovers from specific failures based on a `Filter`.
4855
5239
  *
4856
- * This function is helpful when you want to enhance the error with additional
4857
- * information, change the error type, or apply custom error handling while
5240
+ * @since 4.0.0
5241
+ * @category Error Handling
5242
+ */
5243
+ export declare const catchCauseFilter: {
5244
+ /**
5245
+ * Recovers from specific failures based on a `Filter`.
5246
+ *
5247
+ * @since 4.0.0
5248
+ * @category Error Handling
5249
+ */
5250
+ <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>;
5251
+ /**
5252
+ * Recovers from specific failures based on a `Filter`.
5253
+ *
5254
+ * @since 4.0.0
5255
+ * @category Error Handling
5256
+ */
5257
+ <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>;
5258
+ };
5259
+ /**
5260
+ * The `mapError` function is used to transform or modify the error
5261
+ * produced by an effect, without affecting its success value.
5262
+ *
5263
+ * This function is helpful when you want to enhance the error with additional
5264
+ * information, change the error type, or apply custom error handling while
4858
5265
  * keeping the original behavior of the effect's success values intact. It only
4859
5266
  * operates on the error channel and leaves the success channel unchanged.
4860
5267
  *
@@ -5454,7 +5861,7 @@ export declare const tapCauseIf: {
5454
5861
  * @since 4.0.0
5455
5862
  * @category Sequencing
5456
5863
  */
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>;
5864
+ <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
5865
  /**
5459
5866
  * Conditionally executes a side effect based on the cause of a failed effect.
5460
5867
  *
@@ -5483,7 +5890,29 @@ export declare const tapCauseIf: {
5483
5890
  * @since 4.0.0
5484
5891
  * @category Sequencing
5485
5892
  */
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>;
5893
+ <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>;
5894
+ };
5895
+ /**
5896
+ * Conditionally executes a side effect based on the cause of a failed effect.
5897
+ *
5898
+ * @since 4.0.0
5899
+ * @category Sequencing
5900
+ */
5901
+ export declare const tapCauseFilter: {
5902
+ /**
5903
+ * Conditionally executes a side effect based on the cause of a failed effect.
5904
+ *
5905
+ * @since 4.0.0
5906
+ * @category Sequencing
5907
+ */
5908
+ <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>;
5909
+ /**
5910
+ * Conditionally executes a side effect based on the cause of a failed effect.
5911
+ *
5912
+ * @since 4.0.0
5913
+ * @category Sequencing
5914
+ */
5915
+ <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
5916
  };
5488
5917
  /**
5489
5918
  * Inspect severe errors or defects (non-recoverable failures) in an effect.
@@ -6337,11 +6766,11 @@ export declare const sandbox: <A, E, R>(self: Effect<A, E, R>) => Effect<A, Caus
6337
6766
  * @category Error Handling
6338
6767
  */
6339
6768
  export declare const ignore: <Arg extends Effect<any, any, any> | {
6340
- readonly log?: boolean | LogLevel | undefined;
6769
+ readonly log?: boolean | Severity | undefined;
6341
6770
  } | undefined = {
6342
- readonly log?: boolean | LogLevel | undefined;
6771
+ readonly log?: boolean | Severity | undefined;
6343
6772
  }>(effectOrOptions?: Arg, options?: {
6344
- readonly log?: boolean | LogLevel | undefined;
6773
+ readonly log?: boolean | Severity | undefined;
6345
6774
  } | 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
6775
  /**
6347
6776
  * Ignores the effect's failure cause, including defects and interruptions.
@@ -6362,11 +6791,11 @@ export declare const ignore: <Arg extends Effect<any, any, any> | {
6362
6791
  * @category Error Handling
6363
6792
  */
6364
6793
  export declare const ignoreCause: <Arg extends Effect<any, any, any> | {
6365
- readonly log?: boolean | LogLevel | undefined;
6794
+ readonly log?: boolean | Severity | undefined;
6366
6795
  } | undefined = {
6367
- readonly log?: boolean | LogLevel | undefined;
6796
+ readonly log?: boolean | Severity | undefined;
6368
6797
  }>(effectOrOptions?: Arg, options?: {
6369
- readonly log?: boolean | LogLevel | undefined;
6798
+ readonly log?: boolean | Severity | undefined;
6370
6799
  } | 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
6800
  /**
6372
6801
  * Apply an `ExecutionPlan` to an effect, retrying with step-provided resources
@@ -6472,6 +6901,22 @@ export declare const withExecutionPlan: {
6472
6901
  requirements: PlanR;
6473
6902
  }>): Effect<A, E | PlanE, Exclude<R, Provides> | PlanR>;
6474
6903
  };
6904
+ /**
6905
+ * Runs an effect and reports any errors to the configured `ErrorReporter`s.
6906
+ *
6907
+ * If the `defectsOnly` option is set to `true`, only defects (unrecoverable
6908
+ * errors) will be reported, while regular failures will be ignored.
6909
+ *
6910
+ * @since 4.0.0
6911
+ * @category Error Handling
6912
+ */
6913
+ export declare const withErrorReporting: <Arg extends Effect<any, any, any> | {
6914
+ readonly defectsOnly?: boolean | undefined;
6915
+ } | undefined = {
6916
+ readonly defectsOnly?: boolean | undefined;
6917
+ }>(effectOrOptions: Arg, options?: {
6918
+ readonly defectsOnly?: boolean | undefined;
6919
+ } | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Arg : <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
6475
6920
  /**
6476
6921
  * Replaces the original failure with a success value, ensuring the effect
6477
6922
  * cannot fail.
@@ -6692,7 +7137,7 @@ export declare const timeout: {
6692
7137
  * @since 2.0.0
6693
7138
  * @category Delays & Timeouts
6694
7139
  */
6695
- (duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | Cause.TimeoutError, R>;
7140
+ (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | Cause.TimeoutError, R>;
6696
7141
  /**
6697
7142
  * Adds a time limit to an effect, triggering a timeout if the effect exceeds
6698
7143
  * the duration.
@@ -6739,7 +7184,7 @@ export declare const timeout: {
6739
7184
  * @since 2.0.0
6740
7185
  * @category Delays & Timeouts
6741
7186
  */
6742
- <A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<A, E | Cause.TimeoutError, R>;
7187
+ <A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<A, E | Cause.TimeoutError, R>;
6743
7188
  };
6744
7189
  /**
6745
7190
  * Handles timeouts by returning an `Option` that represents either the result
@@ -6840,7 +7285,7 @@ export declare const timeoutOption: {
6840
7285
  * @since 3.1.0
6841
7286
  * @category Delays & Timeouts
6842
7287
  */
6843
- (duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, E, R>;
7288
+ (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, E, R>;
6844
7289
  /**
6845
7290
  * Handles timeouts by returning an `Option` that represents either the result
6846
7291
  * or a timeout.
@@ -6890,7 +7335,7 @@ export declare const timeoutOption: {
6890
7335
  * @since 3.1.0
6891
7336
  * @category Delays & Timeouts
6892
7337
  */
6893
- <A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<Option<A>, E, R>;
7338
+ <A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<Option<A>, E, R>;
6894
7339
  };
6895
7340
  /**
6896
7341
  * Applies a timeout to an effect, with a fallback effect executed if the timeout is reached.
@@ -6966,7 +7411,7 @@ export declare const timeoutOrElse: {
6966
7411
  * @category Delays & Timeouts
6967
7412
  */
6968
7413
  <A2, E2, R2>(options: {
6969
- readonly duration: Duration.DurationInput;
7414
+ readonly duration: Duration.Input;
6970
7415
  readonly onTimeout: LazyArg<Effect<A2, E2, R2>>;
6971
7416
  }): <A, E, R>(self: Effect<A, E, R>) => Effect<A | A2, E | E2, R | R2>;
6972
7417
  /**
@@ -7006,7 +7451,7 @@ export declare const timeoutOrElse: {
7006
7451
  * @category Delays & Timeouts
7007
7452
  */
7008
7453
  <A, E, R, A2, E2, R2>(self: Effect<A, E, R>, options: {
7009
- readonly duration: Duration.DurationInput;
7454
+ readonly duration: Duration.Input;
7010
7455
  readonly onTimeout: LazyArg<Effect<A2, E2, R2>>;
7011
7456
  }): Effect<A | A2, E | E2, R | R2>;
7012
7457
  };
@@ -7051,7 +7496,7 @@ export declare const delay: {
7051
7496
  * @since 2.0.0
7052
7497
  * @category Delays & Timeouts
7053
7498
  */
7054
- (duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
7499
+ (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
7055
7500
  /**
7056
7501
  * Returns an effect that is delayed from this effect by the specified
7057
7502
  * `Duration`.
@@ -7072,7 +7517,7 @@ export declare const delay: {
7072
7517
  * @since 2.0.0
7073
7518
  * @category Delays & Timeouts
7074
7519
  */
7075
- <A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<A, E, R>;
7520
+ <A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<A, E, R>;
7076
7521
  };
7077
7522
  /**
7078
7523
  * Returns an effect that suspends for the specified duration. This method is
@@ -7096,7 +7541,7 @@ export declare const delay: {
7096
7541
  * @since 2.0.0
7097
7542
  * @category Delays & Timeouts
7098
7543
  */
7099
- export declare const sleep: (duration: Duration.DurationInput) => Effect<void>;
7544
+ export declare const sleep: (duration: Duration.Input) => Effect<void>;
7100
7545
  /**
7101
7546
  * Measures the runtime of an effect and returns the duration with its result.
7102
7547
  *
@@ -7389,12 +7834,12 @@ export declare const raceFirst: {
7389
7834
  }): Effect<A | A2, E | E2, R | R2>;
7390
7835
  };
7391
7836
  /**
7392
- * Filters elements of an iterable using a predicate, refinement, effectful
7393
- * predicate, or `Filter.FilterEffect`.
7837
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7838
+ * predicate.
7394
7839
  *
7395
7840
  * @example
7396
7841
  * ```ts
7397
- * import { Effect, Filter, Result } from "effect"
7842
+ * import { Effect } from "effect"
7398
7843
  *
7399
7844
  * // Sync predicate
7400
7845
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7402,10 +7847,7 @@ export declare const raceFirst: {
7402
7847
  * // Effectful predicate
7403
7848
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7404
7849
  *
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
- * )
7850
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7409
7851
  * ```
7410
7852
  *
7411
7853
  * @since 2.0.0
@@ -7413,12 +7855,12 @@ export declare const raceFirst: {
7413
7855
  */
7414
7856
  export declare const filter: {
7415
7857
  /**
7416
- * Filters elements of an iterable using a predicate, refinement, effectful
7417
- * predicate, or `Filter.FilterEffect`.
7858
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7859
+ * predicate.
7418
7860
  *
7419
7861
  * @example
7420
7862
  * ```ts
7421
- * import { Effect, Filter, Result } from "effect"
7863
+ * import { Effect } from "effect"
7422
7864
  *
7423
7865
  * // Sync predicate
7424
7866
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7426,10 +7868,7 @@ export declare const filter: {
7426
7868
  * // Effectful predicate
7427
7869
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7428
7870
  *
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
- * )
7871
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7433
7872
  * ```
7434
7873
  *
7435
7874
  * @since 2.0.0
@@ -7437,12 +7876,12 @@ export declare const filter: {
7437
7876
  */
7438
7877
  <A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): (elements: Iterable<A>) => Effect<Array<B>>;
7439
7878
  /**
7440
- * Filters elements of an iterable using a predicate, refinement, effectful
7441
- * predicate, or `Filter.FilterEffect`.
7879
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7880
+ * predicate.
7442
7881
  *
7443
7882
  * @example
7444
7883
  * ```ts
7445
- * import { Effect, Filter, Result } from "effect"
7884
+ * import { Effect } from "effect"
7446
7885
  *
7447
7886
  * // Sync predicate
7448
7887
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7450,10 +7889,7 @@ export declare const filter: {
7450
7889
  * // Effectful predicate
7451
7890
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7452
7891
  *
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
- * )
7892
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7457
7893
  * ```
7458
7894
  *
7459
7895
  * @since 2.0.0
@@ -7461,12 +7897,12 @@ export declare const filter: {
7461
7897
  */
7462
7898
  <A>(predicate: Predicate.Predicate<NoInfer<A>>): (elements: Iterable<A>) => Effect<Array<A>>;
7463
7899
  /**
7464
- * Filters elements of an iterable using a predicate, refinement, effectful
7465
- * predicate, or `Filter.FilterEffect`.
7900
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7901
+ * predicate.
7466
7902
  *
7467
7903
  * @example
7468
7904
  * ```ts
7469
- * import { Effect, Filter, Result } from "effect"
7905
+ * import { Effect } from "effect"
7470
7906
  *
7471
7907
  * // Sync predicate
7472
7908
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7474,25 +7910,22 @@ export declare const filter: {
7474
7910
  * // Effectful predicate
7475
7911
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7476
7912
  *
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
- * )
7913
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7481
7914
  * ```
7482
7915
  *
7483
7916
  * @since 2.0.0
7484
7917
  * @category Filtering
7485
7918
  */
7486
- <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>, options?: {
7919
+ <A, E, R>(predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>, options?: {
7487
7920
  readonly concurrency?: Concurrency | undefined;
7488
- }): (elements: Iterable<A>) => Effect<Array<B>>;
7921
+ }): (iterable: Iterable<A>) => Effect<Array<A>, E, R>;
7489
7922
  /**
7490
- * Filters elements of an iterable using a predicate, refinement, effectful
7491
- * predicate, or `Filter.FilterEffect`.
7923
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7924
+ * predicate.
7492
7925
  *
7493
7926
  * @example
7494
7927
  * ```ts
7495
- * import { Effect, Filter, Result } from "effect"
7928
+ * import { Effect } from "effect"
7496
7929
  *
7497
7930
  * // Sync predicate
7498
7931
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7500,25 +7933,20 @@ export declare const filter: {
7500
7933
  * // Effectful predicate
7501
7934
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7502
7935
  *
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
- * )
7936
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7507
7937
  * ```
7508
7938
  *
7509
7939
  * @since 2.0.0
7510
7940
  * @category Filtering
7511
7941
  */
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>;
7942
+ <A, B extends A>(elements: Iterable<A>, refinement: Predicate.Refinement<A, B>): Effect<Array<B>>;
7515
7943
  /**
7516
- * Filters elements of an iterable using a predicate, refinement, effectful
7517
- * predicate, or `Filter.FilterEffect`.
7944
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7945
+ * predicate.
7518
7946
  *
7519
7947
  * @example
7520
7948
  * ```ts
7521
- * import { Effect, Filter, Result } from "effect"
7949
+ * import { Effect } from "effect"
7522
7950
  *
7523
7951
  * // Sync predicate
7524
7952
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7526,25 +7954,20 @@ export declare const filter: {
7526
7954
  * // Effectful predicate
7527
7955
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7528
7956
  *
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
- * )
7957
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7533
7958
  * ```
7534
7959
  *
7535
7960
  * @since 2.0.0
7536
7961
  * @category Filtering
7537
7962
  */
7538
- <A, E, R>(predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>, options?: {
7539
- readonly concurrency?: Concurrency | undefined;
7540
- }): (iterable: Iterable<A>) => Effect<Array<A>, E, R>;
7963
+ <A>(elements: Iterable<A>, predicate: Predicate.Predicate<A>): Effect<Array<A>>;
7541
7964
  /**
7542
- * Filters elements of an iterable using a predicate, refinement, effectful
7543
- * predicate, or `Filter.FilterEffect`.
7965
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7966
+ * predicate.
7544
7967
  *
7545
7968
  * @example
7546
7969
  * ```ts
7547
- * import { Effect, Filter, Result } from "effect"
7970
+ * import { Effect } from "effect"
7548
7971
  *
7549
7972
  * // Sync predicate
7550
7973
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7552,116 +7975,63 @@ export declare const filter: {
7552
7975
  * // Effectful predicate
7553
7976
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7554
7977
  *
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
- * )
7978
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7559
7979
  * ```
7560
7980
  *
7561
7981
  * @since 2.0.0
7562
7982
  * @category Filtering
7563
7983
  */
7564
- <A, B extends A>(elements: Iterable<A>, refinement: Predicate.Refinement<A, B>): Effect<Array<B>>;
7984
+ <A, E, R>(iterable: Iterable<A>, predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>, options?: {
7985
+ readonly concurrency?: Concurrency | undefined;
7986
+ }): Effect<Array<A>, E, R>;
7987
+ };
7988
+ /**
7989
+ * Filters and maps elements of an iterable with a `Filter`.
7990
+ *
7991
+ * @since 4.0.0
7992
+ * @category Filtering
7993
+ */
7994
+ export declare const filterMap: {
7565
7995
  /**
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))
7996
+ * Filters and maps elements of an iterable with a `Filter`.
7578
7997
  *
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
7998
+ * @since 4.0.0
7586
7999
  * @category Filtering
7587
8000
  */
7588
- <A>(elements: Iterable<A>, predicate: Predicate.Predicate<A>): Effect<Array<A>>;
8001
+ <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): (elements: Iterable<A>) => Effect<Array<B>>;
7589
8002
  /**
7590
- * Filters elements of an iterable using a predicate, refinement, effectful
7591
- * predicate, or `Filter.FilterEffect`.
7592
- *
7593
- * @example
7594
- * ```ts
7595
- * import { Effect, Filter, Result } from "effect"
8003
+ * Filters and maps elements of an iterable with a `Filter`.
7596
8004
  *
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
8005
+ * @since 4.0.0
7610
8006
  * @category Filtering
7611
8007
  */
7612
8008
  <A, B, X>(elements: Iterable<A>, filter: Filter.Filter<NoInfer<A>, B, X>): Effect<Array<B>>;
8009
+ };
8010
+ /**
8011
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
8012
+ *
8013
+ * @since 4.0.0
8014
+ * @category Filtering
8015
+ */
8016
+ export declare const filterMapEffect: {
7613
8017
  /**
7614
- * Filters elements of an iterable using a predicate, refinement, effectful
7615
- * predicate, or `Filter.FilterEffect`.
8018
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
7616
8019
  *
7617
- * @example
7618
- * ```ts
7619
- * import { Effect, Filter, Result } from "effect"
7620
- *
7621
- * // Sync predicate
7622
- * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
7623
- *
7624
- * // Effectful predicate
7625
- * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7626
- *
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
- * )
7631
- * ```
7632
- *
7633
- * @since 2.0.0
8020
+ * @since 4.0.0
7634
8021
  * @category Filtering
7635
8022
  */
7636
- <A, B, X, E, R>(elements: Iterable<A>, filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
8023
+ <A, B, X, E, R>(filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
7637
8024
  readonly concurrency?: Concurrency | undefined;
7638
- }): Effect<Array<B>, E, R>;
8025
+ }): (elements: Iterable<A>) => Effect<Array<B>, E, R>;
7639
8026
  /**
7640
- * Filters elements of an iterable using a predicate, refinement, effectful
7641
- * predicate, or `Filter.FilterEffect`.
7642
- *
7643
- * @example
7644
- * ```ts
7645
- * import { Effect, Filter, Result } from "effect"
8027
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
7646
8028
  *
7647
- * // Sync predicate
7648
- * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
7649
- *
7650
- * // Effectful predicate
7651
- * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7652
- *
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
- * )
7657
- * ```
7658
- *
7659
- * @since 2.0.0
8029
+ * @since 4.0.0
7660
8030
  * @category Filtering
7661
8031
  */
7662
- <A, E, R>(iterable: Iterable<A>, predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>, options?: {
8032
+ <A, B, X, E, R>(elements: Iterable<A>, filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
7663
8033
  readonly concurrency?: Concurrency | undefined;
7664
- }): Effect<Array<A>, E, R>;
8034
+ }): Effect<Array<B>, E, R>;
7665
8035
  };
7666
8036
  /**
7667
8037
  * Filters an effect, providing an alternative effect if the predicate fails.
@@ -7755,7 +8125,7 @@ export declare const filterOrElse: {
7755
8125
  * @since 2.0.0
7756
8126
  * @category Filtering
7757
8127
  */
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>;
8128
+ <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
8129
  /**
7760
8130
  * Filters an effect, providing an alternative effect if the predicate fails.
7761
8131
  *
@@ -7817,7 +8187,29 @@ export declare const filterOrElse: {
7817
8187
  * @since 2.0.0
7818
8188
  * @category Filtering
7819
8189
  */
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>;
8190
+ <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>;
8191
+ };
8192
+ /**
8193
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
8194
+ *
8195
+ * @since 4.0.0
8196
+ * @category Filtering
8197
+ */
8198
+ export declare const filterMapOrElse: {
8199
+ /**
8200
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
8201
+ *
8202
+ * @since 4.0.0
8203
+ * @category Filtering
8204
+ */
8205
+ <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>;
8206
+ /**
8207
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
8208
+ *
8209
+ * @since 4.0.0
8210
+ * @category Filtering
8211
+ */
8212
+ <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
8213
  };
7822
8214
  /**
7823
8215
  * Filters an effect, failing with a custom error if the predicate fails.
@@ -7938,7 +8330,7 @@ export declare const filterOrFail: {
7938
8330
  * @since 2.0.0
7939
8331
  * @category Filtering
7940
8332
  */
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>;
8333
+ <A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
7942
8334
  /**
7943
8335
  * Filters an effect, failing with a custom error if the predicate fails.
7944
8336
  *
@@ -7968,7 +8360,7 @@ export declare const filterOrFail: {
7968
8360
  * @since 2.0.0
7969
8361
  * @category Filtering
7970
8362
  */
7971
- <A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
8363
+ <A>(predicate: Predicate.Predicate<NoInfer<A>>): <E, R>(self: Effect<A, E, R>) => Effect<A, Cause.NoSuchElementError | E, R>;
7972
8364
  /**
7973
8365
  * Filters an effect, failing with a custom error if the predicate fails.
7974
8366
  *
@@ -7998,7 +8390,7 @@ export declare const filterOrFail: {
7998
8390
  * @since 2.0.0
7999
8391
  * @category Filtering
8000
8392
  */
8001
- <A>(predicate: Predicate.Predicate<NoInfer<A>>): <E, R>(self: Effect<A, E, R>) => Effect<A, Cause.NoSuchElementError | E, R>;
8393
+ <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
8394
  /**
8003
8395
  * Filters an effect, failing with a custom error if the predicate fails.
8004
8396
  *
@@ -8028,7 +8420,7 @@ export declare const filterOrFail: {
8028
8420
  * @since 2.0.0
8029
8421
  * @category Filtering
8030
8422
  */
8031
- <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
8423
+ <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
8424
  /**
8033
8425
  * Filters an effect, failing with a custom error if the predicate fails.
8034
8426
  *
@@ -8058,7 +8450,7 @@ export declare const filterOrFail: {
8058
8450
  * @since 2.0.0
8059
8451
  * @category Filtering
8060
8452
  */
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>;
8453
+ <A, E, R, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>): Effect<B, E | Cause.NoSuchElementError, R>;
8062
8454
  /**
8063
8455
  * Filters an effect, failing with a custom error if the predicate fails.
8064
8456
  *
@@ -8088,127 +8480,43 @@ export declare const filterOrFail: {
8088
8480
  * @since 2.0.0
8089
8481
  * @category Filtering
8090
8482
  */
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>;
8483
+ <A, E, R>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>): Effect<A, E | Cause.NoSuchElementError, R>;
8484
+ };
8485
+ /**
8486
+ * Filters an effect with a `Filter`, failing when the filter fails.
8487
+ *
8488
+ * @since 4.0.0
8489
+ * @category Filtering
8490
+ */
8491
+ export declare const filterMapOrFail: {
8092
8492
  /**
8093
- * Filters an effect, failing with a custom error if the predicate fails.
8094
- *
8095
- * **Details**
8493
+ * Filters an effect with a `Filter`, failing when the filter fails.
8096
8494
  *
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
- * )
8114
- *
8115
- * // Result: Effect.fail("Expected even number, got 5")
8116
- * ```
8117
- *
8118
- * @since 2.0.0
8495
+ * @since 4.0.0
8119
8496
  * @category Filtering
8120
8497
  */
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>;
8498
+ <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
8499
  /**
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
- * )
8144
- *
8145
- * // Result: Effect.fail("Expected even number, got 5")
8146
- * ```
8500
+ * Filters an effect with a `Filter`, failing when the filter fails.
8147
8501
  *
8148
- * @since 2.0.0
8502
+ * @since 4.0.0
8149
8503
  * @category Filtering
8150
8504
  */
8151
- <A, E, R, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>): Effect<B, E | Cause.NoSuchElementError, R>;
8505
+ <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
8152
8506
  /**
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"
8507
+ * Filters an effect with a `Filter`, failing when the filter fails.
8164
8508
  *
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
- * )
8174
- *
8175
- * // Result: Effect.fail("Expected even number, got 5")
8176
- * ```
8177
- *
8178
- * @since 2.0.0
8509
+ * @since 4.0.0
8179
8510
  * @category Filtering
8180
8511
  */
8181
- <A, E, R>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>): Effect<A, E | Cause.NoSuchElementError, R>;
8512
+ <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
8513
  /**
8183
- * Filters an effect, failing with a custom error if the predicate fails.
8514
+ * Filters an effect with a `Filter`, failing when the filter fails.
8184
8515
  *
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
- * )
8204
- *
8205
- * // Result: Effect.fail("Expected even number, got 5")
8206
- * ```
8207
- *
8208
- * @since 2.0.0
8516
+ * @since 4.0.0
8209
8517
  * @category Filtering
8210
8518
  */
8211
- <A, E, R, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>): Effect<B, E | Cause.NoSuchElementError, R>;
8519
+ <A, E, R, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>): Effect<B, Cause.NoSuchElementError | E, R>;
8212
8520
  };
8213
8521
  /**
8214
8522
  * Conditionally executes an effect based on a boolean condition.
@@ -9733,7 +10041,7 @@ export declare const provideServices: {
9733
10041
  * @since 4.0.0
9734
10042
  * @category ServiceMap
9735
10043
  */
9736
- export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effect<S, never, I>;
10044
+ export declare const service: <I, S>(service: ServiceMap.Key<I, S>) => Effect<S, never, I>;
9737
10045
  /**
9738
10046
  * Optionally accesses a service from the environment.
9739
10047
  *
@@ -9768,7 +10076,7 @@ export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effec
9768
10076
  * @since 2.0.0
9769
10077
  * @category ServiceMap
9770
10078
  */
9771
- export declare const serviceOption: <I, S>(key: ServiceMap.Service<I, S>) => Effect<Option<S>>;
10079
+ export declare const serviceOption: <I, S>(key: ServiceMap.Key<I, S>) => Effect<Option<S>>;
9772
10080
  /**
9773
10081
  * Provides part of the required context while leaving the rest unchanged.
9774
10082
  *
@@ -9950,7 +10258,7 @@ export declare const updateService: {
9950
10258
  * @since 2.0.0
9951
10259
  * @category ServiceMap
9952
10260
  */
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>;
10261
+ <I, A>(service: ServiceMap.Key<I, A>, f: (value: A) => A): <XA, E, R>(self: Effect<XA, E, R>) => Effect<XA, E, R | I>;
9954
10262
  /**
9955
10263
  * Updates the service with the required service entry.
9956
10264
  *
@@ -9979,7 +10287,7 @@ export declare const updateService: {
9979
10287
  * @since 2.0.0
9980
10288
  * @category ServiceMap
9981
10289
  */
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>;
10290
+ <XA, E, R, I, A>(self: Effect<XA, E, R>, service: ServiceMap.Key<I, A>, f: (value: A) => A): Effect<XA, E, R | I>;
9983
10291
  };
9984
10292
  /**
9985
10293
  * The `provideService` function is used to provide an actual
@@ -10072,7 +10380,7 @@ export declare const provideService: {
10072
10380
  * @since 2.0.0
10073
10381
  * @category ServiceMap
10074
10382
  */
10075
- <I, S>(service: ServiceMap.Service<I, S>): {
10383
+ <I, S>(service: ServiceMap.Key<I, S>): {
10076
10384
  /**
10077
10385
  * The `provideService` function is used to provide an actual
10078
10386
  * implementation for a service in the context of an effect.
@@ -10211,7 +10519,7 @@ export declare const provideService: {
10211
10519
  * @since 2.0.0
10212
10520
  * @category ServiceMap
10213
10521
  */
10214
- <I, S>(service: ServiceMap.Service<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
10522
+ <I, S>(service: ServiceMap.Key<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
10215
10523
  /**
10216
10524
  * The `provideService` function is used to provide an actual
10217
10525
  * implementation for a service in the context of an effect.
@@ -10257,7 +10565,7 @@ export declare const provideService: {
10257
10565
  * @since 2.0.0
10258
10566
  * @category ServiceMap
10259
10567
  */
10260
- <A, E, R, I, S>(self: Effect<A, E, R>, service: ServiceMap.Service<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>;
10568
+ <A, E, R, I, S>(self: Effect<A, E, R>, service: ServiceMap.Key<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>;
10261
10569
  };
10262
10570
  /**
10263
10571
  * Provides the effect with the single service it requires. If the effect
@@ -10364,7 +10672,7 @@ export declare const provideServiceEffect: {
10364
10672
  * @since 2.0.0
10365
10673
  * @category ServiceMap
10366
10674
  */
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>;
10675
+ <I, S, E2, R2>(service: ServiceMap.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
10676
  /**
10369
10677
  * Provides the effect with the single service it requires. If the effect
10370
10678
  * requires more than one service use `provide` instead.
@@ -10417,7 +10725,7 @@ export declare const provideServiceEffect: {
10417
10725
  * @since 2.0.0
10418
10726
  * @category ServiceMap
10419
10727
  */
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>;
10728
+ <A, E, R, I, S, E2, R2>(self: Effect<A, E, R>, service: ServiceMap.Key<I, S>, acquire: Effect<S, E2, R2>): Effect<A, E | E2, Exclude<R, I> | R2>;
10421
10729
  };
10422
10730
  /**
10423
10731
  * Sets the concurrency level for parallel operations within an effect.
@@ -10986,7 +11294,7 @@ export declare const onError: {
10986
11294
  };
10987
11295
  /**
10988
11296
  * Runs the finalizer only when this effect fails and the `Cause` matches the
10989
- * filter, passing the filtered failure and the original cause.
11297
+ * provided predicate.
10990
11298
  *
10991
11299
  * @example
10992
11300
  * ```ts
@@ -11010,7 +11318,7 @@ export declare const onError: {
11010
11318
  export declare const onErrorIf: {
11011
11319
  /**
11012
11320
  * Runs the finalizer only when this effect fails and the `Cause` matches the
11013
- * filter, passing the filtered failure and the original cause.
11321
+ * provided predicate.
11014
11322
  *
11015
11323
  * @example
11016
11324
  * ```ts
@@ -11031,10 +11339,10 @@ export declare const onErrorIf: {
11031
11339
  * @since 4.0.0
11032
11340
  * @category Resource Management & Finalization
11033
11341
  */
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>;
11342
+ <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
11343
  /**
11036
11344
  * Runs the finalizer only when this effect fails and the `Cause` matches the
11037
- * filter, passing the filtered failure and the original cause.
11345
+ * provided predicate.
11038
11346
  *
11039
11347
  * @example
11040
11348
  * ```ts
@@ -11055,7 +11363,29 @@ export declare const onErrorIf: {
11055
11363
  * @since 4.0.0
11056
11364
  * @category Resource Management & Finalization
11057
11365
  */
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>;
11366
+ <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>;
11367
+ };
11368
+ /**
11369
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
11370
+ *
11371
+ * @since 4.0.0
11372
+ * @category Resource Management & Finalization
11373
+ */
11374
+ export declare const onErrorFilter: {
11375
+ /**
11376
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
11377
+ *
11378
+ * @since 4.0.0
11379
+ * @category Resource Management & Finalization
11380
+ */
11381
+ <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>;
11382
+ /**
11383
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
11384
+ *
11385
+ * @since 4.0.0
11386
+ * @category Resource Management & Finalization
11387
+ */
11388
+ <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
11389
  };
11060
11390
  /**
11061
11391
  * The low level primitive that powers `onExit`.
@@ -11149,20 +11479,20 @@ export declare const onExit: {
11149
11479
  <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
11480
  };
11151
11481
  /**
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`.
11482
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
11483
+ * predicate.
11155
11484
  *
11156
11485
  * @example
11157
11486
  * ```ts
11158
- * import { Console, Effect, Exit, Filter } from "effect"
11159
- *
11160
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
11487
+ * import { Console, Effect, Exit } from "effect"
11161
11488
  *
11162
11489
  * const program = Effect.onExitIf(
11163
11490
  * Effect.succeed(42),
11164
- * exitFilter,
11165
- * (success) => Console.log(`Succeeded with: ${success.value}`)
11491
+ * Exit.isSuccess,
11492
+ * (exit) =>
11493
+ * Exit.isSuccess(exit)
11494
+ * ? Console.log(`Succeeded with: ${exit.value}`)
11495
+ * : Effect.void
11166
11496
  * )
11167
11497
  * ```
11168
11498
  *
@@ -11171,49 +11501,71 @@ export declare const onExit: {
11171
11501
  */
11172
11502
  export declare const onExitIf: {
11173
11503
  /**
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`.
11504
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
11505
+ * predicate.
11177
11506
  *
11178
11507
  * @example
11179
11508
  * ```ts
11180
- * import { Console, Effect, Exit, Filter } from "effect"
11181
- *
11182
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
11509
+ * import { Console, Effect, Exit } from "effect"
11183
11510
  *
11184
11511
  * const program = Effect.onExitIf(
11185
11512
  * Effect.succeed(42),
11186
- * exitFilter,
11187
- * (success) => Console.log(`Succeeded with: ${success.value}`)
11513
+ * Exit.isSuccess,
11514
+ * (exit) =>
11515
+ * Exit.isSuccess(exit)
11516
+ * ? Console.log(`Succeeded with: ${exit.value}`)
11517
+ * : Effect.void
11188
11518
  * )
11189
11519
  * ```
11190
11520
  *
11191
11521
  * @since 4.0.0
11192
11522
  * @category Resource Management & Finalization
11193
11523
  */
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>;
11524
+ <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
11525
  /**
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`.
11526
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
11527
+ * predicate.
11199
11528
  *
11200
11529
  * @example
11201
11530
  * ```ts
11202
- * import { Console, Effect, Exit, Filter } from "effect"
11203
- *
11204
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
11531
+ * import { Console, Effect, Exit } from "effect"
11205
11532
  *
11206
11533
  * const program = Effect.onExitIf(
11207
11534
  * Effect.succeed(42),
11208
- * exitFilter,
11209
- * (success) => Console.log(`Succeeded with: ${success.value}`)
11535
+ * Exit.isSuccess,
11536
+ * (exit) =>
11537
+ * Exit.isSuccess(exit)
11538
+ * ? Console.log(`Succeeded with: ${exit.value}`)
11539
+ * : Effect.void
11210
11540
  * )
11211
11541
  * ```
11212
11542
  *
11213
11543
  * @since 4.0.0
11214
11544
  * @category Resource Management & Finalization
11215
11545
  */
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>;
11546
+ <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>;
11547
+ };
11548
+ /**
11549
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
11550
+ *
11551
+ * @since 4.0.0
11552
+ * @category Resource Management & Finalization
11553
+ */
11554
+ export declare const onExitFilter: {
11555
+ /**
11556
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
11557
+ *
11558
+ * @since 4.0.0
11559
+ * @category Resource Management & Finalization
11560
+ */
11561
+ <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>;
11562
+ /**
11563
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
11564
+ *
11565
+ * @since 4.0.0
11566
+ * @category Resource Management & Finalization
11567
+ */
11568
+ <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
11569
  };
11218
11570
  /**
11219
11571
  * Returns an effect that lazily computes a result and caches it for subsequent
@@ -11412,7 +11764,7 @@ export declare const cachedWithTTL: {
11412
11764
  * @since 2.0.0
11413
11765
  * @category Caching
11414
11766
  */
11415
- (timeToLive: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<A, E, R>>;
11767
+ (timeToLive: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<A, E, R>>;
11416
11768
  /**
11417
11769
  * Returns an effect that caches its result for a specified `Duration`,
11418
11770
  * known as "timeToLive" (TTL).
@@ -11479,7 +11831,7 @@ export declare const cachedWithTTL: {
11479
11831
  * @since 2.0.0
11480
11832
  * @category Caching
11481
11833
  */
11482
- <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.DurationInput): Effect<Effect<A, E, R>>;
11834
+ <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.Input): Effect<Effect<A, E, R>>;
11483
11835
  };
11484
11836
  /**
11485
11837
  * Caches an effect's result for a specified duration and allows manual
@@ -11620,7 +11972,7 @@ export declare const cachedInvalidateWithTTL: {
11620
11972
  * @since 2.0.0
11621
11973
  * @category Caching
11622
11974
  */
11623
- (timeToLive: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<[Effect<A, E, R>, Effect<void>]>;
11975
+ (timeToLive: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<[Effect<A, E, R>, Effect<void>]>;
11624
11976
  /**
11625
11977
  * Caches an effect's result for a specified duration and allows manual
11626
11978
  * invalidation before expiration.
@@ -11690,7 +12042,7 @@ export declare const cachedInvalidateWithTTL: {
11690
12042
  * @since 2.0.0
11691
12043
  * @category Caching
11692
12044
  */
11693
- <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.DurationInput): Effect<[Effect<A, E, R>, Effect<void>]>;
12045
+ <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.Input): Effect<[Effect<A, E, R>, Effect<void>]>;
11694
12046
  };
11695
12047
  /**
11696
12048
  * Returns an effect that is immediately interrupted.
@@ -11890,232 +12242,6 @@ export declare const uninterruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(ef
11890
12242
  * @category Interruption
11891
12243
  */
11892
12244
  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
12245
  /**
12120
12246
  * @since 2.0.0
12121
12247
  * @category Repetition / Recursion
@@ -15772,7 +15898,7 @@ export declare const clockWith: <A, E, R>(f: (clock: Clock) => Effect<A, E, R>)
15772
15898
  * @since 2.0.0
15773
15899
  * @category Logging
15774
15900
  */
15775
- export declare const logWithLevel: (level?: LogLevel) => (...message: ReadonlyArray<any>) => Effect<void>;
15901
+ export declare const logWithLevel: (level?: Severity) => (...message: ReadonlyArray<any>) => Effect<void>;
15776
15902
  /**
15777
15903
  * Logs one or more messages using the default log level.
15778
15904
  *
@@ -16039,6 +16165,85 @@ export declare const annotateLogs: {
16039
16165
  <A, E, R>(effect: Effect<A, E, R>, key: string, value: unknown): Effect<A, E, R>;
16040
16166
  <A, E, R>(effect: Effect<A, E, R>, values: Record<string, unknown>): Effect<A, E, R>;
16041
16167
  };
16168
+ /**
16169
+ * Adds log annotations to the current scope.
16170
+ *
16171
+ * This differs from `annotateLogs`, which only annotates a specific effect.
16172
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
16173
+ * restores the previous annotations when the scope closes.
16174
+ *
16175
+ * @example
16176
+ * ```ts
16177
+ * import { Effect } from "effect"
16178
+ *
16179
+ * const program = Effect.scoped(
16180
+ * Effect.gen(function*() {
16181
+ * yield* Effect.log("before")
16182
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
16183
+ * yield* Effect.log("inside scope")
16184
+ * })
16185
+ * )
16186
+ *
16187
+ * Effect.runPromise(program)
16188
+ * ```
16189
+ *
16190
+ * @since 4.0.0
16191
+ * @category Logging
16192
+ */
16193
+ export declare const annotateLogsScoped: {
16194
+ /**
16195
+ * Adds log annotations to the current scope.
16196
+ *
16197
+ * This differs from `annotateLogs`, which only annotates a specific effect.
16198
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
16199
+ * restores the previous annotations when the scope closes.
16200
+ *
16201
+ * @example
16202
+ * ```ts
16203
+ * import { Effect } from "effect"
16204
+ *
16205
+ * const program = Effect.scoped(
16206
+ * Effect.gen(function*() {
16207
+ * yield* Effect.log("before")
16208
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
16209
+ * yield* Effect.log("inside scope")
16210
+ * })
16211
+ * )
16212
+ *
16213
+ * Effect.runPromise(program)
16214
+ * ```
16215
+ *
16216
+ * @since 4.0.0
16217
+ * @category Logging
16218
+ */
16219
+ (key: string, value: unknown): Effect<void, never, Scope>;
16220
+ /**
16221
+ * Adds log annotations to the current scope.
16222
+ *
16223
+ * This differs from `annotateLogs`, which only annotates a specific effect.
16224
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
16225
+ * restores the previous annotations when the scope closes.
16226
+ *
16227
+ * @example
16228
+ * ```ts
16229
+ * import { Effect } from "effect"
16230
+ *
16231
+ * const program = Effect.scoped(
16232
+ * Effect.gen(function*() {
16233
+ * yield* Effect.log("before")
16234
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
16235
+ * yield* Effect.log("inside scope")
16236
+ * })
16237
+ * )
16238
+ *
16239
+ * Effect.runPromise(program)
16240
+ * ```
16241
+ *
16242
+ * @since 4.0.0
16243
+ * @category Logging
16244
+ */
16245
+ (values: Record<string, unknown>): Effect<void, never, Scope>;
16246
+ };
16042
16247
  /**
16043
16248
  * Adds a span to each log line in this effect.
16044
16249
  *
@@ -17281,118 +17486,63 @@ declare const Transaction_base: ServiceMap.ServiceClass<Transaction, "effect/Eff
17281
17486
  export declare class Transaction extends Transaction_base {
17282
17487
  }
17283
17488
  /**
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.
17286
- *
17287
- * In Effect transactions are optimistic with retry, that means transactions are retried when:
17288
- *
17289
- * - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
17290
- * accessed transactional values changes.
17489
+ * Accesses the current transaction state within an active transaction.
17291
17490
  *
17292
- * - any of the accessed transactional values change during the execution of the transaction
17293
- * due to a different transaction committing before the current.
17294
- *
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.
17491
+ * This function requires `Transaction` in the context and does NOT create or strip
17492
+ * transaction boundaries. Use it to interact with the transaction journal (e.g. in
17493
+ * `TxRef` internals). To define a transaction boundary, use {@link transaction}.
17297
17494
  *
17298
17495
  * @example
17299
17496
  * ```ts
17300
17497
  * import { Effect, TxRef } from "effect"
17301
17498
  *
17302
17499
  * const program = Effect.gen(function*() {
17303
- * const ref1 = yield* TxRef.make(0)
17304
- * const ref2 = yield* TxRef.make(0)
17305
- *
17306
- * // All operations within atomic block succeed or fail together
17307
- * yield* Effect.atomic(Effect.gen(function*() {
17308
- * yield* TxRef.set(ref1, 10)
17309
- * yield* TxRef.set(ref2, 20)
17310
- * const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
17311
- * console.log(`Transaction sum: ${sum}`)
17312
- * }))
17313
- *
17314
- * console.log(`Final ref1: ${yield* TxRef.get(ref1)}`) // 10
17315
- * console.log(`Final ref2: ${yield* TxRef.get(ref2)}`) // 20
17316
- * })
17317
- * ```
17318
- *
17319
- * @since 4.0.0
17320
- * @category Transactions
17321
- */
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}`)
17500
+ * const ref = yield* Effect.transaction(TxRef.make(0))
17337
17501
  *
17502
+ * yield* Effect.transaction(Effect.gen(function*() {
17338
17503
  * yield* TxRef.set(ref, 42)
17339
17504
  * return yield* TxRef.get(ref)
17340
- * })
17341
- * )
17342
- *
17343
- * Effect.runPromise(program).then(console.log) // 42
17505
+ * }))
17506
+ * })
17344
17507
  * ```
17345
17508
  *
17346
17509
  * @since 4.0.0
17347
17510
  * @category Transactions
17348
17511
  */
17349
- export declare const atomicWith: <A, E, R>(f: (state: Transaction["Service"]) => Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
17512
+ export declare const withTxState: <A, E, R>(f: (state: Transaction["Service"]) => Effect<A, E, R>) => Effect<A, E, R | Transaction>;
17350
17513
  /**
17351
- * Creates an isolated transaction that never composes with parent transactions.
17514
+ * Defines a transaction boundary. Transactions are "all or nothing" with respect to changes
17515
+ * made to transactional values (i.e. TxRef) that occur within the transaction body.
17352
17516
  *
17353
- * **Details**
17517
+ * In Effect transactions are optimistic with retry, that means transactions are retried when:
17354
17518
  *
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.
17519
+ * - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
17520
+ * accessed transactional values changes.
17358
17521
  *
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
17522
+ * - any of the accessed transactional values change during the execution of the transaction
17523
+ * due to a different transaction committing before the current.
17364
17524
  *
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
17525
+ * Each call to `transaction` always creates a new isolated transaction boundary with its own
17526
+ * journal and retry logic.
17369
17527
  *
17370
17528
  * @example
17371
17529
  * ```ts
17372
17530
  * import { Effect, TxRef } from "effect"
17373
17531
  *
17374
17532
  * 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
- * }))
17533
+ * const ref1 = yield* Effect.transaction(TxRef.make(0))
17534
+ * const ref2 = yield* Effect.transaction(TxRef.make(0))
17387
17535
  *
17388
- * // Isolated transaction - ref2 will be in its own transaction
17536
+ * // All operations within transaction block succeed or fail together
17389
17537
  * yield* Effect.transaction(Effect.gen(function*() {
17390
- * yield* TxRef.set(ref2, 200)
17538
+ * yield* TxRef.set(ref1, 10)
17539
+ * yield* TxRef.set(ref2, 20)
17540
+ * const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
17541
+ * console.log(`Transaction sum: ${sum}`)
17391
17542
  * }))
17392
17543
  *
17393
- * const val1 = yield* TxRef.get(ref1) // 20
17394
- * const val2 = yield* TxRef.get(ref2) // 200
17395
- * return { ref1: val1, ref2: val2 }
17544
+ * console.log(`Final ref1: ${yield* Effect.transaction(TxRef.get(ref1))}`) // 10
17545
+ * console.log(`Final ref2: ${yield* Effect.transaction(TxRef.get(ref2))}`) // 20
17396
17546
  * })
17397
17547
  * ```
17398
17548
  *
@@ -17401,34 +17551,21 @@ export declare const atomicWith: <A, E, R>(f: (state: Transaction["Service"]) =>
17401
17551
  */
17402
17552
  export declare const transaction: <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
17403
17553
  /**
17404
- * Executes a function within an isolated transaction context, providing access to the transaction state.
17554
+ * Like {@link transaction} but provides access to the transaction state.
17405
17555
  *
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.
17556
+ * Always creates a new isolated transaction boundary with its own journal and retry logic.
17408
17557
  *
17409
17558
  * @example
17410
17559
  * ```ts
17411
17560
  * import { Effect, TxRef } from "effect"
17412
17561
  *
17413
- * const program = Effect.transactionWith((txState) =>
17562
+ * const program = Effect.transactionWith((_txState) =>
17414
17563
  * Effect.gen(function*() {
17415
17564
  * 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
17565
  * yield* TxRef.set(ref, 42)
17421
17566
  * return yield* TxRef.get(ref)
17422
17567
  * })
17423
17568
  * )
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
17569
  * ```
17433
17570
  *
17434
17571
  * @since 4.0.0
@@ -17450,16 +17587,16 @@ export declare const transactionWith: <A, E, R>(f: (state: Transaction["Service"
17450
17587
  *
17451
17588
  * const program = Effect.gen(function*() {
17452
17589
  * // create a transactional reference
17453
- * const ref = yield* TxRef.make(0)
17590
+ * const ref = yield* Effect.transaction(TxRef.make(0))
17454
17591
  *
17455
17592
  * // forks a fiber that increases the value of `ref` every 100 millis
17456
17593
  * yield* Effect.forkChild(Effect.forever(
17457
17594
  * // update to transactional value
17458
- * TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis"))
17595
+ * Effect.transaction(TxRef.update(ref, (n) => n + 1)).pipe(Effect.delay("100 millis"))
17459
17596
  * ))
17460
17597
  *
17461
17598
  * // the following will retry 10 times until the `ref` value is 10
17462
- * yield* Effect.atomic(Effect.gen(function*() {
17599
+ * yield* Effect.transaction(Effect.gen(function*() {
17463
17600
  * const value = yield* TxRef.get(ref)
17464
17601
  * if (value < 10) {
17465
17602
  * yield* Effect.log(`retry due to value: ${value}`)