effect 4.0.0-beta.2 → 4.0.0-beta.20

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 (876) 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 +733 -687
  42. package/dist/Effect.d.ts.map +1 -1
  43. package/dist/Effect.js +233 -250
  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 +91 -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 +3 -2
  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 +123 -76
  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 +225 -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 +33 -6
  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/HttpServerRespondable.d.ts +2 -2
  470. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  471. package/dist/unstable/http/HttpServerRespondable.js +5 -5
  472. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  473. package/dist/unstable/http/HttpServerResponse.d.ts +2 -1
  474. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  475. package/dist/unstable/http/HttpServerResponse.js +3 -1
  476. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  477. package/dist/unstable/http/Multipart.d.ts +3 -3
  478. package/dist/unstable/http/UrlParams.d.ts +14 -6
  479. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  480. package/dist/unstable/http/UrlParams.js +1 -1
  481. package/dist/unstable/http/UrlParams.js.map +1 -1
  482. package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
  483. package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
  484. package/dist/unstable/http/internal/preResponseHandler.js +10 -0
  485. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
  486. package/dist/unstable/httpapi/HttpApi.d.ts +3 -3
  487. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  488. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  489. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +11 -5
  490. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  491. package/dist/unstable/httpapi/HttpApiBuilder.js +23 -12
  492. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  493. package/dist/unstable/httpapi/HttpApiClient.d.ts +7 -2
  494. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  495. package/dist/unstable/httpapi/HttpApiClient.js +3 -3
  496. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  497. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +31 -44
  498. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  499. package/dist/unstable/httpapi/HttpApiEndpoint.js +15 -24
  500. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  501. package/dist/unstable/httpapi/HttpApiError.d.ts +11 -0
  502. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  503. package/dist/unstable/httpapi/HttpApiError.js +29 -9
  504. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  505. package/dist/unstable/httpapi/HttpApiGroup.d.ts +3 -3
  506. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  507. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  508. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +4 -4
  509. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  510. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  511. package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
  512. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  513. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  514. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +2 -2
  515. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  516. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  517. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  518. package/dist/unstable/httpapi/OpenApi.js +32 -21
  519. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  520. package/dist/unstable/observability/Otlp.d.ts +12 -12
  521. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  522. package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
  523. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  524. package/dist/unstable/observability/OtlpExporter.js +1 -1
  525. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  526. package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
  527. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  528. package/dist/unstable/observability/OtlpLogger.js +7 -4
  529. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  530. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
  531. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  532. package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
  533. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  534. package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
  535. package/dist/unstable/persistence/KeyValueStore.js +6 -6
  536. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  537. package/dist/unstable/persistence/Persistable.d.ts +2 -2
  538. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  539. package/dist/unstable/persistence/PersistedCache.d.ts +6 -5
  540. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  541. package/dist/unstable/persistence/PersistedCache.js +2 -1
  542. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  543. package/dist/unstable/persistence/PersistedQueue.d.ts +12 -12
  544. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  545. package/dist/unstable/persistence/PersistedQueue.js +12 -11
  546. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  547. package/dist/unstable/persistence/Persistence.d.ts +1 -1
  548. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  549. package/dist/unstable/persistence/Persistence.js +2 -2
  550. package/dist/unstable/persistence/Persistence.js.map +1 -1
  551. package/dist/unstable/persistence/RateLimiter.d.ts +3 -3
  552. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  553. package/dist/unstable/persistence/RateLimiter.js +1 -1
  554. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  555. package/dist/unstable/process/ChildProcess.d.ts +5 -128
  556. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  557. package/dist/unstable/process/ChildProcess.js +1 -65
  558. package/dist/unstable/process/ChildProcess.js.map +1 -1
  559. package/dist/unstable/process/ChildProcessSpawner.d.ts +45 -7
  560. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  561. package/dist/unstable/process/ChildProcessSpawner.js +21 -1
  562. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  563. package/dist/unstable/reactivity/Atom.d.ts +10 -10
  564. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  565. package/dist/unstable/reactivity/Atom.js +16 -13
  566. package/dist/unstable/reactivity/Atom.js.map +1 -1
  567. package/dist/unstable/reactivity/AtomHttpApi.d.ts +8 -8
  568. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  569. package/dist/unstable/reactivity/AtomHttpApi.js +3 -3
  570. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  571. package/dist/unstable/reactivity/AtomRegistry.d.ts +6 -0
  572. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  573. package/dist/unstable/reactivity/AtomRegistry.js +24 -7
  574. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  575. package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
  576. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  577. package/dist/unstable/reactivity/AtomRpc.js +1 -1
  578. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  579. package/dist/unstable/reactivity/Hydration.d.ts +39 -0
  580. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -0
  581. package/dist/unstable/reactivity/Hydration.js +76 -0
  582. package/dist/unstable/reactivity/Hydration.js.map +1 -0
  583. package/dist/unstable/reactivity/index.d.ts +4 -0
  584. package/dist/unstable/reactivity/index.d.ts.map +1 -1
  585. package/dist/unstable/reactivity/index.js +4 -0
  586. package/dist/unstable/reactivity/index.js.map +1 -1
  587. package/dist/unstable/rpc/Rpc.d.ts +4 -4
  588. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  589. package/dist/unstable/rpc/Rpc.js.map +1 -1
  590. package/dist/unstable/rpc/RpcClient.d.ts +5 -26
  591. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  592. package/dist/unstable/rpc/RpcClient.js +6 -13
  593. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  594. package/dist/unstable/rpc/RpcGroup.d.ts +2 -2
  595. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  596. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  597. package/dist/unstable/rpc/RpcMiddleware.d.ts +3 -3
  598. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  599. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  600. package/dist/unstable/rpc/RpcSchema.d.ts +13 -0
  601. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  602. package/dist/unstable/rpc/RpcSchema.js +14 -0
  603. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  604. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  605. package/dist/unstable/rpc/RpcSerialization.js +34 -9
  606. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  607. package/dist/unstable/rpc/RpcServer.d.ts +0 -7
  608. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  609. package/dist/unstable/rpc/RpcServer.js +15 -15
  610. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  611. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  612. package/dist/unstable/rpc/Utils.js +2 -1
  613. package/dist/unstable/rpc/Utils.js.map +1 -1
  614. package/dist/unstable/schema/Model.d.ts +1 -1
  615. package/dist/unstable/schema/Model.d.ts.map +1 -1
  616. package/dist/unstable/schema/VariantSchema.d.ts +3 -3
  617. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  618. package/dist/unstable/schema/VariantSchema.js +3 -3
  619. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  620. package/dist/unstable/socket/Socket.d.ts +4 -4
  621. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  622. package/dist/unstable/socket/Socket.js +6 -5
  623. package/dist/unstable/socket/Socket.js.map +1 -1
  624. package/dist/unstable/socket/SocketServer.d.ts +3 -3
  625. package/dist/unstable/sql/Migrator.d.ts +1 -1
  626. package/dist/unstable/sql/SqlClient.d.ts +1 -1
  627. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  628. package/dist/unstable/sql/SqlError.d.ts +14 -14
  629. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  630. package/dist/unstable/sql/SqlError.js +9 -3
  631. package/dist/unstable/sql/SqlError.js.map +1 -1
  632. package/dist/unstable/sql/SqlModel.d.ts +2 -2
  633. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  634. package/dist/unstable/sql/SqlModel.js +3 -3
  635. package/dist/unstable/sql/SqlModel.js.map +1 -1
  636. package/dist/unstable/sql/SqlSchema.d.ts +16 -5
  637. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  638. package/dist/unstable/sql/SqlSchema.js +17 -7
  639. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  640. package/dist/unstable/sql/Statement.js +0 -1
  641. package/dist/unstable/sql/Statement.js.map +1 -1
  642. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  643. package/dist/unstable/workers/Worker.js +2 -1
  644. package/dist/unstable/workers/Worker.js.map +1 -1
  645. package/dist/unstable/workflow/DurableClock.d.ts +3 -3
  646. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  647. package/dist/unstable/workflow/DurableClock.js +3 -3
  648. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  649. package/dist/unstable/workflow/DurableDeferred.js +2 -2
  650. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  651. package/dist/unstable/workflow/Workflow.d.ts +3 -3
  652. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  653. package/dist/unstable/workflow/WorkflowEngine.d.ts +8 -1
  654. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  655. package/dist/unstable/workflow/WorkflowEngine.js +133 -1
  656. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  657. package/package.json +2 -2
  658. package/src/Array.ts +190 -342
  659. package/src/Cache.ts +9 -8
  660. package/src/Cause.ts +1 -1
  661. package/src/Channel.ts +554 -138
  662. package/src/Chunk.ts +81 -268
  663. package/src/Combiner.ts +280 -13
  664. package/src/Config.ts +183 -21
  665. package/src/Data.ts +538 -374
  666. package/src/DateTime.ts +24 -164
  667. package/src/Duration.ts +15 -15
  668. package/src/Effect.ts +909 -817
  669. package/src/Encoding.ts +879 -0
  670. package/src/Equal.ts +278 -111
  671. package/src/ErrorReporter.ts +459 -0
  672. package/src/Fiber.ts +9 -2
  673. package/src/FileSystem.ts +7 -8
  674. package/src/Filter.ts +48 -58
  675. package/src/Formatter.ts +253 -51
  676. package/src/Graph.ts +24 -11
  677. package/src/HashMap.ts +15 -14
  678. package/src/Iterable.ts +105 -50
  679. package/src/JsonSchema.ts +383 -10
  680. package/src/Latch.ts +112 -0
  681. package/src/Layer.ts +11 -15
  682. package/src/LayerMap.ts +5 -5
  683. package/src/LogLevel.ts +37 -0
  684. package/src/Logger.ts +33 -100
  685. package/src/ManagedRuntime.ts +1 -1
  686. package/src/Metric.ts +4 -4
  687. package/src/Optic.ts +948 -19
  688. package/src/Option.ts +30 -20
  689. package/src/Pipeable.ts +32 -1
  690. package/src/PlatformError.ts +5 -5
  691. package/src/Pool.ts +13 -11
  692. package/src/PubSub.ts +10 -9
  693. package/src/Pull.ts +1 -1
  694. package/src/Queue.ts +0 -1
  695. package/src/Random.ts +51 -14
  696. package/src/RcMap.ts +5 -5
  697. package/src/RcRef.ts +1 -1
  698. package/src/Record.ts +43 -152
  699. package/src/Reducer.ts +166 -7
  700. package/src/References.ts +4 -4
  701. package/src/Request.ts +3 -2
  702. package/src/RequestResolver.ts +9 -29
  703. package/src/Result.ts +13 -0
  704. package/src/Schedule.ts +315 -160
  705. package/src/Schema.ts +661 -116
  706. package/src/SchemaAST.ts +3 -2
  707. package/src/SchemaGetter.ts +12 -14
  708. package/src/SchemaParser.ts +11 -0
  709. package/src/SchemaRepresentation.ts +43 -24
  710. package/src/SchemaTransformation.ts +189 -4
  711. package/src/ScopedCache.ts +3 -3
  712. package/src/Semaphore.ts +356 -0
  713. package/src/ServiceMap.ts +47 -38
  714. package/src/Sink.ts +78 -26
  715. package/src/Stream.ts +565 -600
  716. package/src/Struct.ts +26 -0
  717. package/src/SubscriptionRef.ts +3 -2
  718. package/src/SynchronizedRef.ts +3 -2
  719. package/src/Trie.ts +18 -17
  720. package/src/TxChunk.ts +72 -53
  721. package/src/TxDeferred.ts +394 -0
  722. package/src/TxHashMap.ts +332 -285
  723. package/src/TxHashSet.ts +111 -116
  724. package/src/TxPriorityQueue.ts +767 -0
  725. package/src/TxPubSub.ts +789 -0
  726. package/src/TxQueue.ts +241 -251
  727. package/src/TxReentrantLock.ts +753 -0
  728. package/src/TxRef.ts +50 -38
  729. package/src/TxSemaphore.ts +29 -32
  730. package/src/TxSubscriptionRef.ts +639 -0
  731. package/src/Types.ts +78 -2
  732. package/src/index.ts +600 -21
  733. package/src/internal/core.ts +12 -5
  734. package/src/internal/dateTime.ts +9 -30
  735. package/src/internal/effect.ts +660 -265
  736. package/src/internal/hashMap.ts +9 -7
  737. package/src/internal/random.ts +20 -0
  738. package/src/internal/rcRef.ts +4 -3
  739. package/src/internal/request.ts +2 -2
  740. package/src/internal/schema/annotations.ts +2 -0
  741. package/src/internal/schema/schema.ts +1 -0
  742. package/src/internal/trie.ts +16 -9
  743. package/src/testing/TestClock.ts +13 -11
  744. package/src/testing/TestSchema.ts +10 -10
  745. package/src/unstable/ai/AiError.ts +97 -44
  746. package/src/unstable/ai/Chat.ts +12 -11
  747. package/src/unstable/ai/LanguageModel.ts +129 -25
  748. package/src/unstable/ai/McpSchema.ts +59 -13
  749. package/src/unstable/ai/McpServer.ts +46 -8
  750. package/src/unstable/ai/Model.ts +40 -9
  751. package/src/unstable/ai/Prompt.ts +37 -37
  752. package/src/unstable/ai/Response.ts +25 -25
  753. package/src/unstable/ai/Tool.ts +19 -13
  754. package/src/unstable/ai/index.ts +1 -1
  755. package/src/unstable/cli/CliOutput.ts +75 -6
  756. package/src/unstable/cli/Command.ts +501 -60
  757. package/src/unstable/cli/GlobalFlag.ts +243 -0
  758. package/src/unstable/cli/HelpDoc.ts +80 -2
  759. package/src/unstable/cli/index.ts +5 -0
  760. package/src/unstable/cli/internal/command.ts +50 -34
  761. package/src/unstable/cli/internal/completions/CommandDescriptor.ts +7 -2
  762. package/src/unstable/cli/internal/help.ts +146 -0
  763. package/src/unstable/cli/internal/parser.ts +33 -54
  764. package/src/unstable/cluster/ClusterCron.ts +2 -2
  765. package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -4
  766. package/src/unstable/cluster/Entity.ts +11 -10
  767. package/src/unstable/cluster/EntityResource.ts +4 -4
  768. package/src/unstable/cluster/Envelope.ts +1 -1
  769. package/src/unstable/cluster/K8sHttpClient.ts +5 -5
  770. package/src/unstable/cluster/MessageStorage.ts +3 -5
  771. package/src/unstable/cluster/Runners.ts +6 -5
  772. package/src/unstable/cluster/Sharding.ts +12 -10
  773. package/src/unstable/cluster/ShardingConfig.ts +30 -31
  774. package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
  775. package/src/unstable/cluster/internal/entityManager.ts +9 -8
  776. package/src/unstable/cluster/internal/entityReaper.ts +2 -1
  777. package/src/unstable/cluster/internal/resourceRef.ts +2 -1
  778. package/src/unstable/encoding/Sse.ts +3 -5
  779. package/src/unstable/eventlog/EventLog.ts +2 -1
  780. package/src/unstable/http/Cookies.ts +3 -3
  781. package/src/unstable/http/Headers.ts +28 -13
  782. package/src/unstable/http/HttpBody.ts +42 -1
  783. package/src/unstable/http/HttpClient.ts +58 -23
  784. package/src/unstable/http/HttpClientRequest.ts +38 -13
  785. package/src/unstable/http/HttpEffect.ts +46 -68
  786. package/src/unstable/http/HttpMethod.ts +16 -4
  787. package/src/unstable/http/HttpMiddleware.ts +9 -24
  788. package/src/unstable/http/HttpServerError.ts +42 -45
  789. package/src/unstable/http/HttpServerRespondable.ts +6 -6
  790. package/src/unstable/http/HttpServerResponse.ts +4 -2
  791. package/src/unstable/http/Multipart.ts +2 -2
  792. package/src/unstable/http/UrlParams.ts +20 -5
  793. package/src/unstable/http/internal/preResponseHandler.ts +15 -0
  794. package/src/unstable/httpapi/HttpApi.ts +5 -5
  795. package/src/unstable/httpapi/HttpApiBuilder.ts +77 -21
  796. package/src/unstable/httpapi/HttpApiClient.ts +14 -6
  797. package/src/unstable/httpapi/HttpApiEndpoint.ts +67 -83
  798. package/src/unstable/httpapi/HttpApiError.ts +30 -9
  799. package/src/unstable/httpapi/HttpApiGroup.ts +6 -6
  800. package/src/unstable/httpapi/HttpApiMiddleware.ts +4 -4
  801. package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
  802. package/src/unstable/httpapi/HttpApiSecurity.ts +3 -3
  803. package/src/unstable/httpapi/OpenApi.ts +41 -23
  804. package/src/unstable/observability/Otlp.ts +12 -12
  805. package/src/unstable/observability/OtlpExporter.ts +3 -3
  806. package/src/unstable/observability/OtlpLogger.ts +13 -9
  807. package/src/unstable/observability/OtlpMetrics.ts +4 -4
  808. package/src/unstable/observability/OtlpTracer.ts +4 -4
  809. package/src/unstable/persistence/KeyValueStore.ts +6 -6
  810. package/src/unstable/persistence/Persistable.ts +2 -2
  811. package/src/unstable/persistence/PersistedCache.ts +20 -9
  812. package/src/unstable/persistence/PersistedQueue.ts +25 -24
  813. package/src/unstable/persistence/Persistence.ts +3 -3
  814. package/src/unstable/persistence/RateLimiter.ts +4 -4
  815. package/src/unstable/process/ChildProcess.ts +6 -208
  816. package/src/unstable/process/ChildProcessSpawner.ts +75 -14
  817. package/src/unstable/reactivity/Atom.ts +27 -25
  818. package/src/unstable/reactivity/AtomHttpApi.ts +21 -20
  819. package/src/unstable/reactivity/AtomRegistry.ts +31 -7
  820. package/src/unstable/reactivity/AtomRpc.ts +3 -3
  821. package/src/unstable/reactivity/Hydration.ts +112 -0
  822. package/src/unstable/reactivity/index.ts +5 -0
  823. package/src/unstable/rpc/Rpc.ts +6 -6
  824. package/src/unstable/rpc/RpcClient.ts +12 -54
  825. package/src/unstable/rpc/RpcGroup.ts +4 -4
  826. package/src/unstable/rpc/RpcMiddleware.ts +3 -3
  827. package/src/unstable/rpc/RpcSchema.ts +17 -0
  828. package/src/unstable/rpc/RpcSerialization.ts +44 -9
  829. package/src/unstable/rpc/RpcServer.ts +21 -30
  830. package/src/unstable/rpc/Utils.ts +2 -1
  831. package/src/unstable/schema/VariantSchema.ts +6 -6
  832. package/src/unstable/socket/Socket.ts +16 -17
  833. package/src/unstable/sql/SqlClient.ts +1 -1
  834. package/src/unstable/sql/SqlError.ts +11 -9
  835. package/src/unstable/sql/SqlModel.ts +5 -5
  836. package/src/unstable/sql/SqlSchema.ts +41 -25
  837. package/src/unstable/sql/Statement.ts +0 -1
  838. package/src/unstable/workers/Worker.ts +2 -1
  839. package/src/unstable/workflow/DurableClock.ts +8 -8
  840. package/src/unstable/workflow/DurableDeferred.ts +2 -2
  841. package/src/unstable/workflow/Workflow.ts +1 -1
  842. package/src/unstable/workflow/WorkflowEngine.ts +181 -2
  843. package/dist/PartitionedSemaphore.d.ts +0 -52
  844. package/dist/PartitionedSemaphore.d.ts.map +0 -1
  845. package/dist/PartitionedSemaphore.js.map +0 -1
  846. package/dist/encoding/Base64.d.ts +0 -67
  847. package/dist/encoding/Base64.d.ts.map +0 -1
  848. package/dist/encoding/Base64.js +0 -146
  849. package/dist/encoding/Base64.js.map +0 -1
  850. package/dist/encoding/Base64Url.d.ts +0 -60
  851. package/dist/encoding/Base64Url.d.ts.map +0 -1
  852. package/dist/encoding/Base64Url.js +0 -89
  853. package/dist/encoding/Base64Url.js.map +0 -1
  854. package/dist/encoding/EncodingError.d.ts +0 -31
  855. package/dist/encoding/EncodingError.d.ts.map +0 -1
  856. package/dist/encoding/EncodingError.js +0 -22
  857. package/dist/encoding/EncodingError.js.map +0 -1
  858. package/dist/encoding/Hex.d.ts +0 -61
  859. package/dist/encoding/Hex.d.ts.map +0 -1
  860. package/dist/encoding/Hex.js +0 -115
  861. package/dist/encoding/Hex.js.map +0 -1
  862. package/dist/encoding/index.d.ts +0 -26
  863. package/dist/encoding/index.d.ts.map +0 -1
  864. package/dist/encoding/index.js +0 -27
  865. package/dist/encoding/index.js.map +0 -1
  866. package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
  867. package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
  868. package/dist/unstable/cli/internal/builtInFlags.js +0 -44
  869. package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
  870. package/src/PartitionedSemaphore.ts +0 -182
  871. package/src/encoding/Base64.ts +0 -366
  872. package/src/encoding/Base64Url.ts +0 -104
  873. package/src/encoding/EncodingError.ts +0 -35
  874. package/src/encoding/Hex.ts +0 -390
  875. package/src/encoding/index.ts +0 -31
  876. 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
  /**
@@ -724,6 +724,199 @@ export declare const partition: {
724
724
  readonly concurrency?: Concurrency | undefined;
725
725
  }): Effect<[excluded: Array<E>, satisfying: Array<B>], never, R>;
726
726
  };
727
+ /**
728
+ * Applies an effectful function to each element and accumulates all failures.
729
+ *
730
+ * This function always evaluates every element. If at least one effect fails,
731
+ * all failures are returned as a non-empty array and successes are discarded.
732
+ * If all effects succeed, it returns all collected successes.
733
+ *
734
+ * Use `discard: true` to ignore successful values while still validating all
735
+ * elements.
736
+ *
737
+ * @example
738
+ * ```ts
739
+ * import { Effect } from "effect"
740
+ *
741
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
742
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
743
+ * )
744
+ *
745
+ * Effect.runPromiseExit(program).then(console.log)
746
+ * // {
747
+ * // _id: 'Exit',
748
+ * // _tag: 'Failure',
749
+ * // cause: {
750
+ * // _id: 'Cause',
751
+ * // reasons: [
752
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
753
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
754
+ * // ]
755
+ * // }
756
+ * // }
757
+ * ```
758
+ *
759
+ * @since 4.0.0
760
+ * @category Error Accumulation
761
+ */
762
+ export declare const validate: {
763
+ /**
764
+ * Applies an effectful function to each element and accumulates all failures.
765
+ *
766
+ * This function always evaluates every element. If at least one effect fails,
767
+ * all failures are returned as a non-empty array and successes are discarded.
768
+ * If all effects succeed, it returns all collected successes.
769
+ *
770
+ * Use `discard: true` to ignore successful values while still validating all
771
+ * elements.
772
+ *
773
+ * @example
774
+ * ```ts
775
+ * import { Effect } from "effect"
776
+ *
777
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
778
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
779
+ * )
780
+ *
781
+ * Effect.runPromiseExit(program).then(console.log)
782
+ * // {
783
+ * // _id: 'Exit',
784
+ * // _tag: 'Failure',
785
+ * // cause: {
786
+ * // _id: 'Cause',
787
+ * // reasons: [
788
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
789
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
790
+ * // ]
791
+ * // }
792
+ * // }
793
+ * ```
794
+ *
795
+ * @since 4.0.0
796
+ * @category Error Accumulation
797
+ */
798
+ <A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options?: {
799
+ readonly concurrency?: Concurrency | undefined;
800
+ readonly discard?: false | undefined;
801
+ } | undefined): (elements: Iterable<A>) => Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
802
+ /**
803
+ * Applies an effectful function to each element and accumulates all failures.
804
+ *
805
+ * This function always evaluates every element. If at least one effect fails,
806
+ * all failures are returned as a non-empty array and successes are discarded.
807
+ * If all effects succeed, it returns all collected successes.
808
+ *
809
+ * Use `discard: true` to ignore successful values while still validating all
810
+ * elements.
811
+ *
812
+ * @example
813
+ * ```ts
814
+ * import { Effect } from "effect"
815
+ *
816
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
817
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
818
+ * )
819
+ *
820
+ * Effect.runPromiseExit(program).then(console.log)
821
+ * // {
822
+ * // _id: 'Exit',
823
+ * // _tag: 'Failure',
824
+ * // cause: {
825
+ * // _id: 'Cause',
826
+ * // reasons: [
827
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
828
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
829
+ * // ]
830
+ * // }
831
+ * // }
832
+ * ```
833
+ *
834
+ * @since 4.0.0
835
+ * @category Error Accumulation
836
+ */
837
+ <A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options: {
838
+ readonly concurrency?: Concurrency | undefined;
839
+ readonly discard: true;
840
+ }): (elements: Iterable<A>) => Effect<void, Arr.NonEmptyArray<E>, R>;
841
+ /**
842
+ * Applies an effectful function to each element and accumulates all failures.
843
+ *
844
+ * This function always evaluates every element. If at least one effect fails,
845
+ * all failures are returned as a non-empty array and successes are discarded.
846
+ * If all effects succeed, it returns all collected successes.
847
+ *
848
+ * Use `discard: true` to ignore successful values while still validating all
849
+ * elements.
850
+ *
851
+ * @example
852
+ * ```ts
853
+ * import { Effect } from "effect"
854
+ *
855
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
856
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
857
+ * )
858
+ *
859
+ * Effect.runPromiseExit(program).then(console.log)
860
+ * // {
861
+ * // _id: 'Exit',
862
+ * // _tag: 'Failure',
863
+ * // cause: {
864
+ * // _id: 'Cause',
865
+ * // reasons: [
866
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
867
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
868
+ * // ]
869
+ * // }
870
+ * // }
871
+ * ```
872
+ *
873
+ * @since 4.0.0
874
+ * @category Error Accumulation
875
+ */
876
+ <A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options?: {
877
+ readonly concurrency?: Concurrency | undefined;
878
+ readonly discard?: false | undefined;
879
+ } | undefined): Effect<Array<B>, Arr.NonEmptyArray<E>, R>;
880
+ /**
881
+ * Applies an effectful function to each element and accumulates all failures.
882
+ *
883
+ * This function always evaluates every element. If at least one effect fails,
884
+ * all failures are returned as a non-empty array and successes are discarded.
885
+ * If all effects succeed, it returns all collected successes.
886
+ *
887
+ * Use `discard: true` to ignore successful values while still validating all
888
+ * elements.
889
+ *
890
+ * @example
891
+ * ```ts
892
+ * import { Effect } from "effect"
893
+ *
894
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
895
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
896
+ * )
897
+ *
898
+ * Effect.runPromiseExit(program).then(console.log)
899
+ * // {
900
+ * // _id: 'Exit',
901
+ * // _tag: 'Failure',
902
+ * // cause: {
903
+ * // _id: 'Cause',
904
+ * // reasons: [
905
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
906
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
907
+ * // ]
908
+ * // }
909
+ * // }
910
+ * ```
911
+ *
912
+ * @since 4.0.0
913
+ * @category Error Accumulation
914
+ */
915
+ <A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options: {
916
+ readonly concurrency?: Concurrency | undefined;
917
+ readonly discard: true;
918
+ }): Effect<void, Arr.NonEmptyArray<E>, R>;
919
+ };
727
920
  /**
728
921
  * Executes an effectful operation for each element in an `Iterable`.
729
922
  *
@@ -1352,6 +1545,90 @@ export declare const callback: <A, E = never, R = never>(register: (this: Schedu
1352
1545
  * @category Creating Effects
1353
1546
  */
