effect 2.0.0-next.47 → 2.0.0-next.49

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 (445) hide show
  1. package/BigInt/dist/effect-BigInt.cjs.d.mts +2 -0
  2. package/BigInt/dist/effect-BigInt.cjs.d.mts.map +1 -0
  3. package/BigInt/dist/effect-BigInt.cjs.d.ts +2 -0
  4. package/BigInt/dist/effect-BigInt.cjs.d.ts.map +1 -0
  5. package/{Bigint/dist/effect-Bigint.cjs.dev.js → BigInt/dist/effect-BigInt.cjs.dev.js} +30 -30
  6. package/BigInt/dist/effect-BigInt.cjs.js +7 -0
  7. package/{Bigint/dist/effect-Bigint.cjs.mjs → BigInt/dist/effect-BigInt.cjs.mjs} +2 -2
  8. package/{Bigint/dist/effect-Bigint.cjs.prod.js → BigInt/dist/effect-BigInt.cjs.prod.js} +30 -30
  9. package/{Bigint/dist/effect-Bigint.esm.js → BigInt/dist/effect-BigInt.esm.js} +28 -28
  10. package/BigInt/package.json +4 -0
  11. package/Brand/dist/effect-Brand.cjs.dev.js +3 -3
  12. package/Brand/dist/effect-Brand.cjs.prod.js +3 -3
  13. package/Cache/dist/effect-Cache.cjs.dev.js +28 -28
  14. package/Cache/dist/effect-Cache.cjs.prod.js +28 -28
  15. package/Cause/dist/effect-Cause.cjs.dev.js +8 -8
  16. package/Cause/dist/effect-Cause.cjs.prod.js +8 -8
  17. package/Channel/dist/effect-Channel.cjs.dev.js +50 -41
  18. package/Channel/dist/effect-Channel.cjs.mjs +1 -0
  19. package/Channel/dist/effect-Channel.cjs.prod.js +50 -41
  20. package/Channel/dist/effect-Channel.esm.js +10 -2
  21. package/ChannelSingleProducerAsyncInput/dist/effect-ChannelSingleProducerAsyncInput.cjs.dev.js +36 -38
  22. package/ChannelSingleProducerAsyncInput/dist/effect-ChannelSingleProducerAsyncInput.cjs.prod.js +36 -38
  23. package/Chunk/dist/effect-Chunk.cjs.dev.js +13 -4
  24. package/Chunk/dist/effect-Chunk.cjs.mjs +1 -0
  25. package/Chunk/dist/effect-Chunk.cjs.prod.js +13 -4
  26. package/Chunk/dist/effect-Chunk.esm.js +10 -2
  27. package/Clock/dist/effect-Clock.cjs.dev.js +14 -14
  28. package/Clock/dist/effect-Clock.cjs.prod.js +14 -14
  29. package/Config/dist/effect-Config.cjs.dev.js +11 -11
  30. package/Config/dist/effect-Config.cjs.prod.js +11 -11
  31. package/ConfigError/dist/effect-ConfigError.cjs.dev.js +4 -4
  32. package/ConfigError/dist/effect-ConfigError.cjs.prod.js +4 -4
  33. package/ConfigProvider/dist/effect-ConfigProvider.cjs.dev.js +13 -13
  34. package/ConfigProvider/dist/effect-ConfigProvider.cjs.prod.js +13 -13
  35. package/ConfigProviderPathPatch/dist/effect-ConfigProviderPathPatch.cjs.dev.js +5 -5
  36. package/ConfigProviderPathPatch/dist/effect-ConfigProviderPathPatch.cjs.prod.js +5 -5
  37. package/ConfigSecret/dist/effect-ConfigSecret.cjs.dev.js +4 -4
  38. package/ConfigSecret/dist/effect-ConfigSecret.cjs.prod.js +4 -4
  39. package/Console/dist/effect-Console.cjs.dev.js +32 -32
  40. package/Console/dist/effect-Console.cjs.prod.js +32 -32
  41. package/Context/dist/effect-Context.cjs.dev.js +3 -3
  42. package/Context/dist/effect-Context.cjs.prod.js +3 -3
  43. package/Data/dist/effect-Data.cjs.dev.js +50 -46
  44. package/Data/dist/effect-Data.cjs.prod.js +50 -46
  45. package/Data/dist/effect-Data.esm.js +11 -5
  46. package/DefaultServices/dist/effect-DefaultServices.cjs.dev.js +14 -14
  47. package/DefaultServices/dist/effect-DefaultServices.cjs.prod.js +14 -14
  48. package/Deferred/dist/effect-Deferred.cjs.dev.js +8 -8
  49. package/Deferred/dist/effect-Deferred.cjs.prod.js +8 -8
  50. package/Differ/dist/effect-Differ.cjs.dev.js +5 -5
  51. package/Differ/dist/effect-Differ.cjs.prod.js +5 -5
  52. package/Duration/dist/effect-Duration.cjs.dev.js +4 -4
  53. package/Duration/dist/effect-Duration.cjs.prod.js +4 -4
  54. package/Duration/dist/effect-Duration.esm.js +2 -2
  55. package/Effect/dist/effect-Effect.cjs.dev.js +67 -136
  56. package/Effect/dist/effect-Effect.cjs.mjs +2 -11
  57. package/Effect/dist/effect-Effect.cjs.prod.js +67 -136
  58. package/Effect/dist/effect-Effect.esm.js +30 -90
  59. package/Effectable/dist/effect-Effectable.cjs.dev.js +1 -1
  60. package/Effectable/dist/effect-Effectable.cjs.prod.js +1 -1
  61. package/Either/dist/effect-Either.cjs.dev.js +17 -3
  62. package/Either/dist/effect-Either.cjs.mjs +3 -1
  63. package/Either/dist/effect-Either.cjs.prod.js +17 -3
  64. package/Either/dist/effect-Either.esm.js +13 -1
  65. package/Encoding/dist/effect-Encoding.cjs.dev.js +3 -3
  66. package/Encoding/dist/effect-Encoding.cjs.prod.js +3 -3
  67. package/Exit/dist/effect-Exit.cjs.dev.js +8 -8
  68. package/Exit/dist/effect-Exit.cjs.prod.js +8 -8
  69. package/Fiber/dist/effect-Fiber.cjs.dev.js +29 -29
  70. package/Fiber/dist/effect-Fiber.cjs.prod.js +29 -29
  71. package/FiberId/dist/effect-FiberId.cjs.dev.js +5 -5
  72. package/FiberId/dist/effect-FiberId.cjs.prod.js +5 -5
  73. package/FiberRef/dist/effect-FiberRef.cjs.dev.js +29 -29
  74. package/FiberRef/dist/effect-FiberRef.cjs.prod.js +29 -29
  75. package/FiberRefs/dist/effect-FiberRefs.cjs.dev.js +9 -9
  76. package/FiberRefs/dist/effect-FiberRefs.cjs.prod.js +9 -9
  77. package/FiberRefsPatch/dist/effect-FiberRefsPatch.cjs.dev.js +10 -10
  78. package/FiberRefsPatch/dist/effect-FiberRefsPatch.cjs.prod.js +10 -10
  79. package/GroupBy/dist/effect-GroupBy.cjs.dev.js +43 -43
  80. package/GroupBy/dist/effect-GroupBy.cjs.prod.js +43 -43
  81. package/HashMap/dist/effect-HashMap.cjs.dev.js +4 -4
  82. package/HashMap/dist/effect-HashMap.cjs.prod.js +4 -4
  83. package/HashSet/dist/effect-HashSet.cjs.dev.js +4 -4
  84. package/HashSet/dist/effect-HashSet.cjs.prod.js +4 -4
  85. package/KeyedPool/dist/effect-KeyedPool.cjs.dev.js +29 -29
  86. package/KeyedPool/dist/effect-KeyedPool.cjs.prod.js +29 -29
  87. package/Layer/dist/effect-Layer.cjs.dev.js +151 -52
  88. package/Layer/dist/effect-Layer.cjs.mjs +12 -0
  89. package/Layer/dist/effect-Layer.cjs.prod.js +151 -52
  90. package/Layer/dist/effect-Layer.esm.js +92 -2
  91. package/List/dist/effect-List.cjs.dev.js +10 -3
  92. package/List/dist/effect-List.cjs.mjs +1 -0
  93. package/List/dist/effect-List.cjs.prod.js +10 -3
  94. package/List/dist/effect-List.esm.js +7 -1
  95. package/LogLevel/dist/effect-LogLevel.cjs.dev.js +8 -8
  96. package/LogLevel/dist/effect-LogLevel.cjs.prod.js +8 -8
  97. package/Logger/dist/effect-Logger.cjs.dev.js +33 -39
  98. package/Logger/dist/effect-Logger.cjs.prod.js +33 -39
  99. package/Logger/dist/effect-Logger.esm.js +0 -5
  100. package/Match/dist/effect-Match.cjs.d.mts +2 -0
  101. package/Match/dist/effect-Match.cjs.d.mts.map +1 -0
  102. package/Match/dist/effect-Match.cjs.d.ts +2 -0
  103. package/Match/dist/effect-Match.cjs.d.ts.map +1 -0
  104. package/Match/dist/effect-Match.cjs.dev.js +620 -0
  105. package/Match/dist/effect-Match.cjs.js +7 -0
  106. package/Match/dist/effect-Match.cjs.mjs +39 -0
  107. package/Match/dist/effect-Match.cjs.prod.js +620 -0
  108. package/Match/dist/effect-Match.esm.js +258 -0
  109. package/Match/package.json +4 -0
  110. package/Metric/dist/effect-Metric.cjs.dev.js +115 -33
  111. package/Metric/dist/effect-Metric.cjs.prod.js +115 -33
  112. package/Metric/dist/effect-Metric.esm.js +88 -6
  113. package/MetricBoundaries/dist/effect-MetricBoundaries.cjs.dev.js +4 -4
  114. package/MetricBoundaries/dist/effect-MetricBoundaries.cjs.prod.js +4 -4
  115. package/MetricHook/dist/effect-MetricHook.cjs.dev.js +6 -6
  116. package/MetricHook/dist/effect-MetricHook.cjs.prod.js +6 -6
  117. package/MetricKey/dist/effect-MetricKey.cjs.dev.js +7 -7
  118. package/MetricKey/dist/effect-MetricKey.cjs.prod.js +7 -7
  119. package/MetricKeyType/dist/effect-MetricKeyType.cjs.dev.js +4 -4
  120. package/MetricKeyType/dist/effect-MetricKeyType.cjs.prod.js +4 -4
  121. package/MetricLabel/dist/effect-MetricLabel.cjs.dev.js +1 -1
  122. package/MetricLabel/dist/effect-MetricLabel.cjs.prod.js +1 -1
  123. package/MetricPolling/dist/effect-MetricPolling.cjs.dev.js +29 -29
  124. package/MetricPolling/dist/effect-MetricPolling.cjs.prod.js +29 -29
  125. package/MetricRegistry/dist/effect-MetricRegistry.cjs.dev.js +8 -8
  126. package/MetricRegistry/dist/effect-MetricRegistry.cjs.prod.js +8 -8
  127. package/MetricState/dist/effect-MetricState.cjs.dev.js +1 -1
  128. package/MetricState/dist/effect-MetricState.cjs.prod.js +1 -1
  129. package/MutableHashMap/dist/effect-MutableHashMap.cjs.dev.js +4 -4
  130. package/MutableHashMap/dist/effect-MutableHashMap.cjs.prod.js +4 -4
  131. package/MutableHashSet/dist/effect-MutableHashSet.cjs.dev.js +4 -4
  132. package/MutableHashSet/dist/effect-MutableHashSet.cjs.prod.js +4 -4
  133. package/MutableQueue/dist/effect-MutableQueue.cjs.dev.js +3 -3
  134. package/MutableQueue/dist/effect-MutableQueue.cjs.prod.js +3 -3
  135. package/Option/dist/effect-Option.cjs.dev.js +3 -3
  136. package/Option/dist/effect-Option.cjs.prod.js +3 -3
  137. package/Pool/dist/effect-Pool.cjs.dev.js +29 -29
  138. package/Pool/dist/effect-Pool.cjs.prod.js +29 -29
  139. package/Predicate/dist/effect-Predicate.cjs.dev.js +5 -5
  140. package/Predicate/dist/effect-Predicate.cjs.mjs +1 -1
  141. package/Predicate/dist/effect-Predicate.cjs.prod.js +5 -5
  142. package/Predicate/dist/effect-Predicate.esm.js +5 -5
  143. package/PubSub/dist/effect-PubSub.cjs.dev.js +28 -28
  144. package/PubSub/dist/effect-PubSub.cjs.prod.js +28 -28
  145. package/Queue/dist/effect-Queue.cjs.dev.js +28 -28
  146. package/Queue/dist/effect-Queue.cjs.prod.js +28 -28
  147. package/README.md +23 -0
  148. package/Random/dist/effect-Random.cjs.dev.js +14 -14
  149. package/Random/dist/effect-Random.cjs.prod.js +14 -14
  150. package/ReadonlyArray/dist/effect-ReadonlyArray.cjs.dev.js +3 -3
  151. package/ReadonlyArray/dist/effect-ReadonlyArray.cjs.prod.js +3 -3
  152. package/ReadonlyRecord/dist/effect-ReadonlyRecord.cjs.dev.js +3 -3
  153. package/ReadonlyRecord/dist/effect-ReadonlyRecord.cjs.prod.js +3 -3
  154. package/RedBlackTree/dist/effect-RedBlackTree.cjs.dev.js +3 -3
  155. package/RedBlackTree/dist/effect-RedBlackTree.cjs.prod.js +3 -3
  156. package/Ref/dist/effect-Ref.cjs.dev.js +9 -9
  157. package/Ref/dist/effect-Ref.cjs.prod.js +9 -9
  158. package/Reloadable/dist/effect-Reloadable.cjs.dev.js +33 -33
  159. package/Reloadable/dist/effect-Reloadable.cjs.prod.js +33 -33
  160. package/Request/dist/effect-Request.cjs.dev.js +28 -28
  161. package/Request/dist/effect-Request.cjs.prod.js +28 -28
  162. package/RequestBlock/dist/effect-RequestBlock.cjs.dev.js +36 -38
  163. package/RequestBlock/dist/effect-RequestBlock.cjs.prod.js +36 -38
  164. package/RequestResolver/dist/effect-RequestResolver.cjs.dev.js +42 -44
  165. package/RequestResolver/dist/effect-RequestResolver.cjs.prod.js +42 -44
  166. package/Resource/dist/effect-Resource.cjs.dev.js +31 -31
  167. package/Resource/dist/effect-Resource.cjs.prod.js +31 -31
  168. package/Runtime/dist/effect-Runtime.cjs.dev.js +30 -30
  169. package/Runtime/dist/effect-Runtime.cjs.prod.js +30 -30
  170. package/RuntimeFlags/dist/effect-RuntimeFlags.cjs.dev.js +33 -34
  171. package/RuntimeFlags/dist/effect-RuntimeFlags.cjs.prod.js +33 -34
  172. package/RuntimeFlagsPatch/dist/effect-RuntimeFlagsPatch.cjs.dev.js +6 -6
  173. package/RuntimeFlagsPatch/dist/effect-RuntimeFlagsPatch.cjs.prod.js +6 -6
  174. package/STM/dist/effect-STM.cjs.dev.js +45 -45
  175. package/STM/dist/effect-STM.cjs.prod.js +45 -45
  176. package/Schedule/dist/effect-Schedule.cjs.dev.js +20 -20
  177. package/Schedule/dist/effect-Schedule.cjs.prod.js +20 -20
  178. package/ScheduleDecision/dist/effect-ScheduleDecision.cjs.dev.js +3 -3
  179. package/ScheduleDecision/dist/effect-ScheduleDecision.cjs.prod.js +3 -3
  180. package/ScheduleInterval/dist/effect-ScheduleInterval.cjs.dev.js +3 -3
  181. package/ScheduleInterval/dist/effect-ScheduleInterval.cjs.prod.js +3 -3
  182. package/ScheduleIntervals/dist/effect-ScheduleIntervals.cjs.dev.js +3 -3
  183. package/ScheduleIntervals/dist/effect-ScheduleIntervals.cjs.prod.js +3 -3
  184. package/Scheduler/dist/effect-Scheduler.cjs.dev.js +8 -8
  185. package/Scheduler/dist/effect-Scheduler.cjs.prod.js +8 -8
  186. package/Scope/dist/effect-Scope.cjs.dev.js +27 -27
  187. package/Scope/dist/effect-Scope.cjs.prod.js +27 -27
  188. package/ScopedCache/dist/effect-ScopedCache.cjs.dev.js +34 -36
  189. package/ScopedCache/dist/effect-ScopedCache.cjs.prod.js +34 -36
  190. package/ScopedRef/dist/effect-ScopedRef.cjs.dev.js +31 -31
  191. package/ScopedRef/dist/effect-ScopedRef.cjs.prod.js +31 -31
  192. package/Sink/dist/effect-Sink.cjs.dev.js +39 -39
  193. package/Sink/dist/effect-Sink.cjs.prod.js +39 -39
  194. package/SortedMap/dist/effect-SortedMap.cjs.dev.js +3 -3
  195. package/SortedMap/dist/effect-SortedMap.cjs.prod.js +3 -3
  196. package/SortedSet/dist/effect-SortedSet.cjs.dev.js +3 -3
  197. package/SortedSet/dist/effect-SortedSet.cjs.prod.js +3 -3
  198. package/Stream/dist/effect-Stream.cjs.dev.js +43 -43
  199. package/Stream/dist/effect-Stream.cjs.prod.js +43 -43
  200. package/Streamable/dist/effect-Streamable.cjs.dev.js +43 -43
  201. package/Streamable/dist/effect-Streamable.cjs.prod.js +43 -43
  202. package/String/dist/effect-String.cjs.dev.js +3 -3
  203. package/String/dist/effect-String.cjs.prod.js +3 -3
  204. package/SubscriptionRef/dist/effect-SubscriptionRef.cjs.dev.js +46 -46
  205. package/SubscriptionRef/dist/effect-SubscriptionRef.cjs.prod.js +46 -46
  206. package/Supervisor/dist/effect-Supervisor.cjs.dev.js +33 -34
  207. package/Supervisor/dist/effect-Supervisor.cjs.prod.js +33 -34
  208. package/SynchronizedRef/dist/effect-SynchronizedRef.cjs.dev.js +30 -30
  209. package/SynchronizedRef/dist/effect-SynchronizedRef.cjs.prod.js +30 -30
  210. package/TArray/dist/effect-TArray.cjs.dev.js +47 -47
  211. package/TArray/dist/effect-TArray.cjs.prod.js +47 -47
  212. package/TDeferred/dist/effect-TDeferred.cjs.dev.js +46 -46
  213. package/TDeferred/dist/effect-TDeferred.cjs.prod.js +46 -46
  214. package/TMap/dist/effect-TMap.cjs.dev.js +48 -48
  215. package/TMap/dist/effect-TMap.cjs.prod.js +48 -48
  216. package/TPriorityQueue/dist/effect-TPriorityQueue.cjs.dev.js +45 -45
  217. package/TPriorityQueue/dist/effect-TPriorityQueue.cjs.prod.js +45 -45
  218. package/TPubSub/dist/effect-TPubSub.cjs.dev.js +50 -50
  219. package/TPubSub/dist/effect-TPubSub.cjs.prod.js +50 -50
  220. package/TQueue/dist/effect-TQueue.cjs.dev.js +47 -47
  221. package/TQueue/dist/effect-TQueue.cjs.prod.js +47 -47
  222. package/TRandom/dist/effect-TRandom.cjs.dev.js +46 -46
  223. package/TRandom/dist/effect-TRandom.cjs.prod.js +46 -46
  224. package/TReentrantLock/dist/effect-TReentrantLock.cjs.dev.js +50 -50
  225. package/TReentrantLock/dist/effect-TReentrantLock.cjs.prod.js +50 -50
  226. package/TRef/dist/effect-TRef.cjs.dev.js +47 -47
  227. package/TRef/dist/effect-TRef.cjs.mjs +0 -1
  228. package/TRef/dist/effect-TRef.cjs.prod.js +47 -47
  229. package/TRef/dist/effect-TRef.esm.js +3 -2
  230. package/TSemaphore/dist/effect-TSemaphore.cjs.dev.js +46 -46
  231. package/TSemaphore/dist/effect-TSemaphore.cjs.prod.js +46 -46
  232. package/TSet/dist/effect-TSet.cjs.dev.js +48 -48
  233. package/TSet/dist/effect-TSet.cjs.prod.js +48 -48
  234. package/Take/dist/effect-Take.cjs.dev.js +36 -38
  235. package/Take/dist/effect-Take.cjs.prod.js +36 -38
  236. package/TestAnnotation/dist/effect-TestAnnotation.cjs.dev.js +5 -5
  237. package/TestAnnotation/dist/effect-TestAnnotation.cjs.prod.js +5 -5
  238. package/TestAnnotations/dist/effect-TestAnnotations.cjs.dev.js +20 -20
  239. package/TestAnnotations/dist/effect-TestAnnotations.cjs.prod.js +20 -20
  240. package/TestClock/dist/effect-TestClock.cjs.dev.js +32 -32
  241. package/TestClock/dist/effect-TestClock.cjs.prod.js +32 -32
  242. package/TestConfig/dist/effect-TestConfig.cjs.dev.js +3 -3
  243. package/TestConfig/dist/effect-TestConfig.cjs.prod.js +3 -3
  244. package/TestContext/dist/effect-TestContext.cjs.dev.js +34 -36
  245. package/TestContext/dist/effect-TestContext.cjs.prod.js +34 -36
  246. package/TestLive/dist/effect-TestLive.cjs.dev.js +14 -14
  247. package/TestLive/dist/effect-TestLive.cjs.prod.js +14 -14
  248. package/TestServices/dist/effect-TestServices.cjs.dev.js +40 -42
  249. package/TestServices/dist/effect-TestServices.cjs.prod.js +40 -42
  250. package/TestSized/dist/effect-TestSized.cjs.dev.js +8 -8
  251. package/TestSized/dist/effect-TestSized.cjs.prod.js +8 -8
  252. package/Tracer/dist/effect-Tracer.cjs.dev.js +20 -18
  253. package/Tracer/dist/effect-Tracer.cjs.mjs +1 -0
  254. package/Tracer/dist/effect-Tracer.cjs.prod.js +20 -18
  255. package/Tracer/dist/effect-Tracer.esm.js +7 -6
  256. package/dist/{Context-da73ddfa.cjs.dev.js → Context-607e9b4c.cjs.dev.js} +2 -2
  257. package/dist/{Context-9fe5eb16.cjs.prod.js → Context-c91d8ca0.cjs.prod.js} +2 -2
  258. package/dist/{Either-d43f082c.cjs.prod.js → Either-a3f96c60.cjs.prod.js} +2 -2
  259. package/dist/{Either-fa0ef1d9.cjs.dev.js → Either-e7500e90.cjs.dev.js} +2 -2
  260. package/dist/{Option-463b42e6.cjs.dev.js → Option-01caa9d4.cjs.dev.js} +1 -1
  261. package/dist/{Option-935e5d7c.cjs.prod.js → Option-dd52e82a.cjs.prod.js} +1 -1
  262. package/dist/{Ref-4014b526.cjs.prod.js → Ref-23b67ad9.cjs.prod.js} +1 -1
  263. package/dist/{Ref-acdee7ef.cjs.dev.js → Ref-c75b5362.cjs.dev.js} +1 -1
  264. package/dist/{cache-5c7d77e4.cjs.prod.js → cache-7b144c1f.cjs.prod.js} +5 -5
  265. package/dist/{cache-7eed9d33.cjs.dev.js → cache-e3d6cc01.cjs.dev.js} +5 -5
  266. package/dist/{circular-9e10a5a7.cjs.prod.js → circular-105d525c.cjs.prod.js} +8 -9
  267. package/dist/{circular-1f481ffb.cjs.prod.js → circular-3761aff7.cjs.prod.js} +7 -7
  268. package/dist/{circular-c2dbce1a.cjs.dev.js → circular-8baf0205.cjs.dev.js} +7 -7
  269. package/dist/{circular-c8b65bdb.cjs.dev.js → circular-cbfc1699.cjs.dev.js} +8 -9
  270. package/dist/{config-5ba54da1.cjs.prod.js → config-6a5f97fe.cjs.prod.js} +3 -3
  271. package/dist/{config-3b7935a3.cjs.dev.js → config-887520b4.cjs.dev.js} +3 -3
  272. package/dist/{configProvider-b6b20998.cjs.prod.js → configProvider-098f7113.cjs.prod.js} +4 -4
  273. package/dist/{configProvider-f34a82f1.cjs.dev.js → configProvider-8567470d.cjs.dev.js} +4 -4
  274. package/dist/{core-b7401357.cjs.dev.js → core-6815193e.cjs.dev.js} +5 -4
  275. package/dist/{core-84e608f0.cjs.prod.js → core-8072a539.cjs.prod.js} +3 -3
  276. package/dist/{core-07202cc0.cjs.prod.js → core-84667e8d.cjs.prod.js} +5 -4
  277. package/dist/{core-c01fd1d8.cjs.dev.js → core-e6f9fdbe.cjs.dev.js} +3 -3
  278. package/dist/{core-effect-9201ea63.cjs.prod.js → core-effect-520abd3d.cjs.prod.js} +8 -8
  279. package/dist/{core-effect-1c564d42.cjs.dev.js → core-effect-5700daea.cjs.dev.js} +8 -8
  280. package/dist/{dataSource-b5eda714.cjs.dev.js → dataSource-0ca8ef42.cjs.dev.js} +2 -2
  281. package/dist/{dataSource-b83bc277.cjs.prod.js → dataSource-17adc342.cjs.prod.js} +2 -2
  282. package/dist/declarations/src/{Bigint.d.ts → BigInt.d.ts} +27 -27
  283. package/dist/declarations/src/{Bigint.d.ts.map → BigInt.d.ts.map} +1 -1
  284. package/dist/declarations/src/Channel.d.ts +11 -2
  285. package/dist/declarations/src/Channel.d.ts.map +1 -1
  286. package/dist/declarations/src/Chunk.d.ts +11 -1
  287. package/dist/declarations/src/Chunk.d.ts.map +1 -1
  288. package/dist/declarations/src/Data.d.ts +6 -7
  289. package/dist/declarations/src/Data.d.ts.map +1 -1
  290. package/dist/declarations/src/Effect.d.ts +67 -102
  291. package/dist/declarations/src/Effect.d.ts.map +1 -1
  292. package/dist/declarations/src/Either.d.ts +16 -0
  293. package/dist/declarations/src/Either.d.ts.map +1 -1
  294. package/dist/declarations/src/FiberRef.d.ts +2 -2
  295. package/dist/declarations/src/FiberRef.d.ts.map +1 -1
  296. package/dist/declarations/src/HashMap.d.ts +30 -0
  297. package/dist/declarations/src/HashMap.d.ts.map +1 -1
  298. package/dist/declarations/src/Layer.d.ts +98 -3
  299. package/dist/declarations/src/Layer.d.ts.map +1 -1
  300. package/dist/declarations/src/List.d.ts +8 -0
  301. package/dist/declarations/src/List.d.ts.map +1 -1
  302. package/dist/declarations/src/Logger.d.ts +2 -7
  303. package/dist/declarations/src/Logger.d.ts.map +1 -1
  304. package/dist/declarations/src/Match.d.ts +420 -0
  305. package/dist/declarations/src/Match.d.ts.map +1 -0
  306. package/dist/declarations/src/Metric.d.ts +88 -6
  307. package/dist/declarations/src/Metric.d.ts.map +1 -1
  308. package/dist/declarations/src/Predicate.d.ts +4 -4
  309. package/dist/declarations/src/Stream.d.ts +4 -2
  310. package/dist/declarations/src/Stream.d.ts.map +1 -1
  311. package/dist/declarations/src/TRef.d.ts.map +1 -1
  312. package/dist/declarations/src/Tracer.d.ts +17 -10
  313. package/dist/declarations/src/Tracer.d.ts.map +1 -1
  314. package/dist/declarations/src/index.d.ts +5 -1
  315. package/dist/declarations/src/index.d.ts.map +1 -1
  316. package/dist/{defaultServices-755d5b46.cjs.dev.js → defaultServices-193b11dc.cjs.dev.js} +15 -4
  317. package/dist/{defaultServices-9d7ce86f.cjs.prod.js → defaultServices-4c3bf140.cjs.prod.js} +15 -4
  318. package/dist/effect.cjs.dev.js +6 -3
  319. package/dist/effect.cjs.mjs +2 -1
  320. package/dist/effect.cjs.prod.js +6 -3
  321. package/dist/effect.esm.js +4 -2
  322. package/dist/{fiber-9519d109.cjs.prod.js → fiber-a1a5e429.cjs.prod.js} +3 -3
  323. package/dist/{fiber-5156eff2.cjs.dev.js → fiber-cbdeec72.cjs.dev.js} +3 -3
  324. package/dist/{fiberRefs-98b71233.cjs.dev.js → fiberRefs-8d2401f9.cjs.dev.js} +1 -1
  325. package/dist/{fiberRefs-558c17e6.cjs.prod.js → fiberRefs-f631451c.cjs.prod.js} +1 -1
  326. package/dist/{fiberRuntime-31ae011f.cjs.prod.js → fiberRuntime-4691f31b.cjs.prod.js} +27 -23
  327. package/dist/{fiberRuntime-d3872282.cjs.dev.js → fiberRuntime-7cb6cd44.cjs.dev.js} +27 -23
  328. package/dist/{groupBy-70c6dc0d.cjs.dev.js → groupBy-239a6e6e.cjs.dev.js} +10 -7
  329. package/dist/{groupBy-5fb5d639.cjs.prod.js → groupBy-5174c302.cjs.prod.js} +10 -7
  330. package/dist/{hook-8cefc909.cjs.dev.js → hook-8e8bee6a.cjs.dev.js} +1 -1
  331. package/dist/{hook-98ce30e4.cjs.prod.js → hook-c2815d51.cjs.prod.js} +1 -1
  332. package/dist/{key-198b6670.cjs.dev.js → key-2d4efb00.cjs.dev.js} +2 -2
  333. package/dist/{key-eb8a12b2.cjs.prod.js → key-9b2f3322.cjs.prod.js} +2 -2
  334. package/dist/{layer-29574350.cjs.dev.js → layer-961b15ae.cjs.dev.js} +15 -10
  335. package/dist/{layer-51ff4846.cjs.prod.js → layer-d1c204db.cjs.prod.js} +15 -10
  336. package/dist/{patch-7c559bb2.cjs.prod.js → patch-1771b466.cjs.prod.js} +1 -1
  337. package/dist/{patch-0220a642.cjs.dev.js → patch-32cc7202.cjs.dev.js} +1 -1
  338. package/dist/{pathPatch-b56a4da2.cjs.prod.js → pathPatch-312bd492.cjs.prod.js} +1 -1
  339. package/dist/{pathPatch-fab016f1.cjs.dev.js → pathPatch-45b09159.cjs.dev.js} +1 -1
  340. package/dist/{pool-59df8b4d.cjs.dev.js → pool-3890e6ce.cjs.dev.js} +5 -5
  341. package/dist/{pool-042cc42b.cjs.prod.js → pool-f178fcc7.cjs.prod.js} +5 -5
  342. package/dist/{query-c36decd5.cjs.dev.js → query-39c40fa6.cjs.dev.js} +3 -3
  343. package/dist/{query-a52b25f0.cjs.prod.js → query-a6b58e39.cjs.prod.js} +3 -3
  344. package/dist/{queue-e4c59627.cjs.dev.js → queue-4c4bdc04.cjs.dev.js} +2 -2
  345. package/dist/{queue-425b92f6.cjs.prod.js → queue-5342a8d5.cjs.prod.js} +2 -2
  346. package/dist/{registry-d5258dff.cjs.prod.js → registry-6fbdb4e3.cjs.prod.js} +2 -2
  347. package/dist/{registry-62ff192e.cjs.dev.js → registry-ec8b84a2.cjs.dev.js} +2 -2
  348. package/dist/{runtime-005f8a9b.cjs.prod.js → runtime-3295bc3c.cjs.prod.js} +6 -6
  349. package/dist/{runtime-57c8ddf8.cjs.dev.js → runtime-43b9e2bb.cjs.dev.js} +6 -6
  350. package/dist/{schedule-8cdf6bf1.cjs.prod.js → schedule-6431754b.cjs.prod.js} +3 -3
  351. package/dist/{schedule-e7a9f93f.cjs.dev.js → schedule-a4be407d.cjs.dev.js} +3 -3
  352. package/dist/{scopedRef-789d7fef.cjs.prod.js → scopedRef-7c2bf3f3.cjs.prod.js} +6 -6
  353. package/dist/{scopedRef-eb19c7a6.cjs.dev.js → scopedRef-9032002a.cjs.dev.js} +6 -6
  354. package/dist/{singleProducerAsyncInput-9ff8389b.cjs.dev.js → singleProducerAsyncInput-82e5c80c.cjs.dev.js} +1 -1
  355. package/dist/{singleProducerAsyncInput-f9b258b1.cjs.prod.js → singleProducerAsyncInput-879852ad.cjs.prod.js} +1 -1
  356. package/dist/{sink-b2fcb569.cjs.prod.js → sink-95371737.cjs.prod.js} +17 -19
  357. package/dist/{sink-17e02d40.cjs.dev.js → sink-e4280f95.cjs.dev.js} +17 -19
  358. package/dist/{stm-5264610b.cjs.dev.js → stm-4bf1a928.cjs.dev.js} +3 -3
  359. package/dist/{stm-9dd6be88.cjs.prod.js → stm-f792171c.cjs.prod.js} +3 -3
  360. package/dist/{stream-c9c522f2.cjs.prod.js → stream-254329d0.cjs.prod.js} +17 -13
  361. package/dist/{stream-5e2ed3a9.cjs.dev.js → stream-c498ce8a.cjs.dev.js} +17 -13
  362. package/dist/{synchronizedRef-ed8aa6ac.cjs.prod.js → synchronizedRef-5420532c.cjs.prod.js} +1 -1
  363. package/dist/{synchronizedRef-a12fd967.cjs.dev.js → synchronizedRef-cfe99d53.cjs.dev.js} +1 -1
  364. package/dist/{tArray-cac66af4.cjs.prod.js → tArray-7f227674.cjs.prod.js} +3 -3
  365. package/dist/{tArray-77a2ae3c.cjs.dev.js → tArray-996f4aba.cjs.dev.js} +3 -3
  366. package/dist/{tMap-5ac8ec9c.cjs.prod.js → tMap-811797bf.cjs.prod.js} +4 -4
  367. package/dist/{tMap-73bbf062.cjs.dev.js → tMap-b9665a82.cjs.dev.js} +4 -4
  368. package/dist/{tQueue-2b1cd0c4.cjs.dev.js → tQueue-0c15312e.cjs.dev.js} +3 -3
  369. package/dist/{tQueue-dded9b2d.cjs.prod.js → tQueue-8a6a0244.cjs.prod.js} +3 -3
  370. package/dist/{tRef-73c3549e.cjs.prod.js → tRef-2892ee02.cjs.prod.js} +1 -1
  371. package/dist/{tRef-90f0872b.cjs.dev.js → tRef-44d17d07.cjs.dev.js} +1 -1
  372. package/internal/cause.esm.js +2 -1
  373. package/internal/channel.esm.js +28 -30
  374. package/internal/core-effect.esm.js +1 -1
  375. package/internal/core-stream.esm.js +1 -1
  376. package/internal/fiberRuntime.esm.js +27 -23
  377. package/internal/groupBy.esm.js +8 -5
  378. package/internal/layer/circular.esm.js +5 -6
  379. package/internal/layer.esm.js +9 -5
  380. package/internal/logger.esm.js +3 -3
  381. package/internal/matcher.esm.js +314 -0
  382. package/internal/sink.esm.js +11 -11
  383. package/internal/stream.esm.js +15 -12
  384. package/internal/tracer.esm.js +14 -4
  385. package/package.json +25 -16
  386. package/src/{Bigint.ts → BigInt.ts} +26 -26
  387. package/src/Channel.ts +14 -2
  388. package/src/Chunk.ts +12 -1
  389. package/src/Data.ts +33 -21
  390. package/src/Duration.ts +2 -2
  391. package/src/Effect.ts +84 -151
  392. package/src/Either.ts +33 -0
  393. package/src/FiberRef.ts +2 -3
  394. package/src/HashMap.ts +30 -0
  395. package/src/Layer.ts +157 -3
  396. package/src/List.ts +9 -0
  397. package/src/Logger.ts +2 -8
  398. package/src/Match.ts +800 -0
  399. package/src/Metric.ts +88 -6
  400. package/src/Predicate.ts +4 -4
  401. package/src/Stream.ts +4 -2
  402. package/src/TRef.ts +1 -1
  403. package/src/Tracer.ts +18 -9
  404. package/src/index.ts +6 -1
  405. package/src/internal/cause.ts +1 -1
  406. package/src/internal/channel.ts +89 -94
  407. package/src/internal/core-effect.ts +27 -22
  408. package/src/internal/core.ts +5 -7
  409. package/src/internal/fiberRuntime.ts +39 -13
  410. package/src/internal/groupBy.ts +7 -3
  411. package/src/internal/layer/circular.ts +21 -6
  412. package/src/internal/layer.ts +20 -4
  413. package/src/internal/logger.ts +4 -4
  414. package/src/internal/matcher.ts +594 -0
  415. package/src/internal/stream.ts +17 -12
  416. package/src/internal/tracer.ts +28 -5
  417. package/src/tsconfig.json +49 -0
  418. package/Bigint/dist/effect-Bigint.cjs.d.mts +0 -2
  419. package/Bigint/dist/effect-Bigint.cjs.d.mts.map +0 -1
  420. package/Bigint/dist/effect-Bigint.cjs.d.ts +0 -2
  421. package/Bigint/dist/effect-Bigint.cjs.d.ts.map +0 -1
  422. package/Bigint/dist/effect-Bigint.cjs.js +0 -7
  423. package/Bigint/package.json +0 -4
  424. /package/dist/{Effectable-c4c14a2b.cjs.prod.js → Effectable-6a8a05f1.cjs.prod.js} +0 -0
  425. /package/dist/{Effectable-7314aed8.cjs.dev.js → Effectable-71c10ab9.cjs.dev.js} +0 -0
  426. /package/dist/{FiberId-1d7ac632.cjs.prod.js → FiberId-54d8bd67.cjs.prod.js} +0 -0
  427. /package/dist/{FiberId-d88ddce6.cjs.dev.js → FiberId-6708cdca.cjs.dev.js} +0 -0
  428. /package/dist/{HashSet-ac02a3e1.cjs.prod.js → HashSet-86613304.cjs.prod.js} +0 -0
  429. /package/dist/{HashSet-5963ad6b.cjs.dev.js → HashSet-dd020cb0.cjs.dev.js} +0 -0
  430. /package/dist/{RuntimeFlagsPatch-866fa259.cjs.prod.js → RuntimeFlagsPatch-35ed8dee.cjs.prod.js} +0 -0
  431. /package/dist/{RuntimeFlagsPatch-69102b03.cjs.dev.js → RuntimeFlagsPatch-9cbc441d.cjs.dev.js} +0 -0
  432. /package/dist/{boundaries-9af538e3.cjs.prod.js → boundaries-26f0dc82.cjs.prod.js} +0 -0
  433. /package/dist/{boundaries-f212e414.cjs.dev.js → boundaries-6eea221f.cjs.dev.js} +0 -0
  434. /package/dist/{configError-b43723af.cjs.prod.js → configError-856c7153.cjs.prod.js} +0 -0
  435. /package/dist/{configError-d5efe9c0.cjs.dev.js → configError-a824b415.cjs.dev.js} +0 -0
  436. /package/dist/{configSecret-3e8ae336.cjs.dev.js → configSecret-23cf1a3f.cjs.dev.js} +0 -0
  437. /package/dist/{configSecret-e2faa181.cjs.prod.js → configSecret-663cfb59.cjs.prod.js} +0 -0
  438. /package/dist/{keyType-0c5e6178.cjs.prod.js → keyType-4ec0b247.cjs.prod.js} +0 -0
  439. /package/dist/{keyType-7c164b82.cjs.dev.js → keyType-f30c9fa4.cjs.dev.js} +0 -0
  440. /package/dist/{label-655343b5.cjs.prod.js → label-a588e6cd.cjs.prod.js} +0 -0
  441. /package/dist/{label-011edbe7.cjs.dev.js → label-b0cebeae.cjs.dev.js} +0 -0
  442. /package/dist/{state-0bdf02b7.cjs.prod.js → state-40d5dc71.cjs.prod.js} +0 -0
  443. /package/dist/{state-931050c4.cjs.dev.js → state-620f7a22.cjs.dev.js} +0 -0
  444. /package/dist/{take-85daaf79.cjs.prod.js → take-981a87eb.cjs.prod.js} +0 -0
  445. /package/dist/{take-f9ef9e2e.cjs.dev.js → take-bfd0a3ed.cjs.dev.js} +0 -0
