effect 2.0.0-next.49 → 2.0.0-next.50

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 (361) hide show
  1. package/BigInt/dist/effect-BigInt.cjs.dev.js +45 -18
  2. package/BigInt/dist/effect-BigInt.cjs.mjs +1 -0
  3. package/BigInt/dist/effect-BigInt.cjs.prod.js +45 -18
  4. package/BigInt/dist/effect-BigInt.esm.js +46 -19
  5. package/Brand/dist/effect-Brand.cjs.dev.js +0 -1
  6. package/Brand/dist/effect-Brand.cjs.prod.js +0 -1
  7. package/Cache/dist/effect-Cache.cjs.dev.js +23 -23
  8. package/Cache/dist/effect-Cache.cjs.prod.js +23 -23
  9. package/Cause/dist/effect-Cause.cjs.dev.js +4 -5
  10. package/Cause/dist/effect-Cause.cjs.prod.js +4 -5
  11. package/Channel/dist/effect-Channel.cjs.dev.js +35 -35
  12. package/Channel/dist/effect-Channel.cjs.prod.js +35 -35
  13. package/ChannelSingleProducerAsyncInput/dist/effect-ChannelSingleProducerAsyncInput.cjs.dev.js +30 -30
  14. package/ChannelSingleProducerAsyncInput/dist/effect-ChannelSingleProducerAsyncInput.cjs.prod.js +30 -30
  15. package/Chunk/dist/effect-Chunk.cjs.dev.js +0 -1
  16. package/Chunk/dist/effect-Chunk.cjs.prod.js +0 -1
  17. package/Clock/dist/effect-Clock.cjs.dev.js +11 -11
  18. package/Clock/dist/effect-Clock.cjs.prod.js +11 -11
  19. package/Config/dist/effect-Config.cjs.dev.js +7 -8
  20. package/Config/dist/effect-Config.cjs.prod.js +7 -8
  21. package/ConfigError/dist/effect-ConfigError.cjs.dev.js +1 -2
  22. package/ConfigError/dist/effect-ConfigError.cjs.prod.js +1 -2
  23. package/ConfigProvider/dist/effect-ConfigProvider.cjs.dev.js +10 -10
  24. package/ConfigProvider/dist/effect-ConfigProvider.cjs.prod.js +10 -10
  25. package/ConfigProviderPathPatch/dist/effect-ConfigProviderPathPatch.cjs.dev.js +2 -3
  26. package/ConfigProviderPathPatch/dist/effect-ConfigProviderPathPatch.cjs.prod.js +2 -3
  27. package/ConfigSecret/dist/effect-ConfigSecret.cjs.dev.js +1 -2
  28. package/ConfigSecret/dist/effect-ConfigSecret.cjs.prod.js +1 -2
  29. package/Console/dist/effect-Console.cjs.dev.js +27 -27
  30. package/Console/dist/effect-Console.cjs.prod.js +27 -27
  31. package/Data/dist/effect-Data.cjs.dev.js +36 -36
  32. package/Data/dist/effect-Data.cjs.prod.js +36 -36
  33. package/DefaultServices/dist/effect-DefaultServices.cjs.dev.js +11 -11
  34. package/DefaultServices/dist/effect-DefaultServices.cjs.prod.js +11 -11
  35. package/Deferred/dist/effect-Deferred.cjs.dev.js +4 -5
  36. package/Deferred/dist/effect-Deferred.cjs.prod.js +4 -5
  37. package/Differ/dist/effect-Differ.cjs.dev.js +1 -2
  38. package/Differ/dist/effect-Differ.cjs.prod.js +1 -2
  39. package/Duration/dist/effect-Duration.cjs.dev.js +0 -1
  40. package/Duration/dist/effect-Duration.cjs.prod.js +0 -1
  41. package/Effect/dist/effect-Effect.cjs.dev.js +37 -57
  42. package/Effect/dist/effect-Effect.cjs.mjs +0 -2
  43. package/Effect/dist/effect-Effect.cjs.prod.js +37 -57
  44. package/Effect/dist/effect-Effect.esm.js +4 -23
  45. package/Either/dist/effect-Either.cjs.dev.js +1 -1
  46. package/Either/dist/effect-Either.cjs.prod.js +1 -1
  47. package/Either/dist/effect-Either.esm.js +1 -1
  48. package/Exit/dist/effect-Exit.cjs.dev.js +4 -5
  49. package/Exit/dist/effect-Exit.cjs.prod.js +4 -5
  50. package/Fiber/dist/effect-Fiber.cjs.dev.js +24 -24
  51. package/Fiber/dist/effect-Fiber.cjs.prod.js +24 -24
  52. package/FiberId/dist/effect-FiberId.cjs.dev.js +2 -3
  53. package/FiberId/dist/effect-FiberId.cjs.prod.js +2 -3
  54. package/FiberRef/dist/effect-FiberRef.cjs.dev.js +24 -31
  55. package/FiberRef/dist/effect-FiberRef.cjs.mjs +0 -1
  56. package/FiberRef/dist/effect-FiberRef.cjs.prod.js +24 -31
  57. package/FiberRef/dist/effect-FiberRef.esm.js +2 -8
  58. package/FiberRefs/dist/effect-FiberRefs.cjs.dev.js +5 -6
  59. package/FiberRefs/dist/effect-FiberRefs.cjs.prod.js +5 -6
  60. package/FiberRefsPatch/dist/effect-FiberRefsPatch.cjs.dev.js +6 -7
  61. package/FiberRefsPatch/dist/effect-FiberRefsPatch.cjs.prod.js +6 -7
  62. package/GroupBy/dist/effect-GroupBy.cjs.dev.js +36 -36
  63. package/GroupBy/dist/effect-GroupBy.cjs.prod.js +36 -36
  64. package/HashMap/dist/effect-HashMap.cjs.dev.js +1 -2
  65. package/HashMap/dist/effect-HashMap.cjs.prod.js +1 -2
  66. package/HashSet/dist/effect-HashSet.cjs.dev.js +1 -2
  67. package/HashSet/dist/effect-HashSet.cjs.prod.js +1 -2
  68. package/KeyedPool/dist/effect-KeyedPool.cjs.dev.js +24 -24
  69. package/KeyedPool/dist/effect-KeyedPool.cjs.prod.js +24 -24
  70. package/Layer/dist/effect-Layer.cjs.dev.js +35 -35
  71. package/Layer/dist/effect-Layer.cjs.mjs +2 -2
  72. package/Layer/dist/effect-Layer.cjs.prod.js +35 -35
  73. package/Layer/dist/effect-Layer.esm.js +4 -4
  74. package/List/dist/effect-List.cjs.dev.js +0 -1
  75. package/List/dist/effect-List.cjs.prod.js +0 -1
  76. package/LogLevel/dist/effect-LogLevel.cjs.dev.js +4 -4
  77. package/LogLevel/dist/effect-LogLevel.cjs.prod.js +4 -4
  78. package/Logger/dist/effect-Logger.cjs.dev.js +28 -28
  79. package/Logger/dist/effect-Logger.cjs.prod.js +28 -28
  80. package/Match/dist/effect-Match.cjs.dev.js +0 -1
  81. package/Match/dist/effect-Match.cjs.prod.js +0 -1
  82. package/Metric/dist/effect-Metric.cjs.dev.js +22 -22
  83. package/Metric/dist/effect-Metric.cjs.prod.js +22 -22
  84. package/MetricBoundaries/dist/effect-MetricBoundaries.cjs.dev.js +1 -2
  85. package/MetricBoundaries/dist/effect-MetricBoundaries.cjs.prod.js +1 -2
  86. package/MetricHook/dist/effect-MetricHook.cjs.dev.js +3 -3
  87. package/MetricHook/dist/effect-MetricHook.cjs.prod.js +3 -3
  88. package/MetricKey/dist/effect-MetricKey.cjs.dev.js +3 -4
  89. package/MetricKey/dist/effect-MetricKey.cjs.prod.js +3 -4
  90. package/MetricKeyType/dist/effect-MetricKeyType.cjs.dev.js +1 -2
  91. package/MetricKeyType/dist/effect-MetricKeyType.cjs.prod.js +1 -2
  92. package/MetricPolling/dist/effect-MetricPolling.cjs.dev.js +24 -24
  93. package/MetricPolling/dist/effect-MetricPolling.cjs.prod.js +24 -24
  94. package/MetricRegistry/dist/effect-MetricRegistry.cjs.dev.js +5 -5
  95. package/MetricRegistry/dist/effect-MetricRegistry.cjs.prod.js +5 -5
  96. package/MutableHashMap/dist/effect-MutableHashMap.cjs.dev.js +1 -2
  97. package/MutableHashMap/dist/effect-MutableHashMap.cjs.prod.js +1 -2
  98. package/MutableHashSet/dist/effect-MutableHashSet.cjs.dev.js +1 -2
  99. package/MutableHashSet/dist/effect-MutableHashSet.cjs.prod.js +1 -2
  100. package/MutableQueue/dist/effect-MutableQueue.cjs.dev.js +0 -1
  101. package/MutableQueue/dist/effect-MutableQueue.cjs.prod.js +0 -1
  102. package/Number/dist/effect-Number.cjs.dev.js +31 -2
  103. package/Number/dist/effect-Number.cjs.mjs +2 -1
  104. package/Number/dist/effect-Number.cjs.prod.js +31 -2
  105. package/Number/dist/effect-Number.esm.js +24 -3
  106. package/Option/dist/effect-Option.cjs.dev.js +1 -88
  107. package/Option/dist/effect-Option.cjs.mjs +0 -6
  108. package/Option/dist/effect-Option.cjs.prod.js +1 -88
  109. package/Option/dist/effect-Option.esm.js +2 -83
  110. package/Pool/dist/effect-Pool.cjs.dev.js +24 -24
  111. package/Pool/dist/effect-Pool.cjs.prod.js +24 -24
  112. package/PubSub/dist/effect-PubSub.cjs.dev.js +23 -23
  113. package/PubSub/dist/effect-PubSub.cjs.prod.js +23 -23
  114. package/Queue/dist/effect-Queue.cjs.dev.js +23 -23
  115. package/Queue/dist/effect-Queue.cjs.prod.js +23 -23
  116. package/Random/dist/effect-Random.cjs.dev.js +11 -11
  117. package/Random/dist/effect-Random.cjs.prod.js +11 -11
  118. package/ReadonlyArray/dist/effect-ReadonlyArray.cjs.dev.js +0 -1
  119. package/ReadonlyArray/dist/effect-ReadonlyArray.cjs.prod.js +0 -1
  120. package/ReadonlyRecord/dist/effect-ReadonlyRecord.cjs.dev.js +332 -90
  121. package/ReadonlyRecord/dist/effect-ReadonlyRecord.cjs.mjs +15 -2
  122. package/ReadonlyRecord/dist/effect-ReadonlyRecord.cjs.prod.js +332 -90
  123. package/ReadonlyRecord/dist/effect-ReadonlyRecord.esm.js +323 -92
  124. package/RedBlackTree/dist/effect-RedBlackTree.cjs.dev.js +0 -1
  125. package/RedBlackTree/dist/effect-RedBlackTree.cjs.prod.js +0 -1
  126. package/Ref/dist/effect-Ref.cjs.dev.js +5 -6
  127. package/Ref/dist/effect-Ref.cjs.prod.js +5 -6
  128. package/Reloadable/dist/effect-Reloadable.cjs.dev.js +28 -28
  129. package/Reloadable/dist/effect-Reloadable.cjs.prod.js +28 -28
  130. package/Request/dist/effect-Request.cjs.dev.js +23 -23
  131. package/Request/dist/effect-Request.cjs.prod.js +23 -23
  132. package/RequestBlock/dist/effect-RequestBlock.cjs.dev.js +30 -30
  133. package/RequestBlock/dist/effect-RequestBlock.cjs.prod.js +30 -30
  134. package/RequestResolver/dist/effect-RequestResolver.cjs.dev.js +31 -31
  135. package/RequestResolver/dist/effect-RequestResolver.cjs.prod.js +31 -31
  136. package/Resource/dist/effect-Resource.cjs.dev.js +26 -26
  137. package/Resource/dist/effect-Resource.cjs.prod.js +26 -26
  138. package/Runtime/dist/effect-Runtime.cjs.dev.js +25 -25
  139. package/Runtime/dist/effect-Runtime.cjs.prod.js +25 -25
  140. package/RuntimeFlags/dist/effect-RuntimeFlags.cjs.dev.js +35 -35
  141. package/RuntimeFlags/dist/effect-RuntimeFlags.cjs.prod.js +35 -35
  142. package/RuntimeFlagsPatch/dist/effect-RuntimeFlagsPatch.cjs.dev.js +2 -3
  143. package/RuntimeFlagsPatch/dist/effect-RuntimeFlagsPatch.cjs.prod.js +2 -3
  144. package/STM/dist/effect-STM.cjs.dev.js +38 -38
  145. package/STM/dist/effect-STM.cjs.prod.js +38 -38
  146. package/Schedule/dist/effect-Schedule.cjs.dev.js +16 -16
  147. package/Schedule/dist/effect-Schedule.cjs.prod.js +16 -16
  148. package/ScheduleDecision/dist/effect-ScheduleDecision.cjs.dev.js +0 -1
  149. package/ScheduleDecision/dist/effect-ScheduleDecision.cjs.prod.js +0 -1
  150. package/ScheduleInterval/dist/effect-ScheduleInterval.cjs.dev.js +0 -1
  151. package/ScheduleInterval/dist/effect-ScheduleInterval.cjs.prod.js +0 -1
  152. package/ScheduleIntervals/dist/effect-ScheduleIntervals.cjs.dev.js +0 -1
  153. package/ScheduleIntervals/dist/effect-ScheduleIntervals.cjs.prod.js +0 -1
  154. package/Scheduler/dist/effect-Scheduler.cjs.dev.js +4 -5
  155. package/Scheduler/dist/effect-Scheduler.cjs.prod.js +4 -5
  156. package/Scope/dist/effect-Scope.cjs.dev.js +22 -22
  157. package/Scope/dist/effect-Scope.cjs.prod.js +22 -22
  158. package/ScopedCache/dist/effect-ScopedCache.cjs.dev.js +29 -29
  159. package/ScopedCache/dist/effect-ScopedCache.cjs.prod.js +29 -29
  160. package/ScopedRef/dist/effect-ScopedRef.cjs.dev.js +26 -26
  161. package/ScopedRef/dist/effect-ScopedRef.cjs.prod.js +26 -26
  162. package/Sink/dist/effect-Sink.cjs.dev.js +33 -33
  163. package/Sink/dist/effect-Sink.cjs.prod.js +33 -33
  164. package/SortedMap/dist/effect-SortedMap.cjs.dev.js +0 -1
  165. package/SortedMap/dist/effect-SortedMap.cjs.prod.js +0 -1
  166. package/SortedSet/dist/effect-SortedSet.cjs.dev.js +0 -1
  167. package/SortedSet/dist/effect-SortedSet.cjs.prod.js +0 -1
  168. package/Stream/dist/effect-Stream.cjs.dev.js +36 -36
  169. package/Stream/dist/effect-Stream.cjs.prod.js +36 -36
  170. package/Streamable/dist/effect-Streamable.cjs.dev.js +36 -36
  171. package/Streamable/dist/effect-Streamable.cjs.prod.js +36 -36
  172. package/String/dist/effect-String.cjs.dev.js +2 -2
  173. package/String/dist/effect-String.cjs.prod.js +2 -2
  174. package/SubscriptionRef/dist/effect-SubscriptionRef.cjs.dev.js +41 -41
  175. package/SubscriptionRef/dist/effect-SubscriptionRef.cjs.prod.js +41 -41
  176. package/Supervisor/dist/effect-Supervisor.cjs.dev.js +28 -28
  177. package/Supervisor/dist/effect-Supervisor.cjs.prod.js +28 -28
  178. package/SynchronizedRef/dist/effect-SynchronizedRef.cjs.dev.js +25 -25
  179. package/SynchronizedRef/dist/effect-SynchronizedRef.cjs.prod.js +25 -25
  180. package/TArray/dist/effect-TArray.cjs.dev.js +40 -40
  181. package/TArray/dist/effect-TArray.cjs.prod.js +40 -40
  182. package/TDeferred/dist/effect-TDeferred.cjs.dev.js +39 -39
  183. package/TDeferred/dist/effect-TDeferred.cjs.prod.js +39 -39
  184. package/TMap/dist/effect-TMap.cjs.dev.js +41 -41
  185. package/TMap/dist/effect-TMap.cjs.prod.js +41 -41
  186. package/TPriorityQueue/dist/effect-TPriorityQueue.cjs.dev.js +38 -38
  187. package/TPriorityQueue/dist/effect-TPriorityQueue.cjs.prod.js +38 -38
  188. package/TPubSub/dist/effect-TPubSub.cjs.dev.js +47 -47
  189. package/TPubSub/dist/effect-TPubSub.cjs.prod.js +47 -47
  190. package/TQueue/dist/effect-TQueue.cjs.dev.js +40 -40
  191. package/TQueue/dist/effect-TQueue.cjs.prod.js +40 -40
  192. package/TRandom/dist/effect-TRandom.cjs.dev.js +40 -40
  193. package/TRandom/dist/effect-TRandom.cjs.prod.js +40 -40
  194. package/TReentrantLock/dist/effect-TReentrantLock.cjs.dev.js +46 -46
  195. package/TReentrantLock/dist/effect-TReentrantLock.cjs.prod.js +46 -46
  196. package/TRef/dist/effect-TRef.cjs.dev.js +38 -38
  197. package/TRef/dist/effect-TRef.cjs.prod.js +38 -38
  198. package/TSemaphore/dist/effect-TSemaphore.cjs.dev.js +39 -39
  199. package/TSemaphore/dist/effect-TSemaphore.cjs.prod.js +39 -39
  200. package/TSet/dist/effect-TSet.cjs.dev.js +41 -41
  201. package/TSet/dist/effect-TSet.cjs.prod.js +41 -41
  202. package/Take/dist/effect-Take.cjs.dev.js +30 -30
  203. package/Take/dist/effect-Take.cjs.prod.js +30 -30
  204. package/TestAnnotation/dist/effect-TestAnnotation.cjs.dev.js +2 -3
  205. package/TestAnnotation/dist/effect-TestAnnotation.cjs.prod.js +2 -3
  206. package/TestAnnotations/dist/effect-TestAnnotations.cjs.dev.js +16 -16
  207. package/TestAnnotations/dist/effect-TestAnnotations.cjs.prod.js +16 -16
  208. package/TestClock/dist/effect-TestClock.cjs.dev.js +27 -27
  209. package/TestClock/dist/effect-TestClock.cjs.prod.js +27 -27
  210. package/TestContext/dist/effect-TestContext.cjs.dev.js +29 -29
  211. package/TestContext/dist/effect-TestContext.cjs.prod.js +29 -29
  212. package/TestLive/dist/effect-TestLive.cjs.dev.js +11 -11
  213. package/TestLive/dist/effect-TestLive.cjs.prod.js +11 -11
  214. package/TestServices/dist/effect-TestServices.cjs.dev.js +29 -29
  215. package/TestServices/dist/effect-TestServices.cjs.prod.js +29 -29
  216. package/TestSized/dist/effect-TestSized.cjs.dev.js +4 -5
  217. package/TestSized/dist/effect-TestSized.cjs.prod.js +4 -5
  218. package/Tracer/dist/effect-Tracer.cjs.dev.js +28 -21
  219. package/Tracer/dist/effect-Tracer.cjs.mjs +1 -0
  220. package/Tracer/dist/effect-Tracer.cjs.prod.js +28 -21
  221. package/Tracer/dist/effect-Tracer.esm.js +8 -2
  222. package/dist/{Ref-23b67ad9.cjs.prod.js → Ref-00103de4.cjs.prod.js} +1 -1
  223. package/dist/{Ref-c75b5362.cjs.dev.js → Ref-f990026b.cjs.dev.js} +1 -1
  224. package/dist/{cache-7b144c1f.cjs.prod.js → cache-0b148e42.cjs.prod.js} +4 -4
  225. package/dist/{cache-e3d6cc01.cjs.dev.js → cache-d709d5cb.cjs.dev.js} +4 -4
  226. package/dist/{circular-105d525c.cjs.prod.js → circular-5b6f6504.cjs.prod.js} +10 -8
  227. package/dist/{circular-cbfc1699.cjs.dev.js → circular-6d2bb353.cjs.dev.js} +10 -8
  228. package/dist/{circular-3761aff7.cjs.prod.js → circular-952618e5.cjs.prod.js} +7 -7
  229. package/dist/{circular-8baf0205.cjs.dev.js → circular-aa705e70.cjs.dev.js} +7 -7
  230. package/dist/{config-887520b4.cjs.dev.js → config-8a7bf1ae.cjs.dev.js} +3 -3
  231. package/dist/{config-6a5f97fe.cjs.prod.js → config-f0bd27af.cjs.prod.js} +3 -3
  232. package/dist/{configProvider-8567470d.cjs.dev.js → configProvider-3d85d4ef.cjs.dev.js} +4 -4
  233. package/dist/{configProvider-098f7113.cjs.prod.js → configProvider-ae007b10.cjs.prod.js} +4 -4
  234. package/dist/{core-84667e8d.cjs.prod.js → core-473934ce.cjs.prod.js} +125 -41
  235. package/dist/{core-6815193e.cjs.dev.js → core-b4bf44d3.cjs.dev.js} +125 -41
  236. package/dist/{core-8072a539.cjs.prod.js → core-d3f4e713.cjs.prod.js} +2 -2
  237. package/dist/{core-e6f9fdbe.cjs.dev.js → core-dd1edd7a.cjs.dev.js} +2 -2
  238. package/dist/{core-effect-520abd3d.cjs.prod.js → core-effect-6666f2dc.cjs.prod.js} +20 -13
  239. package/dist/{core-effect-5700daea.cjs.dev.js → core-effect-f4b1aad8.cjs.dev.js} +20 -13
  240. package/dist/{dataSource-0ca8ef42.cjs.dev.js → dataSource-9f78e828.cjs.dev.js} +2 -2
  241. package/dist/{dataSource-17adc342.cjs.prod.js → dataSource-d5d7f338.cjs.prod.js} +2 -2
  242. package/dist/declarations/src/BigInt.d.ts +29 -3
  243. package/dist/declarations/src/BigInt.d.ts.map +1 -1
  244. package/dist/declarations/src/Channel.d.ts +0 -2
  245. package/dist/declarations/src/Channel.d.ts.map +1 -1
  246. package/dist/declarations/src/Effect.d.ts +7 -37
  247. package/dist/declarations/src/Effect.d.ts.map +1 -1
  248. package/dist/declarations/src/FiberRef.d.ts +0 -5
  249. package/dist/declarations/src/FiberRef.d.ts.map +1 -1
  250. package/dist/declarations/src/HashMap.d.ts +1 -1
  251. package/dist/declarations/src/Layer.d.ts +7 -10
  252. package/dist/declarations/src/Layer.d.ts.map +1 -1
  253. package/dist/declarations/src/Number.d.ts +24 -1
  254. package/dist/declarations/src/Number.d.ts.map +1 -1
  255. package/dist/declarations/src/Option.d.ts +0 -62
  256. package/dist/declarations/src/Option.d.ts.map +1 -1
  257. package/dist/declarations/src/ReadonlyRecord.d.ts +239 -79
  258. package/dist/declarations/src/ReadonlyRecord.d.ts.map +1 -1
  259. package/dist/declarations/src/Stream.d.ts +0 -2
  260. package/dist/declarations/src/Stream.d.ts.map +1 -1
  261. package/dist/declarations/src/Tracer.d.ts +6 -1
  262. package/dist/declarations/src/Tracer.d.ts.map +1 -1
  263. package/dist/{defaultServices-193b11dc.cjs.dev.js → defaultServices-6a9a2d2b.cjs.dev.js} +8 -79
  264. package/dist/{defaultServices-4c3bf140.cjs.prod.js → defaultServices-8ea5e664.cjs.prod.js} +8 -79
  265. package/dist/{fiber-cbdeec72.cjs.dev.js → fiber-3d944398.cjs.dev.js} +3 -3
  266. package/dist/{fiber-a1a5e429.cjs.prod.js → fiber-cbd0613f.cjs.prod.js} +3 -3
  267. package/dist/{fiberRefs-f631451c.cjs.prod.js → fiberRefs-99808a27.cjs.prod.js} +1 -1
  268. package/dist/{fiberRefs-8d2401f9.cjs.dev.js → fiberRefs-ccc37f30.cjs.dev.js} +1 -1
  269. package/dist/{fiberRuntime-7cb6cd44.cjs.dev.js → fiberRuntime-0c1e7478.cjs.dev.js} +17 -25
  270. package/dist/{fiberRuntime-4691f31b.cjs.prod.js → fiberRuntime-f1e80ca7.cjs.prod.js} +17 -25
  271. package/dist/{groupBy-5174c302.cjs.prod.js → groupBy-30f6e9ba.cjs.prod.js} +4 -4
  272. package/dist/{groupBy-239a6e6e.cjs.dev.js → groupBy-8ae74e3b.cjs.dev.js} +4 -4
  273. package/dist/{key-9b2f3322.cjs.prod.js → key-9c7368c8.cjs.prod.js} +1 -1
  274. package/dist/{key-2d4efb00.cjs.dev.js → key-e3189bbd.cjs.dev.js} +1 -1
  275. package/dist/{layer-d1c204db.cjs.prod.js → layer-bfb9802a.cjs.prod.js} +9 -10
  276. package/dist/{layer-961b15ae.cjs.dev.js → layer-c284cf0d.cjs.dev.js} +9 -10
  277. package/dist/{patch-1771b466.cjs.prod.js → patch-256bc574.cjs.prod.js} +1 -1
  278. package/dist/{patch-32cc7202.cjs.dev.js → patch-cda9b6c8.cjs.dev.js} +1 -1
  279. package/dist/{pathPatch-45b09159.cjs.dev.js → pathPatch-31ce8101.cjs.dev.js} +1 -1
  280. package/dist/{pathPatch-312bd492.cjs.prod.js → pathPatch-40b92af6.cjs.prod.js} +1 -1
  281. package/dist/{pool-f178fcc7.cjs.prod.js → pool-122f0fad.cjs.prod.js} +5 -5
  282. package/dist/{pool-3890e6ce.cjs.dev.js → pool-f6ca2038.cjs.dev.js} +5 -5
  283. package/dist/{query-a6b58e39.cjs.prod.js → query-5cc0ddf8.cjs.prod.js} +3 -3
  284. package/dist/{query-39c40fa6.cjs.dev.js → query-7bffa3c3.cjs.dev.js} +3 -3
  285. package/dist/{queue-4c4bdc04.cjs.dev.js → queue-4166cfdb.cjs.dev.js} +2 -2
  286. package/dist/{queue-5342a8d5.cjs.prod.js → queue-e326fd89.cjs.prod.js} +2 -2
  287. package/dist/{registry-6fbdb4e3.cjs.prod.js → registry-081e18a3.cjs.prod.js} +2 -2
  288. package/dist/{registry-ec8b84a2.cjs.dev.js → registry-377855a9.cjs.dev.js} +2 -2
  289. package/dist/{runtime-3295bc3c.cjs.prod.js → runtime-4078f059.cjs.prod.js} +5 -5
  290. package/dist/{runtime-43b9e2bb.cjs.dev.js → runtime-d4514ab5.cjs.dev.js} +5 -5
  291. package/dist/{schedule-a4be407d.cjs.dev.js → schedule-31e38871.cjs.dev.js} +3 -3
  292. package/dist/{schedule-6431754b.cjs.prod.js → schedule-f036b254.cjs.prod.js} +3 -3
  293. package/dist/{scopedRef-9032002a.cjs.dev.js → scopedRef-5ecf6468.cjs.dev.js} +6 -6
  294. package/dist/{scopedRef-7c2bf3f3.cjs.prod.js → scopedRef-8ce21228.cjs.prod.js} +6 -6
  295. package/dist/{singleProducerAsyncInput-879852ad.cjs.prod.js → singleProducerAsyncInput-8879d87c.cjs.prod.js} +1 -1
  296. package/dist/{singleProducerAsyncInput-82e5c80c.cjs.dev.js → singleProducerAsyncInput-ece7387b.cjs.dev.js} +1 -1
  297. package/dist/{sink-e4280f95.cjs.dev.js → sink-1794329b.cjs.dev.js} +4 -3
  298. package/dist/{sink-95371737.cjs.prod.js → sink-9208df8d.cjs.prod.js} +4 -3
  299. package/dist/{stm-f792171c.cjs.prod.js → stm-6ad7b384.cjs.prod.js} +3 -3
  300. package/dist/{stm-4bf1a928.cjs.dev.js → stm-b080be31.cjs.dev.js} +3 -3
  301. package/dist/{stream-c498ce8a.cjs.dev.js → stream-09aeeac3.cjs.dev.js} +5 -5
  302. package/dist/{stream-254329d0.cjs.prod.js → stream-e19805ca.cjs.prod.js} +5 -5
  303. package/dist/{synchronizedRef-cfe99d53.cjs.dev.js → synchronizedRef-8fa16866.cjs.dev.js} +1 -1
  304. package/dist/{synchronizedRef-5420532c.cjs.prod.js → synchronizedRef-cc04ecbd.cjs.prod.js} +1 -1
  305. package/dist/{tArray-7f227674.cjs.prod.js → tArray-5e42c290.cjs.prod.js} +3 -3
  306. package/dist/{tArray-996f4aba.cjs.dev.js → tArray-7d470ed7.cjs.dev.js} +3 -3
  307. package/dist/{tMap-811797bf.cjs.prod.js → tMap-a2cfde88.cjs.prod.js} +4 -4
  308. package/dist/{tMap-b9665a82.cjs.dev.js → tMap-f0df0ea0.cjs.dev.js} +4 -4
  309. package/dist/{tQueue-0c15312e.cjs.dev.js → tQueue-085f70b5.cjs.dev.js} +3 -3
  310. package/dist/{tQueue-8a6a0244.cjs.prod.js → tQueue-b80e940e.cjs.prod.js} +3 -3
  311. package/dist/{tRef-44d17d07.cjs.dev.js → tRef-2e495254.cjs.dev.js} +1 -1
  312. package/dist/{tRef-2892ee02.cjs.prod.js → tRef-42a212cb.cjs.prod.js} +1 -1
  313. package/internal/cache.esm.js +1 -1
  314. package/internal/channel.esm.js +3 -2
  315. package/internal/core-effect.esm.js +18 -11
  316. package/internal/core.esm.js +52 -41
  317. package/internal/fiberRuntime.esm.js +7 -14
  318. package/internal/layer/circular.esm.js +9 -6
  319. package/internal/layer.esm.js +3 -3
  320. package/internal/sink.esm.js +1 -1
  321. package/internal/stream.esm.js +6 -6
  322. package/internal/tracer.esm.js +7 -4
  323. package/package.json +1 -1
  324. package/src/BigInt.ts +51 -17
  325. package/src/Channel.ts +0 -2
  326. package/src/Effect.ts +9 -44
  327. package/src/Either.ts +1 -1
  328. package/src/FiberRef.ts +0 -6
  329. package/src/HashMap.ts +1 -1
  330. package/src/Layer.ts +7 -10
  331. package/src/Number.ts +29 -1
  332. package/src/Option.ts +1 -94
  333. package/src/ReadonlyRecord.ts +383 -110
  334. package/src/Stream.ts +0 -2
  335. package/src/Tracer.ts +6 -1
  336. package/src/internal/channel.ts +14 -5
  337. package/src/internal/core-effect.ts +34 -24
  338. package/src/internal/core.ts +83 -70
  339. package/src/internal/fiberRuntime.ts +4 -29
  340. package/src/internal/layer/circular.ts +10 -13
  341. package/src/internal/layer.ts +8 -8
  342. package/src/internal/stream.ts +3 -5
  343. package/src/internal/tracer.ts +7 -3
  344. /package/dist/{FiberId-54d8bd67.cjs.prod.js → FiberId-0f0b7779.cjs.prod.js} +0 -0
  345. /package/dist/{FiberId-6708cdca.cjs.dev.js → FiberId-6595cf4c.cjs.dev.js} +0 -0
  346. /package/dist/{HashSet-86613304.cjs.prod.js → HashSet-251c8294.cjs.prod.js} +0 -0
  347. /package/dist/{HashSet-dd020cb0.cjs.dev.js → HashSet-c12c037b.cjs.dev.js} +0 -0
  348. /package/dist/{RuntimeFlagsPatch-35ed8dee.cjs.prod.js → RuntimeFlagsPatch-3890e860.cjs.prod.js} +0 -0
  349. /package/dist/{RuntimeFlagsPatch-9cbc441d.cjs.dev.js → RuntimeFlagsPatch-7d62915d.cjs.dev.js} +0 -0
  350. /package/dist/{boundaries-6eea221f.cjs.dev.js → boundaries-8dfe50cb.cjs.dev.js} +0 -0
  351. /package/dist/{boundaries-26f0dc82.cjs.prod.js → boundaries-ebe66d32.cjs.prod.js} +0 -0
  352. /package/dist/{configError-a824b415.cjs.dev.js → configError-0c09b93c.cjs.dev.js} +0 -0
  353. /package/dist/{configError-856c7153.cjs.prod.js → configError-9021016b.cjs.prod.js} +0 -0
  354. /package/dist/{configSecret-663cfb59.cjs.prod.js → configSecret-0bdfadd8.cjs.prod.js} +0 -0
  355. /package/dist/{configSecret-23cf1a3f.cjs.dev.js → configSecret-938818ad.cjs.dev.js} +0 -0
  356. /package/dist/{hook-8e8bee6a.cjs.dev.js → hook-ad5af092.cjs.dev.js} +0 -0
  357. /package/dist/{hook-c2815d51.cjs.prod.js → hook-cab99f9e.cjs.prod.js} +0 -0
  358. /package/dist/{keyType-4ec0b247.cjs.prod.js → keyType-2ae6a00e.cjs.prod.js} +0 -0
  359. /package/dist/{keyType-f30c9fa4.cjs.dev.js → keyType-36962f62.cjs.dev.js} +0 -0
  360. /package/dist/{take-981a87eb.cjs.prod.js → take-114476e5.cjs.prod.js} +0 -0
  361. /package/dist/{take-bfd0a3ed.cjs.dev.js → take-d4fa1beb.cjs.dev.js} +0 -0