1354
1547
  export declare const never: Effect<never>;
1548
+ /**
1549
+ * An `Effect` containing an empty record `{}`, used as the starting point for
1550
+ * do notation chains.
1551
+ *
1552
+ * @example
1553
+ * ```ts
1554
+ * import { Effect } from "effect"
1555
+ * import { pipe } from "effect/Function"
1556
+ *
1557
+ * const program = pipe(
1558
+ * Effect.Do,
1559
+ * Effect.bind("x", () => Effect.succeed(2)),
1560
+ * Effect.bind("y", ({ x }) => Effect.succeed(x + 1)),
1561
+ * Effect.let("sum", ({ x, y }) => x + y)
1562
+ * )
1563
+ * ```
1564
+ *
1565
+ * @since 4.0.0
1566
+ * @category Do notation
1567
+ */
1568
+ export declare const Do: Effect<{}>;
1569
+ /**
1570
+ * Gives a name to the success value of an `Effect`, creating a single-key
1571
+ * record used in do notation pipelines.
1572
+ *
1573
+ * @since 4.0.0
1574
+ * @category Do notation
1575
+ */
1576
+ export declare const bindTo: {
1577
+ /**
1578
+ * Gives a name to the success value of an `Effect`, creating a single-key
1579
+ * record used in do notation pipelines.
1580
+ *
1581
+ * @since 4.0.0
1582
+ * @category Do notation
1583
+ */
1584
+ <N extends string>(name: N): <A, E, R>(self: Effect<A, E, R>) => Effect<{
1585
+ [K in N]: A;
1586
+ }, E, R>;
1587
+ /**
1588
+ * Gives a name to the success value of an `Effect`, creating a single-key
1589
+ * record used in do notation pipelines.
1590
+ *
1591
+ * @since 4.0.0
1592
+ * @category Do notation
1593
+ */
1594
+ <A, E, R, N extends string>(self: Effect<A, E, R>, name: N): Effect<{
1595
+ [K in N]: A;
1596
+ }, E, R>;
1597
+ };
1598
+ declare const let_: {
1599
+ <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>;
1600
+ <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>;
1601
+ };
1602
+ export {
1603
+ /**
1604
+ * Adds a computed plain value to the do notation record.
1605
+ *
1606
+ * @since 4.0.0
1607
+ * @category Do notation
1608
+ */
1609
+ let_ as let };
1610
+ /**
1611
+ * Adds an `Effect` value to the do notation record under a given name.
1612
+ *
1613
+ * @since 4.0.0
1614
+ * @category Do notation
1615
+ */
1616
+ export declare const bind: {
1617
+ /**
1618
+ * Adds an `Effect` value to the do notation record under a given name.
1619
+ *
1620
+ * @since 4.0.0
1621
+ * @category Do notation
1622
+ */
1623
+ <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>;
1624
+ /**
1625
+ * Adds an `Effect` value to the do notation record under a given name.
1626
+ *
1627
+ * @since 4.0.0
1628
+ * @category Do notation
1629
+ */
1630
+ <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>;
1631
+ };
1355
1632
  /**
1356
1633
  * Provides a way to write effectful code using generator functions, simplifying
1357
1634
  * control flow and error handling.
@@ -3916,7 +4193,7 @@ export declare const catchReason: {
3916
4193
  * @since 4.0.0
3917
4194
  * @category Error Handling
3918
4195
  */
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>;
4196
+ <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
4197
  /**
3921
4198
  * Catches a specific reason within a tagged error.
3922
4199
  *
@@ -3952,7 +4229,7 @@ export declare const catchReason: {
3952
4229
  * @since 4.0.0
3953
4230
  * @category Error Handling
3954
4231
  */
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>;
4232
+ <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
4233
  };