package/src/Match.ts ADDED
@@ -0,0 +1,800 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import type * as Either from "./Either"
5
+ import * as internal from "./internal/matcher"
6
+ import type * as Option from "./Option"
7
+ import type { Pipeable } from "./Pipeable"
8
+ import * as Predicate from "./Predicate"
9
+ import type { UnionToIntersection } from "./Types"
10
+ import type { Unify } from "./Unify"
11
+
12
+ /**
13
+ * @category type ids
14
+ * @since 1.0.0
15
+ */
16
+ export const MatcherTypeId: unique symbol = internal.TypeId
17
+
18
+ /**
19
+ * @category type ids
20
+ * @since 1.0.0
21
+ */
22
+ export type MatcherTypeId = typeof MatcherTypeId
23
+
24
+ /**
25
+ * @category model
26
+ * @since 1.0.0
27
+ */
28
+ export type Matcher<Input, Filters, RemainingApplied, Result, Provided> =
29
+ | TypeMatcher<Input, Filters, RemainingApplied, Result>
30
+ | ValueMatcher<Input, Filters, RemainingApplied, Result, Provided>
31
+
32
+ /**
33
+ * @category model
34
+ * @since 1.0.0
35
+ */
36
+ export interface TypeMatcher<Input, Filters, Remaining, Result> extends Pipeable {
37
+ readonly _tag: "TypeMatcher"
38
+ readonly [MatcherTypeId]: {
39
+ readonly _input: (_: Input) => unknown
40
+ readonly _filters: (_: never) => Filters
41
+ readonly _remaining: (_: never) => Remaining
42
+ readonly _result: (_: never) => Result
43
+ }
44
+ readonly cases: ReadonlyArray<Case>
45
+ readonly add: <I, R, RA, A>(_case: Case) => TypeMatcher<I, R, RA, A>
46
+ }
47
+
48
+ /**
49
+ * @category model
50
+ * @since 1.0.0
51
+ */
52
+ export interface ValueMatcher<Input, Filters, Remaining, Result, Provided> extends Pipeable {
53
+ readonly _tag: "ValueMatcher"
54
+ readonly [MatcherTypeId]: {
55
+ readonly _input: (_: Input) => unknown
56
+ readonly _filters: (_: never) => Filters
57
+ readonly _result: (_: never) => Result
58
+ }
59
+ readonly provided: Provided
60
+ readonly value: Either.Either<Remaining, Provided>
61
+ readonly add: <I, R, RA, A, Pr>(_case: Case) => ValueMatcher<I, R, RA, A, Pr>
62
+ }
63
+
64
+ /**
65
+ * @category model
66
+ * @since 1.0.0
67
+ */
68
+ export type Case = When | Not
69
+
70
+ /**
71
+ * @category model
72
+ * @since 1.0.0
73
+ */
74
+ export interface When {
75
+ readonly _tag: "When"
76
+ readonly guard: (u: unknown) => boolean
77
+ readonly evaluate: (input: unknown) => any
78
+ }
79
+
80
+ /**
81
+ * @category model
82
+ * @since 1.0.0
83
+ */
84
+ export interface Not {
85
+ readonly _tag: "Not"
86
+ readonly guard: (u: unknown) => boolean
87
+ readonly evaluate: (input: unknown) => any
88
+ }
89
+
90
+ /**
91
+ * @category constructors
92
+ * @since 1.0.0
93
+ */
94
+ export const type: <I>() => Matcher<I, Types.Without<never>, I, never, never> = internal.type
95
+
96
+ /**
97
+ * @category constructors
98
+ * @since 1.0.0
99
+ */
100
+ export const value: <const I>(
101
+ i: I
102
+ ) => Matcher<I, Types.Without<never>, I, never, I> = internal.value
103
+
104
+ /**
105
+ * @category constructors
106
+ * @since 1.0.0
107
+ */
108
+ export const valueTags: <
109
+ const I,
110
+ P extends {
111
+ readonly [Tag in Types.Tags<"_tag", I> & string]: (
112
+ _: Extract<I, { readonly _tag: Tag }>
113
+ ) => any
114
+ }
115
+ >(fields: P) => (input: I) => Unify<ReturnType<P[keyof P]>> = internal.valueTags
116
+
117
+ /**
118
+ * @category constructors
119
+ * @since 1.0.0
120
+ */
121
+ export const typeTags: <I>() => <
122
+ P extends {
123
+ readonly [Tag in Types.Tags<"_tag", I> & string]: (
124
+ _: Extract<I, { readonly _tag: Tag }>
125
+ ) => any
126
+ }
127
+ >(fields: P) => (input: I) => Unify<ReturnType<P[keyof P]>> = internal.typeTags
128
+
129
+ /**
130
+ * @category combinators
131
+ * @since 1.0.0
132
+ */
133
+ export const when: <
134
+ R,
135
+ const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>,
136
+ Fn extends (_: Types.WhenMatch<R, P>) => unknown
137
+ >(
138
+ pattern: P,
139
+ f: Fn
140
+ ) => <I, F, A, Pr>(
141
+ self: Matcher<I, F, R, A, Pr>
142
+ ) => Matcher<
143
+ I,
144
+ Types.AddWithout<F, Types.PForExclude<P>>,
145
+ Types.ApplyFilters<I, Types.AddWithout<F, Types.PForExclude<P>>>,
146
+ A | ReturnType<Fn>,
147
+ Pr
148
+ > = internal.when as any
149
+
150
+ /**
151
+ * @category combinators
152
+ * @since 1.0.0
153
+ */
154
+ export const whenOr: <
155
+ R,
156
+ const P extends ReadonlyArray<
157
+ Types.PatternPrimitive<R> | Types.PatternBase<R>
158
+ >,
159
+ Fn extends (_: Types.WhenMatch<R, P[number]>) => unknown
160
+ >(
161
+ ...args: [...patterns: P, f: Fn]
162
+ ) => <I, F, A, Pr>(
163
+ self: Matcher<I, F, R, A, Pr>
164
+ ) => Matcher<
165
+ I,
166
+ Types.AddWithout<F, Types.PForExclude<P[number]>>,
167
+ Types.ApplyFilters<I, Types.AddWithout<F, Types.PForExclude<P[number]>>>,
168
+ A | ReturnType<Fn>,
169
+ Pr
170
+ > = internal.whenOr as any
171
+
172
+ /**
173
+ * @category combinators
174
+ * @since 1.0.0
175
+ */
176
+ export const whenAnd: <
177
+ R,
178
+ const P extends ReadonlyArray<
179
+ Types.PatternPrimitive<R> | Types.PatternBase<R>
180
+ >,
181
+ Fn extends (_: Types.WhenMatch<R, Types.ArrayToIntersection<P>>) => unknown
182
+ >(
183
+ ...args: [...patterns: P, f: Fn]
184
+ ) => <I, F, A, Pr>(
185
+ self: Matcher<I, F, R, A, Pr>
186
+ ) => Matcher<
187
+ I,
188
+ Types.AddWithout<F, Types.PForExclude<Types.ArrayToIntersection<P>>>,
189
+ Types.ApplyFilters<
190
+ I,
191
+ Types.AddWithout<F, Types.PForExclude<Types.ArrayToIntersection<P>>>
192
+ >,
193
+ A | ReturnType<Fn>,
194
+ Pr
195
+ > = internal.whenAnd as any
196
+
197
+ /**
198
+ * @category combinators
199
+ * @since 1.0.0
200
+ */
201
+ export const discriminator: <D extends string>(
202
+ field: D
203
+ ) => <R, P extends Types.Tags<D, R> & string, B>(
204
+ ...pattern: [
205
+ first: P,
206
+ ...values: Array<P>,
207
+ f: (_: Extract<R, Record<D, P>>) => B
208
+ ]
209
+ ) => <I, F, A, Pr>(
210
+ self: Matcher<I, F, R, A, Pr>
211
+ ) => Matcher<
212
+ I,
213
+ Types.AddWithout<F, Extract<R, Record<D, P>>>,
214
+ Types.ApplyFilters<I, Types.AddWithout<F, Extract<R, Record<D, P>>>>,
215
+ B | A,
216
+ Pr
217
+ > = internal.discriminator
218
+
219
+ /**
220
+ * @category combinators
221
+ * @since 1.0.0
222
+ */
223
+ export const discriminatorStartsWith: <D extends string>(
224
+ field: D
225
+ ) => <R, P extends string, B>(
226
+ pattern: P,
227
+ f: (_: Extract<R, Record<D, `${P}${string}`>>) => B
228
+ ) => <I, F, A, Pr>(
229
+ self: Matcher<I, F, R, A, Pr>
230
+ ) => Matcher<
231
+ I,
232
+ Types.AddWithout<F, Extract<R, Record<D, `${P}${string}`>>>,
233
+ Types.ApplyFilters<
234
+ I,
235
+ Types.AddWithout<F, Extract<R, Record<D, `${P}${string}`>>>
236
+ >,
237
+ B | A,
238
+ Pr
239
+ > = internal.discriminatorStartsWith as any
240
+
241
+ /**
242
+ * @category combinators
243
+ * @since 1.0.0
244
+ */
245
+ export const discriminators: <D extends string>(
246
+ field: D
247
+ ) => <
248
+ R,
249
+ P extends {
250
+ readonly [Tag in Types.Tags<D, R> & string]?:
251
+ | ((_: Extract<R, Record<D, Tag>>) => any)
252
+ | undefined
253
+ }
254
+ >(
255
+ fields: P
256
+ ) => <I, F, A, Pr>(
257
+ self: Matcher<I, F, R, A, Pr>
258
+ ) => Matcher<
259
+ I,
260
+ Types.AddWithout<F, Extract<R, Record<D, keyof P>>>,
261
+ Types.ApplyFilters<I, Types.AddWithout<F, Extract<R, Record<D, keyof P>>>>,
262
+ A | ReturnType<P[keyof P] & {}>,
263
+ Pr
264
+ > = internal.discriminators
265
+
266
+ /**
267
+ * @category combinators
268
+ * @since 1.0.0
269
+ */
270
+ export const discriminatorsExhaustive: <D extends string>(
271
+ field: D
272
+ ) => <
273
+ R,
274
+ P extends {
275
+ readonly [Tag in Types.Tags<D, R> & string]: (
276
+ _: Extract<R, Record<D, Tag>>
277
+ ) => any
278
+ }
279
+ >(
280
+ fields: P
281
+ ) => <I, F, A, Pr>(
282
+ self: Matcher<I, F, R, A, Pr>
283
+ ) => [Pr] extends [never] ? (u: I) => Unify<A | ReturnType<P[keyof P]>>
284
+ : Unify<A | ReturnType<P[keyof P]>> = internal.discriminatorsExhaustive
285
+
286
+ /**
287
+ * @category combinators
288
+ * @since 1.0.0
289
+ */
290
+ export const tag: <R, P extends Types.Tags<"_tag", R> & string, B>(
291
+ ...pattern: [
292
+ first: P,
293
+ ...values: Array<P>,
294
+ f: (_: Extract<R, Record<"_tag", P>>) => B
295
+ ]
296
+ ) => <I, F, A, Pr>(
297
+ self: Matcher<I, F, R, A, Pr>
298
+ ) => Matcher<
299
+ I,
300
+ Types.AddWithout<F, Extract<R, Record<"_tag", P>>>,
301
+ Types.ApplyFilters<I, Types.AddWithout<F, Extract<R, Record<"_tag", P>>>>,
302
+ B | A,
303
+ Pr
304
+ > = internal.tag
305
+
306
+ /**
307
+ * @category combinators
308
+ * @since 1.0.0
309
+ */
310
+ export const tagStartsWith: <R, P extends string, B>(
311
+ pattern: P,
312
+ f: (_: Extract<R, Record<"_tag", `${P}${string}`>>) => B
313
+ ) => <I, F, A, Pr>(
314
+ self: Matcher<I, F, R, A, Pr>
315
+ ) => Matcher<
316
+ I,
317
+ Types.AddWithout<F, Extract<R, Record<"_tag", `${P}${string}`>>>,
318
+ Types.ApplyFilters<
319
+ I,
320
+ Types.AddWithout<F, Extract<R, Record<"_tag", `${P}${string}`>>>
321
+ >,
322
+ B | A,
323
+ Pr
324
+ > = internal.tagStartsWith as any
325
+
326
+ /**
327
+ * @category combinators
328
+ * @since 1.0.0
329
+ */
330
+ export const tags: <
331
+ R,
332
+ P extends {
333
+ readonly [Tag in Types.Tags<"_tag", R> & string]?:
334
+ | ((_: Extract<R, Record<"_tag", Tag>>) => any)
335
+ | undefined
336
+ }
337
+ >(
338
+ fields: P
339
+ ) => <I, F, A, Pr>(
340
+ self: Matcher<I, F, R, A, Pr>
341
+ ) => Matcher<
342
+ I,
343
+ Types.AddWithout<F, Extract<R, Record<"_tag", keyof P>>>,
344
+ Types.ApplyFilters<
345
+ I,
346
+ Types.AddWithout<F, Extract<R, Record<"_tag", keyof P>>>
347
+ >,
348
+ A | ReturnType<P[keyof P] & {}>,
349
+ Pr
350
+ > = internal.tags
351
+
352
+ /**
353
+ * @category combinators
354
+ * @since 1.0.0
355
+ */
356
+ export const tagsExhaustive: <
357
+ R,
358
+ P extends {
359
+ readonly [Tag in Types.Tags<"_tag", R> & string]: (
360
+ _: Extract<R, Record<"_tag", Tag>>
361
+ ) => any
362
+ }
363
+ >(
364
+ fields: P
365
+ ) => <I, F, A, Pr>(
366
+ self: Matcher<I, F, R, A, Pr>
367
+ ) => [Pr] extends [never] ? (u: I) => Unify<A | ReturnType<P[keyof P]>>
368
+ : Unify<A | ReturnType<P[keyof P]>> = internal.tagsExhaustive
369
+
370
+ /**
371
+ * @category combinators
372
+ * @since 1.0.0
373
+ */
374
+ export const not: <
375
+ R,
376
+ const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>,
377
+ Fn extends (_: Types.NotMatch<R, P>) => unknown
378
+ >(
379
+ pattern: P,
380
+ f: Fn
381
+ ) => <I, F, A, Pr>(
382
+ self: Matcher<I, F, R, A, Pr>
383
+ ) => Matcher<
384
+ I,
385
+ Types.AddOnly<F, Types.WhenMatch<R, P>>,
386
+ Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>,
387
+ A | ReturnType<Fn>,
388
+ Pr
389
+ > = internal.not as any
390
+
391
+ /**
392
+ * @category predicates
393
+ * @since 1.0.0
394
+ */
395
+ export const nonEmptyString: SafeRefinement<string, never> = internal.nonEmptyString
396
+
397
+ /**
398
+ * @category predicates
399
+ * @since 1.0.0
400
+ */
401
+ export const is: <
402
+ Literals extends ReadonlyArray<string | number | bigint | boolean | null>
403
+ >(...literals: Literals) => Predicate.Refinement<unknown, Literals[number]> = internal.is
404
+
405
+ /**
406
+ * @category predicates
407
+ * @since 1.0.0
408
+ */
409
+ export const string: Predicate.Refinement<unknown, string> = Predicate.isString
410
+
411
+ /**
412
+ * @category predicates
413
+ * @since 1.0.0
414
+ */
415
+ export const number: Predicate.Refinement<unknown, number> = Predicate.isNumber
416
+
417
+ /**
418
+ * @category predicates
419
+ * @since 1.0.0
420
+ */
421
+ export const any: SafeRefinement<unknown, any> = internal.any
422
+
423
+ /**
424
+ * @category predicates
425
+ * @since 1.0.0
426
+ */
427
+ export const defined: <A>(u: A) => u is A & {} = internal.defined
428
+
429
+ /**
430
+ * @category predicates
431
+ * @since 1.0.0
432
+ */
433
+ export const boolean: Predicate.Refinement<unknown, boolean> = Predicate.isBoolean
434
+
435
+ const _undefined: Predicate.Refinement<unknown, undefined> = Predicate.isUndefined
436
+ export {
437
+ /**
438
+ * @category predicates
439
+ * @since 1.0.0
440
+ */
441
+ _undefined as undefined
442
+ }
443
+
444
+ const _null: Predicate.Refinement<unknown, null> = Predicate.isNull
445
+ export {
446
+ /**
447
+ * @category predicates
448
+ * @since 1.0.0
449
+ */
450
+ _null as null
451
+ }
452
+
453
+ /**
454
+ * @category predicates
455
+ * @since 1.0.0
456
+ */
457
+ export const bigint: Predicate.Refinement<unknown, bigint> = Predicate.isBigInt
458
+
459
+ /**
460
+ * @category predicates
461
+ * @since 1.0.0
462
+ */
463
+ export const date: Predicate.Refinement<unknown, Date> = Predicate.isDate
464
+
465
+ /**
466
+ * @category predicates
467
+ * @since 1.0.0
468
+ */
469
+ export const record: Predicate.Refinement<
470
+ unknown,
471
+ {
472
+ [k: string]: any
473
+ [k: symbol]: any
474
+ }
475
+ > = Predicate.isRecord
476
+
477
+ /**
478
+ * @category predicates
479
+ * @since 1.0.0
480
+ */
481
+ export const instanceOf: <A extends abstract new(...args: any) => any>(
482
+ constructor: A
483
+ ) => SafeRefinement<InstanceType<A>, never> = internal.instanceOf
484
+
485
+ /**
486
+ * @category predicates
487
+ * @since 1.0.0
488
+ */
489
+ export const instanceOfUnsafe: <A extends abstract new(...args: any) => any>(
490
+ constructor: A
491
+ ) => SafeRefinement<InstanceType<A>, InstanceType<A>> = internal.instanceOf
492
+
493
+ /**
494
+ * @category conversions
495
+ * @since 1.0.0
496
+ */
497
+ export const orElse: <RA, B>(
498
+ f: (b: RA) => B
499
+ ) => <I, R, A, Pr>(
500
+ self: Matcher<I, R, RA, A, Pr>
501
+ ) => [Pr] extends [never] ? (input: I) => Unify<B | A> : Unify<B | A> = internal.orElse
502
+
503
+ /**
504
+ * @category conversions
505
+ * @since 1.0.0
506
+ */
507
+ export const orElseAbsurd: <I, R, RA, A, Pr>(
508
+ self: Matcher<I, R, RA, A, Pr>
509
+ ) => [Pr] extends [never] ? (input: I) => Unify<A> : Unify<A> = internal.orElseAbsurd
510
+
511
+ /**
512
+ * @category conversions
513
+ * @since 1.0.0
514
+ */
515
+ export const either: <I, F, R, A, Pr>(
516
+ self: Matcher<I, F, R, A, Pr>
517
+ ) => [Pr] extends [never] ? (input: I) => Either.Either<R, Unify<A>>
518
+ : Either.Either<R, Unify<A>> = internal.either
519
+
520
+ /**
521
+ * @category conversions
522
+ * @since 1.0.0
523
+ */
524
+ export const option: <I, F, R, A, Pr>(
525
+ self: Matcher<I, F, R, A, Pr>
526
+ ) => [Pr] extends [never] ? (input: I) => Option.Option<Unify<A>>
527
+ : Option.Option<Unify<A>> = internal.option
528
+
529
+ /**
530
+ * @category conversions
531
+ * @since 1.0.0
532
+ */
533
+ export const exhaustive: <I, F, A, Pr>(
534
+ self: Matcher<I, F, never, A, Pr>
535
+ ) => [Pr] extends [never] ? (u: I) => Unify<A> : Unify<A> = internal.exhaustive
536
+
537
+ /**
538
+ * @since 1.0.0
539
+ * @category type ids
540
+ */
541
+ export const SafeRefinementId = Symbol.for("./SafeRefinement")
542
+
543
+ /**
544
+ * @since 1.0.0
545
+ * @category type ids
546
+ */
547
+ export type SafeRefinementId = typeof SafeRefinementId
548
+
549
+ /**
550
+ * @category model
551
+ * @since 1.0.0
552
+ */
553
+ export interface SafeRefinement<A, R = A> {
554
+ readonly [SafeRefinementId]: (a: A) => R
555
+ }
556
+
557
+ const Fail = Symbol.for("./Fail")
558
+ type Fail = typeof Fail
559
+
560
+ /**
561
+ * @since 1.0.0
562
+ */
563
+ export declare namespace Types {
564
+ /**
565
+ * @since 1.0.0
566
+ */
567
+ export type WhenMatch<R, P> =
568
+ // check for any
569
+ [0] extends [1 & R] ? PForMatch<P>
570
+ : P extends SafeRefinement<infer SP, never> ? SP
571
+ : P extends Predicate.Refinement<infer _R, infer RP>
572
+ // try to narrow refinement
573
+ ? [Extract<R, RP>] extends [infer X] ? [X] extends [never]
574
+ // fallback to original refinement
575
+ ? RP
576
+ : X
577
+ : never
578
+ : P extends PredicateA<infer PP> ? PP
579
+ : ExtractMatch<R, PForMatch<P>>
580
+
581
+ /**
582
+ * @since 1.0.0
583
+ */
584
+ export type NotMatch<R, P> = Exclude<R, ExtractMatch<R, PForExclude<P>>>
585
+
586
+ /**
587
+ * @since 1.0.0
588
+ */
589
+ export type PForMatch<P> = [SafeRefinementP<ResolvePred<P>>] extends [infer X] ? X
590
+ : never
591
+
592
+ /**
593
+ * @since 1.0.0
594
+ */
595
+ export type PForExclude<P> = [SafeRefinementR<ToSafeRefinement<P>>] extends [infer X] ? X
596
+ : never
597
+
598
+ // utilities
599
+ type PredicateA<A> = Predicate.Predicate<A> | Predicate.Refinement<A, A>
600
+
601
+ type SafeRefinementP<A> = A extends never ? never
602
+ : A extends SafeRefinement<infer S, infer _> ? S
603
+ : A extends Function ? A
604
+ : A extends Record<string, any> ? DrainOuterGeneric<{ [K in keyof A]: SafeRefinementP<A[K]> }>
605
+ : A
606
+
607
+ type SafeRefinementR<A> = A extends never ? never
608
+ : A extends SafeRefinement<infer _, infer R> ? R
609
+ : A extends Function ? A
610
+ : A extends Record<string, any> ? DrainOuterGeneric<{ [K in keyof A]: SafeRefinementR<A[K]> }>
611
+ : A
612
+
613
+ type ResolvePred<A> = A extends never ? never
614
+ : A extends Predicate.Refinement<any, infer P> ? P
615
+ : A extends Predicate.Predicate<infer P> ? P
616
+ : A extends SafeRefinement<any> ? A
617
+ : A extends Record<string, any> ? DrainOuterGeneric<{ [K in keyof A]: ResolvePred<A[K]> }>
618
+ : A
619
+
620
+ type ToSafeRefinement<A> = A extends never ? never
621
+ : A extends Predicate.Refinement<any, infer P> ? SafeRefinement<P, P>
622
+ : A extends Predicate.Predicate<infer P> ? SafeRefinement<P, never>
623
+ : A extends SafeRefinement<any> ? A
624
+ : A extends Record<string, any> ? DrainOuterGeneric<{ [K in keyof A]: ToSafeRefinement<A[K]> }>
625
+ : NonLiteralsTo<A, never>
626
+
627
+ type NonLiteralsTo<A, T> = [A] extends [string | number | boolean | bigint] ? [string] extends [A] ? T
628
+ : [number] extends [A] ? T
629
+ : [boolean] extends [A] ? T
630
+ : [bigint] extends [A] ? T
631
+ : A
632
+ : A
633
+
634
+ type DrainOuterGeneric<T> = [T] extends [unknown] ? T : never
635
+
636
+ /**
637
+ * @since 1.0.0
638
+ */
639
+ export type PatternBase<A> = A extends ReadonlyArray<infer _T> ? ReadonlyArray<any> | PatternPrimitive<A>
640
+ : A extends Record<string, any> ? Partial<
641
+ DrainOuterGeneric<
642
+ { [K in keyof A]: PatternPrimitive<A[K] & {}> | PatternBase<A[K] & {}> }
643
+ >
644
+ >
645
+ : never
646
+
647
+ /**
648
+ * @since 1.0.0
649
+ */
650
+ export type PatternPrimitive<A> = PredicateA<A> | A | SafeRefinement<any>
651
+
652
+ /**
653
+ * @since 1.0.0
654
+ */
655
+ export interface Without<X> {
656
+ readonly _tag: "Without"
657
+ readonly _X: X
658
+ }
659
+
660
+ /**
661
+ * @since 1.0.0
662
+ */
663
+ export interface Only<X> {
664
+ readonly _tag: "Only"
665
+ readonly _X: X
666
+ }
667
+
668
+ /**
669
+ * @since 1.0.0
670
+ */
671
+ export type AddWithout<A, X> = [A] extends [Without<infer WX>] ? Without<X | WX>
672
+ : [A] extends [Only<infer OX>] ? Only<Exclude<OX, X>>
673
+ : never
674
+
675
+ /**
676
+ * @since 1.0.0
677
+ */
678
+ export type AddOnly<A, X> = [A] extends [Without<infer WX>] ? [X] extends [WX] ? never
679
+ : Only<X>
680
+ : [A] extends [Only<infer OX>] ? [X] extends [OX] ? Only<X>
681
+ : never
682
+ : never
683
+
684
+ /**
685
+ * @since 1.0.0
686
+ */
687
+ export type ApplyFilters<I, A> = A extends Only<infer X> ? X
688
+ : A extends Without<infer X> ? Exclude<I, X>
689
+ : never
690
+
691
+ /**
692
+ * @since 1.0.0
693
+ */
694
+ export type Tags<D extends string, P> = P extends Record<D, infer X> ? X : never
695
+
696
+ /**
697
+ * @since 1.0.0
698
+ */
699
+ export type ArrayToIntersection<A extends ReadonlyArray<any>> = UnionToIntersection<
700
+ A[number]
701
+ >
702
+
703
+ /**
704
+ * @since 1.0.0
705
+ */
706
+ export type ExtractMatch<I, P> = [ExtractAndNarrow<I, P>] extends [infer EI] ? EI
707
+ : never
708
+
709
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
710
+ type IntersectOf<U extends unknown> = (
711
+ U extends unknown ? (k: U) => void : never
712
+ ) extends (k: infer I) => void ? I
713
+ : never
714
+
715
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
716
+ type Last<U extends any> = IntersectOf<
717
+ U extends unknown ? (x: U) => void : never
718
+ > extends (x: infer P) => void ? P
719
+ : never
720
+
721
+ type _ListOf<U, LN extends Array<any> = [], LastU = Last<U>> = {
722
+ 0: _ListOf<Exclude<U, LastU>, [LastU, ...LN]>
723
+ 1: LN
724
+ }[[U] extends [never] ? 1 : 0]
725
+
726
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
727
+ type ListOf<U extends any> = _ListOf<U> extends infer X ? X extends Array<any> ? X
728
+ : []
729
+ : never
730
+
731
+ type IsUnion<T, U extends T = T> = (
732
+ T extends any ? (U extends T ? false : true) : never
733
+ ) extends false ? false
734
+ : true
735
+
736
+ type Replace<A, B> = A extends Function ? A
737
+ : A extends Record<string | number, any> ? { [K in keyof A]: K extends keyof B ? Replace<A[K], B[K]> : A[K] }
738
+ : [B] extends [A] ? B
739
+ : A
740
+
741
+ type MaybeReplace<I, P> = [P] extends [I] ? P
742
+ : [I] extends [P] ? Replace<I, P>
743
+ : Fail
744
+
745
+ type BuiltInObjects =
746
+ | Function
747
+ | Date
748
+ | RegExp
749
+ | Generator
750
+ | { readonly [Symbol.toStringTag]: string }
751
+
752
+ type IsPlainObject<T> = T extends BuiltInObjects ? false
753
+ : T extends Record<string, any> ? true
754
+ : false
755
+
756
+ type Simplify<A> = { [K in keyof A]: A[K] } & {}
757
+
758
+ type ExtractAndNarrow<I, P> =
759
+ // unknown is a wildcard pattern
760
+ unknown extends P ? I
761
+ : IsUnion<I> extends true ? ListOf<I> extends infer L ? L extends Array<any> ? Exclude<
762
+ DrainOuterGeneric<
763
+ { [K in keyof L]: ExtractAndNarrow<L[K], P> }
764
+ >[number],
765
+ Fail
766
+ >
767
+ : never
768
+ : never
769
+ : I extends ReadonlyArray<any> ? P extends ReadonlyArray<any> ? DrainOuterGeneric<
770
+ {
771
+ readonly [K in keyof I]: K extends keyof P ? ExtractAndNarrow<I[K], P[K]>
772
+ : I[K]
773
+ }
774
+ > extends infer R ? Fail extends R[keyof R] ? never
775
+ : R
776
+ : never
777
+ : never
778
+ : IsPlainObject<I> extends true ? string extends keyof I ? I extends P ? I
779
+ : never
780
+ : symbol extends keyof I ? I extends P ? I
781
+ : never
782
+ : Simplify<
783
+ DrainOuterGeneric<
784
+ {
785
+ [RK in Extract<keyof I, keyof P>]-?: ExtractAndNarrow<I[RK], P[RK]>
786
+ }
787
+ > & Omit<I, keyof P>
788
+ > extends infer R ? [keyof P] extends [keyof RemoveFails<R>] ? R
789
+ : never
790
+ : never
791
+ : MaybeReplace<I, P> extends infer R ? [I] extends [R] ? I
792
+ : R
793
+ : never
794
+
795
+ type RemoveFails<A> = {
796
+ [K in keyof A & {}]: A[K] extends Fail ? never : K
797
+ }[keyof A] extends infer K ? [K] extends [keyof A] ? { [RK in K]: A[RK] }
798
+ : {}
799
+ : {}
800
+ }