package/src/Stream.ts CHANGED
@@ -4004,7 +4004,6 @@ export const withSpan: {
4004
4004
  readonly links?: ReadonlyArray<Tracer.SpanLink>
4005
4005
  readonly parent?: Tracer.ParentSpan
4006
4006
  readonly root?: boolean
4007
- readonly sampled?: boolean
4008
4007
  readonly context?: Context.Context<never>
4009
4008
  }
4010
4009
  ): <R, E, A>(self: Stream<R, E, A>) => Stream<R, E, A>
@@ -4016,7 +4015,6 @@ export const withSpan: {
4016
4015
  readonly links?: ReadonlyArray<Tracer.SpanLink>
4017
4016
  readonly parent?: Tracer.ParentSpan
4018
4017
  readonly root?: boolean
4019
- readonly sampled?: boolean
4020
4018
  readonly context?: Context.Context<never>
4021
4019
  }
4022
4020
  ): Stream<R, E, A>
package/src/Tracer.ts CHANGED
@@ -29,7 +29,6 @@ export interface Tracer {
29
29
  parent: Option.Option<ParentSpan>,
30
30
  context: Context.Context<never>,
31
31
  links: ReadonlyArray<SpanLink>,
32
- sampled: boolean,
33
32
  startTime: bigint
34
33
  ) => Span