3957
4234
  /**
3958
4235
  * Catches multiple reasons within a tagged error using an object of handlers.
@@ -4024,8 +4301,8 @@ export declare const catchReasons: {
4024
4301
  * @category Error Handling
4025
4302
  */
4026
4303
  <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> | {
4304
+ [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>;
4305
+ }, 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
4306
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
4030
4307
  }[keyof Cases], (A2 extends unassigned ? E : ExcludeTag<E, K>) | E2 | {
4031
4308
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
@@ -4067,8 +4344,8 @@ export declare const catchReasons: {
4067
4344
  * @category Error Handling
4068
4345
  */
4069
4346
  <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> | {
4347
+ [RK in ReasonTags<ExtractTag<E, K>>]+?: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Effect<any, any, any>;
4348
+ }, 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
4349
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<infer A, any, any> ? A : never;
4073
4350
  }[keyof Cases], (A2 extends unassigned ? E : ExcludeTag<E, K>) | E2 | {
4074
4351
  [RK in keyof Cases]: Cases[RK] extends (...args: Array<any>) => Effect<any, infer E, any> ? E : never;
@@ -4469,15 +4746,14 @@ export declare const catchDefect: {
4469
4746
  <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
4747
  };
4471
4748
  /**
4472
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4473
- * `Refinement`.
4749
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4474
4750
  *
4475
4751
  * **When to Use**
4476
4752
  *
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.
4753
+ * `catchIf` lets you recover from errors that match a condition. Use a
4754
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4755
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4756
+ * interrupts are not caught.
4481
4757
  *
4482
4758
  * **Previously Known As**
4483
4759
  *
@@ -4504,7 +4780,7 @@ export declare const catchDefect: {
4504
4780
  *
4505
4781
  * // With a Filter
4506
4782
  * const recovered2 = program.pipe(
4507
- * Effect.catchIf(
4783
+ * Effect.catchFilter(
4508
4784
  * Filter.tagged("NotFound"),
4509
4785
  * (error) => Effect.succeed(`missing:${error.id}`)
4510
4786
  * )
@@ -4516,15 +4792,14 @@ export declare const catchDefect: {
4516
4792
  */
4517
4793
  export declare const catchIf: {
4518
4794
  /**
4519
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4520
- * `Refinement`.
4795
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4521
4796
  *
4522
4797
  * **When to Use**
4523
4798
  *
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.
4799
+ * `catchIf` lets you recover from errors that match a condition. Use a
4800
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4801
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4802
+ * interrupts are not caught.
4528
4803
  *
4529
4804
  * **Previously Known As**
4530
4805
  *
@@ -4551,7 +4826,7 @@ export declare const catchIf: {
4551
4826
  *
4552
4827
  * // With a Filter
4553
4828
  * const recovered2 = program.pipe(
4554
- * Effect.catchIf(
4829
+ * Effect.catchFilter(
4555
4830
  * Filter.tagged("NotFound"),
4556
4831
  * (error) => Effect.succeed(`missing:${error.id}`)
4557
4832
  * )
@@ -4563,15 +4838,14 @@ export declare const catchIf: {
4563
4838
  */
4564
4839
  <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
4840
  /**
4566
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4567
- * `Refinement`.
4841
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4568
4842
  *
4569
4843
  * **When to Use**
4570
4844
  *
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.
4845
+ * `catchIf` lets you recover from errors that match a condition. Use a
4846
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4847
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4848
+ * interrupts are not caught.
4575
4849
  *
4576
4850
  * **Previously Known As**
4577
4851
  *
@@ -4598,7 +4872,7 @@ export declare const catchIf: {
4598
4872
  *
4599
4873
  * // With a Filter
4600
4874
  * const recovered2 = program.pipe(
4601
- * Effect.catchIf(
4875
+ * Effect.catchFilter(
4602
4876
  * Filter.tagged("NotFound"),
4603
4877
  * (error) => Effect.succeed(`missing:${error.id}`)
4604
4878
  * )
@@ -4608,17 +4882,16 @@ export declare const catchIf: {
4608
4882
  * @since 2.0.0
4609
4883
  * @category Error Handling
4610
4884
  */
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>;
4885
+ <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
4886
  /**
4613
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4614
- * `Refinement`.
4887
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4615
4888
  *
4616
4889
  * **When to Use**
4617
4890
  *
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.
4891
+ * `catchIf` lets you recover from errors that match a condition. Use a
4892
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4893
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4894
+ * interrupts are not caught.
4622
4895
  *
4623
4896
  * **Previously Known As**
4624
4897
  *
@@ -4645,7 +4918,7 @@ export declare const catchIf: {
4645
4918
  *
4646
4919
  * // With a Filter
4647
4920
  * const recovered2 = program.pipe(
4648
- * Effect.catchIf(
4921
+ * Effect.catchFilter(
4649
4922
  * Filter.tagged("NotFound"),
4650
4923
  * (error) => Effect.succeed(`missing:${error.id}`)
4651
4924
  * )
@@ -4657,15 +4930,14 @@ export declare const catchIf: {
4657
4930
  */
4658
4931
  <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
4932
  /**
4660
- * Recovers from specific errors using a `Filter`, `Predicate`, or
4661
- * `Refinement`.
4933
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
4662
4934
  *
4663
4935
  * **When to Use**
4664
4936
  *
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.
4937
+ * `catchIf` lets you recover from errors that match a condition. Use a
4938
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
4939
+ * matching. Non-matching errors re-fail with the original cause. Defects and
4940
+ * interrupts are not caught.
4669
4941
  *
4670
4942
  * **Previously Known As**
4671
4943
  *
@@ -4692,7 +4964,7 @@ export declare const catchIf: {
4692
4964
  *
4693
4965
  * // With a Filter
4694
4966
  * const recovered2 = program.pipe(
4695
- * Effect.catchIf(
4967
+ * Effect.catchFilter(
4696
4968
  * Filter.tagged("NotFound"),
4697
4969
  * (error) => Effect.succeed(`missing:${error.id}`)
4698
4970
  * )
@@ -4702,7 +4974,29 @@ export declare const catchIf: {
4702
4974
  * @since 2.0.0
4703
4975
  * @category Error Handling
4704
4976
  */
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>;
4977
+ <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>;
4978
+ };
4979
+ /**
4980
+ * Recovers from specific errors using a `Filter`.
4981
+ *
4982
+ * @since 4.0.0
4983
+ * @category Error Handling
4984
+ */
4985
+ export declare const catchFilter: {
4986
+ /**
4987
+ * Recovers from specific errors using a `Filter`.
4988
+ *
4989
+ * @since 4.0.0
4990
+ * @category Error Handling
4991
+ */
4992
+ <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>;
4993
+ /**
4994
+ * Recovers from specific errors using a `Filter`.
4995
+ *
4996
+ * @since 4.0.0
4997
+ * @category Error Handling
4998
+ */
4999
+ <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
5000
  };
4707
5001
  /**
4708
5002
  * Catches `NoSuchElementError` failures and converts them to `Option.none`.
@@ -4808,7 +5102,7 @@ export declare const catchCauseIf: {
4808
5102
  * @since 4.0.0
4809
5103
  * @category Error Handling
4810
5104
  */
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>;
5105
+ <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
5106
  /**
4813
5107
  * Recovers from specific failures based on a predicate.
4814
5108
  *
@@ -4847,7 +5141,29 @@ export declare const catchCauseIf: {
4847
5141
  * @since 4.0.0
4848
5142
  * @category Error Handling
4849
5143
  */
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>;
5144
+ <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>;
5145
+ };
5146
+ /**
5147
+ * Recovers from specific failures based on a `Filter`.
5148
+ *
5149
+ * @since 4.0.0
5150
+ * @category Error Handling
5151
+ */
5152
+ export declare const catchCauseFilter: {
5153
+ /**
5154
+ * Recovers from specific failures based on a `Filter`.
5155
+ *
5156
+ * @since 4.0.0
5157
+ * @category Error Handling
5158
+ */
5159
+ <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>;
5160
+ /**
5161
+ * Recovers from specific failures based on a `Filter`.
5162
+ *
5163
+ * @since 4.0.0
5164
+ * @category Error Handling
5165
+ */
5166
+ <A, E, R, B, E2, R2, EB, X extends Cause.Cause<any>>(self: Effect<A, E, R>, filter: Filter.Filter<Cause.Cause<E>, EB, X>, f: (failure: EB, cause: Cause.Cause<E>) => Effect<B, E2, R2>): Effect<A | B, Cause.Cause.Error<X> | E2, R | R2>;
4851
5167
  };
4852
5168
  /**
4853
5169
  * The `mapError` function is used to transform or modify the error
@@ -5454,7 +5770,7 @@ export declare const tapCauseIf: {
5454
5770
  * @since 4.0.0
5455
5771
  * @category Sequencing
5456
5772
  */
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>;
5773
+ <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
5774
  /**
5459
5775
  * Conditionally executes a side effect based on the cause of a failed effect.
5460
5776
  *
@@ -5483,7 +5799,29 @@ export declare const tapCauseIf: {
5483
5799
  * @since 4.0.0
5484
5800
  * @category Sequencing
5485
5801
  */
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>;
5802
+ <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>;
5803
+ };
5804
+ /**
5805
+ * Conditionally executes a side effect based on the cause of a failed effect.
5806
+ *
5807
+ * @since 4.0.0
5808
+ * @category Sequencing
5809
+ */
5810
+ export declare const tapCauseFilter: {
5811
+ /**
5812
+ * Conditionally executes a side effect based on the cause of a failed effect.
5813
+ *
5814
+ * @since 4.0.0
5815
+ * @category Sequencing
5816
+ */
5817
+ <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>;
5818
+ /**
5819
+ * Conditionally executes a side effect based on the cause of a failed effect.
5820
+ *
5821
+ * @since 4.0.0
5822
+ * @category Sequencing
5823
+ */
5824
+ <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
5825
  };
