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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1512) hide show
  1. package/dist/Array.d.ts +213 -385
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +149 -102
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +82 -45
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +105 -52
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +39 -32
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +36 -33
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Brand.d.ts +3 -5
  14. package/dist/Brand.d.ts.map +1 -1
  15. package/dist/Brand.js +1 -1
  16. package/dist/Brand.js.map +1 -1
  17. package/dist/Cache.d.ts +14 -45
  18. package/dist/Cache.d.ts.map +1 -1
  19. package/dist/Cache.js +21 -47
  20. package/dist/Cache.js.map +1 -1
  21. package/dist/Cause.d.ts +54 -23
  22. package/dist/Cause.d.ts.map +1 -1
  23. package/dist/Cause.js +108 -10
  24. package/dist/Cause.js.map +1 -1
  25. package/dist/Channel.d.ts +166 -48
  26. package/dist/Channel.d.ts.map +1 -1
  27. package/dist/Channel.js +182 -91
  28. package/dist/Channel.js.map +1 -1
  29. package/dist/Chunk.d.ts +112 -304
  30. package/dist/Chunk.d.ts.map +1 -1
  31. package/dist/Chunk.js +56 -88
  32. package/dist/Chunk.js.map +1 -1
  33. package/dist/Clock.d.ts +2 -2
  34. package/dist/Clock.d.ts.map +1 -1
  35. package/dist/Clock.js.map +1 -1
  36. package/dist/Combiner.d.ts +280 -13
  37. package/dist/Combiner.d.ts.map +1 -1
  38. package/dist/Combiner.js +198 -7
  39. package/dist/Combiner.js.map +1 -1
  40. package/dist/Config.d.ts +171 -11
  41. package/dist/Config.d.ts.map +1 -1
  42. package/dist/Config.js +69 -11
  43. package/dist/Config.js.map +1 -1
  44. package/dist/ConfigProvider.d.ts +6 -6
  45. package/dist/ConfigProvider.d.ts.map +1 -1
  46. package/dist/ConfigProvider.js +5 -5
  47. package/dist/ConfigProvider.js.map +1 -1
  48. package/dist/Console.d.ts +2 -2
  49. package/dist/Console.d.ts.map +1 -1
  50. package/dist/Console.js.map +1 -1
  51. package/dist/Context.d.ts +1150 -0
  52. package/dist/Context.d.ts.map +1 -0
  53. package/dist/{ServiceMap.js → Context.js} +181 -165
  54. package/dist/Context.js.map +1 -0
  55. package/dist/Cron.d.ts +11 -7
  56. package/dist/Cron.d.ts.map +1 -1
  57. package/dist/Cron.js +120 -63
  58. package/dist/Cron.js.map +1 -1
  59. package/dist/Data.d.ts +535 -366
  60. package/dist/Data.d.ts.map +1 -1
  61. package/dist/Data.js +132 -79
  62. package/dist/Data.js.map +1 -1
  63. package/dist/DateTime.d.ts +74 -255
  64. package/dist/DateTime.d.ts.map +1 -1
  65. package/dist/DateTime.js +17 -62
  66. package/dist/DateTime.js.map +1 -1
  67. package/dist/Deferred.d.ts +12 -5
  68. package/dist/Deferred.d.ts.map +1 -1
  69. package/dist/Deferred.js +13 -5
  70. package/dist/Deferred.js.map +1 -1
  71. package/dist/Duration.d.ts +62 -32
  72. package/dist/Duration.d.ts.map +1 -1
  73. package/dist/Duration.js +109 -79
  74. package/dist/Duration.js.map +1 -1
  75. package/dist/Effect.d.ts +1377 -1147
  76. package/dist/Effect.d.ts.map +1 -1
  77. package/dist/Effect.js +465 -446
  78. package/dist/Effect.js.map +1 -1
  79. package/dist/Encoding.d.ts +194 -0
  80. package/dist/Encoding.d.ts.map +1 -0
  81. package/dist/Encoding.js +352 -0
  82. package/dist/Encoding.js.map +1 -0
  83. package/dist/Equal.d.ts +276 -109
  84. package/dist/Equal.d.ts.map +1 -1
  85. package/dist/Equal.js +140 -48
  86. package/dist/Equal.js.map +1 -1
  87. package/dist/Equivalence.d.ts +60 -3
  88. package/dist/Equivalence.d.ts.map +1 -1
  89. package/dist/Equivalence.js +70 -13
  90. package/dist/Equivalence.js.map +1 -1
  91. package/dist/ErrorReporter.d.ts +374 -0
  92. package/dist/ErrorReporter.d.ts.map +1 -0
  93. package/dist/ErrorReporter.js +245 -0
  94. package/dist/ErrorReporter.js.map +1 -0
  95. package/dist/ExecutionPlan.d.ts +6 -6
  96. package/dist/ExecutionPlan.d.ts.map +1 -1
  97. package/dist/ExecutionPlan.js +4 -4
  98. package/dist/ExecutionPlan.js.map +1 -1
  99. package/dist/Exit.d.ts +24 -12
  100. package/dist/Exit.d.ts.map +1 -1
  101. package/dist/Exit.js +8 -4
  102. package/dist/Exit.js.map +1 -1
  103. package/dist/Fiber.d.ts +10 -8
  104. package/dist/Fiber.d.ts.map +1 -1
  105. package/dist/Fiber.js.map +1 -1
  106. package/dist/FiberHandle.d.ts +11 -10
  107. package/dist/FiberHandle.d.ts.map +1 -1
  108. package/dist/FiberHandle.js +12 -11
  109. package/dist/FiberHandle.js.map +1 -1
  110. package/dist/FiberMap.d.ts +22 -21
  111. package/dist/FiberMap.d.ts.map +1 -1
  112. package/dist/FiberMap.js +10 -10
  113. package/dist/FiberMap.js.map +1 -1
  114. package/dist/FiberSet.d.ts +2 -2
  115. package/dist/FiberSet.d.ts.map +1 -1
  116. package/dist/FiberSet.js +4 -4
  117. package/dist/FiberSet.js.map +1 -1
  118. package/dist/FileSystem.d.ts +20 -19
  119. package/dist/FileSystem.d.ts.map +1 -1
  120. package/dist/FileSystem.js +17 -13
  121. package/dist/FileSystem.js.map +1 -1
  122. package/dist/Filter.d.ts +4 -37
  123. package/dist/Filter.d.ts.map +1 -1
  124. package/dist/Filter.js +0 -13
  125. package/dist/Filter.js.map +1 -1
  126. package/dist/Formatter.d.ts +131 -47
  127. package/dist/Formatter.d.ts.map +1 -1
  128. package/dist/Formatter.js +229 -51
  129. package/dist/Formatter.js.map +1 -1
  130. package/dist/Function.d.ts +1 -9
  131. package/dist/Function.d.ts.map +1 -1
  132. package/dist/Function.js +2 -10
  133. package/dist/Function.js.map +1 -1
  134. package/dist/Graph.d.ts +65 -65
  135. package/dist/Graph.d.ts.map +1 -1
  136. package/dist/Graph.js +60 -62
  137. package/dist/Graph.js.map +1 -1
  138. package/dist/Hash.js +1 -1
  139. package/dist/Hash.js.map +1 -1
  140. package/dist/HashMap.d.ts +26 -19
  141. package/dist/HashMap.d.ts.map +1 -1
  142. package/dist/HashMap.js +7 -5
  143. package/dist/HashMap.js.map +1 -1
  144. package/dist/Iterable.d.ts +50 -50
  145. package/dist/Iterable.d.ts.map +1 -1
  146. package/dist/Iterable.js +106 -34
  147. package/dist/Iterable.js.map +1 -1
  148. package/dist/JsonSchema.d.ts +299 -10
  149. package/dist/JsonSchema.d.ts.map +1 -1
  150. package/dist/JsonSchema.js +323 -4
  151. package/dist/JsonSchema.js.map +1 -1
  152. package/dist/Latch.d.ts +175 -0
  153. package/dist/Latch.d.ts.map +1 -0
  154. package/dist/Latch.js +130 -0
  155. package/dist/Latch.js.map +1 -0
  156. package/dist/Layer.d.ts +599 -379
  157. package/dist/Layer.d.ts.map +1 -1
  158. package/dist/Layer.js +249 -180
  159. package/dist/Layer.js.map +1 -1
  160. package/dist/LayerMap.d.ts +27 -26
  161. package/dist/LayerMap.d.ts.map +1 -1
  162. package/dist/LayerMap.js +21 -18
  163. package/dist/LayerMap.js.map +1 -1
  164. package/dist/LogLevel.d.ts +32 -0
  165. package/dist/LogLevel.d.ts.map +1 -1
  166. package/dist/LogLevel.js +28 -100
  167. package/dist/LogLevel.js.map +1 -1
  168. package/dist/Logger.d.ts +31 -97
  169. package/dist/Logger.d.ts.map +1 -1
  170. package/dist/Logger.js +2 -3
  171. package/dist/Logger.js.map +1 -1
  172. package/dist/ManagedRuntime.d.ts +8 -8
  173. package/dist/ManagedRuntime.d.ts.map +1 -1
  174. package/dist/ManagedRuntime.js +34 -25
  175. package/dist/ManagedRuntime.js.map +1 -1
  176. package/dist/Metric.d.ts +23 -25
  177. package/dist/Metric.d.ts.map +1 -1
  178. package/dist/Metric.js +24 -26
  179. package/dist/Metric.js.map +1 -1
  180. package/dist/MutableHashMap.d.ts +7 -0
  181. package/dist/MutableHashMap.d.ts.map +1 -1
  182. package/dist/MutableHashMap.js +8 -0
  183. package/dist/MutableHashMap.js.map +1 -1
  184. package/dist/MutableHashSet.d.ts +7 -0
  185. package/dist/MutableHashSet.d.ts.map +1 -1
  186. package/dist/MutableHashSet.js +8 -0
  187. package/dist/MutableHashSet.js.map +1 -1
  188. package/dist/MutableList.d.ts.map +1 -1
  189. package/dist/MutableList.js +3 -0
  190. package/dist/MutableList.js.map +1 -1
  191. package/dist/Newtype.d.ts +291 -0
  192. package/dist/Newtype.d.ts.map +1 -0
  193. package/dist/Newtype.js +161 -0
  194. package/dist/Newtype.js.map +1 -0
  195. package/dist/Number.d.ts +74 -18
  196. package/dist/Number.d.ts.map +1 -1
  197. package/dist/Number.js +46 -18
  198. package/dist/Number.js.map +1 -1
  199. package/dist/Optic.d.ts +947 -18
  200. package/dist/Optic.d.ts.map +1 -1
  201. package/dist/Optic.js +454 -5
  202. package/dist/Optic.js.map +1 -1
  203. package/dist/Option.d.ts +25 -16
  204. package/dist/Option.d.ts.map +1 -1
  205. package/dist/Option.js +15 -9
  206. package/dist/Option.js.map +1 -1
  207. package/dist/Order.d.ts +6 -1
  208. package/dist/Order.d.ts.map +1 -1
  209. package/dist/Order.js +19 -14
  210. package/dist/Order.js.map +1 -1
  211. package/dist/PartitionedSemaphore.d.ts +146 -15
  212. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  213. package/dist/PartitionedSemaphore.js +174 -61
  214. package/dist/PartitionedSemaphore.js.map +1 -1
  215. package/dist/Path.d.ts +2 -2
  216. package/dist/Path.d.ts.map +1 -1
  217. package/dist/Path.js +2 -2
  218. package/dist/Path.js.map +1 -1
  219. package/dist/Pipeable.d.ts +17 -0
  220. package/dist/Pipeable.d.ts.map +1 -1
  221. package/dist/Pipeable.js +19 -1
  222. package/dist/Pipeable.js.map +1 -1
  223. package/dist/PlatformError.d.ts +2 -2
  224. package/dist/Pool.d.ts +6 -4
  225. package/dist/Pool.d.ts.map +1 -1
  226. package/dist/Pool.js +11 -9
  227. package/dist/Pool.js.map +1 -1
  228. package/dist/PubSub.d.ts +8 -6
  229. package/dist/PubSub.d.ts.map +1 -1
  230. package/dist/PubSub.js +18 -10
  231. package/dist/PubSub.js.map +1 -1
  232. package/dist/Pull.d.ts.map +1 -1
  233. package/dist/Pull.js +1 -1
  234. package/dist/Pull.js.map +1 -1
  235. package/dist/Queue.d.ts +9 -6
  236. package/dist/Queue.d.ts.map +1 -1
  237. package/dist/Queue.js +7 -5
  238. package/dist/Queue.js.map +1 -1
  239. package/dist/Random.d.ts +36 -2
  240. package/dist/Random.d.ts.map +1 -1
  241. package/dist/Random.js +46 -35
  242. package/dist/Random.js.map +1 -1
  243. package/dist/RcMap.d.ts +4 -4
  244. package/dist/RcMap.d.ts.map +1 -1
  245. package/dist/RcMap.js +13 -13
  246. package/dist/RcMap.js.map +1 -1
  247. package/dist/RcRef.d.ts +1 -1
  248. package/dist/RcRef.d.ts.map +1 -1
  249. package/dist/Record.d.ts +63 -160
  250. package/dist/Record.d.ts.map +1 -1
  251. package/dist/Record.js +37 -56
  252. package/dist/Record.js.map +1 -1
  253. package/dist/Redactable.d.ts +139 -62
  254. package/dist/Redactable.d.ts.map +1 -1
  255. package/dist/Redactable.js +59 -55
  256. package/dist/Redactable.js.map +1 -1
  257. package/dist/Reducer.d.ts +166 -7
  258. package/dist/Reducer.d.ts.map +1 -1
  259. package/dist/Reducer.js +135 -1
  260. package/dist/Reducer.js.map +1 -1
  261. package/dist/References.d.ts +257 -229
  262. package/dist/References.d.ts.map +1 -1
  263. package/dist/References.js +240 -259
  264. package/dist/References.js.map +1 -1
  265. package/dist/Request.d.ts +6 -6
  266. package/dist/Request.d.ts.map +1 -1
  267. package/dist/Request.js +2 -1
  268. package/dist/Request.js.map +1 -1
  269. package/dist/RequestResolver.d.ts +25 -45
  270. package/dist/RequestResolver.d.ts.map +1 -1
  271. package/dist/RequestResolver.js +15 -36
  272. package/dist/RequestResolver.js.map +1 -1
  273. package/dist/Resource.d.ts +0 -3
  274. package/dist/Resource.d.ts.map +1 -1
  275. package/dist/Resource.js +5 -4
  276. package/dist/Resource.js.map +1 -1
  277. package/dist/Result.d.ts +1 -1
  278. package/dist/Result.d.ts.map +1 -1
  279. package/dist/Result.js +1 -2
  280. package/dist/Result.js.map +1 -1
  281. package/dist/Runtime.d.ts +66 -0
  282. package/dist/Runtime.d.ts.map +1 -1
  283. package/dist/Runtime.js +79 -6
  284. package/dist/Runtime.js.map +1 -1
  285. package/dist/Schedule.d.ts +176 -293
  286. package/dist/Schedule.d.ts.map +1 -1
  287. package/dist/Schedule.js +162 -136
  288. package/dist/Schedule.js.map +1 -1
  289. package/dist/Scheduler.d.ts +36 -125
  290. package/dist/Scheduler.d.ts.map +1 -1
  291. package/dist/Scheduler.js +37 -126
  292. package/dist/Scheduler.js.map +1 -1
  293. package/dist/Schema.d.ts +3326 -383
  294. package/dist/Schema.d.ts.map +1 -1
  295. package/dist/Schema.js +2315 -283
  296. package/dist/Schema.js.map +1 -1
  297. package/dist/SchemaAST.d.ts +13 -2
  298. package/dist/SchemaAST.d.ts.map +1 -1
  299. package/dist/SchemaAST.js +340 -257
  300. package/dist/SchemaAST.js.map +1 -1
  301. package/dist/SchemaGetter.d.ts +57 -15
  302. package/dist/SchemaGetter.d.ts.map +1 -1
  303. package/dist/SchemaGetter.js +85 -25
  304. package/dist/SchemaGetter.js.map +1 -1
  305. package/dist/SchemaIssue.d.ts.map +1 -1
  306. package/dist/SchemaIssue.js +29 -11
  307. package/dist/SchemaIssue.js.map +1 -1
  308. package/dist/SchemaParser.d.ts +44 -54
  309. package/dist/SchemaParser.d.ts.map +1 -1
  310. package/dist/SchemaParser.js +69 -4
  311. package/dist/SchemaParser.js.map +1 -1
  312. package/dist/SchemaRepresentation.d.ts +46 -45
  313. package/dist/SchemaRepresentation.d.ts.map +1 -1
  314. package/dist/SchemaRepresentation.js +65 -38
  315. package/dist/SchemaRepresentation.js.map +1 -1
  316. package/dist/SchemaTransformation.d.ts +252 -3
  317. package/dist/SchemaTransformation.d.ts.map +1 -1
  318. package/dist/SchemaTransformation.js +319 -13
  319. package/dist/SchemaTransformation.js.map +1 -1
  320. package/dist/Scope.d.ts +2 -2
  321. package/dist/Scope.d.ts.map +1 -1
  322. package/dist/Scope.js.map +1 -1
  323. package/dist/ScopedCache.d.ts +2 -2
  324. package/dist/ScopedCache.d.ts.map +1 -1
  325. package/dist/ScopedCache.js +5 -5
  326. package/dist/ScopedCache.js.map +1 -1
  327. package/dist/Semaphore.d.ts +307 -0
  328. package/dist/Semaphore.d.ts.map +1 -0
  329. package/dist/Semaphore.js +220 -0
  330. package/dist/Semaphore.js.map +1 -0
  331. package/dist/Sink.d.ts +22 -19
  332. package/dist/Sink.d.ts.map +1 -1
  333. package/dist/Sink.js +54 -7
  334. package/dist/Sink.js.map +1 -1
  335. package/dist/Stdio.d.ts +18 -6
  336. package/dist/Stdio.d.ts.map +1 -1
  337. package/dist/Stdio.js +20 -2
  338. package/dist/Stdio.js.map +1 -1
  339. package/dist/Stream.d.ts +465 -542
  340. package/dist/Stream.d.ts.map +1 -1
  341. package/dist/Stream.js +321 -144
  342. package/dist/Stream.js.map +1 -1
  343. package/dist/String.d.ts +114 -47
  344. package/dist/String.d.ts.map +1 -1
  345. package/dist/String.js +29 -47
  346. package/dist/String.js.map +1 -1
  347. package/dist/Struct.d.ts +23 -7
  348. package/dist/Struct.d.ts.map +1 -1
  349. package/dist/Struct.js +22 -0
  350. package/dist/Struct.js.map +1 -1
  351. package/dist/SubscriptionRef.d.ts +3 -3
  352. package/dist/SubscriptionRef.d.ts.map +1 -1
  353. package/dist/SubscriptionRef.js +85 -117
  354. package/dist/SubscriptionRef.js.map +1 -1
  355. package/dist/SynchronizedRef.d.ts +2 -1
  356. package/dist/SynchronizedRef.d.ts.map +1 -1
  357. package/dist/SynchronizedRef.js +2 -1
  358. package/dist/SynchronizedRef.js.map +1 -1
  359. package/dist/Terminal.d.ts +5 -4
  360. package/dist/Terminal.d.ts.map +1 -1
  361. package/dist/Terminal.js +2 -2
  362. package/dist/Terminal.js.map +1 -1
  363. package/dist/Tracer.d.ts +21 -20
  364. package/dist/Tracer.d.ts.map +1 -1
  365. package/dist/Tracer.js +13 -9
  366. package/dist/Tracer.js.map +1 -1
  367. package/dist/Trie.d.ts +44 -31
  368. package/dist/Trie.d.ts.map +1 -1
  369. package/dist/Trie.js +13 -9
  370. package/dist/Trie.js.map +1 -1
  371. package/dist/TxChunk.d.ts +4 -4
  372. package/dist/TxChunk.d.ts.map +1 -1
  373. package/dist/TxChunk.js +4 -4
  374. package/dist/TxChunk.js.map +1 -1
  375. package/dist/TxDeferred.d.ts +328 -0
  376. package/dist/TxDeferred.d.ts.map +1 -0
  377. package/dist/TxDeferred.js +197 -0
  378. package/dist/TxDeferred.js.map +1 -0
  379. package/dist/TxHashMap.d.ts +105 -86
  380. package/dist/TxHashMap.d.ts.map +1 -1
  381. package/dist/TxHashMap.js +51 -44
  382. package/dist/TxHashMap.js.map +1 -1
  383. package/dist/TxHashSet.d.ts +2 -2
  384. package/dist/TxHashSet.d.ts.map +1 -1
  385. package/dist/TxHashSet.js +16 -15
  386. package/dist/TxHashSet.js.map +1 -1
  387. package/dist/TxPriorityQueue.d.ts +609 -0
  388. package/dist/TxPriorityQueue.d.ts.map +1 -0
  389. package/dist/TxPriorityQueue.js +416 -0
  390. package/dist/TxPriorityQueue.js.map +1 -0
  391. package/dist/TxPubSub.d.ts +585 -0
  392. package/dist/TxPubSub.d.ts.map +1 -0
  393. package/dist/TxPubSub.js +521 -0
  394. package/dist/TxPubSub.js.map +1 -0
  395. package/dist/TxQueue.d.ts +1 -1
  396. package/dist/TxQueue.d.ts.map +1 -1
  397. package/dist/TxQueue.js +42 -57
  398. package/dist/TxQueue.js.map +1 -1
  399. package/dist/TxReentrantLock.d.ts +500 -0
  400. package/dist/TxReentrantLock.d.ts.map +1 -0
  401. package/dist/TxReentrantLock.js +481 -0
  402. package/dist/TxReentrantLock.js.map +1 -0
  403. package/dist/TxRef.d.ts +14 -20
  404. package/dist/TxRef.d.ts.map +1 -1
  405. package/dist/TxRef.js +8 -10
  406. package/dist/TxRef.js.map +1 -1
  407. package/dist/TxSemaphore.d.ts +162 -2
  408. package/dist/TxSemaphore.d.ts.map +1 -1
  409. package/dist/TxSemaphore.js +25 -10
  410. package/dist/TxSemaphore.js.map +1 -1
  411. package/dist/TxSubscriptionRef.d.ts +508 -0
  412. package/dist/TxSubscriptionRef.d.ts.map +1 -0
  413. package/dist/TxSubscriptionRef.js +293 -0
  414. package/dist/TxSubscriptionRef.js.map +1 -0
  415. package/dist/Types.d.ts +83 -17
  416. package/dist/Types.d.ts.map +1 -1
  417. package/dist/Unify.d.ts +8 -2
  418. package/dist/Unify.d.ts.map +1 -1
  419. package/dist/Unify.js.map +1 -1
  420. package/dist/Utils.d.ts +137 -65
  421. package/dist/Utils.d.ts.map +1 -1
  422. package/dist/Utils.js +38 -66
  423. package/dist/Utils.js.map +1 -1
  424. package/dist/index.d.ts +888 -71
  425. package/dist/index.d.ts.map +1 -1
  426. package/dist/index.js +888 -71
  427. package/dist/index.js.map +1 -1
  428. package/dist/internal/core.js +11 -3
  429. package/dist/internal/core.js.map +1 -1
  430. package/dist/internal/dateTime.js +77 -71
  431. package/dist/internal/dateTime.js.map +1 -1
  432. package/dist/internal/effect.js +485 -325
  433. package/dist/internal/effect.js.map +1 -1
  434. package/dist/internal/hashMap.js +7 -5
  435. package/dist/internal/hashMap.js.map +1 -1
  436. package/dist/internal/layer.js +3 -3
  437. package/dist/internal/layer.js.map +1 -1
  438. package/dist/internal/option.js +6 -0
  439. package/dist/internal/option.js.map +1 -1
  440. package/dist/internal/random.d.ts +2 -0
  441. package/dist/internal/random.d.ts.map +1 -0
  442. package/dist/internal/random.js +13 -0
  443. package/dist/internal/random.js.map +1 -0
  444. package/dist/internal/rcRef.js +11 -10
  445. package/dist/internal/rcRef.js.map +1 -1
  446. package/dist/internal/references.d.ts +2 -0
  447. package/dist/internal/references.d.ts.map +1 -0
  448. package/dist/internal/references.js +51 -0
  449. package/dist/internal/references.js.map +1 -0
  450. package/dist/internal/request.js +6 -6
  451. package/dist/internal/request.js.map +1 -1
  452. package/dist/internal/schedule.js +1 -1
  453. package/dist/internal/schedule.js.map +1 -1
  454. package/dist/internal/schema/annotations.js +2 -0
  455. package/dist/internal/schema/annotations.js.map +1 -1
  456. package/dist/internal/schema/representation.js +86 -107
  457. package/dist/internal/schema/representation.js.map +1 -1
  458. package/dist/internal/schema/schema.d.ts +10 -1
  459. package/dist/internal/schema/schema.d.ts.map +1 -1
  460. package/dist/internal/schema/schema.js +22 -1
  461. package/dist/internal/schema/schema.js.map +1 -1
  462. package/dist/internal/schema/to-codec.js +7 -10
  463. package/dist/internal/schema/to-codec.js.map +1 -1
  464. package/dist/internal/trie.js +8 -7
  465. package/dist/internal/trie.js.map +1 -1
  466. package/dist/testing/TestClock.d.ts +8 -7
  467. package/dist/testing/TestClock.d.ts.map +1 -1
  468. package/dist/testing/TestClock.js +6 -4
  469. package/dist/testing/TestClock.js.map +1 -1
  470. package/dist/testing/TestSchema.d.ts +267 -33
  471. package/dist/testing/TestSchema.d.ts.map +1 -1
  472. package/dist/testing/TestSchema.js +296 -23
  473. package/dist/testing/TestSchema.js.map +1 -1
  474. package/dist/testing/index.d.ts +64 -1
  475. package/dist/testing/index.d.ts.map +1 -1
  476. package/dist/testing/index.js +64 -1
  477. package/dist/testing/index.js.map +1 -1
  478. package/dist/unstable/ai/AiError.d.ts +155 -73
  479. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  480. package/dist/unstable/ai/AiError.js +29 -23
  481. package/dist/unstable/ai/AiError.js.map +1 -1
  482. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  483. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  484. package/dist/unstable/ai/AnthropicStructuredOutput.js +9 -2
  485. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  486. package/dist/unstable/ai/Chat.d.ts +39 -11
  487. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  488. package/dist/unstable/ai/Chat.js +41 -47
  489. package/dist/unstable/ai/Chat.js.map +1 -1
  490. package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
  491. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
  492. package/dist/unstable/ai/EmbeddingModel.js +127 -0
  493. package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
  494. package/dist/unstable/ai/IdGenerator.d.ts +2 -2
  495. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  496. package/dist/unstable/ai/IdGenerator.js +2 -2
  497. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  498. package/dist/unstable/ai/LanguageModel.d.ts +119 -49
  499. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  500. package/dist/unstable/ai/LanguageModel.js +260 -61
  501. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  502. package/dist/unstable/ai/McpSchema.d.ts +236 -141
  503. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  504. package/dist/unstable/ai/McpSchema.js +71 -19
  505. package/dist/unstable/ai/McpSchema.js.map +1 -1
  506. package/dist/unstable/ai/McpServer.d.ts +68 -15
  507. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  508. package/dist/unstable/ai/McpServer.js +218 -73
  509. package/dist/unstable/ai/McpServer.js.map +1 -1
  510. package/dist/unstable/ai/Model.d.ts +27 -9
  511. package/dist/unstable/ai/Model.d.ts.map +1 -1
  512. package/dist/unstable/ai/Model.js +25 -9
  513. package/dist/unstable/ai/Model.js.map +1 -1
  514. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  515. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  516. package/dist/unstable/ai/OpenAiStructuredOutput.js +9 -1
  517. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  518. package/dist/unstable/ai/Prompt.d.ts +20 -20
  519. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  520. package/dist/unstable/ai/Prompt.js +6 -9
  521. package/dist/unstable/ai/Prompt.js.map +1 -1
  522. package/dist/unstable/ai/Response.d.ts +27 -27
  523. package/dist/unstable/ai/Response.d.ts.map +1 -1
  524. package/dist/unstable/ai/Response.js +7 -8
  525. package/dist/unstable/ai/Response.js.map +1 -1
  526. package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
  527. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
  528. package/dist/unstable/ai/ResponseIdTracker.js +68 -0
  529. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
  530. package/dist/unstable/ai/Telemetry.d.ts +35 -2
  531. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  532. package/dist/unstable/ai/Telemetry.js +2 -2
  533. package/dist/unstable/ai/Telemetry.js.map +1 -1
  534. package/dist/unstable/ai/Tokenizer.d.ts +2 -2
  535. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  536. package/dist/unstable/ai/Tokenizer.js +2 -2
  537. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  538. package/dist/unstable/ai/Tool.d.ts +46 -16
  539. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  540. package/dist/unstable/ai/Tool.js +68 -22
  541. package/dist/unstable/ai/Tool.js.map +1 -1
  542. package/dist/unstable/ai/Toolkit.d.ts +4 -4
  543. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  544. package/dist/unstable/ai/Toolkit.js +14 -21
  545. package/dist/unstable/ai/Toolkit.js.map +1 -1
  546. package/dist/unstable/ai/index.d.ts +22 -1
  547. package/dist/unstable/ai/index.d.ts.map +1 -1
  548. package/dist/unstable/ai/index.js +22 -1
  549. package/dist/unstable/ai/index.js.map +1 -1
  550. package/dist/unstable/ai/internal/codec-transformer.js +5 -7
  551. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  552. package/dist/unstable/cli/Argument.d.ts +4 -7
  553. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  554. package/dist/unstable/cli/Argument.js +1 -3
  555. package/dist/unstable/cli/Argument.js.map +1 -1
  556. package/dist/unstable/cli/CliError.d.ts +55 -67
  557. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  558. package/dist/unstable/cli/CliError.js +32 -57
  559. package/dist/unstable/cli/CliError.js.map +1 -1
  560. package/dist/unstable/cli/CliOutput.d.ts +5 -4
  561. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  562. package/dist/unstable/cli/CliOutput.js +67 -12
  563. package/dist/unstable/cli/CliOutput.js.map +1 -1
  564. package/dist/unstable/cli/Command.d.ts +372 -59
  565. package/dist/unstable/cli/Command.d.ts.map +1 -1
  566. package/dist/unstable/cli/Command.js +328 -66
  567. package/dist/unstable/cli/Command.js.map +1 -1
  568. package/dist/unstable/cli/Completions.d.ts +97 -0
  569. package/dist/unstable/cli/Completions.d.ts.map +1 -0
  570. package/dist/unstable/cli/Completions.js +25 -0
  571. package/dist/unstable/cli/Completions.js.map +1 -0
  572. package/dist/unstable/cli/Flag.d.ts +4 -5
  573. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  574. package/dist/unstable/cli/Flag.js +1 -1
  575. package/dist/unstable/cli/Flag.js.map +1 -1
  576. package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
  577. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
  578. package/dist/unstable/cli/GlobalFlag.js +118 -0
  579. package/dist/unstable/cli/GlobalFlag.js.map +1 -0
  580. package/dist/unstable/cli/HelpDoc.d.ts +81 -11
  581. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  582. package/dist/unstable/cli/Param.d.ts +34 -6
  583. package/dist/unstable/cli/Param.d.ts.map +1 -1
  584. package/dist/unstable/cli/Param.js +24 -14
  585. package/dist/unstable/cli/Param.js.map +1 -1
  586. package/dist/unstable/cli/Primitive.d.ts +2 -2
  587. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  588. package/dist/unstable/cli/Primitive.js +1 -1
  589. package/dist/unstable/cli/Primitive.js.map +1 -1
  590. package/dist/unstable/cli/Prompt.js +266 -86
  591. package/dist/unstable/cli/Prompt.js.map +1 -1
  592. package/dist/unstable/cli/index.d.ts +8 -0
  593. package/dist/unstable/cli/index.d.ts.map +1 -1
  594. package/dist/unstable/cli/index.js +8 -0
  595. package/dist/unstable/cli/index.js.map +1 -1
  596. package/dist/unstable/cli/internal/command.d.ts +41 -15
  597. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  598. package/dist/unstable/cli/internal/command.js +84 -47
  599. package/dist/unstable/cli/internal/command.js.map +1 -1
  600. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  601. package/dist/unstable/cli/internal/completions/descriptor.d.ts +2 -0
  602. package/dist/unstable/cli/internal/completions/descriptor.d.ts.map +1 -0
  603. package/dist/unstable/cli/internal/completions/{CommandDescriptor.js → descriptor.js} +17 -5
  604. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -0
  605. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  606. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  607. package/dist/unstable/cli/internal/config.js +42 -0
  608. package/dist/unstable/cli/internal/config.js.map +1 -1
  609. package/dist/unstable/cli/internal/help.d.ts +33 -0
  610. package/dist/unstable/cli/internal/help.d.ts.map +1 -0
  611. package/dist/unstable/cli/internal/help.js +125 -0
  612. package/dist/unstable/cli/internal/help.js.map +1 -0
  613. package/dist/unstable/cli/internal/parser.js +155 -58
  614. package/dist/unstable/cli/internal/parser.js.map +1 -1
  615. package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
  616. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  617. package/dist/unstable/cluster/ClusterCron.js +1 -1
  618. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  619. package/dist/unstable/cluster/ClusterError.d.ts +7 -7
  620. package/dist/unstable/cluster/ClusterSchema.d.ts +28 -7
  621. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  622. package/dist/unstable/cluster/ClusterSchema.js +28 -8
  623. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  624. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +4 -2
  625. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  626. package/dist/unstable/cluster/ClusterWorkflowEngine.js +97 -63
  627. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  628. package/dist/unstable/cluster/DeliverAt.js +1 -1
  629. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  630. package/dist/unstable/cluster/Entity.d.ts +18 -16
  631. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  632. package/dist/unstable/cluster/Entity.js +31 -25
  633. package/dist/unstable/cluster/Entity.js.map +1 -1
  634. package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
  635. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  636. package/dist/unstable/cluster/EntityAddress.js +1 -1
  637. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  638. package/dist/unstable/cluster/EntityProxy.js +3 -3
  639. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  640. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  641. package/dist/unstable/cluster/EntityProxyServer.js +4 -4
  642. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  643. package/dist/unstable/cluster/EntityResource.d.ts +4 -4
  644. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  645. package/dist/unstable/cluster/EntityResource.js +2 -2
  646. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  647. package/dist/unstable/cluster/Envelope.d.ts +4 -4
  648. package/dist/unstable/cluster/HttpRunner.js +2 -2
  649. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  650. package/dist/unstable/cluster/K8sHttpClient.d.ts +5 -5
  651. package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
  652. package/dist/unstable/cluster/K8sHttpClient.js +6 -6
  653. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  654. package/dist/unstable/cluster/Message.d.ts +21 -15
  655. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  656. package/dist/unstable/cluster/Message.js +16 -8
  657. package/dist/unstable/cluster/Message.js.map +1 -1
  658. package/dist/unstable/cluster/MessageStorage.d.ts +46 -23
  659. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  660. package/dist/unstable/cluster/MessageStorage.js +42 -26
  661. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  662. package/dist/unstable/cluster/Reply.d.ts +10 -9
  663. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  664. package/dist/unstable/cluster/Reply.js +8 -7
  665. package/dist/unstable/cluster/Reply.js.map +1 -1
  666. package/dist/unstable/cluster/Runner.d.ts +2 -2
  667. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  668. package/dist/unstable/cluster/Runner.js +1 -1
  669. package/dist/unstable/cluster/Runner.js.map +1 -1
  670. package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
  671. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  672. package/dist/unstable/cluster/RunnerAddress.js +1 -1
  673. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  674. package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
  675. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  676. package/dist/unstable/cluster/RunnerHealth.js +2 -2
  677. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  678. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  679. package/dist/unstable/cluster/RunnerServer.js +10 -9
  680. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  681. package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
  682. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  683. package/dist/unstable/cluster/RunnerStorage.js +3 -3
  684. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  685. package/dist/unstable/cluster/Runners.d.ts +5 -4
  686. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  687. package/dist/unstable/cluster/Runners.js +20 -17
  688. package/dist/unstable/cluster/Runners.js.map +1 -1
  689. package/dist/unstable/cluster/ShardId.d.ts +35 -49
  690. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  691. package/dist/unstable/cluster/ShardId.js +65 -67
  692. package/dist/unstable/cluster/ShardId.js.map +1 -1
  693. package/dist/unstable/cluster/Sharding.d.ts +4 -4
  694. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  695. package/dist/unstable/cluster/Sharding.js +66 -54
  696. package/dist/unstable/cluster/Sharding.js.map +1 -1
  697. package/dist/unstable/cluster/ShardingConfig.d.ts +28 -27
  698. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  699. package/dist/unstable/cluster/ShardingConfig.js +27 -27
  700. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  701. package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
  702. package/dist/unstable/cluster/Snowflake.d.ts +2 -2
  703. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  704. package/dist/unstable/cluster/Snowflake.js +2 -2
  705. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  706. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  707. package/dist/unstable/cluster/SqlMessageStorage.js +24 -20
  708. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  709. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  710. package/dist/unstable/cluster/SqlRunnerStorage.js +7 -7
  711. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  712. package/dist/unstable/cluster/internal/entityManager.js +34 -27
  713. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  714. package/dist/unstable/cluster/internal/entityReaper.js +4 -3
  715. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  716. package/dist/unstable/cluster/internal/resourceMap.js +3 -3
  717. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  718. package/dist/unstable/cluster/internal/resourceRef.js +2 -1
  719. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  720. package/dist/unstable/devtools/DevToolsClient.d.ts +2 -2
  721. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  722. package/dist/unstable/devtools/DevToolsClient.js +9 -8
  723. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  724. package/dist/unstable/devtools/DevToolsSchema.d.ts +40 -40
  725. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  726. package/dist/unstable/devtools/DevToolsSchema.js +9 -2
  727. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  728. package/dist/unstable/encoding/Msgpack.d.ts +1 -1
  729. package/dist/unstable/encoding/Ndjson.d.ts +9 -9
  730. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  731. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  732. package/dist/unstable/encoding/Sse.d.ts +4 -4
  733. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  734. package/dist/unstable/encoding/Sse.js +1 -1
  735. package/dist/unstable/encoding/Sse.js.map +1 -1
  736. package/dist/unstable/eventlog/Event.d.ts +0 -6
  737. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  738. package/dist/unstable/eventlog/Event.js +0 -5
  739. package/dist/unstable/eventlog/Event.js.map +1 -1
  740. package/dist/unstable/eventlog/EventGroup.d.ts +0 -2
  741. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  742. package/dist/unstable/eventlog/EventGroup.js +0 -2
  743. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  744. package/dist/unstable/eventlog/EventJournal.d.ts +28 -11
  745. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  746. package/dist/unstable/eventlog/EventJournal.js +130 -71
  747. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  748. package/dist/unstable/eventlog/EventLog.d.ts +94 -37
  749. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  750. package/dist/unstable/eventlog/EventLog.js +225 -150
  751. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  752. package/dist/unstable/eventlog/EventLogEncryption.d.ts +11 -9
  753. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  754. package/dist/unstable/eventlog/EventLogEncryption.js +15 -17
  755. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  756. package/dist/unstable/eventlog/EventLogMessage.d.ts +228 -0
  757. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -0
  758. package/dist/unstable/eventlog/EventLogMessage.js +214 -0
  759. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -0
  760. package/dist/unstable/eventlog/EventLogRemote.d.ts +112 -194
  761. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  762. package/dist/unstable/eventlog/EventLogRemote.js +168 -322
  763. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  764. package/dist/unstable/eventlog/EventLogServer.d.ts +26 -48
  765. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  766. package/dist/unstable/eventlog/EventLogServer.js +128 -199
  767. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  768. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +60 -0
  769. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -0
  770. package/dist/unstable/eventlog/EventLogServerEncrypted.js +166 -0
  771. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -0
  772. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +183 -0
  773. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -0
  774. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +461 -0
  775. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -0
  776. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +117 -0
  777. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -0
  778. package/dist/unstable/eventlog/EventLogSessionAuth.js +284 -0
  779. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -0
  780. package/dist/unstable/eventlog/{SqlEventLogJournal.d.ts → SqlEventJournal.d.ts} +2 -2
  781. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -0
  782. package/dist/unstable/eventlog/{SqlEventLogJournal.js → SqlEventJournal.js} +28 -21
  783. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
  784. package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
  785. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
  786. package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +69 -27
  787. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
  788. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
  789. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
  790. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +355 -0
  791. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
  792. package/dist/unstable/eventlog/index.d.ts +22 -2
  793. package/dist/unstable/eventlog/index.d.ts.map +1 -1
  794. package/dist/unstable/eventlog/index.js +22 -2
  795. package/dist/unstable/eventlog/index.js.map +1 -1
  796. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
  797. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
  798. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
  799. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
  800. package/dist/unstable/http/Cookies.d.ts +52 -7
  801. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  802. package/dist/unstable/http/Cookies.js +27 -6
  803. package/dist/unstable/http/Cookies.js.map +1 -1
  804. package/dist/unstable/http/Etag.d.ts +2 -2
  805. package/dist/unstable/http/Etag.d.ts.map +1 -1
  806. package/dist/unstable/http/Etag.js +7 -3
  807. package/dist/unstable/http/Etag.js.map +1 -1
  808. package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
  809. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  810. package/dist/unstable/http/FetchHttpClient.js +5 -5
  811. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  812. package/dist/unstable/http/Headers.d.ts +24 -4
  813. package/dist/unstable/http/Headers.d.ts.map +1 -1
  814. package/dist/unstable/http/Headers.js +42 -13
  815. package/dist/unstable/http/Headers.js.map +1 -1
  816. package/dist/unstable/http/HttpBody.d.ts +1 -1
  817. package/dist/unstable/http/HttpClient.d.ts +125 -21
  818. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  819. package/dist/unstable/http/HttpClient.js +197 -19
  820. package/dist/unstable/http/HttpClient.js.map +1 -1
  821. package/dist/unstable/http/HttpClientError.d.ts +8 -8
  822. package/dist/unstable/http/HttpClientRequest.d.ts +43 -15
  823. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  824. package/dist/unstable/http/HttpClientRequest.js +131 -21
  825. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  826. package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
  827. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  828. package/dist/unstable/http/HttpClientResponse.js +6 -1
  829. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  830. package/dist/unstable/http/HttpEffect.d.ts +13 -11
  831. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  832. package/dist/unstable/http/HttpEffect.js +67 -75
  833. package/dist/unstable/http/HttpEffect.js.map +1 -1
  834. package/dist/unstable/http/HttpIncomingMessage.d.ts +5 -4
  835. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  836. package/dist/unstable/http/HttpIncomingMessage.js +2 -2
  837. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  838. package/dist/unstable/http/HttpMethod.d.ts +4 -4
  839. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  840. package/dist/unstable/http/HttpMethod.js +3 -3
  841. package/dist/unstable/http/HttpMethod.js.map +1 -1
  842. package/dist/unstable/http/HttpMiddleware.d.ts +4 -9
  843. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  844. package/dist/unstable/http/HttpMiddleware.js +47 -43
  845. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  846. package/dist/unstable/http/HttpPlatform.d.ts +2 -2
  847. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  848. package/dist/unstable/http/HttpPlatform.js +5 -4
  849. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  850. package/dist/unstable/http/HttpRouter.d.ts +9 -8
  851. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  852. package/dist/unstable/http/HttpRouter.js +36 -36
  853. package/dist/unstable/http/HttpRouter.js.map +1 -1
  854. package/dist/unstable/http/HttpServer.d.ts +2 -2
  855. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  856. package/dist/unstable/http/HttpServer.js +4 -4
  857. package/dist/unstable/http/HttpServer.js.map +1 -1
  858. package/dist/unstable/http/HttpServerError.d.ts +22 -34
  859. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  860. package/dist/unstable/http/HttpServerError.js +39 -45
  861. package/dist/unstable/http/HttpServerError.js.map +1 -1
  862. package/dist/unstable/http/HttpServerRequest.d.ts +19 -7
  863. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  864. package/dist/unstable/http/HttpServerRequest.js +307 -13
  865. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  866. package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
  867. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  868. package/dist/unstable/http/HttpServerRespondable.js +5 -5
  869. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  870. package/dist/unstable/http/HttpServerResponse.d.ts +52 -5
  871. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  872. package/dist/unstable/http/HttpServerResponse.js +240 -5
  873. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  874. package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
  875. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
  876. package/dist/unstable/http/HttpStaticServer.js +353 -0
  877. package/dist/unstable/http/HttpStaticServer.js.map +1 -0
  878. package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
  879. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  880. package/dist/unstable/http/HttpTraceContext.js +27 -15
  881. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  882. package/dist/unstable/http/Multipart.d.ts +9 -9
  883. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  884. package/dist/unstable/http/Multipart.js +7 -7
  885. package/dist/unstable/http/Multipart.js.map +1 -1
  886. package/dist/unstable/http/Url.d.ts +604 -0
  887. package/dist/unstable/http/Url.d.ts.map +1 -0
  888. package/dist/unstable/http/Url.js +256 -0
  889. package/dist/unstable/http/Url.js.map +1 -0
  890. package/dist/unstable/http/UrlParams.d.ts +19 -10
  891. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  892. package/dist/unstable/http/UrlParams.js +6 -7
  893. package/dist/unstable/http/UrlParams.js.map +1 -1
  894. package/dist/unstable/http/index.d.ts +8 -0
  895. package/dist/unstable/http/index.d.ts.map +1 -1
  896. package/dist/unstable/http/index.js +8 -0
  897. package/dist/unstable/http/index.js.map +1 -1
  898. package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
  899. package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
  900. package/dist/unstable/http/internal/preResponseHandler.js +10 -0
  901. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
  902. package/dist/unstable/httpapi/HttpApi.d.ts +11 -11
  903. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  904. package/dist/unstable/httpapi/HttpApi.js +8 -8
  905. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  906. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +12 -9
  907. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  908. package/dist/unstable/httpapi/HttpApiBuilder.js +53 -39
  909. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  910. package/dist/unstable/httpapi/HttpApiClient.d.ts +83 -7
  911. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  912. package/dist/unstable/httpapi/HttpApiClient.js +79 -11
  913. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  914. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +211 -105
  915. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  916. package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -47
  917. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  918. package/dist/unstable/httpapi/HttpApiError.d.ts +43 -26
  919. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  920. package/dist/unstable/httpapi/HttpApiError.js +125 -32
  921. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  922. package/dist/unstable/httpapi/HttpApiGroup.d.ts +9 -8
  923. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  924. package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
  925. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  926. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -18
  927. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  928. package/dist/unstable/httpapi/HttpApiMiddleware.js +38 -8
  929. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  930. package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
  931. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  932. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  933. package/dist/unstable/httpapi/HttpApiSchema.d.ts +88 -9
  934. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  935. package/dist/unstable/httpapi/HttpApiSchema.js +86 -11
  936. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  937. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
  938. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  939. package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
  940. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  941. package/dist/unstable/httpapi/OpenApi.d.ts +17 -25
  942. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  943. package/dist/unstable/httpapi/OpenApi.js +59 -60
  944. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  945. package/dist/unstable/observability/Otlp.d.ts +12 -12
  946. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  947. package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
  948. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  949. package/dist/unstable/observability/OtlpExporter.js +8 -8
  950. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  951. package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
  952. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  953. package/dist/unstable/observability/OtlpLogger.js +7 -4
  954. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  955. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
  956. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  957. package/dist/unstable/observability/OtlpMetrics.js +2 -2
  958. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  959. package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
  960. package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
  961. package/dist/unstable/observability/OtlpSerialization.js +2 -2
  962. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  963. package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
  964. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  965. package/dist/unstable/observability/OtlpTracer.js +7 -3
  966. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  967. package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
  968. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  969. package/dist/unstable/observability/PrometheusMetrics.js +4 -33
  970. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  971. package/dist/unstable/observability/internal/protobuf.js +4 -4
  972. package/dist/unstable/observability/internal/protobuf.js.map +1 -1
  973. package/dist/unstable/persistence/KeyValueStore.d.ts +24 -3
  974. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  975. package/dist/unstable/persistence/KeyValueStore.js +148 -6
  976. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  977. package/dist/unstable/persistence/Persistable.d.ts +2 -2
  978. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  979. package/dist/unstable/persistence/Persistable.js +1 -1
  980. package/dist/unstable/persistence/Persistable.js.map +1 -1
  981. package/dist/unstable/persistence/PersistedCache.d.ts +6 -6
  982. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  983. package/dist/unstable/persistence/PersistedCache.js +12 -12
  984. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  985. package/dist/unstable/persistence/PersistedQueue.d.ts +16 -16
  986. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  987. package/dist/unstable/persistence/PersistedQueue.js +15 -14
  988. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  989. package/dist/unstable/persistence/Persistence.d.ts +5 -5
  990. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  991. package/dist/unstable/persistence/Persistence.js +5 -5
  992. package/dist/unstable/persistence/Persistence.js.map +1 -1
  993. package/dist/unstable/persistence/RateLimiter.d.ts +9 -9
  994. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  995. package/dist/unstable/persistence/RateLimiter.js +4 -4
  996. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  997. package/dist/unstable/persistence/Redis.d.ts +3 -3
  998. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  999. package/dist/unstable/persistence/Redis.js +2 -2
  1000. package/dist/unstable/persistence/Redis.js.map +1 -1
  1001. package/dist/unstable/process/ChildProcess.d.ts +5 -128
  1002. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1003. package/dist/unstable/process/ChildProcess.js +1 -65
  1004. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1005. package/dist/unstable/process/ChildProcessSpawner.d.ts +89 -8
  1006. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1007. package/dist/unstable/process/ChildProcessSpawner.js +22 -2
  1008. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1009. package/dist/unstable/reactivity/Atom.d.ts +108 -47
  1010. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1011. package/dist/unstable/reactivity/Atom.js +105 -25
  1012. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1013. package/dist/unstable/reactivity/AtomHttpApi.d.ts +22 -20
  1014. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1015. package/dist/unstable/reactivity/AtomHttpApi.js +58 -26
  1016. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1017. package/dist/unstable/reactivity/AtomRegistry.d.ts +8 -2
  1018. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  1019. package/dist/unstable/reactivity/AtomRegistry.js +57 -14
  1020. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1021. package/dist/unstable/reactivity/AtomRpc.d.ts +12 -12
  1022. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1023. package/dist/unstable/reactivity/AtomRpc.js +59 -31
  1024. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1025. package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
  1026. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  1027. package/dist/unstable/reactivity/Reactivity.js +6 -6
  1028. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1029. package/dist/unstable/reactivity/index.d.ts +2 -2
  1030. package/dist/unstable/reactivity/index.d.ts.map +1 -1
  1031. package/dist/unstable/reactivity/index.js +2 -2
  1032. package/dist/unstable/reactivity/index.js.map +1 -1
  1033. package/dist/unstable/rpc/Rpc.d.ts +47 -19
  1034. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1035. package/dist/unstable/rpc/Rpc.js +39 -7
  1036. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1037. package/dist/unstable/rpc/RpcClient.d.ts +26 -47
  1038. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1039. package/dist/unstable/rpc/RpcClient.js +120 -77
  1040. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1041. package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
  1042. package/dist/unstable/rpc/RpcGroup.d.ts +15 -11
  1043. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  1044. package/dist/unstable/rpc/RpcGroup.js +30 -20
  1045. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1046. package/dist/unstable/rpc/RpcMiddleware.d.ts +12 -12
  1047. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  1048. package/dist/unstable/rpc/RpcMiddleware.js +5 -5
  1049. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1050. package/dist/unstable/rpc/RpcSchema.d.ts +14 -1
  1051. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  1052. package/dist/unstable/rpc/RpcSchema.js +17 -2
  1053. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1054. package/dist/unstable/rpc/RpcSerialization.d.ts +13 -2
  1055. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1056. package/dist/unstable/rpc/RpcSerialization.js +60 -27
  1057. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1058. package/dist/unstable/rpc/RpcServer.d.ts +8 -12
  1059. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  1060. package/dist/unstable/rpc/RpcServer.js +78 -46
  1061. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1062. package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
  1063. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  1064. package/dist/unstable/rpc/RpcWorker.js +4 -4
  1065. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1066. package/dist/unstable/rpc/Utils.d.ts +6 -3
  1067. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  1068. package/dist/unstable/rpc/Utils.js +48 -6
  1069. package/dist/unstable/rpc/Utils.js.map +1 -1
  1070. package/dist/unstable/schema/Model.d.ts +24 -3
  1071. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1072. package/dist/unstable/schema/Model.js +17 -4
  1073. package/dist/unstable/schema/Model.js.map +1 -1
  1074. package/dist/unstable/schema/VariantSchema.d.ts +7 -7
  1075. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  1076. package/dist/unstable/schema/VariantSchema.js +7 -18
  1077. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1078. package/dist/unstable/socket/Socket.d.ts +16 -15
  1079. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1080. package/dist/unstable/socket/Socket.js +22 -19
  1081. package/dist/unstable/socket/Socket.js.map +1 -1
  1082. package/dist/unstable/socket/SocketServer.d.ts +8 -5
  1083. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  1084. package/dist/unstable/socket/SocketServer.js +2 -2
  1085. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1086. package/dist/unstable/sql/Migrator.d.ts +1 -1
  1087. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  1088. package/dist/unstable/sql/Migrator.js +2 -2
  1089. package/dist/unstable/sql/Migrator.js.map +1 -1
  1090. package/dist/unstable/sql/SqlClient.d.ts +5 -5
  1091. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1092. package/dist/unstable/sql/SqlClient.js +7 -7
  1093. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1094. package/dist/unstable/sql/SqlConnection.d.ts +2 -2
  1095. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  1096. package/dist/unstable/sql/SqlConnection.js +5 -2
  1097. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1098. package/dist/unstable/sql/SqlError.d.ts +237 -17
  1099. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  1100. package/dist/unstable/sql/SqlError.js +260 -4
  1101. package/dist/unstable/sql/SqlError.js.map +1 -1
  1102. package/dist/unstable/sql/SqlModel.d.ts +8 -9
  1103. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  1104. package/dist/unstable/sql/SqlModel.js +12 -38
  1105. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1106. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  1107. package/dist/unstable/sql/SqlResolver.js +26 -17
  1108. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1109. package/dist/unstable/sql/SqlSchema.d.ts +17 -6
  1110. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  1111. package/dist/unstable/sql/SqlSchema.js +17 -7
  1112. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1113. package/dist/unstable/sql/Statement.d.ts +2 -2
  1114. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  1115. package/dist/unstable/sql/Statement.js +2 -3
  1116. package/dist/unstable/sql/Statement.js.map +1 -1
  1117. package/dist/unstable/workers/Transferable.d.ts +4 -4
  1118. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  1119. package/dist/unstable/workers/Transferable.js +7 -7
  1120. package/dist/unstable/workers/Transferable.js.map +1 -1
  1121. package/dist/unstable/workers/Worker.d.ts +3 -3
  1122. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  1123. package/dist/unstable/workers/Worker.js +8 -4
  1124. package/dist/unstable/workers/Worker.js.map +1 -1
  1125. package/dist/unstable/workers/WorkerError.d.ts +5 -5
  1126. package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
  1127. package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
  1128. package/dist/unstable/workers/WorkerRunner.js +5 -2
  1129. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1130. package/dist/unstable/workflow/Activity.d.ts +7 -2
  1131. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  1132. package/dist/unstable/workflow/Activity.js +17 -4
  1133. package/dist/unstable/workflow/Activity.js.map +1 -1
  1134. package/dist/unstable/workflow/DurableClock.d.ts +3 -6
  1135. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  1136. package/dist/unstable/workflow/DurableClock.js +6 -6
  1137. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1138. package/dist/unstable/workflow/DurableDeferred.d.ts +1 -1
  1139. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  1140. package/dist/unstable/workflow/DurableDeferred.js +15 -15
  1141. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1142. package/dist/unstable/workflow/Workflow.d.ts +13 -12
  1143. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1144. package/dist/unstable/workflow/Workflow.js +18 -18
  1145. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1146. package/dist/unstable/workflow/WorkflowEngine.d.ts +26 -8
  1147. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  1148. package/dist/unstable/workflow/WorkflowEngine.js +167 -17
  1149. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1150. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  1151. package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
  1152. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1153. package/package.json +11 -11
  1154. package/src/Array.ts +304 -447
  1155. package/src/BigDecimal.ts +137 -82
  1156. package/src/BigInt.ts +53 -45
  1157. package/src/Brand.ts +3 -5
  1158. package/src/Cache.ts +27 -54
  1159. package/src/Cause.ts +58 -23
  1160. package/src/Channel.ts +693 -224
  1161. package/src/Chunk.ts +149 -331
  1162. package/src/Clock.ts +2 -2
  1163. package/src/Combiner.ts +280 -13
  1164. package/src/Config.ts +197 -27
  1165. package/src/ConfigProvider.ts +5 -5
  1166. package/src/Console.ts +2 -2
  1167. package/src/Context.ts +1454 -0
  1168. package/src/Cron.ts +155 -63
  1169. package/src/Data.ts +539 -376
  1170. package/src/DateTime.ts +77 -258
  1171. package/src/Deferred.ts +15 -6
  1172. package/src/Duration.ts +123 -67
  1173. package/src/Effect.ts +1629 -1355
  1174. package/src/Encoding.ts +879 -0
  1175. package/src/Equal.ts +295 -111
  1176. package/src/Equivalence.ts +114 -52
  1177. package/src/ErrorReporter.ts +458 -0
  1178. package/src/ExecutionPlan.ts +8 -9
  1179. package/src/Exit.ts +24 -12
  1180. package/src/Fiber.ts +17 -8
  1181. package/src/FiberHandle.ts +15 -14
  1182. package/src/FiberMap.ts +27 -27
  1183. package/src/FiberSet.ts +5 -5
  1184. package/src/FileSystem.ts +34 -30
  1185. package/src/Filter.ts +4 -62
  1186. package/src/Formatter.ts +253 -51
  1187. package/src/Function.ts +2 -10
  1188. package/src/Graph.ts +131 -117
  1189. package/src/Hash.ts +2 -2
  1190. package/src/HashMap.ts +26 -19
  1191. package/src/Iterable.ts +117 -63
  1192. package/src/JsonSchema.ts +383 -10
  1193. package/src/Latch.ts +194 -0
  1194. package/src/Layer.ts +728 -441
  1195. package/src/LayerMap.ts +38 -35
  1196. package/src/LogLevel.ts +37 -0
  1197. package/src/Logger.ts +35 -102
  1198. package/src/ManagedRuntime.ts +61 -48
  1199. package/src/Metric.ts +64 -66
  1200. package/src/MutableHashMap.ts +9 -0
  1201. package/src/MutableHashSet.ts +9 -0
  1202. package/src/MutableList.ts +3 -0
  1203. package/src/Newtype.ts +308 -0
  1204. package/src/Number.ts +98 -29
  1205. package/src/Optic.ts +948 -19
  1206. package/src/Option.ts +34 -24
  1207. package/src/Order.ts +39 -32
  1208. package/src/PartitionedSemaphore.ts +288 -56
  1209. package/src/Path.ts +2 -2
  1210. package/src/Pipeable.ts +32 -1
  1211. package/src/Pool.ts +18 -16
  1212. package/src/PubSub.ts +30 -20
  1213. package/src/Pull.ts +1 -1
  1214. package/src/Queue.ts +11 -9
  1215. package/src/Random.ts +51 -14
  1216. package/src/RcMap.ts +19 -19
  1217. package/src/RcRef.ts +1 -1
  1218. package/src/Record.ts +94 -199
  1219. package/src/Redactable.ts +146 -72
  1220. package/src/Reducer.ts +166 -7
  1221. package/src/References.ts +283 -287
  1222. package/src/Request.ts +8 -7
  1223. package/src/RequestResolver.ts +34 -55
  1224. package/src/Resource.ts +6 -5
  1225. package/src/Result.ts +2 -4
  1226. package/src/Runtime.ts +102 -6
  1227. package/src/Schedule.ts +460 -451
  1228. package/src/Scheduler.ts +52 -129
  1229. package/src/Schema.ts +4267 -752
  1230. package/src/SchemaAST.ts +480 -302
  1231. package/src/SchemaGetter.ts +92 -38
  1232. package/src/SchemaIssue.ts +28 -15
  1233. package/src/SchemaParser.ts +100 -29
  1234. package/src/SchemaRepresentation.ts +59 -32
  1235. package/src/SchemaTransformation.ts +364 -13
  1236. package/src/Scope.ts +2 -2
  1237. package/src/ScopedCache.ts +8 -8
  1238. package/src/Semaphore.ts +442 -0
  1239. package/src/Sink.ts +89 -34
  1240. package/src/Stdio.ts +29 -6
  1241. package/src/Stream.ts +898 -752
  1242. package/src/String.ts +122 -69
  1243. package/src/Struct.ts +33 -7
  1244. package/src/SubscriptionRef.ts +101 -120
  1245. package/src/SynchronizedRef.ts +3 -2
  1246. package/src/Terminal.ts +5 -4
  1247. package/src/Tracer.ts +23 -22
  1248. package/src/Trie.ts +44 -31
  1249. package/src/TxChunk.ts +26 -16
  1250. package/src/TxDeferred.ts +391 -0
  1251. package/src/TxHashMap.ts +347 -291
  1252. package/src/TxHashSet.ts +54 -61
  1253. package/src/TxPriorityQueue.ts +762 -0
  1254. package/src/TxPubSub.ts +787 -0
  1255. package/src/TxQueue.ts +221 -245
  1256. package/src/TxReentrantLock.ts +729 -0
  1257. package/src/TxRef.ts +31 -31
  1258. package/src/TxSemaphore.ts +203 -31
  1259. package/src/TxSubscriptionRef.ts +637 -0
  1260. package/src/Types.ts +78 -17
  1261. package/src/Unify.ts +26 -2
  1262. package/src/Utils.ts +137 -111
  1263. package/src/index.ts +898 -72
  1264. package/src/internal/core.ts +19 -12
  1265. package/src/internal/dateTime.ts +91 -96
  1266. package/src/internal/effect.ts +1150 -611
  1267. package/src/internal/hashMap.ts +12 -10
  1268. package/src/internal/layer.ts +7 -7
  1269. package/src/internal/option.ts +7 -0
  1270. package/src/internal/random.ts +20 -0
  1271. package/src/internal/rcRef.ts +14 -13
  1272. package/src/internal/references.ts +72 -0
  1273. package/src/internal/request.ts +8 -8
  1274. package/src/internal/schedule.ts +3 -1
  1275. package/src/internal/schema/annotations.ts +2 -0
  1276. package/src/internal/schema/representation.ts +81 -95
  1277. package/src/internal/schema/schema.ts +25 -1
  1278. package/src/internal/schema/to-codec.ts +7 -17
  1279. package/src/internal/trie.ts +21 -15
  1280. package/src/testing/TestClock.ts +13 -11
  1281. package/src/testing/TestSchema.ts +333 -36
  1282. package/src/testing/index.ts +64 -1
  1283. package/src/unstable/ai/AiError.ts +112 -54
  1284. package/src/unstable/ai/AnthropicStructuredOutput.ts +7 -3
  1285. package/src/unstable/ai/Chat.ts +137 -88
  1286. package/src/unstable/ai/EmbeddingModel.ts +209 -0
  1287. package/src/unstable/ai/IdGenerator.ts +2 -2
  1288. package/src/unstable/ai/LanguageModel.ts +685 -255
  1289. package/src/unstable/ai/McpSchema.ts +84 -22
  1290. package/src/unstable/ai/McpServer.ts +299 -87
  1291. package/src/unstable/ai/Model.ts +44 -13
  1292. package/src/unstable/ai/OpenAiStructuredOutput.ts +9 -2
  1293. package/src/unstable/ai/Prompt.ts +43 -49
  1294. package/src/unstable/ai/Response.ts +31 -33
  1295. package/src/unstable/ai/ResponseIdTracker.ts +95 -0
  1296. package/src/unstable/ai/Telemetry.ts +2 -2
  1297. package/src/unstable/ai/Tokenizer.ts +2 -2
  1298. package/src/unstable/ai/Tool.ts +62 -36
  1299. package/src/unstable/ai/Toolkit.ts +17 -26
  1300. package/src/unstable/ai/index.ts +24 -1
  1301. package/src/unstable/ai/internal/codec-transformer.ts +3 -9
  1302. package/src/unstable/cli/Argument.ts +5 -8
  1303. package/src/unstable/cli/CliError.ts +67 -66
  1304. package/src/unstable/cli/CliOutput.ts +87 -15
  1305. package/src/unstable/cli/Command.ts +808 -193
  1306. package/src/unstable/cli/Completions.ts +107 -0
  1307. package/src/unstable/cli/Flag.ts +5 -6
  1308. package/src/unstable/cli/GlobalFlag.ts +242 -0
  1309. package/src/unstable/cli/HelpDoc.ts +91 -11
  1310. package/src/unstable/cli/Param.ts +54 -27
  1311. package/src/unstable/cli/Primitive.ts +2 -2
  1312. package/src/unstable/cli/Prompt.ts +275 -104
  1313. package/src/unstable/cli/index.ts +10 -0
  1314. package/src/unstable/cli/internal/command.ts +125 -64
  1315. package/src/unstable/cli/internal/completions/bash.ts +7 -7
  1316. package/src/unstable/cli/internal/completions/{CommandDescriptor.ts → descriptor.ts} +16 -58
  1317. package/src/unstable/cli/internal/completions/fish.ts +7 -7
  1318. package/src/unstable/cli/internal/completions/zsh.ts +8 -14
  1319. package/src/unstable/cli/internal/config.ts +49 -0
  1320. package/src/unstable/cli/internal/help.ts +171 -0
  1321. package/src/unstable/cli/internal/parser.ts +201 -84
  1322. package/src/unstable/cluster/ClusterCron.ts +2 -2
  1323. package/src/unstable/cluster/ClusterSchema.ts +38 -10
  1324. package/src/unstable/cluster/ClusterWorkflowEngine.ts +144 -81
  1325. package/src/unstable/cluster/DeliverAt.ts +1 -1
  1326. package/src/unstable/cluster/Entity.ts +59 -45
  1327. package/src/unstable/cluster/EntityAddress.ts +1 -1
  1328. package/src/unstable/cluster/EntityProxy.ts +3 -3
  1329. package/src/unstable/cluster/EntityProxyServer.ts +4 -4
  1330. package/src/unstable/cluster/EntityResource.ts +6 -6
  1331. package/src/unstable/cluster/Envelope.ts +1 -1
  1332. package/src/unstable/cluster/HttpRunner.ts +2 -2
  1333. package/src/unstable/cluster/K8sHttpClient.ts +7 -7
  1334. package/src/unstable/cluster/Message.ts +30 -17
  1335. package/src/unstable/cluster/MessageStorage.ts +76 -46
  1336. package/src/unstable/cluster/Reply.ts +13 -10
  1337. package/src/unstable/cluster/Runner.ts +1 -1
  1338. package/src/unstable/cluster/RunnerAddress.ts +1 -1
  1339. package/src/unstable/cluster/RunnerHealth.ts +2 -2
  1340. package/src/unstable/cluster/RunnerServer.ts +11 -14
  1341. package/src/unstable/cluster/RunnerStorage.ts +9 -9
  1342. package/src/unstable/cluster/Runners.ts +28 -23
  1343. package/src/unstable/cluster/ShardId.ts +84 -74
  1344. package/src/unstable/cluster/Sharding.ts +83 -66
  1345. package/src/unstable/cluster/ShardingConfig.ts +39 -40
  1346. package/src/unstable/cluster/Snowflake.ts +2 -2
  1347. package/src/unstable/cluster/SqlMessageStorage.ts +29 -20
  1348. package/src/unstable/cluster/SqlRunnerStorage.ts +13 -7
  1349. package/src/unstable/cluster/internal/entityManager.ts +66 -46
  1350. package/src/unstable/cluster/internal/entityReaper.ts +4 -3
  1351. package/src/unstable/cluster/internal/resourceMap.ts +3 -3
  1352. package/src/unstable/cluster/internal/resourceRef.ts +2 -1
  1353. package/src/unstable/devtools/DevToolsClient.ts +26 -21
  1354. package/src/unstable/devtools/DevToolsSchema.ts +16 -3
  1355. package/src/unstable/encoding/Ndjson.ts +17 -17
  1356. package/src/unstable/encoding/Sse.ts +3 -5
  1357. package/src/unstable/eventlog/Event.ts +0 -8
  1358. package/src/unstable/eventlog/EventGroup.ts +0 -4
  1359. package/src/unstable/eventlog/EventJournal.ts +148 -80
  1360. package/src/unstable/eventlog/EventLog.ts +360 -233
  1361. package/src/unstable/eventlog/EventLogEncryption.ts +18 -32
  1362. package/src/unstable/eventlog/EventLogMessage.ts +277 -0
  1363. package/src/unstable/eventlog/EventLogRemote.ts +264 -410
  1364. package/src/unstable/eventlog/EventLogServer.ts +183 -275
  1365. package/src/unstable/eventlog/EventLogServerEncrypted.ts +206 -0
  1366. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +749 -0
  1367. package/src/unstable/eventlog/EventLogSessionAuth.ts +437 -0
  1368. package/src/unstable/eventlog/{SqlEventLogJournal.ts → SqlEventJournal.ts} +38 -22
  1369. package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +110 -43
  1370. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +506 -0
  1371. package/src/unstable/eventlog/index.ts +27 -2
  1372. package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
  1373. package/src/unstable/http/Cookies.ts +94 -11
  1374. package/src/unstable/http/Etag.ts +7 -5
  1375. package/src/unstable/http/FetchHttpClient.ts +5 -5
  1376. package/src/unstable/http/Headers.ts +70 -20
  1377. package/src/unstable/http/HttpClient.ts +385 -42
  1378. package/src/unstable/http/HttpClientRequest.ts +151 -39
  1379. package/src/unstable/http/HttpClientResponse.ts +12 -6
  1380. package/src/unstable/http/HttpEffect.ts +86 -100
  1381. package/src/unstable/http/HttpIncomingMessage.ts +5 -4
  1382. package/src/unstable/http/HttpMethod.ts +16 -4
  1383. package/src/unstable/http/HttpMiddleware.ts +50 -50
  1384. package/src/unstable/http/HttpPlatform.ts +5 -4
  1385. package/src/unstable/http/HttpRouter.ts +46 -46
  1386. package/src/unstable/http/HttpServer.ts +5 -11
  1387. package/src/unstable/http/HttpServerError.ts +45 -47
  1388. package/src/unstable/http/HttpServerRequest.ts +414 -23
  1389. package/src/unstable/http/HttpServerRespondable.ts +6 -6
  1390. package/src/unstable/http/HttpServerResponse.ts +351 -13
  1391. package/src/unstable/http/HttpStaticServer.ts +456 -0
  1392. package/src/unstable/http/HttpTraceContext.ts +31 -17
  1393. package/src/unstable/http/Multipart.ts +10 -10
  1394. package/src/unstable/http/Url.ts +650 -0
  1395. package/src/unstable/http/UrlParams.ts +31 -19
  1396. package/src/unstable/http/index.ts +10 -0
  1397. package/src/unstable/http/internal/preResponseHandler.ts +15 -0
  1398. package/src/unstable/httpapi/HttpApi.ts +21 -21
  1399. package/src/unstable/httpapi/HttpApiBuilder.ts +128 -55
  1400. package/src/unstable/httpapi/HttpApiClient.ts +186 -34
  1401. package/src/unstable/httpapi/HttpApiEndpoint.ts +225 -113
  1402. package/src/unstable/httpapi/HttpApiError.ts +108 -30
  1403. package/src/unstable/httpapi/HttpApiGroup.ts +18 -17
  1404. package/src/unstable/httpapi/HttpApiMiddleware.ts +95 -33
  1405. package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
  1406. package/src/unstable/httpapi/HttpApiSchema.ts +106 -11
  1407. package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
  1408. package/src/unstable/httpapi/OpenApi.ts +73 -72
  1409. package/src/unstable/observability/Otlp.ts +12 -12
  1410. package/src/unstable/observability/OtlpExporter.ts +14 -10
  1411. package/src/unstable/observability/OtlpLogger.ts +13 -9
  1412. package/src/unstable/observability/OtlpMetrics.ts +6 -6
  1413. package/src/unstable/observability/OtlpSerialization.ts +2 -2
  1414. package/src/unstable/observability/OtlpTracer.ts +14 -10
  1415. package/src/unstable/observability/PrometheusMetrics.ts +5 -5
  1416. package/src/unstable/observability/internal/protobuf.ts +4 -4
  1417. package/src/unstable/persistence/KeyValueStore.ts +230 -7
  1418. package/src/unstable/persistence/Persistable.ts +3 -3
  1419. package/src/unstable/persistence/PersistedCache.ts +35 -21
  1420. package/src/unstable/persistence/PersistedQueue.ts +28 -27
  1421. package/src/unstable/persistence/Persistence.ts +7 -7
  1422. package/src/unstable/persistence/RateLimiter.ts +7 -7
  1423. package/src/unstable/persistence/Redis.ts +2 -2
  1424. package/src/unstable/process/ChildProcess.ts +6 -208
  1425. package/src/unstable/process/ChildProcessSpawner.ts +120 -15
  1426. package/src/unstable/reactivity/Atom.ts +280 -124
  1427. package/src/unstable/reactivity/AtomHttpApi.ts +115 -59
  1428. package/src/unstable/reactivity/AtomRegistry.ts +70 -16
  1429. package/src/unstable/reactivity/AtomRpc.ts +82 -37
  1430. package/src/unstable/reactivity/Reactivity.ts +6 -6
  1431. package/src/unstable/reactivity/index.ts +2 -2
  1432. package/src/unstable/rpc/Rpc.ts +77 -32
  1433. package/src/unstable/rpc/RpcClient.ts +165 -145
  1434. package/src/unstable/rpc/RpcGroup.ts +51 -34
  1435. package/src/unstable/rpc/RpcMiddleware.ts +28 -22
  1436. package/src/unstable/rpc/RpcSchema.ts +24 -6
  1437. package/src/unstable/rpc/RpcSerialization.ts +97 -54
  1438. package/src/unstable/rpc/RpcServer.ts +97 -69
  1439. package/src/unstable/rpc/RpcWorker.ts +5 -5
  1440. package/src/unstable/rpc/Utils.ts +65 -5
  1441. package/src/unstable/schema/Model.ts +35 -6
  1442. package/src/unstable/schema/VariantSchema.ts +14 -27
  1443. package/src/unstable/socket/Socket.ts +42 -38
  1444. package/src/unstable/socket/SocketServer.ts +2 -2
  1445. package/src/unstable/sql/Migrator.ts +7 -5
  1446. package/src/unstable/sql/SqlClient.ts +13 -11
  1447. package/src/unstable/sql/SqlConnection.ts +2 -2
  1448. package/src/unstable/sql/SqlError.ts +365 -11
  1449. package/src/unstable/sql/SqlModel.ts +57 -85
  1450. package/src/unstable/sql/SqlResolver.ts +26 -16
  1451. package/src/unstable/sql/SqlSchema.ts +42 -26
  1452. package/src/unstable/sql/Statement.ts +2 -3
  1453. package/src/unstable/workers/Transferable.ts +17 -19
  1454. package/src/unstable/workers/Worker.ts +6 -5
  1455. package/src/unstable/workers/WorkerRunner.ts +2 -2
  1456. package/src/unstable/workflow/Activity.ts +27 -4
  1457. package/src/unstable/workflow/DurableClock.ts +11 -11
  1458. package/src/unstable/workflow/DurableDeferred.ts +16 -16
  1459. package/src/unstable/workflow/Workflow.ts +32 -25
  1460. package/src/unstable/workflow/WorkflowEngine.ts +239 -25
  1461. package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
  1462. package/dist/NullOr.d.ts +0 -149
  1463. package/dist/NullOr.d.ts.map +0 -1
  1464. package/dist/NullOr.js +0 -152
  1465. package/dist/NullOr.js.map +0 -1
  1466. package/dist/ServiceMap.d.ts +0 -1126
  1467. package/dist/ServiceMap.d.ts.map +0 -1
  1468. package/dist/ServiceMap.js.map +0 -1
  1469. package/dist/encoding/Base64.d.ts +0 -67
  1470. package/dist/encoding/Base64.d.ts.map +0 -1
  1471. package/dist/encoding/Base64.js +0 -146
  1472. package/dist/encoding/Base64.js.map +0 -1
  1473. package/dist/encoding/Base64Url.d.ts +0 -60
  1474. package/dist/encoding/Base64Url.d.ts.map +0 -1
  1475. package/dist/encoding/Base64Url.js +0 -89
  1476. package/dist/encoding/Base64Url.js.map +0 -1
  1477. package/dist/encoding/EncodingError.d.ts +0 -31
  1478. package/dist/encoding/EncodingError.d.ts.map +0 -1
  1479. package/dist/encoding/EncodingError.js +0 -22
  1480. package/dist/encoding/EncodingError.js.map +0 -1
  1481. package/dist/encoding/Hex.d.ts +0 -61
  1482. package/dist/encoding/Hex.d.ts.map +0 -1
  1483. package/dist/encoding/Hex.js +0 -115
  1484. package/dist/encoding/Hex.js.map +0 -1
  1485. package/dist/encoding/index.d.ts +0 -26
  1486. package/dist/encoding/index.d.ts.map +0 -1
  1487. package/dist/encoding/index.js +0 -27
  1488. package/dist/encoding/index.js.map +0 -1
  1489. package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
  1490. package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
  1491. package/dist/unstable/cli/internal/builtInFlags.js +0 -44
  1492. package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
  1493. package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts +0 -2
  1494. package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts.map +0 -1
  1495. package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +0 -1
  1496. package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
  1497. package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
  1498. package/dist/unstable/cli/internal/completions/Completions.js +0 -23
  1499. package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
  1500. package/dist/unstable/eventlog/SqlEventLogJournal.d.ts.map +0 -1
  1501. package/dist/unstable/eventlog/SqlEventLogJournal.js.map +0 -1
  1502. package/dist/unstable/eventlog/SqlEventLogServer.d.ts.map +0 -1
  1503. package/dist/unstable/eventlog/SqlEventLogServer.js.map +0 -1
  1504. package/src/NullOr.ts +0 -204
  1505. package/src/ServiceMap.ts +0 -1410
  1506. package/src/encoding/Base64.ts +0 -366
  1507. package/src/encoding/Base64Url.ts +0 -104
  1508. package/src/encoding/EncodingError.ts +0 -35
  1509. package/src/encoding/Hex.ts +0 -390
  1510. package/src/encoding/index.ts +0 -31
  1511. package/src/unstable/cli/internal/builtInFlags.ts +0 -78
  1512. package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/src/Stream.ts CHANGED