35
34
  readonly context: <X>(f: () => X, fiber: Fiber.RuntimeFiber<any, any>) => X
@@ -55,6 +54,12 @@ export type SpanStatus = {
55
54
  */
56
55
  export type ParentSpan = Span | ExternalSpan
57
56
 
57
+ /**
58
+ * @since 2.0.0
59
+ * @category tags
60
+ */
61
+ export const ParentSpan: Context.Tag<ParentSpan, ParentSpan> = internal.spanTag
62
+
58
63
  /**
59
64
  * @since 2.0.0
60
65
  * @category models
@@ -32,6 +32,7 @@ import * as core from "./core-stream"
32
32
  import * as MergeDecisionOpCodes from "./opCodes/channelMergeDecision"
33
33
  import * as MergeStateOpCodes from "./opCodes/channelMergeState"
34
34
  import * as ChannelStateOpCodes from "./opCodes/channelState"
35
+ import * as tracer from "./tracer"
35
36
 
36
37
  /** @internal */
37
38
  export const acquireUseRelease = <Env, InErr, InElem, InDone, OutErr, OutElem1, OutDone, Acquired>(
@@ -2299,12 +2300,11 @@ export const withSpan = dual<
2299
2300
  readonly links?: ReadonlyArray<Tracer.SpanLink>
2300
2301
  readonly parent?: Tracer.ParentSpan
2301
2302
  readonly root?: boolean
2302
- readonly sampled?: boolean
2303
2303
  readonly context?: Context.Context<never>
2304
2304
  }
2305
2305
  ) => <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(
2306
2306
  self: Channel.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>
2307
- ) => Channel.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
2307
+ ) => Channel.Channel<Exclude<Env, Tracer.ParentSpan>, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
2308
2308
  <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(
2309
2309
  self: Channel.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>,
2310
2310
  name: string,
@@ -2313,11 +2313,20 @@ export const withSpan = dual<
2313
2313
  readonly links?: ReadonlyArray<Tracer.SpanLink>
2314
2314
  readonly parent?: Tracer.ParentSpan
2315
2315
  readonly root?: boolean
2316
- readonly sampled?: boolean
2317
2316
  readonly context?: Context.Context<never>
2318
2317
  }