5488
5826
  /**
5489
5827
  * Inspect severe errors or defects (non-recoverable failures) in an effect.
@@ -6337,11 +6675,11 @@ export declare const sandbox: <A, E, R>(self: Effect<A, E, R>) => Effect<A, Caus
6337
6675
  * @category Error Handling
6338
6676
  */
6339
6677
  export declare const ignore: <Arg extends Effect<any, any, any> | {
6340
- readonly log?: boolean | LogLevel | undefined;
6678
+ readonly log?: boolean | Severity | undefined;
6341
6679
  } | undefined = {
6342
- readonly log?: boolean | LogLevel | undefined;
6680
+ readonly log?: boolean | Severity | undefined;
6343
6681
  }>(effectOrOptions?: Arg, options?: {
6344
- readonly log?: boolean | LogLevel | undefined;
6682
+ readonly log?: boolean | Severity | undefined;
6345
6683
  } | 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
6684
  /**
6347
6685
  * Ignores the effect's failure cause, including defects and interruptions.
@@ -6362,11 +6700,11 @@ export declare const ignore: <Arg extends Effect<any, any, any> | {
6362
6700
  * @category Error Handling
6363
6701
  */
6364
6702
  export declare const ignoreCause: <Arg extends Effect<any, any, any> | {
6365
- readonly log?: boolean | LogLevel | undefined;
6703
+ readonly log?: boolean | Severity | undefined;
6366
6704
  } | undefined = {
6367
- readonly log?: boolean | LogLevel | undefined;
6705
+ readonly log?: boolean | Severity | undefined;
6368
6706
  }>(effectOrOptions?: Arg, options?: {
6369
- readonly log?: boolean | LogLevel | undefined;
6707
+ readonly log?: boolean | Severity | undefined;
6370
6708
  } | 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
6709
  /**
6372
6710
  * Apply an `ExecutionPlan` to an effect, retrying with step-provided resources
@@ -6472,6 +6810,22 @@ export declare const withExecutionPlan: {
6472
6810
  requirements: PlanR;
6473
6811
  }>): Effect<A, E | PlanE, Exclude<R, Provides> | PlanR>;
6474
6812
  };
6813
+ /**
6814
+ * Runs an effect and reports any errors to the configured `ErrorReporter`s.
6815
+ *
6816
+ * If the `defectsOnly` option is set to `true`, only defects (unrecoverable
6817
+ * errors) will be reported, while regular failures will be ignored.
6818
+ *
6819
+ * @since 4.0.0
6820
+ * @category Error Handling
6821
+ */
6822
+ export declare const withErrorReporting: <Arg extends Effect<any, any, any> | {
6823
+ readonly defectsOnly?: boolean | undefined;
6824
+ } | undefined = {
6825
+ readonly defectsOnly?: boolean | undefined;
6826
+ }>(effectOrOptions: Arg, options?: {
6827
+ readonly defectsOnly?: boolean | undefined;
6828
+ } | undefined) => [Arg] extends [Effect<infer _A, infer _E, infer _R>] ? Arg : <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
6475
6829
  /**
6476
6830
  * Replaces the original failure with a success value, ensuring the effect
6477
6831
  * cannot fail.
@@ -6692,7 +7046,7 @@ export declare const timeout: {
6692
7046
  * @since 2.0.0
6693
7047
  * @category Delays & Timeouts
6694
7048
  */
6695
- (duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | Cause.TimeoutError, R>;
7049
+ (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | Cause.TimeoutError, R>;
6696
7050
  /**
6697
7051
  * Adds a time limit to an effect, triggering a timeout if the effect exceeds
6698
7052
  * the duration.
@@ -6739,7 +7093,7 @@ export declare const timeout: {
6739
7093
  * @since 2.0.0
6740
7094
  * @category Delays & Timeouts
6741
7095
  */
6742
- <A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<A, E | Cause.TimeoutError, R>;
7096
+ <A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<A, E | Cause.TimeoutError, R>;
6743
7097
  };
6744
7098
  /**
6745
7099
  * Handles timeouts by returning an `Option` that represents either the result
@@ -6840,7 +7194,7 @@ export declare const timeoutOption: {
6840
7194
  * @since 3.1.0
6841
7195
  * @category Delays & Timeouts
6842
7196
  */
6843
- (duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, E, R>;
7197
+ (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, E, R>;
6844
7198
  /**
6845
7199
  * Handles timeouts by returning an `Option` that represents either the result
6846
7200
  * or a timeout.
@@ -6890,7 +7244,7 @@ export declare const timeoutOption: {
6890
7244
  * @since 3.1.0
6891
7245
  * @category Delays & Timeouts
6892
7246
  */
6893
- <A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<Option<A>, E, R>;
7247
+ <A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<Option<A>, E, R>;
6894
7248
  };
6895
7249
  /**
6896
7250
  * Applies a timeout to an effect, with a fallback effect executed if the timeout is reached.
@@ -6966,7 +7320,7 @@ export declare const timeoutOrElse: {
6966
7320
  * @category Delays & Timeouts
6967
7321
  */
6968
7322
  <A2, E2, R2>(options: {
6969
- readonly duration: Duration.DurationInput;
7323
+ readonly duration: Duration.Input;
6970
7324
  readonly onTimeout: LazyArg<Effect<A2, E2, R2>>;
6971
7325
  }): <A, E, R>(self: Effect<A, E, R>) => Effect<A | A2, E | E2, R | R2>;
6972
7326
  /**
@@ -7006,7 +7360,7 @@ export declare const timeoutOrElse: {
7006
7360
  * @category Delays & Timeouts
7007
7361
  */
7008
7362
  <A, E, R, A2, E2, R2>(self: Effect<A, E, R>, options: {
7009
- readonly duration: Duration.DurationInput;
7363
+ readonly duration: Duration.Input;
7010
7364
  readonly onTimeout: LazyArg<Effect<A2, E2, R2>>;
7011
7365
  }): Effect<A | A2, E | E2, R | R2>;
7012
7366
  };
@@ -7051,7 +7405,7 @@ export declare const delay: {
7051
7405
  * @since 2.0.0
7052
7406
  * @category Delays & Timeouts
7053
7407
  */
7054
- (duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
7408
+ (duration: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
7055
7409
  /**
7056
7410
  * Returns an effect that is delayed from this effect by the specified
7057
7411
  * `Duration`.
@@ -7072,7 +7426,7 @@ export declare const delay: {
7072
7426
  * @since 2.0.0
7073
7427
  * @category Delays & Timeouts
7074
7428
  */
7075
- <A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<A, E, R>;
7429
+ <A, E, R>(self: Effect<A, E, R>, duration: Duration.Input): Effect<A, E, R>;
7076
7430
  };
7077
7431
  /**
7078
7432
  * Returns an effect that suspends for the specified duration. This method is
@@ -7096,7 +7450,7 @@ export declare const delay: {
7096
7450
  * @since 2.0.0
7097
7451
  * @category Delays & Timeouts
7098
7452
  */
7099
- export declare const sleep: (duration: Duration.DurationInput) => Effect<void>;
7453
+ export declare const sleep: (duration: Duration.Input) => Effect<void>;
7100
7454
  /**
7101
7455
  * Measures the runtime of an effect and returns the duration with its result.
7102
7456
  *
@@ -7389,12 +7743,12 @@ export declare const raceFirst: {
7389
7743
  }): Effect<A | A2, E | E2, R | R2>;
7390
7744
  };
7391
7745
  /**
7392
- * Filters elements of an iterable using a predicate, refinement, effectful
7393
- * predicate, or `Filter.FilterEffect`.
7746
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7747
+ * predicate.
7394
7748
  *
7395
7749
  * @example
7396
7750
  * ```ts
7397
- * import { Effect, Filter, Result } from "effect"
7751
+ * import { Effect } from "effect"
7398
7752
  *
7399
7753
  * // Sync predicate
7400
7754
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7402,10 +7756,7 @@ export declare const raceFirst: {
7402
7756
  * // Effectful predicate
7403
7757
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7404
7758
  *
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
- * )
7759
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7409
7760
  * ```
7410
7761
  *
7411
7762
  * @since 2.0.0
@@ -7413,12 +7764,12 @@ export declare const raceFirst: {
7413
7764
  */
7414
7765
  export declare const filter: {
7415
7766
  /**
7416
- * Filters elements of an iterable using a predicate, refinement, effectful
7417
- * predicate, or `Filter.FilterEffect`.
7767
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7768
+ * predicate.
7418
7769
  *
7419
7770
  * @example
7420
7771
  * ```ts
7421
- * import { Effect, Filter, Result } from "effect"
7772
+ * import { Effect } from "effect"
7422
7773
  *
7423
7774
  * // Sync predicate
7424
7775
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7426,10 +7777,7 @@ export declare const filter: {
7426
7777
  * // Effectful predicate
7427
7778
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7428
7779
  *
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
- * )
7780
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7433
7781
  * ```
7434
7782
  *
7435
7783
  * @since 2.0.0
@@ -7437,12 +7785,12 @@ export declare const filter: {
7437
7785
  */
7438
7786
  <A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): (elements: Iterable<A>) => Effect<Array<B>>;
7439
7787
  /**
7440
- * Filters elements of an iterable using a predicate, refinement, effectful
7441
- * predicate, or `Filter.FilterEffect`.
7788
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7789
+ * predicate.
7442
7790
  *
7443
7791
  * @example
7444
7792
  * ```ts
7445
- * import { Effect, Filter, Result } from "effect"
7793
+ * import { Effect } from "effect"
7446
7794
  *
7447
7795
  * // Sync predicate
7448
7796
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7450,10 +7798,7 @@ export declare const filter: {
7450
7798
  * // Effectful predicate
7451
7799
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7452
7800
  *
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
- * )
7801
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7457
7802
  * ```
7458
7803
  *
7459
7804
  * @since 2.0.0
@@ -7461,12 +7806,12 @@ export declare const filter: {
7461
7806
  */
7462
7807
  <A>(predicate: Predicate.Predicate<NoInfer<A>>): (elements: Iterable<A>) => Effect<Array<A>>;
7463
7808
  /**
7464
- * Filters elements of an iterable using a predicate, refinement, effectful
7465
- * predicate, or `Filter.FilterEffect`.
7809
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7810
+ * predicate.
7466
7811
  *
7467
7812
  * @example
7468
7813
  * ```ts
7469
- * import { Effect, Filter, Result } from "effect"
7814
+ * import { Effect } from "effect"
7470
7815
  *
7471
7816
  * // Sync predicate
7472
7817
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7474,25 +7819,22 @@ export declare const filter: {
7474
7819
  * // Effectful predicate
7475
7820
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7476
7821
  *
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
- * )
7822
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7481
7823
  * ```
7482
7824
  *
7483
7825
  * @since 2.0.0
7484
7826
  * @category Filtering
7485
7827
  */
7486
- <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>, options?: {
7828
+ <A, E, R>(predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>, options?: {
7487
7829
  readonly concurrency?: Concurrency | undefined;
7488
- }): (elements: Iterable<A>) => Effect<Array<B>>;
7830
+ }): (iterable: Iterable<A>) => Effect<Array<A>, E, R>;
7489
7831
  /**
7490
- * Filters elements of an iterable using a predicate, refinement, effectful
7491
- * predicate, or `Filter.FilterEffect`.
7832
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7833
+ * predicate.
7492
7834
  *
7493
7835
  * @example
7494
7836
  * ```ts
7495
- * import { Effect, Filter, Result } from "effect"
7837
+ * import { Effect } from "effect"
7496
7838
  *
7497
7839
  * // Sync predicate
7498
7840
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7500,25 +7842,20 @@ export declare const filter: {
7500
7842
  * // Effectful predicate
7501
7843
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7502
7844
  *
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
- * )
7845
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7507
7846
  * ```
7508
7847
  *
7509
7848
  * @since 2.0.0
7510
7849
  * @category Filtering
7511
7850
  */
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>;
7851
+ <A, B extends A>(elements: Iterable<A>, refinement: Predicate.Refinement<A, B>): Effect<Array<B>>;
7515
7852
  /**
7516
- * Filters elements of an iterable using a predicate, refinement, effectful
7517
- * predicate, or `Filter.FilterEffect`.
7853
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7854
+ * predicate.
7518
7855
  *
7519
7856
  * @example
7520
7857
  * ```ts
7521
- * import { Effect, Filter, Result } from "effect"
7858
+ * import { Effect } from "effect"
7522
7859
  *
7523
7860
  * // Sync predicate
7524
7861
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7526,25 +7863,20 @@ export declare const filter: {
7526
7863
  * // Effectful predicate
7527
7864
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7528
7865
  *
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
- * )
7866
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7533
7867
  * ```
7534
7868
  *
7535
7869
  * @since 2.0.0
7536
7870
  * @category Filtering
7537
7871
  */
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>;
7872
+ <A>(elements: Iterable<A>, predicate: Predicate.Predicate<A>): Effect<Array<A>>;
7541
7873
  /**
7542
- * Filters elements of an iterable using a predicate, refinement, effectful
7543
- * predicate, or `Filter.FilterEffect`.
7874
+ * Filters elements of an iterable using a predicate, refinement, or effectful
7875
+ * predicate.
7544
7876
  *
7545
7877
  * @example
7546
7878
  * ```ts
7547
- * import { Effect, Filter, Result } from "effect"
7879
+ * import { Effect } from "effect"
7548
7880
  *
7549
7881
  * // Sync predicate
7550
7882
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -7552,116 +7884,63 @@ export declare const filter: {
7552
7884
  * // Effectful predicate
7553
7885
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7554
7886
  *
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
- * )
7887
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
7559
7888
  * ```
7560
7889
  *
7561
7890
  * @since 2.0.0
7562
7891
  * @category Filtering
7563
7892
  */
7564
- <A, B extends A>(elements: Iterable<A>, refinement: Predicate.Refinement<A, B>): Effect<Array<B>>;
7893
+ <A, E, R>(iterable: Iterable<A>, predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>, options?: {
7894
+ readonly concurrency?: Concurrency | undefined;
7895
+ }): Effect<Array<A>, E, R>;
7896
+ };
7897
+ /**
7898
+ * Filters and maps elements of an iterable with a `Filter`.
7899
+ *
7900
+ * @since 4.0.0
7901
+ * @category Filtering
7902
+ */
7903
+ export declare const filterMap: {
7565
7904
  /**
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)
7905
+ * Filters and maps elements of an iterable with a `Filter`.
7575
7906
  *
7576
- * // Effectful predicate
7577
- * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
7578
- *
7579
- * // FilterEffect
7580
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
7581
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
7582
- * )
7583
- * ```
7584
- *
7585
- * @since 2.0.0
7907
+ * @since 4.0.0
7586
7908
  * @category Filtering
7587
7909
  */
7588
- <A>(elements: Iterable<A>, predicate: Predicate.Predicate<A>): Effect<Array<A>>;
7910
+ <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): (elements: Iterable<A>) => Effect<Array<B>>;
7589
7911
  /**
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"
7596
- *
7597
- * // Sync predicate
7598
- * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
7912
+ * Filters and maps elements of an iterable with a `Filter`.
7599
7913
  *
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
7914
+ * @since 4.0.0
7610
7915
  * @category Filtering
7611
7916
  */
7612
7917
  <A, B, X>(elements: Iterable<A>, filter: Filter.Filter<NoInfer<A>, B, X>): Effect<Array<B>>;
7918
+ };
7919
+ /**
7920
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
7921
+ *
7922
+ * @since 4.0.0
7923
+ * @category Filtering
7924
+ */
7925
+ export declare const filterMapEffect: {
7613
7926
  /**
7614
- * Filters elements of an iterable using a predicate, refinement, effectful
7615
- * predicate, or `Filter.FilterEffect`.
7927
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
7616
7928
  *
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
7929
+ * @since 4.0.0
7634
7930
  * @category Filtering
7635
7931
  */
7636
- <A, B, X, E, R>(elements: Iterable<A>, filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
7932
+ <A, B, X, E, R>(filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
7637
7933
  readonly concurrency?: Concurrency | undefined;
7638
- }): Effect<Array<B>, E, R>;
7934
+ }): (elements: Iterable<A>) => Effect<Array<B>, E, R>;
7639
7935
  /**
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"
7646
- *
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
- * ```
7936
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
7658
7937
  *
7659
- * @since 2.0.0
7938
+ * @since 4.0.0
7660
7939
  * @category Filtering
7661
7940
  */
7662
- <A, E, R>(iterable: Iterable<A>, predicate: (a: NoInfer<A>, i: number) => Effect<boolean, E, R>, options?: {
7941
+ <A, B, X, E, R>(elements: Iterable<A>, filter: Filter.FilterEffect<NoInfer<A>, B, X, E, R>, options?: {
7663
7942
  readonly concurrency?: Concurrency | undefined;
7664
- }): Effect<Array<A>, E, R>;
7943
+ }): Effect<Array<B>, E, R>;
7665
7944
  };