@@ -6,13 +6,14 @@ import * as Arr from "./Array.ts"
6
6
  import * as Cause from "./Cause.ts"
7
7
  import * as Channel from "./Channel.ts"
8
8
  import { Clock } from "./Clock.ts"
9
+ import * as Context from "./Context.ts"
9
10
  import * as Duration from "./Duration.ts"
10
11
  import * as Effect from "./Effect.ts"
11
12
  import * as Equal from "./Equal.ts"
12
13
  import * as ExecutionPlan from "./ExecutionPlan.ts"
13
14
  import * as Exit from "./Exit.ts"
14
15
  import * as Fiber from "./Fiber.ts"
15
- import * as Filter from "./Filter.ts"
16
+ import type * as Filter from "./Filter.ts"
16
17
  import type { LazyArg } from "./Function.ts"
17
18
  import { constant, constTrue, constVoid, dual, identity } from "./Function.ts"
18
19
  import type { TypeLambda } from "./HKT.ts"
@@ -20,8 +21,9 @@ import * as internalExecutionPlan from "./internal/executionPlan.ts"
20
21
  import * as internal from "./internal/stream.ts"
21
22
  import { addSpanStackTrace } from "./internal/tracer.ts"
22
23
  import * as Iterable from "./Iterable.ts"
24
+ import * as Latch from "./Latch.ts"
23
25
  import type * as Layer from "./Layer.ts"