2319
- ) => Channel.Channel<Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>
2320
- >(3, (self, name, options) => unwrapScoped(Effect.as(Effect.setSpan(name, options), self)))
2318
+ ) => Channel.Channel<Exclude<Env, Tracer.ParentSpan>, InErr, InElem, InDone, OutErr, OutElem, OutDone>
2319
+ >(3, (self, name, options) =>
2320
+ unwrapScoped(
2321
+ Effect.flatMap(
2322
+ Effect.context(),
2323
+ (context) =>
2324
+ Effect.map(
2325
+ Effect.makeSpanScoped(name, options),
2326
+ (span) => core.provideContext(self, Context.add(context, tracer.spanTag, span))
2327
+ )
2328
+ )
2329
+ ) as any)
2321
2330
 
2322
2331
  /** @internal */
2323
2332
  export const writeAll = <OutElem>(
@@ -21,6 +21,7 @@ import * as fiberRefsPatch from "../internal/fiberRefs/patch"
21
21
  import * as metricLabel from "../internal/metric/label"
22
22
  import * as runtimeFlags from "../internal/runtimeFlags"
23
23
  import * as SingleShotGen from "../internal/singleShotGen"
24
+ import * as internalTracer from "../internal/tracer"
24
25
  import * as List from "../List"
25
26
  import * as LogLevel from "../LogLevel"
26
27
  import * as LogSpan from "../LogSpan"
@@ -1189,7 +1190,20 @@ export const provideService = dual<
1189
1190
  tag: T,
1190
1191
  service: Context.Tag.Service<T>
1191
1192
  ) => Effect.Effect<Exclude<R, Context.Tag.Identifier<T>>, E, A>