7666
7945
  /**
7667
7946
  * Filters an effect, providing an alternative effect if the predicate fails.
@@ -7755,7 +8034,7 @@ export declare const filterOrElse: {
7755
8034
  * @since 2.0.0
7756
8035
  * @category Filtering
7757
8036
  */
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>;
8037
+ <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
8038
  /**
7760
8039
  * Filters an effect, providing an alternative effect if the predicate fails.
7761
8040
  *
@@ -7817,7 +8096,29 @@ export declare const filterOrElse: {
7817
8096
  * @since 2.0.0
7818
8097
  * @category Filtering
7819
8098
  */
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>;
8099
+ <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>;
8100
+ };
8101
+ /**
8102
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
8103
+ *
8104
+ * @since 4.0.0
8105
+ * @category Filtering
8106
+ */
8107
+ export declare const filterMapOrElse: {
8108
+ /**
8109
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
8110
+ *
8111
+ * @since 4.0.0
8112
+ * @category Filtering
8113
+ */
8114
+ <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>;
8115
+ /**
8116
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
8117
+ *
8118
+ * @since 4.0.0
8119
+ * @category Filtering
8120
+ */
8121
+ <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
8122
  };
7822
8123
  /**
7823
8124
  * Filters an effect, failing with a custom error if the predicate fails.
@@ -7938,7 +8239,7 @@ export declare const filterOrFail: {
7938
8239
  * @since 2.0.0
7939
8240
  * @category Filtering
7940
8241
  */
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>;
8242
+ <A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
7942
8243
  /**
7943
8244
  * Filters an effect, failing with a custom error if the predicate fails.
7944
8245
  *
@@ -7968,7 +8269,7 @@ export declare const filterOrFail: {
7968
8269
  * @since 2.0.0
7969
8270
  * @category Filtering
7970
8271
  */
