effect 4.0.0-beta.65 → 4.0.0-beta.67

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 (1657) hide show
  1. package/dist/Array.d.ts +113 -67
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +28 -18
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +404 -337
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +190 -146
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +167 -97
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +87 -47
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +62 -31
  14. package/dist/Boolean.d.ts.map +1 -1
  15. package/dist/Boolean.js +30 -15
  16. package/dist/Boolean.js.map +1 -1
  17. package/dist/Brand.d.ts +20 -1
  18. package/dist/Brand.d.ts.map +1 -1
  19. package/dist/Brand.js +16 -0
  20. package/dist/Brand.js.map +1 -1
  21. package/dist/Cache.d.ts +236 -132
  22. package/dist/Cache.d.ts.map +1 -1
  23. package/dist/Cache.js +133 -57
  24. package/dist/Cache.js.map +1 -1
  25. package/dist/Cause.d.ts +77 -65
  26. package/dist/Cause.d.ts.map +1 -1
  27. package/dist/Cause.js +43 -36
  28. package/dist/Cause.js.map +1 -1
  29. package/dist/Channel.d.ts +1518 -575
  30. package/dist/Channel.d.ts.map +1 -1
  31. package/dist/Channel.js +661 -287
  32. package/dist/Channel.js.map +1 -1
  33. package/dist/ChannelSchema.d.ts +119 -10
  34. package/dist/ChannelSchema.d.ts.map +1 -1
  35. package/dist/ChannelSchema.js +45 -6
  36. package/dist/ChannelSchema.js.map +1 -1
  37. package/dist/Chunk.d.ts +548 -379
  38. package/dist/Chunk.d.ts.map +1 -1
  39. package/dist/Chunk.js +238 -170
  40. package/dist/Chunk.js.map +1 -1
  41. package/dist/Clock.d.ts +15 -8
  42. package/dist/Clock.d.ts.map +1 -1
  43. package/dist/Clock.js +8 -4
  44. package/dist/Clock.js.map +1 -1
  45. package/dist/Combiner.d.ts +2 -4
  46. package/dist/Combiner.d.ts.map +1 -1
  47. package/dist/Combiner.js +2 -4
  48. package/dist/Combiner.js.map +1 -1
  49. package/dist/Config.d.ts +5 -4
  50. package/dist/Config.d.ts.map +1 -1
  51. package/dist/Config.js +9 -8
  52. package/dist/Config.js.map +1 -1
  53. package/dist/ConfigProvider.d.ts +1 -1
  54. package/dist/ConfigProvider.js +1 -1
  55. package/dist/Console.d.ts +76 -50
  56. package/dist/Console.d.ts.map +1 -1
  57. package/dist/Console.js +69 -46
  58. package/dist/Console.js.map +1 -1
  59. package/dist/Context.d.ts +386 -138
  60. package/dist/Context.d.ts.map +1 -1
  61. package/dist/Context.js +144 -62
  62. package/dist/Context.js.map +1 -1
  63. package/dist/Cron.d.ts +69 -48
  64. package/dist/Cron.d.ts.map +1 -1
  65. package/dist/Cron.js +96 -36
  66. package/dist/Cron.js.map +1 -1
  67. package/dist/Data.d.ts +3 -2
  68. package/dist/Data.d.ts.map +1 -1
  69. package/dist/Data.js.map +1 -1
  70. package/dist/DateTime.d.ts +875 -444
  71. package/dist/DateTime.d.ts.map +1 -1
  72. package/dist/DateTime.js +376 -217
  73. package/dist/DateTime.js.map +1 -1
  74. package/dist/Deferred.d.ts +367 -174
  75. package/dist/Deferred.d.ts.map +1 -1
  76. package/dist/Deferred.js +145 -71
  77. package/dist/Deferred.js.map +1 -1
  78. package/dist/Differ.d.ts +42 -0
  79. package/dist/Differ.d.ts.map +1 -1
  80. package/dist/Differ.js +36 -0
  81. package/dist/Duration.d.ts +329 -185
  82. package/dist/Duration.d.ts.map +1 -1
  83. package/dist/Duration.js +174 -106
  84. package/dist/Duration.js.map +1 -1
  85. package/dist/Effect.d.ts +2445 -2356
  86. package/dist/Effect.d.ts.map +1 -1
  87. package/dist/Effect.js +906 -758
  88. package/dist/Effect.js.map +1 -1
  89. package/dist/Effectable.d.ts +38 -3
  90. package/dist/Effectable.d.ts.map +1 -1
  91. package/dist/Effectable.js +3 -3
  92. package/dist/Effectable.js.map +1 -1
  93. package/dist/Encoding.d.ts +78 -28
  94. package/dist/Encoding.d.ts.map +1 -1
  95. package/dist/Encoding.js +75 -27
  96. package/dist/Encoding.js.map +1 -1
  97. package/dist/Equivalence.d.ts +14 -19
  98. package/dist/Equivalence.d.ts.map +1 -1
  99. package/dist/Equivalence.js +14 -19
  100. package/dist/Equivalence.js.map +1 -1
  101. package/dist/ErrorReporter.d.ts +66 -82
  102. package/dist/ErrorReporter.d.ts.map +1 -1
  103. package/dist/ErrorReporter.js +38 -29
  104. package/dist/ErrorReporter.js.map +1 -1
  105. package/dist/ExecutionPlan.d.ts +96 -12
  106. package/dist/ExecutionPlan.d.ts.map +1 -1
  107. package/dist/ExecutionPlan.js +21 -6
  108. package/dist/ExecutionPlan.js.map +1 -1
  109. package/dist/Exit.d.ts +7 -5
  110. package/dist/Exit.d.ts.map +1 -1
  111. package/dist/Exit.js.map +1 -1
  112. package/dist/Fiber.d.ts +72 -40
  113. package/dist/Fiber.d.ts.map +1 -1
  114. package/dist/Fiber.js +39 -21
  115. package/dist/Fiber.js.map +1 -1
  116. package/dist/FiberHandle.d.ts +119 -58
  117. package/dist/FiberHandle.d.ts.map +1 -1
  118. package/dist/FiberHandle.js +122 -40
  119. package/dist/FiberHandle.js.map +1 -1
  120. package/dist/FiberMap.d.ts +288 -160
  121. package/dist/FiberMap.d.ts.map +1 -1
  122. package/dist/FiberMap.js +176 -74
  123. package/dist/FiberMap.js.map +1 -1
  124. package/dist/FiberSet.d.ts +93 -52
  125. package/dist/FiberSet.d.ts.map +1 -1
  126. package/dist/FiberSet.js +97 -34
  127. package/dist/FiberSet.js.map +1 -1
  128. package/dist/FileSystem.d.ts +104 -73
  129. package/dist/FileSystem.d.ts.map +1 -1
  130. package/dist/FileSystem.js +53 -39
  131. package/dist/FileSystem.js.map +1 -1
  132. package/dist/Filter.d.ts +166 -88
  133. package/dist/Filter.d.ts.map +1 -1
  134. package/dist/Filter.js +68 -42
  135. package/dist/Filter.js.map +1 -1
  136. package/dist/Function.d.ts +154 -86
  137. package/dist/Function.d.ts.map +1 -1
  138. package/dist/Function.js +53 -37
  139. package/dist/Function.js.map +1 -1
  140. package/dist/Graph.d.ts +682 -365
  141. package/dist/Graph.d.ts.map +1 -1
  142. package/dist/Graph.js +308 -157
  143. package/dist/Graph.js.map +1 -1
  144. package/dist/HKT.d.ts +29 -13
  145. package/dist/HKT.d.ts.map +1 -1
  146. package/dist/Hash.d.ts +31 -18
  147. package/dist/Hash.d.ts.map +1 -1
  148. package/dist/Hash.js +25 -15
  149. package/dist/Hash.js.map +1 -1
  150. package/dist/HashMap.d.ts +444 -256
  151. package/dist/HashMap.d.ts.map +1 -1
  152. package/dist/HashMap.js +223 -105
  153. package/dist/HashMap.js.map +1 -1
  154. package/dist/HashRing.d.ts +36 -17
  155. package/dist/HashRing.d.ts.map +1 -1
  156. package/dist/HashRing.js +75 -8
  157. package/dist/HashRing.js.map +1 -1
  158. package/dist/HashSet.d.ts +194 -104
  159. package/dist/HashSet.d.ts.map +1 -1
  160. package/dist/HashSet.js +93 -38
  161. package/dist/HashSet.js.map +1 -1
  162. package/dist/Inspectable.d.ts +20 -9
  163. package/dist/Inspectable.d.ts.map +1 -1
  164. package/dist/Inspectable.js +16 -6
  165. package/dist/Inspectable.js.map +1 -1
  166. package/dist/Iterable.d.ts +309 -149
  167. package/dist/Iterable.d.ts.map +1 -1
  168. package/dist/Iterable.js +129 -65
  169. package/dist/Iterable.js.map +1 -1
  170. package/dist/JsonPatch.d.ts +4 -3
  171. package/dist/JsonPatch.d.ts.map +1 -1
  172. package/dist/JsonPatch.js +4 -3
  173. package/dist/JsonPatch.js.map +1 -1
  174. package/dist/Latch.d.ts +98 -15
  175. package/dist/Latch.d.ts.map +1 -1
  176. package/dist/Latch.js +41 -10
  177. package/dist/Latch.js.map +1 -1
  178. package/dist/Layer.d.ts +412 -309
  179. package/dist/Layer.d.ts.map +1 -1
  180. package/dist/Layer.js +262 -181
  181. package/dist/Layer.js.map +1 -1
  182. package/dist/LayerMap.d.ts +95 -21
  183. package/dist/LayerMap.d.ts.map +1 -1
  184. package/dist/LayerMap.js +58 -14
  185. package/dist/LayerMap.js.map +1 -1
  186. package/dist/LogLevel.d.ts +92 -131
  187. package/dist/LogLevel.d.ts.map +1 -1
  188. package/dist/LogLevel.js +25 -15
  189. package/dist/LogLevel.js.map +1 -1
  190. package/dist/Logger.d.ts +155 -99
  191. package/dist/Logger.d.ts.map +1 -1
  192. package/dist/Logger.js +211 -184
  193. package/dist/Logger.js.map +1 -1
  194. package/dist/ManagedRuntime.d.ts +75 -17
  195. package/dist/ManagedRuntime.d.ts.map +1 -1
  196. package/dist/ManagedRuntime.js +22 -16
  197. package/dist/ManagedRuntime.js.map +1 -1
  198. package/dist/Match.d.ts +133 -157
  199. package/dist/Match.d.ts.map +1 -1
  200. package/dist/Match.js +85 -76
  201. package/dist/Match.js.map +1 -1
  202. package/dist/Metric.d.ts +325 -284
  203. package/dist/Metric.d.ts.map +1 -1
  204. package/dist/Metric.js +217 -212
  205. package/dist/Metric.js.map +1 -1
  206. package/dist/MutableHashMap.d.ts +117 -58
  207. package/dist/MutableHashMap.d.ts.map +1 -1
  208. package/dist/MutableHashMap.js +52 -29
  209. package/dist/MutableHashMap.js.map +1 -1
  210. package/dist/MutableHashSet.d.ts +52 -30
  211. package/dist/MutableHashSet.d.ts.map +1 -1
  212. package/dist/MutableHashSet.js +94 -38
  213. package/dist/MutableHashSet.js.map +1 -1
  214. package/dist/MutableList.d.ts +92 -49
  215. package/dist/MutableList.d.ts.map +1 -1
  216. package/dist/MutableList.js +123 -71
  217. package/dist/MutableList.js.map +1 -1
  218. package/dist/MutableRef.d.ts +99 -62
  219. package/dist/MutableRef.d.ts.map +1 -1
  220. package/dist/MutableRef.js +79 -60
  221. package/dist/MutableRef.js.map +1 -1
  222. package/dist/Newtype.d.ts +3 -0
  223. package/dist/Newtype.d.ts.map +1 -1
  224. package/dist/Newtype.js.map +1 -1
  225. package/dist/NonEmptyIterable.d.ts +36 -39
  226. package/dist/NonEmptyIterable.d.ts.map +1 -1
  227. package/dist/NonEmptyIterable.js +34 -20
  228. package/dist/NonEmptyIterable.js.map +1 -1
  229. package/dist/Number.d.ts +116 -64
  230. package/dist/Number.d.ts.map +1 -1
  231. package/dist/Number.js +54 -30
  232. package/dist/Number.js.map +1 -1
  233. package/dist/Optic.d.ts +1 -2
  234. package/dist/Optic.d.ts.map +1 -1
  235. package/dist/Optic.js +0 -1
  236. package/dist/Optic.js.map +1 -1
  237. package/dist/Option.d.ts +38 -53
  238. package/dist/Option.d.ts.map +1 -1
  239. package/dist/Option.js +87 -11
  240. package/dist/Option.js.map +1 -1
  241. package/dist/Ordering.d.ts +43 -28
  242. package/dist/Ordering.d.ts.map +1 -1
  243. package/dist/Ordering.js +4 -2
  244. package/dist/Ordering.js.map +1 -1
  245. package/dist/PartitionedSemaphore.d.ts +225 -40
  246. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  247. package/dist/PartitionedSemaphore.js +113 -17
  248. package/dist/PartitionedSemaphore.js.map +1 -1
  249. package/dist/Path.d.ts +77 -13
  250. package/dist/Path.d.ts.map +1 -1
  251. package/dist/Path.js +48 -4
  252. package/dist/Path.js.map +1 -1
  253. package/dist/Pipeable.d.ts +71 -15
  254. package/dist/Pipeable.d.ts.map +1 -1
  255. package/dist/Pipeable.js +59 -12
  256. package/dist/Pipeable.js.map +1 -1
  257. package/dist/PlatformError.d.ts +74 -6
  258. package/dist/PlatformError.d.ts.map +1 -1
  259. package/dist/PlatformError.js +68 -5
  260. package/dist/PlatformError.js.map +1 -1
  261. package/dist/Pool.d.ts +66 -31
  262. package/dist/Pool.d.ts.map +1 -1
  263. package/dist/Pool.js +26 -24
  264. package/dist/Pool.js.map +1 -1
  265. package/dist/Predicate.d.ts +16 -21
  266. package/dist/Predicate.d.ts.map +1 -1
  267. package/dist/Predicate.js +9 -14
  268. package/dist/Predicate.js.map +1 -1
  269. package/dist/PrimaryKey.d.ts +9 -2
  270. package/dist/PrimaryKey.d.ts.map +1 -1
  271. package/dist/PrimaryKey.js +7 -1
  272. package/dist/PrimaryKey.js.map +1 -1
  273. package/dist/PubSub.d.ts +364 -262
  274. package/dist/PubSub.d.ts.map +1 -1
  275. package/dist/PubSub.js +245 -174
  276. package/dist/PubSub.js.map +1 -1
  277. package/dist/Pull.d.ts +94 -25
  278. package/dist/Pull.d.ts.map +1 -1
  279. package/dist/Pull.js +61 -13
  280. package/dist/Pull.js.map +1 -1
  281. package/dist/Queue.d.ts +284 -150
  282. package/dist/Queue.d.ts.map +1 -1
  283. package/dist/Queue.js +216 -113
  284. package/dist/Queue.js.map +1 -1
  285. package/dist/Random.d.ts +54 -35
  286. package/dist/Random.d.ts.map +1 -1
  287. package/dist/Random.js +36 -24
  288. package/dist/Random.js.map +1 -1
  289. package/dist/RcMap.d.ts +151 -141
  290. package/dist/RcMap.d.ts.map +1 -1
  291. package/dist/RcMap.js +66 -20
  292. package/dist/RcMap.js.map +1 -1
  293. package/dist/RcRef.d.ts +69 -32
  294. package/dist/RcRef.d.ts.map +1 -1
  295. package/dist/RcRef.js +33 -16
  296. package/dist/RcRef.js.map +1 -1
  297. package/dist/Record.d.ts +273 -129
  298. package/dist/Record.d.ts.map +1 -1
  299. package/dist/Record.js +117 -57
  300. package/dist/Record.js.map +1 -1
  301. package/dist/Redactable.d.ts +3 -3
  302. package/dist/Redactable.js +2 -2
  303. package/dist/Redacted.d.ts +63 -33
  304. package/dist/Redacted.d.ts.map +1 -1
  305. package/dist/Redacted.js +30 -14
  306. package/dist/Redacted.js.map +1 -1
  307. package/dist/Ref.d.ts +81 -52
  308. package/dist/Ref.d.ts.map +1 -1
  309. package/dist/Ref.js +54 -35
  310. package/dist/Ref.js.map +1 -1
  311. package/dist/References.d.ts +73 -31
  312. package/dist/References.d.ts.map +1 -1
  313. package/dist/References.js +66 -30
  314. package/dist/References.js.map +1 -1
  315. package/dist/RegExp.d.ts +11 -5
  316. package/dist/RegExp.d.ts.map +1 -1
  317. package/dist/RegExp.js +11 -5
  318. package/dist/RegExp.js.map +1 -1
  319. package/dist/Request.d.ts +158 -34
  320. package/dist/Request.d.ts.map +1 -1
  321. package/dist/Request.js +67 -12
  322. package/dist/Request.js.map +1 -1
  323. package/dist/RequestResolver.d.ts +261 -116
  324. package/dist/RequestResolver.d.ts.map +1 -1
  325. package/dist/RequestResolver.js +77 -41
  326. package/dist/RequestResolver.js.map +1 -1
  327. package/dist/Resource.d.ts +13 -7
  328. package/dist/Resource.d.ts.map +1 -1
  329. package/dist/Resource.js +44 -6
  330. package/dist/Resource.js.map +1 -1
  331. package/dist/Result.d.ts +26 -16
  332. package/dist/Result.d.ts.map +1 -1
  333. package/dist/Result.js +6 -6
  334. package/dist/Result.js.map +1 -1
  335. package/dist/Runtime.d.ts +43 -18
  336. package/dist/Runtime.d.ts.map +1 -1
  337. package/dist/Runtime.js +35 -16
  338. package/dist/Runtime.js.map +1 -1
  339. package/dist/Schedule.d.ts +545 -576
  340. package/dist/Schedule.d.ts.map +1 -1
  341. package/dist/Schedule.js +261 -247
  342. package/dist/Schedule.js.map +1 -1
  343. package/dist/Scheduler.d.ts +43 -6
  344. package/dist/Scheduler.d.ts.map +1 -1
  345. package/dist/Scheduler.js +33 -4
  346. package/dist/Scheduler.js.map +1 -1
  347. package/dist/Schema.d.ts +815 -294
  348. package/dist/Schema.d.ts.map +1 -1
  349. package/dist/Schema.js +287 -193
  350. package/dist/Schema.js.map +1 -1
  351. package/dist/SchemaAST.d.ts +24 -15
  352. package/dist/SchemaAST.d.ts.map +1 -1
  353. package/dist/SchemaAST.js +13 -9
  354. package/dist/SchemaAST.js.map +1 -1
  355. package/dist/SchemaGetter.d.ts +26 -13
  356. package/dist/SchemaGetter.d.ts.map +1 -1
  357. package/dist/SchemaGetter.js +24 -11
  358. package/dist/SchemaGetter.js.map +1 -1
  359. package/dist/SchemaIssue.d.ts +1 -8
  360. package/dist/SchemaIssue.d.ts.map +1 -1
  361. package/dist/SchemaIssue.js.map +1 -1
  362. package/dist/SchemaParser.d.ts +194 -25
  363. package/dist/SchemaParser.d.ts.map +1 -1
  364. package/dist/SchemaParser.js +220 -26
  365. package/dist/SchemaParser.js.map +1 -1
  366. package/dist/SchemaRepresentation.d.ts +2 -2
  367. package/dist/SchemaTransformation.d.ts +61 -41
  368. package/dist/SchemaTransformation.d.ts.map +1 -1
  369. package/dist/SchemaTransformation.js +56 -33
  370. package/dist/SchemaTransformation.js.map +1 -1
  371. package/dist/SchemaUtils.d.ts +7 -0
  372. package/dist/SchemaUtils.d.ts.map +1 -1
  373. package/dist/SchemaUtils.js +23 -0
  374. package/dist/SchemaUtils.js.map +1 -1
  375. package/dist/Scope.d.ts +102 -43
  376. package/dist/Scope.d.ts.map +1 -1
  377. package/dist/Scope.js +57 -23
  378. package/dist/Scope.js.map +1 -1
  379. package/dist/ScopedCache.d.ts +138 -46
  380. package/dist/ScopedCache.d.ts.map +1 -1
  381. package/dist/ScopedCache.js +80 -19
  382. package/dist/ScopedCache.js.map +1 -1
  383. package/dist/ScopedRef.d.ts +28 -8
  384. package/dist/ScopedRef.d.ts.map +1 -1
  385. package/dist/ScopedRef.js +25 -5
  386. package/dist/ScopedRef.js.map +1 -1
  387. package/dist/Semaphore.d.ts +64 -28
  388. package/dist/Semaphore.d.ts.map +1 -1
  389. package/dist/Semaphore.js +22 -13
  390. package/dist/Semaphore.js.map +1 -1
  391. package/dist/Sink.d.ts +458 -200
  392. package/dist/Sink.d.ts.map +1 -1
  393. package/dist/Sink.js +240 -89
  394. package/dist/Sink.js.map +1 -1
  395. package/dist/Stdio.d.ts +43 -6
  396. package/dist/Stdio.d.ts.map +1 -1
  397. package/dist/Stdio.js +33 -4
  398. package/dist/Stdio.js.map +1 -1
  399. package/dist/Stream.d.ts +1899 -1186
  400. package/dist/Stream.d.ts.map +1 -1
  401. package/dist/Stream.js +868 -525
  402. package/dist/Stream.js.map +1 -1
  403. package/dist/String.d.ts +171 -95
  404. package/dist/String.d.ts.map +1 -1
  405. package/dist/String.js +125 -67
  406. package/dist/String.js.map +1 -1
  407. package/dist/SubscriptionRef.d.ts +308 -203
  408. package/dist/SubscriptionRef.d.ts.map +1 -1
  409. package/dist/SubscriptionRef.js +125 -76
  410. package/dist/SubscriptionRef.js.map +1 -1
  411. package/dist/Symbol.d.ts +13 -5
  412. package/dist/Symbol.d.ts.map +1 -1
  413. package/dist/Symbol.js +13 -5
  414. package/dist/Symbol.js.map +1 -1
  415. package/dist/SynchronizedRef.d.ts +278 -62
  416. package/dist/SynchronizedRef.d.ts.map +1 -1
  417. package/dist/SynchronizedRef.js +116 -23
  418. package/dist/SynchronizedRef.js.map +1 -1
  419. package/dist/Take.d.ts +26 -2
  420. package/dist/Take.d.ts.map +1 -1
  421. package/dist/Take.js +4 -1
  422. package/dist/Take.js.map +1 -1
  423. package/dist/Terminal.d.ts +39 -7
  424. package/dist/Terminal.d.ts.map +1 -1
  425. package/dist/Terminal.js +10 -4
  426. package/dist/Terminal.js.map +1 -1
  427. package/dist/Tracer.d.ts +229 -55
  428. package/dist/Tracer.d.ts.map +1 -1
  429. package/dist/Tracer.js +94 -18
  430. package/dist/Tracer.js.map +1 -1
  431. package/dist/Trie.d.ts +213 -142
  432. package/dist/Trie.d.ts.map +1 -1
  433. package/dist/Trie.js +88 -60
  434. package/dist/Trie.js.map +1 -1
  435. package/dist/TxChunk.d.ts +182 -146
  436. package/dist/TxChunk.d.ts.map +1 -1
  437. package/dist/TxChunk.js +73 -56
  438. package/dist/TxChunk.js.map +1 -1
  439. package/dist/TxDeferred.d.ts +43 -29
  440. package/dist/TxDeferred.d.ts.map +1 -1
  441. package/dist/TxDeferred.js +22 -15
  442. package/dist/TxDeferred.js.map +1 -1
  443. package/dist/TxHashMap.d.ts +362 -222
  444. package/dist/TxHashMap.d.ts.map +1 -1
  445. package/dist/TxHashMap.js +171 -98
  446. package/dist/TxHashMap.js.map +1 -1
  447. package/dist/TxHashSet.d.ts +178 -104
  448. package/dist/TxHashSet.d.ts.map +1 -1
  449. package/dist/TxHashSet.js +84 -43
  450. package/dist/TxHashSet.js.map +1 -1
  451. package/dist/TxPriorityQueue.d.ts +93 -62
  452. package/dist/TxPriorityQueue.d.ts.map +1 -1
  453. package/dist/TxPriorityQueue.js +54 -36
  454. package/dist/TxPriorityQueue.js.map +1 -1
  455. package/dist/TxPubSub.d.ts +77 -49
  456. package/dist/TxPubSub.d.ts.map +1 -1
  457. package/dist/TxPubSub.js +60 -37
  458. package/dist/TxPubSub.js.map +1 -1
  459. package/dist/TxQueue.d.ts +279 -241
  460. package/dist/TxQueue.d.ts.map +1 -1
  461. package/dist/TxQueue.js +147 -101
  462. package/dist/TxQueue.js.map +1 -1
  463. package/dist/TxReentrantLock.d.ts +69 -46
  464. package/dist/TxReentrantLock.d.ts.map +1 -1
  465. package/dist/TxReentrantLock.js +48 -32
  466. package/dist/TxReentrantLock.js.map +1 -1
  467. package/dist/TxRef.d.ts +69 -40
  468. package/dist/TxRef.d.ts.map +1 -1
  469. package/dist/TxRef.js +35 -20
  470. package/dist/TxRef.js.map +1 -1
  471. package/dist/TxSemaphore.d.ts +101 -54
  472. package/dist/TxSemaphore.d.ts.map +1 -1
  473. package/dist/TxSemaphore.js +76 -34
  474. package/dist/TxSemaphore.js.map +1 -1
  475. package/dist/TxSubscriptionRef.d.ts +72 -48
  476. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  477. package/dist/TxSubscriptionRef.js +33 -22
  478. package/dist/TxSubscriptionRef.js.map +1 -1
  479. package/dist/Types.d.ts +34 -34
  480. package/dist/UndefinedOr.d.ts +48 -25
  481. package/dist/UndefinedOr.d.ts.map +1 -1
  482. package/dist/UndefinedOr.js +28 -25
  483. package/dist/UndefinedOr.js.map +1 -1
  484. package/dist/Unify.d.ts +71 -116
  485. package/dist/Unify.d.ts.map +1 -1
  486. package/dist/Unify.js +20 -6
  487. package/dist/Unify.js.map +1 -1
  488. package/dist/Utils.d.ts +4 -0
  489. package/dist/Utils.d.ts.map +1 -1
  490. package/dist/Utils.js +4 -0
  491. package/dist/Utils.js.map +1 -1
  492. package/dist/index.d.ts +81 -32
  493. package/dist/index.d.ts.map +1 -1
  494. package/dist/index.js +81 -32
  495. package/dist/index.js.map +1 -1
  496. package/dist/internal/concurrency.js +2 -2
  497. package/dist/internal/concurrency.js.map +1 -1
  498. package/dist/internal/core.js +8 -20
  499. package/dist/internal/core.js.map +1 -1
  500. package/dist/internal/effect.js +20 -19
  501. package/dist/internal/effect.js.map +1 -1
  502. package/dist/internal/executionPlan.js +2 -2
  503. package/dist/internal/executionPlan.js.map +1 -1
  504. package/dist/internal/option.js +5 -8
  505. package/dist/internal/option.js.map +1 -1
  506. package/dist/internal/result.js +5 -8
  507. package/dist/internal/result.js.map +1 -1
  508. package/dist/internal/schema/schema.js +1 -1
  509. package/dist/internal/schema/schema.js.map +1 -1
  510. package/dist/testing/FastCheck.d.ts +6 -3
  511. package/dist/testing/FastCheck.d.ts.map +1 -1
  512. package/dist/testing/FastCheck.js +6 -3
  513. package/dist/testing/FastCheck.js.map +1 -1
  514. package/dist/testing/TestClock.d.ts +39 -34
  515. package/dist/testing/TestClock.d.ts.map +1 -1
  516. package/dist/testing/TestClock.js +42 -12
  517. package/dist/testing/TestClock.js.map +1 -1
  518. package/dist/testing/TestConsole.d.ts +39 -30
  519. package/dist/testing/TestConsole.d.ts.map +1 -1
  520. package/dist/testing/TestConsole.js +25 -10
  521. package/dist/testing/TestConsole.js.map +1 -1
  522. package/dist/testing/TestSchema.js +7 -7
  523. package/dist/testing/TestSchema.js.map +1 -1
  524. package/dist/unstable/ai/AiError.d.ts +197 -130
  525. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  526. package/dist/unstable/ai/AiError.js +166 -102
  527. package/dist/unstable/ai/AiError.js.map +1 -1
  528. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  529. package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -2
  530. package/dist/unstable/ai/Chat.d.ts +65 -41
  531. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  532. package/dist/unstable/ai/Chat.js +51 -33
  533. package/dist/unstable/ai/Chat.js.map +1 -1
  534. package/dist/unstable/ai/EmbeddingModel.d.ts +12 -11
  535. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
  536. package/dist/unstable/ai/EmbeddingModel.js +9 -8
  537. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  538. package/dist/unstable/ai/IdGenerator.d.ts +28 -18
  539. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  540. package/dist/unstable/ai/IdGenerator.js +18 -11
  541. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  542. package/dist/unstable/ai/LanguageModel.d.ts +36 -30
  543. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  544. package/dist/unstable/ai/LanguageModel.js +21 -15
  545. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  546. package/dist/unstable/ai/McpSchema.d.ts +339 -119
  547. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  548. package/dist/unstable/ai/McpSchema.js +264 -98
  549. package/dist/unstable/ai/McpSchema.js.map +1 -1
  550. package/dist/unstable/ai/McpServer.d.ts +53 -19
  551. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  552. package/dist/unstable/ai/McpServer.js +65 -17
  553. package/dist/unstable/ai/McpServer.js.map +1 -1
  554. package/dist/unstable/ai/Model.d.ts +13 -7
  555. package/dist/unstable/ai/Model.d.ts.map +1 -1
  556. package/dist/unstable/ai/Model.js +11 -9
  557. package/dist/unstable/ai/Model.js.map +1 -1
  558. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  559. package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -2
  560. package/dist/unstable/ai/Prompt.d.ts +194 -168
  561. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  562. package/dist/unstable/ai/Prompt.js +75 -66
  563. package/dist/unstable/ai/Prompt.js.map +1 -1
  564. package/dist/unstable/ai/Response.d.ts +153 -140
  565. package/dist/unstable/ai/Response.d.ts.map +1 -1
  566. package/dist/unstable/ai/Response.js +43 -48
  567. package/dist/unstable/ai/Response.js.map +1 -1
  568. package/dist/unstable/ai/ResponseIdTracker.d.ts +43 -4
  569. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
  570. package/dist/unstable/ai/ResponseIdTracker.js +27 -2
  571. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  572. package/dist/unstable/ai/Telemetry.d.ts +42 -32
  573. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  574. package/dist/unstable/ai/Telemetry.js +14 -10
  575. package/dist/unstable/ai/Telemetry.js.map +1 -1
  576. package/dist/unstable/ai/Tokenizer.d.ts +13 -8
  577. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  578. package/dist/unstable/ai/Tokenizer.js +10 -6
  579. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  580. package/dist/unstable/ai/Tool.d.ts +153 -84
  581. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  582. package/dist/unstable/ai/Tool.js +97 -44
  583. package/dist/unstable/ai/Tool.js.map +1 -1
  584. package/dist/unstable/ai/Toolkit.d.ts +33 -42
  585. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  586. package/dist/unstable/ai/Toolkit.js +35 -36
  587. package/dist/unstable/ai/Toolkit.js.map +1 -1
  588. package/dist/unstable/ai/index.d.ts +42 -24
  589. package/dist/unstable/ai/index.d.ts.map +1 -1
  590. package/dist/unstable/ai/index.js +42 -24
  591. package/dist/unstable/ai/index.js.map +1 -1
  592. package/dist/unstable/cli/Argument.d.ts +226 -134
  593. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  594. package/dist/unstable/cli/Argument.js +101 -65
  595. package/dist/unstable/cli/Argument.js.map +1 -1
  596. package/dist/unstable/cli/CliError.d.ts +72 -26
  597. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  598. package/dist/unstable/cli/CliError.js +86 -23
  599. package/dist/unstable/cli/CliError.js.map +1 -1
  600. package/dist/unstable/cli/CliOutput.d.ts +43 -13
  601. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  602. package/dist/unstable/cli/CliOutput.js +30 -6
  603. package/dist/unstable/cli/CliOutput.js.map +1 -1
  604. package/dist/unstable/cli/Command.d.ts +218 -117
  605. package/dist/unstable/cli/Command.d.ts.map +1 -1
  606. package/dist/unstable/cli/Command.js +45 -31
  607. package/dist/unstable/cli/Command.js.map +1 -1
  608. package/dist/unstable/cli/Completions.d.ts +7 -7
  609. package/dist/unstable/cli/Completions.js +1 -1
  610. package/dist/unstable/cli/Flag.d.ts +235 -142
  611. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  612. package/dist/unstable/cli/Flag.js +111 -71
  613. package/dist/unstable/cli/Flag.js.map +1 -1
  614. package/dist/unstable/cli/GlobalFlag.d.ts +42 -14
  615. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  616. package/dist/unstable/cli/GlobalFlag.js +30 -7
  617. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  618. package/dist/unstable/cli/HelpDoc.d.ts +35 -10
  619. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  620. package/dist/unstable/cli/HelpDoc.js +21 -0
  621. package/dist/unstable/cli/Param.d.ts +79 -31
  622. package/dist/unstable/cli/Param.d.ts.map +1 -1
  623. package/dist/unstable/cli/Param.js +161 -99
  624. package/dist/unstable/cli/Param.js.map +1 -1
  625. package/dist/unstable/cli/Primitive.d.ts +79 -42
  626. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  627. package/dist/unstable/cli/Primitive.js +66 -35
  628. package/dist/unstable/cli/Primitive.js.map +1 -1
  629. package/dist/unstable/cli/Prompt.d.ts +178 -47
  630. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  631. package/dist/unstable/cli/Prompt.js +111 -31
  632. package/dist/unstable/cli/Prompt.js.map +1 -1
  633. package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
  634. package/dist/unstable/cli/internal/ansi.js +13 -0
  635. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  636. package/dist/unstable/cli/internal/command.d.ts +7 -7
  637. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  638. package/dist/unstable/cli/internal/command.js +12 -10
  639. package/dist/unstable/cli/internal/command.js.map +1 -1
  640. package/dist/unstable/cli/internal/config.d.ts +3 -0
  641. package/dist/unstable/cli/internal/config.d.ts.map +1 -1
  642. package/dist/unstable/cli/internal/config.js.map +1 -1
  643. package/dist/unstable/cli/internal/lexer.js.map +1 -1
  644. package/dist/unstable/cluster/ClusterCron.d.ts +35 -1
  645. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  646. package/dist/unstable/cluster/ClusterCron.js +35 -1
  647. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  648. package/dist/unstable/cluster/ClusterError.d.ts +56 -7
  649. package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
  650. package/dist/unstable/cluster/ClusterError.js +56 -7
  651. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  652. package/dist/unstable/cluster/ClusterMetrics.d.ts +39 -5
  653. package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
  654. package/dist/unstable/cluster/ClusterMetrics.js +39 -5
  655. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  656. package/dist/unstable/cluster/ClusterSchema.d.ts +61 -8
  657. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  658. package/dist/unstable/cluster/ClusterSchema.js +61 -8
  659. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  660. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +14 -2
  661. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  662. package/dist/unstable/cluster/ClusterWorkflowEngine.js +36 -3
  663. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  664. package/dist/unstable/cluster/DeliverAt.d.ts +39 -4
  665. package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
  666. package/dist/unstable/cluster/DeliverAt.js +11 -3
  667. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  668. package/dist/unstable/cluster/Entity.d.ts +75 -16
  669. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  670. package/dist/unstable/cluster/Entity.js +78 -13
  671. package/dist/unstable/cluster/Entity.js.map +1 -1
  672. package/dist/unstable/cluster/EntityAddress.d.ts +30 -2
  673. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  674. package/dist/unstable/cluster/EntityAddress.js +30 -2
  675. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  676. package/dist/unstable/cluster/EntityId.d.ts +18 -3
  677. package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
  678. package/dist/unstable/cluster/EntityId.js +15 -2
  679. package/dist/unstable/cluster/EntityId.js.map +1 -1
  680. package/dist/unstable/cluster/EntityProxy.d.ts +34 -2
  681. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  682. package/dist/unstable/cluster/EntityProxy.js +24 -2
  683. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  684. package/dist/unstable/cluster/EntityProxyServer.d.ts +17 -2
  685. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  686. package/dist/unstable/cluster/EntityProxyServer.js +40 -8
  687. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  688. package/dist/unstable/cluster/EntityResource.d.ts +43 -6
  689. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  690. package/dist/unstable/cluster/EntityResource.js +11 -4
  691. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  692. package/dist/unstable/cluster/EntityType.d.ts +27 -3
  693. package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
  694. package/dist/unstable/cluster/EntityType.js +24 -2
  695. package/dist/unstable/cluster/EntityType.js.map +1 -1
  696. package/dist/unstable/cluster/Envelope.d.ts +105 -23
  697. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  698. package/dist/unstable/cluster/Envelope.js +88 -14
  699. package/dist/unstable/cluster/Envelope.js.map +1 -1
  700. package/dist/unstable/cluster/HttpRunner.d.ts +88 -13
  701. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  702. package/dist/unstable/cluster/HttpRunner.js +88 -13
  703. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  704. package/dist/unstable/cluster/K8sHttpClient.d.ts +49 -6
  705. package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
  706. package/dist/unstable/cluster/K8sHttpClient.js +31 -6
  707. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  708. package/dist/unstable/cluster/MachineId.d.ts +24 -3
  709. package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
  710. package/dist/unstable/cluster/MachineId.js +21 -2
  711. package/dist/unstable/cluster/MachineId.js.map +1 -1
  712. package/dist/unstable/cluster/Message.d.ts +102 -13
  713. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  714. package/dist/unstable/cluster/Message.js +86 -10
  715. package/dist/unstable/cluster/Message.js.map +1 -1
  716. package/dist/unstable/cluster/MessageStorage.d.ts +127 -21
  717. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  718. package/dist/unstable/cluster/MessageStorage.js +71 -11
  719. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  720. package/dist/unstable/cluster/Reply.d.ts +101 -12
  721. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  722. package/dist/unstable/cluster/Reply.js +64 -8
  723. package/dist/unstable/cluster/Reply.js.map +1 -1
  724. package/dist/unstable/cluster/Runner.d.ts +47 -17
  725. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  726. package/dist/unstable/cluster/Runner.js +47 -17
  727. package/dist/unstable/cluster/Runner.js.map +1 -1
  728. package/dist/unstable/cluster/RunnerAddress.d.ts +34 -2
  729. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  730. package/dist/unstable/cluster/RunnerAddress.js +34 -2
  731. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  732. package/dist/unstable/cluster/RunnerHealth.d.ts +40 -12
  733. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  734. package/dist/unstable/cluster/RunnerHealth.js +40 -12
  735. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  736. package/dist/unstable/cluster/RunnerServer.d.ts +7 -4
  737. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  738. package/dist/unstable/cluster/RunnerServer.js +31 -4
  739. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  740. package/dist/unstable/cluster/RunnerStorage.d.ts +42 -5
  741. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  742. package/dist/unstable/cluster/RunnerStorage.js +38 -4
  743. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  744. package/dist/unstable/cluster/Runners.d.ts +73 -10
  745. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  746. package/dist/unstable/cluster/Runners.js +70 -9
  747. package/dist/unstable/cluster/Runners.js.map +1 -1
  748. package/dist/unstable/cluster/ShardId.d.ts +51 -5
  749. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  750. package/dist/unstable/cluster/ShardId.js +47 -4
  751. package/dist/unstable/cluster/ShardId.js.map +1 -1
  752. package/dist/unstable/cluster/Sharding.d.ts +10 -2
  753. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  754. package/dist/unstable/cluster/Sharding.js +35 -4
  755. package/dist/unstable/cluster/Sharding.js.map +1 -1
  756. package/dist/unstable/cluster/ShardingConfig.d.ts +65 -9
  757. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  758. package/dist/unstable/cluster/ShardingConfig.js +67 -10
  759. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  760. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -6
  761. package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
  762. package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -4
  763. package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
  764. package/dist/unstable/cluster/SingleRunner.d.ts +23 -1
  765. package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
  766. package/dist/unstable/cluster/SingleRunner.js +23 -1
  767. package/dist/unstable/cluster/SingleRunner.js.map +1 -1
  768. package/dist/unstable/cluster/Singleton.d.ts +15 -1
  769. package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
  770. package/dist/unstable/cluster/Singleton.js +15 -1
  771. package/dist/unstable/cluster/Singleton.js.map +1 -1
  772. package/dist/unstable/cluster/SingletonAddress.d.ts +21 -1
  773. package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
  774. package/dist/unstable/cluster/SingletonAddress.js +21 -1
  775. package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
  776. package/dist/unstable/cluster/Snowflake.d.ts +89 -19
  777. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  778. package/dist/unstable/cluster/Snowflake.js +48 -13
  779. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  780. package/dist/unstable/cluster/SocketRunner.d.ts +8 -2
  781. package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
  782. package/dist/unstable/cluster/SocketRunner.js +29 -2
  783. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  784. package/dist/unstable/cluster/SqlMessageStorage.d.ts +11 -3
  785. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  786. package/dist/unstable/cluster/SqlMessageStorage.js +27 -3
  787. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  788. package/dist/unstable/cluster/SqlRunnerStorage.d.ts +11 -3
  789. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  790. package/dist/unstable/cluster/SqlRunnerStorage.js +46 -7
  791. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  792. package/dist/unstable/cluster/TestRunner.d.ts +18 -1
  793. package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
  794. package/dist/unstable/cluster/TestRunner.js +18 -1
  795. package/dist/unstable/cluster/TestRunner.js.map +1 -1
  796. package/dist/unstable/cluster/internal/hash.js +12 -0
  797. package/dist/unstable/cluster/internal/hash.js.map +1 -1
  798. package/dist/unstable/devtools/DevTools.d.ts +26 -3
  799. package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
  800. package/dist/unstable/devtools/DevTools.js +26 -3
  801. package/dist/unstable/devtools/DevTools.js.map +1 -1
  802. package/dist/unstable/devtools/DevToolsClient.d.ts +20 -5
  803. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  804. package/dist/unstable/devtools/DevToolsClient.js +32 -5
  805. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  806. package/dist/unstable/devtools/DevToolsSchema.d.ts +184 -44
  807. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  808. package/dist/unstable/devtools/DevToolsSchema.js +102 -20
  809. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  810. package/dist/unstable/devtools/DevToolsServer.d.ts +27 -2
  811. package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
  812. package/dist/unstable/devtools/DevToolsServer.js +21 -1
  813. package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
  814. package/dist/unstable/encoding/Msgpack.d.ts +81 -12
  815. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  816. package/dist/unstable/encoding/Msgpack.js +75 -9
  817. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  818. package/dist/unstable/encoding/Ndjson.d.ts +149 -21
  819. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  820. package/dist/unstable/encoding/Ndjson.js +97 -13
  821. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  822. package/dist/unstable/encoding/Sse.d.ts +109 -18
  823. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  824. package/dist/unstable/encoding/Sse.js +69 -13
  825. package/dist/unstable/encoding/Sse.js.map +1 -1
  826. package/dist/unstable/eventlog/Event.d.ts +115 -30
  827. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  828. package/dist/unstable/eventlog/Event.js +22 -2
  829. package/dist/unstable/eventlog/Event.js.map +1 -1
  830. package/dist/unstable/eventlog/EventGroup.d.ts +50 -17
  831. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  832. package/dist/unstable/eventlog/EventGroup.js +24 -6
  833. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  834. package/dist/unstable/eventlog/EventJournal.d.ts +104 -20
  835. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  836. package/dist/unstable/eventlog/EventJournal.js +108 -16
  837. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  838. package/dist/unstable/eventlog/EventLog.d.ts +151 -31
  839. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  840. package/dist/unstable/eventlog/EventLog.js +111 -20
  841. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  842. package/dist/unstable/eventlog/EventLogEncryption.d.ts +42 -6
  843. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  844. package/dist/unstable/eventlog/EventLogEncryption.js +38 -5
  845. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  846. package/dist/unstable/eventlog/EventLogMessage.d.ts +96 -22
  847. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  848. package/dist/unstable/eventlog/EventLogMessage.js +72 -16
  849. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  850. package/dist/unstable/eventlog/EventLogRemote.d.ts +35 -8
  851. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  852. package/dist/unstable/eventlog/EventLogRemote.js +54 -8
  853. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  854. package/dist/unstable/eventlog/EventLogServer.d.ts +17 -3
  855. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  856. package/dist/unstable/eventlog/EventLogServer.js +17 -3
  857. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  858. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +32 -6
  859. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  860. package/dist/unstable/eventlog/EventLogServerEncrypted.js +52 -6
  861. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  862. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +74 -16
  863. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  864. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +90 -16
  865. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  866. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +59 -15
  867. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
  868. package/dist/unstable/eventlog/EventLogSessionAuth.js +73 -14
  869. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
  870. package/dist/unstable/eventlog/SqlEventJournal.d.ts +10 -2
  871. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  872. package/dist/unstable/eventlog/SqlEventJournal.js +28 -2
  873. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  874. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +32 -3
  875. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
  876. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +32 -3
  877. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  878. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +10 -2
  879. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  880. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +28 -2
  881. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  882. package/dist/unstable/http/Cookies.d.ts +156 -77
  883. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  884. package/dist/unstable/http/Cookies.js +93 -39
  885. package/dist/unstable/http/Cookies.js.map +1 -1
  886. package/dist/unstable/http/Etag.d.ts +40 -7
  887. package/dist/unstable/http/Etag.d.ts.map +1 -1
  888. package/dist/unstable/http/Etag.js +27 -4
  889. package/dist/unstable/http/Etag.js.map +1 -1
  890. package/dist/unstable/http/FetchHttpClient.d.ts +29 -3
  891. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  892. package/dist/unstable/http/FetchHttpClient.js +33 -4
  893. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  894. package/dist/unstable/http/FindMyWay.d.ts +1 -1
  895. package/dist/unstable/http/FindMyWay.js +1 -1
  896. package/dist/unstable/http/Headers.d.ts +182 -36
  897. package/dist/unstable/http/Headers.d.ts.map +1 -1
  898. package/dist/unstable/http/Headers.js +86 -16
  899. package/dist/unstable/http/Headers.js.map +1 -1
  900. package/dist/unstable/http/HttpBody.d.ts +114 -26
  901. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  902. package/dist/unstable/http/HttpBody.js +100 -22
  903. package/dist/unstable/http/HttpBody.js.map +1 -1
  904. package/dist/unstable/http/HttpClient.d.ts +205 -96
  905. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  906. package/dist/unstable/http/HttpClient.js +85 -39
  907. package/dist/unstable/http/HttpClient.js.map +1 -1
  908. package/dist/unstable/http/HttpClientError.d.ts +68 -12
  909. package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
  910. package/dist/unstable/http/HttpClientError.js +71 -9
  911. package/dist/unstable/http/HttpClientError.js.map +1 -1
  912. package/dist/unstable/http/HttpClientRequest.d.ts +318 -100
  913. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  914. package/dist/unstable/http/HttpClientRequest.js +153 -47
  915. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  916. package/dist/unstable/http/HttpClientResponse.d.ts +59 -16
  917. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  918. package/dist/unstable/http/HttpClientResponse.js +44 -11
  919. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  920. package/dist/unstable/http/HttpEffect.d.ts +42 -16
  921. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  922. package/dist/unstable/http/HttpEffect.js +33 -13
  923. package/dist/unstable/http/HttpEffect.js.map +1 -1
  924. package/dist/unstable/http/HttpIncomingMessage.d.ts +47 -7
  925. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  926. package/dist/unstable/http/HttpIncomingMessage.js +44 -6
  927. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  928. package/dist/unstable/http/HttpMethod.d.ts +35 -5
  929. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  930. package/dist/unstable/http/HttpMethod.js +23 -1
  931. package/dist/unstable/http/HttpMethod.js.map +1 -1
  932. package/dist/unstable/http/HttpMiddleware.d.ts +37 -11
  933. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  934. package/dist/unstable/http/HttpMiddleware.js +70 -31
  935. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  936. package/dist/unstable/http/HttpPlatform.d.ts +34 -3
  937. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  938. package/dist/unstable/http/HttpPlatform.js +35 -4
  939. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  940. package/dist/unstable/http/HttpRouter.d.ts +194 -45
  941. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  942. package/dist/unstable/http/HttpRouter.js +122 -28
  943. package/dist/unstable/http/HttpRouter.js.map +1 -1
  944. package/dist/unstable/http/HttpServer.d.ts +151 -22
  945. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  946. package/dist/unstable/http/HttpServer.js +77 -12
  947. package/dist/unstable/http/HttpServer.js.map +1 -1
  948. package/dist/unstable/http/HttpServerError.d.ts +90 -10
  949. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  950. package/dist/unstable/http/HttpServerError.js +82 -8
  951. package/dist/unstable/http/HttpServerError.js.map +1 -1
  952. package/dist/unstable/http/HttpServerRequest.d.ts +125 -21
  953. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  954. package/dist/unstable/http/HttpServerRequest.js +112 -31
  955. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  956. package/dist/unstable/http/HttpServerRespondable.d.ts +32 -6
  957. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  958. package/dist/unstable/http/HttpServerRespondable.js +43 -5
  959. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  960. package/dist/unstable/http/HttpServerResponse.d.ts +390 -67
  961. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  962. package/dist/unstable/http/HttpServerResponse.js +209 -38
  963. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  964. package/dist/unstable/http/HttpStaticServer.d.ts +22 -4
  965. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  966. package/dist/unstable/http/HttpStaticServer.js +22 -4
  967. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  968. package/dist/unstable/http/HttpTraceContext.d.ts +53 -6
  969. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  970. package/dist/unstable/http/HttpTraceContext.js +47 -5
  971. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  972. package/dist/unstable/http/Multipart.d.ts +178 -28
  973. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  974. package/dist/unstable/http/Multipart.js +130 -20
  975. package/dist/unstable/http/Multipart.js.map +1 -1
  976. package/dist/unstable/http/Multipasta/HeadersParser.d.ts +1 -1
  977. package/dist/unstable/http/Multipasta/HeadersParser.js +1 -1
  978. package/dist/unstable/http/Multipasta/Node.d.ts +1 -1
  979. package/dist/unstable/http/Multipasta/Node.js +1 -1
  980. package/dist/unstable/http/Multipasta/Search.d.ts +1 -1
  981. package/dist/unstable/http/Multipasta/Search.js +1 -1
  982. package/dist/unstable/http/Multipasta/Web.d.ts +1 -1
  983. package/dist/unstable/http/Multipasta/Web.js +1 -1
  984. package/dist/unstable/http/Multipasta.d.ts +1 -1
  985. package/dist/unstable/http/Multipasta.js +1 -1
  986. package/dist/unstable/http/Template.d.ts +53 -0
  987. package/dist/unstable/http/Template.d.ts.map +1 -1
  988. package/dist/unstable/http/Template.js +26 -0
  989. package/dist/unstable/http/Template.js.map +1 -1
  990. package/dist/unstable/http/Url.d.ts +56 -42
  991. package/dist/unstable/http/Url.d.ts.map +1 -1
  992. package/dist/unstable/http/Url.js +29 -15
  993. package/dist/unstable/http/Url.js.map +1 -1
  994. package/dist/unstable/http/UrlParams.d.ts +233 -49
  995. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  996. package/dist/unstable/http/UrlParams.js +116 -23
  997. package/dist/unstable/http/UrlParams.js.map +1 -1
  998. package/dist/unstable/httpapi/HttpApi.d.ts +49 -14
  999. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  1000. package/dist/unstable/httpapi/HttpApi.js +14 -8
  1001. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  1002. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +55 -16
  1003. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  1004. package/dist/unstable/httpapi/HttpApiBuilder.js +47 -9
  1005. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  1006. package/dist/unstable/httpapi/HttpApiClient.d.ts +58 -15
  1007. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  1008. package/dist/unstable/httpapi/HttpApiClient.js +43 -7
  1009. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  1010. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +214 -59
  1011. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  1012. package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -9
  1013. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  1014. package/dist/unstable/httpapi/HttpApiError.d.ts +81 -1
  1015. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  1016. package/dist/unstable/httpapi/HttpApiError.js +98 -1
  1017. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  1018. package/dist/unstable/httpapi/HttpApiGroup.d.ts +87 -20
  1019. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  1020. package/dist/unstable/httpapi/HttpApiGroup.js +5 -2
  1021. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  1022. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +113 -22
  1023. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  1024. package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -6
  1025. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  1026. package/dist/unstable/httpapi/HttpApiScalar.d.ts +19 -4
  1027. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  1028. package/dist/unstable/httpapi/HttpApiScalar.js +32 -2
  1029. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  1030. package/dist/unstable/httpapi/HttpApiSchema.d.ts +67 -30
  1031. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  1032. package/dist/unstable/httpapi/HttpApiSchema.js +48 -27
  1033. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  1034. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +74 -17
  1035. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  1036. package/dist/unstable/httpapi/HttpApiSecurity.js +38 -5
  1037. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  1038. package/dist/unstable/httpapi/HttpApiSwagger.d.ts +5 -2
  1039. package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
  1040. package/dist/unstable/httpapi/HttpApiSwagger.js +24 -2
  1041. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  1042. package/dist/unstable/httpapi/HttpApiTest.d.ts +9 -2
  1043. package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
  1044. package/dist/unstable/httpapi/HttpApiTest.js +28 -3
  1045. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  1046. package/dist/unstable/httpapi/OpenApi.d.ts +86 -15
  1047. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  1048. package/dist/unstable/httpapi/OpenApi.js +73 -15
  1049. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  1050. package/dist/unstable/observability/Otlp.d.ts +33 -3
  1051. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  1052. package/dist/unstable/observability/Otlp.js +14 -3
  1053. package/dist/unstable/observability/Otlp.js.map +1 -1
  1054. package/dist/unstable/observability/OtlpExporter.d.ts +8 -1
  1055. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  1056. package/dist/unstable/observability/OtlpExporter.js +32 -1
  1057. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  1058. package/dist/unstable/observability/OtlpLogger.d.ts +14 -2
  1059. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  1060. package/dist/unstable/observability/OtlpLogger.js +29 -2
  1061. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  1062. package/dist/unstable/observability/OtlpMetrics.d.ts +15 -4
  1063. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  1064. package/dist/unstable/observability/OtlpMetrics.js +32 -2
  1065. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  1066. package/dist/unstable/observability/OtlpResource.d.ts +49 -12
  1067. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  1068. package/dist/unstable/observability/OtlpResource.js +47 -5
  1069. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  1070. package/dist/unstable/observability/OtlpSerialization.d.ts +28 -3
  1071. package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
  1072. package/dist/unstable/observability/OtlpSerialization.js +28 -3
  1073. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  1074. package/dist/unstable/observability/OtlpTracer.d.ts +16 -2
  1075. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  1076. package/dist/unstable/observability/OtlpTracer.js +32 -2
  1077. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  1078. package/dist/unstable/observability/PrometheusMetrics.d.ts +32 -12
  1079. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  1080. package/dist/unstable/observability/PrometheusMetrics.js +7 -5
  1081. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  1082. package/dist/unstable/observability/index.d.ts +2 -1
  1083. package/dist/unstable/observability/index.d.ts.map +1 -1
  1084. package/dist/unstable/observability/index.js +2 -1
  1085. package/dist/unstable/observability/index.js.map +1 -1
  1086. package/dist/unstable/persistence/KeyValueStore.d.ts +93 -18
  1087. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  1088. package/dist/unstable/persistence/KeyValueStore.js +81 -21
  1089. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  1090. package/dist/unstable/persistence/Persistable.d.ts +76 -15
  1091. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  1092. package/dist/unstable/persistence/Persistable.js +22 -5
  1093. package/dist/unstable/persistence/Persistable.js.map +1 -1
  1094. package/dist/unstable/persistence/PersistedCache.d.ts +27 -2
  1095. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  1096. package/dist/unstable/persistence/PersistedCache.js +24 -1
  1097. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  1098. package/dist/unstable/persistence/PersistedQueue.d.ts +73 -16
  1099. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  1100. package/dist/unstable/persistence/PersistedQueue.js +60 -13
  1101. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  1102. package/dist/unstable/persistence/Persistence.d.ts +97 -16
  1103. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  1104. package/dist/unstable/persistence/Persistence.js +90 -14
  1105. package/dist/unstable/persistence/Persistence.js.map +1 -1
  1106. package/dist/unstable/persistence/RateLimiter.d.ts +97 -21
  1107. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  1108. package/dist/unstable/persistence/RateLimiter.js +82 -17
  1109. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  1110. package/dist/unstable/persistence/Redis.d.ts +26 -5
  1111. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  1112. package/dist/unstable/persistence/Redis.js +36 -4
  1113. package/dist/unstable/persistence/Redis.js.map +1 -1
  1114. package/dist/unstable/process/ChildProcess.d.ts +89 -109
  1115. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  1116. package/dist/unstable/process/ChildProcess.js +74 -23
  1117. package/dist/unstable/process/ChildProcess.js.map +1 -1
  1118. package/dist/unstable/process/ChildProcessSpawner.d.ts +22 -11
  1119. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  1120. package/dist/unstable/process/ChildProcessSpawner.js +11 -6
  1121. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  1122. package/dist/unstable/process/index.d.ts +2 -1
  1123. package/dist/unstable/process/index.d.ts.map +1 -1
  1124. package/dist/unstable/process/index.js +2 -1
  1125. package/dist/unstable/process/index.js.map +1 -1
  1126. package/dist/unstable/reactivity/AsyncResult.d.ts +196 -59
  1127. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  1128. package/dist/unstable/reactivity/AsyncResult.js +121 -36
  1129. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  1130. package/dist/unstable/reactivity/Atom.d.ts +539 -130
  1131. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1132. package/dist/unstable/reactivity/Atom.js +256 -62
  1133. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1134. package/dist/unstable/reactivity/AtomHttpApi.d.ts +41 -2
  1135. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1136. package/dist/unstable/reactivity/AtomHttpApi.js +35 -1
  1137. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1138. package/dist/unstable/reactivity/AtomRef.d.ts +51 -7
  1139. package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
  1140. package/dist/unstable/reactivity/AtomRef.js +29 -3
  1141. package/dist/unstable/reactivity/AtomRef.js.map +1 -1
  1142. package/dist/unstable/reactivity/AtomRegistry.d.ts +135 -21
  1143. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  1144. package/dist/unstable/reactivity/AtomRegistry.js +69 -10
  1145. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1146. package/dist/unstable/reactivity/AtomRpc.d.ts +36 -2
  1147. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1148. package/dist/unstable/reactivity/AtomRpc.js +29 -1
  1149. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1150. package/dist/unstable/reactivity/Hydration.d.ts +28 -5
  1151. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  1152. package/dist/unstable/reactivity/Hydration.js +35 -3
  1153. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  1154. package/dist/unstable/reactivity/Reactivity.d.ts +95 -13
  1155. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  1156. package/dist/unstable/reactivity/Reactivity.js +61 -7
  1157. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1158. package/dist/unstable/rpc/Rpc.d.ts +255 -56
  1159. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1160. package/dist/unstable/rpc/Rpc.js +44 -11
  1161. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1162. package/dist/unstable/rpc/RpcClient.d.ts +81 -19
  1163. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1164. package/dist/unstable/rpc/RpcClient.js +53 -13
  1165. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1166. package/dist/unstable/rpc/RpcClientError.d.ts +26 -2
  1167. package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
  1168. package/dist/unstable/rpc/RpcClientError.js +26 -2
  1169. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  1170. package/dist/unstable/rpc/RpcGroup.d.ts +51 -8
  1171. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  1172. package/dist/unstable/rpc/RpcGroup.js +3 -1
  1173. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1174. package/dist/unstable/rpc/RpcMessage.d.ts +128 -32
  1175. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  1176. package/dist/unstable/rpc/RpcMessage.js +23 -7
  1177. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  1178. package/dist/unstable/rpc/RpcMiddleware.d.ts +100 -20
  1179. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  1180. package/dist/unstable/rpc/RpcMiddleware.js +39 -3
  1181. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1182. package/dist/unstable/rpc/RpcSchema.d.ts +38 -4
  1183. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  1184. package/dist/unstable/rpc/RpcSchema.js +34 -3
  1185. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1186. package/dist/unstable/rpc/RpcSerialization.d.ts +60 -13
  1187. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1188. package/dist/unstable/rpc/RpcSerialization.js +56 -12
  1189. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1190. package/dist/unstable/rpc/RpcServer.d.ts +73 -23
  1191. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  1192. package/dist/unstable/rpc/RpcServer.js +70 -23
  1193. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1194. package/dist/unstable/rpc/RpcTest.d.ts +20 -1
  1195. package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
  1196. package/dist/unstable/rpc/RpcTest.js +20 -1
  1197. package/dist/unstable/rpc/RpcTest.js.map +1 -1
  1198. package/dist/unstable/rpc/RpcWorker.d.ts +40 -6
  1199. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  1200. package/dist/unstable/rpc/RpcWorker.js +17 -5
  1201. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1202. package/dist/unstable/rpc/Utils.d.ts +8 -0
  1203. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  1204. package/dist/unstable/rpc/Utils.js +8 -0
  1205. package/dist/unstable/rpc/Utils.js.map +1 -1
  1206. package/dist/unstable/schema/Model.d.ts +130 -52
  1207. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1208. package/dist/unstable/schema/Model.js +79 -34
  1209. package/dist/unstable/schema/Model.js.map +1 -1
  1210. package/dist/unstable/schema/VariantSchema.d.ts +104 -24
  1211. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  1212. package/dist/unstable/schema/VariantSchema.js +22 -6
  1213. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1214. package/dist/unstable/socket/Socket.d.ts +167 -34
  1215. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1216. package/dist/unstable/socket/Socket.js +124 -29
  1217. package/dist/unstable/socket/Socket.js.map +1 -1
  1218. package/dist/unstable/socket/SocketServer.d.ts +58 -10
  1219. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  1220. package/dist/unstable/socket/SocketServer.js +43 -5
  1221. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1222. package/dist/unstable/sql/Migrator.d.ts +35 -4
  1223. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  1224. package/dist/unstable/sql/Migrator.js +45 -5
  1225. package/dist/unstable/sql/Migrator.js.map +1 -1
  1226. package/dist/unstable/sql/SqlClient.d.ts +34 -2
  1227. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1228. package/dist/unstable/sql/SqlClient.js +38 -1
  1229. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1230. package/dist/unstable/sql/SqlConnection.d.ts +31 -0
  1231. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  1232. package/dist/unstable/sql/SqlConnection.js +22 -0
  1233. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1234. package/dist/unstable/sql/SqlError.d.ts +99 -0
  1235. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  1236. package/dist/unstable/sql/SqlError.js +114 -0
  1237. package/dist/unstable/sql/SqlError.js.map +1 -1
  1238. package/dist/unstable/sql/SqlModel.d.ts +26 -5
  1239. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  1240. package/dist/unstable/sql/SqlModel.js +8 -4
  1241. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1242. package/dist/unstable/sql/SqlResolver.d.ts +56 -13
  1243. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  1244. package/dist/unstable/sql/SqlResolver.js +44 -10
  1245. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1246. package/dist/unstable/sql/SqlSchema.d.ts +29 -8
  1247. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  1248. package/dist/unstable/sql/SqlSchema.js +29 -8
  1249. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1250. package/dist/unstable/sql/SqlStream.d.ts +3 -0
  1251. package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
  1252. package/dist/unstable/sql/SqlStream.js +23 -0
  1253. package/dist/unstable/sql/SqlStream.js.map +1 -1
  1254. package/dist/unstable/sql/Statement.d.ts +124 -0
  1255. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  1256. package/dist/unstable/sql/Statement.js +82 -0
  1257. package/dist/unstable/sql/Statement.js.map +1 -1
  1258. package/dist/unstable/sql/index.d.ts +1 -1
  1259. package/dist/unstable/sql/index.js +1 -1
  1260. package/dist/unstable/workers/Transferable.d.ts +65 -13
  1261. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  1262. package/dist/unstable/workers/Transferable.js +53 -10
  1263. package/dist/unstable/workers/Transferable.js.map +1 -1
  1264. package/dist/unstable/workers/Worker.d.ts +60 -8
  1265. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  1266. package/dist/unstable/workers/Worker.js +43 -4
  1267. package/dist/unstable/workers/Worker.js.map +1 -1
  1268. package/dist/unstable/workers/WorkerError.d.ts +31 -9
  1269. package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
  1270. package/dist/unstable/workers/WorkerError.js +44 -7
  1271. package/dist/unstable/workers/WorkerError.js.map +1 -1
  1272. package/dist/unstable/workers/WorkerRunner.d.ts +32 -3
  1273. package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
  1274. package/dist/unstable/workers/WorkerRunner.js +24 -1
  1275. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1276. package/dist/unstable/workers/index.d.ts +1 -1
  1277. package/dist/unstable/workers/index.js +1 -1
  1278. package/dist/unstable/workflow/Activity.d.ts +61 -10
  1279. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  1280. package/dist/unstable/workflow/Activity.js +21 -6
  1281. package/dist/unstable/workflow/Activity.js.map +1 -1
  1282. package/dist/unstable/workflow/DurableClock.d.ts +12 -3
  1283. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  1284. package/dist/unstable/workflow/DurableClock.js +22 -2
  1285. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1286. package/dist/unstable/workflow/DurableDeferred.d.ts +126 -31
  1287. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  1288. package/dist/unstable/workflow/DurableDeferred.js +76 -13
  1289. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1290. package/dist/unstable/workflow/DurableQueue.d.ts +145 -0
  1291. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -0
  1292. package/dist/unstable/workflow/DurableQueue.js +200 -0
  1293. package/dist/unstable/workflow/DurableQueue.js.map +1 -0
  1294. package/dist/unstable/workflow/Workflow.d.ts +100 -31
  1295. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1296. package/dist/unstable/workflow/Workflow.js +76 -20
  1297. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1298. package/dist/unstable/workflow/WorkflowEngine.d.ts +40 -5
  1299. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  1300. package/dist/unstable/workflow/WorkflowEngine.js +16 -4
  1301. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1302. package/dist/unstable/workflow/WorkflowProxy.d.ts +32 -2
  1303. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  1304. package/dist/unstable/workflow/WorkflowProxy.js +2 -2
  1305. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  1306. package/dist/unstable/workflow/WorkflowProxyServer.d.ts +36 -2
  1307. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  1308. package/dist/unstable/workflow/WorkflowProxyServer.js +12 -6
  1309. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1310. package/dist/unstable/workflow/index.d.ts +4 -0
  1311. package/dist/unstable/workflow/index.d.ts.map +1 -1
  1312. package/dist/unstable/workflow/index.js +4 -0
  1313. package/dist/unstable/workflow/index.js.map +1 -1
  1314. package/package.json +11 -11
  1315. package/src/Array.ts +113 -67
  1316. package/src/BigDecimal.ts +404 -337
  1317. package/src/BigInt.ts +167 -97
  1318. package/src/Boolean.ts +62 -31
  1319. package/src/Brand.ts +20 -1
  1320. package/src/Cache.ts +331 -164
  1321. package/src/Cause.ts +77 -65
  1322. package/src/Channel.ts +1585 -607
  1323. package/src/ChannelSchema.ts +137 -12
  1324. package/src/Chunk.ts +549 -380
  1325. package/src/Clock.ts +15 -8
  1326. package/src/Combiner.ts +2 -4
  1327. package/src/Config.ts +12 -10
  1328. package/src/ConfigProvider.ts +1 -1
  1329. package/src/Console.ts +88 -58
  1330. package/src/Context.ts +397 -149
  1331. package/src/Cron.ts +111 -48
  1332. package/src/Data.ts +3 -2
  1333. package/src/DateTime.ts +876 -445
  1334. package/src/Deferred.ts +367 -174
  1335. package/src/Differ.ts +42 -0
  1336. package/src/Duration.ts +329 -185
  1337. package/src/Effect.ts +2474 -2395
  1338. package/src/Effectable.ts +39 -4
  1339. package/src/Encoding.ts +78 -28
  1340. package/src/Equivalence.ts +14 -19
  1341. package/src/ErrorReporter.ts +66 -82
  1342. package/src/ExecutionPlan.ts +97 -13
  1343. package/src/Exit.ts +7 -5
  1344. package/src/Fiber.ts +72 -40
  1345. package/src/FiberHandle.ts +158 -58
  1346. package/src/FiberMap.ts +329 -164
  1347. package/src/FiberSet.ts +130 -52
  1348. package/src/FileSystem.ts +106 -74
  1349. package/src/Filter.ts +166 -88
  1350. package/src/Function.ts +154 -86
  1351. package/src/Graph.ts +682 -365
  1352. package/src/HKT.ts +29 -13
  1353. package/src/Hash.ts +31 -18
  1354. package/src/HashMap.ts +444 -256
  1355. package/src/HashRing.ts +94 -17
  1356. package/src/HashSet.ts +194 -104
  1357. package/src/Inspectable.ts +22 -10
  1358. package/src/Iterable.ts +309 -149
  1359. package/src/JsonPatch.ts +4 -3
  1360. package/src/Latch.ts +98 -15
  1361. package/src/Layer.ts +488 -345
  1362. package/src/LayerMap.ts +98 -25
  1363. package/src/LogLevel.ts +92 -131
  1364. package/src/Logger.ts +357 -288
  1365. package/src/ManagedRuntime.ts +75 -17
  1366. package/src/Match.ts +133 -157
  1367. package/src/Metric.ts +355 -304
  1368. package/src/MutableHashMap.ts +161 -84
  1369. package/src/MutableHashSet.ts +122 -52
  1370. package/src/MutableList.ts +141 -81
  1371. package/src/MutableRef.ts +130 -90
  1372. package/src/Newtype.ts +3 -0
  1373. package/src/NonEmptyIterable.ts +36 -39
  1374. package/src/Number.ts +116 -64
  1375. package/src/Optic.ts +1 -2
  1376. package/src/Option.ts +41 -53
  1377. package/src/Ordering.ts +43 -28
  1378. package/src/PartitionedSemaphore.ts +225 -40
  1379. package/src/Path.ts +77 -13
  1380. package/src/Pipeable.ts +76 -21
  1381. package/src/PlatformError.ts +74 -6
  1382. package/src/Pool.ts +94 -31
  1383. package/src/Predicate.ts +16 -21
  1384. package/src/PrimaryKey.ts +9 -2
  1385. package/src/PubSub.ts +364 -262
  1386. package/src/Pull.ts +94 -25
  1387. package/src/Queue.ts +284 -150
  1388. package/src/Random.ts +54 -35
  1389. package/src/RcMap.ts +151 -141
  1390. package/src/RcRef.ts +69 -32
  1391. package/src/Record.ts +273 -129
  1392. package/src/Redactable.ts +3 -3
  1393. package/src/Redacted.ts +63 -33
  1394. package/src/Ref.ts +161 -104
  1395. package/src/References.ts +73 -31
  1396. package/src/RegExp.ts +11 -5
  1397. package/src/Request.ts +158 -34
  1398. package/src/RequestResolver.ts +277 -119
  1399. package/src/Resource.ts +45 -7
  1400. package/src/Result.ts +31 -18
  1401. package/src/Runtime.ts +45 -19
  1402. package/src/Schedule.ts +575 -600
  1403. package/src/Scheduler.ts +43 -6
  1404. package/src/Schema.ts +845 -319
  1405. package/src/SchemaAST.ts +25 -16
  1406. package/src/SchemaGetter.ts +32 -17
  1407. package/src/SchemaIssue.ts +1 -8
  1408. package/src/SchemaParser.ts +262 -38
  1409. package/src/SchemaTransformation.ts +61 -41
  1410. package/src/SchemaUtils.ts +23 -0
  1411. package/src/Scope.ts +102 -43
  1412. package/src/ScopedCache.ts +192 -56
  1413. package/src/ScopedRef.ts +28 -8
  1414. package/src/Semaphore.ts +64 -28
  1415. package/src/Sink.ts +458 -200
  1416. package/src/Stdio.ts +43 -6
  1417. package/src/Stream.ts +2043 -1256
  1418. package/src/String.ts +171 -95
  1419. package/src/SubscriptionRef.ts +308 -203
  1420. package/src/Symbol.ts +13 -5
  1421. package/src/SynchronizedRef.ts +278 -62
  1422. package/src/Take.ts +26 -2
  1423. package/src/Terminal.ts +40 -7
  1424. package/src/Tracer.ts +229 -55
  1425. package/src/Trie.ts +213 -142
  1426. package/src/TxChunk.ts +182 -146
  1427. package/src/TxDeferred.ts +43 -29
  1428. package/src/TxHashMap.ts +370 -230
  1429. package/src/TxHashSet.ts +250 -152
  1430. package/src/TxPriorityQueue.ts +96 -64
  1431. package/src/TxPubSub.ts +77 -49
  1432. package/src/TxQueue.ts +279 -241
  1433. package/src/TxReentrantLock.ts +70 -47
  1434. package/src/TxRef.ts +70 -41
  1435. package/src/TxSemaphore.ts +101 -54
  1436. package/src/TxSubscriptionRef.ts +72 -48
  1437. package/src/Types.ts +34 -34
  1438. package/src/UndefinedOr.ts +48 -25
  1439. package/src/Unify.ts +71 -116
  1440. package/src/Utils.ts +4 -0
  1441. package/src/index.ts +81 -32
  1442. package/src/internal/concurrency.ts +2 -2
  1443. package/src/internal/core.ts +12 -23
  1444. package/src/internal/effect.ts +25 -29
  1445. package/src/internal/executionPlan.ts +2 -2
  1446. package/src/internal/option.ts +5 -8
  1447. package/src/internal/result.ts +5 -8
  1448. package/src/internal/schema/schema.ts +1 -1
  1449. package/src/testing/FastCheck.ts +6 -3
  1450. package/src/testing/TestClock.ts +63 -34
  1451. package/src/testing/TestConsole.ts +49 -30
  1452. package/src/testing/TestSchema.ts +8 -8
  1453. package/src/unstable/ai/AiError.ts +187 -120
  1454. package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
  1455. package/src/unstable/ai/Chat.ts +69 -43
  1456. package/src/unstable/ai/EmbeddingModel.ts +12 -11
  1457. package/src/unstable/ai/IdGenerator.ts +28 -18
  1458. package/src/unstable/ai/LanguageModel.ts +47 -46
  1459. package/src/unstable/ai/McpSchema.ts +339 -119
  1460. package/src/unstable/ai/McpServer.ts +78 -21
  1461. package/src/unstable/ai/Model.ts +23 -18
  1462. package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
  1463. package/src/unstable/ai/Prompt.ts +210 -184
  1464. package/src/unstable/ai/Response.ts +159 -147
  1465. package/src/unstable/ai/ResponseIdTracker.ts +43 -4
  1466. package/src/unstable/ai/Telemetry.ts +42 -32
  1467. package/src/unstable/ai/Tokenizer.ts +13 -8
  1468. package/src/unstable/ai/Tool.ts +154 -85
  1469. package/src/unstable/ai/Toolkit.ts +81 -84
  1470. package/src/unstable/ai/index.ts +42 -24
  1471. package/src/unstable/cli/Argument.ts +226 -134
  1472. package/src/unstable/cli/CliError.ts +96 -26
  1473. package/src/unstable/cli/CliOutput.ts +43 -13
  1474. package/src/unstable/cli/Command.ts +225 -125
  1475. package/src/unstable/cli/Completions.ts +7 -7
  1476. package/src/unstable/cli/Flag.ts +235 -142
  1477. package/src/unstable/cli/GlobalFlag.ts +42 -14
  1478. package/src/unstable/cli/HelpDoc.ts +35 -10
  1479. package/src/unstable/cli/Param.ts +328 -190
  1480. package/src/unstable/cli/Primitive.ts +79 -42
  1481. package/src/unstable/cli/Prompt.ts +210 -58
  1482. package/src/unstable/cli/internal/ansi.ts +13 -0
  1483. package/src/unstable/cli/internal/command.ts +17 -15
  1484. package/src/unstable/cli/internal/config.ts +3 -0
  1485. package/src/unstable/cli/internal/lexer.ts +11 -0
  1486. package/src/unstable/cluster/ClusterCron.ts +35 -1
  1487. package/src/unstable/cluster/ClusterError.ts +56 -7
  1488. package/src/unstable/cluster/ClusterMetrics.ts +39 -5
  1489. package/src/unstable/cluster/ClusterSchema.ts +61 -8
  1490. package/src/unstable/cluster/ClusterWorkflowEngine.ts +36 -3
  1491. package/src/unstable/cluster/DeliverAt.ts +39 -4
  1492. package/src/unstable/cluster/Entity.ts +110 -19
  1493. package/src/unstable/cluster/EntityAddress.ts +30 -2
  1494. package/src/unstable/cluster/EntityId.ts +18 -3
  1495. package/src/unstable/cluster/EntityProxy.ts +34 -2
  1496. package/src/unstable/cluster/EntityProxyServer.ts +44 -8
  1497. package/src/unstable/cluster/EntityResource.ts +43 -6
  1498. package/src/unstable/cluster/EntityType.ts +27 -3
  1499. package/src/unstable/cluster/Envelope.ts +128 -23
  1500. package/src/unstable/cluster/HttpRunner.ts +88 -13
  1501. package/src/unstable/cluster/K8sHttpClient.ts +49 -6
  1502. package/src/unstable/cluster/MachineId.ts +24 -3
  1503. package/src/unstable/cluster/Message.ts +102 -13
  1504. package/src/unstable/cluster/MessageStorage.ts +128 -22
  1505. package/src/unstable/cluster/Reply.ts +101 -12
  1506. package/src/unstable/cluster/Runner.ts +47 -17
  1507. package/src/unstable/cluster/RunnerAddress.ts +34 -2
  1508. package/src/unstable/cluster/RunnerHealth.ts +40 -12
  1509. package/src/unstable/cluster/RunnerServer.ts +31 -4
  1510. package/src/unstable/cluster/RunnerStorage.ts +42 -5
  1511. package/src/unstable/cluster/Runners.ts +73 -10
  1512. package/src/unstable/cluster/ShardId.ts +51 -5
  1513. package/src/unstable/cluster/Sharding.ts +35 -4
  1514. package/src/unstable/cluster/ShardingConfig.ts +76 -11
  1515. package/src/unstable/cluster/ShardingRegistrationEvent.ts +31 -7
  1516. package/src/unstable/cluster/SingleRunner.ts +23 -1
  1517. package/src/unstable/cluster/Singleton.ts +15 -1
  1518. package/src/unstable/cluster/SingletonAddress.ts +21 -1
  1519. package/src/unstable/cluster/Snowflake.ts +89 -19
  1520. package/src/unstable/cluster/SocketRunner.ts +29 -2
  1521. package/src/unstable/cluster/SqlMessageStorage.ts +27 -3
  1522. package/src/unstable/cluster/SqlRunnerStorage.ts +46 -7
  1523. package/src/unstable/cluster/TestRunner.ts +18 -1
  1524. package/src/unstable/cluster/internal/hash.ts +12 -0
  1525. package/src/unstable/devtools/DevTools.ts +26 -3
  1526. package/src/unstable/devtools/DevToolsClient.ts +32 -5
  1527. package/src/unstable/devtools/DevToolsSchema.ts +201 -44
  1528. package/src/unstable/devtools/DevToolsServer.ts +27 -2
  1529. package/src/unstable/encoding/Msgpack.ts +97 -12
  1530. package/src/unstable/encoding/Ndjson.ts +149 -21
  1531. package/src/unstable/encoding/Sse.ts +109 -18
  1532. package/src/unstable/eventlog/Event.ts +131 -30
  1533. package/src/unstable/eventlog/EventGroup.ts +50 -17
  1534. package/src/unstable/eventlog/EventJournal.ts +120 -20
  1535. package/src/unstable/eventlog/EventLog.ts +151 -31
  1536. package/src/unstable/eventlog/EventLogEncryption.ts +42 -6
  1537. package/src/unstable/eventlog/EventLogMessage.ts +92 -18
  1538. package/src/unstable/eventlog/EventLogRemote.ts +54 -8
  1539. package/src/unstable/eventlog/EventLogServer.ts +33 -3
  1540. package/src/unstable/eventlog/EventLogServerEncrypted.ts +52 -6
  1541. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +90 -16
  1542. package/src/unstable/eventlog/EventLogSessionAuth.ts +77 -15
  1543. package/src/unstable/eventlog/SqlEventJournal.ts +28 -2
  1544. package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +32 -3
  1545. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +28 -2
  1546. package/src/unstable/http/Cookies.ts +156 -77
  1547. package/src/unstable/http/Etag.ts +40 -7
  1548. package/src/unstable/http/FetchHttpClient.ts +33 -4
  1549. package/src/unstable/http/FindMyWay.ts +1 -1
  1550. package/src/unstable/http/Headers.ts +252 -50
  1551. package/src/unstable/http/HttpBody.ts +130 -28
  1552. package/src/unstable/http/HttpClient.ts +206 -97
  1553. package/src/unstable/http/HttpClientError.ts +80 -12
  1554. package/src/unstable/http/HttpClientRequest.ts +320 -102
  1555. package/src/unstable/http/HttpClientResponse.ts +59 -16
  1556. package/src/unstable/http/HttpEffect.ts +66 -18
  1557. package/src/unstable/http/HttpIncomingMessage.ts +47 -7
  1558. package/src/unstable/http/HttpMethod.ts +35 -5
  1559. package/src/unstable/http/HttpMiddleware.ts +63 -16
  1560. package/src/unstable/http/HttpPlatform.ts +35 -4
  1561. package/src/unstable/http/HttpRouter.ts +221 -57
  1562. package/src/unstable/http/HttpServer.ts +152 -23
  1563. package/src/unstable/http/HttpServerError.ts +90 -10
  1564. package/src/unstable/http/HttpServerRequest.ts +136 -32
  1565. package/src/unstable/http/HttpServerRespondable.ts +49 -6
  1566. package/src/unstable/http/HttpServerResponse.ts +395 -72
  1567. package/src/unstable/http/HttpStaticServer.ts +22 -4
  1568. package/src/unstable/http/HttpTraceContext.ts +53 -6
  1569. package/src/unstable/http/Multipart.ts +179 -29
  1570. package/src/unstable/http/Multipasta/HeadersParser.ts +1 -1
  1571. package/src/unstable/http/Multipasta/Node.ts +1 -1
  1572. package/src/unstable/http/Multipasta/Search.ts +1 -1
  1573. package/src/unstable/http/Multipasta/Web.ts +1 -1
  1574. package/src/unstable/http/Multipasta.ts +1 -1
  1575. package/src/unstable/http/Template.ts +53 -0
  1576. package/src/unstable/http/Url.ts +56 -42
  1577. package/src/unstable/http/UrlParams.ts +233 -49
  1578. package/src/unstable/httpapi/HttpApi.ts +49 -14
  1579. package/src/unstable/httpapi/HttpApiBuilder.ts +86 -20
  1580. package/src/unstable/httpapi/HttpApiClient.ts +80 -16
  1581. package/src/unstable/httpapi/HttpApiEndpoint.ts +238 -59
  1582. package/src/unstable/httpapi/HttpApiError.ts +100 -1
  1583. package/src/unstable/httpapi/HttpApiGroup.ts +87 -20
  1584. package/src/unstable/httpapi/HttpApiMiddleware.ts +113 -23
  1585. package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
  1586. package/src/unstable/httpapi/HttpApiSchema.ts +67 -30
  1587. package/src/unstable/httpapi/HttpApiSecurity.ts +74 -17
  1588. package/src/unstable/httpapi/HttpApiSwagger.ts +24 -2
  1589. package/src/unstable/httpapi/HttpApiTest.ts +31 -3
  1590. package/src/unstable/httpapi/OpenApi.ts +115 -15
  1591. package/src/unstable/observability/Otlp.ts +33 -3
  1592. package/src/unstable/observability/OtlpExporter.ts +32 -1
  1593. package/src/unstable/observability/OtlpLogger.ts +31 -2
  1594. package/src/unstable/observability/OtlpMetrics.ts +37 -4
  1595. package/src/unstable/observability/OtlpResource.ts +68 -12
  1596. package/src/unstable/observability/OtlpSerialization.ts +28 -3
  1597. package/src/unstable/observability/OtlpTracer.ts +38 -2
  1598. package/src/unstable/observability/PrometheusMetrics.ts +32 -12
  1599. package/src/unstable/observability/index.ts +2 -1
  1600. package/src/unstable/persistence/KeyValueStore.ts +108 -28
  1601. package/src/unstable/persistence/Persistable.ts +76 -15
  1602. package/src/unstable/persistence/PersistedCache.ts +27 -2
  1603. package/src/unstable/persistence/PersistedQueue.ts +98 -16
  1604. package/src/unstable/persistence/Persistence.ts +97 -16
  1605. package/src/unstable/persistence/RateLimiter.ts +98 -22
  1606. package/src/unstable/persistence/Redis.ts +42 -5
  1607. package/src/unstable/process/ChildProcess.ts +100 -79
  1608. package/src/unstable/process/ChildProcessSpawner.ts +22 -11
  1609. package/src/unstable/process/index.ts +2 -1
  1610. package/src/unstable/reactivity/AsyncResult.ts +202 -61
  1611. package/src/unstable/reactivity/Atom.ts +597 -143
  1612. package/src/unstable/reactivity/AtomHttpApi.ts +41 -2
  1613. package/src/unstable/reactivity/AtomRef.ts +51 -7
  1614. package/src/unstable/reactivity/AtomRegistry.ts +141 -22
  1615. package/src/unstable/reactivity/AtomRpc.ts +36 -2
  1616. package/src/unstable/reactivity/Hydration.ts +45 -5
  1617. package/src/unstable/reactivity/Reactivity.ts +95 -13
  1618. package/src/unstable/rpc/Rpc.ts +255 -56
  1619. package/src/unstable/rpc/RpcClient.ts +108 -20
  1620. package/src/unstable/rpc/RpcClientError.ts +26 -2
  1621. package/src/unstable/rpc/RpcGroup.ts +51 -8
  1622. package/src/unstable/rpc/RpcMessage.ts +128 -32
  1623. package/src/unstable/rpc/RpcMiddleware.ts +100 -20
  1624. package/src/unstable/rpc/RpcSchema.ts +38 -4
  1625. package/src/unstable/rpc/RpcSerialization.ts +60 -13
  1626. package/src/unstable/rpc/RpcServer.ts +108 -25
  1627. package/src/unstable/rpc/RpcTest.ts +20 -1
  1628. package/src/unstable/rpc/RpcWorker.ts +42 -8
  1629. package/src/unstable/rpc/Utils.ts +31 -0
  1630. package/src/unstable/schema/Model.ts +148 -52
  1631. package/src/unstable/schema/VariantSchema.ts +104 -24
  1632. package/src/unstable/socket/Socket.ts +168 -35
  1633. package/src/unstable/socket/SocketServer.ts +58 -10
  1634. package/src/unstable/sql/Migrator.ts +57 -5
  1635. package/src/unstable/sql/SqlClient.ts +55 -2
  1636. package/src/unstable/sql/SqlConnection.ts +31 -0
  1637. package/src/unstable/sql/SqlError.ts +117 -0
  1638. package/src/unstable/sql/SqlModel.ts +26 -5
  1639. package/src/unstable/sql/SqlResolver.ts +56 -13
  1640. package/src/unstable/sql/SqlSchema.ts +29 -8
  1641. package/src/unstable/sql/SqlStream.ts +23 -0
  1642. package/src/unstable/sql/Statement.ts +141 -0
  1643. package/src/unstable/sql/index.ts +1 -1
  1644. package/src/unstable/workers/Transferable.ts +65 -13
  1645. package/src/unstable/workers/Worker.ts +60 -8
  1646. package/src/unstable/workers/WorkerError.ts +50 -9
  1647. package/src/unstable/workers/WorkerRunner.ts +32 -3
  1648. package/src/unstable/workers/index.ts +1 -1
  1649. package/src/unstable/workflow/Activity.ts +62 -11
  1650. package/src/unstable/workflow/DurableClock.ts +26 -3
  1651. package/src/unstable/workflow/DurableDeferred.ts +146 -31
  1652. package/src/unstable/workflow/DurableQueue.ts +366 -0
  1653. package/src/unstable/workflow/Workflow.ts +122 -32
  1654. package/src/unstable/workflow/WorkflowEngine.ts +40 -5
  1655. package/src/unstable/workflow/WorkflowProxy.ts +32 -2
  1656. package/src/unstable/workflow/WorkflowProxyServer.ts +40 -6
  1657. package/src/unstable/workflow/index.ts +5 -0