1192
- >(3, (self, tag, service) => provideServiceEffect(self, tag, core.succeed(service)))
1193
+ >(
1194
+ 3,
1195
+ <R, E, A, T extends Context.Tag<any, any>>(
1196
+ self: Effect.Effect<R, E, A>,
1197
+ tag: T,
1198
+ service: Context.Tag.Service<T>
1199
+ ): Effect.Effect<Exclude<R, Context.Tag.Identifier<T>>, E, A> =>
1200
+ core.contextWithEffect((env) =>
1201
+ core.provideContext(
1202
+ self as Effect.Effect<Context.Tag.Identifier<T> | Exclude<R, Context.Tag.Identifier<T>>, E, A>,
1203
+ Context.add(env, tag, service)
1204
+ )
1205
+ )
1206
+ )
1193
1207
 
1194
1208
  /* @internal */
1195
1209
  export const provideServiceEffect = dual<
@@ -1890,6 +1904,9 @@ export const serviceMembers = <I, S>(tag: Context.Tag<I, S>): {
1890
1904
  constants: serviceConstants(tag)
1891
1905
  })
1892
1906
 
1907
+ /** @internal */
1908
+ export const serviceOption = <I, S>(tag: Context.Tag<I, S>) => core.map(core.context<never>(), Context.getOption(tag))
1909
+
1893
1910
  // -----------------------------------------------------------------------------
1894
1911
  // tracing
1895
1912
  // -----------------------------------------------------------------------------
@@ -1947,16 +1964,18 @@ export const annotateSpans = dual<
1947
1964
  }
1948
1965
  )
1949
1966
 
1950
- /* @internal */
1951
- export const currentParentSpan: Effect.Effect<never, never, Option.Option<Tracer.ParentSpan>> = core.map(
1952
- core.fiberRefGet(core.currentTracerSpan),
1953
- List.head
1967
+ /** @internal */
1968
+ export const currentParentSpan: Effect.Effect<never, never, Option.Option<Tracer.ParentSpan>> = serviceOption(
1969
+ internalTracer.spanTag
1954
1970
  )
1955
1971
 
1956
- /* @internal */
1972
+ /** @internal */
1957
1973
  export const currentSpan: Effect.Effect<never, never, Option.Option<Tracer.Span>> = core.map(
1958
- core.fiberRefGet(core.currentTracerSpan),
1959
- List.findFirst((span): span is Tracer.Span => span._tag === "Span")
1974
+ core.context<never>(),
1975
+ (context) => {
1976
+ const span = context.unsafeMap.get(internalTracer.spanTag) as Tracer.ParentSpan | undefined
1977
+ return span !== undefined && span._tag === "Span" ? Option.some(span) : Option.none()
1978
+ }
1960
1979
  )
1961
1980
 
1962
1981
  const bigint0 = BigInt(0)
@@ -2001,7 +2020,6 @@ export const makeSpan = (
2001
2020
  readonly links?: ReadonlyArray<Tracer.SpanLink>
2002
2021
  readonly parent?: Tracer.ParentSpan
2003
2022
  readonly root?: boolean
2004
- readonly sampled?: boolean
2005
2023
  readonly context?: Context.Context<never>
2006
2024
  }
2007
2025
  ) =>
@@ -2031,7 +2049,6 @@ export const makeSpan = (
2031
2049
  parent,
2032
2050
  options?.context ?? Context.empty(),
2033
2051
  linksArray,
2034
- options?.sampled ?? (parent._tag === "Some" ? parent.value.sampled : true),
2035
2052
  startTime
2036
2053
  )
2037
2054
  HashMap.forEach(annotations, (value, key) => span.attribute(key, value))
@@ -2060,7 +2077,6 @@ export const useSpan: {
2060
2077
  readonly links?: ReadonlyArray<Tracer.SpanLink>
2061
2078
  readonly parent?: Tracer.ParentSpan
2062
2079
  readonly root?: boolean
2063
- readonly sampled?: boolean
2064
2080
  readonly context?: Context.Context<never>
2065
2081
  }, evaluate: (span: Tracer.Span) => Effect.Effect<R, E, A>): Effect.Effect<R, E, A>