7971
- <A, B extends A>(refinement: Predicate.Refinement<NoInfer<A>, B>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
8272
+ <A>(predicate: Predicate.Predicate<NoInfer<A>>): <E, R>(self: Effect<A, E, R>) => Effect<A, Cause.NoSuchElementError | E, R>;
7972
8273
  /**
7973
8274
  * Filters an effect, failing with a custom error if the predicate fails.
7974
8275
  *
@@ -7998,7 +8299,7 @@ export declare const filterOrFail: {
7998
8299
  * @since 2.0.0
7999
8300
  * @category Filtering
8000
8301
  */
8001
- <A>(predicate: Predicate.Predicate<NoInfer<A>>): <E, R>(self: Effect<A, E, R>) => Effect<A, Cause.NoSuchElementError | E, R>;
8302
+ <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
8303
  /**
8003
8304
  * Filters an effect, failing with a custom error if the predicate fails.
8004
8305
  *
@@ -8028,7 +8329,7 @@ export declare const filterOrFail: {
8028
8329
  * @since 2.0.0
8029
8330
  * @category Filtering
8030
8331
  */
8031
- <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
8332
+ <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
8333
  /**
8033
8334
  * Filters an effect, failing with a custom error if the predicate fails.
8034
8335
  *
@@ -8058,7 +8359,7 @@ export declare const filterOrFail: {
8058
8359
  * @since 2.0.0
8059
8360
  * @category Filtering
8060
8361
  */
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>;
8362
+ <A, E, R, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>): Effect<B, E | Cause.NoSuchElementError, R>;
8062
8363
  /**
8063
8364
  * Filters an effect, failing with a custom error if the predicate fails.
8064
8365
  *
@@ -8088,127 +8389,43 @@ export declare const filterOrFail: {
8088
8389
  * @since 2.0.0
8089
8390
  * @category Filtering
8090
8391
  */
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>;
8392
+ <A, E, R>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>): Effect<A, E | Cause.NoSuchElementError, R>;
8393
+ };
8394
+ /**
8395
+ * Filters an effect with a `Filter`, failing when the filter fails.
8396
+ *
8397
+ * @since 4.0.0
8398
+ * @category Filtering
8399
+ */
8400
+ export declare const filterMapOrFail: {
8092
8401
  /**
8093
- * Filters an effect, failing with a custom error if the predicate fails.
8094
- *
8095
- * **Details**
8096
- *
8097
- * This function applies a predicate to the result of an effect. If the
8098
- * predicate evaluates to `false`, the effect fails with either a custom
8099
- * error (if `orFailWith` is provided) or a `NoSuchElementError`.
8100
- *
8101
- * @example
8102
- * ```ts
8103
- * import { Effect } from "effect"
8104
- *
8105
- * // An effect that produces a number
8106
- * const program = Effect.succeed(5)
8107
- *
8108
- * // Filter for even numbers, fail for odd numbers
8109
- * const filtered = Effect.filterOrFail(
8110
- * program,
8111
- * (n) => n % 2 === 0,
8112
- * (n) => `Expected even number, got ${n}`
8113
- * )
8402
+ * Filters an effect with a `Filter`, failing when the filter fails.
8114
8403
  *
8115
- * // Result: Effect.fail("Expected even number, got 5")
8116
- * ```
8117
- *
8118
- * @since 2.0.0
8404
+ * @since 4.0.0
8119
8405
  * @category Filtering
8120
8406
  */
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>;
8407
+ <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
8408
  /**
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
- * ```
8409
+ * Filters an effect with a `Filter`, failing when the filter fails.
8147
8410
  *
8148
- * @since 2.0.0
8411
+ * @since 4.0.0
8149
8412
  * @category Filtering
8150
8413
  */
8151
- <A, E, R, B extends A>(self: Effect<A, E, R>, refinement: Predicate.Refinement<NoInfer<A>, B>): Effect<B, E | Cause.NoSuchElementError, R>;
8414
+ <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Effect<A, E, R>) => Effect<B, Cause.NoSuchElementError | E, R>;
8152
8415
  /**
8153
- * Filters an effect, failing with a custom error if the predicate fails.
8154
- *
8155
- * **Details**
8156
- *
8157
- * This function applies a predicate to the result of an effect. If the
8158
- * predicate evaluates to `false`, the effect fails with either a custom
8159
- * error (if `orFailWith` is provided) or a `NoSuchElementError`.
8160
- *
8161
- * @example
8162
- * ```ts
8163
- * import { Effect } from "effect"
8164
- *
8165
- * // An effect that produces a number
8166
- * const program = Effect.succeed(5)
8167
- *
8168
- * // Filter for even numbers, fail for odd numbers
8169
- * const filtered = Effect.filterOrFail(
8170
- * program,
8171
- * (n) => n % 2 === 0,
8172
- * (n) => `Expected even number, got ${n}`
8173
- * )
8174
- *
8175
- * // Result: Effect.fail("Expected even number, got 5")
8176
- * ```
8416
+ * Filters an effect with a `Filter`, failing when the filter fails.
8177
8417
  *
8178
- * @since 2.0.0
8418
+ * @since 4.0.0
8179
8419
  * @category Filtering
8180
8420
  */
8181
- <A, E, R>(self: Effect<A, E, R>, predicate: Predicate.Predicate<NoInfer<A>>): Effect<A, E | Cause.NoSuchElementError, R>;
8421
+ <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
8422
  /**
8183
- * Filters an effect, failing with a custom error if the predicate fails.
8184
- *
8185
- * **Details**
8186
- *
8187
- * This function applies a predicate to the result of an effect. If the
8188
- * predicate evaluates to `false`, the effect fails with either a custom
8189
- * error (if `orFailWith` is provided) or a `NoSuchElementError`.
8190
- *
8191
- * @example
8192
- * ```ts
8193
- * import { Effect } from "effect"
8194
- *
8195
- * // An effect that produces a number
8196
- * const program = Effect.succeed(5)
8197
- *
8198
- * // Filter for even numbers, fail for odd numbers
8199
- * const filtered = Effect.filterOrFail(
8200
- * program,
8201
- * (n) => n % 2 === 0,
8202
- * (n) => `Expected even number, got ${n}`
8203
- * )
8204
- *
8205
- * // Result: Effect.fail("Expected even number, got 5")
8206
- * ```
8423
+ * Filters an effect with a `Filter`, failing when the filter fails.
8207
8424
  *
8208
- * @since 2.0.0
8425
+ * @since 4.0.0
8209
8426
  * @category Filtering
8210
8427
  */
8211
- <A, E, R, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>): Effect<B, E | Cause.NoSuchElementError, R>;
8428
+ <A, E, R, B, X>(self: Effect<A, E, R>, filter: Filter.Filter<A, B, X>): Effect<B, Cause.NoSuchElementError | E, R>;
8212
8429
  };