package/src/Layer.ts CHANGED
@@ -49,8 +49,8 @@ const TypeId = "~effect/Layer"
49
49
  * - E: The possible errors during layer construction
50
50
  * - RIn: The services this layer requires as dependencies
51
51
  *
52
- * @since 2.0.0
53
52
  * @category models
53
+ * @since 2.0.0
54
54
  */
55
55
  export interface Layer<in ROut, out E = never, out RIn = never> extends Variance<ROut, E, RIn>, Pipeable {
56
56
  /** @internal */
@@ -61,8 +61,14 @@ export interface Layer<in ROut, out E = never, out RIn = never> extends Variance
61
61
  }
62
62
 
63
63
  /**
64
- * @since 4.0.0
64
+ * Type-level hook that allows `Layer` values to participate in `Unify`
65
+ * inference.
66
+ *
67
+ * This is used by Effect's pipe and unification machinery to preserve the
68
+ * provided services, error, and requirements of a `Layer`.
69
+ *
65
70
  * @category models
71
+ * @since 4.0.0
66
72
  */
67
73
  export interface LayerUnify<A extends { [Unify.typeSymbol]?: any }> {
68
74
  Layer?: () => A[Unify.typeSymbol] extends Layer<any, any, any> | infer _ ? Layer<
@@ -74,16 +80,19 @@ export interface LayerUnify<A extends { [Unify.typeSymbol]?: any }> {
74
80
  }
75
81
 
76
82
  /**
77
- * @since 4.0.0
83
+ * Type-level marker used by `Unify` for `Layer` types that should be ignored
84
+ * during unification.
85
+ *
78
86
  * @category models
87
+ * @since 4.0.0
79
88
  */
80
89
  export interface LayerUnifyIgnore {}
81
90
 
82
91
  /**
83
92
  * The variance interface for Layer type parameters.
84
93
  *
85
- * @since 2.0.0
86
94
  * @category models
95
+ * @since 2.0.0
87
96
  */
88
97
  export interface Variance<in ROut, out E, out RIn> {
89
98
  readonly [TypeId]: {
@@ -98,8 +107,8 @@ export interface Variance<in ROut, out E, out RIn> {
98
107
  * This interface is used to constrain generic types to Layer types
99
108
  * without specifying exact type parameters.
100
109
  *
101
- * @since 3.9.0
102
110
  * @category type-level
111
+ * @since 3.9.0
103
112
  */
104
113
  export interface Any {
105
114
  readonly [TypeId]: {
@@ -111,8 +120,8 @@ export interface Any {
111
120
  /**
112
121
  * Extracts the service dependencies (RIn) from a Layer type.
113
122
  *
114
- * @since 2.0.0
115
123
  * @category type-level
124
+ * @since 2.0.0
116
125
  */
117
126
  export type Services<T extends Any> = T extends infer L
118
127
  ? L extends Layer<infer _ROut, infer _E, infer _RIn> ? _RIn : never
@@ -120,15 +129,15 @@ export type Services<T extends Any> = T extends infer L
120
129
  /**
121
130
  * Extracts the error type (E) from a Layer type.
122
131
  *
123
- * @since 2.0.0
124
132
  * @category type-level
133
+ * @since 2.0.0
125
134
  */
126
135
  export type Error<T extends Any> = T extends Layer<infer _ROut, infer _E, infer _RIn> ? _E : never
127
136
  /**
128
137
  * Extracts the service output type (ROut) from a Layer type.
129
138
  *
130
- * @since 2.0.0
131
139
  * @category type-level
140
+ * @since 2.0.0
132
141
  */
133
142
  export type Success<T extends Any> = T extends Layer<infer _ROut, infer _E, infer _RIn> ? _ROut : never
134
143
 
@@ -140,7 +149,8 @@ const MemoMapTypeId = "~effect/Layer/MemoMap"
140
149
  * The MemoMap prevents duplicate construction of the same layer instance,
141
150
  * enabling efficient resource sharing across layer dependencies.
142
151
  *
143
- * @example
152
+ * **Example** (Sharing layer construction with a memo map)
153
+ *
144
154
  * ```ts
145
155
  * import { Effect, Layer, Context } from "effect"
146
156
  *
@@ -162,11 +172,15 @@ const MemoMapTypeId = "~effect/Layer/MemoMap"
162
172
  * })
163
173
  * ```
164
174
  *
165
- * @since 2.0.0
166
175
  * @category models
176
+ * @since 2.0.0
167
177
  */
168
178
  export interface MemoMap {
169
179
  readonly [MemoMapTypeId]: typeof MemoMapTypeId
180
+ readonly get: <RIn, E, ROut>(
181
+ layer: Layer<ROut, E, RIn>,
182
+ scope: Scope.Scope
183
+ ) => Effect<Context.Context<ROut>, E, RIn> | undefined
170
184
  readonly getOrElseMemoize: <RIn, E, ROut>(
171
185
  layer: Layer<ROut, E, RIn>,
172
186
  scope: Scope.Scope,
@@ -174,10 +188,28 @@ export interface MemoMap {
174
188
  ) => Effect<Context.Context<ROut>, E, RIn>
175
189
  }
176
190
 
191
+ type MemoMapEntry = {
192
+ observers: number
193
+ effect: Effect<Context.Context<any>, any>
194
+ readonly finalizer: (exit: Exit.Exit<unknown, unknown>) => Effect<void>
195
+ }
196
+
197
+ const memoMapReuse = <RIn, E, ROut>(
198
+ entry: MemoMapEntry,
199
+ scope: Scope.Scope
200
+ ): Effect<Context.Context<ROut>, E, RIn> => {
201
+ entry.observers++
202
+ return internalEffect.andThen(
203
+ internalEffect.scopeAddFinalizerExit(scope, (exit) => entry.finalizer(exit)),
204
+ entry.effect
205
+ )
206
+ }
207
+
177
208
  /**
178
209
  * Returns `true` if the specified value is a `Layer`, `false` otherwise.
179
210
  *
180
- * @example
211
+ * **Example** (Checking whether a value is a layer)
212
+ *
181
213
  * ```ts
182
214
  * import { Effect, Layer, Context } from "effect"
183
215
  *
@@ -194,8 +226,8 @@ export interface MemoMap {
194
226
  * console.log(Layer.isLayer(notALayer)) // false
195
227
  * ```
196
228
  *
197
- * @since 2.0.0
198
229
  * @category getters
230
+ * @since 2.0.0
199
231
  */
200
232
  export const isLayer = (u: unknown): u is Layer<unknown, unknown, unknown> => hasProperty(u, TypeId)
201
233
 
@@ -227,7 +259,8 @@ const fromBuildUnsafe = <ROut, E, RIn>(
227
259
  * The function receives a `MemoMap` for memoization and a `Scope` for resource management.
228
260
  * A child scope is created, and if the build fails, the child scope is closed.
229
261
  *
230
- * @example
262
+ * **Example** (Constructing a layer from a build function)
263
+ *
231
264
  * ```ts
232
265
  * import { Effect, Layer, Context } from "effect"
233
266
  *
@@ -244,8 +277,8 @@ const fromBuildUnsafe = <ROut, E, RIn>(
244
277
  * )
245
278
  * ```
246
279
  *
247
- * @since 4.0.0
248
280
  * @category constructors
281
+ * @since 4.0.0
249
282
  */
250
283
  export const fromBuild = <ROut, E, RIn>(
251
284
  build: (
@@ -268,7 +301,8 @@ export const fromBuild = <ROut, E, RIn>(
268
301
  * This is similar to `fromBuild` but provides automatic memoization of the layer construction.
269
302
  * The layer will be memoized based on the provided `MemoMap`.
270
303
  *
271
- * @example
304
+ * **Example** (Memoizing layer construction)
305
+ *
272
306
  * ```ts
273
307
  * import { Effect, Layer, Context } from "effect"
274
308
  *
@@ -285,8 +319,8 @@ export const fromBuild = <ROut, E, RIn>(
285
319
  * )
286
320
  * ```
287
321
  *
288
- * @since 4.0.0
289
322
  * @category constructors
323
+ * @since 4.0.0
290
324
  */
291
325
  export const fromBuildMemo = <ROut, E, RIn>(
292
326
  build: (
@@ -298,60 +332,79 @@ export const fromBuildMemo = <ROut, E, RIn>(
298
332
  return self
299
333
  }
300
334
 
335
+ const memoMapBuild = <RIn, E, ROut>(
336
+ memoMap: MemoMapImpl,
337
+ layer: Layer<ROut, E, RIn>,
338
+ scope: Scope.Scope,
339
+ build: (memoMap: MemoMap, scope: Scope.Scope) => Effect<Context.Context<ROut>, E, RIn>
340
+ ): Effect<Context.Context<ROut>, E, RIn> => {
341
+ const layerScope = Scope.makeUnsafe()
342
+ const deferred = Deferred.makeUnsafe<Context.Context<ROut>, E>()
343
+ const entry: MemoMapEntry = {
344
+ observers: 1,
345
+ effect: Deferred.await(deferred),
346
+ finalizer: (exit: Exit.Exit<unknown, unknown>) =>
347
+ internalEffect.suspend(() => {
348
+ entry.observers--
349
+ if (entry.observers === 0) {
350
+ memoMap.map.delete(layer)
351
+ return Scope.close(layerScope, exit)
352
+ }
353
+ return internalEffect.void
354
+ })
355
+ }
356
+ memoMap.map.set(layer, entry)
357
+ return internalEffect.scopeAddFinalizerExit(scope, entry.finalizer).pipe(
358
+ internalEffect.flatMap(() => build(memoMap, layerScope)),
359
+ internalEffect.onExit((exit) => {
360
+ entry.effect = exit
361
+ return Deferred.done(deferred, exit)
362
+ })
363
+ )
364
+ }
365
+
301
366
  class MemoMapImpl implements MemoMap {
302
367
  get [MemoMapTypeId](): typeof MemoMapTypeId {
303
368
  return MemoMapTypeId
304
369
  }
305
370
 
306
- readonly map = new Map<Layer<any, any, any>, {
307
- observers: number
308
- effect: Effect<Context.Context<any>, any>
309
- readonly finalizer: (exit: Exit.Exit<unknown, unknown>) => Effect<void>
310
- }>()
371
+ readonly parent: MemoMap | undefined
372
+
373
+ constructor(parent?: MemoMap) {
374
+ this.parent = parent
375
+ }
376
+
377
+ readonly map = new Map<Layer<any, any, any>, MemoMapEntry>()
378
+
379
+ get<RIn, E, ROut>(
380
+ layer: Layer<ROut, E, RIn>,
381
+ scope: Scope.Scope
382
+ ): Effect<Context.Context<ROut>, E, RIn> | undefined {
383
+ const local = this.map.get(layer)
384
+ if (local) {
385
+ return memoMapReuse(local, scope)
386
+ }
387
+ return this.parent?.get(layer, scope)
388
+ }
311
389
 
312
390
  getOrElseMemoize<RIn, E, ROut>(
313
391
  layer: Layer<ROut, E, RIn>,
314
392
  scope: Scope.Scope,
315
393
  build: (memoMap: MemoMap, scope: Scope.Scope) => Effect<Context.Context<ROut>, E, RIn>
316
394
  ): Effect<Context.Context<ROut>, E, RIn> {
317
- if (this.map.has(layer)) {
318
- const entry = this.map.get(layer)!
319
- entry.observers++
320
- return internalEffect.andThen(
321
- internalEffect.scopeAddFinalizerExit(scope, (exit) => entry.finalizer(exit)),
322
- entry.effect
323
- )
324
- }
325
- const layerScope = Scope.makeUnsafe()
326
- const deferred = Deferred.makeUnsafe<Context.Context<ROut>, E>()
327
- const entry = {
328
- observers: 1,
329
- effect: Deferred.await(deferred),
330
- finalizer: (exit: Exit.Exit<unknown, unknown>) =>
331
- internalEffect.suspend(() => {
332
- entry.observers--
333
- if (entry.observers === 0) {
334
- this.map.delete(layer)
335
- return Scope.close(layerScope, exit)
336
- }
337
- return internalEffect.void
338
- })
395
+ const existing = this.get(layer, scope)
396
+ if (existing) {
397
+ return existing
339
398
  }
340
- this.map.set(layer, entry)
341
- return internalEffect.scopeAddFinalizerExit(scope, entry.finalizer).pipe(
342
- internalEffect.flatMap(() => build(this, layerScope)),
343
- internalEffect.onExit((exit) => {
344
- entry.effect = exit
345
- return Deferred.done(deferred, exit)
346
- })
347
- )
399
+ return memoMapBuild(this, layer, scope, build)
348
400
  }
349
401
  }
350
402
 
351
403
  /**
352
404
  * Constructs a `MemoMap` that can be used to build additional layers.
353
405
  *
354
- * @example
406
+ * **Example** (Creating a memo map unsafely)
407
+ *
355
408
  * ```ts
356
409
  * import { Effect, Layer, Context } from "effect"
357
410
  *
@@ -373,15 +426,25 @@ class MemoMapImpl implements MemoMap {
373
426
  * })
374
427
  * ```
375
428
  *
376
- * @since 4.0.0
377
429
  * @category memo map
430
+ * @since 4.0.0
378
431
  */
379
432
  export const makeMemoMapUnsafe = (): MemoMap => new MemoMapImpl()
380
433
 
434
+ /**
435
+ * Constructs a child `MemoMap` that can reuse layers already memoized in the
436
+ * parent while isolating any new layer allocations to the child map.
437
+ *
438
+ * @since 4.0.0
439
+ * @category memo map
440
+ */
441
+ export const forkMemoMapUnsafe = (parent: MemoMap): MemoMap => new MemoMapImpl(parent)
442
+
381
443
  /**
382
444
  * Constructs a `MemoMap` that can be used to build additional layers.
383
445
  *
384
- * @example
446
+ * **Example** (Creating a memo map in an effect)
447
+ *
385
448
  * ```ts
386
449
  * import { Effect, Layer, Context } from "effect"
387
450
  *
@@ -403,19 +466,28 @@ export const makeMemoMapUnsafe = (): MemoMap => new MemoMapImpl()
403
466
  * })
404
467
  * ```
405
468
  *
406
- * @since 2.0.0
407
469
  * @category memo map
470
+ * @since 2.0.0
408
471
  */
409
472
  export const makeMemoMap: Effect<MemoMap> = internalEffect.sync(makeMemoMapUnsafe)
410
473
 
474
+ /**
475
+ * Constructs a child `MemoMap` that can reuse layers already memoized in the
476
+ * parent while isolating any new layer allocations to the child map.
477
+ *
478
+ * @since 4.0.0
479
+ * @category memo map
480
+ */
481
+ export const forkMemoMap = (parent: MemoMap): Effect<MemoMap> => internalEffect.sync(() => forkMemoMapUnsafe(parent))
482
+
411
483
  /**
412
484
  * A service reference for the current `MemoMap` used in layer construction.
413
485
  *
414
486
  * This service provides access to the current memoization map during layer building,
415
487
  * allowing layers to share memoized results.
416
488
  *
417
- * @since 3.13.0
418
489
  * @category models
490
+ * @since 3.13.0
419
491
  */
420
492
  export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("effect/Layer/CurrentMemoMap") {
421
493
  static getOrCreate: <Services>(self: Context.Context<Services>) => MemoMap = Context.getOrElse(
@@ -428,7 +500,8 @@ export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("
428
500
  * Builds a layer into an `Effect` value, using the specified `MemoMap` to memoize
429
501
  * the layer construction.
430
502
  *
431
- * @example
503
+ * **Example** (Building layers with an explicit memo map)
504
+ *
432
505
  * ```ts
433
506
  * import { Effect, Layer, Context } from "effect"
434
507
  *
@@ -468,15 +541,16 @@ export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("
468
541
  * })
469
542
  * ```
470
543
  *
471
- * @since 2.0.0
472
544
  * @category memo map
545
+ * @since 2.0.0
473
546
  */
474
547
  export const buildWithMemoMap: {
475
548
  /**
476
549
  * Builds a layer into an `Effect` value, using the specified `MemoMap` to memoize
477
550
  * the layer construction.
478
551
  *
479
- * @example
552
+ * **Example** (Building layers with an explicit memo map)
553
+ *
480
554
  * ```ts
481
555
  * import { Effect, Layer, Context } from "effect"
482
556
  *
@@ -516,15 +590,16 @@ export const buildWithMemoMap: {
516
590
  * })
517
591
  * ```
518
592
  *
519
- * @since 2.0.0
520
593
  * @category memo map
594
+ * @since 2.0.0
521
595
  */
522
596
  (memoMap: MemoMap, scope: Scope.Scope): <RIn, E, ROut>(self: Layer<ROut, E, RIn>) => Effect<Context.Context<ROut>, E, RIn>
523
597
  /**
524
598
  * Builds a layer into an `Effect` value, using the specified `MemoMap` to memoize
525
599
  * the layer construction.
526
600
  *
527
- * @example
601
+ * **Example** (Building layers with an explicit memo map)
602
+ *
528
603
  * ```ts
529
604
  * import { Effect, Layer, Context } from "effect"
530
605
  *
@@ -564,8 +639,8 @@ export const buildWithMemoMap: {
564
639
  * })
565
640
  * ```
566
641
  *
567
- * @since 2.0.0
568
642
  * @category memo map
643
+ * @since 2.0.0
569
644
  */
570
645
  <RIn, E, ROut>(self: Layer<ROut, E, RIn>, memoMap: MemoMap, scope: Scope.Scope): Effect<Context.Context<ROut>, E, RIn>
571
646
  } = dual(3, <RIn, E, ROut>(
@@ -582,7 +657,8 @@ export const buildWithMemoMap: {
582
657
  /**
583
658
  * Builds a layer into a scoped value.
584
659
  *
585
- * @example
660
+ * **Example** (Building a layer into a context)
661
+ *
586
662
  * ```ts
587
663
  * import { Effect, Layer, Context } from "effect"
588
664
  *
@@ -606,8 +682,8 @@ export const buildWithMemoMap: {
606
682
  * })
607
683
  * ```
608
684
  *
609
- * @since 2.0.0
610
685
  * @category destructors
686
+ * @since 2.0.0
611
687
  */
612
688
  export const build = <RIn, E, ROut>(
613
689
  self: Layer<ROut, E, RIn>
@@ -627,7 +703,8 @@ export const build = <RIn, E, ROut>(
627
703
  * the services output by the layer exceed the lifetime of the effect the
628
704
  * layer is provided to.
629
705
  *
630
- * @example
706
+ * **Example** (Building a layer with an explicit scope)
707
+ *
631
708
  * ```ts
632
709
  * import { Effect, Layer, Scope, Context } from "effect"
633
710
  *
@@ -657,8 +734,8 @@ export const build = <RIn, E, ROut>(
657
734
  * })
658
735
  * ```
659
736
  *
660
- * @since 2.0.0
661
737
  * @category destructors
738
+ * @since 2.0.0
662
739
  */
663
740
  export const buildWithScope: {
664
741
  /**
@@ -668,7 +745,8 @@ export const buildWithScope: {
668
745
  * the services output by the layer exceed the lifetime of the effect the
669
746
  * layer is provided to.
670
747
  *
671
- * @example
748
+ * **Example** (Building a layer with an explicit scope)
749
+ *
672
750
  * ```ts
673
751
  * import { Effect, Layer, Scope, Context } from "effect"
674
752
  *
@@ -698,8 +776,8 @@ export const buildWithScope: {
698
776
  * })
699
777
  * ```
700
778
  *
701
- * @since 2.0.0
702
779
  * @category destructors
780
+ * @since 2.0.0
703
781
  */
704
782
  (scope: Scope.Scope): <RIn, E, ROut>(self: Layer<ROut, E, RIn>) => Effect<Context.Context<ROut>, E, RIn>
705
783
  /**
@@ -709,7 +787,8 @@ export const buildWithScope: {
709
787
  * the services output by the layer exceed the lifetime of the effect the
710
788
  * layer is provided to.
711
789
  *
712
- * @example
790
+ * **Example** (Building a layer with an explicit scope)
791
+ *
713
792
  * ```ts
714
793
  * import { Effect, Layer, Scope, Context } from "effect"
715
794
  *
@@ -739,8 +818,8 @@ export const buildWithScope: {
739
818
  * })
740
819
  * ```
741
820
  *
742
- * @since 2.0.0
743
821
  * @category destructors
822
+ * @since 2.0.0
744
823
  */
745
824
  <RIn, E, ROut>(self: Layer<ROut, E, RIn>, scope: Scope.Scope): Effect<Context.Context<ROut>, E, RIn>
746
825
  } = dual(2, <RIn, E, ROut>(
@@ -758,7 +837,8 @@ export const buildWithScope: {
758
837
  /**
759
838
  * Constructs a layer from the specified value.
760
839
  *
761
- * @example
840
+ * **Example** (Providing services from values)
841
+ *
762
842
  * ```ts
763
843
  * import { Effect, Layer, Context } from "effect"
764
844
  *
@@ -794,14 +874,15 @@ export const buildWithScope: {
794
874
  * )
795
875
  * ```
796
876
  *
797
- * @since 2.0.0
798
877
  * @category constructors
878
+ * @since 2.0.0
799
879
  */
800
880
  export const succeed: {
801
881
  /**
802
882
  * Constructs a layer from the specified value.
803
883
  *
804
- * @example
884
+ * **Example** (Providing services from values)
885
+ *
805
886
  * ```ts
806
887
  * import { Effect, Layer, Context } from "effect"
807
888
  *
@@ -837,14 +918,15 @@ export const succeed: {
837
918
  * )
838
919
  * ```
839
920
  *
840
- * @since 2.0.0
841
921
  * @category constructors
922
+ * @since 2.0.0
842
923
  */
843
924
  <I, S>(service: Context.Key<I, S>): (resource: S) => Layer<I>
844
925
  /**
845
926
  * Constructs a layer from the specified value.
846
927
  *
847
- * @example
928
+ * **Example** (Providing services from values)
929
+ *
848
930
  * ```ts
849
931
  * import { Effect, Layer, Context } from "effect"
850
932
  *
@@ -880,8 +962,8 @@ export const succeed: {
880
962
  * )
881
963
  * ```
882
964
  *
883
- * @since 2.0.0
884
965
  * @category constructors
966
+ * @since 2.0.0
885
967
  */
886
968
  <I, S>(service: Context.Key<I, S>, resource: Types.NoInfer<S>): Layer<I>
887
969
  } = function() {
@@ -898,7 +980,8 @@ export const succeed: {
898
980
  * This is a more general version of `succeed` that allows you to provide multiple
899
981
  * services at once through a `Context`.
900
982
  *
901
- * @example
983
+ * **Example** (Providing multiple services from a context)
984
+ *
902
985
  * ```ts
903
986
  * import { Effect, Layer, Context } from "effect"
904
987
  *
@@ -921,8 +1004,8 @@ export const succeed: {
921
1004
  * const layer = Layer.succeedContext(context)
922
1005
  * ```
923
1006
  *
924
- * @since 2.0.0
925
1007
  * @category constructors
1008
+ * @since 2.0.0
926
1009
  */
927
1010
  export const succeedContext = <A>(context: Context.Context<A>): Layer<A> =>
928
1011
  fromBuildUnsafe(constant(internalEffect.succeed(context)))
@@ -933,15 +1016,16 @@ export const succeedContext = <A>(context: Context.Context<A>): Layer<A> =>
933
1016
  * This layer provides no services and can be used as a neutral element
934
1017
  * in layer composition or as a starting point for building layers.
935
1018
  *
936
- * @example
1019
+ * **Example** (Creating an empty layer)
1020
+ *
937
1021
  * ```ts
938
1022
  * import { Layer } from "effect"
939
1023
  *
940
1024
  * const emptyLayer = Layer.empty
941
1025
  * ```
942
1026
  *
943
- * @since 2.0.0
944
1027
  * @category constructors
1028
+ * @since 2.0.0
945
1029
  */
946
1030
  export const empty: Layer<never> = succeedContext(Context.empty())
947
1031
 
@@ -951,7 +1035,8 @@ export const empty: Layer<never> = succeedContext(Context.empty())
951
1035
  * This is a lazy version of `succeed` where the service value is computed
952
1036
  * synchronously only when the layer is built.
953
1037
  *
954
- * @example
1038
+ * **Example** (Lazily providing a service)
1039
+ *
955
1040
  * ```ts
956
1041
  * import { Effect, Layer, Context } from "effect"
957
1042
  *
@@ -964,8 +1049,8 @@ export const empty: Layer<never> = succeedContext(Context.empty())
964
1049
  * }))
965
1050
  * ```
966
1051
  *
967
- * @since 2.0.0
968
1052
  * @category constructors
1053
+ * @since 2.0.0
969
1054
  */
970
1055
  export const sync: {
971
1056
  /**
@@ -974,7 +1059,8 @@ export const sync: {
974
1059
  * This is a lazy version of `succeed` where the service value is computed
975
1060
  * synchronously only when the layer is built.
976
1061
  *
977
- * @example
1062
+ * **Example** (Lazily providing a service)
1063
+ *
978
1064
  * ```ts
979
1065
  * import { Effect, Layer, Context } from "effect"
980
1066
  *
@@ -987,8 +1073,8 @@ export const sync: {
987
1073
  * }))
988
1074
  * ```
989
1075
  *
990
- * @since 2.0.0
991
1076
  * @category constructors
1077
+ * @since 2.0.0
992
1078
  */
993
1079
  <I, S>(service: Context.Key<I, S>): (evaluate: LazyArg<S>) => Layer<I>
994
1080
  /**
@@ -997,7 +1083,8 @@ export const sync: {
997
1083
  * This is a lazy version of `succeed` where the service value is computed
998
1084
  * synchronously only when the layer is built.
999
1085
  *
1000
- * @example
1086
+ * **Example** (Lazily providing a service)
1087
+ *
1001
1088
  * ```ts
1002
1089
  * import { Effect, Layer, Context } from "effect"
1003
1090
  *
@@ -1010,8 +1097,8 @@ export const sync: {
1010
1097
  * }))
1011
1098
  * ```
1012
1099
  *
1013
- * @since 2.0.0
1014
1100
  * @category constructors
1101
+ * @since 2.0.0
1015
1102
  */
1016
1103
  <I, S>(service: Context.Key<I, S>, evaluate: LazyArg<Types.NoInfer<S>>): Layer<I>
1017
1104
  } = function() {
@@ -1028,7 +1115,8 @@ export const sync: {
1028
1115
  * This is a lazy version of `succeedContext` where the Context is computed
1029
1116
  * synchronously only when the layer is built.
1030
1117
  *
1031
- * @example
1118
+ * **Example** (Lazily providing a context)
1119
+ *
1032
1120
  * ```ts
1033
1121
  * import { Effect, Layer, Context } from "effect"
1034
1122
  *
@@ -1043,8 +1131,8 @@ export const sync: {
1043
1131
  * )
1044
1132
  * ```
1045
1133
  *
1046
- * @since 2.0.0
1047
1134
  * @category constructors
1135
+ * @since 2.0.0
1048
1136
  */
1049
1137
  export const syncContext = <A>(evaluate: LazyArg<Context.Context<A>>): Layer<A> =>
1050
1138
  fromBuildMemo(constant(internalEffect.sync(evaluate)))
@@ -1062,7 +1150,8 @@ export const syncContext = <A>(evaluate: LazyArg<Context.Context<A>>): Layer<A>
1062
1150
  *
1063
1151
  * - `Layer.scoped`
1064
1152
  *
1065
- * @example
1153
+ * **Example** (Creating a layer from an effect)
1154
+ *
1066
1155
  * ```ts
1067
1156
  * import { Effect, Layer, Context } from "effect"
1068
1157
  *
@@ -1077,8 +1166,8 @@ export const syncContext = <A>(evaluate: LazyArg<Context.Context<A>>): Layer<A>
1077
1166
  * )
1078
1167
  * ```
1079
1168
  *
1080
- * @since 2.0.0
1081
1169
  * @category constructors
1170
+ * @since 2.0.0
1082
1171
  */
1083
1172
  export const effect: {
1084
1173
  /**
@@ -1094,7 +1183,8 @@ export const effect: {
1094
1183
  *
1095
1184
  * - `Layer.scoped`
1096
1185
  *
1097
- * @example
1186
+ * **Example** (Creating a layer from an effect)
1187
+ *
1098
1188
  * ```ts
1099
1189
  * import { Effect, Layer, Context } from "effect"
1100
1190
  *
@@ -1109,8 +1199,8 @@ export const effect: {
1109
1199
  * )
1110
1200
  * ```
1111
1201
  *
1112
- * @since 2.0.0
1113
1202
  * @category constructors
1203
+ * @since 2.0.0
1114
1204
  */
1115
1205
  <I, S>(service: Context.Key<I, S>): <E, R>(
1116
1206
  effect: Effect<S, E, R>
@@ -1128,7 +1218,8 @@ export const effect: {
1128
1218
  *
1129
1219
  * - `Layer.scoped`
1130
1220
  *
1131
- * @example
1221
+ * **Example** (Creating a layer from an effect)
1222
+ *
1132
1223
  * ```ts
1133
1224
  * import { Effect, Layer, Context } from "effect"
1134
1225
  *
@@ -1143,8 +1234,8 @@ export const effect: {
1143
1234
  * )
1144
1235
  * ```
1145
1236
  *
1146
- * @since 2.0.0
1147
1237
  * @category constructors
1238
+ * @since 2.0.0
1148
1239
  */
1149
1240
  <I, S, E, R>(service: Context.Key<I, S>, effect: Effect<Types.NoInfer<S>, E, R>): Layer<I, E, Exclude<R, Scope.Scope>>
1150
1241
  } = function() {
@@ -1167,7 +1258,8 @@ const effectImpl = <I, S, E, R>(
1167
1258
  * This allows you to create a Layer from an effectful computation that returns
1168
1259
  * multiple services. The Effect is executed in the scope of the layer.
1169
1260
  *
1170
- * @example
1261
+ * **Example** (Creating a layer from an effectful context)
1262
+ *
1171
1263
  * ```ts
1172
1264
  * import { Effect, Layer, Context } from "effect"
1173
1265
  *
@@ -1183,8 +1275,8 @@ const effectImpl = <I, S, E, R>(
1183
1275
  * )
1184
1276
  * ```
1185
1277
  *
1186
- * @since 2.0.0
1187
1278
  * @category constructors
1279
+ * @since 2.0.0
1188
1280
  */
1189
1281
  export const effectContext = <A, E, R>(
1190
1282
  effect: Effect<Context.Context<A>, E, R>
@@ -1202,7 +1294,8 @@ export const effectContext = <A, E, R>(
1202
1294
  *
1203
1295
  * - `Layer.scopedDiscard`
1204
1296
  *
1205
- * @example
1297
+ * **Example** (Running an effect during layer construction)
1298
+ *
1206
1299
  * ```ts
1207
1300
  * import { Effect, Layer } from "effect"
1208
1301
  *
@@ -1213,8 +1306,8 @@ export const effectContext = <A, E, R>(
1213
1306
  * )
1214
1307
  * ```
1215
1308
  *
1216
- * @since 2.0.0
1217
1309
  * @category constructors
1310
+ * @since 2.0.0
1218
1311
  */
1219
1312
  export const effectDiscard = <X, E, R>(effect: Effect<X, E, R>): Layer<never, E, Exclude<R, Scope.Scope>> =>
1220
1313
  effectContext(internalEffect.as(effect, Context.empty()))
@@ -1225,7 +1318,8 @@ export const effectDiscard = <X, E, R>(effect: Effect<X, E, R>): Layer<never, E,
1225
1318
  * The factory is evaluated only when the suspended layer is first built, and
1226
1319
  * the result is memoized with normal layer sharing semantics.
1227
1320
  *
1228
- * @example
1321
+ * **Example** (Choosing a layer lazily)
1322
+ *
1229
1323
  * ```ts
1230
1324
  * import { Layer, Context } from "effect"
1231
1325
  *
@@ -1240,8 +1334,8 @@ export const effectDiscard = <X, E, R>(effect: Effect<X, E, R>): Layer<never, E,
1240
1334
  * )
1241
1335
  * ```
1242
1336
  *
1243
- * @since 4.0.0
1244
1337
  * @category constructors
1338
+ * @since 4.0.0
1245
1339
  */
1246
1340
  export const suspend = <A, E, R>(evaluate: LazyArg<Layer<A, E, R>>): Layer<A, E, R> =>
1247
1341
  fromBuildMemo((memoMap, scope) => internalEffect.suspend(() => evaluate().build(memoMap, scope)))
@@ -1253,7 +1347,8 @@ export const suspend = <A, E, R>(evaluate: LazyArg<Layer<A, E, R>>): Layer<A, E,
1253
1347
  * use that Layer directly. The resulting Layer will have the combined error and
1254
1348
  * dependency types from both the outer Effect and the inner Layer.
1255
1349
  *
1256
- * @example
1350
+ * **Example** (Unwrapping an effectful layer)
1351
+ *
1257
1352
  * ```ts
1258
1353
  * import { Effect, Layer, Context } from "effect"
1259
1354
  *
@@ -1268,8 +1363,8 @@ export const suspend = <A, E, R>(evaluate: LazyArg<Layer<A, E, R>>): Layer<A, E,
1268
1363
  * const unwrappedLayer = Layer.unwrap(layerEffect)
1269
1364
  * ```
1270
1365
  *
1271
- * @since 4.0.0
1272
1366
  * @category utils
1367
+ * @since 4.0.0
1273
1368
  */
1274
1369
  export const unwrap = <A, E1, R1, E, R>(
1275
1370
  self: Effect<Layer<A, E1, R1>, E, R>
@@ -1301,7 +1396,8 @@ const mergeAllEffect = <Layers extends [Layer<never, any, any>, ...Array<Layer<n
1301
1396
  * All layers are built concurrently, and their outputs are merged into a single layer.
1302
1397
  * This is useful when you need to combine multiple independent layers.
1303
1398
  *
1304
- * @example
1399
+ * **Example** (Merging independent layers)
1400
+ *
1305
1401
  * ```ts
1306
1402
  * import { Effect, Layer, Context } from "effect"
1307
1403
  *
@@ -1323,8 +1419,8 @@ const mergeAllEffect = <Layers extends [Layer<never, any, any>, ...Array<Layer<n
1323
1419
  * const mergedLayer = Layer.mergeAll(dbLayer, loggerLayer)
1324
1420
  * ```
1325
1421
  *
1326
- * @since 2.0.0
1327
1422
  * @category zipping
1423
+ * @since 2.0.0
1328
1424
  */
1329
1425
  export const mergeAll = <Layers extends [Layer<never, any, any>, ...Array<Layer<never, any, any>>]>(
1330
1426
  ...layers: Layers
@@ -1340,7 +1436,8 @@ export const mergeAll = <Layers extends [Layer<never, any, any>, ...Array<Layer<
1340
1436
  * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1341
1437
  * The layers are built concurrently and their outputs are combined.
1342
1438
  *
1343
- * @example
1439
+ * **Example** (Merging two layers)
1440
+ *
1344
1441
  * ```ts
1345
1442
  * import { Effect, Layer, Context } from "effect"
1346
1443
  *
@@ -1362,8 +1459,8 @@ export const mergeAll = <Layers extends [Layer<never, any, any>, ...Array<Layer<
1362
1459
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1363
1460
  * ```
1364
1461
  *
1365
- * @since 2.0.0
1366
1462
  * @category zipping
1463
+ * @since 2.0.0
1367
1464
  */
1368
1465
  export const merge: {
1369
1466
  /**
@@ -1372,7 +1469,8 @@ export const merge: {
1372
1469
  * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1373
1470
  * The layers are built concurrently and their outputs are combined.
1374
1471
  *
1375
- * @example
1472
+ * **Example** (Merging two layers)
1473
+ *
1376
1474
  * ```ts
1377
1475
  * import { Effect, Layer, Context } from "effect"
1378
1476
  *
@@ -1394,8 +1492,8 @@ export const merge: {
1394
1492
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1395
1493
  * ```
1396
1494
  *
1397
- * @since 2.0.0
1398
1495
  * @category zipping
1496
+ * @since 2.0.0
1399
1497
  */
1400
1498
  <RIn, E, ROut>(that: Layer<ROut, E, RIn>): <RIn2, E2, ROut2>(self: Layer<ROut2, E2, RIn2>) => Layer<ROut | ROut2, E | E2, RIn | RIn2>
1401
1499
  /**
@@ -1404,7 +1502,8 @@ export const merge: {
1404
1502
  * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1405
1503
  * The layers are built concurrently and their outputs are combined.
1406
1504
  *
1407
- * @example
1505
+ * **Example** (Merging two layers)
1506
+ *
1408
1507
  * ```ts
1409
1508
  * import { Effect, Layer, Context } from "effect"
1410
1509
  *
@@ -1426,8 +1525,8 @@ export const merge: {
1426
1525
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1427
1526
  * ```
1428
1527
  *
1429
- * @since 2.0.0
1430
1528
  * @category zipping
1529
+ * @since 2.0.0
1431
1530
  */
1432
1531
  <const Layers extends [Any, ...Array<Any>]>(that: Layers): <A, E, R>(
1433
1532
  self: Layer<A, E, R>
@@ -1443,7 +1542,8 @@ export const merge: {
1443
1542
  * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1444
1543
  * The layers are built concurrently and their outputs are combined.
1445
1544
  *
1446
- * @example
1545
+ * **Example** (Merging two layers)
1546
+ *
1447
1547
  * ```ts
1448
1548
  * import { Effect, Layer, Context } from "effect"
1449
1549
  *
@@ -1465,8 +1565,8 @@ export const merge: {
1465
1565
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1466
1566
  * ```
1467
1567
  *
1468
- * @since 2.0.0
1469
1568
  * @category zipping
1569
+ * @since 2.0.0
1470
1570
  */
1471
1571
  <RIn2, E2, ROut2, RIn, E, ROut>(self: Layer<ROut2, E2, RIn2>, that: Layer<ROut, E, RIn>): Layer<ROut | ROut2, E | E2, RIn | RIn2>
1472
1572
  /**
@@ -1475,7 +1575,8 @@ export const merge: {
1475
1575
  * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1476
1576
  * The layers are built concurrently and their outputs are combined.
1477
1577
  *
1478
- * @example
1578
+ * **Example** (Merging two layers)
1579
+ *
1479
1580
  * ```ts
1480
1581
  * import { Effect, Layer, Context } from "effect"
1481
1582
  *
@@ -1497,8 +1598,8 @@ export const merge: {
1497
1598
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1498
1599
  * ```
1499
1600
  *
1500
- * @since 2.0.0
1501
1601
  * @category zipping
1602
+ * @since 2.0.0
1502
1603
  */
1503
1604
  <A, E, R, const Layers extends [Any, ...Array<Any>]>(self: Layer<A, E, R>, that: Layers): Layer<
1504
1605
  A | Success<Layers[number]>,
@@ -1537,7 +1638,8 @@ const provideWith = (
1537
1638
  * builder, resulting in a new builder with the inputs of this builder as
1538
1639
  * well as any leftover inputs, and the outputs of the specified builder.
1539
1640
  *
1540
- * @example
1641
+ * **Example** (Providing layer dependencies)
1642
+ *
1541
1643
  * ```ts
1542
1644
  * import { Effect, Layer, Context } from "effect"
1543
1645
  *
@@ -1595,8 +1697,8 @@ const provideWith = (
1595
1697
  * )
1596
1698
  * ```
1597
1699
  *
1598
- * @since 2.0.0
1599
1700
  * @category utils
1701
+ * @since 2.0.0
1600
1702
  */
1601
1703
  export const provide: {
1602
1704
  /**
@@ -1604,7 +1706,8 @@ export const provide: {
1604
1706
  * builder, resulting in a new builder with the inputs of this builder as
1605
1707
  * well as any leftover inputs, and the outputs of the specified builder.
1606
1708
  *
1607
- * @example
1709
+ * **Example** (Providing layer dependencies)
1710
+ *
1608
1711
  * ```ts
1609
1712
  * import { Effect, Layer, Context } from "effect"
1610
1713
  *
@@ -1662,8 +1765,8 @@ export const provide: {
1662
1765
  * )
1663
1766
  * ```
1664
1767
  *
1665
- * @since 2.0.0
1666
1768
  * @category utils
1769
+ * @since 2.0.0
1667
1770
  */
1668
1771
  <RIn, E, ROut>(that: Layer<ROut, E, RIn>): <RIn2, E2, ROut2>(self: Layer<ROut2, E2, RIn2>) => Layer<ROut2, E | E2, RIn | Exclude<RIn2, ROut>>
1669
1772
  /**
@@ -1671,7 +1774,8 @@ export const provide: {
1671
1774
  * builder, resulting in a new builder with the inputs of this builder as
1672
1775
  * well as any leftover inputs, and the outputs of the specified builder.
1673
1776
  *
1674
- * @example
1777
+ * **Example** (Providing layer dependencies)
1778
+ *
1675
1779
  * ```ts
1676
1780
  * import { Effect, Layer, Context } from "effect"
1677
1781
  *
@@ -1729,8 +1833,8 @@ export const provide: {
1729
1833
  * )
1730
1834
  * ```
1731
1835
  *
1732
- * @since 2.0.0
1733
1836
  * @category utils
1837
+ * @since 2.0.0
1734
1838
  */
1735
1839
  <const Layers extends [Any, ...Array<Any>]>(that: Layers): <A, E, R>(
1736
1840
  self: Layer<A, E, R>
@@ -1745,7 +1849,8 @@ export const provide: {
1745
1849
  * builder, resulting in a new builder with the inputs of this builder as
1746
1850
  * well as any leftover inputs, and the outputs of the specified builder.
1747
1851
  *
1748
- * @example
1852
+ * **Example** (Providing layer dependencies)
1853
+ *
1749
1854
  * ```ts
1750
1855
  * import { Effect, Layer, Context } from "effect"
1751
1856
  *
@@ -1803,8 +1908,8 @@ export const provide: {
1803
1908
  * )
1804
1909
  * ```
1805
1910
  *
1806
- * @since 2.0.0
1807
1911
  * @category utils
1912
+ * @since 2.0.0
1808
1913
  */
1809
1914
  <RIn2, E2, ROut2, RIn, E, ROut>(self: Layer<ROut2, E2, RIn2>, that: Layer<ROut, E, RIn>): Layer<ROut2, E | E2, RIn | Exclude<RIn2, ROut>>
1810
1915
  /**
@@ -1812,7 +1917,8 @@ export const provide: {
1812
1917
  * builder, resulting in a new builder with the inputs of this builder as
1813
1918
  * well as any leftover inputs, and the outputs of the specified builder.
1814
1919
  *
1815
- * @example
1920
+ * **Example** (Providing layer dependencies)
1921
+ *
1816
1922
  * ```ts
1817
1923
  * import { Effect, Layer, Context } from "effect"
1818
1924
  *
@@ -1870,8 +1976,8 @@ export const provide: {
1870
1976
  * )
1871
1977
  * ```
1872
1978
  *
1873
- * @since 2.0.0
1874
1979
  * @category utils
1980
+ * @since 2.0.0
1875
1981
  */
1876
1982
  <A, E, R, const Layers extends [Any, ...Array<Any>]>(self: Layer<A, E, R>, that: Layers): Layer<
1877
1983
  A,
@@ -1889,7 +1995,8 @@ export const provide: {
1889
1995
  * layer, resulting in a new layer with the inputs of this layer, and the
1890
1996
  * outputs of both layers.
1891
1997
  *
1892
- * @example
1998
+ * **Example** (Providing dependencies while retaining services)
1999
+ *
1893
2000
  * ```ts
1894
2001
  * import { Effect, Layer, Context } from "effect"
1895
2002
  *
@@ -1953,8 +2060,8 @@ export const provide: {
1953
2060
  * )
1954
2061
  * ```
1955
2062
  *
1956
- * @since 2.0.0
1957
2063
  * @category utils
2064
+ * @since 2.0.0
1958
2065
  */
1959
2066
  export const provideMerge: {
1960
2067
  /**
@@ -1962,7 +2069,8 @@ export const provideMerge: {
1962
2069
  * layer, resulting in a new layer with the inputs of this layer, and the
1963
2070
  * outputs of both layers.
1964
2071
  *
1965
- * @example
2072
+ * **Example** (Providing dependencies while retaining services)
2073
+ *
1966
2074
  * ```ts
1967
2075
  * import { Effect, Layer, Context } from "effect"
1968
2076
  *
@@ -2026,8 +2134,8 @@ export const provideMerge: {
2026
2134
  * )
2027
2135
  * ```
2028
2136
  *
2029
- * @since 2.0.0
2030
2137
  * @category utils
2138
+ * @since 2.0.0
2031
2139
  */
2032
2140
  <RIn, E, ROut>(that: Layer<ROut, E, RIn>): <RIn2, E2, ROut2>(self: Layer<ROut2, E2, RIn2>) => Layer<ROut | ROut2, E | E2, RIn | Exclude<RIn2, ROut>>
2033
2141
  /**
@@ -2035,7 +2143,8 @@ export const provideMerge: {
2035
2143
  * layer, resulting in a new layer with the inputs of this layer, and the
2036
2144
  * outputs of both layers.
2037
2145
  *
2038
- * @example
2146
+ * **Example** (Providing dependencies while retaining services)
2147
+ *
2039
2148
  * ```ts
2040
2149
  * import { Effect, Layer, Context } from "effect"
2041
2150
  *
@@ -2099,8 +2208,8 @@ export const provideMerge: {
2099
2208
  * )
2100
2209
  * ```
2101
2210
  *
2102
- * @since 2.0.0
2103
2211
  * @category utils
2212
+ * @since 2.0.0
2104
2213
  */
2105
2214
  <const Layers extends [Any, ...Array<Any>]>(that: Layers): <A, E, R>(
2106
2215
  self: Layer<A, E, R>
@@ -2115,7 +2224,8 @@ export const provideMerge: {
2115
2224
  * layer, resulting in a new layer with the inputs of this layer, and the
2116
2225
  * outputs of both layers.
2117
2226
  *
2118
- * @example
2227
+ * **Example** (Providing dependencies while retaining services)
2228
+ *
2119
2229
  * ```ts
2120
2230
  * import { Effect, Layer, Context } from "effect"
2121
2231
  *
@@ -2179,8 +2289,8 @@ export const provideMerge: {
2179
2289
  * )
2180
2290
  * ```
2181
2291
  *
2182
- * @since 2.0.0
2183
2292
  * @category utils
2293
+ * @since 2.0.0
2184
2294
  */
2185
2295
  <RIn2, E2, ROut2, RIn, E, ROut>(self: Layer<ROut2, E2, RIn2>, that: Layer<ROut, E, RIn>): Layer<ROut | ROut2, E | E2, RIn | Exclude<RIn2, ROut>>
2186
2296
  /**
@@ -2188,7 +2298,8 @@ export const provideMerge: {
2188
2298
  * layer, resulting in a new layer with the inputs of this layer, and the
2189
2299
  * outputs of both layers.
2190
2300
  *
2191
- * @example
2301
+ * **Example** (Providing dependencies while retaining services)
2302
+ *
2192
2303
  * ```ts
2193
2304
  * import { Effect, Layer, Context } from "effect"
2194
2305
  *
@@ -2252,8 +2363,8 @@ export const provideMerge: {
2252
2363
  * )
2253
2364
  * ```
2254
2365
  *
2255
- * @since 2.0.0
2256
2366
  * @category utils
2367
+ * @since 2.0.0
2257
2368
  */
2258
2369
  <A, E, R, const Layers extends [Any, ...Array<Any>]>(self: Layer<A, E, R>, that: Layers): Layer<
2259
2370
  A | Success<Layers[number]>,
@@ -2274,7 +2385,8 @@ export const provideMerge: {
2274
2385
  /**
2275
2386
  * Constructs a layer dynamically based on the output of this layer.
2276
2387
  *
2277
- * @example
2388
+ * **Example** (Creating services from layer output)
2389
+ *
2278
2390
  * ```ts
2279
2391
  * import { Effect, Layer, Context } from "effect"
2280
2392
  *
@@ -2338,14 +2450,15 @@ export const provideMerge: {
2338
2450
  * )
2339
2451
  * ```
2340
2452
  *
2341
- * @since 2.0.0
2342
2453
  * @category sequencing
2454
+ * @since 2.0.0
2343
2455
  */
2344
2456
  export const flatMap: {
2345
2457
  /**
2346
2458
  * Constructs a layer dynamically based on the output of this layer.
2347
2459
  *
2348
- * @example
2460
+ * **Example** (Creating services from layer output)
2461
+ *
2349
2462
  * ```ts
2350
2463
  * import { Effect, Layer, Context } from "effect"
2351
2464
  *
@@ -2409,14 +2522,15 @@ export const flatMap: {
2409
2522
  * )
2410
2523
  * ```
2411
2524
  *
2412
- * @since 2.0.0
2413
2525
  * @category sequencing
2526
+ * @since 2.0.0
2414
2527
  */
2415
2528
  <A, A2, E2, R2>(f: (context: Context.Context<A>) => Layer<A2, E2, R2>): <E, R>(self: Layer<A, E, R>) => Layer<A2, E2 | E, R2 | R>
2416
2529
  /**
2417
2530
  * Constructs a layer dynamically based on the output of this layer.
2418
2531
  *
2419
- * @example
2532
+ * **Example** (Creating services from layer output)
2533
+ *
2420
2534
  * ```ts
2421
2535
  * import { Effect, Layer, Context } from "effect"
2422
2536
  *
@@ -2480,8 +2594,8 @@ export const flatMap: {
2480
2594
  * )
2481
2595
  * ```
2482
2596
  *
2483
- * @since 2.0.0
2484
2597
  * @category sequencing
2598
+ * @since 2.0.0
2485
2599
  */
2486
2600
  <A, E, R, A2, E2, R2>(
2487
2601
  self: Layer<A, E, R>,
@@ -2501,22 +2615,22 @@ export const flatMap: {
2501
2615
  /**
2502
2616
  * Performs the specified effect if this layer succeeds.
2503
2617
  *
2504
- * @since 4.0.0
2505
2618
  * @category sequencing
2619
+ * @since 4.0.0
2506
2620
  */
2507
2621
  export const tap: {
2508
2622
  /**
2509
2623
  * Performs the specified effect if this layer succeeds.
2510
2624
  *
2511
- * @since 4.0.0
2512
2625
  * @category sequencing
2626
+ * @since 4.0.0
2513
2627
  */
2514
2628
  <ROut, XR extends ROut, RIn2, E2, X>(f: (context: Context.Context<XR>) => Effect<X, E2, RIn2>): <RIn, E>(self: Layer<ROut, E, RIn>) => Layer<ROut, E | E2, RIn | Exclude<RIn2, Scope.Scope>>
2515
2629
  /**
2516
2630
  * Performs the specified effect if this layer succeeds.
2517
2631
  *
2518
- * @since 4.0.0
2519
2632
  * @category sequencing
2633
+ * @since 4.0.0
2520
2634
  */
2521
2635
  <RIn, E, ROut, XR extends ROut, RIn2, E2, X>(
2522
2636
  self: Layer<ROut, E, RIn>,
@@ -2536,22 +2650,22 @@ export const tap: {
2536
2650
  /**
2537
2651
  * Performs the specified effect if this layer fails.
2538
2652
  *
2539
- * @since 4.0.0
2540
2653
  * @category sequencing
2654
+ * @since 4.0.0
2541
2655
  */
2542
2656
  export const tapError: {
2543
2657
  /**
2544
2658
  * Performs the specified effect if this layer fails.
2545
2659
  *
2546
- * @since 4.0.0
2547
2660
  * @category sequencing
2661
+ * @since 4.0.0
2548
2662
  */
2549
2663
  <E, XE extends E, RIn2, E2, X>(f: (e: XE) => Effect<X, E2, RIn2>): <RIn, ROut>(self: Layer<ROut, E, RIn>) => Layer<ROut, E | E2, RIn | Exclude<RIn2, Scope.Scope>>
2550
2664
  /**
2551
2665
  * Performs the specified effect if this layer fails.
2552
2666
  *
2553
- * @since 4.0.0
2554
2667
  * @category sequencing
2668
+ * @since 4.0.0
2555
2669
  */
2556
2670
  <RIn, E, XE extends E, ROut, RIn2, E2, X>(self: Layer<ROut, E, RIn>, f: (e: XE) => Effect<X, E2, RIn2>): Layer<ROut, E | E2, RIn | Exclude<RIn2, Scope.Scope>>
2557
2671
  } = dual(2, <RIn, E, XE extends E, ROut, RIn2, E2, X>(
@@ -2566,7 +2680,13 @@ export const tapError: {
2566
2680
  ))
2567
2681
 
2568
2682
  /**
2569
- * Performs the specified effect if this layer fails.
2683
+ * Performs the specified effect when this layer fails with any cause.
2684
+ *
2685
+ * **Details**
2686
+ * The callback receives the layer's `Cause`, so it can inspect typed errors,
2687
+ * defects, and interruption information. If the callback succeeds, the layer
2688
+ * fails again with the original cause; if the callback fails, that failure is
2689
+ * added to the layer's error type.
2570
2690
  *
2571
2691
  * **Previously Known As**
2572
2692
  *
@@ -2574,12 +2694,18 @@ export const tapError: {
2574
2694
  *
2575
2695
  * - `Layer.tapErrorCause`
2576
2696
  *
2577
- * @since 4.0.0
2578
2697
  * @category sequencing
2698
+ * @since 4.0.0
2579
2699
  */
2580
2700
  export const tapCause: {
2581
2701
  /**
2582
- * Performs the specified effect if this layer fails.
2702
+ * Performs the specified effect when this layer fails with any cause.
2703
+ *
2704
+ * **Details**
2705
+ * The callback receives the layer's `Cause`, so it can inspect typed errors,
2706
+ * defects, and interruption information. If the callback succeeds, the layer
2707
+ * fails again with the original cause; if the callback fails, that failure is
2708
+ * added to the layer's error type.
2583
2709
  *
2584
2710
  * **Previously Known As**
2585
2711
  *
@@ -2587,12 +2713,18 @@ export const tapCause: {
2587
2713
  *
2588
2714
  * - `Layer.tapErrorCause`
2589
2715
  *
2590
- * @since 4.0.0
2591
2716
  * @category sequencing
2717
+ * @since 4.0.0
2592
2718
  */
2593
2719
  <E, XE extends E, RIn2, E2, X>(f: (cause: Cause.Cause<XE>) => Effect<X, E2, RIn2>): <RIn, ROut>(self: Layer<ROut, E, RIn>) => Layer<ROut, E | E2, RIn | Exclude<RIn2, Scope.Scope>>
2594
2720
  /**
2595
- * Performs the specified effect if this layer fails.
2721
+ * Performs the specified effect when this layer fails with any cause.
2722
+ *
2723
+ * **Details**
2724
+ * The callback receives the layer's `Cause`, so it can inspect typed errors,
2725
+ * defects, and interruption information. If the callback succeeds, the layer
2726
+ * fails again with the original cause; if the callback fails, that failure is
2727
+ * added to the layer's error type.
2596
2728
  *
2597
2729
  * **Previously Known As**
2598
2730
  *
@@ -2600,8 +2732,8 @@ export const tapCause: {
2600
2732
  *
2601
2733
  * - `Layer.tapErrorCause`
2602
2734
  *
2603
- * @since 4.0.0
2604
2735
  * @category sequencing
2736
+ * @since 4.0.0
2605
2737
  */
2606
2738
  <RIn, E, XE extends E, ROut, RIn2, E2, X>(
2607
2739
  self: Layer<ROut, E, RIn>,
@@ -2623,7 +2755,8 @@ export const tapCause: {
2623
2755
  * Translates effect failure into death of the fiber, making all failures
2624
2756
  * unchecked and not a part of the type of the layer.
2625
2757
  *
2626
- * @example
2758
+ * **Example** (Converting layer failures to defects)
2759
+ *
2627
2760
  * ```ts
2628
2761
  * import { Data, Effect, Layer, Context } from "effect"
2629
2762
  *
@@ -2637,13 +2770,8 @@ export const tapCause: {
2637
2770
  *
2638
2771
  * // Layer that can fail during construction
2639
2772
  * const flakyDatabaseLayer = Layer.effect(Database)(Effect.gen(function*() {
2640
- * // Simulate a database connection that might fail
2641
- * const shouldFail = Math.random() > 0.5
2642
- * if (shouldFail) {
2643
- * return yield* new DatabaseError({ message: "Connection failed" })
2644
- * }
2645
- *
2646
- * return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`)) }
2773
+ * console.log("connecting")
2774
+ * return yield* new DatabaseError({ message: "Connection failed" })
2647
2775
  * }))
2648
2776
  *
2649
2777
  * // Convert failures to fiber death - removes error from type
@@ -2657,12 +2785,12 @@ export const tapCause: {
2657
2785
  * Effect.provide(reliableDatabaseLayer)
2658
2786
  * )
2659
2787
  *
2660
- * // If the database layer fails, the entire fiber will die
2661
- * // instead of the effect failing with DatabaseError
2788
+ * // Running the program prints "connecting", then the DatabaseError is
2789
+ * // converted into a fiber defect instead of remaining a typed error.
2662
2790
  * ```
2663
2791
  *
2664
- * @since 2.0.0
2665
2792
  * @category error handling
2793
+ * @since 2.0.0
2666
2794
  */
2667
2795
  export const orDie = <A, E, R>(self: Layer<A, E, R>): Layer<A, never, R> =>
2668
2796
  fromBuildUnsafe((memoMap, scope) => internalEffect.orDie(self.build(memoMap, scope)))
@@ -2690,8 +2818,8 @@ export {
2690
2818
  /**
2691
2819
  * Recovers from all errors.
2692
2820
  *
2693
- * @since 4.0.0
2694
2821
  * @category error handling
2822
+ * @since 4.0.0
2695
2823
  */
2696
2824
  catch_ as catch
2697
2825
  }
@@ -2699,7 +2827,8 @@ export {
2699
2827
  /**
2700
2828
  * Recovers from specific tagged errors.
2701
2829
  *
2702
- * @example
2830
+ * **Example** (Recovering from tagged layer errors)
2831
+ *
2703
2832
  * ```ts
2704
2833
  * import { Data, Effect, Layer, Context } from "effect"
2705
2834
  *
@@ -2718,14 +2847,15 @@ export {
2718
2847
  * )
2719
2848
  * ```
2720
2849
  *
2721
- * @since 4.0.0
2722
2850
  * @category error handling
2851
+ * @since 4.0.0
2723
2852
  */
2724
2853
  export const catchTag: {
2725
2854
  /**
2726
2855
  * Recovers from specific tagged errors.
2727
2856
  *
2728
- * @example
2857
+ * **Example** (Recovering from tagged layer errors)
2858
+ *
2729
2859
  * ```ts
2730
2860
  * import { Data, Effect, Layer, Context } from "effect"
2731
2861
  *
@@ -2744,8 +2874,8 @@ export const catchTag: {
2744
2874
  * )
2745
2875
  * ```
2746
2876
  *
2747
- * @since 4.0.0
2748
2877
  * @category error handling
2878
+ * @since 4.0.0
2749
2879
  */
2750
2880
  <const K extends Types.Tags<E> | NonEmptyReadonlyArray<Types.Tags<E>>, E, RIn2, E2, ROut2>(
2751
2881
  k: K,
@@ -2762,7 +2892,8 @@ export const catchTag: {
2762
2892
  /**
2763
2893
  * Recovers from specific tagged errors.
2764
2894
  *
2765
- * @example
2895
+ * **Example** (Recovering from tagged layer errors)
2896
+ *
2766
2897
  * ```ts
2767
2898
  * import { Data, Effect, Layer, Context } from "effect"
2768
2899
  *
@@ -2781,8 +2912,8 @@ export const catchTag: {
2781
2912
  * )
2782
2913
  * ```
2783
2914
  *
2784
- * @since 4.0.0
2785
2915
  * @category error handling
2916
+ * @since 4.0.0
2786
2917
  */
2787
2918
  <
2788
2919
  RIn,
@@ -2823,9 +2954,15 @@ export const catchTag: {
2823
2954
  ))
2824
2955
 
2825
2956
  /**
2826
- * Recovers from all errors.
2957
+ * Recovers from any failure cause by switching to another layer.
2958
+ *
2959
+ * **Details**
2960
+ * The handler receives the full `Cause` of the failed layer, including typed
2961
+ * errors, defects, and interruption information, and returns the fallback layer
2962
+ * to build instead.
2963
+ *
2964
+ * **Example** (Recovering from layer failures by cause)
2827
2965
  *
2828
- * @example
2829
2966
  * ```ts
2830
2967
  * import { Data, Effect, Layer, Context } from "effect"
2831
2968
  *
@@ -2833,57 +2970,48 @@ export const catchTag: {
2833
2970
  * message: string
2834
2971
  * }> {}
2835
2972
  *
2836
- * class NetworkError extends Data.TaggedError("NetworkError")<{
2837
- * reason: string
2838
- * }> {}
2839
- *
2840
2973
  * class Database extends Context.Service<Database, {
2841
2974
  * readonly query: (sql: string) => Effect.Effect<string>
2842
2975
  * }>()("Database") {}
2843
2976
  *
2844
- * class Logger extends Context.Service<Logger, {
2845
- * readonly log: (msg: string) => Effect.Effect<void>
2846
- * }>()("Logger") {}
2847
- *
2848
- * // Primary database layer that might fail
2849
- * const primaryDatabaseLayer = Layer.effect(Database)(Effect.gen(function*() {
2850
- * return yield* new DatabaseError({ message: "Primary DB unreachable" })
2851
- * return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Primary: ${sql}`)) }
2852
- * }))
2977
+ * const primaryDatabaseLayer = Layer.effect(Database)(
2978
+ * Effect.fail(new DatabaseError({ message: "Primary DB unreachable" }))
2979
+ * )
2853
2980
  *
2854
- * // Fallback layers for different error causes
2855
2981
  * const databaseWithFallback = primaryDatabaseLayer.pipe(
2856
2982
  * Layer.catchCause(() => {
2857
- * // For any cause/error, fallback to in-memory database
2858
- * return Layer.mergeAll(
2859
- * Layer.succeed(Database)({
2860
- * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
2861
- * }),
2862
- * Layer.succeed(Logger)({
2863
- * log: Effect.fn("Logger.log")((msg: string) =>
2864
- * Effect.sync(() => console.log(`[FALLBACK] ${msg}`))
2865
- * )
2866
- * })
2867
- * )
2983
+ * return Layer.succeed(Database)({
2984
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
2985
+ * })
2868
2986
  * })
2869
2987
  * )
2870
2988
  *
2871
2989
  * const program = Effect.gen(function*() {
2872
2990
  * const database = yield* Database
2873
- * return yield* database.query("SELECT * FROM users")
2991
+ * const result = yield* database.query("SELECT * FROM users")
2992
+ * console.log(result)
2874
2993
  * }).pipe(
2875
2994
  * Effect.provide(databaseWithFallback)
2876
2995
  * )
2996
+ *
2997
+ * Effect.runPromise(program)
2998
+ * // Memory: SELECT * FROM users
2877
2999
  * ```
2878
3000
  *
2879
- * @since 2.0.0
2880
3001
  * @category error handling
3002
+ * @since 2.0.0
2881
3003
  */
2882
3004
  export const catchCause: {
2883
3005
  /**
2884
- * Recovers from all errors.
3006
+ * Recovers from any failure cause by switching to another layer.
3007
+ *
3008
+ * **Details**
3009
+ * The handler receives the full `Cause` of the failed layer, including typed
3010
+ * errors, defects, and interruption information, and returns the fallback layer
3011
+ * to build instead.
3012
+ *
3013
+ * **Example** (Recovering from layer failures by cause)
2885
3014
  *
2886
- * @example
2887
3015
  * ```ts
2888
3016
  * import { Data, Effect, Layer, Context } from "effect"
2889
3017
  *
@@ -2891,57 +3019,48 @@ export const catchCause: {
2891
3019
  * message: string
2892
3020
  * }> {}
2893
3021
  *
2894
- * class NetworkError extends Data.TaggedError("NetworkError")<{
2895
- * reason: string
2896
- * }> {}
2897
- *
2898
3022
  * class Database extends Context.Service<Database, {
2899
3023
  * readonly query: (sql: string) => Effect.Effect<string>
2900
3024
  * }>()("Database") {}
2901
3025
  *
2902
- * class Logger extends Context.Service<Logger, {
2903
- * readonly log: (msg: string) => Effect.Effect<void>
2904
- * }>()("Logger") {}
2905
- *
2906
- * // Primary database layer that might fail
2907
- * const primaryDatabaseLayer = Layer.effect(Database)(Effect.gen(function*() {
2908
- * return yield* new DatabaseError({ message: "Primary DB unreachable" })
2909
- * return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Primary: ${sql}`)) }
2910
- * }))
3026
+ * const primaryDatabaseLayer = Layer.effect(Database)(
3027
+ * Effect.fail(new DatabaseError({ message: "Primary DB unreachable" }))
3028
+ * )
2911
3029
  *
2912
- * // Fallback layers for different error causes
2913
3030
  * const databaseWithFallback = primaryDatabaseLayer.pipe(
2914
3031
  * Layer.catchCause(() => {
2915
- * // For any cause/error, fallback to in-memory database
2916
- * return Layer.mergeAll(
2917
- * Layer.succeed(Database)({
2918
- * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
2919
- * }),
2920
- * Layer.succeed(Logger)({
2921
- * log: Effect.fn("Logger.log")((msg: string) =>
2922
- * Effect.sync(() => console.log(`[FALLBACK] ${msg}`))
2923
- * )
2924
- * })
2925
- * )
3032
+ * return Layer.succeed(Database)({
3033
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
3034
+ * })
2926
3035
  * })
2927
3036
  * )
2928
3037
  *
2929
3038
  * const program = Effect.gen(function*() {
2930
3039
  * const database = yield* Database
2931
- * return yield* database.query("SELECT * FROM users")
3040
+ * const result = yield* database.query("SELECT * FROM users")
3041
+ * console.log(result)
2932
3042
  * }).pipe(
2933
3043
  * Effect.provide(databaseWithFallback)
2934
3044
  * )
3045
+ *
3046
+ * Effect.runPromise(program)
3047
+ * // Memory: SELECT * FROM users
2935
3048
  * ```
2936
3049
  *
2937
- * @since 2.0.0
2938
3050
  * @category error handling
3051
+ * @since 2.0.0
2939
3052
  */
2940
3053
  <E, RIn2, E2, ROut2>(onError: (cause: Cause.Cause<E>) => Layer<ROut2, E2, RIn2>): <RIn, ROut>(self: Layer<ROut, E, RIn>) => Layer<ROut & ROut2, E2, RIn2 | RIn>
2941
3054
  /**
2942
- * Recovers from all errors.
3055
+ * Recovers from any failure cause by switching to another layer.
3056
+ *
3057
+ * **Details**
3058
+ * The handler receives the full `Cause` of the failed layer, including typed
3059
+ * errors, defects, and interruption information, and returns the fallback layer
3060
+ * to build instead.
3061
+ *
3062
+ * **Example** (Recovering from layer failures by cause)
2943
3063
  *
2944
- * @example
2945
3064
  * ```ts
2946
3065
  * import { Data, Effect, Layer, Context } from "effect"
2947
3066
  *
@@ -2949,51 +3068,36 @@ export const catchCause: {
2949
3068
  * message: string
2950
3069
  * }> {}
2951
3070
  *
2952
- * class NetworkError extends Data.TaggedError("NetworkError")<{
2953
- * reason: string
2954
- * }> {}
2955
- *
2956
3071
  * class Database extends Context.Service<Database, {
2957
3072
  * readonly query: (sql: string) => Effect.Effect<string>
2958
3073
  * }>()("Database") {}
2959
3074
  *
2960
- * class Logger extends Context.Service<Logger, {
2961
- * readonly log: (msg: string) => Effect.Effect<void>
2962
- * }>()("Logger") {}
2963
- *
2964
- * // Primary database layer that might fail
2965
- * const primaryDatabaseLayer = Layer.effect(Database)(Effect.gen(function*() {
2966
- * return yield* new DatabaseError({ message: "Primary DB unreachable" })
2967
- * return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Primary: ${sql}`)) }
2968
- * }))
3075
+ * const primaryDatabaseLayer = Layer.effect(Database)(
3076
+ * Effect.fail(new DatabaseError({ message: "Primary DB unreachable" }))
3077
+ * )
2969
3078
  *
2970
- * // Fallback layers for different error causes
2971
3079
  * const databaseWithFallback = primaryDatabaseLayer.pipe(
2972
3080
  * Layer.catchCause(() => {
2973
- * // For any cause/error, fallback to in-memory database
2974
- * return Layer.mergeAll(
2975
- * Layer.succeed(Database)({
2976
- * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
2977
- * }),
2978
- * Layer.succeed(Logger)({
2979
- * log: Effect.fn("Logger.log")((msg: string) =>
2980
- * Effect.sync(() => console.log(`[FALLBACK] ${msg}`))
2981
- * )
2982
- * })
2983
- * )
3081
+ * return Layer.succeed(Database)({
3082
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
3083
+ * })
2984
3084
  * })
2985
3085
  * )
2986
3086
  *
2987
3087
  * const program = Effect.gen(function*() {
2988
3088
  * const database = yield* Database
2989
- * return yield* database.query("SELECT * FROM users")
3089
+ * const result = yield* database.query("SELECT * FROM users")
3090
+ * console.log(result)
2990
3091
  * }).pipe(
2991
3092
  * Effect.provide(databaseWithFallback)
2992
3093
  * )
3094
+ *
3095
+ * Effect.runPromise(program)
3096
+ * // Memory: SELECT * FROM users
2993
3097
  * ```
2994
3098
  *
2995
- * @since 2.0.0
2996
3099
  * @category error handling
3100
+ * @since 2.0.0
2997
3101
  */
2998
3102
  <RIn, E, ROut, RIn2, E2, ROut22>(
2999
3103
  self: Layer<ROut, E, RIn>,
@@ -3025,8 +3129,8 @@ export const catchCause: {
3025
3129
  * This is useful for adapting or extending a service's behavior during the
3026
3130
  * creation of a layer.
3027
3131
  *
3028
- * @since 3.13.0
3029
3132
  * @category utils
3133
+ * @since 3.13.0
3030
3134
  */
3031
3135
  export const updateService: {
3032
3136
  /**
@@ -3044,8 +3148,8 @@ export const updateService: {
3044
3148
  * This is useful for adapting or extending a service's behavior during the
3045
3149
  * creation of a layer.
3046
3150
  *
3047
- * @since 3.13.0
3048
3151
  * @category utils
3152
+ * @since 3.13.0
3049
3153
  */
3050
3154
  <I, A>(service: Context.Key<I, A>, f: (a: Types.NoInfer<A>) => A): <A1, E1, R1>(layer: Layer<A1, E1, R1>) => Layer<A1, E1, I | R1>
3051
3155
  /**
@@ -3063,8 +3167,8 @@ export const updateService: {
3063
3167
  * This is useful for adapting or extending a service's behavior during the
3064
3168
  * creation of a layer.
3065
3169
  *
3066
- * @since 3.13.0
3067
3170
  * @category utils
3171
+ * @since 3.13.0
3068
3172
  */
3069
3173
  <A1, E1, R1, I, A>(
3070
3174
  layer: Layer<A1, E1, R1>,
@@ -3077,59 +3181,80 @@ export const updateService: {
3077
3181
  layer: Layer<A1, E1, R1>,
3078
3182
  service: Context.Key<I, A>,
3079
3183
  f: (a: Types.NoInfer<A>) => A
3080
- ): Layer<A1, E1, I | R1> => provide(layer, effect(service, internalEffect.map(service.asEffect(), f)))
3184
+ ): Layer<A1, E1, I | R1> => provide(layer, effect(service, internalEffect.map(service, f)))
3081
3185
  )
3082
3186
 
3083
3187
  /**
3084
3188
  * Creates a fresh version of this layer that will not be shared.
3085
3189
  *
3086
- * @example
3190
+ * **Example** (Creating non-shared layer instances)
3191
+ *
3087
3192
  * ```ts
3088
3193
  * import { Effect, Layer, Ref, Context } from "effect"
3089
3194
  *
3090
3195
  * class Counter extends Context.Service<Counter, {
3091
- * readonly count: number
3092
- * readonly increment: () => Effect.Effect<number>
3196
+ * readonly id: number
3093
3197
  * }>()("Counter") {}
3094
3198
  *
3095
- * // Layer that creates a counter with shared state
3096
- * const counterLayer = Layer.effect(Counter)(Effect.gen(function*() {
3097
- * const ref = yield* Ref.make(0)
3098
- * return {
3099
- * count: 0,
3100
- * increment: Effect.fn("Counter.increment")(() =>
3101
- * Ref.update(ref, (n) => n + 1).pipe(
3102
- * Effect.flatMap(() => Ref.get(ref))
3103
- * )
3104
- * )
3105
- * }
3199
+ * class Left extends Context.Service<Left, {
3200
+ * readonly counterId: number
3201
+ * }>()("Left") {}
3202
+ *
3203
+ * class Right extends Context.Service<Right, {
3204
+ * readonly counterId: number
3205
+ * }>()("Right") {}
3206
+ *
3207
+ * const leftLayer = Layer.effect(Left)(Effect.gen(function*() {
3208
+ * const counter = yield* Counter
3209
+ * return { counterId: counter.id }
3106
3210
  * }))
3107
3211
  *
3108
- * // By default, layers are shared - same instance used everywhere
3109
- * const sharedProgram = Effect.gen(function*() {
3110
- * const counter1 = yield* Counter
3111
- * const counter2 = yield* Counter
3212
+ * const rightLayer = Layer.effect(Right)(Effect.gen(function*() {
3213
+ * const counter = yield* Counter
3214
+ * return { counterId: counter.id }
3215
+ * }))
3112
3216
  *
3113
- * // Both counter1 and counter2 refer to the same instance
3114
- * console.log("Shared layer - same instance")
3115
- * }).pipe(
3116
- * Effect.provide(counterLayer)
3117
- * )
3217
+ * const showIds = Effect.gen(function*() {
3218
+ * const left = yield* Left
3219
+ * const right = yield* Right
3220
+ * console.log(`same Counter: ${left.counterId === right.counterId}`)
3221
+ * })
3118
3222
  *
3119
- * // Fresh layer creates a new instance each time
3120
- * const freshProgram = Effect.gen(function*() {
3121
- * const counter1 = yield* Counter
3122
- * const counter2 = yield* Counter
3223
+ * const program = Effect.gen(function*() {
3224
+ * const nextId = yield* Ref.make(0)
3123
3225
  *
3124
- * // counter1 and counter2 are different instances
3125
- * console.log("Fresh layer - different instances")
3126
- * }).pipe(
3127
- * Effect.provide(Layer.fresh(counterLayer))
3128
- * )
3226
+ * const counterLayer = Layer.effect(Counter)(Effect.gen(function*() {
3227
+ * const id = yield* Ref.updateAndGet(nextId, (n) => n + 1)
3228
+ * console.log("constructed Counter")
3229
+ * return { id }
3230
+ * }))
3231
+ *
3232
+ * const shared = Layer.merge(
3233
+ * Layer.provide(leftLayer, counterLayer),
3234
+ * Layer.provide(rightLayer, counterLayer)
3235
+ * )
3236
+ *
3237
+ * yield* Effect.provide(showIds, shared)
3238
+ *
3239
+ * const freshCounterLayer = Layer.fresh(counterLayer)
3240
+ * const fresh = Layer.merge(
3241
+ * Layer.provide(leftLayer, freshCounterLayer),
3242
+ * Layer.provide(rightLayer, freshCounterLayer)
3243
+ * )
3244
+ *
3245
+ * yield* Effect.provide(showIds, fresh)
3246
+ * })
3247
+ *
3248
+ * Effect.runPromise(program)
3249
+ * // constructed Counter
3250
+ * // same Counter: true
3251
+ * // constructed Counter
3252
+ * // constructed Counter
3253
+ * // same Counter: false
3129
3254
  * ```
3130
3255
  *
3131
- * @since 2.0.0
3132
3256
  * @category utils
3257
+ * @since 2.0.0
3133
3258
  */
3134
3259
  export const fresh = <A, E, R>(self: Layer<A, E, R>): Layer<A, E, R> =>
3135
3260
  fromBuildUnsafe((_, scope) => self.build(makeMemoMapUnsafe(), scope))
@@ -3138,7 +3263,8 @@ export const fresh = <A, E, R>(self: Layer<A, E, R>): Layer<A, E, R> =>
3138
3263
  * Builds this layer and uses it until it is interrupted. This is useful when
3139
3264
  * your entire application is a layer, such as an HTTP server.
3140
3265
  *
3141
- * @example
3266
+ * **Example** (Launching an application layer)
3267
+ *
3142
3268
  * ```ts
3143
3269
  * import { Console, Effect, Layer, Context } from "effect"
3144
3270
  *
@@ -3185,8 +3311,8 @@ export const fresh = <A, E, R>(self: Layer<A, E, R>): Layer<A, E, R> =>
3185
3311
  * // Effect.runFork(application)
3186
3312
  * ```
3187
3313
  *
3188
- * @since 2.0.0
3189
3314
  * @category conversions
3315
+ * @since 2.0.0
3190
3316
  */
3191
3317
  export const launch = <RIn, E, ROut>(self: Layer<ROut, E, RIn>): Effect<never, E, RIn> =>
3192
3318
  internalEffect.scoped(internalEffect.andThen(build(self), internalEffect.never))
@@ -3198,8 +3324,8 @@ export const launch = <RIn, E, ROut>(self: Layer<ROut, E, RIn>): Effect<never, E
3198
3324
  * while keeping non-Effect properties required. This allows you to provide
3199
3325
  * only the methods you need to test while leaving others unimplemented.
3200
3326
  *
3201
- * @since 4.0.0
3202
3327
  * @category Testing
3328
+ * @since 4.0.0
3203
3329
  */
3204
3330
  export type PartialEffectful<A extends object> = Types.Simplify<
3205
3331
  & {
@@ -3223,7 +3349,8 @@ type AnyEffectOrStream =
3223
3349
  * implementation of the service, and any methods not provided will
3224
3350
  * throw an unimplemented defect when called.
3225
3351
  *
3226
- * @example
3352
+ * **Example** (Mocking services for tests)
3353
+ *
3227
3354
  * ```ts
3228
3355
  * import { Effect, Layer, Context } from "effect"
3229
3356
  *
@@ -3261,8 +3388,8 @@ type AnyEffectOrStream =
3261
3388
  * )
3262
3389
  * ```
3263
3390
  *
3264
- * @since 4.0.0
3265
3391
  * @category Testing
3392
+ * @since 4.0.0
3266
3393
  */
3267
3394
  export const mock: {
3268
3395
  /**
@@ -3270,7 +3397,8 @@ export const mock: {
3270
3397
  * implementation of the service, and any methods not provided will
3271
3398
  * throw an unimplemented defect when called.
3272
3399
  *
3273
- * @example
3400
+ * **Example** (Mocking services for tests)
3401
+ *
3274
3402
  * ```ts
3275
3403
  * import { Effect, Layer, Context } from "effect"
3276
3404
  *
@@ -3308,8 +3436,8 @@ export const mock: {
3308
3436
  * )
3309
3437
  * ```
3310
3438
  *
3311
- * @since 4.0.0
3312
3439
  * @category Testing
3440
+ * @since 4.0.0
3313
3441
  */
3314
3442
  <I, S extends object>(service: Context.Key<I, S>): (implementation: PartialEffectful<S>) => Layer<I>
3315
3443
  /**
@@ -3317,7 +3445,8 @@ export const mock: {
3317
3445
  * implementation of the service, and any methods not provided will
3318
3446
  * throw an unimplemented defect when called.
3319
3447
  *
3320
- * @example
3448
+ * **Example** (Mocking services for tests)
3449
+ *
3321
3450
  * ```ts
3322
3451
  * import { Effect, Layer, Context } from "effect"
3323
3452
  *
@@ -3355,8 +3484,8 @@ export const mock: {
3355
3484
  * )
3356
3485
  * ```
3357
3486
  *
3358
- * @since 4.0.0
3359
3487
  * @category Testing
3488
+ * @since 4.0.0
3360
3489
  */
3361
3490
  <I, S extends object>(
3362
3491
  service: Context.Key<I, S>,
@@ -3422,7 +3551,8 @@ const ChannelTypeId: Channel.TypeId = "~effect/Channel"
3422
3551
  * This function provides compile-time type checking to ensure that the success
3423
3552
  * value of an layer conforms to a specific type constraint.
3424
3553
  *
3425
- * @example
3554
+ * **Example** (Constraining layer success types)
3555
+ *
3426
3556
  * ```ts
3427
3557
  * import { Layer } from "effect"
3428
3558
  *
@@ -3438,11 +3568,11 @@ const ChannelTypeId: Channel.TypeId = "~effect/Channel"
3438
3568
  * // This would cause a TypeScript compilation error:
3439
3569
  * // const invalidLayer = satisfiesNumber(StringLayer)
3440
3570
  * // ^^^^^^^^^^^
3441
- * // Type 'number' is not assignable to type 'string'
3571
+ * // Type 'string' is not assignable to type 'number'
3442
3572
  * ```
3443
3573
  *
3444
- * @since 4.0.0
3445
3574
  * @category Type constraints
3575
+ * @since 4.0.0
3446
3576
  */
3447
3577
  export const satisfiesSuccessType =
3448
3578
  <ROut>() => <ROut2 extends ROut, E, RIn>(layer: Layer<ROut2, E, RIn>): Layer<ROut2, E, RIn> => layer
@@ -3453,7 +3583,8 @@ export const satisfiesSuccessType =
3453
3583
  * This function provides compile-time type checking to ensure that the error
3454
3584
  * type of an layer conforms to a specific type constraint.
3455
3585
  *
3456
- * @example
3586
+ * **Example** (Constraining layer error types)
3587
+ *
3457
3588
  * ```ts
3458
3589
  * import { Layer } from "effect"
3459
3590
  *
@@ -3473,8 +3604,8 @@ export const satisfiesSuccessType =
3473
3604
  * // Type 'string' is not assignable to type 'Error'
3474
3605
  * ```
3475
3606
  *
3476
- * @since 4.0.0
3477
3607
  * @category Type constraints
3608
+ * @since 4.0.0
3478
3609
  */
3479
3610
  export const satisfiesErrorType =
3480
3611
  <E>() => <ROut, E2 extends E, RIn>(layer: Layer<ROut, E2, RIn>): Layer<ROut, E2, RIn> => layer
@@ -3485,14 +3616,15 @@ export const satisfiesErrorType =
3485
3616
  * This function provides compile-time type checking to ensure that the
3486
3617
  * requirements (context) type of an layer conforms to a specific type constraint.
3487
3618
  *
3488
- * @example
3619
+ * **Example** (Constraining layer service requirements)
3620
+ *
3489
3621
  * ```ts
3490
3622
  * import { Layer } from "effect"
3491
3623
  *
3492
3624
  * declare const FortyTwoLayer: Layer.Layer<never, never, 42>
3493
3625
  * declare const StringLayer: Layer.Layer<never, never, string>
3494
3626
  *
3495
- * // Define a constraint that the success type must be a number
3627
+ * // Define a constraint that the service requirements must be numbers
3496
3628
  * const satisfiesNumber = Layer.satisfiesServicesType<number>()
3497
3629
  *
3498
3630
  * // This works - Layer<never, never, 42> extends Layer<never, never, number>
@@ -3504,8 +3636,8 @@ export const satisfiesErrorType =
3504
3636
  * // Type 'string' is not assignable to type 'number'
3505
3637
  * ```
3506
3638
  *
3507
- * @since 4.0.0
3508
3639
  * @category Type constraints
3640
+ * @since 4.0.0
3509
3641
  */
3510
3642
  export const satisfiesServicesType =
3511
3643
  <RIn>() => <ROut, E, RIn2 extends RIn>(layer: Layer<ROut, E, RIn2>): Layer<ROut, E, RIn2> => layer
@@ -3518,8 +3650,8 @@ export const satisfiesServicesType =
3518
3650
  * Represents options that can be used to control the behavior of spans created
3519
3651
  * for layers.
3520
3652
  *
3521
- * @since 4.0.0
3522
3653
  * @category Models
3654
+ * @since 4.0.0
3523
3655
  */
3524
3656
  export interface SpanOptions extends Tracer.SpanOptions {
3525
3657
  /**
@@ -3539,7 +3671,8 @@ export interface SpanOptions extends Tracer.SpanOptions {
3539
3671
  * operations within the layer constructor part of the same trace span. The span
3540
3672
  * is automatically closed when the layer's scope is closed.
3541
3673
  *
3542
- * @example
3674
+ * **Example** (Tracing layer construction with a span)
3675
+ *
3543
3676
  * ```ts
3544
3677
  * import { Console, Effect, Layer, Context, type Tracer } from "effect"
3545
3678
  *
@@ -3573,8 +3706,8 @@ export interface SpanOptions extends Tracer.SpanOptions {
3573
3706
  * })
3574
3707
  * ```
3575
3708
  *
3576
- * @since 4.0.0
3577
3709
  * @category tracing
3710
+ * @since 4.0.0
3578
3711
  */
3579
3712
  export const span = (
3580
3713
  name: string,
@@ -3593,14 +3726,15 @@ export const span = (
3593
3726
  }
3594
3727
 
3595
3728
  /**
3596
- * Constructs a new `Layer` which takes an existing span and registers it as the
3597
- * current parent span.
3729
+ * Constructs a layer that provides an existing span as the current parent span.
3598
3730
  *
3599
- * This allows you to create a traced scope for layer construction, making all
3600
- * operations within the layer constructor part of the same trace span. The span
3601
- * is automatically closed when the layer's scope is closed.
3731
+ * **Details**
3732
+ * The supplied span is made available through `Tracer.ParentSpan` for layers
3733
+ * that are built with this layer. This API does not create, end, or close the
3734
+ * span; the caller remains responsible for the span's lifetime.
3735
+ *
3736
+ * **Example** (Using an existing parent span)
3602
3737
  *
3603
- * @example
3604
3738
  * ```ts
3605
3739
  * import { Console, Effect, Layer, Context, Tracer } from "effect"
3606
3740
  *
@@ -3627,8 +3761,8 @@ export const span = (
3627
3761
  * }))))
3628
3762
  * ```
3629
3763
  *
3630
- * @since 4.0.0
3631
3764
  * @category tracing
3765
+ * @since 4.0.0
3632
3766
  */
3633
3767
  export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
3634
3768
  succeedContext(Tracer.ParentSpan.context(span))
@@ -3641,7 +3775,8 @@ export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
3641
3775
  * is automatically ended when the layer's scope is closed. This is useful for
3642
3776
  * tracking the lifecycle and performance of layer initialization.
3643
3777
  *
3644
- * @example
3778
+ * **Example** (Wrapping a layer with a span)
3779
+ *
3645
3780
  * ```ts
3646
3781
  * import { Effect, Layer, Context } from "effect"
3647
3782
  *
@@ -3688,8 +3823,8 @@ export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
3688
3823
  * )
3689
3824
  * ```
3690
3825
  *
3691
- * @since 4.0.0
3692
3826
  * @category tracing
3827
+ * @since 4.0.0
3693
3828
  */
3694
3829
  export const withSpan: {
3695
3830
  /**
@@ -3700,7 +3835,8 @@ export const withSpan: {
3700
3835
  * is automatically ended when the layer's scope is closed. This is useful for
3701
3836
  * tracking the lifecycle and performance of layer initialization.
3702
3837
  *
3703
- * @example
3838
+ * **Example** (Wrapping a layer with a span)
3839
+ *
3704
3840
  * ```ts
3705
3841
  * import { Effect, Layer, Context } from "effect"
3706
3842
  *
@@ -3747,8 +3883,8 @@ export const withSpan: {
3747
3883
  * )
3748
3884
  * ```
3749
3885
  *
3750
- * @since 4.0.0
3751
3886
  * @category tracing
3887
+ * @since 4.0.0
3752
3888
  */
3753
3889
  (name: string, options?: SpanOptions): <A, E, R>(
3754
3890
  self: Layer<A, E, R>
@@ -3761,7 +3897,8 @@ export const withSpan: {
3761
3897
  * is automatically ended when the layer's scope is closed. This is useful for
3762
3898
  * tracking the lifecycle and performance of layer initialization.
3763
3899
  *
3764
- * @example
3900
+ * **Example** (Wrapping a layer with a span)
3901
+ *
3765
3902
  * ```ts
3766
3903
  * import { Effect, Layer, Context } from "effect"
3767
3904
  *
@@ -3808,8 +3945,8 @@ export const withSpan: {
3808
3945
  * )
3809
3946
  * ```
3810
3947
  *
3811
- * @since 4.0.0
3812
3948
  * @category tracing
3949
+ * @since 4.0.0
3813
3950
  */
3814
3951
  <A, E, R>(self: Layer<A, E, R>, name: string, options?: SpanOptions): Layer<A, E, Exclude<R, Tracer.ParentSpan>>
3815
3952
  } = function() {
@@ -3845,13 +3982,15 @@ export const withSpan: {
3845
3982
  } as any
3846
3983
 
3847
3984
  /**
3848
- * Wraps a `Layer` with a new tracing span and sets the span as the parent span.
3985
+ * Wraps a layer so spans created during its construction use the supplied span
3986
+ * as their parent.
3849
3987
  *
3850
- * This attaches a layer to an existing trace span, making all operations within
3851
- * the layer children of the provided parent span. This is useful for integrating
3852
- * layer construction into an existing trace hierarchy.
3988
+ * **Details**
3989
+ * Use this to attach layer construction to an existing trace hierarchy. This API
3990
+ * does not create or end the supplied parent span.
3991
+ *
3992
+ * **Example** (Attaching layers to an existing parent span)
3853
3993
  *
3854
- * @example
3855
3994
  * ```ts
3856
3995
  * import { Effect, Layer, Context, Tracer } from "effect"
3857
3996
  *
@@ -3900,18 +4039,20 @@ export const withSpan: {
3900
4039
  * )
3901
4040
  * ```
3902
4041
  *
3903
- * @since 4.0.0
3904
4042
  * @category tracing
4043
+ * @since 4.0.0
3905
4044
  */
3906
4045
  export const withParentSpan: {
3907
4046
  /**
3908
- * Wraps a `Layer` with a new tracing span and sets the span as the parent span.
4047
+ * Wraps a layer so spans created during its construction use the supplied span
4048
+ * as their parent.
4049
+ *
4050
+ * **Details**
4051
+ * Use this to attach layer construction to an existing trace hierarchy. This API
4052
+ * does not create or end the supplied parent span.
3909
4053
  *
3910
- * This attaches a layer to an existing trace span, making all operations within
3911
- * the layer children of the provided parent span. This is useful for integrating
3912
- * layer construction into an existing trace hierarchy.
4054
+ * **Example** (Attaching layers to an existing parent span)
3913
4055
  *
3914
- * @example
3915
4056
  * ```ts
3916
4057
  * import { Effect, Layer, Context, Tracer } from "effect"
3917
4058
  *
@@ -3960,20 +4101,22 @@ export const withParentSpan: {
3960
4101
  * )
3961
4102
  * ```
3962
4103
  *
3963
- * @since 4.0.0
3964
4104
  * @category tracing
4105
+ * @since 4.0.0
3965
4106
  */
3966
4107
  (span: Tracer.AnySpan, options?: Tracer.TraceOptions): <A, E, R>(
3967
4108
  self: Layer<A, E, R>
3968
4109
  ) => Layer<A, E, Exclude<R, Tracer.ParentSpan>>
3969
4110
  /**
3970
- * Wraps a `Layer` with a new tracing span and sets the span as the parent span.
4111
+ * Wraps a layer so spans created during its construction use the supplied span
4112
+ * as their parent.
4113
+ *
4114
+ * **Details**
4115
+ * Use this to attach layer construction to an existing trace hierarchy. This API
4116
+ * does not create or end the supplied parent span.
3971
4117
  *
3972
- * This attaches a layer to an existing trace span, making all operations within
3973
- * the layer children of the provided parent span. This is useful for integrating
3974
- * layer construction into an existing trace hierarchy.
4118
+ * **Example** (Attaching layers to an existing parent span)
3975
4119
  *
3976
- * @example
3977
4120
  * ```ts
3978
4121
  * import { Effect, Layer, Context, Tracer } from "effect"
3979
4122
  *
@@ -4022,8 +4165,8 @@ export const withParentSpan: {
4022
4165
  * )
4023
4166
  * ```
4024
4167
  *
4025
- * @since 4.0.0
4026
4168
  * @category tracing
4169
+ * @since 4.0.0
4027
4170
  */
4028
4171
  <A, E, R>(self: Layer<A, E, R>, span: Tracer.AnySpan, options?: Tracer.TraceOptions): Layer<A, E, Exclude<R, Tracer.ParentSpan>>
4029
4172
  } = function() {