2066
2082
  } = <R, E, A>(
@@ -2075,7 +2091,6 @@ export const useSpan: {
2075
2091
  readonly links?: ReadonlyArray<Tracer.SpanLink>
2076
2092
  readonly parent?: Tracer.ParentSpan
2077
2093
  readonly root?: boolean
2078
- readonly sampled?: boolean
2079
2094
  readonly context?: Context.Context<never>
2080
2095
  } | undefined = args.length === 1 ? undefined : args[0]
2081
2096
  const evaluate: (span: Tracer.Span) => Effect.Effect<R, E, A> = args[args.length - 1]
@@ -2093,14 +2108,11 @@ export const useSpan: {
2093
2108
 
2094
2109
  /** @internal */
2095
2110
  export const withParentSpan = dual<
2096
- (span: Tracer.ParentSpan) => <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>,
2097
- <R, E, A>(self: Effect.Effect<R, E, A>, span: Tracer.ParentSpan) => Effect.Effect<R, E, A>
2098
- >(2, (self, span) =>
2099
- core.fiberRefLocallyWith(
2100
- self,
2101
- core.currentTracerSpan,
2102
- List.prepend(span)
2103
- ))
2111
+ (
2112
+ span: Tracer.ParentSpan
2113
+ ) => <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<Exclude<R, Tracer.ParentSpan>, E, A>,
2114
+ <R, E, A>(self: Effect.Effect<R, E, A>, span: Tracer.ParentSpan) => Effect.Effect<Exclude<R, Tracer.ParentSpan>, E, A>
2115
+ >(2, (self, span) => provideService(self, internalTracer.spanTag, span))
2104
2116
 
2105
2117
  /** @internal */
2106
2118
  export const withSpan = dual<
@@ -2109,17 +2121,15 @@ export const withSpan = dual<
2109
2121
  readonly links?: ReadonlyArray<Tracer.SpanLink>
2110
2122
  readonly parent?: Tracer.ParentSpan
2111
2123
  readonly root?: boolean
2112
- readonly sampled?: boolean
2113
2124
  readonly context?: Context.Context<never>
2114
- }) => <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>,
2125
+ }) => <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<Exclude<R, Tracer.ParentSpan>, E, A>,
2115
2126
  <R, E, A>(self: Effect.Effect<R, E, A>, name: string, options?: {
2116
2127
  readonly attributes?: Record<string, unknown>
2117
2128
  readonly links?: ReadonlyArray<Tracer.SpanLink>
2118
2129
  readonly parent?: Tracer.ParentSpan
2119
2130
  readonly root?: boolean
2120
- readonly sampled?: boolean
2121
2131
  readonly context?: Context.Context<never>
2122
- }) => Effect.Effect<R, E, A>
2132
+ }) => Effect.Effect<Exclude<R, Tracer.ParentSpan>, E, A>
2123
2133
  >(
2124
2134
  (args) => typeof args[0] !== "string",
2125
2135
  (self, name, options) =>
@@ -27,6 +27,7 @@ import type * as fiberScope from "../internal/fiberScope"
27
27
  import * as DeferredOpCodes from "../internal/opCodes/deferred"
28
28
  import * as OpCodes from "../internal/opCodes/effect"
29
29
  import * as _runtimeFlags from "../internal/runtimeFlags"
30
+ import * as internalTracer from "../internal/tracer"
30
31
  import * as List from "../List"
31
32
  import type * as LogLevel from "../LogLevel"
32
33
  import type * as LogSpan from "../LogSpan"
@@ -617,26 +618,23 @@ export const originalInstance = <E>(obj: E): E => {
617
618
  }
618
619
 
619
620
  /* @internal */
620
- const capture = <E>(obj: E & object, span: List.List<Tracer.ParentSpan>): E => {
621
- if (List.isCons(span)) {
622
- const head = span.head
623
- if (head._tag === "Span") {
624
- return new Proxy(obj, {
625
- has(target, p) {
626
- return p === spanSymbol || p === originalSymbol || p in target
627
- },
628
- get(target, p) {
629
- if (p === spanSymbol) {
630
- return head
631
- }
632
- if (p === originalSymbol) {
633
- return obj
634
- }
635
- // @ts-expect-error
636
- return target[p]
621
+ const capture = <E>(obj: E & object, span: Option.Option<Tracer.Span>): E => {
622
+ if (Option.isSome(span)) {
623
+ return new Proxy(obj, {
624
+ has(target, p) {
625
+ return p === spanSymbol || p === originalSymbol || p in target
626
+ },
627
+ get(target, p) {
628
+ if (p === spanSymbol) {
629
+ return span.value
637
630
  }
638
- })
639
- }
631
+ if (p === originalSymbol) {
632
+ return obj
633
+ }
634
+ // @ts-expect-error
635
+ return target[p]
636
+ }
637
+ })
640
638
  }
641
639
  return obj
642
640
  }
@@ -644,7 +642,7 @@ const capture = <E>(obj: E & object, span: List.List<Tracer.ParentSpan>): E => {
644
642
  /* @internal */
645
643
  export const die = (defect: unknown): Effect.Effect<never, never, never> =>
646
644
  typeof defect === "object" && defect !== null && !(spanSymbol in defect) ?
647
- withFiberRuntime((fiber) => failCause(internalCause.die(capture(defect, fiber.getFiberRef(currentTracerSpan)))))
645
+ withFiberRuntime((fiber) => failCause(internalCause.die(capture(defect, currentSpanFromFiber(fiber)))))
648
646
  : failCause(internalCause.die(defect))
649
647
 
650
648
  /* @internal */
@@ -661,15 +659,6 @@ export const either = <R, E, A>(self: Effect.Effect<R, E, A>): Effect.Effect<R,
661
659
  onSuccess: (a) => succeed(Either.right(a))
662
660
  })
663
661
 
664
- /* @internal */
665
- export const context = <R>(): Effect.Effect<R, never, Context.Context<R>> =>
666
- suspend(() => fiberRefGet(currentContext) as Effect.Effect<never, never, Context.Context<R>>)
667
-
668
- /* @internal */
669
- export const contextWithEffect = <R, R0, E, A>(
670
- f: (context: Context.Context<R0>) => Effect.Effect<R, E, A>
671
- ): Effect.Effect<R | R0, E, A> => flatMap(context<R0>(), f)
672
-
673
662
  /* @internal */
674
663
  export const exit = <R, E, A>(self: Effect.Effect<R, E, A>): Effect.Effect<R, never, Exit.Exit<E, A>> =>
675
664
  matchCause(self, {
@@ -680,7 +669,7 @@ export const exit = <R, E, A>(self: Effect.Effect<R, E, A>): Effect.Effect<R, ne
680
669
  /* @internal */
681
670
  export const fail = <E>(error: E): Effect.Effect<never, E, never> =>
682
671
  typeof error === "object" && error !== null && !(spanSymbol in error) ?
683
- withFiberRuntime((fiber) => failCause(internalCause.fail(capture(error, fiber.getFiberRef(currentTracerSpan)))))
672
+ withFiberRuntime((fiber) => failCause(internalCause.fail(capture(error, currentSpanFromFiber(fiber)))))
684
673
  : failCause(internalCause.fail(error))
685
674
 
686
675
  /* @internal */
@@ -1095,40 +1084,6 @@ export const partitionMap = <A, A1, A2>(
1095
1084
  [new Array<A1>(), new Array<A2>()]
1096
1085
  )
1097
1086
 
1098
- /* @internal */
1099
- export const provideContext = dual<
1100
- <R>(context: Context.Context<R>) => <E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<never, E, A>,
1101
- <R, E, A>(self: Effect.Effect<R, E, A>, context: Context.Context<R>) => Effect.Effect<never, E, A>
1102
- >(2, <R, E, A>(self: Effect.Effect<R, E, A>, context: Context.Context<R>) =>
1103
- fiberRefLocally(
1104
- currentContext,
1105
- context
1106
- )(self as Effect.Effect<never, E, A>))
1107
-
1108
- /* @internal */
1109
- export const provideSomeContext = dual<
1110
- <R>(context: Context.Context<R>) => <R1, E, A>(self: Effect.Effect<R1, E, A>) => Effect.Effect<Exclude<R1, R>, E, A>,
1111
- <R, R1, E, A>(self: Effect.Effect<R1, E, A>, context: Context.Context<R>) => Effect.Effect<Exclude<R1, R>, E, A>
1112
- >(2, <R1, R, E, A>(self: Effect.Effect<R1, E, A>, context: Context.Context<R>) =>
1113
- fiberRefLocallyWith(
1114
- currentContext,
1115
- (parent) => Context.merge(parent, context)
1116
- )(self as Effect.Effect<never, E, A>))
1117
-
1118
- /* @internal */
1119
- export const mapInputContext = dual<
1120
- <R0, R>(
1121
- f: (context: Context.Context<R0>) => Context.Context<R>
1122
- ) => <E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<R0, E, A>,
1123
- <R0, R, E, A>(
1124
- self: Effect.Effect<R, E, A>,
1125
- f: (context: Context.Context<R0>) => Context.Context<R>
1126
- ) => Effect.Effect<R0, E, A>
1127
- >(2, <R0, R, E, A>(
1128
- self: Effect.Effect<R, E, A>,
1129
- f: (context: Context.Context<R0>) => Context.Context<R>
1130
- ) => contextWithEffect((context: Context.Context<R0>) => provideContext(self, f(context))))
1131
-
1132
1087
  /* @internal */
1133
1088
  export const runtimeFlags: Effect.Effect<never, never, RuntimeFlags.RuntimeFlags> = withFiberRuntime<
1134
1089
  never,
@@ -1931,12 +1886,6 @@ export const currentInterruptedCause: FiberRef.FiberRef<Cause.Cause<never>> = gl
1931
1886
  })
1932
1887
  )
1933
1888
 
1934
- /** @internal */
1935
- export const currentTracerSpan: FiberRef.FiberRef<List.List<Tracer.ParentSpan>> = globalValue(
1936
- Symbol.for("effect/FiberRef/currentTracerSpan"),
1937
- () => fiberRefUnsafeMake(List.empty<Tracer.ParentSpan>())
1938
- )
1939
-
1940
1889
  /** @internal */
1941
1890
  export const currentTracerTimingEnabled: FiberRef.FiberRef<boolean> = globalValue(
1942
1891
  Symbol.for("effect/FiberRef/currentTracerTiming"),
@@ -2761,3 +2710,67 @@ const deferredInterruptJoiner = <E, A>(
2761
2710
  )
2762
2711
  }
2763
2712
  })