8213
8430
  /**
8214
8431
  * Conditionally executes an effect based on a boolean condition.
@@ -9733,7 +9950,7 @@ export declare const provideServices: {
9733
9950
  * @since 4.0.0
9734
9951
  * @category ServiceMap
9735
9952
  */
9736
- export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effect<S, never, I>;
9953
+ export declare const service: <I, S>(service: ServiceMap.Key<I, S>) => Effect<S, never, I>;
9737
9954
  /**
9738
9955
  * Optionally accesses a service from the environment.
9739
9956
  *
@@ -9768,7 +9985,7 @@ export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effec
9768
9985
  * @since 2.0.0
9769
9986
  * @category ServiceMap
9770
9987
  */
9771
- export declare const serviceOption: <I, S>(key: ServiceMap.Service<I, S>) => Effect<Option<S>>;
9988
+ export declare const serviceOption: <I, S>(key: ServiceMap.Key<I, S>) => Effect<Option<S>>;
9772
9989
  /**
9773
9990
  * Provides part of the required context while leaving the rest unchanged.
9774
9991
  *
@@ -9950,7 +10167,7 @@ export declare const updateService: {
9950
10167
  * @since 2.0.0
9951
10168
  * @category ServiceMap
9952
10169
  */
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>;
10170
+ <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
10171
  /**
9955
10172
  * Updates the service with the required service entry.
9956
10173
  *
@@ -9979,7 +10196,7 @@ export declare const updateService: {
9979
10196
  * @since 2.0.0
9980
10197
  * @category ServiceMap
9981
10198
  */
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>;
10199
+ <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
10200
  };
9984
10201
  /**
9985
10202
  * The `provideService` function is used to provide an actual
@@ -10072,7 +10289,7 @@ export declare const provideService: {
10072
10289
  * @since 2.0.0
10073
10290
  * @category ServiceMap
10074
10291
  */