24
- import type { LogLevel } from "./LogLevel.ts"
26
+ import type { Severity } from "./LogLevel.ts"
25
27
  import * as MutableHashMap from "./MutableHashMap.ts"
26
28
  import * as MutableList from "./MutableList.ts"
27
29
  import * as Option from "./Option.ts"
@@ -36,7 +38,6 @@ import * as RcRef from "./RcRef.ts"
36
38
  import * as Result from "./Result.ts"
37
39
  import * as Schedule from "./Schedule.ts"
38
40
  import * as Scope from "./Scope.ts"
39
- import * as ServiceMap from "./ServiceMap.ts"
40
41
  import * as Sink from "./Sink.ts"
41
42
  import { isString } from "./String.ts"
42
43
  import type * as Take from "./Take.ts"
@@ -47,14 +48,26 @@ import type {
47
48
  ExcludeTag,
48
49
  ExtractReason,
49
50
  ExtractTag,
51
+ NarrowReason,
50
52
  NoInfer,
53
+ OmitReason,
51
54
  ReasonTags,
52
55
  Tags,
53
56
  unassigned
54
57
  } from "./Types.ts"
55
58
  import type * as Unify from "./Unify.ts"
56
59
 
57
- const TypeId = "~effect/Stream"
60
+ /**
61
+ * @since 4.0.0
62
+ * @category Type Identifiers
63
+ */
64
+ export type TypeId = "~effect/Stream"
65
+
66
+ /**
67
+ * @since 4.0.0
68
+ * @category Type Identifiers
69
+ */
70
+ export const TypeId: TypeId = "~effect/Stream"
58
71
 
59
72
  /**
60
73
  * A `Stream<A, E, R>` describes a program that can emit many `A` values, fail
@@ -129,7 +142,7 @@ export interface StreamUnify<A extends { [Unify.typeSymbol]?: any }> extends Eff
129
142
  * @category Models
130
143
  * @since 2.0.0
131
144
  */