2713
+
2714
+ // -----------------------------------------------------------------------------
2715
+ // Context
2716
+ // -----------------------------------------------------------------------------
2717
+
2718
+ const constContext = fiberRefGet(currentContext)
2719
+
2720
+ /* @internal */
2721
+ export const context = <R>(): Effect.Effect<R, never, Context.Context<R>> =>
2722
+ constContext as Effect.Effect<never, never, Context.Context<R>>
2723
+
2724
+ /* @internal */
2725
+ export const contextWith = <R0, A>(
2726
+ f: (context: Context.Context<R0>) => A
2727
+ ): Effect.Effect<R0, never, A> => map(context<R0>(), f)
2728
+
2729
+ /* @internal */
2730
+ export const contextWithEffect = <R, R0, E, A>(
2731
+ f: (context: Context.Context<R0>) => Effect.Effect<R, E, A>
2732
+ ): Effect.Effect<R | R0, E, A> => flatMap(context<R0>(), f)
2733
+
2734
+ /* @internal */
2735
+ export const provideContext = dual<
2736
+ <R>(context: Context.Context<R>) => <E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<never, E, A>,
2737
+ <R, E, A>(self: Effect.Effect<R, E, A>, context: Context.Context<R>) => Effect.Effect<never, E, A>
2738
+ >(2, <R, E, A>(self: Effect.Effect<R, E, A>, context: Context.Context<R>) =>
2739
+ fiberRefLocally(
2740
+ currentContext,
2741
+ context
2742
+ )(self as Effect.Effect<never, E, A>))
2743
+
2744
+ /* @internal */
2745
+ export const provideSomeContext = dual<
2746
+ <R>(context: Context.Context<R>) => <R1, E, A>(self: Effect.Effect<R1, E, A>) => Effect.Effect<Exclude<R1, R>, E, A>,
2747
+ <R, R1, E, A>(self: Effect.Effect<R1, E, A>, context: Context.Context<R>) => Effect.Effect<Exclude<R1, R>, E, A>
2748
+ >(2, <R1, R, E, A>(self: Effect.Effect<R1, E, A>, context: Context.Context<R>) =>
2749
+ fiberRefLocallyWith(
2750
+ currentContext,
2751
+ (parent) => Context.merge(parent, context)
2752
+ )(self as Effect.Effect<never, E, A>))
2753
+
2754
+ /* @internal */
2755
+ export const mapInputContext = dual<
2756
+ <R0, R>(
2757
+ f: (context: Context.Context<R0>) => Context.Context<R>
2758
+ ) => <E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<R0, E, A>,
2759
+ <R0, R, E, A>(
2760
+ self: Effect.Effect<R, E, A>,
2761
+ f: (context: Context.Context<R0>) => Context.Context<R>
2762
+ ) => Effect.Effect<R0, E, A>
2763
+ >(2, <R0, R, E, A>(
2764
+ self: Effect.Effect<R, E, A>,
2765
+ f: (context: Context.Context<R0>) => Context.Context<R>
2766
+ ) => contextWithEffect((context: Context.Context<R0>) => provideContext(self, f(context))))
2767
+
2768
+ // -----------------------------------------------------------------------------
2769
+ // Tracing
2770
+ // -----------------------------------------------------------------------------
2771
+
2772
+ /** @internal */
2773
+ export const currentSpanFromFiber = <E, A>(fiber: Fiber.RuntimeFiber<E, A>): Option.Option<Tracer.Span> => {
2774
+ const span = fiber.getFiberRef(currentContext).unsafeMap.get(internalTracer.spanTag) as Tracer.ParentSpan | undefined
2775
+ return span !== undefined && span._tag === "Span" ? Option.some(span) : Option.none()
2776
+ }
@@ -45,7 +45,6 @@ import { OpSupervision } from "../internal/runtimeFlags"
45
45
  import * as supervisor from "../internal/supervisor"
46
46
  import * as SupervisorPatch from "../internal/supervisor/patch"
47
47
  import * as tracer from "../internal/tracer"
48
- import * as List from "../List"
49
48
  import type { Logger } from "../Logger"
50
49
  import * as LogLevel from "../LogLevel"
51
50
  import type * as MetricLabel from "../MetricLabel"
@@ -1374,7 +1373,7 @@ export const tracerLogger = internalLogger.makeLogger<unknown, void>(({
1374
1373
  logLevel,
1375
1374
  message
1376
1375
  }) => {
1377
- const span = Option.flatMap(fiberRefs.get(context, core.currentTracerSpan), List.head)
1376
+ const span = Option.flatMap(fiberRefs.get(context, core.currentContext), Context.getOption(tracer.spanTag))
1378
1377
  const clockService = Option.map(
1379
1378
  fiberRefs.get(context, defaultServices.currentServices),
1380
1379
  (_) => Context.get(_, clock.clockTag)
@@ -3437,7 +3436,6 @@ export const makeSpanScoped = (
3437
3436
  readonly links?: ReadonlyArray<Tracer.SpanLink>
3438
3437
  readonly parent?: Tracer.ParentSpan
3439
3438
  readonly root?: boolean
3440
- readonly sampled?: boolean
3441
3439
  readonly context?: Context.Context<never>
3442
3440
  }
3443
3441
  ): Effect.Effect<Scope.Scope, never, Tracer.Span> =>
@@ -3450,31 +3448,10 @@ export const makeSpanScoped = (
3450
3448
  )
3451
3449
  )
3452
3450
 
3453
- /* @internal */
3454
- export const setSpan = (
3455
- name: string,
3456
- options?: {
3457
- readonly attributes?: Record<string, unknown>
3458
- readonly links?: ReadonlyArray<Tracer.SpanLink>
3459
- readonly parent?: Tracer.ParentSpan
3460
- readonly root?: boolean
3461
- readonly sampled?: boolean
3462
- readonly context?: Context.Context<never>
3463
- }
3464
- ): Effect.Effect<Scope.Scope, never, void> =>
3465
- core.tap(
3466
- makeSpanScoped(name, options),
3467
- (span) => setParentSpan(span)
3468
- )
3469
-
3470
3451
  /* @internal */
3471
3452
  export const withTracerScoped = (value: Tracer.Tracer): Effect.Effect<Scope.Scope, never, void> =>
3472
3453
  fiberRefLocallyScopedWith(defaultServices.currentServices, Context.add(tracer.tracerTag, value))
3473
3454
 
3474
- /* @internal */
3475
- export const setParentSpan = (span: Tracer.ParentSpan): Effect.Effect<Scope.Scope, never, void> =>
3476
- fiberRefLocallyScopedWith(core.currentTracerSpan, List.prepend(span))
3477
-
3478
3455
  /** @internal */
3479
3456
  export const withSpanScoped = dual<
3480
3457
  (name: string, options?: {
@@ -3482,22 +3459,20 @@ export const withSpanScoped = dual<
3482
3459
  readonly links?: ReadonlyArray<Tracer.SpanLink>
3483
3460
  readonly parent?: Tracer.ParentSpan
3484
3461
  readonly root?: boolean
3485
- readonly sampled?: boolean
3486
3462
  readonly context?: Context.Context<never>
3487
- }) => <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<R | Scope.Scope, E, A>,
3463
+ }) => <R, E, A>(self: Effect.Effect<R, E, A>) => Effect.Effect<Exclude<R, Tracer.ParentSpan> | Scope.Scope, E, A>,
3488
3464
  <R, E, A>(self: Effect.Effect<R, E, A>, name: string, options?: {
3489
3465
  readonly attributes?: Record<string, unknown>
3490
3466
  readonly links?: ReadonlyArray<Tracer.SpanLink>
3491
3467
  readonly parent?: Tracer.ParentSpan
3492
3468
  readonly root?: boolean
3493
- readonly sampled?: boolean
3494
3469
  readonly context?: Context.Context<never>
3495
- }) => Effect.Effect<R | Scope.Scope, E, A>
3470
+ }) => Effect.Effect<Exclude<R, Tracer.ParentSpan> | Scope.Scope, E, A>
3496
3471
  >(
3497
3472
  (args) => typeof args[0] !== "string",
3498
3473
  (self, name, options) =>
3499
3474
  core.flatMap(
3500
3475
  makeSpanScoped(name, options),
3501
- (span) => core.fiberRefLocallyWith(self, core.currentTracerSpan, List.prepend(span))
3476
+ (span) => internalEffect.provideService(self, tracer.spanTag, span)
3502
3477
  )
3503
3478
  )