10075
- <I, S>(service: ServiceMap.Service<I, S>): {
10292
+ <I, S>(service: ServiceMap.Key<I, S>): {
10076
10293
  /**
10077
10294
  * The `provideService` function is used to provide an actual
10078
10295
  * implementation for a service in the context of an effect.
@@ -10211,7 +10428,7 @@ export declare const provideService: {
10211
10428
  * @since 2.0.0
10212
10429
  * @category ServiceMap
10213
10430
  */
10214
- <I, S>(service: ServiceMap.Service<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
10431
+ <I, S>(service: ServiceMap.Key<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
10215
10432
  /**
10216
10433
  * The `provideService` function is used to provide an actual
10217
10434
  * implementation for a service in the context of an effect.
@@ -10257,7 +10474,7 @@ export declare const provideService: {
10257
10474
  * @since 2.0.0
10258
10475
  * @category ServiceMap
10259
10476
  */
10260
- <A, E, R, I, S>(self: Effect<A, E, R>, service: ServiceMap.Service<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>;
10477
+ <A, E, R, I, S>(self: Effect<A, E, R>, service: ServiceMap.Key<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>;
10261
10478
  };
10262
10479
  /**
10263
10480
  * Provides the effect with the single service it requires. If the effect
@@ -10364,7 +10581,7 @@ export declare const provideServiceEffect: {
10364
10581
  * @since 2.0.0
10365
10582
  * @category ServiceMap
10366
10583
  */
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>;
10584
+ <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
10585
  /**
10369
10586
  * Provides the effect with the single service it requires. If the effect
10370
10587
  * requires more than one service use `provide` instead.
@@ -10417,7 +10634,7 @@ export declare const provideServiceEffect: {
10417
10634
  * @since 2.0.0
10418
10635
  * @category ServiceMap
10419
10636
  */
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>;
10637
+ <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
10638
  };
10422
10639
  /**
10423
10640
  * Sets the concurrency level for parallel operations within an effect.
@@ -10986,7 +11203,7 @@ export declare const onError: {
10986
11203
  };
10987
11204
  /**
10988
11205
  * Runs the finalizer only when this effect fails and the `Cause` matches the
10989
- * filter, passing the filtered failure and the original cause.
11206
+ * provided predicate.
10990
11207
  *
10991
11208
  * @example
10992
11209
  * ```ts
@@ -11010,7 +11227,7 @@ export declare const onError: {
11010
11227
  export declare const onErrorIf: {
11011
11228
  /**
11012
11229
  * Runs the finalizer only when this effect fails and the `Cause` matches the
11013
- * filter, passing the filtered failure and the original cause.
11230
+ * provided predicate.
11014
11231
  *
11015
11232
  * @example
11016
11233
  * ```ts
@@ -11031,10 +11248,10 @@ export declare const onErrorIf: {
11031
11248
  * @since 4.0.0
11032
11249
  * @category Resource Management & Finalization
11033
11250
  */
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>;
11251
+ <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
11252
  /**
11036
11253
  * Runs the finalizer only when this effect fails and the `Cause` matches the
11037
- * filter, passing the filtered failure and the original cause.
11254
+ * provided predicate.
11038
11255
  *
11039
11256
  * @example
11040
11257
  * ```ts
@@ -11055,7 +11272,29 @@ export declare const onErrorIf: {
11055
11272
  * @since 4.0.0
11056
11273
  * @category Resource Management & Finalization
11057
11274
  */
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>;
11275
+ <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>;
11276
+ };
11277
+ /**
11278
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
11279
+ *
11280
+ * @since 4.0.0
11281
+ * @category Resource Management & Finalization
11282
+ */
11283
+ export declare const onErrorFilter: {
11284
+ /**
11285
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
11286
+ *
11287
+ * @since 4.0.0
11288
+ * @category Resource Management & Finalization
11289
+ */
11290
+ <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>;
11291
+ /**
11292
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
11293
+ *
11294
+ * @since 4.0.0
11295
+ * @category Resource Management & Finalization
11296
+ */
11297
+ <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
11298
  };
11060
11299
  /**
11061
11300
  * The low level primitive that powers `onExit`.
@@ -11149,20 +11388,20 @@ export declare const onExit: {
11149
11388
  <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
11389
  };
11151
11390
  /**
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`.
11391
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
11392
+ * predicate.
11155
11393
  *
11156
11394
  * @example
11157
11395
  * ```ts
11158
- * import { Console, Effect, Exit, Filter } from "effect"
11159
- *
11160
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
11396
+ * import { Console, Effect, Exit } from "effect"
11161
11397
  *
11162
11398
  * const program = Effect.onExitIf(
11163
11399
  * Effect.succeed(42),
11164
- * exitFilter,
11165
- * (success) => Console.log(`Succeeded with: ${success.value}`)
11400
+ * Exit.isSuccess,
11401
+ * (exit) =>
11402
+ * Exit.isSuccess(exit)
11403
+ * ? Console.log(`Succeeded with: ${exit.value}`)
11404
+ * : Effect.void
11166
11405
  * )
11167
11406
  * ```
11168
11407
  *
@@ -11171,49 +11410,71 @@ export declare const onExit: {
11171
11410
  */
11172
11411
  export declare const onExitIf: {
11173
11412
  /**
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`.
11413
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
11414
+ * predicate.
11177
11415
  *
11178
11416
  * @example
11179
11417
  * ```ts
11180
- * import { Console, Effect, Exit, Filter } from "effect"
11181
- *
11182
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
11418
+ * import { Console, Effect, Exit } from "effect"
11183
11419
  *
11184
11420
  * const program = Effect.onExitIf(
11185
11421
  * Effect.succeed(42),
11186
- * exitFilter,
11187
- * (success) => Console.log(`Succeeded with: ${success.value}`)
11422
+ * Exit.isSuccess,
11423
+ * (exit) =>
11424
+ * Exit.isSuccess(exit)
11425
+ * ? Console.log(`Succeeded with: ${exit.value}`)
11426
+ * : Effect.void
11188
11427
  * )
11189
11428
  * ```
11190
11429
  *
11191
11430
  * @since 4.0.0
11192
11431
  * @category Resource Management & Finalization
11193
11432
  */
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>;
11433
+ <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
11434
  /**
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`.
11435
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
11436
+ * predicate.
11199
11437
  *
11200
11438
  * @example
11201
11439
  * ```ts
11202
- * import { Console, Effect, Exit, Filter } from "effect"
11203
- *
11204
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
11440
+ * import { Console, Effect, Exit } from "effect"
11205
11441
  *
11206
11442
  * const program = Effect.onExitIf(
11207
11443
  * Effect.succeed(42),
11208
- * exitFilter,
11209
- * (success) => Console.log(`Succeeded with: ${success.value}`)
11444
+ * Exit.isSuccess,
11445
+ * (exit) =>
11446
+ * Exit.isSuccess(exit)
11447
+ * ? Console.log(`Succeeded with: ${exit.value}`)
11448
+ * : Effect.void
11210
11449
  * )
11211
11450
  * ```
11212
11451
  *
11213
11452
  * @since 4.0.0
11214
11453
  * @category Resource Management & Finalization
11215
11454
  */
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>;
11455
+ <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>;
11456
+ };
11457
+ /**
11458
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
11459
+ *
11460
+ * @since 4.0.0
11461
+ * @category Resource Management & Finalization
11462
+ */
11463
+ export declare const onExitFilter: {
11464
+ /**
11465
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
11466
+ *
11467
+ * @since 4.0.0
11468
+ * @category Resource Management & Finalization
11469
+ */
11470
+ <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>;
11471
+ /**
11472
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
11473
+ *
11474
+ * @since 4.0.0
11475
+ * @category Resource Management & Finalization
11476
+ */
11477
+ <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
11478
  };
11218
11479
  /**
11219
11480
  * Returns an effect that lazily computes a result and caches it for subsequent
@@ -11412,7 +11673,7 @@ export declare const cachedWithTTL: {
11412
11673
  * @since 2.0.0
11413
11674
  * @category Caching
11414
11675
  */
11415
- (timeToLive: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<A, E, R>>;
11676
+ (timeToLive: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<A, E, R>>;
11416
11677
  /**
11417
11678
  * Returns an effect that caches its result for a specified `Duration`,
11418
11679
  * known as "timeToLive" (TTL).
@@ -11479,7 +11740,7 @@ export declare const cachedWithTTL: {
11479
11740
  * @since 2.0.0
11480
11741
  * @category Caching
11481
11742
  */
11482
- <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.DurationInput): Effect<Effect<A, E, R>>;
11743
+ <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.Input): Effect<Effect<A, E, R>>;
11483
11744
  };
11484
11745
  /**
11485
11746
  * Caches an effect's result for a specified duration and allows manual
@@ -11620,7 +11881,7 @@ export declare const cachedInvalidateWithTTL: {
11620
11881
  * @since 2.0.0
11621
11882
  * @category Caching
11622
11883
  */
11623
- (timeToLive: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<[Effect<A, E, R>, Effect<void>]>;
11884
+ (timeToLive: Duration.Input): <A, E, R>(self: Effect<A, E, R>) => Effect<[Effect<A, E, R>, Effect<void>]>;
11624
11885
  /**
11625
11886
  * Caches an effect's result for a specified duration and allows manual
11626
11887
  * invalidation before expiration.
@@ -11690,7 +11951,7 @@ export declare const cachedInvalidateWithTTL: {
11690
11951
  * @since 2.0.0
11691
11952
  * @category Caching
11692
11953
  */
11693
- <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.DurationInput): Effect<[Effect<A, E, R>, Effect<void>]>;
11954
+ <A, E, R>(self: Effect<A, E, R>, timeToLive: Duration.Input): Effect<[Effect<A, E, R>, Effect<void>]>;
11694
11955
  };
11695
11956
  /**
11696
11957
  * Returns an effect that is immediately interrupted.
@@ -11890,232 +12151,6 @@ export declare const uninterruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(ef
11890
12151
  * @category Interruption
11891
12152
  */
11892
12153
  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
12154
  /**
12120
12155
  * @since 2.0.0
12121
12156
  * @category Repetition / Recursion
@@ -15772,7 +15807,7 @@ export declare const clockWith: <A, E, R>(f: (clock: Clock) => Effect<A, E, R>)
15772
15807
  * @since 2.0.0
15773
15808
  * @category Logging
15774
15809
  */
15775
- export declare const logWithLevel: (level?: LogLevel) => (...message: ReadonlyArray<any>) => Effect<void>;
15810
+ export declare const logWithLevel: (level?: Severity) => (...message: ReadonlyArray<any>) => Effect<void>;
15776
15811
  /**
15777
15812
  * Logs one or more messages using the default log level.
15778
15813
  *
@@ -16039,6 +16074,85 @@ export declare const annotateLogs: {
16039
16074
  <A, E, R>(effect: Effect<A, E, R>, key: string, value: unknown): Effect<A, E, R>;
16040
16075
  <A, E, R>(effect: Effect<A, E, R>, values: Record<string, unknown>): Effect<A, E, R>;
16041
16076
  };
16077
+ /**
16078
+ * Adds log annotations to the current scope.
16079
+ *
16080
+ * This differs from `annotateLogs`, which only annotates a specific effect.
16081
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
16082
+ * restores the previous annotations when the scope closes.
16083
+ *
16084
+ * @example
16085
+ * ```ts
16086
+ * import { Effect } from "effect"
16087
+ *
16088
+ * const program = Effect.scoped(
16089
+ * Effect.gen(function*() {
16090
+ * yield* Effect.log("before")
16091
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
16092
+ * yield* Effect.log("inside scope")
16093
+ * })
16094
+ * )
16095
+ *
16096
+ * Effect.runPromise(program)
16097
+ * ```
16098
+ *
16099
+ * @since 4.0.0
16100
+ * @category Logging
16101
+ */
16102
+ export declare const annotateLogsScoped: {
16103
+ /**
16104
+ * Adds log annotations to the current scope.
16105
+ *
16106
+ * This differs from `annotateLogs`, which only annotates a specific effect.
16107
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
16108
+ * restores the previous annotations when the scope closes.
16109
+ *
16110
+ * @example
16111
+ * ```ts
16112
+ * import { Effect } from "effect"
16113
+ *
16114
+ * const program = Effect.scoped(
16115
+ * Effect.gen(function*() {
16116
+ * yield* Effect.log("before")
16117
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
16118
+ * yield* Effect.log("inside scope")
16119
+ * })
16120
+ * )
16121
+ *
16122
+ * Effect.runPromise(program)
16123
+ * ```
16124
+ *
16125
+ * @since 4.0.0
16126
+ * @category Logging
16127
+ */
16128
+ (key: string, value: unknown): Effect<void, never, Scope>;
16129
+ /**
16130
+ * Adds log annotations to the current scope.
16131
+ *
16132
+ * This differs from `annotateLogs`, which only annotates a specific effect.
16133
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
16134
+ * restores the previous annotations when the scope closes.
16135
+ *
16136
+ * @example
16137
+ * ```ts
16138
+ * import { Effect } from "effect"
16139
+ *
16140
+ * const program = Effect.scoped(
16141
+ * Effect.gen(function*() {
16142
+ * yield* Effect.log("before")
16143
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
16144
+ * yield* Effect.log("inside scope")
16145
+ * })
16146
+ * )
16147
+ *
16148
+ * Effect.runPromise(program)
16149
+ * ```
16150
+ *
16151
+ * @since 4.0.0
16152
+ * @category Logging
16153
+ */
16154
+ (values: Record<string, unknown>): Effect<void, never, Scope>;
16155
+ };
16042
16156
  /**
16043
16157
  * Adds a span to each log line in this effect.
16044
16158
  *
@@ -17281,118 +17395,63 @@ declare const Transaction_base: ServiceMap.ServiceClass<Transaction, "effect/Eff
17281
17395
  export declare class Transaction extends Transaction_base {
17282
17396
  }
17283
17397
  /**
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.
17291
- *
17292
- * - any of the accessed transactional values change during the execution of the transaction
17293
- * due to a different transaction committing before the current.
17398
+ * Accesses the current transaction state within an active transaction.
17294
17399
  *
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.
17400
+ * This function requires `Transaction` in the context and does NOT create or strip
17401
+ * transaction boundaries. Use it to interact with the transaction journal (e.g. in
17402
+ * `TxRef` internals). To define a transaction boundary, use {@link transaction}.
17297
17403
  *
17298
17404
  * @example
17299
17405
  * ```ts
17300
17406
  * import { Effect, TxRef } from "effect"
17301
17407
  *
17302
17408
  * 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}`)
17409
+ * const ref = yield* Effect.transaction(TxRef.make(0))
17337
17410
  *
17411
+ * yield* Effect.transaction(Effect.gen(function*() {
17338
17412
  * yield* TxRef.set(ref, 42)
17339
17413
  * return yield* TxRef.get(ref)
17340
- * })
17341
- * )
17342
- *
17343
- * Effect.runPromise(program).then(console.log) // 42
17414
+ * }))
17415
+ * })
17344
17416
  * ```
17345
17417
  *
17346
17418
  * @since 4.0.0
17347
17419
  * @category Transactions
17348
17420
  */
17349
- export declare const atomicWith: <A, E, R>(f: (state: Transaction["Service"]) => Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
17421
+ export declare const withTxState: <A, E, R>(f: (state: Transaction["Service"]) => Effect<A, E, R>) => Effect<A, E, R | Transaction>;
17350
17422
  /**
17351
- * Creates an isolated transaction that never composes with parent transactions.
17423
+ * Defines a transaction boundary. Transactions are "all or nothing" with respect to changes
17424
+ * made to transactional values (i.e. TxRef) that occur within the transaction body.
17352
17425
  *
17353
- * **Details**
17426
+ * In Effect transactions are optimistic with retry, that means transactions are retried when:
17354
17427
  *
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.
17428
+ * - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
17429
+ * accessed transactional values changes.
17358
17430
  *
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
17431
+ * - any of the accessed transactional values change during the execution of the transaction
17432
+ * due to a different transaction committing before the current.
17364
17433
  *
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
17434
+ * Each call to `transaction` always creates a new isolated transaction boundary with its own
17435
+ * journal and retry logic.
17369
17436
  *
17370
17437
  * @example
17371
17438
  * ```ts
17372
17439
  * import { Effect, TxRef } from "effect"
17373
17440
  *
17374
17441
  * const program = Effect.gen(function*() {
17375
- * const ref1 = yield* TxRef.make(0)
17376
- * const ref2 = yield* TxRef.make(100)
17442
+ * const ref1 = yield* Effect.transaction(TxRef.make(0))
17443
+ * const ref2 = yield* Effect.transaction(TxRef.make(0))
17377
17444
  *
17378
- * // Nested atomic transaction - ref1 will be part of outer transaction
17379
- * yield* Effect.atomic(Effect.gen(function*() {
17380
- * yield* TxRef.set(ref1, 10)
17381
- *
17382
- * // This atomic operation composes with the parent
17383
- * yield* Effect.atomic(Effect.gen(function*() {
17384
- * yield* TxRef.set(ref1, 20) // Part of same transaction
17385
- * }))
17386
- * }))
17387
- *
17388
- * // Isolated transaction - ref2 will be in its own transaction
17445
+ * // All operations within transaction block succeed or fail together
17389
17446
  * yield* Effect.transaction(Effect.gen(function*() {
17390
- * yield* TxRef.set(ref2, 200)
17447
+ * yield* TxRef.set(ref1, 10)
17448
+ * yield* TxRef.set(ref2, 20)
17449
+ * const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
17450
+ * console.log(`Transaction sum: ${sum}`)
17391
17451
  * }))
17392
17452
  *
17393
- * const val1 = yield* TxRef.get(ref1) // 20
17394
- * const val2 = yield* TxRef.get(ref2) // 200
17395
- * return { ref1: val1, ref2: val2 }
17453
+ * console.log(`Final ref1: ${yield* Effect.transaction(TxRef.get(ref1))}`) // 10
17454
+ * console.log(`Final ref2: ${yield* Effect.transaction(TxRef.get(ref2))}`) // 20
17396
17455
  * })
17397
17456
  * ```
17398
17457
  *
@@ -17401,34 +17460,21 @@ export declare const atomicWith: <A, E, R>(f: (state: Transaction["Service"]) =>
17401
17460
  */
17402
17461
  export declare const transaction: <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, Exclude<R, Transaction>>;
17403
17462
  /**
17404
- * Executes a function within an isolated transaction context, providing access to the transaction state.
17463
+ * Like {@link transaction} but provides access to the transaction state.
17405
17464
  *
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.
17465
+ * Always creates a new isolated transaction boundary with its own journal and retry logic.
17408
17466
  *
17409
17467
  * @example
17410
17468
  * ```ts
17411
17469
  * import { Effect, TxRef } from "effect"
17412
17470
  *
17413
- * const program = Effect.transactionWith((txState) =>
17471
+ * const program = Effect.transactionWith((_txState) =>
17414
17472
  * Effect.gen(function*() {
17415
17473
  * 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
17474
  * yield* TxRef.set(ref, 42)
17421
17475
  * return yield* TxRef.get(ref)
17422
17476
  * })
17423
17477
  * )
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
17478
  * ```
17433
17479
  *
17434
17480
  * @since 4.0.0
@@ -17450,16 +17496,16 @@ export declare const transactionWith: <A, E, R>(f: (state: Transaction["Service"
17450
17496
  *
17451
17497
  * const program = Effect.gen(function*() {
17452
17498
  * // create a transactional reference
17453
- * const ref = yield* TxRef.make(0)
17499
+ * const ref = yield* Effect.transaction(TxRef.make(0))
17454
17500
  *
17455
17501
  * // forks a fiber that increases the value of `ref` every 100 millis
17456
17502
  * yield* Effect.forkChild(Effect.forever(
17457
17503
  * // update to transactional value
17458
- * TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis"))
17504
+ * Effect.transaction(TxRef.update(ref, (n) => n + 1)).pipe(Effect.delay("100 millis"))
17459
17505
  * ))
17460
17506
  *
17461
17507
  * // the following will retry 10 times until the `ref` value is 10
17462
- * yield* Effect.atomic(Effect.gen(function*() {
17508
+ * yield* Effect.transaction(Effect.gen(function*() {
17463
17509
  * const value = yield* TxRef.get(ref)
17464
17510
  * if (value < 10) {
17465
17511
  * yield* Effect.log(`retry due to value: ${value}`)