132
- export interface StreamUnifyIgnore extends Effect.EffectUnifyIgnore {
145
+ export interface StreamUnifyIgnore {
133
146
  Effect?: true
134
147
  }
135
148
 
@@ -341,6 +354,79 @@ export const fromChannel: <Arr extends Arr.NonEmptyReadonlyArray<any>, E, R>(
341
354
  export const fromEffect = <A, E, R>(effect: Effect.Effect<A, E, R>): Stream<A, E, R> =>
342
355
  fromChannel(Channel.fromEffect(Effect.map(effect, Arr.of)))
343
356
 
357
+ /**
358
+ * Accesses a service from the context and emits it as a single element.
359
+ *
360
+ * @example
361
+ * ```ts
362
+ * import { Effect, Context, Stream } from "effect"
363
+ *
364
+ * class Greeter extends Context.Service<Greeter, {
365
+ * readonly greet: (name: string) => string
366
+ * }>()("Greeter") {}
367
+ *
368
+ * const stream = Stream.service(Greeter).pipe(
369
+ * Stream.map((greeter) => greeter.greet("World"))
370
+ * )
371
+ *
372
+ * const program = Effect.gen(function*() {
373
+ * return yield* stream.pipe(
374
+ * Stream.provideService(Greeter, {
375
+ * greet: (name) => `Hello, ${name}!`
376
+ * }),
377
+ * Stream.runCollect
378
+ * )
379
+ * })
380
+ *
381
+ * Effect.runPromise(program)
382
+ * // Output: [ "Hello, World!" ]
383
+ * ```
384
+ *
385
+ * @since 4.0.0
386
+ * @category Context
387
+ */
388
+ export const service = <I, S>(service: Context.Key<I, S>): Stream<S, never, I> => fromEffect(Effect.service(service))
389
+
390
+ /**
391
+ * Optionally accesses a service from the context and emits the result as a
392
+ * single element.
393
+ *
394
+ * @example
395
+ * ```ts
396
+ * import { Effect, Option, Context, Stream } from "effect"
397
+ *
398
+ * class Greeter extends Context.Service<Greeter, {
399
+ * readonly greet: (name: string) => string
400
+ * }>()("Greeter") {}
401
+ *
402
+ * const stream = Stream.serviceOption(Greeter).pipe(
403
+ * Stream.map((maybeGreeter) =>
404
+ * Option.match(maybeGreeter, {
405
+ * onNone: () => "No greeter",
406
+ * onSome: (greeter) => greeter.greet("World")
407
+ * })
408
+ * )
409
+ * )
410
+ *
411
+ * const program = Effect.gen(function*() {
412
+ * return yield* stream.pipe(
413
+ * Stream.provideService(Greeter, {
414
+ * greet: (name) => `Hello, ${name}!`
415
+ * }),
416
+ * Stream.runCollect
417
+ * )
418
+ * })
419
+ *
420
+ * Effect.runPromise(program)
421
+ * // Output: [ "Hello, World!" ]
422
+ * ```
423
+ *
424
+ * @since 4.0.0
425
+ * @category Context
426
+ */
427
+ export const serviceOption = <I, S>(service: Context.Key<I, S>): Stream<Option.Option<S>> =>
428
+ fromEffect(Effect.serviceOption(service))
429
+
344
430
  /**
345
431
  * Creates a stream that runs the effect and emits no elements.
346
432
  *
@@ -471,7 +557,7 @@ export const fromEffectSchedule = <A, E, R, X, AS extends A, ES, RS>(
471
557
  * @since 2.0.0
472
558
  * @category Constructors
473
559
  */
474
- export const tick = (interval: Duration.DurationInput): Stream<void> =>
560
+ export const tick = (interval: Duration.Input): Stream<void> =>
475
561
  fromPull(Effect.sync(() => {
476
562
  let first = true
477
563
  const effect = Effect.succeed(Arr.of<void>(undefined))
@@ -960,6 +1046,10 @@ export const fromIteratorSucceed = <A>(iterator: IterableIterator<A>, maxChunkSi
960
1046
  /**
961
1047
  * Creates a new `Stream` from an iterable collection of values.
962
1048
  *
1049
+ * **Options**
1050
+ *
1051
+ * - `chunkSize`: Maximum number of values emitted per chunk.
1052
+ *
963
1053
  * @example
964
1054
  * ```ts
965
1055
  * import { Console, Effect, Stream } from "effect"
@@ -979,19 +1069,24 @@ export const fromIteratorSucceed = <A>(iterator: IterableIterator<A>, maxChunkSi
979
1069
  * @since 2.0.0
980
1070
  * @category Constructors
981
1071
  */
982
- export const fromIterable = <A>(iterable: Iterable<A>): Stream<A> =>
983
- Array.isArray(iterable)
1072
+ export const fromIterable = <A>(
1073
+ iterable: Iterable<A>,
1074
+ options?: {
1075
+ readonly chunkSize?: number | undefined
1076
+ }
1077
+ ): Stream<A> =>
1078
+ Array.isArray(iterable) && options?.chunkSize === undefined
984
1079
  ? fromArray(iterable)
985
- : fromChannel(Channel.fromIterableArray(iterable))
1080
+ : fromChannel(Channel.fromIterableArray(iterable, options?.chunkSize))
986
1081
 
987
1082
  /**
988
1083
  * Creates a stream from an effect producing an iterable of values.
989
1084
  *
990
1085
  * @example
991
1086
  * ```ts
992
- * import { Console, Effect, ServiceMap, Stream } from "effect"
1087
+ * import { Console, Effect, Context, Stream } from "effect"
993
1088
  *
994
- * class UserRepo extends ServiceMap.Service<UserRepo, {
1089
+ * class UserRepo extends Context.Service<UserRepo, {
995
1090
  * readonly list: Effect.Effect<ReadonlyArray<string>>
996
1091
  * }>()("UserRepo") {}
997
1092
  *
@@ -1242,7 +1337,9 @@ export const fromPubSubTake = <A, E>(pubsub: PubSub.PubSub<Take.Take<A, E>>): St
1242
1337
  *
1243
1338
  * @example
1244
1339
  * ```ts
1245
- * import { Console, Effect, Stream } from "effect"
1340
+ * import { Console, Data, Effect, Stream } from "effect"
1341
+ *
1342
+ * class StreamError extends Data.TaggedError("StreamError")<{ readonly cause: unknown }> {}
1246
1343
  *
1247
1344
  * const readableStream = new ReadableStream({
1248
1345
  * start(controller) {
@@ -1256,7 +1353,7 @@ export const fromPubSubTake = <A, E>(pubsub: PubSub.PubSub<Take.Take<A, E>>): St
1256
1353
  * const program = Effect.gen(function*() {
1257
1354
  * const stream = Stream.fromReadableStream({
1258
1355
  * evaluate: () => readableStream,
1259
- * onError: (error) => new Error(String(error))
1356
+ * onError: (cause) => new StreamError({ cause })
1260
1357
  * })
1261
1358
  * const values = yield* Stream.runCollect(stream)
1262
1359
  * yield* Console.log(values)
@@ -1298,7 +1395,9 @@ export const fromReadableStream = <A, E>(
1298
1395
  *
1299
1396
  * @example
1300
1397
  * ```ts
1301
- * import { Console, Effect, Stream } from "effect"
1398
+ * import { Console, Data, Effect, Stream } from "effect"
1399
+ *
1400
+ * class StreamError extends Data.TaggedError("StreamError")<{ readonly cause: unknown }> {}
1302
1401
  *
1303
1402
  * const iterable = (async function*() {
1304
1403
  * yield 1
@@ -1307,7 +1406,7 @@ export const fromReadableStream = <A, E>(
1307
1406
  * })()
1308
1407
  *
1309
1408
  * const program = Effect.gen(function*() {
1310
- * const stream = Stream.fromAsyncIterable(iterable, (error) => new Error(String(error)))
1409
+ * const stream = Stream.fromAsyncIterable(iterable, (cause) => new StreamError({ cause }))
1311
1410
  * const values = yield* Stream.runCollect(stream)
1312
1411
  * yield* Console.log(values)
1313
1412
  * })
@@ -1334,7 +1433,7 @@ export const fromAsyncIterable = <A, E>(
1334
1433
  *
1335
1434
  * const program = Effect.gen(function*() {
1336
1435
  * const schedule = Schedule.spaced("50 millis").pipe(
1337
- * Schedule.compose(Schedule.recurs(2))
1436
+ * Schedule.both(Schedule.recurs(2))
1338
1437
  * )
1339
1438
  * const stream = Stream.fromSchedule(schedule)
1340
1439
  * const values = yield* Stream.runCollect(stream)
@@ -2648,8 +2747,8 @@ export const tapSink: {
2648
2747
  transformPullBracket(
2649
2748
  self,
2650
2749
  Effect.fnUntraced(function*(pull, _, scope) {
2651
- const upstreamLatch = Effect.makeLatchUnsafe()
2652
- const sinkLatch = Effect.makeLatchUnsafe()
2750
+ const upstreamLatch = Latch.makeUnsafe()
2751
+ const sinkLatch = Latch.makeUnsafe()
2653
2752
  let chunk: Arr.NonEmptyReadonlyArray<A> | undefined = undefined
2654
2753
  let causeSink: Cause.Cause<E2> | undefined = undefined
2655
2754
  let sinkDone = false
@@ -3316,7 +3415,7 @@ export const timeout: {
3316
3415
  * @since 2.0.0
3317
3416
  * @category Rate Limiting
3318
3417
  */
3319
- (duration: Duration.DurationInput): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
3418
+ (duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
3320
3419
  /**
3321
3420
  * Ends the stream if it does not produce a value within the specified duration.
3322
3421
  *
@@ -3340,15 +3439,97 @@ export const timeout: {
3340
3439
  * @since 2.0.0
3341
3440
  * @category Rate Limiting
3342
3441
  */
3343
- <A, E, R>(self: Stream<A, E, R>, duration: Duration.DurationInput): Stream<A, E, R>
3442
+ <A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R>
3344
3443
  } = dual(
3345
3444
  2,
3346
- <A, E, R>(self: Stream<A, E, R>, duration: Duration.DurationInput): Stream<A, E, R> =>
3347
- transformPull(self, (pull, _scope) =>
3348
- Effect.succeed(Effect.timeoutOrElse(pull, {
3349
- duration,
3350
- onTimeout: () => Cause.done()
3351
- })))
3445
+ <A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R> =>
3446
+ timeoutOrElse(self, {
3447
+ duration,
3448
+ orElse: () => empty
3449
+ })
3450
+ )
3451
+
3452
+ /**
3453
+ * @since 2.0.0
3454
+ * @category Rate Limiting
3455
+ */
3456
+ export const timeoutOrElse: {
3457
+ /**
3458
+ * @since 2.0.0
3459
+ * @category Rate Limiting
3460
+ */
3461
+ <B, E2, R2>(
3462
+ options: {
3463
+ readonly duration: Duration.Input
3464
+ readonly orElse: () => Stream<B, E2, R2>
3465
+ }
3466
+ ): <A, E, R>(self: Stream<A, E, R>) => Stream<A | B, E | E2, R | R2>
3467
+ /**
3468
+ * @since 2.0.0
3469
+ * @category Rate Limiting
3470
+ */
3471
+ <A, E, R, B, E2, R2>(
3472
+ self: Stream<A, E, R>,
3473
+ options: {
3474
+ readonly duration: Duration.Input
3475
+ readonly orElse: () => Stream<B, E2, R2>
3476
+ }
3477
+ ): Stream<A | B, E | E2, R | R2>
3478
+ } = dual(
3479
+ 2,
3480
+ <A, E, R, B, E2, R2>(
3481
+ self: Stream<A, E, R>,
3482
+ options: {
3483
+ readonly duration: Duration.Input
3484
+ readonly orElse: () => Stream<B, E2, R2>
3485
+ }
3486
+ ): Stream<A | B, E | E2, R | R2> => {
3487
+ const duration = Duration.fromInputUnsafe(options.duration)
3488
+ if (!Duration.isFinite(duration)) return self
3489
+ if (Duration.isZero(duration)) return suspend(options.orElse)
3490
+ const timeoutSymbol = Symbol()
3491
+ return catchCause(
3492
+ suspend(() => {
3493
+ const parent = Fiber.getCurrent()!
3494
+ const clock = parent.getRef(Clock)
3495
+ const durationMs = Duration.toMillis(duration)
3496
+ let deadline: number | undefined = undefined
3497
+ const latch = Latch.makeUnsafe(false)
3498
+ return merge(
3499
+ transformPull(self, (pull, _scope) =>
3500
+ Effect.suspend(() => {
3501
+ deadline = clock.currentTimeMillisUnsafe() + durationMs
3502
+ latch.openUnsafe()
3503
+ return pull
3504
+ }).pipe(
3505
+ Effect.map((arr) => {
3506
+ latch.closeUnsafe()
3507
+ deadline = undefined
3508
+ return arr
3509
+ }),
3510
+ Effect.succeed
3511
+ )),
3512
+ fromEffectDrain(Effect.gen(function*() {
3513
+ while (true) {
3514
+ yield* latch.await
3515
+ if (deadline === undefined) continue
3516
+ yield* Effect.sleep(deadline - clock.currentTimeMillisUnsafe())
3517
+ if (deadline === undefined) continue
3518
+ const remaining = deadline - clock.currentTimeMillisUnsafe()
3519
+ if (remaining > 0) continue
3520
+ return yield* Effect.die(timeoutSymbol)
3521
+ }
3522
+ })),
3523
+ { haltStrategy: "left" }
3524
+ )
3525
+ }),
3526
+ (cause): Stream<B, E | E2, R2> => {
3527
+ const isTimeout = cause.reasons.find((r) => r._tag === "Die" && r.defect === timeoutSymbol)
3528
+ if (isTimeout) return options.orElse()
3529
+ return failCause(cause as Cause.Cause<E>)
3530
+ }
3531
+ )
3532
+ }
3352
3533
  )
3353
3534
 
3354
3535
  /**
@@ -3801,7 +3982,7 @@ export const merge: {
3801
3982
  } | undefined
3802
3983
  ): Stream<A | A2, E | E2, R | R2>
3803
3984
  } = dual(
3804
- 2,
3985
+ (args) => isStream(args[0]) && isStream(args[1]),
3805
3986
  <A, E, R, A2, E2, R2>(
3806
3987
  self: Stream<A, E, R>,
3807
3988
  that: Stream<A2, E2, R2>,
@@ -5341,7 +5522,7 @@ export const zipLatestAll = <T extends ReadonlyArray<Stream<any, any, any>>>(
5341
5522
  fromChannel(Channel.suspend(() => {
5342
5523
  const latest: Array<any> = []
5343
5524
  const emitted = new Set<number>()
5344
- const readyLatch = Effect.makeLatchUnsafe()
5525
+ const readyLatch = Latch.makeUnsafe()
5345
5526
  return Channel.mergeAll(
5346
5527
  Channel.fromArray(
5347
5528
  streams.map((s, i) =>
@@ -5763,7 +5944,7 @@ export const filter: {
5763
5944
  * @since 2.0.0
5764
5945
  * @category Filtering
5765
5946
  */
5766
- <A, Result extends Filter.ResultOrBool>(filter: Filter.OrPredicate<NoInfer<A>, Result>): <E, R>(self: Stream<A, E, R>) => Stream<Filter.Pass<A, Result>, E, R>
5947
+ <A>(predicate: Predicate<NoInfer<A>>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
5767
5948
  /**
5768
5949
  * Filters a stream to the elements that satisfy a predicate.
5769
5950
  *
@@ -5809,27 +5990,52 @@ export const filter: {
5809
5990
  * @since 2.0.0
5810
5991
  * @category Filtering
5811
5992
  */
5812
- <A, E, R, Result extends Filter.ResultOrBool>(self: Stream<A, E, R>, filter: Filter.OrPredicate<NoInfer<A>, Result>): Stream<Filter.Pass<A, Result>, E, R>
5993
+ <A, E, R>(self: Stream<A, E, R>, predicate: Predicate<A>): Stream<A, E, R>
5813
5994
  } = dual(
5814
5995
  2,
5815
- <A, E, R, Result extends Filter.ResultOrBool>(
5996
+ <A, E, R>(
5816
5997
  self: Stream<A, E, R>,
5817
- filter: Filter.OrPredicate<NoInfer<A>, Result>
5818
- ): Stream<Filter.Pass<A, Result>, E, R> => fromChannel(Channel.filterArray(toChannel(self), filter))
5998
+ predicate: Predicate<A>
5999
+ ): Stream<A, E, R> => fromChannel(Channel.filterArray(toChannel(self), predicate))
5819
6000
  )
5820
6001
 
5821
6002
  /**
5822
- * Effectfully filters and maps elements in a single pass.
6003
+ * Filters and maps stream elements in one pass using a `Filter`.
6004
+ *
6005
+ * @since 4.0.0
6006
+ * @category Filtering
6007
+ */
6008
+ export const filterMap: {
6009
+ /**
6010
+ * Filters and maps stream elements in one pass using a `Filter`.
6011
+ *
6012
+ * @since 4.0.0
6013
+ * @category Filtering
6014
+ */
6015
+ <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<B, E, R>
6016
+ /**
6017
+ * Filters and maps stream elements in one pass using a `Filter`.
6018
+ *
6019
+ * @since 4.0.0
6020
+ * @category Filtering
6021
+ */
6022
+ <A, E, R, B, X>(self: Stream<A, E, R>, filter: Filter.Filter<A, B, X>): Stream<B, E, R>
6023
+ } = dual(
6024
+ 2,
6025
+ <A, E, R, B, X>(
6026
+ self: Stream<A, E, R>,
6027
+ filter: Filter.Filter<A, B, X>
6028
+ ): Stream<B, E, R> => fromChannel(Channel.filterMapArray(toChannel(self), filter))
6029
+ )
6030
+
6031
+ /**
6032
+ * Effectfully filters elements in a single pass.
5823
6033
  *
5824
6034
  * @example
5825
6035
  * ```ts
5826
- * import { Console, Effect, Filter, Result, Stream } from "effect"
5827
- *
5828
- * const filter = Filter.makeEffect((n: number) =>
5829
- * Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
5830
- * )
6036
+ * import { Console, Effect, Stream } from "effect"
5831
6037
  *
5832
- * const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect(filter))
6038
+ * const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect((n) => Effect.succeed(n > 2)))
5833
6039
  *
5834
6040
  * const program = Effect.gen(function*() {
5835
6041
  * const result = yield* Stream.runCollect(stream)
@@ -5837,7 +6043,7 @@ export const filter: {
5837
6043
  * })
5838
6044
  *
5839
6045
  * Effect.runPromise(program)
5840
- * // Output: [ 4, 5 ]
6046
+ * // Output: [ 3, 4 ]
5841
6047
  * ```
5842
6048
  *
5843
6049
  * @since 2.0.0
@@ -5845,17 +6051,13 @@ export const filter: {
5845
6051
  */
5846
6052
  export const filterEffect: {
5847
6053
  /**
5848
- * Effectfully filters and maps elements in a single pass.
6054
+ * Effectfully filters elements in a single pass.
5849
6055
  *
5850
6056
  * @example
5851
6057
  * ```ts
5852
- * import { Console, Effect, Filter, Result, Stream } from "effect"
5853
- *
5854
- * const filter = Filter.makeEffect((n: number) =>
5855
- * Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
5856
- * )
6058
+ * import { Console, Effect, Stream } from "effect"
5857
6059
  *
5858
- * const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect(filter))
6060
+ * const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect((n) => Effect.succeed(n > 2)))
5859
6061
  *
5860
6062
  * const program = Effect.gen(function*() {
5861
6063
  * const result = yield* Stream.runCollect(stream)
@@ -5863,25 +6065,21 @@ export const filterEffect: {
5863
6065
  * })
5864
6066
  *
5865
6067
  * Effect.runPromise(program)
5866
- * // Output: [ 4, 5 ]
6068
+ * // Output: [ 3, 4 ]
5867
6069
  * ```
5868
6070
  *
5869
6071
  * @since 2.0.0
5870
6072
  * @category Filtering
5871
6073
  */
5872
- <A, B, X, EX, RX>(filter: Filter.FilterEffect<A, B, X, EX, RX>): <E, R>(self: Stream<A, E, R>) => Stream<B, E | EX, R | RX>
6074
+ <A, EX, RX>(predicate: (a: NoInfer<A>, i: number) => Effect.Effect<boolean, EX, RX>): <E, R>(self: Stream<A, E, R>) => Stream<A, E | EX, R | RX>
5873
6075
  /**
5874
- * Effectfully filters and maps elements in a single pass.
6076
+ * Effectfully filters elements in a single pass.
5875
6077
  *
5876
6078
  * @example
5877
6079
  * ```ts
5878
- * import { Console, Effect, Filter, Result, Stream } from "effect"
5879
- *
5880
- * const filter = Filter.makeEffect((n: number) =>
5881
- * Effect.succeed(n > 2 ? Result.succeed(n + 1) : Result.fail(n))
5882
- * )
6080
+ * import { Console, Effect, Stream } from "effect"
5883
6081
  *
5884
- * const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect(filter))
6082
+ * const stream = Stream.make(1, 2, 3, 4).pipe(Stream.filterEffect((n) => Effect.succeed(n > 2)))
5885
6083
  *
5886
6084
  * const program = Effect.gen(function*() {
5887
6085
  * const result = yield* Stream.runCollect(stream)
@@ -5889,35 +6087,65 @@ export const filterEffect: {
5889
6087
  * })
5890
6088
  *
5891
6089
  * Effect.runPromise(program)
5892
- * // Output: [ 4, 5 ]
6090
+ * // Output: [ 3, 4 ]
5893
6091
  * ```
5894
6092
  *
5895
6093
  * @since 2.0.0
5896
6094
  * @category Filtering
5897
6095
  */
6096
+ <A, E, R, EX, RX>(
6097
+ self: Stream<A, E, R>,
6098
+ predicate: (a: NoInfer<A>, i: number) => Effect.Effect<boolean, EX, RX>
6099
+ ): Stream<A, E | EX, R | RX>
6100
+ } = dual(
6101
+ 2,
6102
+ <A, E, R, EX, RX>(
6103
+ self: Stream<A, E, R>,
6104
+ predicate: (a: NoInfer<A>, i: number) => Effect.Effect<boolean, EX, RX>
6105
+ ): Stream<A, E | EX, R | RX> => fromChannel(Channel.filterArrayEffect(toChannel(self), predicate))
6106
+ )
6107
+
6108
+ /**
6109
+ * Effectfully filters and maps elements in a single pass.
6110
+ *
6111
+ * @since 4.0.0
6112
+ * @category Filtering
6113
+ */
6114
+ export const filterMapEffect: {
6115
+ /**
6116
+ * Effectfully filters and maps elements in a single pass.
6117
+ *
6118
+ * @since 4.0.0
6119
+ * @category Filtering
6120
+ */
6121
+ <A, B, X, EX, RX>(filter: Filter.FilterEffect<NoInfer<A>, B, X, EX, RX>): <E, R>(self: Stream<A, E, R>) => Stream<B, E | EX, R | RX>
6122
+ /**
6123
+ * Effectfully filters and maps elements in a single pass.
6124
+ *
6125
+ * @since 4.0.0
6126
+ * @category Filtering
6127
+ */
5898
6128
  <A, E, R, B, X, EX, RX>(self: Stream<A, E, R>, filter: Filter.FilterEffect<A, B, X, EX, RX>): Stream<B, E | EX, R | RX>
5899
6129
  } = dual(
5900
6130
  2,
5901
6131
  <A, E, R, B, X, EX, RX>(
5902
6132
  self: Stream<A, E, R>,
5903
6133
  filter: Filter.FilterEffect<A, B, X, EX, RX>
5904
- ): Stream<B, E | EX, R | RX> => fromChannel(Channel.filterArrayEffect(toChannel(self), filter))
6134
+ ): Stream<B, E | EX, R | RX> => fromChannel(Channel.filterMapArrayEffect(toChannel(self), filter))
5905
6135
  )
5906
6136
 
5907
6137
  /**
5908
- * Partitions a stream using a Filter and exposes passing and failing values as queues.
6138
+ * Partitions a stream using a `Filter` and exposes passing and failing values as queues.
5909
6139
  *
5910
6140
  * Each queue fails with the stream error or `Cause.Done` when the source ends.
5911
6141
  *
5912
6142
  * @example
5913
6143
  * ```ts
5914
- * import { Console, Effect, Filter, Result, Stream } from "effect"
6144
+ * import { Console, Effect, Result, Stream } from "effect"
5915
6145
  *
5916
6146
  * const program = Effect.gen(function*() {
5917
6147
  * const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
5918
- * Stream.partitionQueue(
5919
- * Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
5920
- * )
6148
+ * Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
5921
6149
  * )
5922
6150
  *
5923
6151
  * const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
@@ -5937,63 +6165,17 @@ export const filterEffect: {
5937
6165
  */
5938
6166
  export const partitionQueue: {
5939
6167
  /**
5940
- * Partitions a stream using a Filter and exposes passing and failing values as queues.
5941
- *
5942
- * Each queue fails with the stream error or `Cause.Done` when the source ends.
5943
- *
5944
- * @example
5945
- * ```ts
5946
- * import { Console, Effect, Filter, Result, Stream } from "effect"
5947
- *
5948
- * const program = Effect.gen(function*() {
5949
- * const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
5950
- * Stream.partitionQueue(
5951
- * Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
5952
- * )
5953
- * )
5954
- *
5955
- * const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
5956
- * const failValues = yield* Stream.fromQueue(fails).pipe(Stream.runCollect)
5957
- *
5958
- * yield* Console.log(passValues)
5959
- * // Output: [ 2, 4 ]
5960
- * yield* Console.log(failValues)
5961
- * // Output: [ 1, 3 ]
5962
- * })
5963
- *
5964
- * Effect.runPromise(Effect.scoped(program))
5965
- * ```
5966
- *
5967
- * @since 4.0.0
5968
- * @category Filtering
5969
- */
5970
- <A, B extends A>(
5971
- refinement: Refinement<NoInfer<A>, B>,
5972
- options?: {
5973
- readonly capacity?: number | "unbounded" | undefined
5974
- }
5975
- ): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
5976
- [
5977
- passes: Queue.Dequeue<B, E | Cause.Done>,
5978
- fails: Queue.Dequeue<Exclude<A, B>, E | Cause.Done>
5979
- ],
5980
- never,
5981
- R | Scope.Scope
5982
- >
5983
- /**
5984
- * Partitions a stream using a Filter and exposes passing and failing values as queues.
6168
+ * Partitions a stream using a `Filter` and exposes passing and failing values as queues.
5985
6169
  *
5986
6170
  * Each queue fails with the stream error or `Cause.Done` when the source ends.
5987
6171
  *
5988
6172
  * @example
5989
6173
  * ```ts
5990
- * import { Console, Effect, Filter, Result, Stream } from "effect"
6174
+ * import { Console, Effect, Result, Stream } from "effect"
5991
6175
  *
5992
6176
  * const program = Effect.gen(function*() {
5993
6177
  * const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
5994
- * Stream.partitionQueue(
5995
- * Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
5996
- * )
6178
+ * Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
5997
6179
  * )
5998
6180
  *
5999
6181
  * const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
@@ -6011,78 +6193,31 @@ export const partitionQueue: {
6011
6193
  * @since 4.0.0
6012
6194
  * @category Filtering
6013
6195
  */
6014
- <A, Result extends Filter.ResultOrBool>(
6015
- filter: Filter.OrPredicate<NoInfer<A>, Result>,
6196
+ <A, Pass, Fail>(
6197
+ filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
6016
6198
  options?: {
6017
6199
  readonly capacity?: number | "unbounded" | undefined
6018
6200
  }
6019
6201
  ): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
6020
6202
  [
6021
- passes: Queue.Dequeue<Filter.Pass<A, Result>, E | Cause.Done>,
6022
- fails: Queue.Dequeue<Filter.Fail<A, Result>, E | Cause.Done>
6203
+ passes: Queue.Dequeue<Pass, E | Cause.Done>,
6204
+ fails: Queue.Dequeue<Fail, E | Cause.Done>
6023
6205
  ],
6024
6206
  never,
6025
6207
  R | Scope.Scope
6026
6208
  >
6027
6209
  /**
6028
- * Partitions a stream using a Filter and exposes passing and failing values as queues.
6210
+ * Partitions a stream using a `Filter` and exposes passing and failing values as queues.
6029
6211
  *
6030
6212
  * Each queue fails with the stream error or `Cause.Done` when the source ends.
6031
6213
  *
6032
6214
  * @example
6033
6215
  * ```ts
6034
- * import { Console, Effect, Filter, Result, Stream } from "effect"
6035
- *
6036
- * const program = Effect.gen(function*() {
6037
- * const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
6038
- * Stream.partitionQueue(
6039
- * Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
6040
- * )
6041
- * )
6042
- *
6043
- * const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
6044
- * const failValues = yield* Stream.fromQueue(fails).pipe(Stream.runCollect)
6045
- *
6046
- * yield* Console.log(passValues)
6047
- * // Output: [ 2, 4 ]
6048
- * yield* Console.log(failValues)
6049
- * // Output: [ 1, 3 ]
6050
- * })
6051
- *
6052
- * Effect.runPromise(Effect.scoped(program))
6053
- * ```
6054
- *
6055
- * @since 4.0.0
6056
- * @category Filtering
6057
- */
6058
- <A, E, R, B extends A>(
6059
- self: Stream<A, E, R>,
6060
- refinement: Refinement<A, B>,
6061
- options?: {
6062
- readonly capacity?: number | "unbounded" | undefined
6063
- }
6064
- ): Effect.Effect<
6065
- [
6066
- passes: Queue.Dequeue<B, E | Cause.Done>,
6067
- fails: Queue.Dequeue<Exclude<A, B>, E | Cause.Done>
6068
- ],
6069
- never,
6070
- R | Scope.Scope
6071
- >
6072
- /**
6073
- * Partitions a stream using a Filter and exposes passing and failing values as queues.
6074
- *
6075
- * Each queue fails with the stream error or `Cause.Done` when the source ends.
6076
- *
6077
- * @example
6078
- * ```ts
6079
- * import { Console, Effect, Filter, Result, Stream } from "effect"
6216
+ * import { Console, Effect, Result, Stream } from "effect"
6080
6217
  *
6081
6218
  * const program = Effect.gen(function*() {
6082
6219
  * const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
6083
- * Stream.partitionQueue(
6084
- * Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
6085
- * )
6220
+ * Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
6086
6221
  * )
6087
6222
  *
6088
6223
  * const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
@@ -6100,16 +6235,16 @@ export const partitionQueue: {
6100
6235
  * @since 4.0.0
6101
6236
  * @category Filtering
6102
6237
  */
6103
- <A, E, R, Result extends Filter.ResultOrBool>(
6238
+ <A, E, R, Pass, Fail>(
6104
6239
  self: Stream<A, E, R>,
6105
- filter: Filter.OrPredicate<NoInfer<A>, Result>,
6240
+ filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
6106
6241
  options?: {
6107
6242
  readonly capacity?: number | "unbounded" | undefined
6108
6243
  }
6109
6244
  ): Effect.Effect<
6110
6245
  [
6111
- passes: Queue.Dequeue<Filter.Pass<A, Result>, E | Cause.Done>,
6112
- fails: Queue.Dequeue<Filter.Fail<A, Result>, E | Cause.Done>
6246
+ passes: Queue.Dequeue<Pass, E | Cause.Done>,
6247
+ fails: Queue.Dequeue<Fail, E | Cause.Done>
6113
6248
  ],
6114
6249
  never,
6115
6250
  R | Scope.Scope
@@ -6117,16 +6252,16 @@ export const partitionQueue: {
6117
6252
  } = dual(
6118
6253
  (args) => isStream(args[0]),
6119
6254
  Effect.fnUntraced(
6120
- function*<A, E, R, Result extends Filter.ResultOrBool>(
6255
+ function*<A, E, R, Pass, Fail>(
6121
6256
  self: Stream<A, E, R>,
6122
- filter: Filter.OrPredicate<NoInfer<A>, Result>,
6257
+ filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
6123
6258
  options?: {
6124
6259
  readonly capacity?: number | "unbounded" | undefined
6125
6260
  }
6126
6261
  ): Effect.fn.Return<
6127
6262
  [
6128
- passes: Queue.Dequeue<any, E | Cause.Done>,
6129
- fails: Queue.Dequeue<any, E | Cause.Done>
6263
+ passes: Queue.Dequeue<Pass, E | Cause.Done>,
6264
+ fails: Queue.Dequeue<Fail, E | Cause.Done>
6130
6265
  ],
6131
6266
  never,
6132
6267
  R | Scope.Scope
@@ -6135,19 +6270,17 @@ export const partitionQueue: {
6135
6270
  const pull = yield* Channel.toPullScoped(self.channel, scope)
6136
6271
  const capacity = options?.capacity === "unbounded" ? undefined : options?.capacity ?? DefaultChunkSize
6137
6272
  const passes = yield* Queue.make</**
6138
- * Partitions a stream using a Filter and exposes passing and failing values as queues.
6273
+ * Partitions a stream using a `Filter` and exposes passing and failing values as queues.
6139
6274
  *
6140
6275
  * Each queue fails with the stream error or `Cause.Done` when the source ends.
6141
6276
  *
6142
6277
  * @example
6143
6278
  * ```ts
6144
- * import { Console, Effect, Filter, Result, Stream } from "effect"
6279
+ * import { Console, Effect, Result, Stream } from "effect"
6145
6280
  *
6146
6281
  * const program = Effect.gen(function*() {
6147
6282
  * const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
6148
- * Stream.partitionQueue(
6149
- * Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
6150
- * )
6283
+ * Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
6151
6284
  * )
6152
6285
  *
6153
6286
  * const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
@@ -6165,20 +6298,18 @@ export const partitionQueue: {
6165
6298
  * @since 4.0.0
6166
6299
  * @category Filtering
6167
6300
  */
6168
- any, /**
6169
- * Partitions a stream using a Filter and exposes passing and failing values as queues.
6301
+ Pass, /**
6302
+ * Partitions a stream using a `Filter` and exposes passing and failing values as queues.
6170
6303
  *
6171
6304
  * Each queue fails with the stream error or `Cause.Done` when the source ends.
6172
6305
  *
6173
6306
  * @example
6174
6307
  * ```ts
6175
- * import { Console, Effect, Filter, Result, Stream } from "effect"
6308
+ * import { Console, Effect, Result, Stream } from "effect"
6176
6309
  *
6177
6310
  * const program = Effect.gen(function*() {
6178
6311
  * const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
6179
- * Stream.partitionQueue(
6180
- * Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
6181
- * )
6312
+ * Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
6182
6313
  * )
6183
6314
  *
6184
6315
  * const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
@@ -6198,19 +6329,17 @@ export const partitionQueue: {
6198
6329
  */
6199
6330
  E | Cause.Done>({ capacity })
6200
6331
  const fails = yield* Queue.make</**
6201
- * Partitions a stream using a Filter and exposes passing and failing values as queues.
6332
+ * Partitions a stream using a `Filter` and exposes passing and failing values as queues.
6202
6333
  *
6203
6334
  * Each queue fails with the stream error or `Cause.Done` when the source ends.
6204
6335
  *
6205
6336
  * @example
6206
6337
  * ```ts
6207
- * import { Console, Effect, Filter, Result, Stream } from "effect"
6338
+ * import { Console, Effect, Result, Stream } from "effect"
6208
6339
  *
6209
6340
  * const program = Effect.gen(function*() {
6210
6341
  * const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
6211
- * Stream.partitionQueue(
6212
- * Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
6213
- * )
6342
+ * Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
6214
6343
  * )
6215
6344
  *
6216
6345
  * const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
@@ -6228,20 +6357,18 @@ export const partitionQueue: {
6228
6357
  * @since 4.0.0
6229
6358
  * @category Filtering
6230
6359
  */
6231
- any, /**
6232
- * Partitions a stream using a Filter and exposes passing and failing values as queues.
6360
+ Fail, /**
6361
+ * Partitions a stream using a `Filter` and exposes passing and failing values as queues.
6233
6362
  *
6234
6363
  * Each queue fails with the stream error or `Cause.Done` when the source ends.
6235
6364
  *
6236
6365
  * @example
6237
6366
  * ```ts
6238
- * import { Console, Effect, Filter, Result, Stream } from "effect"
6367
+ * import { Console, Effect, Result, Stream } from "effect"
6239
6368
  *
6240
6369
  * const program = Effect.gen(function*() {
6241
6370
  * const [passes, fails] = yield* Stream.make(1, 2, 3, 4).pipe(
6242
- * Stream.partitionQueue(
6243
- * Filter.make((n) => (n % 2 === 0 ? Result.succeed(n) : Result.fail(n)))
6244
- * )
6371
+ * Stream.partitionQueue((n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
6245
6372
  * )
6246
6373
  *
6247
6374
  * const passValues = yield* Stream.fromQueue(passes).pipe(Stream.runCollect)
@@ -6261,12 +6388,19 @@ export const partitionQueue: {
6261
6388
  */
6262
6389
  E | Cause.Done>({ capacity })
6263
6390
 
6264
- const partitionArr = Arr.partition(filter as any)
6265
-
6266
6391
  yield* Effect.gen(function*() {
6267
6392
  while (true) {
6268
6393
  const chunk = yield* pull
6269
- const [excluded, satisfying] = partitionArr(chunk)
6394
+ const excluded: Array<Fail> = []
6395
+ const satisfying: Array<Pass> = []
6396
+ for (let i = 0; i < chunk.length; i++) {
6397
+ const result = filter(chunk[i] as NoInfer<A>)
6398
+ if (Result.isFailure(result)) {
6399
+ excluded.push(result.failure)
6400
+ } else {
6401
+ satisfying.push(result.success)
6402
+ }
6403
+ }
6270
6404
  let passFiber: Fiber.Fiber<any> | undefined = undefined
6271
6405
  if (satisfying.length > 0) {
6272
6406
  const leftover = Queue.offerAllUnsafe(passes, satisfying)
@@ -6297,147 +6431,112 @@ export const partitionQueue: {
6297
6431
  )
6298
6432
 
6299
6433
  /**
6300
- * Splits a stream using an effectful filter, producing pass and fail streams.
6434
+ * Splits a stream using an effectful `Filter`, producing pass and fail streams.
6301
6435
  *
6302
6436
  * @since 4.0.0
6303
6437
  * @category Filtering
6304
- *
6305
- * @example
6306
- * ```ts
6307
- * import { Console, Effect, Result, Stream } from "effect"
6308
- *
6309
- * const program = Effect.scoped(
6310
- * Effect.gen(function*() {
6311
- * const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
6312
- * Stream.partitionEffect((n) =>
6313
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
6314
- * )
6315
- * )
6316
- * const result = yield* Effect.all({
6317
- * evens: Stream.runCollect(evens),
6318
- * odds: Stream.runCollect(odds)
6319
- * })
6320
- * yield* Console.log(result)
6321
- * })
6322
- * )
6323
- *
6324
- * Effect.runPromise(program)
6325
- * // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
6326
- * ```
6327
6438
  */
6328
6439
  export const partitionEffect: {
6329
6440
  /**
6330
- * Splits a stream using an effectful filter, producing pass and fail streams.
6441
+ * Splits a stream using an effectful `Filter`, producing pass and fail streams.
6331
6442
  *
6332
6443
  * @since 4.0.0
6333
6444
  * @category Filtering
6334
- *
6335
- * @example
6336
- * ```ts
6337
- * import { Console, Effect, Result, Stream } from "effect"
6338
- *
6339
- * const program = Effect.scoped(
6340
- * Effect.gen(function*() {
6341
- * const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
6342
- * Stream.partitionEffect((n) =>
6343
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
6344
- * )
6345
- * )
6346
- * const result = yield* Effect.all({
6347
- * evens: Stream.runCollect(evens),
6348
- * odds: Stream.runCollect(odds)
6349
- * })
6350
- * yield* Console.log(result)
6351
- * })
6352
- * )
6353
- *
6354
- * Effect.runPromise(program)
6355
- * // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
6356
- * ```
6357
6445
  */
6358
- <A, B, X, EX, RX>(
6359
- filter: Filter.FilterEffect<A, B, X, EX, RX>,
6446
+ <A, Pass, Fail, EX, RX>(
6447
+ filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
6360
6448
  options?: {
6361
6449
  readonly capacity?: number | "unbounded" | undefined
6362
6450
  readonly concurrency?: number | "unbounded" | undefined
6363
6451
  }
6364
6452
  ): <E, R>(self: Stream<A, E, R>) => Effect.Effect<
6365
6453
  [
6366
- passes: Stream<B, E | EX>,
6367
- fails: Stream<X, E | EX>
6454
+ passes: Stream<Pass, E | EX>,
6455
+ fails: Stream<Fail, E | EX>
6368
6456
  ],
6369
6457
  never,
6370
6458
  R | RX | Scope.Scope
6371
6459
  >
6372
6460
  /**
6373
- * Splits a stream using an effectful filter, producing pass and fail streams.
6461
+ * Splits a stream using an effectful `Filter`, producing pass and fail streams.
6374
6462
  *
6375
6463
  * @since 4.0.0
6376
6464
  * @category Filtering
6377
- *
6378
- * @example
6379
- * ```ts
6380
- * import { Console, Effect, Result, Stream } from "effect"
6381
- *
6382
- * const program = Effect.scoped(
6383
- * Effect.gen(function*() {
6384
- * const [evens, odds] = yield* Stream.make(1, 2, 3, 4).pipe(
6385
- * Stream.partitionEffect((n) =>
6386
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n) : Result.fail(n))
6387
- * )
6388
- * )
6389
- * const result = yield* Effect.all({
6390
- * evens: Stream.runCollect(evens),
6391
- * odds: Stream.runCollect(odds)
6392
- * })
6393
- * yield* Console.log(result)
6394
- * })
6395
- * )
6396
- *
6397
- * Effect.runPromise(program)
6398
- * // Output: { evens: [ 2, 4 ], odds: [ 1, 3 ] }
6399
- * ```
6400
6465
  */
6401
- <A, E, R, B, X, EX, RX>(
6466
+ <A, E, R, Pass, Fail, EX, RX>(
6402
6467
  self: Stream<A, E, R>,
6403
- filter: Filter.FilterEffect<A, B, X, EX, RX>,
6468
+ filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
6404
6469
  options?: {
6405
6470
  readonly capacity?: number | "unbounded" | undefined
6406
6471
  readonly concurrency?: number | "unbounded" | undefined
6407
6472
  }
6408
6473
  ): Effect.Effect<
6409
6474
  [
6410
- passes: Stream<B, E | EX>,
6411
- fails: Stream<X, E | EX>
6475
+ passes: Stream<Pass, E | EX>,
6476
+ fails: Stream<Fail, E | EX>
6412
6477
  ],
6413
6478
  never,
6414
6479
  R | RX | Scope.Scope
6415
6480
  >
6416
6481
  } = dual(
6417
6482
  (args) => isStream(args[0]),
6418
- <A, E, R, B, X, EX, RX>(self: Stream<A, E, R>, filter: Filter.FilterEffect<A, B, X, EX, RX>, options?: {
6419
- readonly capacity?: number | "unbounded" | undefined
6420
- readonly concurrency?: number | "unbounded" | undefined
6421
- }): Effect.Effect<
6483
+ <A, E, R, Pass, Fail, EX, RX>(
6484
+ self: Stream<A, E, R>,
6485
+ filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, EX, RX>,
6486
+ options?: {
6487
+ readonly capacity?: number | "unbounded" | undefined
6488
+ readonly concurrency?: number | "unbounded" | undefined
6489
+ }
6490
+ ): Effect.Effect<
6422
6491
  [
6423
- passes: Stream<B, E | EX>,
6424
- fails: Stream<X, E | EX>
6492
+ passes: Stream<Pass, E | EX>,
6493
+ fails: Stream<Fail, E | EX>
6425
6494
  ],
6426
6495
  never,
6427
6496
  R | RX | Scope.Scope
6428
6497
  > =>
6429
6498
  Effect.map(
6430
- self.pipe(
6431
- mapEffect(filter, options),
6432
- partitionQueue(identity as any, options)
6499
+ partitionQueue</**
6500
+ * Splits a stream using an effectful `Filter`, producing pass and fail streams.
6501
+ *
6502
+ * @since 4.0.0
6503
+ * @category Filtering
6504
+ */
6505
+ Result.Result<Pass, Fail>, /**
6506
+ * Splits a stream using an effectful `Filter`, producing pass and fail streams.
6507
+ *
6508
+ * @since 4.0.0
6509
+ * @category Filtering
6510
+ */
6511
+ E | EX, /**
6512
+ * Splits a stream using an effectful `Filter`, producing pass and fail streams.
6513
+ *
6514
+ * @since 4.0.0
6515
+ * @category Filtering
6516
+ */
6517
+ R | RX, /**
6518
+ * Splits a stream using an effectful `Filter`, producing pass and fail streams.
6519
+ *
6520
+ * @since 4.0.0
6521
+ * @category Filtering
6522
+ */
6523
+ Pass, /**
6524
+ * Splits a stream using an effectful `Filter`, producing pass and fail streams.
6525
+ *
6526
+ * @since 4.0.0
6527
+ * @category Filtering
6528
+ */
6529
+ Fail>(
6530
+ mapEffect(self, (a) => filter(a as NoInfer<A>), options),
6531
+ (result) => result,
6532
+ options
6433
6533
  ),
6434
- ([passes, fails]) => [fromQueue(passes), fromQueue(fails)]
6435
- ) as any
6534
+ ([passes, fails]) => [fromQueue(passes), fromQueue(fails)] as const
6535
+ )
6436
6536
  )
6437
6537
 
6438
6538
  /**
6439
- * Splits a stream into excluded and satisfying substreams using a predicate,
6440
- * refinement, or Filter.
6539
+ * Splits a stream into excluded and satisfying substreams using a `Filter`.
6441
6540
  *
6442
6541
  * The faster stream may advance up to `bufferSize` elements ahead of the slower
6443
6542
  * one.
@@ -6447,12 +6546,12 @@ export const partitionEffect: {
6447
6546
  *
6448
6547
  * @example
6449
6548
  * ```ts
6450
- * import { Console, Effect, Stream } from "effect"
6549
+ * import { Console, Effect, Result, Stream } from "effect"
6451
6550
  *
6452
6551
  * const program = Effect.gen(function*() {
6453
6552
  * const [excluded, satisfying] = yield* Stream.partition(
6454
6553
  * Stream.make(1, 2, 3, 4),
6455
- * (n) => n % 2 === 0
6554
+ * (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
6456
6555
  * )
6457
6556
  * const left = yield* Stream.runCollect(excluded)
6458
6557
  * const right = yield* Stream.runCollect(satisfying)
@@ -6462,87 +6561,10 @@ export const partitionEffect: {
6462
6561
  * // Output: [ 2, 4 ]
6463
6562
  * })
6464
6563
  * ```
6465
- */
6466
- export const partition: {
6467
- /**
6468
- * Splits a stream into excluded and satisfying substreams using a predicate,
6469
- * refinement, or Filter.
6470
- *
6471
- * The faster stream may advance up to `bufferSize` elements ahead of the slower
6472
- * one.
6473
- *
6474
- * @since 4.0.0
6475
- * @category Filtering
6476
- *
6477
- * @example
6478
- * ```ts
6479
- * import { Console, Effect, Stream } from "effect"
6480
- *
6481
- * const program = Effect.gen(function*() {
6482
- * const [excluded, satisfying] = yield* Stream.partition(
6483
- * Stream.make(1, 2, 3, 4),
6484
- * (n) => n % 2 === 0
6485
- * )
6486
- * const left = yield* Stream.runCollect(excluded)
6487
- * const right = yield* Stream.runCollect(satisfying)
6488
- * yield* Console.log(left)
6489
- * // Output: [ 1, 3 ]
6490
- * yield* Console.log(right)
6491
- * // Output: [ 2, 4 ]
6492
- * })
6493
- * ```
6494
- */
6495
- <C extends A, B extends A, A = C>(
6496
- refinement: Refinement<NoInfer<A>, B>,
6497
- options?: { readonly bufferSize?: number | undefined }
6498
- ): <E, R>(
6499
- self: Stream<C, E, R>
6500
- ) => Effect.Effect<
6501
- [excluded: Stream<Exclude<C, B>, E>, satisfying: Stream<B, E>],
6502
- never,
6503
- R | Scope.Scope
6504
- >
6505
- /**
6506
- * Splits a stream into excluded and satisfying substreams using a predicate,
6507
- * refinement, or Filter.
6508
- *
6509
- * The faster stream may advance up to `bufferSize` elements ahead of the slower
6510
- * one.
6511
- *
6512
- * @since 4.0.0
6513
- * @category Filtering
6514
- *
6515
- * @example
6516
- * ```ts
6517
- * import { Console, Effect, Stream } from "effect"
6518
- *
6519
- * const program = Effect.gen(function*() {
6520
- * const [excluded, satisfying] = yield* Stream.partition(
6521
- * Stream.make(1, 2, 3, 4),
6522
- * (n) => n % 2 === 0
6523
- * )
6524
- * const left = yield* Stream.runCollect(excluded)
6525
- * const right = yield* Stream.runCollect(satisfying)
6526
- * yield* Console.log(left)
6527
- * // Output: [ 1, 3 ]
6528
- * yield* Console.log(right)
6529
- * // Output: [ 2, 4 ]
6530
- * })
6531
- * ```
6532
- */
6533
- <A, Result extends Filter.ResultOrBool>(
6534
- filter: Filter.OrPredicate<NoInfer<A>, Result>,
6535
- options?: { readonly bufferSize?: number | undefined }
6536
- ): <E, R>(
6537
- self: Stream<A, E, R>
6538
- ) => Effect.Effect<
6539
- [excluded: Stream<Filter.Fail<A, Result>, E>, satisfying: Stream<Filter.Pass<A, Result>, E>],
6540
- never,
6541
- R | Scope.Scope
6542
- >
6564
+ */
6565
+ export const partition: {
6543
6566
  /**
6544
- * Splits a stream into excluded and satisfying substreams using a predicate,
6545
- * refinement, or Filter.
6567
+ * Splits a stream into excluded and satisfying substreams using a `Filter`.
6546
6568
  *
6547
6569
  * The faster stream may advance up to `bufferSize` elements ahead of the slower
6548
6570
  * one.
@@ -6552,12 +6574,12 @@ export const partition: {
6552
6574
  *
6553
6575
  * @example
6554
6576
  * ```ts
6555
- * import { Console, Effect, Stream } from "effect"
6577
+ * import { Console, Effect, Result, Stream } from "effect"
6556
6578
  *
6557
6579
  * const program = Effect.gen(function*() {
6558
6580
  * const [excluded, satisfying] = yield* Stream.partition(
6559
6581
  * Stream.make(1, 2, 3, 4),
6560
- * (n) => n % 2 === 0
6582
+ * (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
6561
6583
  * )
6562
6584
  * const left = yield* Stream.runCollect(excluded)
6563
6585
  * const right = yield* Stream.runCollect(satisfying)
@@ -6568,18 +6590,18 @@ export const partition: {
6568
6590
  * })
6569
6591
  * ```
6570
6592
  */
6571
- <C extends A, E, R, B extends A, A = C>(
6572
- self: Stream<C, E, R>,
6573
- refinement: Refinement<A, B>,
6593
+ <A, Pass, Fail>(
6594
+ filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
6574
6595
  options?: { readonly bufferSize?: number | undefined }
6575
- ): Effect.Effect<
6576
- [excluded: Stream<Exclude<C, B>, E>, satisfying: Stream<B, E>],
6596
+ ): <E, R>(
6597
+ self: Stream<A, E, R>
6598
+ ) => Effect.Effect<
6599
+ [excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
6577
6600
  never,
6578
6601
  R | Scope.Scope
6579
6602
  >
6580
6603
  /**
6581
- * Splits a stream into excluded and satisfying substreams using a predicate,
6582
- * refinement, or Filter.
6604
+ * Splits a stream into excluded and satisfying substreams using a `Filter`.
6583
6605
  *
6584
6606
  * The faster stream may advance up to `bufferSize` elements ahead of the slower
6585
6607
  * one.
@@ -6589,12 +6611,12 @@ export const partition: {
6589
6611
  *
6590
6612
  * @example
6591
6613
  * ```ts
6592
- * import { Console, Effect, Stream } from "effect"
6614
+ * import { Console, Effect, Result, Stream } from "effect"
6593
6615
  *
6594
6616
  * const program = Effect.gen(function*() {
6595
6617
  * const [excluded, satisfying] = yield* Stream.partition(
6596
6618
  * Stream.make(1, 2, 3, 4),
6597
- * (n) => n % 2 === 0
6619
+ * (n) => n % 2 === 0 ? Result.succeed(n) : Result.fail(n)
6598
6620
  * )
6599
6621
  * const left = yield* Stream.runCollect(excluded)
6600
6622
  * const right = yield* Stream.runCollect(satisfying)
@@ -6605,28 +6627,28 @@ export const partition: {
6605
6627
  * })
6606
6628
  * ```
6607
6629
  */
6608
- <A, E, R, Result extends Filter.ResultOrBool>(
6630
+ <A, E, R, Pass, Fail>(
6609
6631
  self: Stream<A, E, R>,
6610
- filter: Filter.OrPredicate<NoInfer<A>, Result>,
6632
+ filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
6611
6633
  options?: { readonly bufferSize?: number | undefined }
6612
6634
  ): Effect.Effect<
6613
- [excluded: Stream<Filter.Fail<A, Result>, E>, satisfying: Stream<Filter.Pass<A, Result>, E>],
6635
+ [excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
6614
6636
  never,
6615
6637
  R | Scope.Scope
6616
6638
  >
6617
6639
  } = dual(
6618
6640
  (args) => isStream(args[0]),
6619
- <A, E, R, Result extends Filter.ResultOrBool>(
6641
+ <A, E, R, Pass, Fail>(
6620
6642
  self: Stream<A, E, R>,
6621
- filter: Filter.OrPredicate<NoInfer<A>, Result>,
6643
+ filter: Filter.Filter<NoInfer<A>, Pass, Fail>,
6622
6644
  options?: { readonly bufferSize?: number | undefined }
6623
6645
  ): Effect.Effect<
6624
- [excluded: Stream<Filter.Fail<A, Result>, E>, satisfying: Stream<Filter.Pass<A, Result>, E>],
6646
+ [excluded: Stream<Fail, E>, satisfying: Stream<Pass, E>],
6625
6647
  never,
6626
6648
  R | Scope.Scope
6627
6649
  > =>
6628
6650
  Effect.map(
6629
- partitionQueue(filter, { capacity: options?.bufferSize ?? 16 })(self),
6651
+ partitionQueue(self, filter, { capacity: options?.bufferSize ?? 16 }),
6630
6652
  ([passes, fails]) => [fromQueue(fails), fromQueue(passes)] as const
6631
6653
  )
6632
6654
  )
@@ -7408,7 +7430,7 @@ export const tapError: {
7408
7430
  ))
7409
7431
 
7410
7432
  /**
7411
- * Recovers from errors that match a filter by switching to a recovery stream.
7433
+ * Recovers from errors that match a predicate by switching to a recovery stream.
7412
7434
  *
7413
7435
  * When a failure matches the filter, the stream switches to the recovery
7414
7436
  * stream. Non-matching failures propagate downstream, so the error type is
@@ -7422,12 +7444,12 @@ export const tapError: {
7422
7444
  *
7423
7445
  * @example
7424
7446
  * ```ts
7425
- * import { Console, Effect, Filter, Stream } from "effect"
7447
+ * import { Console, Effect, Stream } from "effect"
7426
7448
  *
7427
7449
  * const stream = Stream.make(1, 2).pipe(
7428
7450
  * Stream.concat(Stream.fail(42)),
7429
7451
  * Stream.catchIf(
7430
- * Filter.fromPredicate((error): error is 42 => error === 42),
7452
+ * (error): error is 42 => error === 42,
7431
7453
  * () => Stream.make(999)
7432
7454
  * )
7433
7455
  * )
@@ -7446,7 +7468,7 @@ export const tapError: {
7446
7468
  */
7447
7469
  export const catchIf: {
7448
7470
  /**
7449
- * Recovers from errors that match a filter by switching to a recovery stream.
7471
+ * Recovers from errors that match a predicate by switching to a recovery stream.
7450
7472
  *
7451
7473
  * When a failure matches the filter, the stream switches to the recovery
7452
7474
  * stream. Non-matching failures propagate downstream, so the error type is
@@ -7460,12 +7482,12 @@ export const catchIf: {
7460
7482
  *
7461
7483
  * @example
7462
7484
  * ```ts
7463
- * import { Console, Effect, Filter, Stream } from "effect"
7485
+ * import { Console, Effect, Stream } from "effect"
7464
7486
  *
7465
7487
  * const stream = Stream.make(1, 2).pipe(
7466
7488
  * Stream.concat(Stream.fail(42)),
7467
7489
  * Stream.catchIf(
7468
- * Filter.fromPredicate((error): error is 42 => error === 42),
7490
+ * (error): error is 42 => error === 42,
7469
7491
  * () => Stream.make(999)
7470
7492
  * )
7471
7493
  * )
@@ -7488,7 +7510,7 @@ export const catchIf: {
7488
7510
  orElse?: ((e: Exclude<E, EB>) => Stream<A3, E3, R3>) | undefined
7489
7511
  ): <A, R>(self: Stream<A, E, R>) => Stream<A2 | A | A3, E2 | E3, R2 | R | R3>
7490
7512
  /**
7491
- * Recovers from errors that match a filter by switching to a recovery stream.
7513
+ * Recovers from errors that match a predicate by switching to a recovery stream.
7492
7514
  *
7493
7515
  * When a failure matches the filter, the stream switches to the recovery
7494
7516
  * stream. Non-matching failures propagate downstream, so the error type is
@@ -7502,12 +7524,12 @@ export const catchIf: {
7502
7524
  *
7503
7525
  * @example
7504
7526
  * ```ts
7505
- * import { Console, Effect, Filter, Stream } from "effect"
7527
+ * import { Console, Effect, Stream } from "effect"
7506
7528
  *
7507
7529
  * const stream = Stream.make(1, 2).pipe(
7508
7530
  * Stream.concat(Stream.fail(42)),
7509
7531
  * Stream.catchIf(
7510
- * Filter.fromPredicate((error): error is 42 => error === 42),
7532
+ * (error): error is 42 => error === 42,
7511
7533
  * () => Stream.make(999)
7512
7534
  * )
7513
7535
  * )
@@ -7524,13 +7546,13 @@ export const catchIf: {
7524
7546
  * @since 4.0.0
7525
7547
  * @category Error Handling
7526
7548
  */
7527
- <E, Result extends Filter.ResultOrBool, A2, E2, R2, A3 = never, E3 = Filter.Fail<E, Result>, R3 = never>(
7528
- filter: Filter.OrPredicate<NoInfer<E>, Result>,
7529
- f: (failure: Filter.Pass<E, Result>) => Stream<A2, E2, R2>,
7530
- orElse?: ((failure: Filter.Fail<E, Result>) => Stream<A3, E3, R3>) | undefined
7531
- ): <A, R>(self: Stream<A, E, R>) => Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
7549
+ <E, A2, E2, R2, A3 = never, E3 = E, R3 = never>(
7550
+ predicate: Predicate<NoInfer<E>>,
7551
+ f: (e: NoInfer<E>) => Stream<A2, E2, R2>,
7552
+ orElse?: ((e: NoInfer<E>) => Stream<A3, E3, R3>) | undefined
7553
+ ): <A, R>(self: Stream<A, E, R>) => Stream<A2 | A | A3, E2 | E3, R2 | R | R3>
7532
7554
  /**
7533
- * Recovers from errors that match a filter by switching to a recovery stream.
7555
+ * Recovers from errors that match a predicate by switching to a recovery stream.
7534
7556
  *
7535
7557
  * When a failure matches the filter, the stream switches to the recovery
7536
7558
  * stream. Non-matching failures propagate downstream, so the error type is
@@ -7544,12 +7566,12 @@ export const catchIf: {
7544
7566
  *
7545
7567
  * @example
7546
7568
  * ```ts
7547
- * import { Console, Effect, Filter, Stream } from "effect"
7569
+ * import { Console, Effect, Stream } from "effect"
7548
7570
  *
7549
7571
  * const stream = Stream.make(1, 2).pipe(
7550
7572
  * Stream.concat(Stream.fail(42)),
7551
7573
  * Stream.catchIf(
7552
- * Filter.fromPredicate((error): error is 42 => error === 42),
7574
+ * (error): error is 42 => error === 42,
7553
7575
  * () => Stream.make(999)
7554
7576
  * )
7555
7577
  * )
@@ -7573,7 +7595,7 @@ export const catchIf: {
7573
7595
  orElse?: ((e: Exclude<E, EB>) => Stream<A3, E3, R3>) | undefined
7574
7596
  ): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
7575
7597
  /**
7576
- * Recovers from errors that match a filter by switching to a recovery stream.
7598
+ * Recovers from errors that match a predicate by switching to a recovery stream.
7577
7599
  *
7578
7600
  * When a failure matches the filter, the stream switches to the recovery
7579
7601
  * stream. Non-matching failures propagate downstream, so the error type is
@@ -7587,12 +7609,12 @@ export const catchIf: {
7587
7609
  *
7588
7610
  * @example
7589
7611
  * ```ts
7590
- * import { Console, Effect, Filter, Stream } from "effect"
7612
+ * import { Console, Effect, Stream } from "effect"
7591
7613
  *
7592
7614
  * const stream = Stream.make(1, 2).pipe(
7593
7615
  * Stream.concat(Stream.fail(42)),
7594
7616
  * Stream.catchIf(
7595
- * Filter.fromPredicate((error): error is 42 => error === 42),
7617
+ * (error): error is 42 => error === 42,
7596
7618
  * () => Stream.make(999)
7597
7619
  * )
7598
7620
  * )
@@ -7609,37 +7631,96 @@ export const catchIf: {
7609
7631
  * @since 4.0.0
7610
7632
  * @category Error Handling
7611
7633
  */
7612
- <A, E, R, Result extends Filter.ResultOrBool, A2, E2, R2, A3 = never, E3 = Filter.Fail<E, Result>, R3 = never>(
7634
+ <A, E, R, A2, E2, R2, A3 = never, E3 = E, R3 = never>(
7613
7635
  self: Stream<A, E, R>,
7614
- filter: Filter.OrPredicate<NoInfer<E>, Result>,
7615
- f: (failure: Filter.Pass<E, Result>) => Stream<A2, E2, R2>,
7616
- orElse?: ((failure: Filter.Fail<E, Result>) => Stream<A3, E3, R3>) | undefined
7636
+ predicate: Predicate<E>,
7637
+ f: (e: E) => Stream<A2, E2, R2>,
7638
+ orElse?: ((e: E) => Stream<A3, E3, R3>) | undefined
7617
7639
  ): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
7618
7640
  } = dual((args) => isStream(args[0]), <
7619
7641
  A,
7620
7642
  E,
7621
7643
  R,
7622
- Result extends Filter.ResultOrBool,
7623
7644
  A2,
7624
7645
  E2,
7625
7646
  R2,
7626
7647
  A3 = never,
7627
- E3 = Filter.Fail<E, Result>,
7648
+ E3 = E,
7628
7649
  R3 = never
7629
7650
  >(
7630
7651
  self: Stream<A, E, R>,
7631
- filter: Filter.OrPredicate<NoInfer<E>, Result>,
7632
- f: (failure: Filter.Pass<E, Result>) => Stream<A2, E2, R2>,
7633
- orElse?: ((failure: Filter.Fail<E, Result>) => Stream<A3, E3, R3>) | undefined
7652
+ predicate: Predicate<E>,
7653
+ f: (failure: E) => Stream<A2, E2, R2>,
7654
+ orElse?: ((failure: E) => Stream<A3, E3, R3>) | undefined
7634
7655
  ): Stream<A | A2 | A3, E2 | E3, R | R2 | R3> =>
7635
7656
  fromChannel(
7636
7657
  Channel.catchIf(
7637
7658
  toChannel(self),
7638
- filter as any,
7639
- (e: any) => f(e).channel,
7640
- orElse && ((e: any) => orElse(e).channel)
7659
+ predicate,
7660
+ (e) => f(e).channel,
7661
+ orElse && ((e) => orElse(e).channel)
7662
+ )
7663
+ ))
7664
+
7665
+ /**
7666
+ * Recovers from errors that match a `Filter` by switching to a recovery
7667
+ * stream.
7668
+ *
7669
+ * @since 4.0.0
7670
+ * @category Error Handling
7671
+ */
7672
+ export const catchFilter: {
7673
+ /**
7674
+ * Recovers from errors that match a `Filter` by switching to a recovery
7675
+ * stream.
7676
+ *
7677
+ * @since 4.0.0
7678
+ * @category Error Handling
7679
+ */
7680
+ <E, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(
7681
+ filter: Filter.Filter<NoInfer<E>, EB, X>,
7682
+ f: (failure: EB) => Stream<A2, E2, R2>,
7683
+ orElse?: ((failure: X) => Stream<A3, E3, R3>) | undefined
7684
+ ): <A, R>(self: Stream<A, E, R>) => Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
7685
+ /**
7686
+ * Recovers from errors that match a `Filter` by switching to a recovery
7687
+ * stream.
7688
+ *
7689
+ * @since 4.0.0
7690
+ * @category Error Handling
7691
+ */
7692
+ <A, E, R, EB, A2, E2, R2, X, A3 = never, E3 = X, R3 = never>(
7693
+ self: Stream<A, E, R>,
7694
+ filter: Filter.Filter<NoInfer<E>, EB, X>,
7695
+ f: (failure: EB) => Stream<A2, E2, R2>,
7696
+ orElse?: ((failure: X) => Stream<A3, E3, R3>) | undefined
7697
+ ): Stream<A | A2 | A3, E2 | E3, R | R2 | R3>
7698
+ } = dual((args) => isStream(args[0]), <
7699
+ A,
7700
+ E,
7701
+ R,
7702
+ EB,
7703
+ A2,
7704
+ E2,
7705
+ R2,
7706
+ X,
7707
+ A3 = never,
7708
+ E3 = X,
7709
+ R3 = never
7710
+ >(
7711
+ self: Stream<A, E, R>,
7712
+ filter: Filter.Filter<NoInfer<E>, EB, X>,
7713
+ f: (failure: EB) => Stream<A2, E2, R2>,
7714
+ orElse?: ((failure: X) => Stream<A3, E3, R3>) | undefined
7715
+ ): Stream<A | A2 | A3, E2 | E3, R | R2 | R3> =>
7716
+ fromChannel(
7717
+ Channel.catchFilter(
7718
+ toChannel(self),
7719
+ filter,
7720
+ (e) => f(e).channel,
7721
+ orElse && ((e) => orElse(e).channel)
7641
7722
  )
7642
- ) as any)
7723
+ ))
7643
7724
 
7644
7725
  /**
7645
7726
  * Recovers from failures whose `_tag` matches the provided value by switching to
@@ -7978,7 +8059,7 @@ export const catchTags: {
7978
8059
  >
7979
8060
  } = dual((args) => isStream(args[0]), (self, cases, orElse) => {
7980
8061
  let keys: Array<string>
7981
- return catchIf(
8062
+ return catchFilter(
7982
8063
  self,
7983
8064
  (e: any) => {
7984
8065
  keys ??= Object.keys(cases)
@@ -8091,8 +8172,16 @@ export const catchReason: {
8091
8172
  >(
8092
8173
  errorTag: K,
8093
8174
  reasonTag: RK,
8094
- f: (reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>) => Stream<A2, E2, R2>,
8095
- orElse?: ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RK>) => Stream<A3, E3, R3>) | undefined
8175
+ f: (
8176
+ reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>,
8177
+ error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>
8178
+ ) => Stream<A2, E2, R2>,
8179
+ orElse?:
8180
+ | ((
8181
+ reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, RK>,
8182
+ error: OmitReason<ExtractTag<NoInfer<E>, K>, RK>
8183
+ ) => Stream<A3, E3, R3>)
8184
+ | undefined
8096
8185
  ): <A, R>(
8097
8186
  self: Stream<A, E, R>
8098
8187
  ) => Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>
@@ -8155,8 +8244,10 @@ export const catchReason: {
8155
8244
  self: Stream<A, E, R>,
8156
8245
  errorTag: K,
8157
8246
  reasonTag: RK,
8158
- f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
8159
- orElse?: ((reason: ExcludeReason<ExtractTag<E, K>, RK>) => Stream<A3, E3, R3>) | undefined
8247
+ f: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
8248
+ orElse?:
8249
+ | ((reason: ExcludeReason<ExtractTag<E, K>, RK>, error: OmitReason<ExtractTag<E, K>, RK>) => Stream<A3, E3, R3>)
8250
+ | undefined
8160
8251
  ): Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3>
8161
8252
  } = dual(
8162
8253
  (args) => isStream(args[0]),
@@ -8176,16 +8267,18 @@ export const catchReason: {
8176
8267
  self: Stream<A, E, R>,
8177
8268
  errorTag: K,
8178
8269
  reasonTag: RK,
8179
- f: (reason: ExtractReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
8180
- orElse?: ((reason: ExcludeReason<ExtractTag<E, K>, RK>) => Stream<A3, E3, R3>) | undefined
8270
+ f: (reason: ExtractReason<ExtractTag<E, K>, RK>, error: NarrowReason<ExtractTag<E, K>, RK>) => Stream<A2, E2, R2>,
8271
+ orElse?:
8272
+ | ((reason: ExcludeReason<ExtractTag<E, K>, RK>, error: OmitReason<ExtractTag<E, K>, RK>) => Stream<A3, E3, R3>)
8273
+ | undefined
8181
8274
  ): Stream<A | A2 | Exclude<A3, unassigned>, (A3 extends unassigned ? E : ExcludeTag<E, K>) | E2 | E3, R | R2 | R3> =>
8182
8275
  fromChannel(
8183
8276
  Channel.catchReason(
8184
8277
  toChannel(self),
8185
8278
  errorTag,
8186
8279
  reasonTag,
8187
- (reason) => f(reason).channel,
8188
- orElse && ((reason) => orElse(reason).channel)
8280
+ (reason, error) => f(reason, error).channel,
8281
+ orElse && ((reason, error) => orElse(reason, error).channel)
8189
8282
  )
8190
8283
  ) as any
8191
8284
  )
@@ -8278,7 +8371,8 @@ export const catchReasons: {
8278
8371
  E,
8279
8372
  Cases extends {
8280
8373
  [RK in ReasonTags<ExtractTag<NoInfer<E>, K>>]+?: (
8281
- reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>
8374
+ reason: ExtractReason<ExtractTag<NoInfer<E>, K>, RK>,
8375
+ error: NarrowReason<ExtractTag<NoInfer<E>, K>, RK>
8282
8376
  ) => Stream<any, any, any>
8283
8377
  },
8284
8378
  A2 = unassigned,
@@ -8288,7 +8382,10 @@ export const catchReasons: {
8288
8382
  errorTag: K,
8289
8383
  cases: Cases,
8290
8384
  orElse?:
8291
- | ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Stream<A2, E2, R2>)
8385
+ | ((
8386
+ reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>,
8387
+ error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>
8388
+ ) => Stream<A2, E2, R2>)
8292
8389
  | undefined
8293
8390
  ): <A, R>(self: Stream<A, E, R>) => Stream<
8294
8391
  | A
@@ -8355,7 +8452,8 @@ export const catchReasons: {
8355
8452
  K extends Tags<E>,
8356
8453
  Cases extends {
8357
8454
  [RK in ReasonTags<ExtractTag<E, K>>]+?: (
8358
- reason: ExtractReason<ExtractTag<E, K>, RK>
8455
+ reason: ExtractReason<ExtractTag<E, K>, RK>,
8456
+ error: NarrowReason<ExtractTag<E, K>, RK>
8359
8457
  ) => Stream<any, any, any>
8360
8458
  },
8361
8459
  A2 = unassigned,
@@ -8366,7 +8464,10 @@ export const catchReasons: {
8366
8464
  errorTag: K,
8367
8465
  cases: Cases,
8368
8466
  orElse?:
8369
- | ((reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>) => Stream<A2, E2, R2>)
8467
+ | ((
8468
+ reason: ExcludeReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>,
8469
+ error: OmitReason<ExtractTag<NoInfer<E>, K>, Extract<keyof Cases, string>>
8470
+ ) => Stream<A2, E2, R2>)
8370
8471
  | undefined
8371
8472
  ): Stream<
8372
8473
  | A
@@ -8386,12 +8487,12 @@ export const catchReasons: {
8386
8487
  }[keyof Cases]
8387
8488
  >
8388
8489
  } = dual((args) => isStream(args[0]), (self, errorTag, cases, orElse) => {
8389
- const handlers: Record<string, (reason: any) => Channel.Channel<any, any, any, any, any, any, any>> = {}
8490
+ const handlers: Record<string, (reason: any, error: any) => Channel.Channel<any, any, any, any, any, any, any>> = {}
8390
8491
  for (const key of Object.keys(cases)) {
8391
8492
  const handler = (cases as any)[key]
8392
- handlers[key] = (reason) => handler(reason).channel
8493
+ handlers[key] = (reason, error) => handler(reason, error).channel
8393
8494
  }
8394
- const orElseHandler = orElse && ((reason: any) => orElse(reason).channel)
8495
+ const orElseHandler = orElse && ((reason: any, error: any) => orElse(reason, error).channel)
8395
8496
  return fromChannel(
8396
8497
  Channel.catchReasons(self.channel, errorTag as any, handlers as any, orElseHandler as any) as Channel.Channel<
8397
8498
  Arr.NonEmptyReadonlyArray<any>,
@@ -8549,12 +8650,12 @@ export const catchCauseIf: {
8549
8650
  * @since 4.0.0
8550
8651
  * @category Error Handling
8551
8652
  */
8552
- <E, Result extends Filter.ResultOrBool<Cause.Cause<any>>, A2, E2, R2>(
8553
- filter: Filter.OrPredicate<Cause.Cause<E>, Result>,
8554
- f: (failure: Filter.Pass<Cause.Cause<E>, Result>, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
8653
+ <E, A2, E2, R2>(
8654
+ predicate: Predicate<Cause.Cause<E>>,
8655
+ f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
8555
8656
  ): <A, R>(
8556
8657
  self: Stream<A, E, R>
8557
- ) => Stream<A | A2, Cause.Cause.Error<Filter.Fail<Cause.Cause<E>, Result>> | E2, R2 | R>
8658
+ ) => Stream<A | A2, E | E2, R2 | R>
8558
8659
  /**
8559
8660
  * Recovers from stream failures by filtering the `Cause` and switching to a recovery stream.
8560
8661
  * Non-matching causes are re-emitted as failures.
@@ -8588,19 +8689,68 @@ export const catchCauseIf: {
8588
8689
  * @since 4.0.0
8589
8690
  * @category Error Handling
8590
8691
  */
8591
- <A, E, R, A2, E2, R2, Result extends Filter.ResultOrBool<Cause.Cause<any>>>(
8692
+ <A, E, R, A2, E2, R2>(
8693
+ self: Stream<A, E, R>,
8694
+ predicate: Predicate<Cause.Cause<E>>,
8695
+ f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
8696
+ ): Stream<A | A2, E | E2, R | R2>
8697
+ } = dual(3, <A, E, R, A2, E2, R2>(
8698
+ self: Stream<A, E, R>,
8699
+ predicate: Predicate<Cause.Cause<E>>,
8700
+ f: (cause: Cause.Cause<E>) => Stream<A2, E2, R2>
8701
+ ): Stream<A | A2, E | E2, R | R2> =>
8702
+ fromChannel(
8703
+ Channel.catchCauseIf(
8704
+ self.channel,
8705
+ predicate,
8706
+ (cause) => f(cause).channel
8707
+ )
8708
+ ))
8709
+
8710
+ /**
8711
+ * Recovers from stream failures by filtering the `Cause` and switching to a
8712
+ * recovery stream.
8713
+ *
8714
+ * @since 4.0.0
8715
+ * @category Error Handling
8716
+ */
8717
+ export const catchCauseFilter: {
8718
+ /**
8719
+ * Recovers from stream failures by filtering the `Cause` and switching to a
8720
+ * recovery stream.
8721
+ *
8722
+ * @since 4.0.0
8723
+ * @category Error Handling
8724
+ */
8725
+ <E, EB, A2, E2, R2, X extends Cause.Cause<any>>(
8726
+ filter: Filter.Filter<Cause.Cause<E>, EB, X>,
8727
+ f: (failure: EB, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
8728
+ ): <A, R>(
8729
+ self: Stream<A, E, R>
8730
+ ) => Stream<A | A2, Cause.Cause.Error<X> | E2, R2 | R>
8731
+ /**
8732
+ * Recovers from stream failures by filtering the `Cause` and switching to a
8733
+ * recovery stream.
8734
+ *
8735
+ * @since 4.0.0
8736
+ * @category Error Handling
8737
+ */
8738
+ <A, E, R, EB, A2, E2, R2, X extends Cause.Cause<any>>(
8592
8739
  self: Stream<A, E, R>,
8593
- filter: Filter.OrPredicate<Cause.Cause<E>, Result>,
8594
- f: (failure: Filter.Pass<Cause.Cause<E>, Result>, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
8595
- ): Stream<A | A2, Cause.Cause.Error<Filter.Fail<Cause.Cause<E>, Result>> | E2, R | R2>
8596
- } = dual(3, <A, E, R, A2, E2, R2, Result extends Filter.ResultOrBool<Cause.Cause<any>>>(
8740
+ filter: Filter.Filter<Cause.Cause<E>, EB, X>,
8741
+ f: (failure: EB, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
8742
+ ): Stream<A | A2, Cause.Cause.Error<X> | E2, R | R2>
8743
+ } = dual(3, <A, E, R, EB, A2, E2, R2, X extends Cause.Cause<any>>(
8597
8744
  self: Stream<A, E, R>,
8598
- filter: Filter.OrPredicate<Cause.Cause<E>, Result>,
8599
- f: (failure: Filter.Pass<Cause.Cause<E>, Result>, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
8600
- ): Stream<A | A2, Cause.Cause.Error<Filter.Fail<Cause.Cause<E>, Result>> | E2, R | R2> =>
8745
+ filter: Filter.Filter<Cause.Cause<E>, EB, X>,
8746
+ f: (failure: EB, cause: Cause.Cause<E>) => Stream<A2, E2, R2>
8747
+ ): Stream<A | A2, Cause.Cause.Error<X> | E2, R | R2> =>
8601
8748
  fromChannel(
8602
- Channel.catchCauseIf(self.channel, filter as any, (failure: any, cause: any) =>
8603
- (f as any)(failure, cause).channel) as any
8749
+ Channel.catchCauseFilter(
8750
+ self.channel,
8751
+ filter,
8752
+ (failure, cause) => f(failure, cause).channel
8753
+ )
8604
8754
  ))
8605
8755
 
8606
8756
  /**
@@ -8819,12 +8969,12 @@ export const orDie = <A, E, R>(self: Stream<A, E, R>): Stream<A, never, R> => fr
8819
8969
  */
8820
8970
  export const ignore: <
8821
8971
  Arg extends Stream<any, any, any> | {
8822
- readonly log?: boolean | LogLevel | undefined
8972
+ readonly log?: boolean | Severity | undefined
8823
8973
  } | undefined
8824
8974
  >(
8825
8975
  selfOrOptions: Arg,
8826
8976
  options?: {
8827
- readonly log?: boolean | LogLevel | undefined
8977
+ readonly log?: boolean | Severity | undefined
8828
8978
  } | undefined
8829
8979
  ) => [Arg] extends [Stream<infer A, infer _E, infer R>] ? Stream<A, never, R>
8830
8980
  : <A, E, R>(self: Stream<A, E, R>) => Stream<A, never, R> = dual(
@@ -8832,7 +8982,7 @@ export const ignore: <
8832
8982
  <A, E, R>(
8833
8983
  self: Stream<A, E, R>,
8834
8984
  options?: {
8835
- readonly log?: boolean | LogLevel | undefined
8985
+ readonly log?: boolean | Severity | undefined
8836
8986
  } | undefined
8837
8987
  ): Stream<A, never, R> => fromChannel(Channel.ignore(self.channel, options))
8838
8988
  )
@@ -8859,19 +9009,19 @@ export const ignore: <
8859
9009
  */
8860
9010
  export const ignoreCause: <
8861
9011
  Arg extends Stream<any, any, any> | {
8862
- readonly log?: boolean | LogLevel | undefined
9012
+ readonly log?: boolean | Severity | undefined
8863
9013
  } | undefined
8864
9014
  >(
8865
9015
  streamOrOptions: Arg,
8866
9016
  options?: {
8867
- readonly log?: boolean | LogLevel | undefined
9017
+ readonly log?: boolean | Severity | undefined
8868
9018
  } | undefined
8869
9019
  ) => [Arg] extends [Stream<infer A, infer _E, infer R>] ? Stream<A, never, R>
8870
9020
  : <A, E, R>(self: Stream<A, E, R>) => Stream<A, never, R> = dual(
8871
9021
  (args) => isStream(args[0]),
8872
9022
  <A, E, R>(
8873
9023
  self: Stream<A, E, R>,
8874
- options?: { readonly log?: boolean | LogLevel | undefined } | undefined
9024
+ options?: { readonly log?: boolean | Severity | undefined } | undefined
8875
9025
  ): Stream<A, never, R> => fromChannel(Channel.ignoreCause(self.channel, options))
8876
9026
  )
8877
9027
 
@@ -9006,9 +9156,9 @@ export const retry: {
9006
9156
  *
9007
9157
  * @example
9008
9158
  * ```ts
9009
- * import { Console, Effect, ExecutionPlan, Layer, ServiceMap, Stream } from "effect"
9159
+ * import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
9010
9160
  *
9011
- * class Service extends ServiceMap.Service<Service>()("Service", {
9161
+ * class Service extends Context.Service<Service>()("Service", {
9012
9162
  * make: Effect.succeed({
9013
9163
  * stream: Stream.fail("A") as Stream.Stream<number, string>
9014
9164
  * })
@@ -9048,9 +9198,9 @@ export const withExecutionPlan: {
9048
9198
  *
9049
9199
  * @example
9050
9200
  * ```ts
9051
- * import { Console, Effect, ExecutionPlan, Layer, ServiceMap, Stream } from "effect"
9201
+ * import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
9052
9202
  *
9053
- * class Service extends ServiceMap.Service<Service>()("Service", {
9203
+ * class Service extends Context.Service<Service>()("Service", {
9054
9204
  * make: Effect.succeed({
9055
9205
  * stream: Stream.fail("A") as Stream.Stream<number, string>
9056
9206
  * })
@@ -9093,9 +9243,9 @@ export const withExecutionPlan: {
9093
9243
  *
9094
9244
  * @example
9095
9245
  * ```ts
9096
- * import { Console, Effect, ExecutionPlan, Layer, ServiceMap, Stream } from "effect"
9246
+ * import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
9097
9247
  *
9098
- * class Service extends ServiceMap.Service<Service>()("Service", {
9248
+ * class Service extends Context.Service<Service>()("Service", {
9099
9249
  * make: Effect.succeed({
9100
9250
  * stream: Stream.fail("A") as Stream.Stream<number, string>
9101
9251
  * })
@@ -9168,9 +9318,9 @@ export const withExecutionPlan: {
9168
9318
  *
9169
9319
  * @example
9170
9320
  * ```ts
9171
- * import { Console, Effect, ExecutionPlan, Layer, ServiceMap, Stream } from "effect"
9321
+ * import { Console, Effect, ExecutionPlan, Layer, Context, Stream } from "effect"
9172
9322
  *
9173
- * class Service extends ServiceMap.Service<Service>()("Service", {
9323
+ * class Service extends Context.Service<Service>()("Service", {
9174
9324
  * make: Effect.succeed({
9175
9325
  * stream: Stream.fail("A") as Stream.Stream<number, string>
9176
9326
  * })
@@ -9741,7 +9891,7 @@ export const takeWhile: {
9741
9891
  * @since 2.0.0
9742
9892
  * @category Filtering
9743
9893
  */
9744
- <A, B, X>(f: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<B, E, R>
9894
+ <A, E, R, B extends A>(self: Stream<A, E, R>, refinement: (a: NoInfer<A>, n: number) => a is B): Stream<B, E, R>
9745
9895
  /**
9746
9896
  * Takes the longest initial prefix of elements that satisfy the predicate.
9747
9897
  *
@@ -9765,71 +9915,71 @@ export const takeWhile: {
9765
9915
  * @since 2.0.0
9766
9916
  * @category Filtering
9767
9917
  */
9768
- <A, E, R, B extends A>(self: Stream<A, E, R>, refinement: (a: NoInfer<A>, n: number) => a is B): Stream<B, E, R>
9918
+ <A, E, R>(self: Stream<A, E, R>, predicate: (a: NoInfer<A>, n: number) => boolean): Stream<A, E, R>
9919
+ } = dual(
9920
+ 2,
9921
+ <A, E, R>(
9922
+ self: Stream<A, E, R>,
9923
+ predicate: (a: A, n: number) => boolean
9924
+ ): Stream<A, E, R> =>
9925
+ transformPull(self, (pull, _scope) =>
9926
+ Effect.sync(() => {
9927
+ let i = 0
9928
+ let done = false
9929
+ const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void, R> = Effect.flatMap(
9930
+ Effect.suspend(() => done ? Cause.done() : pull),
9931
+ (chunk) => {
9932
+ const out: Array<A> = []
9933
+ for (let j = 0; j < chunk.length; j++) {
9934
+ if (!predicate(chunk[j], i++)) {
9935
+ done = true
9936
+ break
9937
+ }
9938
+ out.push(chunk[j])
9939
+ }
9940
+ return Arr.isReadonlyArrayNonEmpty(out) ? Effect.succeed(out) : done ? Cause.done() : pump
9941
+ }
9942
+ )
9943
+ return pump
9944
+ }))
9945
+ )
9946
+
9947
+ /**
9948
+ * Takes the longest initial prefix of elements that satisfy the filter.
9949
+ *
9950
+ * @since 4.0.0
9951
+ * @category Filtering
9952
+ */
9953
+ export const takeWhileFilter: {
9769
9954
  /**
9770
- * Takes the longest initial prefix of elements that satisfy the predicate.
9771
- *
9772
- * @example
9773
- * ```ts
9774
- * import { Console, Effect, Stream } from "effect"
9775
- *
9776
- * const stream = Stream.range(1, 5).pipe(
9777
- * Stream.takeWhile((n) => n % 3 !== 0)
9778
- * )
9779
- *
9780
- * const program = Effect.gen(function*() {
9781
- * const result = yield* Stream.runCollect(stream)
9782
- * yield* Console.log(result)
9783
- * })
9784
- *
9785
- * Effect.runPromise(program)
9786
- * // Output: [ 1, 2 ]
9787
- * ```
9955
+ * Takes the longest initial prefix of elements that satisfy the filter.
9788
9956
  *
9789
- * @since 2.0.0
9957
+ * @since 4.0.0
9790
9958
  * @category Filtering
9791
9959
  */
9792
- <A, E, R>(self: Stream<A, E, R>, predicate: (a: NoInfer<A>, n: number) => boolean): Stream<A, E, R>
9960
+ <A, B, X>(f: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<B, E, R>
9793
9961
  /**
9794
- * Takes the longest initial prefix of elements that satisfy the predicate.
9795
- *
9796
- * @example
9797
- * ```ts
9798
- * import { Console, Effect, Stream } from "effect"
9799
- *
9800
- * const stream = Stream.range(1, 5).pipe(
9801
- * Stream.takeWhile((n) => n % 3 !== 0)
9802
- * )
9803
- *
9804
- * const program = Effect.gen(function*() {
9805
- * const result = yield* Stream.runCollect(stream)
9806
- * yield* Console.log(result)
9807
- * })
9808
- *
9809
- * Effect.runPromise(program)
9810
- * // Output: [ 1, 2 ]
9811
- * ```
9962
+ * Takes the longest initial prefix of elements that satisfy the filter.
9812
9963
  *
9813
- * @since 2.0.0
9964
+ * @since 4.0.0
9814
9965
  * @category Filtering
9815
9966
  */
9816
9967
  <A, E, R, B, X>(self: Stream<A, E, R>, f: Filter.Filter<NoInfer<A>, B, X>): Stream<B, E, R>
9817
9968
  } = dual(
9818
9969
  2,
9819
- <A, E, R>(
9970
+ <A, E, R, B, X>(
9820
9971
  self: Stream<A, E, R>,
9821
- f: Filter.Filter<A, any, any> | ((a: A, n: number) => boolean)
9822
- ): Stream<any, E, R> =>
9972
+ filter: Filter.Filter<NoInfer<A>, B, X>
9973
+ ): Stream<B, E, R> =>
9823
9974
  transformPull(self, (pull, _scope) =>
9824
9975
  Effect.sync(() => {
9825
- let i = 0
9826
9976
  let done = false
9827
- const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<any>, E, void, R> = Effect.flatMap(
9977
+ const pump: Pull.Pull<Arr.NonEmptyReadonlyArray<B>, E, void, R> = Effect.flatMap(
9828
9978
  Effect.suspend(() => done ? Cause.done() : pull),
9829
9979
  (chunk) => {
9830
- const out: Array<any> = []
9980
+ const out: Array<B> = []
9831
9981
  for (let j = 0; j < chunk.length; j++) {
9832
- const result = Filter.apply(f as any, chunk[j], i++)
9982
+ const result = filter(chunk[j])
9833
9983
  if (Result.isFailure(result)) {
9834
9984
  done = true
9835
9985
  break
@@ -10224,29 +10374,6 @@ export const dropWhile: {
10224
10374
  * @category Filtering
10225
10375
  */
10226
10376
  <A>(predicate: (a: NoInfer<A>, index: number) => boolean): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
10227
- /**
10228
- * Drops elements from the stream while the specified predicate evaluates to `true`.
10229
- *
10230
- * @example
10231
- * ```ts
10232
- * import { Console, Effect, Stream } from "effect"
10233
- *
10234
- * const program = Effect.gen(function*() {
10235
- * const values = yield* Stream.make(1, 2, 3, 4, 5).pipe(
10236
- * Stream.dropWhile((n) => n < 3),
10237
- * Stream.runCollect
10238
- * )
10239
- * yield* Console.log(values)
10240
- * })
10241
- *
10242
- * Effect.runPromise(program)
10243
- * // Output: [ 3, 4, 5 ]
10244
- * ```
10245
- *
10246
- * @since 2.0.0
10247
- * @category Filtering
10248
- */
10249
- <A, B, X>(f: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
10250
10377
  /**
10251
10378
  * Drops elements from the stream while the specified predicate evaluates to `true`.
10252
10379
  *
@@ -10273,39 +10400,53 @@ export const dropWhile: {
10273
10400
  self: Stream<A, E, R>,
10274
10401
  predicate: (a: NoInfer<A>, index: number) => boolean
10275
10402
  ): Stream<A, E, R>
10403
+ } = dual(2, <A, E, R>(
10404
+ self: Stream<A, E, R>,
10405
+ predicate: (a: A, index: number) => boolean
10406
+ ): Stream<A, E, R> =>
10407
+ transformPull(self, (pull, _scope) =>
10408
+ Effect.sync(() => {
10409
+ let dropping = true
10410
+ let index = 0
10411
+ const filtered: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E> = Effect.flatMap(pull, (arr) => {
10412
+ const found = arr.findIndex((a) => !predicate(a, index++))
10413
+ if (found === -1) return filtered
10414
+ dropping = false
10415
+ return Effect.succeed(arr.slice(found) as Arr.NonEmptyArray<A>)
10416
+ })
10417
+ return Effect.suspend(() => dropping ? filtered : pull)
10418
+ })))
10419
+
10420
+ /**
10421
+ * Drops elements while the filter succeeds.
10422
+ *
10423
+ * @since 4.0.0
10424
+ * @category Filtering
10425
+ */
10426
+ export const dropWhileFilter: {
10276
10427
  /**
10277
- * Drops elements from the stream while the specified predicate evaluates to `true`.
10278
- *
10279
- * @example
10280
- * ```ts
10281
- * import { Console, Effect, Stream } from "effect"
10282
- *
10283
- * const program = Effect.gen(function*() {
10284
- * const values = yield* Stream.make(1, 2, 3, 4, 5).pipe(
10285
- * Stream.dropWhile((n) => n < 3),
10286
- * Stream.runCollect
10287
- * )
10288
- * yield* Console.log(values)
10289
- * })
10428
+ * Drops elements while the filter succeeds.
10290
10429
  *
10291
- * Effect.runPromise(program)
10292
- * // Output: [ 3, 4, 5 ]
10293
- * ```
10430
+ * @since 4.0.0
10431
+ * @category Filtering
10432
+ */
10433
+ <A, B, X>(filter: Filter.Filter<NoInfer<A>, B, X>): <E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
10434
+ /**
10435
+ * Drops elements while the filter succeeds.
10294
10436
  *
10295
- * @since 2.0.0
10437
+ * @since 4.0.0
10296
10438
  * @category Filtering
10297
10439
  */
10298
- <A, E, R, B, X>(self: Stream<A, E, R>, f: Filter.Filter<NoInfer<A>, B, X>): Stream<A, E, R>
10299
- } = dual(2, <A, E, R>(
10440
+ <A, E, R, B, X>(self: Stream<A, E, R>, filter: Filter.Filter<NoInfer<A>, B, X>): Stream<A, E, R>
10441
+ } = dual(2, <A, E, R, B, X>(
10300
10442
  self: Stream<A, E, R>,
10301
- f: Filter.Filter<A, any, any> | ((a: A, index: number) => boolean)
10443
+ filter: Filter.Filter<NoInfer<A>, B, X>
10302
10444
  ): Stream<A, E, R> =>
10303
10445
  transformPull(self, (pull, _scope) =>
10304
10446
  Effect.sync(() => {
10305
10447
  let dropping = true
10306
- let index = 0
10307
10448
  const filtered: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E> = Effect.flatMap(pull, (arr) => {
10308
- const found = arr.findIndex((a) => Result.isFailure(Filter.apply(f as any, a, index++)))
10449
+ const found = arr.findIndex((a) => Result.isFailure(filter(a)))
10309
10450
  if (found === -1) return filtered
10310
10451
  dropping = false
10311
10452
  return Effect.succeed(arr.slice(found) as Arr.NonEmptyArray<A>)
@@ -12174,7 +12315,7 @@ export const debounce: {
12174
12315
  * @since 2.0.0
12175
12316
  * @category Rate Limiting
12176
12317
  */
12177
- (duration: Duration.DurationInput): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
12318
+ (duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R>
12178
12319
  /**
12179
12320
  * Drops earlier elements within the debounce window and emits only the latest element after the pause.
12180
12321
  *
@@ -12198,21 +12339,21 @@ export const debounce: {
12198
12339
  * @since 2.0.0
12199
12340
  * @category Rate Limiting
12200
12341
  */
12201
- <A, E, R>(self: Stream<A, E, R>, duration: Duration.DurationInput): Stream<A, E, R>
12342
+ <A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R>
12202
12343
  } = dual(
12203
12344
  2,
12204
- <A, E, R>(self: Stream<A, E, R>, duration: Duration.DurationInput): Stream<A, E, R> =>
12345
+ <A, E, R>(self: Stream<A, E, R>, duration: Duration.Input): Stream<A, E, R> =>
12205
12346
  transformPull(
12206
12347
  self,
12207
12348
  Effect.fnUntraced(function*(pull, scope) {
12208
12349
  const clock = yield* Clock
12209
- const durationMs = Duration.toMillis(Duration.fromDurationInputUnsafe(duration))
12350
+ const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
12210
12351
  let lastArr: Arr.NonEmptyReadonlyArray<A> | undefined
12211
12352
  let cause: Cause.Cause<Cause.Done | E> | undefined
12212
12353
  let emitAtMs = Infinity
12213
- const pullLatch = Effect.makeLatchUnsafe()
12214
- const emitLatch = Effect.makeLatchUnsafe()
12215
- const endLatch = Effect.makeLatchUnsafe()
12354
+ const pullLatch = Latch.makeUnsafe()
12355
+ const emitLatch = Latch.makeUnsafe()
12356
+ const endLatch = Latch.makeUnsafe()
12216
12357
 
12217
12358
  yield* pull.pipe(
12218
12359
  pullLatch.whenOpen,
@@ -12346,7 +12487,7 @@ export const throttleEffect: {
12346
12487
  options: {
12347
12488
  readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
12348
12489
  readonly units: number
12349
- readonly duration: Duration.DurationInput
12490
+ readonly duration: Duration.Input
12350
12491
  readonly burst?: number | undefined
12351
12492
  readonly strategy?: "enforce" | "shape" | undefined
12352
12493
  }
@@ -12392,7 +12533,7 @@ export const throttleEffect: {
12392
12533
  options: {
12393
12534
  readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
12394
12535
  readonly units: number
12395
- readonly duration: Duration.DurationInput
12536
+ readonly duration: Duration.Input
12396
12537
  readonly burst?: number | undefined
12397
12538
  readonly strategy?: "enforce" | "shape" | undefined
12398
12539
  }
@@ -12404,7 +12545,7 @@ export const throttleEffect: {
12404
12545
  options: {
12405
12546
  readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>
12406
12547
  readonly units: number
12407
- readonly duration: Duration.DurationInput
12548
+ readonly duration: Duration.Input
12408
12549
  readonly burst?: number | undefined
12409
12550
  readonly strategy?: "enforce" | "shape" | undefined
12410
12551
  }
@@ -12421,12 +12562,12 @@ const throttleEnforceEffect = <A, E, R, E2, R2>(
12421
12562
  self: Stream<A, E, R>,
12422
12563
  cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>,
12423
12564
  units: number,
12424
- duration: Duration.DurationInput,
12565
+ duration: Duration.Input,
12425
12566
  burst: number
12426
12567
  ): Stream<A, E | E2, R | R2> =>
12427
12568
  transformPull(self, (pull) =>
12428
12569
  Effect.clockWith((clock) => {
12429
- const durationMs = Duration.toMillis(Duration.fromDurationInputUnsafe(duration))
12570
+ const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
12430
12571
  const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst
12431
12572
  let tokens = units
12432
12573
  let timestampMs = clock.currentTimeMillisUnsafe()
@@ -12457,12 +12598,12 @@ const throttleShapeEffect = <A, E, R, E2, R2>(
12457
12598
  self: Stream<A, E, R>,
12458
12599
  cost: (arr: Arr.NonEmptyReadonlyArray<A>) => Effect.Effect<number, E2, R2>,
12459
12600
  units: number,
12460
- duration: Duration.DurationInput,
12601
+ duration: Duration.Input,
12461
12602
  burst: number
12462
12603
  ): Stream<A, E | E2, R | R2> =>
12463
12604
  transformPull(self, (pull) =>
12464
12605
  Effect.clockWith((clock) => {
12465
- const durationMs = Duration.toMillis(Duration.fromDurationInputUnsafe(duration))
12606
+ const durationMs = Duration.toMillis(Duration.fromInputUnsafe(duration))
12466
12607
  const max = units + burst < 0 ? Number.POSITIVE_INFINITY : units + burst
12467
12608
  let tokens = units
12468
12609
  let timestampMs = clock.currentTimeMillisUnsafe()
@@ -12575,7 +12716,7 @@ export const throttle: {
12575
12716
  options: {
12576
12717
  readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
12577
12718
  readonly units: number
12578
- readonly duration: Duration.DurationInput
12719
+ readonly duration: Duration.Input
12579
12720
  readonly burst?: number | undefined
12580
12721
  readonly strategy?: "enforce" | "shape" | undefined
12581
12722
  }
@@ -12620,7 +12761,7 @@ export const throttle: {
12620
12761
  options: {
12621
12762
  readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
12622
12763
  readonly units: number
12623
- readonly duration: Duration.DurationInput
12764
+ readonly duration: Duration.Input
12624
12765
  readonly burst?: number | undefined
12625
12766
  readonly strategy?: "enforce" | "shape" | undefined
12626
12767
  }
@@ -12632,7 +12773,7 @@ export const throttle: {
12632
12773
  options: {
12633
12774
  readonly cost: (arr: Arr.NonEmptyReadonlyArray<A>) => number
12634
12775
  readonly units: number
12635
- readonly duration: Duration.DurationInput
12776
+ readonly duration: Duration.Input
12636
12777
  readonly burst?: number | undefined
12637
12778
  readonly strategy?: "enforce" | "shape" | undefined
12638
12779
  }
@@ -12770,7 +12911,7 @@ export const groupedWithin: {
12770
12911
  * @since 2.0.0
12771
12912
  * @category Grouping
12772
12913
  */
12773
- (chunkSize: number, duration: Duration.DurationInput): <A, E, R>(self: Stream<A, E, R>) => Stream<Array<A>, E, R>
12914
+ (chunkSize: number, duration: Duration.Input): <A, E, R>(self: Stream<A, E, R>) => Stream<Array<A>, E, R>
12774
12915
  /**
12775
12916
  * Partitions the stream into arrays, emitting when the chunk size is reached
12776
12917
  * or the duration passes.
@@ -12794,11 +12935,11 @@ export const groupedWithin: {
12794
12935
  * @since 2.0.0
12795
12936
  * @category Grouping
12796
12937
  */
12797
- <A, E, R>(self: Stream<A, E, R>, chunkSize: number, duration: Duration.DurationInput): Stream<Array<A>, E, R>
12938
+ <A, E, R>(self: Stream<A, E, R>, chunkSize: number, duration: Duration.Input): Stream<Array<A>, E, R>
12798
12939
  } = dual(3, <A, E, R>(
12799
12940
  self: Stream<A, E, R>,
12800
12941
  chunkSize: number,
12801
- duration: Duration.DurationInput
12942
+ duration: Duration.Input
12802
12943
  ): Stream<Array<A>, E, R> =>
12803
12944
  aggregateWithin(
12804
12945
  self,
@@ -12873,7 +13014,7 @@ export const groupBy: {
12873
13014
  f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
12874
13015
  options?: {
12875
13016
  readonly bufferSize?: number | undefined
12876
- readonly idleTimeToLive?: Duration.DurationInput | undefined
13017
+ readonly idleTimeToLive?: Duration.Input | undefined
12877
13018
  }
12878
13019
  ): <E, R>(self: Stream<A, E, R>) => Stream<readonly [K, Stream<V>], E | E2, R | R2>
12879
13020
  /**
@@ -12912,7 +13053,7 @@ export const groupBy: {
12912
13053
  f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
12913
13054
  options?: {
12914
13055
  readonly bufferSize?: number | undefined
12915
- readonly idleTimeToLive?: Duration.DurationInput | undefined
13056
+ readonly idleTimeToLive?: Duration.Input | undefined
12916
13057
  }
12917
13058
  ): Stream<readonly [K, Stream<V>], E | E2, R | R2>
12918
13059
  } = dual((args) => isStream(args[0]), <A, E, R, K, V, E2, R2>(
@@ -12920,7 +13061,7 @@ export const groupBy: {
12920
13061
  f: (a: NoInfer<A>) => Effect.Effect<readonly [K, V], E2, R2>,
12921
13062
  options?: {
12922
13063
  readonly bufferSize?: number | undefined
12923
- readonly idleTimeToLive?: Duration.DurationInput | undefined
13064
+ readonly idleTimeToLive?: Duration.Input | undefined
12924
13065
  }
12925
13066
  ): Stream<readonly [K, Stream<V>], E | E2, R | R2> =>
12926
13067
  groupByImpl(
@@ -13002,7 +13143,7 @@ export const groupByKey: {
13002
13143
  f: (a: NoInfer<A>) => K,
13003
13144
  options?: {
13004
13145
  readonly bufferSize?: number | undefined
13005
- readonly idleTimeToLive?: Duration.DurationInput | undefined
13146
+ readonly idleTimeToLive?: Duration.Input | undefined
13006
13147
  }
13007
13148
  ): <E, R>(self: Stream<A, E, R>) => Stream<readonly [K, Stream<A>], E, R>
13008
13149
  /**
@@ -13039,7 +13180,7 @@ export const groupByKey: {
13039
13180
  f: (a: NoInfer<A>) => K,
13040
13181
  options?: {
13041
13182
  readonly bufferSize?: number | undefined
13042
- readonly idleTimeToLive?: Duration.DurationInput | undefined
13183
+ readonly idleTimeToLive?: Duration.Input | undefined
13043
13184
  }
13044
13185
  ): Stream<readonly [K, Stream<A>], E, R>
13045
13186
  } = dual((args) => isStream(args[0]), <A, E, R, K>(
@@ -13047,7 +13188,7 @@ export const groupByKey: {
13047
13188
  f: (a: NoInfer<A>) => K,
13048
13189
  options?: {
13049
13190
  readonly bufferSize?: number | undefined
13050
- readonly idleTimeToLive?: Duration.DurationInput | undefined
13191
+ readonly idleTimeToLive?: Duration.Input | undefined
13051
13192
  }
13052
13193
  ): Stream<readonly [K, Stream<A>], E, R> =>
13053
13194
  suspend(() => {
@@ -13145,7 +13286,7 @@ const groupByImpl = <A, E, R, K, V, E2, R2>(
13145
13286
  ) => Effect.Effect<void, E2, R2>,
13146
13287
  options?: {
13147
13288
  readonly bufferSize?: number | undefined
13148
- readonly idleTimeToLive?: Duration.DurationInput | undefined
13289
+ readonly idleTimeToLive?: Duration.Input | undefined
13149
13290
  }
13150
13291
  ): Stream<readonly [K, Stream<V>], E | E2, R | R2> =>
13151
13292
  transformPullBracket(
@@ -13537,7 +13678,7 @@ export const aggregateWithin: {
13537
13678
  fromChannel(Channel.fromTransformBracket(Effect.fnUntraced(function*(_upstream, _, scope) {
13538
13679
  const pull = yield* Channel.toPullScoped(self.channel, _)
13539
13680
 
13540
- const pullLatch = Effect.makeLatchUnsafe(false)
13681
+ const pullLatch = Latch.makeUnsafe(false)
13541
13682
  const scheduleStep = Symbol()
13542
13683
  const buffer = yield* Queue.make</**
13543
13684
  * Aggregates elements with a sink, emitting each result when the sink completes or the schedule triggers.
@@ -13596,11 +13737,9 @@ export const aggregateWithin: {
13596
13737
  })
13597
13738
 
13598
13739
  // upstream -> buffer
13599
- let hadChunk = false
13600
13740
  yield* pull.pipe(
13601
13741
  pullLatch.whenOpen,
13602
13742
  Effect.flatMap((arr) => {
13603
- hadChunk = true
13604
13743
  pullLatch.closeUnsafe()
13605
13744
  return Queue.offer(buffer, arr)
13606
13745
  }),
@@ -13637,35 +13776,44 @@ export const aggregateWithin: {
13637
13776
  * @category Aggregation
13638
13777
  */
13639
13778
  B>()
13779
+ let leftover: Arr.NonEmptyReadonlyArray<A2> | undefined
13780
+ let sinkHasInput = false
13640
13781
  const step = yield* Schedule.toStepWithSleep(schedule)
13641
- const stepToBuffer = Effect.suspend(() => step(lastOutput)).pipe(
13642
- Effect.flatMap(() => Queue.offer(buffer, scheduleStep)),
13643
- Effect.flatMap(() => Effect.never),
13644
- Pull.catchDone(() => Cause.done())
13645
- )
13782
+ const stepToBuffer = Effect.suspend(function loop(): Pull.Pull<never, E3, void, R3> {
13783
+ return step(lastOutput).pipe(
13784
+ Effect.flatMap(() => !sinkHasInput ? loop() : Queue.offer(buffer, scheduleStep)),
13785
+ Effect.flatMap(() => Effect.never),
13786
+ Pull.catchDone(() => Cause.done())
13787
+ )
13788
+ })
13646
13789
 
13647
13790
  // buffer -> sink
13648
13791
  const pullFromBuffer: Pull.Pull<
13649
13792
  Arr.NonEmptyReadonlyArray<A>,
13650
13793
  E
13651
13794
  > = Queue.take(buffer).pipe(
13652
- Effect.flatMap((arr) => arr === scheduleStep ? Cause.done() : Effect.succeed(arr))
13795
+ Effect.flatMap((arr) => {
13796
+ if (arr === scheduleStep) {
13797
+ return Cause.done()
13798
+ }
13799
+ sinkHasInput = true
13800
+ return Effect.succeed(arr)
13801
+ })
13653
13802
  )
13654
13803
 
13655
- let leftover: Arr.NonEmptyReadonlyArray<A2> | undefined
13656
13804
  const sinkUpstream = Effect.suspend((): Pull.Pull<Arr.NonEmptyReadonlyArray<A | A2>, E> => {
13657
13805
  if (leftover !== undefined) {
13658
13806
  const chunk = leftover
13659
13807
  leftover = undefined
13808
+ sinkHasInput = true
13660
13809
  return Effect.succeed(chunk)
13661
13810
  }
13662
- hadChunk = false
13663
13811
  pullLatch.openUnsafe()
13664
13812
  return pullFromBuffer
13665
13813
  })
13666
13814
  const catchSinkHalt = Effect.flatMap(([value, leftover_]: Sink.End<B, A2>) => {
13667
- // ignore the last output if the upsteam only pulled a halt
13668
- if (!hadChunk && buffer.state._tag === "Done") return Cause.done()
13815
+ // ignore the last output if the upstream only pulled a halt
13816
+ if (!sinkHasInput && buffer.state._tag === "Done") return Cause.done()
13669
13817
  lastOutput = Option.some(value)
13670
13818
  leftover = leftover_
13671
13819
  return Effect.succeed(Arr.of(value))
@@ -13673,9 +13821,10 @@ export const aggregateWithin: {
13673
13821
 
13674
13822
  return Effect.suspend(() => {
13675
13823
  // if the buffer has exited and there is no more data to process
13676
- if (buffer.state._tag === "Done") {
13824
+ if (buffer.state._tag === "Done" && leftover === undefined) {
13677
13825
  return buffer.state.exit as Exit.Exit<never, Cause.Done<void> | E>
13678
13826
  }
13827
+ sinkHasInput = leftover !== undefined
13679
13828
  return Effect.succeed(Effect.suspend(() => sink.transform(sinkUpstream as any, scope)))
13680
13829
  }).pipe(
13681
13830
  Effect.flatMap((pull) => Effect.raceFirst(catchSinkHalt(pull), stepToBuffer))
@@ -13879,12 +14028,12 @@ export const share: {
13879
14028
  options: {
13880
14029
  readonly capacity: "unbounded"
13881
14030
  readonly replay?: number | undefined
13882
- readonly idleTimeToLive?: Duration.DurationInput | undefined
14031
+ readonly idleTimeToLive?: Duration.Input | undefined
13883
14032
  } | {
13884
14033
  readonly capacity: number
13885
14034
  readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
13886
14035
  readonly replay?: number | undefined
13887
- readonly idleTimeToLive?: Duration.DurationInput | undefined
14036
+ readonly idleTimeToLive?: Duration.Input | undefined
13888
14037
  }
13889
14038
  ): <A, E, R>(self: Stream<A, E, R>) => Effect.Effect<Stream<A, E>, never, Scope.Scope | R>
13890
14039
  /**
@@ -13923,12 +14072,12 @@ export const share: {
13923
14072
  options: {
13924
14073
  readonly capacity: "unbounded"
13925
14074
  readonly replay?: number | undefined
13926
- readonly idleTimeToLive?: Duration.DurationInput | undefined
14075
+ readonly idleTimeToLive?: Duration.Input | undefined
13927
14076
  } | {
13928
14077
  readonly capacity: number
13929
14078
  readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
13930
14079
  readonly replay?: number | undefined
13931
- readonly idleTimeToLive?: Duration.DurationInput | undefined
14080
+ readonly idleTimeToLive?: Duration.Input | undefined
13932
14081
  }
13933
14082
  ): Effect.Effect<Stream<A, E>, never, Scope.Scope | R>
13934
14083
  } = dual(2, <A, E, R>(
@@ -13936,12 +14085,12 @@ export const share: {
13936
14085
  options: {
13937
14086
  readonly capacity: "unbounded"
13938
14087
  readonly replay?: number | undefined
13939
- readonly idleTimeToLive?: Duration.DurationInput | undefined
14088
+ readonly idleTimeToLive?: Duration.Input | undefined
13940
14089
  } | {
13941
14090
  readonly capacity: number
13942
14091
  readonly strategy?: "sliding" | "dropping" | "suspend" | undefined
13943
14092
  readonly replay?: number | undefined
13944
- readonly idleTimeToLive?: Duration.DurationInput | undefined
14093
+ readonly idleTimeToLive?: Duration.Input | undefined
13945
14094
  }
13946
14095
  ): Effect.Effect<Stream<A, E>, never, Scope.Scope | R> =>
13947
14096
  Effect.map(
@@ -15806,7 +15955,7 @@ export const ensuring: {
15806
15955
  )
15807
15956
 
15808
15957
  /**
15809
- * Provides a layer or service map to the stream, removing the corresponding
15958
+ * Provides a layer or context to the stream, removing the corresponding
15810
15959
  * service requirements. Use `options.local` to build the layer every time; by
15811
15960
  * default, layers are shared between provide calls.
15812
15961
  *
@@ -15814,9 +15963,9 @@ export const ensuring: {
15814
15963
  *
15815
15964
  * @example
15816
15965
  * ```ts
15817
- * import { Console, Effect, Layer, ServiceMap, Stream } from "effect"
15966
+ * import { Console, Effect, Layer, Context, Stream } from "effect"
15818
15967
  *
15819
- * class Env extends ServiceMap.Service<Env, { readonly name: string }>()("Env") {}
15968
+ * class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
15820
15969
  *
15821
15970
  * const layer = Layer.succeed(Env)({ name: "Ada" })
15822
15971
  *
@@ -15843,7 +15992,7 @@ export const ensuring: {
15843
15992
  */
15844
15993
  export const provide: {
15845
15994
  /**
15846
- * Provides a layer or service map to the stream, removing the corresponding
15995
+ * Provides a layer or context to the stream, removing the corresponding
15847
15996
  * service requirements. Use `options.local` to build the layer every time; by
15848
15997
  * default, layers are shared between provide calls.
15849
15998
  *
@@ -15851,9 +16000,9 @@ export const provide: {
15851
16000
  *
15852
16001
  * @example
15853
16002
  * ```ts
15854
- * import { Console, Effect, Layer, ServiceMap, Stream } from "effect"
16003
+ * import { Console, Effect, Layer, Context, Stream } from "effect"
15855
16004
  *
15856
- * class Env extends ServiceMap.Service<Env, { readonly name: string }>()("Env") {}
16005
+ * class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
15857
16006
  *
15858
16007
  * const layer = Layer.succeed(Env)({ name: "Ada" })
15859
16008
  *
@@ -15879,7 +16028,7 @@ export const provide: {
15879
16028
  * @category Services
15880
16029
  */
15881
16030
  <AL, EL = never, RL = never>(
15882
- layer: Layer.Layer<AL, EL, RL> | ServiceMap.ServiceMap<AL>,
16031
+ layer: Layer.Layer<AL, EL, RL> | Context.Context<AL>,
15883
16032
  options?: {
15884
16033
  readonly local?: boolean | undefined
15885
16034
  } | undefined
@@ -15887,7 +16036,7 @@ export const provide: {
15887
16036
  self: Stream<A, E, R>
15888
16037
  ) => Stream<A, E | EL, Exclude<R, AL> | RL>
15889
16038
  /**
15890
- * Provides a layer or service map to the stream, removing the corresponding
16039
+ * Provides a layer or context to the stream, removing the corresponding
15891
16040
  * service requirements. Use `options.local` to build the layer every time; by
15892
16041
  * default, layers are shared between provide calls.
15893
16042
  *
@@ -15895,9 +16044,9 @@ export const provide: {
15895
16044
  *
15896
16045
  * @example
15897
16046
  * ```ts
15898
- * import { Console, Effect, Layer, ServiceMap, Stream } from "effect"
16047
+ * import { Console, Effect, Layer, Context, Stream } from "effect"
15899
16048
  *
15900
- * class Env extends ServiceMap.Service<Env, { readonly name: string }>()("Env") {}
16049
+ * class Env extends Context.Service<Env, { readonly name: string }>()("Env") {}
15901
16050
  *
15902
16051
  * const layer = Layer.succeed(Env)({ name: "Ada" })
15903
16052
  *
@@ -15924,31 +16073,31 @@ export const provide: {
15924
16073
  */
15925
16074
  <A, E, R, AL, EL = never, RL = never>(
15926
16075
  self: Stream<A, E, R>,
15927
- layer: Layer.Layer<AL, EL, RL> | ServiceMap.ServiceMap<AL>,
16076
+ layer: Layer.Layer<AL, EL, RL> | Context.Context<AL>,
15928
16077
  options?: {
15929
16078
  readonly local?: boolean | undefined
15930
16079
  } | undefined
15931
16080
  ): Stream<A, E | EL, Exclude<R, AL> | RL>
15932
16081
  } = dual((args) => isStream(args[0]), <A, E, R, AL, EL = never, RL = never>(
15933
16082
  self: Stream<A, E, R>,
15934
- layer: Layer.Layer<AL, EL, RL> | ServiceMap.ServiceMap<AL>,
16083
+ layer: Layer.Layer<AL, EL, RL> | Context.Context<AL>,
15935
16084
  options?: {
15936
16085
  readonly local?: boolean | undefined
15937
16086
  } | undefined
15938
16087
  ): Stream<A, E | EL, Exclude<R, AL> | RL> => fromChannel(Channel.provide(self.channel, layer, options)))
15939
16088
 
15940
16089
  /**
15941
- * Provides multiple services to the stream using a service map.
16090
+ * Provides multiple services to the stream using a context.
15942
16091
  *
15943
16092
  * @example
15944
16093
  * ```ts
15945
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16094
+ * import { Console, Effect, Context, Stream } from "effect"
15946
16095
  *
15947
- * class Config extends ServiceMap.Service<Config, { readonly prefix: string }>()("Config") {}
15948
- * class Greeter extends ServiceMap.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
16096
+ * class Config extends Context.Service<Config, { readonly prefix: string }>()("Config") {}
16097
+ * class Greeter extends Context.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
15949
16098
  *
15950
- * const services = ServiceMap.make(Config, { prefix: "Hello" }).pipe(
15951
- * ServiceMap.add(Greeter, { greet: (name: string) => `${name}!` })
16099
+ * const context = Context.make(Config, { prefix: "Hello" }).pipe(
16100
+ * Context.add(Greeter, { greet: (name: string) => `${name}!` })
15952
16101
  * )
15953
16102
  *
15954
16103
  * const stream = Stream.fromEffect(
@@ -15960,7 +16109,7 @@ export const provide: {
15960
16109
  * )
15961
16110
  *
15962
16111
  * const program = Effect.gen(function*() {
15963
- * const result = yield* Stream.runCollect(Stream.provideServices(stream, services))
16112
+ * const result = yield* Stream.runCollect(Stream.provideContext(stream, context))
15964
16113
  * yield* Console.log(result)
15965
16114
  * })
15966
16115
  *
@@ -15971,19 +16120,19 @@ export const provide: {
15971
16120
  * @since 4.0.0
15972
16121
  * @category Services
15973
16122
  */
15974
- export const provideServices: {
16123
+ export const provideContext: {
15975
16124
  /**
15976
- * Provides multiple services to the stream using a service map.
16125
+ * Provides multiple services to the stream using a context.
15977
16126
  *
15978
16127
  * @example
15979
16128
  * ```ts
15980
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16129
+ * import { Console, Effect, Context, Stream } from "effect"
15981
16130
  *
15982
- * class Config extends ServiceMap.Service<Config, { readonly prefix: string }>()("Config") {}
15983
- * class Greeter extends ServiceMap.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
16131
+ * class Config extends Context.Service<Config, { readonly prefix: string }>()("Config") {}
16132
+ * class Greeter extends Context.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
15984
16133
  *
15985
- * const services = ServiceMap.make(Config, { prefix: "Hello" }).pipe(
15986
- * ServiceMap.add(Greeter, { greet: (name: string) => `${name}!` })
16134
+ * const context = Context.make(Config, { prefix: "Hello" }).pipe(
16135
+ * Context.add(Greeter, { greet: (name: string) => `${name}!` })
15987
16136
  * )
15988
16137
  *
15989
16138
  * const stream = Stream.fromEffect(
@@ -15995,7 +16144,7 @@ export const provideServices: {
15995
16144
  * )
15996
16145
  *
15997
16146
  * const program = Effect.gen(function*() {
15998
- * const result = yield* Stream.runCollect(Stream.provideServices(stream, services))
16147
+ * const result = yield* Stream.runCollect(Stream.provideContext(stream, context))
15999
16148
  * yield* Console.log(result)
16000
16149
  * })
16001
16150
  *
@@ -16006,19 +16155,19 @@ export const provideServices: {
16006
16155
  * @since 4.0.0
16007
16156
  * @category Services
16008
16157
  */
16009
- <R2>(services: ServiceMap.ServiceMap<R2>): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, Exclude<R, R2>>
16158
+ <R2>(context: Context.Context<R2>): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, Exclude<R, R2>>
16010
16159
  /**
16011
- * Provides multiple services to the stream using a service map.
16160
+ * Provides multiple services to the stream using a context.
16012
16161
  *
16013
16162
  * @example
16014
16163
  * ```ts
16015
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16164
+ * import { Console, Effect, Context, Stream } from "effect"
16016
16165
  *
16017
- * class Config extends ServiceMap.Service<Config, { readonly prefix: string }>()("Config") {}
16018
- * class Greeter extends ServiceMap.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
16166
+ * class Config extends Context.Service<Config, { readonly prefix: string }>()("Config") {}
16167
+ * class Greeter extends Context.Service<Greeter, { greet: (name: string) => string }>()("Greeter") {}
16019
16168
  *
16020
- * const services = ServiceMap.make(Config, { prefix: "Hello" }).pipe(
16021
- * ServiceMap.add(Greeter, { greet: (name: string) => `${name}!` })
16169
+ * const context = Context.make(Config, { prefix: "Hello" }).pipe(
16170
+ * Context.add(Greeter, { greet: (name: string) => `${name}!` })
16022
16171
  * )
16023
16172
  *
16024
16173
  * const stream = Stream.fromEffect(
@@ -16030,7 +16179,7 @@ export const provideServices: {
16030
16179
  * )
16031
16180
  *
16032
16181
  * const program = Effect.gen(function*() {
16033
- * const result = yield* Stream.runCollect(Stream.provideServices(stream, services))
16182
+ * const result = yield* Stream.runCollect(Stream.provideContext(stream, context))
16034
16183
  * yield* Console.log(result)
16035
16184
  * })
16036
16185
  *
@@ -16041,11 +16190,11 @@ export const provideServices: {
16041
16190
  * @since 4.0.0
16042
16191
  * @category Services
16043
16192
  */
16044
- <A, E, R, R2>(self: Stream<A, E, R>, services: ServiceMap.ServiceMap<R2>): Stream<A, E, Exclude<R, R2>>
16193
+ <A, E, R, R2>(self: Stream<A, E, R>, context: Context.Context<R2>): Stream<A, E, Exclude<R, R2>>
16045
16194
  } = dual(
16046
16195
  2,
16047
- <A, E, R, R2>(self: Stream<A, E, R>, services: ServiceMap.ServiceMap<R2>): Stream<A, E, Exclude<R, R2>> =>
16048
- fromChannel(Channel.provideServices(self.channel, services))
16196
+ <A, E, R, R2>(self: Stream<A, E, R>, context: Context.Context<R2>): Stream<A, E, Exclude<R, R2>> =>
16197
+ fromChannel(Channel.provideContext(self.channel, context))
16049
16198
  )
16050
16199
 
16051
16200
  /**
@@ -16054,9 +16203,9 @@ export const provideServices: {
16054
16203
  *
16055
16204
  * @example
16056
16205
  * ```ts
16057
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16206
+ * import { Console, Effect, Context, Stream } from "effect"
16058
16207
  *
16059
- * class Greeter extends ServiceMap.Service<Greeter, {
16208
+ * class Greeter extends Context.Service<Greeter, {
16060
16209
  * greet: (name: string) => string
16061
16210
  * }>()("Greeter") {}
16062
16211
  *
@@ -16091,9 +16240,9 @@ export const provideService: {
16091
16240
  *
16092
16241
  * @example
16093
16242
  * ```ts
16094
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16243
+ * import { Console, Effect, Context, Stream } from "effect"
16095
16244
  *
16096
- * class Greeter extends ServiceMap.Service<Greeter, {
16245
+ * class Greeter extends Context.Service<Greeter, {
16097
16246
  * greet: (name: string) => string
16098
16247
  * }>()("Greeter") {}
16099
16248
  *
@@ -16121,7 +16270,7 @@ export const provideService: {
16121
16270
  * @since 4.0.0
16122
16271
  * @category Services
16123
16272
  */
16124
- <I, S>(key: ServiceMap.Service<I, S>, service: NoInfer<S>): <A, E, R>(
16273
+ <I, S>(key: Context.Key<I, S>, service: NoInfer<S>): <A, E, R>(
16125
16274
  self: Stream<A, E, R>
16126
16275
  ) => Stream<A, E, Exclude<R, I>>
16127
16276
  /**
@@ -16130,9 +16279,9 @@ export const provideService: {
16130
16279
  *
16131
16280
  * @example
16132
16281
  * ```ts
16133
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16282
+ * import { Console, Effect, Context, Stream } from "effect"
16134
16283
  *
16135
- * class Greeter extends ServiceMap.Service<Greeter, {
16284
+ * class Greeter extends Context.Service<Greeter, {
16136
16285
  * greet: (name: string) => string
16137
16286
  * }>()("Greeter") {}
16138
16287
  *
@@ -16160,10 +16309,10 @@ export const provideService: {
16160
16309
  * @since 4.0.0
16161
16310
  * @category Services
16162
16311
  */
16163
- <A, E, R, I, S>(self: Stream<A, E, R>, key: ServiceMap.Service<I, S>, service: NoInfer<S>): Stream<A, E, Exclude<R, I>>
16312
+ <A, E, R, I, S>(self: Stream<A, E, R>, key: Context.Key<I, S>, service: NoInfer<S>): Stream<A, E, Exclude<R, I>>
16164
16313
  } = dual(3, <A, E, R, I, S>(
16165
16314
  self: Stream<A, E, R>,
16166
- key: ServiceMap.Service<I, S>,
16315
+ key: Context.Key<I, S>,
16167
16316
  service: NoInfer<S>
16168
16317
  ): Stream<A, E, Exclude<R, I>> => fromChannel(Channel.provideService(self.channel, key, service)))
16169
16318
 
@@ -16172,9 +16321,9 @@ export const provideService: {
16172
16321
  *
16173
16322
  * @example
16174
16323
  * ```ts
16175
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16324
+ * import { Console, Effect, Context, Stream } from "effect"
16176
16325
  *
16177
- * class ApiConfig extends ServiceMap.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
16326
+ * class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
16178
16327
  *
16179
16328
  * const stream = Stream.fromEffect(
16180
16329
  * Effect.gen(function*() {
@@ -16211,9 +16360,9 @@ export const provideServiceEffect: {
16211
16360
  *
16212
16361
  * @example
16213
16362
  * ```ts
16214
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16363
+ * import { Console, Effect, Context, Stream } from "effect"
16215
16364
  *
16216
- * class ApiConfig extends ServiceMap.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
16365
+ * class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
16217
16366
  *
16218
16367
  * const stream = Stream.fromEffect(
16219
16368
  * Effect.gen(function*() {
@@ -16244,7 +16393,7 @@ export const provideServiceEffect: {
16244
16393
  * @since 4.0.0
16245
16394
  * @category Services
16246
16395
  */
16247
- <I, S, ES, RS>(key: ServiceMap.Service<I, S>, service: Effect.Effect<NoInfer<S>, ES, RS>): <A, E, R>(
16396
+ <I, S, ES, RS>(key: Context.Key<I, S>, service: Effect.Effect<NoInfer<S>, ES, RS>): <A, E, R>(
16248
16397
  self: Stream<A, E, R>
16249
16398
  ) => Stream<A, E | ES, Exclude<R, I> | RS>
16250
16399
  /**
@@ -16252,9 +16401,9 @@ export const provideServiceEffect: {
16252
16401
  *
16253
16402
  * @example
16254
16403
  * ```ts
16255
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16404
+ * import { Console, Effect, Context, Stream } from "effect"
16256
16405
  *
16257
- * class ApiConfig extends ServiceMap.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
16406
+ * class ApiConfig extends Context.Service<ApiConfig, { readonly baseUrl: string }>()("ApiConfig") {}
16258
16407
  *
16259
16408
  * const stream = Stream.fromEffect(
16260
16409
  * Effect.gen(function*() {
@@ -16287,25 +16436,25 @@ export const provideServiceEffect: {
16287
16436
  */
16288
16437
  <A, E, R, I, S, ES, RS>(
16289
16438
  self: Stream<A, E, R>,
16290
- key: ServiceMap.Service<I, S>,
16439
+ key: Context.Key<I, S>,
16291
16440
  service: Effect.Effect<NoInfer<S>, ES, RS>
16292
16441
  ): Stream<A, E | ES, Exclude<R, I> | RS>
16293
16442
  } = dual(3, <A, E, R, I, S, ES, RS>(
16294
16443
  self: Stream<A, E, R>,
16295
- key: ServiceMap.Service<I, S>,
16444
+ key: Context.Key<I, S>,
16296
16445
  service: Effect.Effect<NoInfer<S>, ES, RS>
16297
16446
  ): Stream<A, E | ES, Exclude<R, I> | RS> => fromChannel(Channel.provideServiceEffect(self.channel, key, service)))
16298
16447
 
16299
16448
  /**
16300
- * Transforms the stream's required services by mapping the current service map
16449
+ * Transforms the stream's required services by mapping the current context
16301
16450
  * to a new one.
16302
16451
  *
16303
16452
  * @example
16304
16453
  * ```ts
16305
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16454
+ * import { Console, Effect, Context, Stream } from "effect"
16306
16455
  *
16307
- * class Logger extends ServiceMap.Service<Logger, { prefix: string }>()("Logger") {}
16308
- * class Config extends ServiceMap.Service<Config, { name: string }>()("Config") {}
16456
+ * class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
16457
+ * class Config extends Context.Service<Config, { name: string }>()("Config") {}
16309
16458
  *
16310
16459
  * const stream = Stream.fromEffect(
16311
16460
  * Effect.gen(function*() {
@@ -16316,8 +16465,8 @@ export const provideServiceEffect: {
16316
16465
  * )
16317
16466
  *
16318
16467
  * const updated = stream.pipe(
16319
- * Stream.updateServices((services: ServiceMap.ServiceMap<Logger>) =>
16320
- * ServiceMap.add(services, Config, { name: "World" })
16468
+ * Stream.updateContext((context: Context.Context<Logger>) =>
16469
+ * Context.add(context, Config, { name: "World" })
16321
16470
  * )
16322
16471
  * )
16323
16472
  *
@@ -16335,17 +16484,17 @@ export const provideServiceEffect: {
16335
16484
  * @since 2.0.0
16336
16485
  * @category Services
16337
16486
  */
16338
- export const updateServices: {
16487
+ export const updateContext: {
16339
16488
  /**
16340
- * Transforms the stream's required services by mapping the current service map
16489
+ * Transforms the stream's required services by mapping the current context
16341
16490
  * to a new one.
16342
16491
  *
16343
16492
  * @example
16344
16493
  * ```ts
16345
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16494
+ * import { Console, Effect, Context, Stream } from "effect"
16346
16495
  *
16347
- * class Logger extends ServiceMap.Service<Logger, { prefix: string }>()("Logger") {}
16348
- * class Config extends ServiceMap.Service<Config, { name: string }>()("Config") {}
16496
+ * class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
16497
+ * class Config extends Context.Service<Config, { name: string }>()("Config") {}
16349
16498
  *
16350
16499
  * const stream = Stream.fromEffect(
16351
16500
  * Effect.gen(function*() {
@@ -16356,8 +16505,8 @@ export const updateServices: {
16356
16505
  * )
16357
16506
  *
16358
16507
  * const updated = stream.pipe(
16359
- * Stream.updateServices((services: ServiceMap.ServiceMap<Logger>) =>
16360
- * ServiceMap.add(services, Config, { name: "World" })
16508
+ * Stream.updateContext((context: Context.Context<Logger>) =>
16509
+ * Context.add(context, Config, { name: "World" })
16361
16510
  * )
16362
16511
  * )
16363
16512
  *
@@ -16375,19 +16524,19 @@ export const updateServices: {
16375
16524
  * @since 2.0.0
16376
16525
  * @category Services
16377
16526
  */
16378
- <R, R2>(f: (services: ServiceMap.ServiceMap<R2>) => ServiceMap.ServiceMap<R>): <A, E>(
16527
+ <R, R2>(f: (context: Context.Context<R2>) => Context.Context<R>): <A, E>(
16379
16528
  self: Stream<A, E, R>
16380
16529
  ) => Stream<A, E, R2>
16381
16530
  /**
16382
- * Transforms the stream's required services by mapping the current service map
16531
+ * Transforms the stream's required services by mapping the current context
16383
16532
  * to a new one.
16384
16533
  *
16385
16534
  * @example
16386
16535
  * ```ts
16387
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16536
+ * import { Console, Effect, Context, Stream } from "effect"
16388
16537
  *
16389
- * class Logger extends ServiceMap.Service<Logger, { prefix: string }>()("Logger") {}
16390
- * class Config extends ServiceMap.Service<Config, { name: string }>()("Config") {}
16538
+ * class Logger extends Context.Service<Logger, { prefix: string }>()("Logger") {}
16539
+ * class Config extends Context.Service<Config, { name: string }>()("Config") {}
16391
16540
  *
16392
16541
  * const stream = Stream.fromEffect(
16393
16542
  * Effect.gen(function*() {
@@ -16398,8 +16547,8 @@ export const updateServices: {
16398
16547
  * )
16399
16548
  *
16400
16549
  * const updated = stream.pipe(
16401
- * Stream.updateServices((services: ServiceMap.ServiceMap<Logger>) =>
16402
- * ServiceMap.add(services, Config, { name: "World" })
16550
+ * Stream.updateContext((context: Context.Context<Logger>) =>
16551
+ * Context.add(context, Config, { name: "World" })
16403
16552
  * )
16404
16553
  * )
16405
16554
  *
@@ -16419,21 +16568,21 @@ export const updateServices: {
16419
16568
  */
16420
16569
  <A, E, R, R2>(
16421
16570
  self: Stream<A, E, R>,
16422
- f: (services: ServiceMap.ServiceMap<R2>) => ServiceMap.ServiceMap<R>
16571
+ f: (context: Context.Context<R2>) => Context.Context<R>
16423
16572
  ): Stream<A, E, R2>
16424
16573
  } = dual(2, <A, E, R, R2>(
16425
16574
  self: Stream<A, E, R>,
16426
- f: (services: ServiceMap.ServiceMap<R2>) => ServiceMap.ServiceMap<R>
16427
- ): Stream<A, E, R2> => fromChannel(Channel.updateServices(self.channel, f)))
16575
+ f: (context: Context.Context<R2>) => Context.Context<R>
16576
+ ): Stream<A, E, R2> => fromChannel(Channel.updateContext(self.channel, f)))
16428
16577
 
16429
16578
  /**
16430
16579
  * Updates a single service in the stream environment by applying a function.
16431
16580
  *
16432
16581
  * @example
16433
16582
  * ```ts
16434
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16583
+ * import { Console, Effect, Context, Stream } from "effect"
16435
16584
  *
16436
- * class Counter extends ServiceMap.Service<Counter, { count: number }>()("Counter") {}
16585
+ * class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
16437
16586
  *
16438
16587
  * const stream = Stream.fromEffect(Effect.service(Counter)).pipe(
16439
16588
  * Stream.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
@@ -16457,9 +16606,9 @@ export const updateService: {
16457
16606
  *
16458
16607
  * @example
16459
16608
  * ```ts
16460
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16609
+ * import { Console, Effect, Context, Stream } from "effect"
16461
16610
  *
16462
- * class Counter extends ServiceMap.Service<Counter, { count: number }>()("Counter") {}
16611
+ * class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
16463
16612
  *
16464
16613
  * const stream = Stream.fromEffect(Effect.service(Counter)).pipe(
16465
16614
  * Stream.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
@@ -16477,7 +16626,7 @@ export const updateService: {
16477
16626
  * @since 2.0.0
16478
16627
  * @category Services
16479
16628
  */
16480
- <I, S>(key: ServiceMap.Service<I, S>, f: (service: NoInfer<S>) => S): <A, E, R>(
16629
+ <I, S>(key: Context.Key<I, S>, f: (service: NoInfer<S>) => S): <A, E, R>(
16481
16630
  self: Stream<A, E, R>
16482
16631
  ) => Stream<A, E, R | I>
16483
16632
  /**
@@ -16485,9 +16634,9 @@ export const updateService: {
16485
16634
  *
16486
16635
  * @example
16487
16636
  * ```ts
16488
- * import { Console, Effect, ServiceMap, Stream } from "effect"
16637
+ * import { Console, Effect, Context, Stream } from "effect"
16489
16638
  *
16490
- * class Counter extends ServiceMap.Service<Counter, { count: number }>()("Counter") {}
16639
+ * class Counter extends Context.Service<Counter, { count: number }>()("Counter") {}
16491
16640
  *
16492
16641
  * const stream = Stream.fromEffect(Effect.service(Counter)).pipe(
16493
16642
  * Stream.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
@@ -16507,19 +16656,19 @@ export const updateService: {
16507
16656
  */
16508
16657
  <A, E, R, I, S>(
16509
16658
  self: Stream<A, E, R>,
16510
- key: ServiceMap.Service<I, S>,
16659
+ key: Context.Key<I, S>,
16511
16660
  f: (service: NoInfer<S>) => S
16512
16661
  ): Stream<A, E, R | I>
16513
16662
  } = dual(3, <A, E, R, I, S>(
16514
16663
  self: Stream<A, E, R>,
16515
- service: ServiceMap.Service<I, S>,
16664
+ service: Context.Key<I, S>,
16516
16665
  f: (service: NoInfer<S>) => S
16517
16666
  ): Stream<A, E, R | I> =>
16518
- updateServices(self, (services) =>
16519
- ServiceMap.add(
16520
- services,
16667
+ updateContext(self, (context) =>
16668
+ Context.add(
16669
+ context,
16521
16670
  service,
16522
- f(ServiceMap.get(services, service))
16671
+ f(Context.get(context, service))
16523
16672
  )))
16524
16673
 
16525
16674
  /**
@@ -16591,7 +16740,7 @@ export const withSpan: {
16591
16740
  } = function() {
16592
16741
  const dataFirst = isStream(arguments[0])
16593
16742
  const name = dataFirst ? arguments[1] : arguments[0]
16594
- const options = addSpanStackTrace(dataFirst ? arguments[1] : arguments[2])
16743
+ const options = addSpanStackTrace(dataFirst ? arguments[2] : arguments[1])
16595
16744
  if (dataFirst) {
16596
16745
  const self = arguments[0] as Stream<any, any, any>
16597
16746
  return fromChannel(Channel.withSpan(self.channel, name, options))
@@ -17687,10 +17836,10 @@ export const mkUint8Array = <E, R>(self: Stream<Uint8Array, E, R>): Effect.Effec
17687
17836
  *
17688
17837
  * @example
17689
17838
  * ```ts
17690
- * import { ServiceMap, Stream } from "effect"
17839
+ * import { Context, Stream } from "effect"
17691
17840
  *
17692
17841
  * const stream = Stream.make(1, 2, 3, 4, 5)
17693
- * const readableStream = Stream.toReadableStreamWith(stream, ServiceMap.empty())
17842
+ * const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
17694
17843
  * ```
17695
17844
  *
17696
17845
  * @since 2.0.0
@@ -17704,17 +17853,17 @@ export const toReadableStreamWith = dual<
17704
17853
  *
17705
17854
  * @example
17706
17855
  * ```ts
17707
- * import { ServiceMap, Stream } from "effect"
17856
+ * import { Context, Stream } from "effect"
17708
17857
  *
17709
17858
  * const stream = Stream.make(1, 2, 3, 4, 5)
17710
- * const readableStream = Stream.toReadableStreamWith(stream, ServiceMap.empty())
17859
+ * const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
17711
17860
  * ```
17712
17861
  *
17713
17862
  * @since 2.0.0
17714
17863
  * @category Destructors
17715
17864
  */
17716
17865
  <A, XR>(
17717
- services: ServiceMap.ServiceMap<XR>,
17866
+ context: Context.Context<XR>,
17718
17867
  options?: { readonly strategy?: QueuingStrategy<A> | undefined }
17719
17868
  ) => <E, R extends XR>(self: Stream<A, E, R>) => ReadableStream<A>,
17720
17869
  /**
@@ -17724,10 +17873,10 @@ export const toReadableStreamWith = dual<
17724
17873
  *
17725
17874
  * @example
17726
17875
  * ```ts
17727
- * import { ServiceMap, Stream } from "effect"
17876
+ * import { Context, Stream } from "effect"
17728
17877
  *
17729
17878
  * const stream = Stream.make(1, 2, 3, 4, 5)
17730
- * const readableStream = Stream.toReadableStreamWith(stream, ServiceMap.empty())
17879
+ * const readableStream = Stream.toReadableStreamWith(stream, Context.empty())
17731
17880
  * ```
17732
17881
  *
17733
17882
  * @since 2.0.0
@@ -17735,23 +17884,23 @@ export const toReadableStreamWith = dual<
17735
17884
  */
17736
17885
  <A, E, XR, R extends XR>(
17737
17886
  self: Stream<A, E, R>,
17738
- services: ServiceMap.ServiceMap<XR>,
17887
+ context: Context.Context<XR>,
17739
17888
  options?: { readonly strategy?: QueuingStrategy<A> | undefined }
17740
17889
  ) => ReadableStream<A>
17741
17890
  >(
17742
17891
  (args) => isStream(args[0]),
17743
17892
  <A, E, XR, R extends XR>(
17744
17893
  self: Stream<A, E, R>,
17745
- services: ServiceMap.ServiceMap<XR>,
17894
+ context: Context.Context<XR>,
17746
17895
  options?: { readonly strategy?: QueuingStrategy<A> | undefined }
17747
17896
  ): ReadableStream<A> => {
17748
17897
  let currentResolve: (() => void) | undefined = undefined
17749
17898
  let fiber: Fiber.Fiber<void, E> | undefined = undefined
17750
- const latch = Effect.makeLatchUnsafe(false)
17899
+ const latch = Latch.makeUnsafe(false)
17751
17900
 
17752
17901
  return new ReadableStream<A>({
17753
17902
  start(controller) {
17754
- fiber = Effect.runFork(Effect.provideServices(
17903
+ fiber = Effect.runFork(Effect.provideContext(
17755
17904
  runForEachArray(self, (chunk) =>
17756
17905
  latch.whenOpen(Effect.sync(() => {
17757
17906
  latch.closeUnsafe()
@@ -17761,7 +17910,7 @@ export const toReadableStreamWith = dual<
17761
17910
  currentResolve!()
17762
17911
  currentResolve = undefined
17763
17912
  }))),
17764
- services
17913
+ context
17765
17914
  ))
17766
17915
  fiber.addObserver((exit) => {
17767
17916
  if (exit._tag === "Failure") {
@@ -17846,7 +17995,7 @@ export const toReadableStream: {
17846
17995
  <A, E>(
17847
17996
  self: Stream<A, E>,
17848
17997
  options?: { readonly strategy?: QueuingStrategy<A> | undefined }
17849
- ): ReadableStream<A> => toReadableStreamWith(self, ServiceMap.empty(), options)
17998
+ ): ReadableStream<A> => toReadableStreamWith(self, Context.empty(), options)
17850
17999
  )
17851
18000
 
17852
18001
  /**
@@ -17930,7 +18079,7 @@ export const toReadableStreamEffect: {
17930
18079
  options?: { readonly strategy?: QueuingStrategy<A> | undefined }
17931
18080
  ): Effect.Effect<ReadableStream<A>, never, R> =>
17932
18081
  Effect.map(
17933
- Effect.services</**
18082
+ Effect.context</**
17934
18083
  * Creates an Effect that builds a ReadableStream from the stream.
17935
18084
  *
17936
18085
  * See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.
@@ -17962,10 +18111,10 @@ export const toReadableStreamEffect: {
17962
18111
  *
17963
18112
  * @example
17964
18113
  * ```ts
17965
- * import { ServiceMap, Stream } from "effect"
18114
+ * import { Context, Stream } from "effect"
17966
18115
  *
17967
18116
  * const stream = Stream.make(1, 2, 3)
17968
- * const iterable = Stream.toAsyncIterableWith(stream, ServiceMap.empty())
18117
+ * const iterable = Stream.toAsyncIterableWith(stream, Context.empty())
17969
18118
  *
17970
18119
  * const collect = async () => {
17971
18120
  * const results: Array<number> = []
@@ -17985,10 +18134,10 @@ export const toAsyncIterableWith: {
17985
18134
  *
17986
18135
  * @example
17987
18136
  * ```ts
17988
- * import { ServiceMap, Stream } from "effect"
18137
+ * import { Context, Stream } from "effect"
17989
18138
  *
17990
18139
  * const stream = Stream.make(1, 2, 3)
17991
- * const iterable = Stream.toAsyncIterableWith(stream, ServiceMap.empty())
18140
+ * const iterable = Stream.toAsyncIterableWith(stream, Context.empty())
17992
18141
  *
17993
18142
  * const collect = async () => {
17994
18143
  * const results: Array<number> = []
@@ -18002,16 +18151,16 @@ export const toAsyncIterableWith: {
18002
18151
  * @since 2.0.0
18003
18152
  * @category Destructors
18004
18153
  */
18005
- <XR>(services: ServiceMap.ServiceMap<XR>): <A, E, R extends XR>(self: Stream<A, E, R>) => AsyncIterable<A>
18154
+ <XR>(context: Context.Context<XR>): <A, E, R extends XR>(self: Stream<A, E, R>) => AsyncIterable<A>
18006
18155
  /**
18007
18156
  * Converts the stream to an `AsyncIterable` using the provided services.
18008
18157
  *
18009
18158
  * @example
18010
18159
  * ```ts
18011
- * import { ServiceMap, Stream } from "effect"
18160
+ * import { Context, Stream } from "effect"
18012
18161
  *
18013
18162
  * const stream = Stream.make(1, 2, 3)
18014
- * const iterable = Stream.toAsyncIterableWith(stream, ServiceMap.empty())
18163
+ * const iterable = Stream.toAsyncIterableWith(stream, Context.empty())
18015
18164
  *
18016
18165
  * const collect = async () => {
18017
18166
  * const results: Array<number> = []
@@ -18025,16 +18174,16 @@ export const toAsyncIterableWith: {
18025
18174
  * @since 2.0.0
18026
18175
  * @category Destructors
18027
18176
  */
18028
- <A, E, XR, R extends XR>(self: Stream<A, E, R>, services: ServiceMap.ServiceMap<XR>): AsyncIterable<A>
18177
+ <A, E, XR, R extends XR>(self: Stream<A, E, R>, context: Context.Context<XR>): AsyncIterable<A>
18029
18178
  } = dual(
18030
18179
  2,
18031
18180
  <A, E, XR, R extends XR>(
18032
18181
  self: Stream<A, E, R>,
18033
- services: ServiceMap.ServiceMap<XR>
18182
+ context: Context.Context<XR>
18034
18183
  ): AsyncIterable<A> => ({
18035
18184
  [Symbol.asyncIterator]() {
18036
- const runPromise = Effect.runPromiseWith(services)
18037
- const runPromiseExit = Effect.runPromiseExitWith(services)
18185
+ const runPromise = Effect.runPromiseWith(context)
18186
+ const runPromiseExit = Effect.runPromiseExitWith(context)
18038
18187
  const scope = Scope.makeUnsafe()
18039
18188
  let pull: Pull.Pull<Arr.NonEmptyReadonlyArray<A>, E, void, R> | undefined
18040
18189
  let currentIter: Iterator<A> | undefined
@@ -18096,8 +18245,8 @@ export const toAsyncIterableWith: {
18096
18245
  */
18097
18246
  export const toAsyncIterableEffect = <A, E, R>(self: Stream<A, E, R>): Effect.Effect<AsyncIterable<A>, never, R> =>
18098
18247
  Effect.map(
18099
- Effect.services<R>(),
18100
- (services) => toAsyncIterableWith(self, services)
18248
+ Effect.context<R>(),
18249
+ (context) => toAsyncIterableWith(self, context)
18101
18250
  )
18102
18251
 
18103
18252
  /**
@@ -18126,7 +18275,7 @@ export const toAsyncIterableEffect = <A, E, R>(self: Stream<A, E, R>): Effect.Ef
18126
18275
  * @category Destructors
18127
18276
  */
18128
18277
  export const toAsyncIterable = <A, E>(self: Stream<A, E>): AsyncIterable<A> =>
18129
- toAsyncIterableWith(self, ServiceMap.empty())
18278
+ toAsyncIterableWith(self, Context.empty())
18130
18279
 
18131
18280
  /**
18132
18281
  * Runs the stream, publishing elements into the provided PubSub.
@@ -18472,16 +18621,16 @@ export const toPubSubTake: {
18472
18621
  )
18473
18622
 
18474
18623
  /**
18475
- * Converts a stream to a PubSub for concurrent consumption.
18624
+ * Converts a stream to a Queue for concurrent consumption.
18476
18625
  *
18477
18626
  * @example
18478
18627
  * ```ts
18479
- * import { Effect, PubSub, Stream } from "effect"
18628
+ * import { Effect, Queue, Stream } from "effect"
18480
18629
  *
18481
18630
  * const program = Effect.gen(function* () {
18482
- * const pubSub = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
18483
- * const subscription = yield* PubSub.subscribe(pubSub)
18484
- * return subscription
18631
+ * const queue = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
18632
+ * const chunk = yield* Queue.takeBetween(queue, 1, 3)
18633
+ * return chunk
18485
18634
  * })
18486
18635
  * ```
18487
18636
  *
@@ -18490,16 +18639,16 @@ export const toPubSubTake: {
18490
18639
  */
18491
18640
  export const toQueue: {
18492
18641
  /**
18493
- * Converts a stream to a PubSub for concurrent consumption.
18642
+ * Converts a stream to a Queue for concurrent consumption.
18494
18643
  *
18495
18644
  * @example
18496
18645
  * ```ts
18497
- * import { Effect, PubSub, Stream } from "effect"
18646
+ * import { Effect, Queue, Stream } from "effect"
18498
18647
  *
18499
18648
  * const program = Effect.gen(function* () {
18500
- * const pubSub = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
18501
- * const subscription = yield* PubSub.subscribe(pubSub)
18502
- * return subscription
18649
+ * const queue = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
18650
+ * const chunk = yield* Queue.takeBetween(queue, 1, 3)
18651
+ * return chunk
18503
18652
  * })
18504
18653
  * ```
18505
18654
  *
@@ -18515,16 +18664,16 @@ export const toQueue: {
18515
18664
  }
18516
18665
  ): <A, E, R>(self: Stream<A, E, R>) => Effect.Effect<Queue.Dequeue<A, E | Cause.Done>, never, R | Scope.Scope>
18517
18666
  /**
18518
- * Converts a stream to a PubSub for concurrent consumption.
18667
+ * Converts a stream to a Queue for concurrent consumption.
18519
18668
  *
18520
18669
  * @example
18521
18670
  * ```ts
18522
- * import { Effect, PubSub, Stream } from "effect"
18671
+ * import { Effect, Queue, Stream } from "effect"
18523
18672
  *
18524
18673
  * const program = Effect.gen(function* () {
18525
- * const pubSub = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
18526
- * const subscription = yield* PubSub.subscribe(pubSub)
18527
- * return subscription
18674
+ * const queue = yield* Stream.toQueue(Stream.fromIterable([1, 2, 3]), { capacity: 8 })
18675
+ * const chunk = yield* Queue.takeBetween(queue, 1, 3)
18676
+ * return chunk
18528
18677
  * })
18529
18678
  * ```
18530
18679
  *
@@ -18539,22 +18688,19 @@ export const toQueue: {
18539
18688
  readonly capacity: number
18540
18689
  readonly strategy?: "dropping" | "sliding" | "suspend" | undefined
18541
18690
  }
18542
- ): Effect.Effect<PubSub.PubSub<A>, never, R | Scope.Scope>
18691
+ ): Effect.Effect<Queue.Dequeue<A, E | Cause.Done>, never, R | Scope.Scope>
18543
18692
  } = dual(
18544
18693
  2,
18545
18694
  <A, E, R>(
18546
18695
  self: Stream<A, E, R>,
18547
18696
  options: {
18548
18697
  readonly capacity: "unbounded"
18549
- readonly replay?: number | undefined
18550
- readonly shutdownOnEnd?: boolean | undefined
18551
18698
  } | {
18552
18699
  readonly capacity: number
18553
18700
  readonly strategy?: "dropping" | "sliding" | "suspend" | undefined
18554
- readonly replay?: number | undefined
18555
- readonly shutdownOnEnd?: boolean | undefined
18556
18701
  }
18557
- ): Effect.Effect<PubSub.PubSub<A>, never, R | Scope.Scope> => Channel.toPubSubArray(self.channel, options)
18702
+ ): Effect.Effect<Queue.Dequeue<A, E | Cause.Done>, never, R | Scope.Scope> =>
18703
+ Channel.toQueueArray(self.channel, options)
18558
18704
  )
18559
18705
 
18560
18706
  /**