@@ -1,5 +1,5 @@
1
1
  import type * as ConfigProvider from "../../ConfigProvider"
2
- import type * as Context from "../../Context"
2
+ import * as Context from "../../Context"
3
3
  import type * as Effect from "../../Effect"
4
4
  import type * as Exit from "../../Exit"
5
5
  import { dual } from "../../Function"
@@ -16,6 +16,7 @@ import type * as LogLevel from "../../LogLevel"
16
16
  import type { Scope } from "../../Scope"
17
17
  import type * as Supervisor from "../../Supervisor"
18
18
  import type * as Tracer from "../../Tracer"
19
+ import * as tracer from "../tracer"
19
20
 
20
21
  // circular with Logger
21
22
 
@@ -184,33 +185,29 @@ export const setConfigProvider = (configProvider: ConfigProvider.ConfigProvider)
184
185
  layer.scopedDiscard(fiberRuntime.withConfigProviderScoped(configProvider))
185
186
 
186
187
  /** @internal */
187
- export const setParentSpan = (span: Tracer.ParentSpan): Layer.Layer<never, never, never> =>
188
- layer.scopedDiscard(fiberRuntime.setParentSpan(span))
188
+ export const parentSpan = (span: Tracer.ParentSpan): Layer.Layer<never, never, Tracer.ParentSpan> =>
189
+ layer.succeedContext(Context.make(tracer.spanTag, span))
189
190
 
190
191
  /** @internal */
191
- export const setSpan = (
192
+ export const span = (
192
193
  name: string,
193
194
  options?: {
194
195
  readonly attributes?: Record<string, unknown>
195
196
  readonly links?: ReadonlyArray<Tracer.SpanLink>
196
197
  readonly parent?: Tracer.ParentSpan
197
198
  readonly root?: boolean
198
- readonly sampled?: boolean
199
199
  readonly context?: Context.Context<never>
200
200
  readonly onEnd?: (span: Tracer.Span, exit: Exit.Exit<unknown, unknown>) => Effect.Effect<never, never, void>
201
201
  }
202
- ): Layer.Layer<never, never, never> =>
203
- layer.scopedDiscard(
202
+ ): Layer.Layer<never, never, Tracer.ParentSpan> =>
203
+ layer.scoped(
204
+ tracer.spanTag,
204
205
  options?.onEnd
205
206
  ? core.tap(
206
207
  fiberRuntime.makeSpanScoped(name, options),
207
- (span) =>
208
- core.zipRight(
209
- fiberRuntime.addFinalizer((exit) => options.onEnd!(span, exit)),
210
- fiberRuntime.setParentSpan(span)
211
- )
208
+ (span) => fiberRuntime.addFinalizer((exit) => options.onEnd!(span, exit))
212
209
  )
213
- : fiberRuntime.setSpan(name, options)
210
+ : fiberRuntime.makeSpanScoped(name, options)
214
211
  )
215
212
 
216
213
  /** @internal */
@@ -18,7 +18,6 @@ import * as ref from "../internal/ref"
18
18
  import * as runtime from "../internal/runtime"
19
19
  import * as synchronized from "../internal/synchronizedRef"
20
20
  import type * as Layer from "../Layer"
21
- import * as List from "../List"
22
21
  import { pipeArguments } from "../Pipeable"
23
22
  import type * as Runtime from "../Runtime"
24
23
  import type * as Schedule from "../Schedule"
@@ -28,6 +27,7 @@ import * as Scope from "../Scope"
28
27
  import type * as Synchronized from "../SynchronizedRef"
29
28
  import type * as Tracer from "../Tracer"
30
29
  import * as runtimeFlags from "./runtimeFlags"
30
+ import * as tracer from "./tracer"
31
31
 
32
32
  /** @internal */
33
33
  const LayerSymbolKey = "effect/Layer"
@@ -1127,19 +1127,17 @@ export const withSpan = dual<
1127
1127
  readonly links?: ReadonlyArray<Tracer.SpanLink>
1128
1128
  readonly parent?: Tracer.ParentSpan
1129
1129
  readonly root?: boolean
1130
- readonly sampled?: boolean
1131
1130
  readonly context?: Context.Context<never>
1132
1131
  readonly onEnd?: (span: Tracer.Span, exit: Exit.Exit<unknown, unknown>) => Effect.Effect<never, never, void>
1133
- }) => <R, E, A>(self: Layer.Layer<R, E, A>) => Layer.Layer<R, E, A>,
1132
+ }) => <R, E, A>(self: Layer.Layer<R, E, A>) => Layer.Layer<Exclude<R, Tracer.ParentSpan>, E, A>,
1134
1133
  <R, E, A>(self: Layer.Layer<R, E, A>, name: string, options?: {
1135
1134
  readonly attributes?: Record<string, unknown>
1136
1135
  readonly links?: ReadonlyArray<Tracer.SpanLink>
1137
1136
  readonly parent?: Tracer.ParentSpan
1138
1137
  readonly root?: boolean
1139
- readonly sampled?: boolean
1140
1138
  readonly context?: Context.Context<never>
1141
1139
  readonly onEnd?: (span: Tracer.Span, exit: Exit.Exit<unknown, unknown>) => Effect.Effect<never, never, void>
1142
- }) => Layer.Layer<R, E, A>
1140
+ }) => Layer.Layer<Exclude<R, Tracer.ParentSpan>, E, A>
1143
1141
  >((args) => isLayer(args[0]), (self, name, options) =>
1144
1142
  unwrapScoped(
1145
1143
  core.map(
@@ -1155,9 +1153,11 @@ export const withSpan = dual<
1155
1153
 
1156
1154
  /** @internal */
1157
1155
  export const withParentSpan = dual<
1158
- (span: Tracer.ParentSpan) => <R, E, A>(self: Layer.Layer<R, E, A>) => Layer.Layer<R, E, A>,
1159
- <R, E, A>(self: Layer.Layer<R, E, A>, span: Tracer.ParentSpan) => Layer.Layer<R, E, A>
1160
- >(2, (self, span) => fiberRefLocallyWith(self, core.currentTracerSpan, List.prepend(span)))
1156
+ (
1157
+ span: Tracer.ParentSpan
1158
+ ) => <R, E, A>(self: Layer.Layer<R, E, A>) => Layer.Layer<Exclude<R, Tracer.ParentSpan>, E, A>,
1159
+ <R, E, A>(self: Layer.Layer<R, E, A>, span: Tracer.ParentSpan) => Layer.Layer<Exclude<R, Tracer.ParentSpan>, E, A>
1160
+ >(2, (self, span) => provide(succeedContext(Context.make(tracer.spanTag, span)), self))
1161
1161
 
1162
1162
  // circular with Effect
1163
1163
 
@@ -6850,10 +6850,9 @@ export const withSpan = dual<
6850
6850
  readonly links?: ReadonlyArray<Tracer.SpanLink>
6851
6851
  readonly parent?: Tracer.ParentSpan
6852
6852
  readonly root?: boolean
6853
- readonly sampled?: boolean
6854
6853
  readonly context?: Context.Context<never>
6855
6854
  }
6856
- ) => <R, E, A>(self: Stream.Stream<R, E, A>) => Stream.Stream<R, E, A>,
6855
+ ) => <R, E, A>(self: Stream.Stream<R, E, A>) => Stream.Stream<Exclude<R, Tracer.ParentSpan>, E, A>,
6857
6856
  <R, E, A>(
6858
6857
  self: Stream.Stream<R, E, A>,
6859
6858
  name: string,
@@ -6862,11 +6861,10 @@ export const withSpan = dual<
6862
6861
  readonly links?: ReadonlyArray<Tracer.SpanLink>
6863
6862
  readonly parent?: Tracer.ParentSpan
6864
6863
  readonly root?: boolean
6865
- readonly sampled?: boolean
6866
6864
  readonly context?: Context.Context<never>
6867
6865
  }
6868
- ) => Stream.Stream<R, E, A>
6869
- >(3, (self, name, options) => unwrapScoped(Effect.as(Effect.setSpan(name, options), self)))
6866
+ ) => Stream.Stream<Exclude<R, Tracer.ParentSpan>, E, A>
6867
+ >(3, (self, name, options) => new StreamImpl(channel.withSpan(toChannel(self), name, options)))
6870
6868
 
6871
6869
  /** @internal */
6872
6870
  export const zip = dual<