effect 4.0.0-beta.69 → 4.0.0-beta.70

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 (1269) hide show
  1. package/dist/Array.d.ts +454 -0
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +152 -0
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +87 -33
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +37 -11
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +71 -14
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +35 -10
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +4 -0
  14. package/dist/Boolean.d.ts.map +1 -1
  15. package/dist/Boolean.js +4 -0
  16. package/dist/Boolean.js.map +1 -1
  17. package/dist/Brand.d.ts +16 -11
  18. package/dist/Brand.d.ts.map +1 -1
  19. package/dist/Brand.js +16 -11
  20. package/dist/Brand.js.map +1 -1
  21. package/dist/Cache.d.ts +13 -1
  22. package/dist/Cache.d.ts.map +1 -1
  23. package/dist/Cache.js +8 -0
  24. package/dist/Cache.js.map +1 -1
  25. package/dist/Cause.d.ts +95 -3
  26. package/dist/Cause.d.ts.map +1 -1
  27. package/dist/Cause.js +56 -2
  28. package/dist/Cause.js.map +1 -1
  29. package/dist/Channel.d.ts +312 -0
  30. package/dist/Channel.d.ts.map +1 -1
  31. package/dist/Channel.js +126 -0
  32. package/dist/Channel.js.map +1 -1
  33. package/dist/ChannelSchema.d.ts +20 -0
  34. package/dist/ChannelSchema.d.ts.map +1 -1
  35. package/dist/ChannelSchema.js +12 -0
  36. package/dist/ChannelSchema.js.map +1 -1
  37. package/dist/Chunk.d.ts +59 -22
  38. package/dist/Chunk.d.ts.map +1 -1
  39. package/dist/Chunk.js +29 -10
  40. package/dist/Chunk.js.map +1 -1
  41. package/dist/Combiner.d.ts +75 -71
  42. package/dist/Combiner.d.ts.map +1 -1
  43. package/dist/Combiner.js +67 -62
  44. package/dist/Combiner.js.map +1 -1
  45. package/dist/Config.d.ts +167 -46
  46. package/dist/Config.d.ts.map +1 -1
  47. package/dist/Config.js +108 -28
  48. package/dist/Config.js.map +1 -1
  49. package/dist/ConfigProvider.d.ts +235 -158
  50. package/dist/ConfigProvider.d.ts.map +1 -1
  51. package/dist/ConfigProvider.js +144 -93
  52. package/dist/ConfigProvider.js.map +1 -1
  53. package/dist/Console.d.ts +21 -79
  54. package/dist/Console.d.ts.map +1 -1
  55. package/dist/Console.js +20 -75
  56. package/dist/Console.js.map +1 -1
  57. package/dist/Context.d.ts +4 -4
  58. package/dist/Context.js +2 -2
  59. package/dist/Cron.d.ts +42 -16
  60. package/dist/Cron.d.ts.map +1 -1
  61. package/dist/Cron.js +33 -13
  62. package/dist/Cron.js.map +1 -1
  63. package/dist/Crypto.d.ts +6 -0
  64. package/dist/Crypto.d.ts.map +1 -1
  65. package/dist/Crypto.js.map +1 -1
  66. package/dist/Data.d.ts +132 -70
  67. package/dist/Data.d.ts.map +1 -1
  68. package/dist/Data.js +44 -29
  69. package/dist/Data.js.map +1 -1
  70. package/dist/DateTime.d.ts +227 -14
  71. package/dist/DateTime.d.ts.map +1 -1
  72. package/dist/DateTime.js +115 -6
  73. package/dist/DateTime.js.map +1 -1
  74. package/dist/Deferred.d.ts +94 -27
  75. package/dist/Deferred.d.ts.map +1 -1
  76. package/dist/Deferred.js +33 -8
  77. package/dist/Deferred.js.map +1 -1
  78. package/dist/Differ.d.ts +2 -0
  79. package/dist/Differ.d.ts.map +1 -1
  80. package/dist/Duration.d.ts +64 -6
  81. package/dist/Duration.d.ts.map +1 -1
  82. package/dist/Duration.js +26 -2
  83. package/dist/Duration.js.map +1 -1
  84. package/dist/Effect.d.ts +907 -603
  85. package/dist/Effect.d.ts.map +1 -1
  86. package/dist/Effect.js +360 -233
  87. package/dist/Effect.js.map +1 -1
  88. package/dist/Effectable.d.ts +3 -1
  89. package/dist/Effectable.d.ts.map +1 -1
  90. package/dist/Effectable.js +3 -1
  91. package/dist/Effectable.js.map +1 -1
  92. package/dist/Encoding.d.ts +16 -0
  93. package/dist/Encoding.d.ts.map +1 -1
  94. package/dist/Encoding.js +16 -0
  95. package/dist/Encoding.js.map +1 -1
  96. package/dist/Equal.d.ts +52 -40
  97. package/dist/Equal.d.ts.map +1 -1
  98. package/dist/Equal.js +32 -26
  99. package/dist/Equal.js.map +1 -1
  100. package/dist/Equivalence.d.ts +190 -153
  101. package/dist/Equivalence.d.ts.map +1 -1
  102. package/dist/Equivalence.js +129 -104
  103. package/dist/Equivalence.js.map +1 -1
  104. package/dist/ErrorReporter.d.ts +35 -14
  105. package/dist/ErrorReporter.d.ts.map +1 -1
  106. package/dist/ErrorReporter.js +18 -6
  107. package/dist/ErrorReporter.js.map +1 -1
  108. package/dist/ExecutionPlan.d.ts +10 -3
  109. package/dist/ExecutionPlan.d.ts.map +1 -1
  110. package/dist/ExecutionPlan.js +4 -3
  111. package/dist/ExecutionPlan.js.map +1 -1
  112. package/dist/Exit.d.ts +212 -6
  113. package/dist/Exit.d.ts.map +1 -1
  114. package/dist/Exit.js +139 -2
  115. package/dist/Exit.js.map +1 -1
  116. package/dist/Fiber.d.ts +8 -0
  117. package/dist/Fiber.d.ts.map +1 -1
  118. package/dist/Fiber.js +4 -0
  119. package/dist/Fiber.js.map +1 -1
  120. package/dist/FiberHandle.d.ts +46 -23
  121. package/dist/FiberHandle.d.ts.map +1 -1
  122. package/dist/FiberHandle.js +27 -11
  123. package/dist/FiberHandle.js.map +1 -1
  124. package/dist/FiberMap.d.ts +43 -4
  125. package/dist/FiberMap.d.ts.map +1 -1
  126. package/dist/FiberMap.js +27 -4
  127. package/dist/FiberMap.js.map +1 -1
  128. package/dist/FiberSet.d.ts +21 -6
  129. package/dist/FiberSet.d.ts.map +1 -1
  130. package/dist/FiberSet.js +17 -6
  131. package/dist/FiberSet.js.map +1 -1
  132. package/dist/FileSystem.d.ts +64 -0
  133. package/dist/FileSystem.d.ts.map +1 -1
  134. package/dist/FileSystem.js +26 -0
  135. package/dist/FileSystem.js.map +1 -1
  136. package/dist/Filter.d.ts +53 -21
  137. package/dist/Filter.d.ts.map +1 -1
  138. package/dist/Filter.js +20 -9
  139. package/dist/Filter.js.map +1 -1
  140. package/dist/Formatter.d.ts +21 -22
  141. package/dist/Formatter.d.ts.map +1 -1
  142. package/dist/Formatter.js +12 -12
  143. package/dist/Formatter.js.map +1 -1
  144. package/dist/Function.d.ts +67 -75
  145. package/dist/Function.d.ts.map +1 -1
  146. package/dist/Function.js +29 -19
  147. package/dist/Function.js.map +1 -1
  148. package/dist/Graph.d.ts +51 -13
  149. package/dist/Graph.d.ts.map +1 -1
  150. package/dist/Graph.js +19 -3
  151. package/dist/Graph.js.map +1 -1
  152. package/dist/HKT.d.ts +22 -21
  153. package/dist/HKT.d.ts.map +1 -1
  154. package/dist/Hash.d.ts +33 -10
  155. package/dist/Hash.d.ts.map +1 -1
  156. package/dist/Hash.js +27 -10
  157. package/dist/Hash.js.map +1 -1
  158. package/dist/HashMap.d.ts +50 -9
  159. package/dist/HashMap.d.ts.map +1 -1
  160. package/dist/HashMap.js +17 -3
  161. package/dist/HashMap.js.map +1 -1
  162. package/dist/HashRing.d.ts +4 -0
  163. package/dist/HashRing.d.ts.map +1 -1
  164. package/dist/HashRing.js +2 -0
  165. package/dist/HashRing.js.map +1 -1
  166. package/dist/HashSet.d.ts +2 -0
  167. package/dist/HashSet.d.ts.map +1 -1
  168. package/dist/HashSet.js.map +1 -1
  169. package/dist/Inspectable.d.ts +15 -2
  170. package/dist/Inspectable.d.ts.map +1 -1
  171. package/dist/Inspectable.js +11 -2
  172. package/dist/Inspectable.js.map +1 -1
  173. package/dist/Iterable.d.ts +104 -22
  174. package/dist/Iterable.d.ts.map +1 -1
  175. package/dist/Iterable.js +46 -12
  176. package/dist/Iterable.js.map +1 -1
  177. package/dist/JsonPatch.d.ts +61 -80
  178. package/dist/JsonPatch.d.ts.map +1 -1
  179. package/dist/JsonPatch.js +35 -42
  180. package/dist/JsonPatch.js.map +1 -1
  181. package/dist/JsonPointer.d.ts +16 -20
  182. package/dist/JsonPointer.d.ts.map +1 -1
  183. package/dist/JsonPointer.js +16 -20
  184. package/dist/JsonPointer.js.map +1 -1
  185. package/dist/JsonSchema.d.ts +123 -73
  186. package/dist/JsonSchema.d.ts.map +1 -1
  187. package/dist/JsonSchema.js +95 -53
  188. package/dist/JsonSchema.js.map +1 -1
  189. package/dist/Latch.d.ts +28 -2
  190. package/dist/Latch.d.ts.map +1 -1
  191. package/dist/Latch.js +22 -2
  192. package/dist/Latch.js.map +1 -1
  193. package/dist/Layer.d.ts +781 -335
  194. package/dist/Layer.d.ts.map +1 -1
  195. package/dist/Layer.js +324 -129
  196. package/dist/Layer.js.map +1 -1
  197. package/dist/LogLevel.d.ts +86 -13
  198. package/dist/LogLevel.d.ts.map +1 -1
  199. package/dist/LogLevel.js +30 -4
  200. package/dist/LogLevel.js.map +1 -1
  201. package/dist/Logger.d.ts +63 -51
  202. package/dist/Logger.d.ts.map +1 -1
  203. package/dist/Logger.js +61 -51
  204. package/dist/Logger.js.map +1 -1
  205. package/dist/ManagedRuntime.d.ts +12 -0
  206. package/dist/ManagedRuntime.d.ts.map +1 -1
  207. package/dist/ManagedRuntime.js +1 -0
  208. package/dist/ManagedRuntime.js.map +1 -1
  209. package/dist/Match.d.ts +83 -1
  210. package/dist/Match.d.ts.map +1 -1
  211. package/dist/Match.js +31 -1
  212. package/dist/Match.js.map +1 -1
  213. package/dist/Metric.d.ts +89 -12
  214. package/dist/Metric.d.ts.map +1 -1
  215. package/dist/Metric.js +53 -8
  216. package/dist/Metric.js.map +1 -1
  217. package/dist/MutableHashMap.d.ts +14 -0
  218. package/dist/MutableHashMap.d.ts.map +1 -1
  219. package/dist/MutableHashMap.js +4 -0
  220. package/dist/MutableHashMap.js.map +1 -1
  221. package/dist/MutableHashSet.d.ts +2 -0
  222. package/dist/MutableHashSet.d.ts.map +1 -1
  223. package/dist/MutableHashSet.js.map +1 -1
  224. package/dist/MutableList.d.ts +24 -6
  225. package/dist/MutableList.d.ts.map +1 -1
  226. package/dist/MutableList.js +22 -6
  227. package/dist/MutableList.js.map +1 -1
  228. package/dist/MutableRef.d.ts +2 -0
  229. package/dist/MutableRef.d.ts.map +1 -1
  230. package/dist/MutableRef.js.map +1 -1
  231. package/dist/Newtype.d.ts +69 -30
  232. package/dist/Newtype.d.ts.map +1 -1
  233. package/dist/Newtype.js +52 -22
  234. package/dist/Newtype.js.map +1 -1
  235. package/dist/NonEmptyIterable.d.ts +6 -0
  236. package/dist/NonEmptyIterable.d.ts.map +1 -1
  237. package/dist/NonEmptyIterable.js +2 -0
  238. package/dist/NonEmptyIterable.js.map +1 -1
  239. package/dist/Number.d.ts +16 -30
  240. package/dist/Number.d.ts.map +1 -1
  241. package/dist/Number.js +6 -12
  242. package/dist/Number.js.map +1 -1
  243. package/dist/Optic.d.ts +90 -40
  244. package/dist/Optic.d.ts.map +1 -1
  245. package/dist/Optic.js +48 -24
  246. package/dist/Optic.js.map +1 -1
  247. package/dist/Option.d.ts +121 -111
  248. package/dist/Option.d.ts.map +1 -1
  249. package/dist/Option.js +56 -54
  250. package/dist/Option.js.map +1 -1
  251. package/dist/Order.d.ts +169 -167
  252. package/dist/Order.d.ts.map +1 -1
  253. package/dist/Order.js +135 -135
  254. package/dist/Order.js.map +1 -1
  255. package/dist/Ordering.d.ts +4 -0
  256. package/dist/Ordering.d.ts.map +1 -1
  257. package/dist/Ordering.js +2 -0
  258. package/dist/Ordering.js.map +1 -1
  259. package/dist/PartitionedSemaphore.d.ts +7 -5
  260. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  261. package/dist/PartitionedSemaphore.js +5 -5
  262. package/dist/PartitionedSemaphore.js.map +1 -1
  263. package/dist/Path.d.ts +8 -0
  264. package/dist/Path.d.ts.map +1 -1
  265. package/dist/Path.js +4 -0
  266. package/dist/Path.js.map +1 -1
  267. package/dist/Pipeable.d.ts +10 -0
  268. package/dist/Pipeable.d.ts.map +1 -1
  269. package/dist/Pipeable.js +8 -0
  270. package/dist/Pipeable.js.map +1 -1
  271. package/dist/PlatformError.d.ts +12 -0
  272. package/dist/PlatformError.d.ts.map +1 -1
  273. package/dist/PlatformError.js +10 -0
  274. package/dist/PlatformError.js.map +1 -1
  275. package/dist/Pool.d.ts +30 -16
  276. package/dist/Pool.d.ts.map +1 -1
  277. package/dist/Pool.js +30 -16
  278. package/dist/Pool.js.map +1 -1
  279. package/dist/Predicate.d.ts +520 -352
  280. package/dist/Predicate.d.ts.map +1 -1
  281. package/dist/Predicate.js +271 -184
  282. package/dist/Predicate.js.map +1 -1
  283. package/dist/PrimaryKey.d.ts +4 -0
  284. package/dist/PrimaryKey.d.ts.map +1 -1
  285. package/dist/PrimaryKey.js +2 -0
  286. package/dist/PrimaryKey.js.map +1 -1
  287. package/dist/PubSub.d.ts +22 -4
  288. package/dist/PubSub.d.ts.map +1 -1
  289. package/dist/PubSub.js +17 -3
  290. package/dist/PubSub.js.map +1 -1
  291. package/dist/Pull.d.ts +16 -0
  292. package/dist/Pull.d.ts.map +1 -1
  293. package/dist/Pull.js +10 -0
  294. package/dist/Pull.js.map +1 -1
  295. package/dist/Queue.d.ts +44 -0
  296. package/dist/Queue.d.ts.map +1 -1
  297. package/dist/Queue.js +28 -0
  298. package/dist/Queue.js.map +1 -1
  299. package/dist/Random.d.ts +25 -6
  300. package/dist/Random.d.ts.map +1 -1
  301. package/dist/Random.js +11 -2
  302. package/dist/Random.js.map +1 -1
  303. package/dist/RcMap.d.ts +10 -6
  304. package/dist/RcMap.d.ts.map +1 -1
  305. package/dist/RcMap.js +2 -2
  306. package/dist/RcMap.js.map +1 -1
  307. package/dist/RcRef.d.ts +3 -1
  308. package/dist/RcRef.d.ts.map +1 -1
  309. package/dist/RcRef.js.map +1 -1
  310. package/dist/Record.d.ts +24 -3
  311. package/dist/Record.d.ts.map +1 -1
  312. package/dist/Record.js +12 -3
  313. package/dist/Record.js.map +1 -1
  314. package/dist/Redactable.d.ts +54 -41
  315. package/dist/Redactable.d.ts.map +1 -1
  316. package/dist/Redactable.js +42 -32
  317. package/dist/Redactable.js.map +1 -1
  318. package/dist/Redacted.d.ts +10 -0
  319. package/dist/Redacted.d.ts.map +1 -1
  320. package/dist/Redacted.js +6 -0
  321. package/dist/Redacted.js.map +1 -1
  322. package/dist/Reducer.d.ts +20 -11
  323. package/dist/Reducer.d.ts.map +1 -1
  324. package/dist/Reducer.js +10 -6
  325. package/dist/Reducer.js.map +1 -1
  326. package/dist/Ref.d.ts +45 -24
  327. package/dist/Ref.d.ts.map +1 -1
  328. package/dist/Ref.js +41 -21
  329. package/dist/Ref.js.map +1 -1
  330. package/dist/References.d.ts +18 -1
  331. package/dist/References.d.ts.map +1 -1
  332. package/dist/References.js +17 -1
  333. package/dist/References.js.map +1 -1
  334. package/dist/Request.d.ts +3 -3
  335. package/dist/Request.js +2 -2
  336. package/dist/RequestResolver.d.ts +7 -17
  337. package/dist/RequestResolver.d.ts.map +1 -1
  338. package/dist/RequestResolver.js +3 -5
  339. package/dist/RequestResolver.js.map +1 -1
  340. package/dist/Resource.d.ts +2 -0
  341. package/dist/Resource.d.ts.map +1 -1
  342. package/dist/Resource.js +2 -0
  343. package/dist/Resource.js.map +1 -1
  344. package/dist/Result.d.ts +188 -6
  345. package/dist/Result.d.ts.map +1 -1
  346. package/dist/Result.js +84 -2
  347. package/dist/Result.js.map +1 -1
  348. package/dist/Runtime.d.ts +14 -11
  349. package/dist/Runtime.d.ts.map +1 -1
  350. package/dist/Runtime.js +11 -9
  351. package/dist/Runtime.js.map +1 -1
  352. package/dist/Schedule.d.ts +27 -3
  353. package/dist/Schedule.d.ts.map +1 -1
  354. package/dist/Schedule.js +21 -2
  355. package/dist/Schedule.js.map +1 -1
  356. package/dist/Scheduler.d.ts +22 -19
  357. package/dist/Scheduler.d.ts.map +1 -1
  358. package/dist/Scheduler.js +14 -12
  359. package/dist/Scheduler.js.map +1 -1
  360. package/dist/Schema.d.ts +547 -130
  361. package/dist/Schema.d.ts.map +1 -1
  362. package/dist/Schema.js +409 -121
  363. package/dist/Schema.js.map +1 -1
  364. package/dist/SchemaAST.d.ts +123 -65
  365. package/dist/SchemaAST.d.ts.map +1 -1
  366. package/dist/SchemaAST.js +90 -39
  367. package/dist/SchemaAST.js.map +1 -1
  368. package/dist/SchemaGetter.d.ts +269 -234
  369. package/dist/SchemaGetter.d.ts.map +1 -1
  370. package/dist/SchemaGetter.js +245 -215
  371. package/dist/SchemaGetter.js.map +1 -1
  372. package/dist/SchemaIssue.d.ts +48 -46
  373. package/dist/SchemaIssue.d.ts.map +1 -1
  374. package/dist/SchemaIssue.js +34 -34
  375. package/dist/SchemaIssue.js.map +1 -1
  376. package/dist/SchemaParser.d.ts +58 -0
  377. package/dist/SchemaParser.d.ts.map +1 -1
  378. package/dist/SchemaParser.js +58 -0
  379. package/dist/SchemaParser.js.map +1 -1
  380. package/dist/SchemaRepresentation.d.ts +198 -96
  381. package/dist/SchemaRepresentation.d.ts.map +1 -1
  382. package/dist/SchemaRepresentation.js +107 -45
  383. package/dist/SchemaRepresentation.js.map +1 -1
  384. package/dist/SchemaTransformation.d.ts +272 -203
  385. package/dist/SchemaTransformation.d.ts.map +1 -1
  386. package/dist/SchemaTransformation.js +249 -187
  387. package/dist/SchemaTransformation.js.map +1 -1
  388. package/dist/SchemaUtils.d.ts +2 -0
  389. package/dist/SchemaUtils.d.ts.map +1 -1
  390. package/dist/SchemaUtils.js +2 -0
  391. package/dist/SchemaUtils.js.map +1 -1
  392. package/dist/Scope.d.ts +18 -0
  393. package/dist/Scope.d.ts.map +1 -1
  394. package/dist/Scope.js +12 -0
  395. package/dist/Scope.js.map +1 -1
  396. package/dist/ScopedCache.d.ts +44 -0
  397. package/dist/ScopedCache.d.ts.map +1 -1
  398. package/dist/ScopedCache.js +18 -0
  399. package/dist/ScopedCache.js.map +1 -1
  400. package/dist/ScopedRef.d.ts +9 -3
  401. package/dist/ScopedRef.d.ts.map +1 -1
  402. package/dist/ScopedRef.js +3 -1
  403. package/dist/ScopedRef.js.map +1 -1
  404. package/dist/Semaphore.d.ts +6 -0
  405. package/dist/Semaphore.d.ts.map +1 -1
  406. package/dist/Semaphore.js +4 -0
  407. package/dist/Semaphore.js.map +1 -1
  408. package/dist/Sink.d.ts +108 -0
  409. package/dist/Sink.d.ts.map +1 -1
  410. package/dist/Sink.js +54 -0
  411. package/dist/Sink.js.map +1 -1
  412. package/dist/Stdio.d.ts +7 -3
  413. package/dist/Stdio.d.ts.map +1 -1
  414. package/dist/Stdio.js +2 -0
  415. package/dist/Stdio.js.map +1 -1
  416. package/dist/Stream.d.ts +416 -16
  417. package/dist/Stream.d.ts.map +1 -1
  418. package/dist/Stream.js +164 -8
  419. package/dist/Stream.js.map +1 -1
  420. package/dist/String.d.ts +14 -0
  421. package/dist/String.d.ts.map +1 -1
  422. package/dist/String.js +6 -0
  423. package/dist/String.js.map +1 -1
  424. package/dist/Struct.d.ts +371 -191
  425. package/dist/Struct.d.ts.map +1 -1
  426. package/dist/Struct.js +144 -77
  427. package/dist/Struct.js.map +1 -1
  428. package/dist/SubscriptionRef.d.ts +7 -1
  429. package/dist/SubscriptionRef.d.ts.map +1 -1
  430. package/dist/SubscriptionRef.js +5 -1
  431. package/dist/SubscriptionRef.js.map +1 -1
  432. package/dist/SynchronizedRef.d.ts +2 -0
  433. package/dist/SynchronizedRef.d.ts.map +1 -1
  434. package/dist/SynchronizedRef.js +2 -0
  435. package/dist/SynchronizedRef.js.map +1 -1
  436. package/dist/Tracer.d.ts +17 -27
  437. package/dist/Tracer.d.ts.map +1 -1
  438. package/dist/Tracer.js +8 -12
  439. package/dist/Tracer.js.map +1 -1
  440. package/dist/Trie.d.ts +23 -9
  441. package/dist/Trie.d.ts.map +1 -1
  442. package/dist/Trie.js +13 -3
  443. package/dist/Trie.js.map +1 -1
  444. package/dist/Tuple.d.ts +287 -144
  445. package/dist/Tuple.d.ts.map +1 -1
  446. package/dist/Tuple.js +135 -66
  447. package/dist/Tuple.js.map +1 -1
  448. package/dist/TxChunk.d.ts +182 -93
  449. package/dist/TxChunk.d.ts.map +1 -1
  450. package/dist/TxChunk.js +68 -35
  451. package/dist/TxChunk.js.map +1 -1
  452. package/dist/TxDeferred.d.ts +3 -4
  453. package/dist/TxDeferred.d.ts.map +1 -1
  454. package/dist/TxDeferred.js.map +1 -1
  455. package/dist/TxHashMap.d.ts +163 -86
  456. package/dist/TxHashMap.d.ts.map +1 -1
  457. package/dist/TxHashMap.js +57 -30
  458. package/dist/TxHashMap.js.map +1 -1
  459. package/dist/TxHashSet.d.ts +24 -27
  460. package/dist/TxHashSet.d.ts.map +1 -1
  461. package/dist/TxHashSet.js +9 -6
  462. package/dist/TxHashSet.js.map +1 -1
  463. package/dist/TxPriorityQueue.d.ts +2 -0
  464. package/dist/TxPriorityQueue.d.ts.map +1 -1
  465. package/dist/TxPriorityQueue.js.map +1 -1
  466. package/dist/TxPubSub.d.ts +36 -35
  467. package/dist/TxPubSub.d.ts.map +1 -1
  468. package/dist/TxPubSub.js +22 -21
  469. package/dist/TxPubSub.js.map +1 -1
  470. package/dist/TxQueue.d.ts +77 -114
  471. package/dist/TxQueue.d.ts.map +1 -1
  472. package/dist/TxQueue.js +45 -62
  473. package/dist/TxQueue.js.map +1 -1
  474. package/dist/TxRef.d.ts +4 -0
  475. package/dist/TxRef.d.ts.map +1 -1
  476. package/dist/TxRef.js +2 -0
  477. package/dist/TxRef.js.map +1 -1
  478. package/dist/TxSemaphore.d.ts +66 -27
  479. package/dist/TxSemaphore.d.ts.map +1 -1
  480. package/dist/TxSemaphore.js +38 -15
  481. package/dist/TxSemaphore.js.map +1 -1
  482. package/dist/Types.d.ts +202 -75
  483. package/dist/Types.d.ts.map +1 -1
  484. package/dist/UndefinedOr.d.ts +31 -29
  485. package/dist/UndefinedOr.d.ts.map +1 -1
  486. package/dist/UndefinedOr.js +27 -21
  487. package/dist/UndefinedOr.js.map +1 -1
  488. package/dist/Unify.d.ts +28 -0
  489. package/dist/Unify.d.ts.map +1 -1
  490. package/dist/Unify.js +2 -0
  491. package/dist/Unify.js.map +1 -1
  492. package/dist/Utils.d.ts +29 -35
  493. package/dist/Utils.d.ts.map +1 -1
  494. package/dist/Utils.js +11 -13
  495. package/dist/Utils.js.map +1 -1
  496. package/dist/index.d.ts +18 -7
  497. package/dist/index.d.ts.map +1 -1
  498. package/dist/index.js +18 -7
  499. package/dist/index.js.map +1 -1
  500. package/dist/testing/TestClock.d.ts +17 -17
  501. package/dist/testing/TestClock.js +1 -1
  502. package/dist/testing/TestClock.js.map +1 -1
  503. package/dist/testing/TestConsole.d.ts +2 -0
  504. package/dist/testing/TestConsole.d.ts.map +1 -1
  505. package/dist/testing/TestConsole.js.map +1 -1
  506. package/dist/testing/TestSchema.d.ts +43 -55
  507. package/dist/testing/TestSchema.d.ts.map +1 -1
  508. package/dist/testing/TestSchema.js +43 -55
  509. package/dist/testing/TestSchema.js.map +1 -1
  510. package/dist/unstable/ai/AiError.d.ts +62 -11
  511. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  512. package/dist/unstable/ai/AiError.js +58 -11
  513. package/dist/unstable/ai/AiError.js.map +1 -1
  514. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +4 -4
  515. package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -4
  516. package/dist/unstable/ai/Chat.d.ts +29 -1
  517. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  518. package/dist/unstable/ai/Chat.js +15 -1
  519. package/dist/unstable/ai/Chat.js.map +1 -1
  520. package/dist/unstable/ai/IdGenerator.d.ts +10 -0
  521. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  522. package/dist/unstable/ai/IdGenerator.js +8 -0
  523. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  524. package/dist/unstable/ai/LanguageModel.d.ts +32 -46
  525. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  526. package/dist/unstable/ai/LanguageModel.js +5 -14
  527. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  528. package/dist/unstable/ai/McpSchema.d.ts +84 -32
  529. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  530. package/dist/unstable/ai/McpSchema.js +73 -28
  531. package/dist/unstable/ai/McpSchema.js.map +1 -1
  532. package/dist/unstable/ai/McpServer.d.ts +8 -0
  533. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  534. package/dist/unstable/ai/McpServer.js +6 -0
  535. package/dist/unstable/ai/McpServer.js.map +1 -1
  536. package/dist/unstable/ai/Model.d.ts +9 -5
  537. package/dist/unstable/ai/Model.d.ts.map +1 -1
  538. package/dist/unstable/ai/Model.js +4 -0
  539. package/dist/unstable/ai/Model.js.map +1 -1
  540. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +3 -2
  541. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  542. package/dist/unstable/ai/OpenAiStructuredOutput.js +3 -2
  543. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  544. package/dist/unstable/ai/Prompt.d.ts +62 -35
  545. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  546. package/dist/unstable/ai/Prompt.js +16 -15
  547. package/dist/unstable/ai/Prompt.js.map +1 -1
  548. package/dist/unstable/ai/Response.d.ts +40 -21
  549. package/dist/unstable/ai/Response.d.ts.map +1 -1
  550. package/dist/unstable/ai/Response.js +10 -0
  551. package/dist/unstable/ai/Response.js.map +1 -1
  552. package/dist/unstable/ai/ResponseIdTracker.d.ts +8 -0
  553. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
  554. package/dist/unstable/ai/ResponseIdTracker.js +4 -0
  555. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  556. package/dist/unstable/ai/Telemetry.d.ts +30 -5
  557. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  558. package/dist/unstable/ai/Telemetry.js +7 -1
  559. package/dist/unstable/ai/Telemetry.js.map +1 -1
  560. package/dist/unstable/ai/Tokenizer.d.ts +6 -0
  561. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  562. package/dist/unstable/ai/Tokenizer.js +4 -0
  563. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  564. package/dist/unstable/ai/Tool.d.ts +68 -0
  565. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  566. package/dist/unstable/ai/Tool.js +36 -0
  567. package/dist/unstable/ai/Tool.js.map +1 -1
  568. package/dist/unstable/ai/Toolkit.d.ts +12 -0
  569. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  570. package/dist/unstable/ai/Toolkit.js +6 -0
  571. package/dist/unstable/ai/Toolkit.js.map +1 -1
  572. package/dist/unstable/cli/Argument.d.ts +14 -4
  573. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  574. package/dist/unstable/cli/Argument.js +4 -0
  575. package/dist/unstable/cli/Argument.js.map +1 -1
  576. package/dist/unstable/cli/CliError.d.ts +6 -0
  577. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  578. package/dist/unstable/cli/CliError.js +4 -0
  579. package/dist/unstable/cli/CliError.js.map +1 -1
  580. package/dist/unstable/cli/Command.d.ts +123 -12
  581. package/dist/unstable/cli/Command.d.ts.map +1 -1
  582. package/dist/unstable/cli/Command.js +57 -4
  583. package/dist/unstable/cli/Command.js.map +1 -1
  584. package/dist/unstable/cli/Flag.d.ts +31 -14
  585. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  586. package/dist/unstable/cli/Flag.js +23 -10
  587. package/dist/unstable/cli/Flag.js.map +1 -1
  588. package/dist/unstable/cli/Param.d.ts +10 -0
  589. package/dist/unstable/cli/Param.d.ts.map +1 -1
  590. package/dist/unstable/cli/Param.js +46 -5
  591. package/dist/unstable/cli/Param.js.map +1 -1
  592. package/dist/unstable/cli/Primitive.d.ts +10 -0
  593. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  594. package/dist/unstable/cli/Primitive.js +10 -0
  595. package/dist/unstable/cli/Primitive.js.map +1 -1
  596. package/dist/unstable/cli/Prompt.d.ts +47 -40
  597. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  598. package/dist/unstable/cli/Prompt.js +25 -20
  599. package/dist/unstable/cli/Prompt.js.map +1 -1
  600. package/dist/unstable/cli/internal/command.d.ts +1 -0
  601. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  602. package/dist/unstable/cli/internal/command.js +10 -2
  603. package/dist/unstable/cli/internal/command.js.map +1 -1
  604. package/dist/unstable/cli/internal/completions/descriptor.js +3 -0
  605. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  606. package/dist/unstable/cli/internal/parser.js +8 -1
  607. package/dist/unstable/cli/internal/parser.js.map +1 -1
  608. package/dist/unstable/cluster/ClusterCron.d.ts +10 -1
  609. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  610. package/dist/unstable/cluster/ClusterCron.js +2 -0
  611. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  612. package/dist/unstable/cluster/ClusterSchema.d.ts +8 -0
  613. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  614. package/dist/unstable/cluster/ClusterSchema.js +8 -0
  615. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  616. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +4 -0
  617. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  618. package/dist/unstable/cluster/ClusterWorkflowEngine.js +4 -0
  619. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  620. package/dist/unstable/cluster/DeliverAt.d.ts +3 -4
  621. package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
  622. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  623. package/dist/unstable/cluster/Entity.d.ts +24 -0
  624. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  625. package/dist/unstable/cluster/Entity.js +12 -0
  626. package/dist/unstable/cluster/Entity.js.map +1 -1
  627. package/dist/unstable/cluster/EntityProxy.d.ts +10 -4
  628. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  629. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  630. package/dist/unstable/cluster/EntityProxyServer.d.ts +6 -0
  631. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  632. package/dist/unstable/cluster/EntityProxyServer.js +4 -0
  633. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  634. package/dist/unstable/cluster/EntityResource.d.ts +10 -0
  635. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  636. package/dist/unstable/cluster/EntityResource.js +8 -0
  637. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  638. package/dist/unstable/cluster/Envelope.d.ts +16 -0
  639. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  640. package/dist/unstable/cluster/Envelope.js +10 -0
  641. package/dist/unstable/cluster/Envelope.js.map +1 -1
  642. package/dist/unstable/cluster/HttpRunner.d.ts +16 -0
  643. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  644. package/dist/unstable/cluster/HttpRunner.js +16 -0
  645. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  646. package/dist/unstable/cluster/K8sHttpClient.d.ts +8 -0
  647. package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
  648. package/dist/unstable/cluster/K8sHttpClient.js +8 -0
  649. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  650. package/dist/unstable/cluster/Message.d.ts +24 -0
  651. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  652. package/dist/unstable/cluster/Message.js +18 -0
  653. package/dist/unstable/cluster/Message.js.map +1 -1
  654. package/dist/unstable/cluster/MessageStorage.d.ts +64 -20
  655. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  656. package/dist/unstable/cluster/MessageStorage.js +8 -0
  657. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  658. package/dist/unstable/cluster/Reply.d.ts +6 -6
  659. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  660. package/dist/unstable/cluster/Reply.js +4 -3
  661. package/dist/unstable/cluster/Reply.js.map +1 -1
  662. package/dist/unstable/cluster/Runner.d.ts +2 -0
  663. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  664. package/dist/unstable/cluster/Runner.js +2 -0
  665. package/dist/unstable/cluster/Runner.js.map +1 -1
  666. package/dist/unstable/cluster/RunnerHealth.d.ts +13 -2
  667. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  668. package/dist/unstable/cluster/RunnerHealth.js +13 -2
  669. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  670. package/dist/unstable/cluster/RunnerServer.d.ts +8 -8
  671. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  672. package/dist/unstable/cluster/RunnerServer.js +8 -8
  673. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  674. package/dist/unstable/cluster/RunnerStorage.d.ts +2 -0
  675. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  676. package/dist/unstable/cluster/RunnerStorage.js +2 -0
  677. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  678. package/dist/unstable/cluster/ShardId.d.ts +4 -0
  679. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  680. package/dist/unstable/cluster/ShardId.js +4 -0
  681. package/dist/unstable/cluster/ShardId.js.map +1 -1
  682. package/dist/unstable/cluster/Snowflake.d.ts +2 -0
  683. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  684. package/dist/unstable/cluster/Snowflake.js +2 -0
  685. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  686. package/dist/unstable/cluster/TestRunner.d.ts +3 -2
  687. package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
  688. package/dist/unstable/cluster/TestRunner.js +3 -2
  689. package/dist/unstable/cluster/TestRunner.js.map +1 -1
  690. package/dist/unstable/devtools/DevToolsSchema.d.ts +34 -2
  691. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  692. package/dist/unstable/devtools/DevToolsSchema.js +14 -0
  693. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  694. package/dist/unstable/devtools/DevToolsServer.d.ts +4 -0
  695. package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
  696. package/dist/unstable/devtools/DevToolsServer.js +2 -0
  697. package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
  698. package/dist/unstable/encoding/Msgpack.d.ts +24 -0
  699. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  700. package/dist/unstable/encoding/Msgpack.js +18 -0
  701. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  702. package/dist/unstable/encoding/Ndjson.d.ts +46 -2
  703. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  704. package/dist/unstable/encoding/Ndjson.js +30 -2
  705. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  706. package/dist/unstable/encoding/Sse.d.ts +24 -17
  707. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  708. package/dist/unstable/encoding/Sse.js +20 -11
  709. package/dist/unstable/encoding/Sse.js.map +1 -1
  710. package/dist/unstable/eventlog/Event.d.ts +16 -0
  711. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  712. package/dist/unstable/eventlog/Event.js.map +1 -1
  713. package/dist/unstable/eventlog/EventGroup.d.ts +4 -0
  714. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  715. package/dist/unstable/eventlog/EventGroup.js +2 -0
  716. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  717. package/dist/unstable/eventlog/EventJournal.d.ts +20 -0
  718. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  719. package/dist/unstable/eventlog/EventJournal.js +18 -0
  720. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  721. package/dist/unstable/eventlog/EventLog.d.ts +22 -0
  722. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  723. package/dist/unstable/eventlog/EventLog.js +18 -0
  724. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  725. package/dist/unstable/eventlog/EventLogMessage.d.ts +10 -0
  726. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  727. package/dist/unstable/eventlog/EventLogMessage.js +10 -0
  728. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  729. package/dist/unstable/eventlog/EventLogRemote.d.ts +4 -0
  730. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  731. package/dist/unstable/eventlog/EventLogRemote.js +4 -0
  732. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  733. package/dist/unstable/eventlog/EventLogServer.d.ts +4 -0
  734. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  735. package/dist/unstable/eventlog/EventLogServer.js +4 -0
  736. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  737. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +6 -0
  738. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  739. package/dist/unstable/eventlog/EventLogServerEncrypted.js +6 -0
  740. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  741. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +8 -0
  742. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  743. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +8 -0
  744. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  745. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +11 -1
  746. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
  747. package/dist/unstable/eventlog/EventLogSessionAuth.js +11 -1
  748. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
  749. package/dist/unstable/eventlog/SqlEventJournal.d.ts +2 -0
  750. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  751. package/dist/unstable/eventlog/SqlEventJournal.js +2 -0
  752. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  753. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +2 -0
  754. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
  755. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +2 -0
  756. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
  757. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +2 -0
  758. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  759. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +2 -0
  760. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  761. package/dist/unstable/http/Cookies.d.ts +34 -0
  762. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  763. package/dist/unstable/http/Cookies.js +18 -0
  764. package/dist/unstable/http/Cookies.js.map +1 -1
  765. package/dist/unstable/http/Etag.d.ts +4 -0
  766. package/dist/unstable/http/Etag.d.ts.map +1 -1
  767. package/dist/unstable/http/Etag.js.map +1 -1
  768. package/dist/unstable/http/FetchHttpClient.d.ts +4 -0
  769. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  770. package/dist/unstable/http/FetchHttpClient.js +4 -0
  771. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  772. package/dist/unstable/http/Headers.d.ts +60 -0
  773. package/dist/unstable/http/Headers.d.ts.map +1 -1
  774. package/dist/unstable/http/Headers.js +24 -0
  775. package/dist/unstable/http/Headers.js.map +1 -1
  776. package/dist/unstable/http/HttpBody.d.ts +32 -0
  777. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  778. package/dist/unstable/http/HttpBody.js +22 -0
  779. package/dist/unstable/http/HttpBody.js.map +1 -1
  780. package/dist/unstable/http/HttpClient.d.ts +44 -0
  781. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  782. package/dist/unstable/http/HttpClient.js +14 -0
  783. package/dist/unstable/http/HttpClient.js.map +1 -1
  784. package/dist/unstable/http/HttpClientRequest.d.ts +2 -0
  785. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  786. package/dist/unstable/http/HttpClientRequest.js +2 -0
  787. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  788. package/dist/unstable/http/HttpClientResponse.d.ts +6 -0
  789. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  790. package/dist/unstable/http/HttpClientResponse.js +6 -0
  791. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  792. package/dist/unstable/http/HttpEffect.d.ts +4 -0
  793. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  794. package/dist/unstable/http/HttpEffect.js +4 -0
  795. package/dist/unstable/http/HttpEffect.js.map +1 -1
  796. package/dist/unstable/http/HttpPlatform.d.ts +2 -0
  797. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  798. package/dist/unstable/http/HttpPlatform.js +2 -0
  799. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  800. package/dist/unstable/http/HttpRouter.d.ts +54 -16
  801. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  802. package/dist/unstable/http/HttpRouter.js +26 -1
  803. package/dist/unstable/http/HttpRouter.js.map +1 -1
  804. package/dist/unstable/http/HttpServer.d.ts +35 -1
  805. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  806. package/dist/unstable/http/HttpServer.js +17 -1
  807. package/dist/unstable/http/HttpServer.js.map +1 -1
  808. package/dist/unstable/http/HttpServerError.d.ts +17 -3
  809. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  810. package/dist/unstable/http/HttpServerError.js +16 -0
  811. package/dist/unstable/http/HttpServerError.js.map +1 -1
  812. package/dist/unstable/http/HttpServerRequest.d.ts +30 -0
  813. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  814. package/dist/unstable/http/HttpServerRequest.js +28 -0
  815. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  816. package/dist/unstable/http/HttpServerRespondable.d.ts +8 -0
  817. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  818. package/dist/unstable/http/HttpServerRespondable.js +6 -0
  819. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  820. package/dist/unstable/http/HttpServerResponse.d.ts +96 -0
  821. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  822. package/dist/unstable/http/HttpServerResponse.js +50 -0
  823. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  824. package/dist/unstable/http/HttpTraceContext.d.ts +12 -0
  825. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  826. package/dist/unstable/http/HttpTraceContext.js +10 -0
  827. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  828. package/dist/unstable/http/Multipart.d.ts +49 -2
  829. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  830. package/dist/unstable/http/Multipart.js +35 -2
  831. package/dist/unstable/http/Multipart.js.map +1 -1
  832. package/dist/unstable/http/Template.d.ts +14 -0
  833. package/dist/unstable/http/Template.d.ts.map +1 -1
  834. package/dist/unstable/http/Template.js +4 -0
  835. package/dist/unstable/http/Template.js.map +1 -1
  836. package/dist/unstable/http/UrlParams.d.ts +64 -0
  837. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  838. package/dist/unstable/http/UrlParams.js +28 -0
  839. package/dist/unstable/http/UrlParams.js.map +1 -1
  840. package/dist/unstable/httpapi/HttpApi.d.ts +10 -4
  841. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  842. package/dist/unstable/httpapi/HttpApi.js +4 -0
  843. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  844. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +9 -4
  845. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  846. package/dist/unstable/httpapi/HttpApiBuilder.js +5 -4
  847. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  848. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +2 -0
  849. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  850. package/dist/unstable/httpapi/HttpApiEndpoint.js +2 -0
  851. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  852. package/dist/unstable/httpapi/HttpApiGroup.d.ts +23 -14
  853. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  854. package/dist/unstable/httpapi/HttpApiGroup.js +6 -3
  855. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  856. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +14 -0
  857. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  858. package/dist/unstable/httpapi/HttpApiMiddleware.js +6 -0
  859. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  860. package/dist/unstable/httpapi/HttpApiScalar.d.ts +38 -15
  861. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  862. package/dist/unstable/httpapi/HttpApiScalar.js +4 -0
  863. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  864. package/dist/unstable/httpapi/HttpApiSchema.d.ts +14 -3
  865. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  866. package/dist/unstable/httpapi/HttpApiSchema.js +10 -0
  867. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  868. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +17 -11
  869. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  870. package/dist/unstable/httpapi/HttpApiSecurity.js +17 -11
  871. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  872. package/dist/unstable/httpapi/HttpApiSwagger.d.ts +2 -4
  873. package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
  874. package/dist/unstable/httpapi/HttpApiSwagger.js +2 -4
  875. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  876. package/dist/unstable/httpapi/HttpApiTest.d.ts +2 -0
  877. package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
  878. package/dist/unstable/httpapi/HttpApiTest.js +2 -0
  879. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  880. package/dist/unstable/httpapi/OpenApi.d.ts +2 -0
  881. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  882. package/dist/unstable/httpapi/OpenApi.js +2 -0
  883. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  884. package/dist/unstable/observability/Otlp.d.ts +2 -0
  885. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  886. package/dist/unstable/observability/Otlp.js +2 -0
  887. package/dist/unstable/observability/Otlp.js.map +1 -1
  888. package/dist/unstable/observability/OtlpExporter.d.ts +2 -0
  889. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  890. package/dist/unstable/observability/OtlpExporter.js +2 -0
  891. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  892. package/dist/unstable/observability/OtlpLogger.d.ts +4 -0
  893. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  894. package/dist/unstable/observability/OtlpLogger.js +4 -0
  895. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  896. package/dist/unstable/observability/OtlpMetrics.d.ts +8 -9
  897. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  898. package/dist/unstable/observability/OtlpMetrics.js +3 -3
  899. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  900. package/dist/unstable/observability/OtlpResource.d.ts +8 -0
  901. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  902. package/dist/unstable/observability/OtlpResource.js +8 -0
  903. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  904. package/dist/unstable/observability/OtlpTracer.d.ts +3 -2
  905. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  906. package/dist/unstable/observability/OtlpTracer.js +3 -2
  907. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  908. package/dist/unstable/observability/PrometheusMetrics.d.ts +6 -2
  909. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  910. package/dist/unstable/observability/PrometheusMetrics.js +6 -2
  911. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  912. package/dist/unstable/persistence/KeyValueStore.d.ts +10 -0
  913. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  914. package/dist/unstable/persistence/KeyValueStore.js +8 -0
  915. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  916. package/dist/unstable/persistence/Persistable.d.ts +2 -0
  917. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  918. package/dist/unstable/persistence/Persistable.js +2 -0
  919. package/dist/unstable/persistence/Persistable.js.map +1 -1
  920. package/dist/unstable/persistence/PersistedCache.d.ts +2 -0
  921. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  922. package/dist/unstable/persistence/PersistedCache.js +2 -0
  923. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  924. package/dist/unstable/persistence/PersistedQueue.d.ts +21 -6
  925. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  926. package/dist/unstable/persistence/PersistedQueue.js +10 -0
  927. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  928. package/dist/unstable/persistence/Persistence.d.ts +14 -0
  929. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  930. package/dist/unstable/persistence/Persistence.js +14 -0
  931. package/dist/unstable/persistence/Persistence.js.map +1 -1
  932. package/dist/unstable/persistence/RateLimiter.d.ts +6 -3
  933. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  934. package/dist/unstable/persistence/RateLimiter.js +4 -0
  935. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  936. package/dist/unstable/persistence/Redis.d.ts +6 -0
  937. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  938. package/dist/unstable/persistence/Redis.js +4 -0
  939. package/dist/unstable/persistence/Redis.js.map +1 -1
  940. package/dist/unstable/process/ChildProcess.d.ts +70 -19
  941. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  942. package/dist/unstable/process/ChildProcess.js +10 -0
  943. package/dist/unstable/process/ChildProcess.js.map +1 -1
  944. package/dist/unstable/process/ChildProcessSpawner.d.ts +20 -4
  945. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  946. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  947. package/dist/unstable/reactivity/Atom.d.ts +105 -14
  948. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  949. package/dist/unstable/reactivity/Atom.js +53 -8
  950. package/dist/unstable/reactivity/Atom.js.map +1 -1
  951. package/dist/unstable/reactivity/AtomHttpApi.d.ts +4 -0
  952. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  953. package/dist/unstable/reactivity/AtomHttpApi.js +2 -0
  954. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  955. package/dist/unstable/reactivity/AtomRef.d.ts +8 -0
  956. package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
  957. package/dist/unstable/reactivity/AtomRef.js +2 -0
  958. package/dist/unstable/reactivity/AtomRef.js.map +1 -1
  959. package/dist/unstable/reactivity/AtomRegistry.d.ts +32 -0
  960. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  961. package/dist/unstable/reactivity/AtomRegistry.js +12 -0
  962. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  963. package/dist/unstable/reactivity/AtomRpc.d.ts +8 -6
  964. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  965. package/dist/unstable/reactivity/AtomRpc.js +4 -3
  966. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  967. package/dist/unstable/reactivity/Hydration.d.ts +6 -0
  968. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  969. package/dist/unstable/reactivity/Hydration.js +4 -0
  970. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  971. package/dist/unstable/reactivity/Reactivity.d.ts +27 -3
  972. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  973. package/dist/unstable/reactivity/Reactivity.js +15 -3
  974. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  975. package/dist/unstable/rpc/Rpc.d.ts +38 -2
  976. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  977. package/dist/unstable/rpc/Rpc.js +12 -2
  978. package/dist/unstable/rpc/Rpc.js.map +1 -1
  979. package/dist/unstable/rpc/RpcSerialization.d.ts +6 -0
  980. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  981. package/dist/unstable/rpc/RpcSerialization.js +6 -0
  982. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  983. package/dist/unstable/rpc/RpcServer.d.ts +5 -3
  984. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  985. package/dist/unstable/rpc/RpcServer.js +5 -3
  986. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  987. package/dist/unstable/schema/Model.d.ts +43 -12
  988. package/dist/unstable/schema/Model.d.ts.map +1 -1
  989. package/dist/unstable/schema/Model.js +41 -12
  990. package/dist/unstable/schema/Model.js.map +1 -1
  991. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  992. package/dist/unstable/sql/SqlResolver.d.ts +6 -4
  993. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  994. package/dist/unstable/sql/SqlResolver.js +6 -4
  995. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  996. package/dist/unstable/sql/Statement.d.ts +8 -4
  997. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  998. package/dist/unstable/sql/Statement.js.map +1 -1
  999. package/dist/unstable/workflow/DurableClock.d.ts +1 -1
  1000. package/dist/unstable/workflow/DurableDeferred.d.ts +3 -0
  1001. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  1002. package/dist/unstable/workflow/DurableDeferred.js +3 -0
  1003. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1004. package/dist/unstable/workflow/Workflow.d.ts +42 -34
  1005. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1006. package/dist/unstable/workflow/Workflow.js +18 -19
  1007. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1008. package/package.json +1 -1
  1009. package/src/Array.ts +454 -0
  1010. package/src/BigDecimal.ts +87 -33
  1011. package/src/BigInt.ts +71 -14
  1012. package/src/Boolean.ts +4 -0
  1013. package/src/Brand.ts +16 -11
  1014. package/src/Cache.ts +17 -1
  1015. package/src/Cause.ts +95 -3
  1016. package/src/Channel.ts +326 -0
  1017. package/src/ChannelSchema.ts +24 -0
  1018. package/src/Chunk.ts +59 -22
  1019. package/src/Combiner.ts +75 -71
  1020. package/src/Config.ts +167 -46
  1021. package/src/ConfigProvider.ts +235 -158
  1022. package/src/Console.ts +25 -99
  1023. package/src/Context.ts +4 -4
  1024. package/src/Cron.ts +42 -16
  1025. package/src/Crypto.ts +6 -0
  1026. package/src/Data.ts +132 -70
  1027. package/src/DateTime.ts +227 -14
  1028. package/src/Deferred.ts +94 -27
  1029. package/src/Differ.ts +2 -0
  1030. package/src/Duration.ts +64 -6
  1031. package/src/Effect.ts +909 -605
  1032. package/src/Effectable.ts +3 -1
  1033. package/src/Encoding.ts +16 -0
  1034. package/src/Equal.ts +52 -40
  1035. package/src/Equivalence.ts +190 -153
  1036. package/src/ErrorReporter.ts +35 -14
  1037. package/src/ExecutionPlan.ts +10 -3
  1038. package/src/Exit.ts +212 -6
  1039. package/src/Fiber.ts +8 -0
  1040. package/src/FiberHandle.ts +46 -23
  1041. package/src/FiberMap.ts +43 -4
  1042. package/src/FiberSet.ts +21 -6
  1043. package/src/FileSystem.ts +64 -0
  1044. package/src/Filter.ts +53 -21
  1045. package/src/Formatter.ts +21 -22
  1046. package/src/Function.ts +67 -75
  1047. package/src/Graph.ts +51 -13
  1048. package/src/HKT.ts +22 -21
  1049. package/src/Hash.ts +33 -10
  1050. package/src/HashMap.ts +50 -9
  1051. package/src/HashRing.ts +4 -0
  1052. package/src/HashSet.ts +2 -0
  1053. package/src/Inspectable.ts +15 -2
  1054. package/src/Iterable.ts +104 -22
  1055. package/src/JsonPatch.ts +61 -80
  1056. package/src/JsonPointer.ts +16 -20
  1057. package/src/JsonSchema.ts +123 -73
  1058. package/src/Latch.ts +28 -2
  1059. package/src/Layer.ts +781 -335
  1060. package/src/LogLevel.ts +86 -13
  1061. package/src/Logger.ts +71 -51
  1062. package/src/ManagedRuntime.ts +12 -0
  1063. package/src/Match.ts +83 -1
  1064. package/src/Metric.ts +105 -12
  1065. package/src/MutableHashMap.ts +18 -0
  1066. package/src/MutableHashSet.ts +2 -0
  1067. package/src/MutableList.ts +24 -6
  1068. package/src/MutableRef.ts +2 -0
  1069. package/src/Newtype.ts +69 -30
  1070. package/src/NonEmptyIterable.ts +6 -0
  1071. package/src/Number.ts +16 -30
  1072. package/src/Optic.ts +90 -40
  1073. package/src/Option.ts +121 -111
  1074. package/src/Order.ts +169 -167
  1075. package/src/Ordering.ts +4 -0
  1076. package/src/PartitionedSemaphore.ts +7 -5
  1077. package/src/Path.ts +8 -0
  1078. package/src/Pipeable.ts +10 -0
  1079. package/src/PlatformError.ts +12 -0
  1080. package/src/Pool.ts +30 -16
  1081. package/src/Predicate.ts +520 -352
  1082. package/src/PrimaryKey.ts +4 -0
  1083. package/src/PubSub.ts +23 -5
  1084. package/src/Pull.ts +16 -0
  1085. package/src/Queue.ts +44 -0
  1086. package/src/Random.ts +25 -6
  1087. package/src/RcMap.ts +10 -6
  1088. package/src/RcRef.ts +3 -1
  1089. package/src/Record.ts +24 -3
  1090. package/src/Redactable.ts +54 -41
  1091. package/src/Redacted.ts +10 -0
  1092. package/src/Reducer.ts +20 -11
  1093. package/src/Ref.ts +95 -58
  1094. package/src/References.ts +18 -1
  1095. package/src/Request.ts +3 -3
  1096. package/src/RequestResolver.ts +8 -22
  1097. package/src/Resource.ts +2 -0
  1098. package/src/Result.ts +192 -6
  1099. package/src/Runtime.ts +14 -11
  1100. package/src/Schedule.ts +35 -3
  1101. package/src/Scheduler.ts +22 -19
  1102. package/src/Schema.ts +547 -130
  1103. package/src/SchemaAST.ts +123 -65
  1104. package/src/SchemaGetter.ts +269 -234
  1105. package/src/SchemaIssue.ts +48 -46
  1106. package/src/SchemaParser.ts +58 -0
  1107. package/src/SchemaRepresentation.ts +198 -96
  1108. package/src/SchemaTransformation.ts +272 -203
  1109. package/src/SchemaUtils.ts +2 -0
  1110. package/src/Scope.ts +19 -1
  1111. package/src/ScopedCache.ts +56 -0
  1112. package/src/ScopedRef.ts +9 -3
  1113. package/src/Semaphore.ts +6 -0
  1114. package/src/Sink.ts +108 -0
  1115. package/src/Stdio.ts +7 -3
  1116. package/src/Stream.ts +464 -16
  1117. package/src/String.ts +14 -0
  1118. package/src/Struct.ts +371 -191
  1119. package/src/SubscriptionRef.ts +7 -1
  1120. package/src/SynchronizedRef.ts +2 -0
  1121. package/src/Tracer.ts +17 -27
  1122. package/src/Trie.ts +23 -9
  1123. package/src/Tuple.ts +287 -144
  1124. package/src/TxChunk.ts +182 -93
  1125. package/src/TxDeferred.ts +3 -4
  1126. package/src/TxHashMap.ts +171 -90
  1127. package/src/TxHashSet.ts +36 -35
  1128. package/src/TxPriorityQueue.ts +2 -0
  1129. package/src/TxPubSub.ts +36 -35
  1130. package/src/TxQueue.ts +77 -114
  1131. package/src/TxRef.ts +4 -0
  1132. package/src/TxSemaphore.ts +66 -27
  1133. package/src/Types.ts +202 -75
  1134. package/src/UndefinedOr.ts +31 -29
  1135. package/src/Unify.ts +28 -0
  1136. package/src/Utils.ts +29 -35
  1137. package/src/index.ts +18 -7
  1138. package/src/testing/TestClock.ts +16 -16
  1139. package/src/testing/TestConsole.ts +2 -0
  1140. package/src/testing/TestSchema.ts +43 -55
  1141. package/src/unstable/ai/AiError.ts +62 -11
  1142. package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -4
  1143. package/src/unstable/ai/Chat.ts +29 -1
  1144. package/src/unstable/ai/IdGenerator.ts +10 -0
  1145. package/src/unstable/ai/LanguageModel.ts +32 -46
  1146. package/src/unstable/ai/McpSchema.ts +84 -32
  1147. package/src/unstable/ai/McpServer.ts +8 -0
  1148. package/src/unstable/ai/Model.ts +9 -5
  1149. package/src/unstable/ai/OpenAiStructuredOutput.ts +3 -2
  1150. package/src/unstable/ai/Prompt.ts +62 -35
  1151. package/src/unstable/ai/Response.ts +40 -21
  1152. package/src/unstable/ai/ResponseIdTracker.ts +8 -0
  1153. package/src/unstable/ai/Telemetry.ts +30 -5
  1154. package/src/unstable/ai/Tokenizer.ts +6 -0
  1155. package/src/unstable/ai/Tool.ts +68 -0
  1156. package/src/unstable/ai/Toolkit.ts +12 -0
  1157. package/src/unstable/cli/Argument.ts +14 -4
  1158. package/src/unstable/cli/CliError.ts +6 -0
  1159. package/src/unstable/cli/Command.ts +128 -12
  1160. package/src/unstable/cli/Flag.ts +31 -14
  1161. package/src/unstable/cli/Param.ts +96 -9
  1162. package/src/unstable/cli/Primitive.ts +10 -0
  1163. package/src/unstable/cli/Prompt.ts +47 -40
  1164. package/src/unstable/cli/internal/command.ts +11 -2
  1165. package/src/unstable/cli/internal/completions/descriptor.ts +3 -0
  1166. package/src/unstable/cli/internal/parser.ts +8 -1
  1167. package/src/unstable/cluster/ClusterCron.ts +10 -1
  1168. package/src/unstable/cluster/ClusterSchema.ts +8 -0
  1169. package/src/unstable/cluster/ClusterWorkflowEngine.ts +4 -0
  1170. package/src/unstable/cluster/DeliverAt.ts +3 -4
  1171. package/src/unstable/cluster/Entity.ts +24 -0
  1172. package/src/unstable/cluster/EntityProxy.ts +10 -4
  1173. package/src/unstable/cluster/EntityProxyServer.ts +6 -0
  1174. package/src/unstable/cluster/EntityResource.ts +10 -0
  1175. package/src/unstable/cluster/Envelope.ts +16 -0
  1176. package/src/unstable/cluster/HttpRunner.ts +16 -0
  1177. package/src/unstable/cluster/K8sHttpClient.ts +8 -0
  1178. package/src/unstable/cluster/Message.ts +24 -0
  1179. package/src/unstable/cluster/MessageStorage.ts +44 -10
  1180. package/src/unstable/cluster/Reply.ts +6 -6
  1181. package/src/unstable/cluster/Runner.ts +2 -0
  1182. package/src/unstable/cluster/RunnerHealth.ts +13 -2
  1183. package/src/unstable/cluster/RunnerServer.ts +8 -8
  1184. package/src/unstable/cluster/RunnerStorage.ts +2 -0
  1185. package/src/unstable/cluster/ShardId.ts +4 -0
  1186. package/src/unstable/cluster/Snowflake.ts +2 -0
  1187. package/src/unstable/cluster/TestRunner.ts +3 -2
  1188. package/src/unstable/devtools/DevToolsSchema.ts +34 -2
  1189. package/src/unstable/devtools/DevToolsServer.ts +4 -0
  1190. package/src/unstable/encoding/Msgpack.ts +24 -0
  1191. package/src/unstable/encoding/Ndjson.ts +46 -2
  1192. package/src/unstable/encoding/Sse.ts +24 -17
  1193. package/src/unstable/eventlog/Event.ts +16 -0
  1194. package/src/unstable/eventlog/EventGroup.ts +4 -0
  1195. package/src/unstable/eventlog/EventJournal.ts +20 -0
  1196. package/src/unstable/eventlog/EventLog.ts +22 -0
  1197. package/src/unstable/eventlog/EventLogMessage.ts +10 -0
  1198. package/src/unstable/eventlog/EventLogRemote.ts +4 -0
  1199. package/src/unstable/eventlog/EventLogServer.ts +4 -0
  1200. package/src/unstable/eventlog/EventLogServerEncrypted.ts +6 -0
  1201. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +8 -0
  1202. package/src/unstable/eventlog/EventLogSessionAuth.ts +11 -1
  1203. package/src/unstable/eventlog/SqlEventJournal.ts +2 -0
  1204. package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +2 -0
  1205. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +2 -0
  1206. package/src/unstable/http/Cookies.ts +34 -0
  1207. package/src/unstable/http/Etag.ts +4 -0
  1208. package/src/unstable/http/FetchHttpClient.ts +4 -0
  1209. package/src/unstable/http/Headers.ts +88 -0
  1210. package/src/unstable/http/HttpBody.ts +32 -0
  1211. package/src/unstable/http/HttpClient.ts +44 -0
  1212. package/src/unstable/http/HttpClientRequest.ts +2 -0
  1213. package/src/unstable/http/HttpClientResponse.ts +6 -0
  1214. package/src/unstable/http/HttpEffect.ts +4 -0
  1215. package/src/unstable/http/HttpPlatform.ts +2 -0
  1216. package/src/unstable/http/HttpRouter.ts +54 -16
  1217. package/src/unstable/http/HttpServer.ts +35 -1
  1218. package/src/unstable/http/HttpServerError.ts +17 -3
  1219. package/src/unstable/http/HttpServerRequest.ts +30 -0
  1220. package/src/unstable/http/HttpServerRespondable.ts +8 -0
  1221. package/src/unstable/http/HttpServerResponse.ts +96 -0
  1222. package/src/unstable/http/HttpTraceContext.ts +12 -0
  1223. package/src/unstable/http/Multipart.ts +49 -2
  1224. package/src/unstable/http/Template.ts +14 -0
  1225. package/src/unstable/http/UrlParams.ts +64 -0
  1226. package/src/unstable/httpapi/HttpApi.ts +10 -4
  1227. package/src/unstable/httpapi/HttpApiBuilder.ts +9 -4
  1228. package/src/unstable/httpapi/HttpApiEndpoint.ts +2 -0
  1229. package/src/unstable/httpapi/HttpApiGroup.ts +23 -14
  1230. package/src/unstable/httpapi/HttpApiMiddleware.ts +14 -0
  1231. package/src/unstable/httpapi/HttpApiScalar.ts +38 -15
  1232. package/src/unstable/httpapi/HttpApiSchema.ts +14 -3
  1233. package/src/unstable/httpapi/HttpApiSecurity.ts +17 -11
  1234. package/src/unstable/httpapi/HttpApiSwagger.ts +2 -4
  1235. package/src/unstable/httpapi/HttpApiTest.ts +2 -0
  1236. package/src/unstable/httpapi/OpenApi.ts +2 -0
  1237. package/src/unstable/observability/Otlp.ts +2 -0
  1238. package/src/unstable/observability/OtlpExporter.ts +2 -0
  1239. package/src/unstable/observability/OtlpLogger.ts +4 -0
  1240. package/src/unstable/observability/OtlpMetrics.ts +8 -9
  1241. package/src/unstable/observability/OtlpResource.ts +8 -0
  1242. package/src/unstable/observability/OtlpTracer.ts +3 -2
  1243. package/src/unstable/observability/PrometheusMetrics.ts +6 -2
  1244. package/src/unstable/persistence/KeyValueStore.ts +10 -0
  1245. package/src/unstable/persistence/Persistable.ts +2 -0
  1246. package/src/unstable/persistence/PersistedCache.ts +2 -0
  1247. package/src/unstable/persistence/PersistedQueue.ts +21 -6
  1248. package/src/unstable/persistence/Persistence.ts +14 -0
  1249. package/src/unstable/persistence/RateLimiter.ts +6 -3
  1250. package/src/unstable/persistence/Redis.ts +6 -0
  1251. package/src/unstable/process/ChildProcess.ts +70 -19
  1252. package/src/unstable/process/ChildProcessSpawner.ts +20 -4
  1253. package/src/unstable/reactivity/Atom.ts +119 -14
  1254. package/src/unstable/reactivity/AtomHttpApi.ts +4 -0
  1255. package/src/unstable/reactivity/AtomRef.ts +8 -0
  1256. package/src/unstable/reactivity/AtomRegistry.ts +34 -0
  1257. package/src/unstable/reactivity/AtomRpc.ts +8 -6
  1258. package/src/unstable/reactivity/Hydration.ts +6 -0
  1259. package/src/unstable/reactivity/Reactivity.ts +27 -3
  1260. package/src/unstable/rpc/Rpc.ts +38 -2
  1261. package/src/unstable/rpc/RpcSerialization.ts +6 -0
  1262. package/src/unstable/rpc/RpcServer.ts +5 -3
  1263. package/src/unstable/schema/Model.ts +43 -12
  1264. package/src/unstable/sql/SqlClient.ts +1 -1
  1265. package/src/unstable/sql/SqlResolver.ts +6 -4
  1266. package/src/unstable/sql/Statement.ts +8 -4
  1267. package/src/unstable/workflow/DurableClock.ts +1 -1
  1268. package/src/unstable/workflow/DurableDeferred.ts +3 -0
  1269. package/src/unstable/workflow/Workflow.ts +42 -34
package/src/Layer.ts CHANGED
@@ -3,17 +3,28 @@
3
3
  * application. Services can be injected into effects via
4
4
  * `Effect.provideService`. Effects can require services via `Effect.service`.
5
5
  *
6
- * Layer can be thought of as recipes for producing bundles of services, given
7
- * their dependencies (other services).
6
+ * A layer is a recipe for producing services from their dependencies:
8
7
  *
9
- * Construction of services can be effectful and utilize resources that must be
10
- * acquired and safely released when the services are done being utilized.
8
+ * - `ROut` is what the layer provides.
9
+ * - `E` is what can fail while building the layer.
10
+ * - `RIn` is what the layer needs in order to build.
11
11
  *
12
- * By default layers are shared, meaning that if the same layer is used twice
13
- * the layer will only be allocated a single time.
12
+ * Normal application code should ask for services. Layer code should create
13
+ * services. The application entry point should provide the final layer once.
14
+ * Keeping this boundary clear makes programs easier to reuse with production,
15
+ * test, or mock implementations.
16
+ *
17
+ * Construction of services can be effectful and can acquire resources that must
18
+ * be safely released when the services are no longer used. For example, a layer
19
+ * can open a database pool during acquisition and close it in a finalizer.
20
+ *
21
+ * Layers are lazy: they do not build anything until they are provided to a
22
+ * program or explicitly built. By default layers are shared, meaning that if the
23
+ * same layer value is used twice, it is allocated only once and both users share
24
+ * the same service instance.
14
25
  *
15
26
  * Because of their excellent composition properties, layers are the idiomatic
16
- * way in Effect-TS to create services that depend on other services.
27
+ * way in Effect to create services that depend on other services.
17
28
  *
18
29
  * @since 2.0.0
19
30
  */
@@ -42,12 +53,13 @@ import type * as Unify from "./Unify.ts"
42
53
  const TypeId = "~effect/Layer"
43
54
 
44
55
  /**
45
- * A Layer describes how to build one or more services for dependency injection.
56
+ * A `Layer` describes how to build one or more services for dependency injection.
57
+ *
58
+ * **Details**
46
59
  *
47
- * A Layer<ROut, E, RIn> represents:
48
- * - ROut: The services this layer provides
49
- * - E: The possible errors during layer construction
50
- * - RIn: The services this layer requires as dependencies
60
+ * A `Layer<ROut, E, RIn>` represents `ROut` as the services this layer
61
+ * provides, `E` as the possible errors during layer construction, and `RIn` as
62
+ * the services this layer requires as dependencies.
51
63
  *
52
64
  * @category models
53
65
  * @since 2.0.0
@@ -64,6 +76,8 @@ export interface Layer<in ROut, out E = never, out RIn = never> extends Variance
64
76
  * Type-level hook that allows `Layer` values to participate in `Unify`
65
77
  * inference.
66
78
  *
79
+ * **Details**
80
+ *
67
81
  * This is used by Effect's pipe and unification machinery to preserve the
68
82
  * provided services, error, and requirements of a `Layer`.
69
83
  *
@@ -102,12 +116,14 @@ export interface Variance<in ROut, out E, out RIn> {
102
116
  }
103
117
  }
104
118
  /**
105
- * A constraint interface for working with any Layer type.
119
+ * A type-level constraint for working with any `Layer` type.
106
120
  *
107
- * This interface is used to constrain generic types to Layer types
108
- * without specifying exact type parameters.
121
+ * **Details**
122
+ *
123
+ * This interface is used to constrain generic types to `Layer` values without
124
+ * specifying exact type parameters.
109
125
  *
110
- * @category type-level
126
+ * @category utility types
111
127
  * @since 3.9.0
112
128
  */
113
129
  export interface Any {
@@ -118,25 +134,25 @@ export interface Any {
118
134
  }
119
135
  }
120
136
  /**
121
- * Extracts the service dependencies (RIn) from a Layer type.
137
+ * Extracts the service requirements (`RIn`) from a `Layer` type.
122
138
  *
123
- * @category type-level
139
+ * @category utility types
124
140
  * @since 4.0.0
125
141
  */
126
142
  export type Services<T extends Any> = T extends infer L
127
143
  ? L extends Layer<infer _ROut, infer _E, infer _RIn> ? _RIn : never
128
144
  : never
129
145
  /**
130
- * Extracts the error type (E) from a Layer type.
146
+ * Extracts the error type (`E`) from a `Layer` type.
131
147
  *
132
- * @category type-level
148
+ * @category utility types
133
149
  * @since 2.0.0
134
150
  */
135
151
  export type Error<T extends Any> = T extends Layer<infer _ROut, infer _E, infer _RIn> ? _E : never
136
152
  /**
137
- * Extracts the service output type (ROut) from a Layer type.
153
+ * Extracts the service output type (`ROut`) from a `Layer` type.
138
154
  *
139
- * @category type-level
155
+ * @category utility types
140
156
  * @since 2.0.0
141
157
  */
142
158
  export type Success<T extends Any> = T extends Layer<infer _ROut, infer _E, infer _RIn> ? _ROut : never
@@ -144,9 +160,12 @@ export type Success<T extends Any> = T extends Layer<infer _ROut, infer _E, infe
144
160
  const MemoMapTypeId = "~effect/Layer/MemoMap"
145
161
 
146
162
  /**
147
- * A MemoMap is used to memoize layer construction and ensure sharing of layers.
163
+ * A `MemoMap` is used to memoize layer construction and ensure sharing of
164
+ * layers.
148
165
  *
149
- * The MemoMap prevents duplicate construction of the same layer instance,
166
+ * **Details**
167
+ *
168
+ * The `MemoMap` prevents duplicate construction of the same layer instance,
150
169
  * enabling efficient resource sharing across layer dependencies.
151
170
  *
152
171
  * **Example** (Sharing layer construction with a memo map)
@@ -163,7 +182,7 @@ const MemoMapTypeId = "~effect/Layer/MemoMap"
163
182
  * const memoMap = yield* Layer.makeMemoMap
164
183
  * const scope = yield* Effect.scope
165
184
  *
166
- * const dbLayer = Layer.succeed(Database)({
185
+ * const dbLayer = Layer.succeed(Database, {
167
186
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
168
187
  * })
169
188
  * const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
@@ -217,7 +236,7 @@ const memoMapReuse = <RIn, E, ROut>(
217
236
  * readonly query: (sql: string) => Effect.Effect<string>
218
237
  * }>()("Database") {}
219
238
  *
220
- * const dbLayer = Layer.succeed(Database)({
239
+ * const dbLayer = Layer.succeed(Database, {
221
240
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
222
241
  * })
223
242
  * const notALayer = { someProperty: "value" }
@@ -254,7 +273,10 @@ const fromBuildUnsafe = <ROut, E, RIn>(
254
273
  }
255
274
 
256
275
  /**
257
- * Constructs a Layer from a function that uses a `MemoMap` and `Scope` to build the layer.
276
+ * Constructs a `Layer` from a function that uses a `MemoMap` and `Scope` to
277
+ * build the layer.
278
+ *
279
+ * **Details**
258
280
  *
259
281
  * The function receives a `MemoMap` for memoization and a `Scope` for resource management.
260
282
  * A child scope is created, and if the build fails, the child scope is closed.
@@ -295,8 +317,10 @@ export const fromBuild = <ROut, E, RIn>(
295
317
  })
296
318
 
297
319
  /**
298
- * Constructs a Layer from a function that uses a `MemoMap` and `Scope` to build the layer,
299
- * with automatic memoization.
320
+ * Constructs a `Layer` from a function that uses a `MemoMap` and `Scope` to
321
+ * build the layer, with automatic memoization.
322
+ *
323
+ * **Details**
300
324
  *
301
325
  * This is similar to `fromBuild` but provides automatic memoization of the layer construction.
302
326
  * The layer will be memoized based on the provided `MemoMap`.
@@ -417,7 +441,7 @@ class MemoMapImpl implements MemoMap {
417
441
  * const memoMap = Layer.makeMemoMapUnsafe()
418
442
  * const scope = yield* Effect.scope
419
443
  *
420
- * const dbLayer = Layer.succeed(Database)({
444
+ * const dbLayer = Layer.succeed(Database, {
421
445
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
422
446
  * })
423
447
  * const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
@@ -457,7 +481,7 @@ export const forkMemoMapUnsafe = (parent: MemoMap): MemoMap => new MemoMapImpl(p
457
481
  * const memoMap = yield* Layer.makeMemoMap
458
482
  * const scope = yield* Effect.scope
459
483
  *
460
- * const dbLayer = Layer.succeed(Database)({
484
+ * const dbLayer = Layer.succeed(Database, {
461
485
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
462
486
  * })
463
487
  * const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
@@ -483,6 +507,8 @@ export const forkMemoMap = (parent: MemoMap): Effect<MemoMap> => internalEffect.
483
507
  /**
484
508
  * A service reference for the current `MemoMap` used in layer construction.
485
509
  *
510
+ * **Details**
511
+ *
486
512
  * This service provides access to the current memoization map during layer building,
487
513
  * allowing layers to share memoized results.
488
514
  *
@@ -519,13 +545,13 @@ export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("
519
545
  * const scope = yield* Effect.scope
520
546
  *
521
547
  * // Build database layer with memoization
522
- * const dbLayer = Layer.succeed(Database)({
548
+ * const dbLayer = Layer.succeed(Database, {
523
549
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
524
550
  * })
525
551
  * const dbContext = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
526
552
  *
527
553
  * // Build logger layer with same memoization (reuses memo if same layer)
528
- * const loggerLayer = Layer.succeed(Logger)({
554
+ * const loggerLayer = Layer.succeed(Logger, {
529
555
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
530
556
  * })
531
557
  * const loggerContext = yield* Layer.buildWithMemoMap(
@@ -568,13 +594,13 @@ export const buildWithMemoMap: {
568
594
  * const scope = yield* Effect.scope
569
595
  *
570
596
  * // Build database layer with memoization
571
- * const dbLayer = Layer.succeed(Database)({
597
+ * const dbLayer = Layer.succeed(Database, {
572
598
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
573
599
  * })
574
600
  * const dbContext = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
575
601
  *
576
602
  * // Build logger layer with same memoization (reuses memo if same layer)
577
- * const loggerLayer = Layer.succeed(Logger)({
603
+ * const loggerLayer = Layer.succeed(Logger, {
578
604
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
579
605
  * })
580
606
  * const loggerContext = yield* Layer.buildWithMemoMap(
@@ -617,13 +643,13 @@ export const buildWithMemoMap: {
617
643
  * const scope = yield* Effect.scope
618
644
  *
619
645
  * // Build database layer with memoization
620
- * const dbLayer = Layer.succeed(Database)({
646
+ * const dbLayer = Layer.succeed(Database, {
621
647
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
622
648
  * })
623
649
  * const dbContext = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
624
650
  *
625
651
  * // Build logger layer with same memoization (reuses memo if same layer)
626
- * const loggerLayer = Layer.succeed(Logger)({
652
+ * const loggerLayer = Layer.succeed(Logger, {
627
653
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
628
654
  * })
629
655
  * const loggerContext = yield* Layer.buildWithMemoMap(
@@ -668,7 +694,7 @@ export const buildWithMemoMap: {
668
694
  *
669
695
  * // Build a layer to get its services
670
696
  * const program = Effect.gen(function*() {
671
- * const dbLayer = Layer.succeed(Database)({
697
+ * const dbLayer = Layer.succeed(Database, {
672
698
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
673
699
  * })
674
700
  *
@@ -716,7 +742,7 @@ export const build = <RIn, E, ROut>(
716
742
  * const program = Effect.gen(function*() {
717
743
  * const scope = yield* Effect.scope
718
744
  *
719
- * const dbLayer = Layer.effect(Database)(Effect.gen(function*() {
745
+ * const dbLayer = Layer.effect(Database, Effect.gen(function*() {
720
746
  * console.log("Initializing database...")
721
747
  * yield* Scope.addFinalizer(
722
748
  * scope,
@@ -758,7 +784,7 @@ export const buildWithScope: {
758
784
  * const program = Effect.gen(function*() {
759
785
  * const scope = yield* Effect.scope
760
786
  *
761
- * const dbLayer = Layer.effect(Database)(Effect.gen(function*() {
787
+ * const dbLayer = Layer.effect(Database, Effect.gen(function*() {
762
788
  * console.log("Initializing database...")
763
789
  * yield* Scope.addFinalizer(
764
790
  * scope,
@@ -800,7 +826,7 @@ export const buildWithScope: {
800
826
  * const program = Effect.gen(function*() {
801
827
  * const scope = yield* Effect.scope
802
828
  *
803
- * const dbLayer = Layer.effect(Database)(Effect.gen(function*() {
829
+ * const dbLayer = Layer.effect(Database, Effect.gen(function*() {
804
830
  * console.log("Initializing database...")
805
831
  * yield* Scope.addFinalizer(
806
832
  * scope,
@@ -835,9 +861,16 @@ export const buildWithScope: {
835
861
  ))
836
862
 
837
863
  /**
838
- * Constructs a layer from the specified value.
864
+ * Constructs a layer that provides a single service from an already available
865
+ * value.
866
+ *
867
+ * **When to use**
839
868
  *
840
- * **Example** (Providing services from values)
869
+ * Use `succeed` when the service implementation is already constructed and does
870
+ * not need effectful acquisition. Use `sync` when the service should be created
871
+ * lazily during layer construction.
872
+ *
873
+ * **Example** (Creating a layer from a service implementation)
841
874
  *
842
875
  * ```ts
843
876
  * import { Context, Effect, Layer } from "effect"
@@ -846,42 +879,28 @@ export const buildWithScope: {
846
879
  * readonly query: (sql: string) => Effect.Effect<string>
847
880
  * }>()("Database") {}
848
881
  *
849
- * class Logger extends Context.Service<Logger, {
850
- * readonly log: (msg: string) => Effect.Effect<void>
851
- * }>()("Logger") {}
852
- *
853
- * // Create layers from concrete service implementations
854
- * const databaseLayer = Layer.succeed(Database)({
882
+ * const DatabaseLive = Layer.succeed(Database, {
855
883
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Query result: ${sql}`))
856
884
  * })
857
- *
858
- * const loggerLayer = Layer.succeed(Logger)({
859
- * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
860
- * })
861
- *
862
- * // Use the layers in a program
863
- * const program = Effect.gen(function*() {
864
- * const database = yield* Database
865
- * const logger = yield* Logger
866
- *
867
- * yield* logger.log("Starting database query")
868
- * const result = yield* database.query("SELECT * FROM users")
869
- * yield* logger.log(`Query completed: ${result}`)
870
- *
871
- * return result
872
- * }).pipe(
873
- * Effect.provide(Layer.mergeAll(databaseLayer, loggerLayer))
874
- * )
875
885
  * ```
876
886
  *
887
+ * @see {@link sync} for constructing layers from lazy values
888
+ *
877
889
  * @category constructors
878
890
  * @since 2.0.0
879
891
  */
880
892
  export const succeed: {
881
893
  /**
882
- * Constructs a layer from the specified value.
894
+ * Constructs a layer that provides a single service from an already available
895
+ * value.
896
+ *
897
+ * **When to use**
883
898
  *
884
- * **Example** (Providing services from values)
899
+ * Use `succeed` when the service implementation is already constructed and does
900
+ * not need effectful acquisition. Use `sync` when the service should be created
901
+ * lazily during layer construction.
902
+ *
903
+ * **Example** (Creating a layer from a service implementation)
885
904
  *
886
905
  * ```ts
887
906
  * import { Context, Effect, Layer } from "effect"
@@ -890,42 +909,28 @@ export const succeed: {
890
909
  * readonly query: (sql: string) => Effect.Effect<string>
891
910
  * }>()("Database") {}
892
911
  *
893
- * class Logger extends Context.Service<Logger, {
894
- * readonly log: (msg: string) => Effect.Effect<void>
895
- * }>()("Logger") {}
896
- *
897
- * // Create layers from concrete service implementations
898
- * const databaseLayer = Layer.succeed(Database)({
912
+ * const DatabaseLive = Layer.succeed(Database, {
899
913
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Query result: ${sql}`))
900
914
  * })
901
- *
902
- * const loggerLayer = Layer.succeed(Logger)({
903
- * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
904
- * })
905
- *
906
- * // Use the layers in a program
907
- * const program = Effect.gen(function*() {
908
- * const database = yield* Database
909
- * const logger = yield* Logger
910
- *
911
- * yield* logger.log("Starting database query")
912
- * const result = yield* database.query("SELECT * FROM users")
913
- * yield* logger.log(`Query completed: ${result}`)
914
- *
915
- * return result
916
- * }).pipe(
917
- * Effect.provide(Layer.mergeAll(databaseLayer, loggerLayer))
918
- * )
919
915
  * ```
920
916
  *
917
+ * @see {@link sync} for constructing layers from lazy values
918
+ *
921
919
  * @category constructors
922
920
  * @since 2.0.0
923
921
  */
924
922
  <I, S>(service: Context.Key<I, S>): (resource: S) => Layer<I>
925
923
  /**
926
- * Constructs a layer from the specified value.
924
+ * Constructs a layer that provides a single service from an already available
925
+ * value.
926
+ *
927
+ * **When to use**
927
928
  *
928
- * **Example** (Providing services from values)
929
+ * Use `succeed` when the service implementation is already constructed and does
930
+ * not need effectful acquisition. Use `sync` when the service should be created
931
+ * lazily during layer construction.
932
+ *
933
+ * **Example** (Creating a layer from a service implementation)
929
934
  *
930
935
  * ```ts
931
936
  * import { Context, Effect, Layer } from "effect"
@@ -934,34 +939,13 @@ export const succeed: {
934
939
  * readonly query: (sql: string) => Effect.Effect<string>
935
940
  * }>()("Database") {}
936
941
  *
937
- * class Logger extends Context.Service<Logger, {
938
- * readonly log: (msg: string) => Effect.Effect<void>
939
- * }>()("Logger") {}
940
- *
941
- * // Create layers from concrete service implementations
942
- * const databaseLayer = Layer.succeed(Database)({
942
+ * const DatabaseLive = Layer.succeed(Database, {
943
943
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Query result: ${sql}`))
944
944
  * })
945
- *
946
- * const loggerLayer = Layer.succeed(Logger)({
947
- * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
948
- * })
949
- *
950
- * // Use the layers in a program
951
- * const program = Effect.gen(function*() {
952
- * const database = yield* Database
953
- * const logger = yield* Logger
954
- *
955
- * yield* logger.log("Starting database query")
956
- * const result = yield* database.query("SELECT * FROM users")
957
- * yield* logger.log(`Query completed: ${result}`)
958
- *
959
- * return result
960
- * }).pipe(
961
- * Effect.provide(Layer.mergeAll(databaseLayer, loggerLayer))
962
- * )
963
945
  * ```
964
946
  *
947
+ * @see {@link sync} for constructing layers from lazy values
948
+ *
965
949
  * @category constructors
966
950
  * @since 2.0.0
967
951
  */
@@ -974,11 +958,19 @@ export const succeed: {
974
958
  } as any
975
959
 
976
960
  /**
977
- * Constructs a layer from the specified value, which must return one or more
978
- * services.
961
+ * Constructs a layer that provides all services in an already available
962
+ * `Context`.
979
963
  *
980
- * This is a more general version of `succeed` that allows you to provide multiple
981
- * services at once through a `Context`.
964
+ * **When to use**
965
+ *
966
+ * Use `succeedContext` when you already have a `Context` or need to provide
967
+ * multiple services at once. Use `succeed` when you only need to provide one
968
+ * service value.
969
+ *
970
+ * **Details**
971
+ *
972
+ * This is a more general version of `succeed` that allows you to provide
973
+ * multiple services at once through a `Context`.
982
974
  *
983
975
  * **Example** (Providing multiple services from a context)
984
976
  *
@@ -1004,6 +996,8 @@ export const succeed: {
1004
996
  * const layer = Layer.succeedContext(context)
1005
997
  * ```
1006
998
  *
999
+ * @see {@link succeed} for providing a single service from a value
1000
+ *
1007
1001
  * @category constructors
1008
1002
  * @since 2.0.0
1009
1003
  */
@@ -1011,26 +1005,44 @@ export const succeedContext = <A>(context: Context.Context<A>): Layer<A> =>
1011
1005
  fromBuildUnsafe(constant(internalEffect.succeed(context)))
1012
1006
 
1013
1007
  /**
1014
- * A Layer that constructs an empty Context.
1008
+ * An empty layer that provides no services, cannot fail, has no requirements,
1009
+ * and performs no construction or finalization work.
1015
1010
  *
1016
- * This layer provides no services and can be used as a neutral element
1017
- * in layer composition or as a starting point for building layers.
1011
+ * **When to use**
1018
1012
  *
1019
- * **Example** (Creating an empty layer)
1013
+ * Use `Layer.empty` as the no-op branch when conditionally composing layers.
1014
+ * If you need to run an effect during layer construction while still providing
1015
+ * no services, use `effectDiscard`.
1016
+ *
1017
+ * **Example** (Disabling optional lifecycle work)
1020
1018
  *
1021
1019
  * ```ts
1022
- * import { Layer } from "effect"
1020
+ * import { Console, Layer } from "effect"
1021
+ *
1022
+ * declare const flag: boolean
1023
1023
  *
1024
- * const emptyLayer = Layer.empty
1024
+ * const StartupLogLive = flag
1025
+ * ? Layer.effectDiscard(Console.log("application starting"))
1026
+ * : Layer.empty
1025
1027
  * ```
1026
1028
  *
1029
+ * @see {@link effectDiscard} for running an effect while providing no services
1030
+ *
1027
1031
  * @category constructors
1028
1032
  * @since 2.0.0
1029
1033
  */
1030
1034
  export const empty: Layer<never> = succeedContext(Context.empty())
1031
1035
 
1032
1036
  /**
1033
- * Lazily constructs a layer from the specified value.
1037
+ * Lazily constructs a layer that provides a single service.
1038
+ *
1039
+ * **When to use**
1040
+ *
1041
+ * Use `sync` when the service can be created synchronously but should be
1042
+ * deferred until the layer is built. Use `succeed` when the service value is
1043
+ * already available.
1044
+ *
1045
+ * **Details**
1034
1046
  *
1035
1047
  * This is a lazy version of `succeed` where the service value is computed
1036
1048
  * synchronously only when the layer is built.
@@ -1044,17 +1056,27 @@ export const empty: Layer<never> = succeedContext(Context.empty())
1044
1056
  * readonly query: (sql: string) => Effect.Effect<string>
1045
1057
  * }>()("Database") {}
1046
1058
  *
1047
- * const layer = Layer.sync(Database)(() => ({
1059
+ * const layer = Layer.sync(Database, () => ({
1048
1060
  * query: (sql: string) => Effect.succeed(`Query: ${sql}`)
1049
1061
  * }))
1050
1062
  * ```
1051
1063
  *
1064
+ * @see {@link succeed} for constructing layers from static values
1065
+ *
1052
1066
  * @category constructors
1053
1067
  * @since 2.0.0
1054
1068
  */
1055
1069
  export const sync: {
1056
1070
  /**
1057
- * Lazily constructs a layer from the specified value.
1071
+ * Lazily constructs a layer that provides a single service.
1072
+ *
1073
+ * **When to use**
1074
+ *
1075
+ * Use `sync` when the service can be created synchronously but should be
1076
+ * deferred until the layer is built. Use `succeed` when the service value is
1077
+ * already available.
1078
+ *
1079
+ * **Details**
1058
1080
  *
1059
1081
  * This is a lazy version of `succeed` where the service value is computed
1060
1082
  * synchronously only when the layer is built.
@@ -1068,17 +1090,27 @@ export const sync: {
1068
1090
  * readonly query: (sql: string) => Effect.Effect<string>
1069
1091
  * }>()("Database") {}
1070
1092
  *
1071
- * const layer = Layer.sync(Database)(() => ({
1093
+ * const layer = Layer.sync(Database, () => ({
1072
1094
  * query: (sql: string) => Effect.succeed(`Query: ${sql}`)
1073
1095
  * }))
1074
1096
  * ```
1075
1097
  *
1098
+ * @see {@link succeed} for constructing layers from static values
1099
+ *
1076
1100
  * @category constructors
1077
1101
  * @since 2.0.0
1078
1102
  */
1079
1103
  <I, S>(service: Context.Key<I, S>): (evaluate: LazyArg<S>) => Layer<I>
1080
1104
  /**
1081
- * Lazily constructs a layer from the specified value.
1105
+ * Lazily constructs a layer that provides a single service.
1106
+ *
1107
+ * **When to use**
1108
+ *
1109
+ * Use `sync` when the service can be created synchronously but should be
1110
+ * deferred until the layer is built. Use `succeed` when the service value is
1111
+ * already available.
1112
+ *
1113
+ * **Details**
1082
1114
  *
1083
1115
  * This is a lazy version of `succeed` where the service value is computed
1084
1116
  * synchronously only when the layer is built.
@@ -1092,11 +1124,13 @@ export const sync: {
1092
1124
  * readonly query: (sql: string) => Effect.Effect<string>
1093
1125
  * }>()("Database") {}
1094
1126
  *
1095
- * const layer = Layer.sync(Database)(() => ({
1127
+ * const layer = Layer.sync(Database, () => ({
1096
1128
  * query: (sql: string) => Effect.succeed(`Query: ${sql}`)
1097
1129
  * }))
1098
1130
  * ```
1099
1131
  *
1132
+ * @see {@link succeed} for constructing layers from static values
1133
+ *
1100
1134
  * @category constructors
1101
1135
  * @since 2.0.0
1102
1136
  */
@@ -1109,10 +1143,17 @@ export const sync: {
1109
1143
  } as any
1110
1144
 
1111
1145
  /**
1112
- * Lazily constructs a layer from the specified value, which must return one or more
1113
- * services.
1146
+ * Lazily constructs a layer that provides all services in a `Context`.
1147
+ *
1148
+ * **When to use**
1114
1149
  *
1115
- * This is a lazy version of `succeedContext` where the Context is computed
1150
+ * Use `syncContext` when multiple services can be created synchronously and
1151
+ * should be deferred until the layer is built. Use `sync` when you only need to
1152
+ * provide one service.
1153
+ *
1154
+ * **Details**
1155
+ *
1156
+ * This is a lazy version of `succeedContext` where the `Context` is computed
1116
1157
  * synchronously only when the layer is built.
1117
1158
  *
1118
1159
  * **Example** (Lazily providing a context)
@@ -1131,6 +1172,9 @@ export const sync: {
1131
1172
  * )
1132
1173
  * ```
1133
1174
  *
1175
+ * @see {@link sync} for lazily providing a single service
1176
+ * @see {@link succeedContext} for providing an already available context
1177
+ *
1134
1178
  * @category constructors
1135
1179
  * @since 2.0.0
1136
1180
  */
@@ -1138,10 +1182,19 @@ export const syncContext = <A>(evaluate: LazyArg<Context.Context<A>>): Layer<A>
1138
1182
  fromBuildMemo(constant(internalEffect.sync(evaluate)))
1139
1183
 
1140
1184
  /**
1141
- * Constructs a layer from the specified scoped effect.
1185
+ * Constructs a layer from an effect that produces a single service.
1186
+ *
1187
+ * **When to use**
1188
+ *
1189
+ * Use `effect` when constructing the service requires effects, dependencies, or
1190
+ * scoped resource acquisition. Use `effectContext` when the effect produces
1191
+ * multiple services in a `Context`, and `effectDiscard` when construction work
1192
+ * should provide no services.
1142
1193
  *
1143
- * This allows you to create a Layer from an Effect that produces a service.
1144
- * The Effect is executed in the scope of the layer, allowing for proper
1194
+ * **Details**
1195
+ *
1196
+ * This allows you to create a `Layer` from an `Effect` that produces a service.
1197
+ * The `Effect` is executed in the scope of the layer, allowing for proper
1145
1198
  * resource management.
1146
1199
  *
1147
1200
  * **Example** (Creating a layer from an effect)
@@ -1153,22 +1206,34 @@ export const syncContext = <A>(evaluate: LazyArg<Context.Context<A>>): Layer<A>
1153
1206
  * readonly query: (sql: string) => Effect.Effect<string>
1154
1207
  * }>()("Database") {}
1155
1208
  *
1156
- * const layer = Layer.effect(Database)(
1209
+ * const layer = Layer.effect(Database,
1157
1210
  * Effect.sync(() => ({
1158
1211
  * query: (sql: string) => Effect.succeed(`Query: ${sql}`)
1159
1212
  * }))
1160
1213
  * )
1161
1214
  * ```
1162
1215
  *
1216
+ * @see {@link effectContext} for effectfully providing multiple services
1217
+ * @see {@link effectDiscard} for running construction work without providing services
1218
+ *
1163
1219
  * @category constructors
1164
1220
  * @since 2.0.0
1165
1221
  */
1166
1222
  export const effect: {
1167
1223
  /**
1168
- * Constructs a layer from the specified scoped effect.
1224
+ * Constructs a layer from an effect that produces a single service.
1225
+ *
1226
+ * **When to use**
1227
+ *
1228
+ * Use `effect` when constructing the service requires effects, dependencies, or
1229
+ * scoped resource acquisition. Use `effectContext` when the effect produces
1230
+ * multiple services in a `Context`, and `effectDiscard` when construction work
1231
+ * should provide no services.
1169
1232
  *
1170
- * This allows you to create a Layer from an Effect that produces a service.
1171
- * The Effect is executed in the scope of the layer, allowing for proper
1233
+ * **Details**
1234
+ *
1235
+ * This allows you to create a `Layer` from an `Effect` that produces a service.
1236
+ * The `Effect` is executed in the scope of the layer, allowing for proper
1172
1237
  * resource management.
1173
1238
  *
1174
1239
  * **Example** (Creating a layer from an effect)
@@ -1180,13 +1245,16 @@ export const effect: {
1180
1245
  * readonly query: (sql: string) => Effect.Effect<string>
1181
1246
  * }>()("Database") {}
1182
1247
  *
1183
- * const layer = Layer.effect(Database)(
1248
+ * const layer = Layer.effect(Database,
1184
1249
  * Effect.sync(() => ({
1185
1250
  * query: (sql: string) => Effect.succeed(`Query: ${sql}`)
1186
1251
  * }))
1187
1252
  * )
1188
1253
  * ```
1189
1254
  *
1255
+ * @see {@link effectContext} for effectfully providing multiple services
1256
+ * @see {@link effectDiscard} for running construction work without providing services
1257
+ *
1190
1258
  * @category constructors
1191
1259
  * @since 2.0.0
1192
1260
  */
@@ -1194,10 +1262,19 @@ export const effect: {
1194
1262
  effect: Effect<S, E, R>
1195
1263
  ) => Layer<I, E, Exclude<R, Scope.Scope>>
1196
1264
  /**
1197
- * Constructs a layer from the specified scoped effect.
1265
+ * Constructs a layer from an effect that produces a single service.
1266
+ *
1267
+ * **When to use**
1268
+ *
1269
+ * Use `effect` when constructing the service requires effects, dependencies, or
1270
+ * scoped resource acquisition. Use `effectContext` when the effect produces
1271
+ * multiple services in a `Context`, and `effectDiscard` when construction work
1272
+ * should provide no services.
1198
1273
  *
1199
- * This allows you to create a Layer from an Effect that produces a service.
1200
- * The Effect is executed in the scope of the layer, allowing for proper
1274
+ * **Details**
1275
+ *
1276
+ * This allows you to create a `Layer` from an `Effect` that produces a service.
1277
+ * The `Effect` is executed in the scope of the layer, allowing for proper
1201
1278
  * resource management.
1202
1279
  *
1203
1280
  * **Example** (Creating a layer from an effect)
@@ -1209,13 +1286,16 @@ export const effect: {
1209
1286
  * readonly query: (sql: string) => Effect.Effect<string>
1210
1287
  * }>()("Database") {}
1211
1288
  *
1212
- * const layer = Layer.effect(Database)(
1289
+ * const layer = Layer.effect(Database,
1213
1290
  * Effect.sync(() => ({
1214
1291
  * query: (sql: string) => Effect.succeed(`Query: ${sql}`)
1215
1292
  * }))
1216
1293
  * )
1217
1294
  * ```
1218
1295
  *
1296
+ * @see {@link effectContext} for effectfully providing multiple services
1297
+ * @see {@link effectDiscard} for running construction work without providing services
1298
+ *
1219
1299
  * @category constructors
1220
1300
  * @since 2.0.0
1221
1301
  */
@@ -1234,11 +1314,18 @@ const effectImpl = <I, S, E, R>(
1234
1314
  effectContext(internalEffect.map(effect, (value) => Context.make(service, value)))
1235
1315
 
1236
1316
  /**
1237
- * Constructs a layer from the specified scoped effect, which must return one
1238
- * or more services.
1317
+ * Constructs a layer from an effect that produces all services in a `Context`.
1318
+ *
1319
+ * **When to use**
1320
+ *
1321
+ * Use `effectContext` when effectful construction needs to provide multiple
1322
+ * services at once. Use `effect` when the effect produces one service value.
1239
1323
  *
1240
- * This allows you to create a Layer from an effectful computation that returns
1241
- * multiple services. The Effect is executed in the scope of the layer.
1324
+ * **Details**
1325
+ *
1326
+ * This allows you to create a `Layer` from an effectful computation that
1327
+ * returns multiple services. The `Effect` is executed in the scope of the
1328
+ * layer.
1242
1329
  *
1243
1330
  * **Example** (Creating a layer from an effectful context)
1244
1331
  *
@@ -1257,6 +1344,8 @@ const effectImpl = <I, S, E, R>(
1257
1344
  * )
1258
1345
  * ```
1259
1346
  *
1347
+ * @see {@link effect} for effectfully providing a single service
1348
+ *
1260
1349
  * @category constructors
1261
1350
  * @since 2.0.0
1262
1351
  */
@@ -1265,7 +1354,10 @@ export const effectContext = <A, E, R>(
1265
1354
  ): Layer<A, E, Exclude<R, Scope.Scope>> => fromBuildMemo((_, scope) => Scope.provide(effect, scope))
1266
1355
 
1267
1356
  /**
1268
- * Constructs a layer from the specified scoped effect.
1357
+ * Constructs a layer from an effect, discarding its value and providing no
1358
+ * services.
1359
+ *
1360
+ * **When to use**
1269
1361
  *
1270
1362
  * This is useful when you want to run an Effect for its side effects during
1271
1363
  * layer construction, but don't need to provide any services.
@@ -1282,6 +1374,8 @@ export const effectContext = <A, E, R>(
1282
1374
  * )
1283
1375
  * ```
1284
1376
  *
1377
+ * @see {@link empty} for a no-op layer that performs no construction work
1378
+ *
1285
1379
  * @category constructors
1286
1380
  * @since 2.0.0
1287
1381
  */
@@ -1291,6 +1385,8 @@ export const effectDiscard = <X, E, R>(effect: Effect<X, E, R>): Layer<never, E,
1291
1385
  /**
1292
1386
  * Lazily constructs a layer using the specified factory.
1293
1387
  *
1388
+ * **Details**
1389
+ *
1294
1390
  * The factory is evaluated only when the suspended layer is first built, and
1295
1391
  * the result is memoized with normal layer sharing semantics.
1296
1392
  *
@@ -1305,8 +1401,8 @@ export const effectDiscard = <X, E, R>(effect: Effect<X, E, R>): Layer<never, E,
1305
1401
  *
1306
1402
  * const layer = Layer.suspend(() =>
1307
1403
  * useProd
1308
- * ? Layer.succeed(Config)("https://api.example.com")
1309
- * : Layer.succeed(Config)("http://localhost:3000")
1404
+ * ? Layer.succeed(Config, "https://api.example.com")
1405
+ * : Layer.succeed(Config, "http://localhost:3000")
1310
1406
  * )
1311
1407
  * ```
1312
1408
  *
@@ -1317,11 +1413,17 @@ export const suspend = <A, E, R>(evaluate: LazyArg<Layer<A, E, R>>): Layer<A, E,
1317
1413
  fromBuildMemo((memoMap, scope) => internalEffect.suspend(() => evaluate().build(memoMap, scope)))
1318
1414
 
1319
1415
  /**
1320
- * Unwraps a Layer from an Effect, flattening the nested structure.
1416
+ * Unwraps a `Layer` from an `Effect`, flattening the nested structure.
1417
+ *
1418
+ * **When to use**
1321
1419
  *
1322
- * This is useful when you have an Effect that produces a Layer, and you want to
1323
- * use that Layer directly. The resulting Layer will have the combined error and
1324
- * dependency types from both the outer Effect and the inner Layer.
1420
+ * Use this when you have an `Effect` that produces a `Layer` and you want to
1421
+ * use that layer directly.
1422
+ *
1423
+ * **Details**
1424
+ *
1425
+ * The resulting Layer will have the combined error and dependency types from
1426
+ * both the outer Effect and the inner Layer.
1325
1427
  *
1326
1428
  * **Example** (Unwrapping an effectful layer)
1327
1429
  *
@@ -1333,7 +1435,7 @@ export const suspend = <A, E, R>(evaluate: LazyArg<Layer<A, E, R>>): Layer<A, E,
1333
1435
  * }>()("Database") {}
1334
1436
  *
1335
1437
  * const layerEffect = Effect.succeed(
1336
- * Layer.succeed(Database)({ query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result")) })
1438
+ * Layer.succeed(Database, { query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result")) })
1337
1439
  * )
1338
1440
  *
1339
1441
  * const unwrappedLayer = Layer.unwrap(layerEffect)
@@ -1367,10 +1469,20 @@ const mergeAllEffect = <Layers extends [Layer<never, any, any>, ...Array<Layer<n
1367
1469
  }
1368
1470
 
1369
1471
  /**
1370
- * Combines all the provided layers concurrently, creating a new layer with merged input, error, and output types.
1472
+ * Combines all the provided layers concurrently, creating a new layer with
1473
+ * merged input, error, and output types.
1474
+ *
1475
+ * **When to use**
1476
+ *
1477
+ * Use this when you need to combine multiple independent layers.
1478
+ *
1479
+ * **Details**
1371
1480
  *
1372
1481
  * All layers are built concurrently, and their outputs are merged into a single layer.
1373
- * This is useful when you need to combine multiple independent layers.
1482
+ *
1483
+ * If multiple merged layers depend on the same layer value, that dependency is
1484
+ * shared by default. Reuse a named layer value when you want services to share
1485
+ * the same resource, such as one database pool.
1374
1486
  *
1375
1487
  * **Example** (Merging independent layers)
1376
1488
  *
@@ -1385,16 +1497,18 @@ const mergeAllEffect = <Layers extends [Layer<never, any, any>, ...Array<Layer<n
1385
1497
  * readonly log: (msg: string) => Effect.Effect<void>
1386
1498
  * }>()("Logger") {}
1387
1499
  *
1388
- * const dbLayer = Layer.succeed(Database)({
1500
+ * const dbLayer = Layer.succeed(Database, {
1389
1501
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
1390
1502
  * })
1391
- * const loggerLayer = Layer.succeed(Logger)({
1503
+ * const loggerLayer = Layer.succeed(Logger, {
1392
1504
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
1393
1505
  * })
1394
1506
  *
1395
1507
  * const mergedLayer = Layer.mergeAll(dbLayer, loggerLayer)
1396
1508
  * ```
1397
1509
  *
1510
+ * @see {@link merge} for merging one layer with another layer or array
1511
+ *
1398
1512
  * @category zipping
1399
1513
  * @since 2.0.0
1400
1514
  */
@@ -1407,10 +1521,19 @@ export const mergeAll = <Layers extends [Layer<never, any, any>, ...Array<Layer<
1407
1521
  > => fromBuild((memoMap, scope) => mergeAllEffect(layers, memoMap, scope))
1408
1522
 
1409
1523
  /**
1410
- * Merges this layer with the specified layer concurrently, producing a new layer with combined input and output types.
1524
+ * Merges this layer with another layer concurrently, producing a new layer with
1525
+ * combined input, error, and output types.
1526
+ *
1527
+ * **When to use**
1528
+ *
1529
+ * Use `merge` when composing from an existing layer in a pipeline. Use
1530
+ * `mergeAll` when you already have all layers as separate arguments.
1411
1531
  *
1412
- * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1413
- * The layers are built concurrently and their outputs are combined.
1532
+ * **Details**
1533
+ *
1534
+ * This is a binary version of `mergeAll` that merges exactly two layers or one
1535
+ * layer with an array of layers. The layers are built concurrently and their
1536
+ * outputs are combined.
1414
1537
  *
1415
1538
  * **Example** (Merging two layers)
1416
1539
  *
@@ -1425,25 +1548,36 @@ export const mergeAll = <Layers extends [Layer<never, any, any>, ...Array<Layer<
1425
1548
  * readonly log: (msg: string) => Effect.Effect<void>
1426
1549
  * }>()("Logger") {}
1427
1550
  *
1428
- * const dbLayer = Layer.succeed(Database)({
1551
+ * const dbLayer = Layer.succeed(Database, {
1429
1552
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
1430
1553
  * })
1431
- * const loggerLayer = Layer.succeed(Logger)({
1554
+ * const loggerLayer = Layer.succeed(Logger, {
1432
1555
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
1433
1556
  * })
1434
1557
  *
1435
1558
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1436
1559
  * ```
1437
1560
  *
1561
+ * @see {@link mergeAll} for merging several layers at once
1562
+ *
1438
1563
  * @category zipping
1439
1564
  * @since 2.0.0
1440
1565
  */
1441
1566
  export const merge: {
1442
1567
  /**
1443
- * Merges this layer with the specified layer concurrently, producing a new layer with combined input and output types.
1568
+ * Merges this layer with another layer concurrently, producing a new layer with
1569
+ * combined input, error, and output types.
1570
+ *
1571
+ * **When to use**
1444
1572
  *
1445
- * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1446
- * The layers are built concurrently and their outputs are combined.
1573
+ * Use `merge` when composing from an existing layer in a pipeline. Use
1574
+ * `mergeAll` when you already have all layers as separate arguments.
1575
+ *
1576
+ * **Details**
1577
+ *
1578
+ * This is a binary version of `mergeAll` that merges exactly two layers or one
1579
+ * layer with an array of layers. The layers are built concurrently and their
1580
+ * outputs are combined.
1447
1581
  *
1448
1582
  * **Example** (Merging two layers)
1449
1583
  *
@@ -1458,25 +1592,36 @@ export const merge: {
1458
1592
  * readonly log: (msg: string) => Effect.Effect<void>
1459
1593
  * }>()("Logger") {}
1460
1594
  *
1461
- * const dbLayer = Layer.succeed(Database)({
1595
+ * const dbLayer = Layer.succeed(Database, {
1462
1596
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
1463
1597
  * })
1464
- * const loggerLayer = Layer.succeed(Logger)({
1598
+ * const loggerLayer = Layer.succeed(Logger, {
1465
1599
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
1466
1600
  * })
1467
1601
  *
1468
1602
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1469
1603
  * ```
1470
1604
  *
1605
+ * @see {@link mergeAll} for merging several layers at once
1606
+ *
1471
1607
  * @category zipping
1472
1608
  * @since 2.0.0
1473
1609
  */
1474
1610
  <RIn, E, ROut>(that: Layer<ROut, E, RIn>): <RIn2, E2, ROut2>(self: Layer<ROut2, E2, RIn2>) => Layer<ROut | ROut2, E | E2, RIn | RIn2>
1475
1611
  /**
1476
- * Merges this layer with the specified layer concurrently, producing a new layer with combined input and output types.
1612
+ * Merges this layer with another layer concurrently, producing a new layer with
1613
+ * combined input, error, and output types.
1614
+ *
1615
+ * **When to use**
1477
1616
  *
1478
- * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1479
- * The layers are built concurrently and their outputs are combined.
1617
+ * Use `merge` when composing from an existing layer in a pipeline. Use
1618
+ * `mergeAll` when you already have all layers as separate arguments.
1619
+ *
1620
+ * **Details**
1621
+ *
1622
+ * This is a binary version of `mergeAll` that merges exactly two layers or one
1623
+ * layer with an array of layers. The layers are built concurrently and their
1624
+ * outputs are combined.
1480
1625
  *
1481
1626
  * **Example** (Merging two layers)
1482
1627
  *
@@ -1491,16 +1636,18 @@ export const merge: {
1491
1636
  * readonly log: (msg: string) => Effect.Effect<void>
1492
1637
  * }>()("Logger") {}
1493
1638
  *
1494
- * const dbLayer = Layer.succeed(Database)({
1639
+ * const dbLayer = Layer.succeed(Database, {
1495
1640
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
1496
1641
  * })
1497
- * const loggerLayer = Layer.succeed(Logger)({
1642
+ * const loggerLayer = Layer.succeed(Logger, {
1498
1643
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
1499
1644
  * })
1500
1645
  *
1501
1646
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1502
1647
  * ```
1503
1648
  *
1649
+ * @see {@link mergeAll} for merging several layers at once
1650
+ *
1504
1651
  * @category zipping
1505
1652
  * @since 2.0.0
1506
1653
  */
@@ -1513,10 +1660,19 @@ export const merge: {
1513
1660
  | R
1514
1661
  >
1515
1662
  /**
1516
- * Merges this layer with the specified layer concurrently, producing a new layer with combined input and output types.
1663
+ * Merges this layer with another layer concurrently, producing a new layer with
1664
+ * combined input, error, and output types.
1517
1665
  *
1518
- * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1519
- * The layers are built concurrently and their outputs are combined.
1666
+ * **When to use**
1667
+ *
1668
+ * Use `merge` when composing from an existing layer in a pipeline. Use
1669
+ * `mergeAll` when you already have all layers as separate arguments.
1670
+ *
1671
+ * **Details**
1672
+ *
1673
+ * This is a binary version of `mergeAll` that merges exactly two layers or one
1674
+ * layer with an array of layers. The layers are built concurrently and their
1675
+ * outputs are combined.
1520
1676
  *
1521
1677
  * **Example** (Merging two layers)
1522
1678
  *
@@ -1531,25 +1687,36 @@ export const merge: {
1531
1687
  * readonly log: (msg: string) => Effect.Effect<void>
1532
1688
  * }>()("Logger") {}
1533
1689
  *
1534
- * const dbLayer = Layer.succeed(Database)({
1690
+ * const dbLayer = Layer.succeed(Database, {
1535
1691
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
1536
1692
  * })
1537
- * const loggerLayer = Layer.succeed(Logger)({
1693
+ * const loggerLayer = Layer.succeed(Logger, {
1538
1694
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
1539
1695
  * })
1540
1696
  *
1541
1697
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1542
1698
  * ```
1543
1699
  *
1700
+ * @see {@link mergeAll} for merging several layers at once
1701
+ *
1544
1702
  * @category zipping
1545
1703
  * @since 2.0.0
1546
1704
  */
1547
1705
  <RIn2, E2, ROut2, RIn, E, ROut>(self: Layer<ROut2, E2, RIn2>, that: Layer<ROut, E, RIn>): Layer<ROut | ROut2, E | E2, RIn | RIn2>
1548
1706
  /**
1549
- * Merges this layer with the specified layer concurrently, producing a new layer with combined input and output types.
1707
+ * Merges this layer with another layer concurrently, producing a new layer with
1708
+ * combined input, error, and output types.
1709
+ *
1710
+ * **When to use**
1711
+ *
1712
+ * Use `merge` when composing from an existing layer in a pipeline. Use
1713
+ * `mergeAll` when you already have all layers as separate arguments.
1550
1714
  *
1551
- * This is a binary version of `mergeAll` that merges exactly two layers or one layer with an array of layers.
1552
- * The layers are built concurrently and their outputs are combined.
1715
+ * **Details**
1716
+ *
1717
+ * This is a binary version of `mergeAll` that merges exactly two layers or one
1718
+ * layer with an array of layers. The layers are built concurrently and their
1719
+ * outputs are combined.
1553
1720
  *
1554
1721
  * **Example** (Merging two layers)
1555
1722
  *
@@ -1564,16 +1731,18 @@ export const merge: {
1564
1731
  * readonly log: (msg: string) => Effect.Effect<void>
1565
1732
  * }>()("Logger") {}
1566
1733
  *
1567
- * const dbLayer = Layer.succeed(Database)({
1734
+ * const dbLayer = Layer.succeed(Database, {
1568
1735
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
1569
1736
  * })
1570
- * const loggerLayer = Layer.succeed(Logger)({
1737
+ * const loggerLayer = Layer.succeed(Logger, {
1571
1738
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
1572
1739
  * })
1573
1740
  *
1574
1741
  * const mergedLayer = Layer.merge(dbLayer, loggerLayer)
1575
1742
  * ```
1576
1743
  *
1744
+ * @see {@link mergeAll} for merging several layers at once
1745
+ *
1577
1746
  * @category zipping
1578
1747
  * @since 2.0.0
1579
1748
  */
@@ -1610,9 +1779,19 @@ const provideWith = (
1610
1779
  )
1611
1780
 
1612
1781
  /**
1613
- * Feeds the output services of this builder into the input of the specified
1614
- * builder, resulting in a new builder with the inputs of this builder as
1615
- * well as any leftover inputs, and the outputs of the specified builder.
1782
+ * Feeds the output services of the dependency layer into the requirements of
1783
+ * this layer, returning a layer that only provides the services from this layer.
1784
+ *
1785
+ * **When to use**
1786
+ *
1787
+ * Use `provide` when the dependency layer is an implementation detail of the
1788
+ * layer being built and should not be exposed to callers. Use `provideMerge`
1789
+ * when callers should also receive the dependency services.
1790
+ *
1791
+ * **Details**
1792
+ *
1793
+ * In `serviceLayer.pipe(Layer.provide(dependencyLayer))`, the dependency layer is
1794
+ * built first and is used to satisfy the requirements of `serviceLayer`.
1616
1795
  *
1617
1796
  * **Example** (Providing layer dependencies)
1618
1797
  *
@@ -1635,16 +1814,16 @@ const provideWith = (
1635
1814
  * }>()("Logger") {}
1636
1815
  *
1637
1816
  * // Create dependency layers
1638
- * const databaseLayer = Layer.succeed(Database)({
1817
+ * const databaseLayer = Layer.succeed(Database, {
1639
1818
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
1640
1819
  * })
1641
1820
  *
1642
- * const loggerLayer = Layer.succeed(Logger)({
1821
+ * const loggerLayer = Layer.succeed(Logger, {
1643
1822
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
1644
1823
  * })
1645
1824
  *
1646
1825
  * // UserService depends on Database and Logger
1647
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
1826
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
1648
1827
  * const database = yield* Database
1649
1828
  * const logger = yield* Logger
1650
1829
  *
@@ -1673,14 +1852,26 @@ const provideWith = (
1673
1852
  * )
1674
1853
  * ```
1675
1854
  *
1855
+ * @see {@link provideMerge} for retaining the dependency services
1856
+ *
1676
1857
  * @category utils
1677
1858
  * @since 2.0.0
1678
1859
  */
1679
1860
  export const provide: {
1680
1861
  /**
1681
- * Feeds the output services of this builder into the input of the specified
1682
- * builder, resulting in a new builder with the inputs of this builder as
1683
- * well as any leftover inputs, and the outputs of the specified builder.
1862
+ * Feeds the output services of the dependency layer into the requirements of
1863
+ * this layer, returning a layer that only provides the services from this layer.
1864
+ *
1865
+ * **When to use**
1866
+ *
1867
+ * Use `provide` when the dependency layer is an implementation detail of the
1868
+ * layer being built and should not be exposed to callers. Use `provideMerge`
1869
+ * when callers should also receive the dependency services.
1870
+ *
1871
+ * **Details**
1872
+ *
1873
+ * In `serviceLayer.pipe(Layer.provide(dependencyLayer))`, the dependency layer is
1874
+ * built first and is used to satisfy the requirements of `serviceLayer`.
1684
1875
  *
1685
1876
  * **Example** (Providing layer dependencies)
1686
1877
  *
@@ -1703,16 +1894,16 @@ export const provide: {
1703
1894
  * }>()("Logger") {}
1704
1895
  *
1705
1896
  * // Create dependency layers
1706
- * const databaseLayer = Layer.succeed(Database)({
1897
+ * const databaseLayer = Layer.succeed(Database, {
1707
1898
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
1708
1899
  * })
1709
1900
  *
1710
- * const loggerLayer = Layer.succeed(Logger)({
1901
+ * const loggerLayer = Layer.succeed(Logger, {
1711
1902
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
1712
1903
  * })
1713
1904
  *
1714
1905
  * // UserService depends on Database and Logger
1715
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
1906
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
1716
1907
  * const database = yield* Database
1717
1908
  * const logger = yield* Logger
1718
1909
  *
@@ -1741,14 +1932,26 @@ export const provide: {
1741
1932
  * )
1742
1933
  * ```
1743
1934
  *
1935
+ * @see {@link provideMerge} for retaining the dependency services
1936
+ *
1744
1937
  * @category utils
1745
1938
  * @since 2.0.0
1746
1939
  */
1747
1940
  <RIn, E, ROut>(that: Layer<ROut, E, RIn>): <RIn2, E2, ROut2>(self: Layer<ROut2, E2, RIn2>) => Layer<ROut2, E | E2, RIn | Exclude<RIn2, ROut>>
1748
1941
  /**
1749
- * Feeds the output services of this builder into the input of the specified
1750
- * builder, resulting in a new builder with the inputs of this builder as
1751
- * well as any leftover inputs, and the outputs of the specified builder.
1942
+ * Feeds the output services of the dependency layer into the requirements of
1943
+ * this layer, returning a layer that only provides the services from this layer.
1944
+ *
1945
+ * **When to use**
1946
+ *
1947
+ * Use `provide` when the dependency layer is an implementation detail of the
1948
+ * layer being built and should not be exposed to callers. Use `provideMerge`
1949
+ * when callers should also receive the dependency services.
1950
+ *
1951
+ * **Details**
1952
+ *
1953
+ * In `serviceLayer.pipe(Layer.provide(dependencyLayer))`, the dependency layer is
1954
+ * built first and is used to satisfy the requirements of `serviceLayer`.
1752
1955
  *
1753
1956
  * **Example** (Providing layer dependencies)
1754
1957
  *
@@ -1771,16 +1974,16 @@ export const provide: {
1771
1974
  * }>()("Logger") {}
1772
1975
  *
1773
1976
  * // Create dependency layers
1774
- * const databaseLayer = Layer.succeed(Database)({
1977
+ * const databaseLayer = Layer.succeed(Database, {
1775
1978
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
1776
1979
  * })
1777
1980
  *
1778
- * const loggerLayer = Layer.succeed(Logger)({
1981
+ * const loggerLayer = Layer.succeed(Logger, {
1779
1982
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
1780
1983
  * })
1781
1984
  *
1782
1985
  * // UserService depends on Database and Logger
1783
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
1986
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
1784
1987
  * const database = yield* Database
1785
1988
  * const logger = yield* Logger
1786
1989
  *
@@ -1809,6 +2012,8 @@ export const provide: {
1809
2012
  * )
1810
2013
  * ```
1811
2014
  *
2015
+ * @see {@link provideMerge} for retaining the dependency services
2016
+ *
1812
2017
  * @category utils
1813
2018
  * @since 2.0.0
1814
2019
  */
@@ -1821,9 +2026,19 @@ export const provide: {
1821
2026
  | Exclude<R, Success<Layers[number]>>
1822
2027
  >
1823
2028
  /**
1824
- * Feeds the output services of this builder into the input of the specified
1825
- * builder, resulting in a new builder with the inputs of this builder as
1826
- * well as any leftover inputs, and the outputs of the specified builder.
2029
+ * Feeds the output services of the dependency layer into the requirements of
2030
+ * this layer, returning a layer that only provides the services from this layer.
2031
+ *
2032
+ * **When to use**
2033
+ *
2034
+ * Use `provide` when the dependency layer is an implementation detail of the
2035
+ * layer being built and should not be exposed to callers. Use `provideMerge`
2036
+ * when callers should also receive the dependency services.
2037
+ *
2038
+ * **Details**
2039
+ *
2040
+ * In `serviceLayer.pipe(Layer.provide(dependencyLayer))`, the dependency layer is
2041
+ * built first and is used to satisfy the requirements of `serviceLayer`.
1827
2042
  *
1828
2043
  * **Example** (Providing layer dependencies)
1829
2044
  *
@@ -1846,16 +2061,16 @@ export const provide: {
1846
2061
  * }>()("Logger") {}
1847
2062
  *
1848
2063
  * // Create dependency layers
1849
- * const databaseLayer = Layer.succeed(Database)({
2064
+ * const databaseLayer = Layer.succeed(Database, {
1850
2065
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
1851
2066
  * })
1852
2067
  *
1853
- * const loggerLayer = Layer.succeed(Logger)({
2068
+ * const loggerLayer = Layer.succeed(Logger, {
1854
2069
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
1855
2070
  * })
1856
2071
  *
1857
2072
  * // UserService depends on Database and Logger
1858
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
2073
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
1859
2074
  * const database = yield* Database
1860
2075
  * const logger = yield* Logger
1861
2076
  *
@@ -1884,14 +2099,26 @@ export const provide: {
1884
2099
  * )
1885
2100
  * ```
1886
2101
  *
2102
+ * @see {@link provideMerge} for retaining the dependency services
2103
+ *
1887
2104
  * @category utils
1888
2105
  * @since 2.0.0
1889
2106
  */
1890
2107
  <RIn2, E2, ROut2, RIn, E, ROut>(self: Layer<ROut2, E2, RIn2>, that: Layer<ROut, E, RIn>): Layer<ROut2, E | E2, RIn | Exclude<RIn2, ROut>>
1891
2108
  /**
1892
- * Feeds the output services of this builder into the input of the specified
1893
- * builder, resulting in a new builder with the inputs of this builder as
1894
- * well as any leftover inputs, and the outputs of the specified builder.
2109
+ * Feeds the output services of the dependency layer into the requirements of
2110
+ * this layer, returning a layer that only provides the services from this layer.
2111
+ *
2112
+ * **When to use**
2113
+ *
2114
+ * Use `provide` when the dependency layer is an implementation detail of the
2115
+ * layer being built and should not be exposed to callers. Use `provideMerge`
2116
+ * when callers should also receive the dependency services.
2117
+ *
2118
+ * **Details**
2119
+ *
2120
+ * In `serviceLayer.pipe(Layer.provide(dependencyLayer))`, the dependency layer is
2121
+ * built first and is used to satisfy the requirements of `serviceLayer`.
1895
2122
  *
1896
2123
  * **Example** (Providing layer dependencies)
1897
2124
  *
@@ -1914,16 +2141,16 @@ export const provide: {
1914
2141
  * }>()("Logger") {}
1915
2142
  *
1916
2143
  * // Create dependency layers
1917
- * const databaseLayer = Layer.succeed(Database)({
2144
+ * const databaseLayer = Layer.succeed(Database, {
1918
2145
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
1919
2146
  * })
1920
2147
  *
1921
- * const loggerLayer = Layer.succeed(Logger)({
2148
+ * const loggerLayer = Layer.succeed(Logger, {
1922
2149
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
1923
2150
  * })
1924
2151
  *
1925
2152
  * // UserService depends on Database and Logger
1926
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
2153
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
1927
2154
  * const database = yield* Database
1928
2155
  * const logger = yield* Logger
1929
2156
  *
@@ -1952,6 +2179,8 @@ export const provide: {
1952
2179
  * )
1953
2180
  * ```
1954
2181
  *
2182
+ * @see {@link provideMerge} for retaining the dependency services
2183
+ *
1955
2184
  * @category utils
1956
2185
  * @since 2.0.0
1957
2186
  */
@@ -1967,9 +2196,15 @@ export const provide: {
1967
2196
  ) => provideWith(self, that, identity))
1968
2197
 
1969
2198
  /**
1970
- * Feeds the output services of this layer into the input of the specified
1971
- * layer, resulting in a new layer with the inputs of this layer, and the
1972
- * outputs of both layers.
2199
+ * Feeds the output services of the dependency layer into the requirements of
2200
+ * this layer, returning a layer that provides both sets of services.
2201
+ *
2202
+ * **When to use**
2203
+ *
2204
+ * Use this when callers need access to both the service being built and the
2205
+ * dependency used to build it, such as a health check that needs both a
2206
+ * repository and its database. Prefer `provide` when the dependency should stay
2207
+ * private.
1973
2208
  *
1974
2209
  * **Example** (Providing dependencies while retaining services)
1975
2210
  *
@@ -1992,16 +2227,16 @@ export const provide: {
1992
2227
  * }>()("UserService") {}
1993
2228
  *
1994
2229
  * // Create dependency layers
1995
- * const databaseLayer = Layer.succeed(Database)({
2230
+ * const databaseLayer = Layer.succeed(Database, {
1996
2231
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
1997
2232
  * })
1998
2233
  *
1999
- * const loggerLayer = Layer.succeed(Logger)({
2234
+ * const loggerLayer = Layer.succeed(Logger, {
2000
2235
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
2001
2236
  * })
2002
2237
  *
2003
2238
  * // UserService depends on Database and Logger
2004
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
2239
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
2005
2240
  * const database = yield* Database
2006
2241
  * const logger = yield* Logger
2007
2242
  *
@@ -2036,14 +2271,22 @@ export const provide: {
2036
2271
  * )
2037
2272
  * ```
2038
2273
  *
2274
+ * @see {@link provide} for keeping dependency services private
2275
+ *
2039
2276
  * @category utils
2040
2277
  * @since 2.0.0
2041
2278
  */
2042
2279
  export const provideMerge: {
2043
2280
  /**
2044
- * Feeds the output services of this layer into the input of the specified
2045
- * layer, resulting in a new layer with the inputs of this layer, and the
2046
- * outputs of both layers.
2281
+ * Feeds the output services of the dependency layer into the requirements of
2282
+ * this layer, returning a layer that provides both sets of services.
2283
+ *
2284
+ * **When to use**
2285
+ *
2286
+ * Use this when callers need access to both the service being built and the
2287
+ * dependency used to build it, such as a health check that needs both a
2288
+ * repository and its database. Prefer `provide` when the dependency should stay
2289
+ * private.
2047
2290
  *
2048
2291
  * **Example** (Providing dependencies while retaining services)
2049
2292
  *
@@ -2066,16 +2309,16 @@ export const provideMerge: {
2066
2309
  * }>()("UserService") {}
2067
2310
  *
2068
2311
  * // Create dependency layers
2069
- * const databaseLayer = Layer.succeed(Database)({
2312
+ * const databaseLayer = Layer.succeed(Database, {
2070
2313
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
2071
2314
  * })
2072
2315
  *
2073
- * const loggerLayer = Layer.succeed(Logger)({
2316
+ * const loggerLayer = Layer.succeed(Logger, {
2074
2317
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
2075
2318
  * })
2076
2319
  *
2077
2320
  * // UserService depends on Database and Logger
2078
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
2321
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
2079
2322
  * const database = yield* Database
2080
2323
  * const logger = yield* Logger
2081
2324
  *
@@ -2110,14 +2353,22 @@ export const provideMerge: {
2110
2353
  * )
2111
2354
  * ```
2112
2355
  *
2356
+ * @see {@link provide} for keeping dependency services private
2357
+ *
2113
2358
  * @category utils
2114
2359
  * @since 2.0.0
2115
2360
  */
2116
2361
  <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>>
2117
2362
  /**
2118
- * Feeds the output services of this layer into the input of the specified
2119
- * layer, resulting in a new layer with the inputs of this layer, and the
2120
- * outputs of both layers.
2363
+ * Feeds the output services of the dependency layer into the requirements of
2364
+ * this layer, returning a layer that provides both sets of services.
2365
+ *
2366
+ * **When to use**
2367
+ *
2368
+ * Use this when callers need access to both the service being built and the
2369
+ * dependency used to build it, such as a health check that needs both a
2370
+ * repository and its database. Prefer `provide` when the dependency should stay
2371
+ * private.
2121
2372
  *
2122
2373
  * **Example** (Providing dependencies while retaining services)
2123
2374
  *
@@ -2140,16 +2391,16 @@ export const provideMerge: {
2140
2391
  * }>()("UserService") {}
2141
2392
  *
2142
2393
  * // Create dependency layers
2143
- * const databaseLayer = Layer.succeed(Database)({
2394
+ * const databaseLayer = Layer.succeed(Database, {
2144
2395
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
2145
2396
  * })
2146
2397
  *
2147
- * const loggerLayer = Layer.succeed(Logger)({
2398
+ * const loggerLayer = Layer.succeed(Logger, {
2148
2399
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
2149
2400
  * })
2150
2401
  *
2151
2402
  * // UserService depends on Database and Logger
2152
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
2403
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
2153
2404
  * const database = yield* Database
2154
2405
  * const logger = yield* Logger
2155
2406
  *
@@ -2184,6 +2435,8 @@ export const provideMerge: {
2184
2435
  * )
2185
2436
  * ```
2186
2437
  *
2438
+ * @see {@link provide} for keeping dependency services private
2439
+ *
2187
2440
  * @category utils
2188
2441
  * @since 2.0.0
2189
2442
  */
@@ -2196,9 +2449,15 @@ export const provideMerge: {
2196
2449
  | Exclude<R, Success<Layers[number]>>
2197
2450
  >
2198
2451
  /**
2199
- * Feeds the output services of this layer into the input of the specified
2200
- * layer, resulting in a new layer with the inputs of this layer, and the
2201
- * outputs of both layers.
2452
+ * Feeds the output services of the dependency layer into the requirements of
2453
+ * this layer, returning a layer that provides both sets of services.
2454
+ *
2455
+ * **When to use**
2456
+ *
2457
+ * Use this when callers need access to both the service being built and the
2458
+ * dependency used to build it, such as a health check that needs both a
2459
+ * repository and its database. Prefer `provide` when the dependency should stay
2460
+ * private.
2202
2461
  *
2203
2462
  * **Example** (Providing dependencies while retaining services)
2204
2463
  *
@@ -2221,16 +2480,16 @@ export const provideMerge: {
2221
2480
  * }>()("UserService") {}
2222
2481
  *
2223
2482
  * // Create dependency layers
2224
- * const databaseLayer = Layer.succeed(Database)({
2483
+ * const databaseLayer = Layer.succeed(Database, {
2225
2484
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
2226
2485
  * })
2227
2486
  *
2228
- * const loggerLayer = Layer.succeed(Logger)({
2487
+ * const loggerLayer = Layer.succeed(Logger, {
2229
2488
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
2230
2489
  * })
2231
2490
  *
2232
2491
  * // UserService depends on Database and Logger
2233
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
2492
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
2234
2493
  * const database = yield* Database
2235
2494
  * const logger = yield* Logger
2236
2495
  *
@@ -2265,14 +2524,22 @@ export const provideMerge: {
2265
2524
  * )
2266
2525
  * ```
2267
2526
  *
2527
+ * @see {@link provide} for keeping dependency services private
2528
+ *
2268
2529
  * @category utils
2269
2530
  * @since 2.0.0
2270
2531
  */
2271
2532
  <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>>
2272
2533
  /**
2273
- * Feeds the output services of this layer into the input of the specified
2274
- * layer, resulting in a new layer with the inputs of this layer, and the
2275
- * outputs of both layers.
2534
+ * Feeds the output services of the dependency layer into the requirements of
2535
+ * this layer, returning a layer that provides both sets of services.
2536
+ *
2537
+ * **When to use**
2538
+ *
2539
+ * Use this when callers need access to both the service being built and the
2540
+ * dependency used to build it, such as a health check that needs both a
2541
+ * repository and its database. Prefer `provide` when the dependency should stay
2542
+ * private.
2276
2543
  *
2277
2544
  * **Example** (Providing dependencies while retaining services)
2278
2545
  *
@@ -2295,16 +2562,16 @@ export const provideMerge: {
2295
2562
  * }>()("UserService") {}
2296
2563
  *
2297
2564
  * // Create dependency layers
2298
- * const databaseLayer = Layer.succeed(Database)({
2565
+ * const databaseLayer = Layer.succeed(Database, {
2299
2566
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
2300
2567
  * })
2301
2568
  *
2302
- * const loggerLayer = Layer.succeed(Logger)({
2569
+ * const loggerLayer = Layer.succeed(Logger, {
2303
2570
  * log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
2304
2571
  * })
2305
2572
  *
2306
2573
  * // UserService depends on Database and Logger
2307
- * const userServiceLayer = Layer.effect(UserService)(Effect.gen(function*() {
2574
+ * const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
2308
2575
  * const database = yield* Database
2309
2576
  * const logger = yield* Logger
2310
2577
  *
@@ -2339,6 +2606,8 @@ export const provideMerge: {
2339
2606
  * )
2340
2607
  * ```
2341
2608
  *
2609
+ * @see {@link provide} for keeping dependency services private
2610
+ *
2342
2611
  * @category utils
2343
2612
  * @since 2.0.0
2344
2613
  */
@@ -2380,7 +2649,7 @@ export const provideMerge: {
2380
2649
  * }>()("Logger") {}
2381
2650
  *
2382
2651
  * // Base config layer
2383
- * const configLayer = Layer.succeed(Config)({
2652
+ * const configLayer = Layer.succeed(Config, {
2384
2653
  * dbUrl: "postgres://localhost:5432/mydb",
2385
2654
  * logLevel: "debug"
2386
2655
  * })
@@ -2391,7 +2660,7 @@ export const provideMerge: {
2391
2660
  * const config = Context.get(context, Config)
2392
2661
  *
2393
2662
  * // Create database layer based on config
2394
- * const dbLayer = Layer.succeed(Database)({
2663
+ * const dbLayer = Layer.succeed(Database, {
2395
2664
  * query: Effect.fn("Database.query")((sql: string) =>
2396
2665
  * Effect.succeed(
2397
2666
  * `Querying ${config.dbUrl}: ${sql}`
@@ -2399,7 +2668,7 @@ export const provideMerge: {
2399
2668
  * })
2400
2669
  *
2401
2670
  * // Create logger layer based on config
2402
- * const loggerLayer = Layer.succeed(Logger)({
2671
+ * const loggerLayer = Layer.succeed(Logger, {
2403
2672
  * log: Effect.fn("Logger.log")((msg: string) =>
2404
2673
  * config.logLevel === "debug"
2405
2674
  * ? Effect.sync(() => console.log(`[DEBUG] ${msg}`))
@@ -2452,7 +2721,7 @@ export const flatMap: {
2452
2721
  * }>()("Logger") {}
2453
2722
  *
2454
2723
  * // Base config layer
2455
- * const configLayer = Layer.succeed(Config)({
2724
+ * const configLayer = Layer.succeed(Config, {
2456
2725
  * dbUrl: "postgres://localhost:5432/mydb",
2457
2726
  * logLevel: "debug"
2458
2727
  * })
@@ -2463,7 +2732,7 @@ export const flatMap: {
2463
2732
  * const config = Context.get(context, Config)
2464
2733
  *
2465
2734
  * // Create database layer based on config
2466
- * const dbLayer = Layer.succeed(Database)({
2735
+ * const dbLayer = Layer.succeed(Database, {
2467
2736
  * query: Effect.fn("Database.query")((sql: string) =>
2468
2737
  * Effect.succeed(
2469
2738
  * `Querying ${config.dbUrl}: ${sql}`
@@ -2471,7 +2740,7 @@ export const flatMap: {
2471
2740
  * })
2472
2741
  *
2473
2742
  * // Create logger layer based on config
2474
- * const loggerLayer = Layer.succeed(Logger)({
2743
+ * const loggerLayer = Layer.succeed(Logger, {
2475
2744
  * log: Effect.fn("Logger.log")((msg: string) =>
2476
2745
  * config.logLevel === "debug"
2477
2746
  * ? Effect.sync(() => console.log(`[DEBUG] ${msg}`))
@@ -2524,7 +2793,7 @@ export const flatMap: {
2524
2793
  * }>()("Logger") {}
2525
2794
  *
2526
2795
  * // Base config layer
2527
- * const configLayer = Layer.succeed(Config)({
2796
+ * const configLayer = Layer.succeed(Config, {
2528
2797
  * dbUrl: "postgres://localhost:5432/mydb",
2529
2798
  * logLevel: "debug"
2530
2799
  * })
@@ -2535,7 +2804,7 @@ export const flatMap: {
2535
2804
  * const config = Context.get(context, Config)
2536
2805
  *
2537
2806
  * // Create database layer based on config
2538
- * const dbLayer = Layer.succeed(Database)({
2807
+ * const dbLayer = Layer.succeed(Database, {
2539
2808
  * query: Effect.fn("Database.query")((sql: string) =>
2540
2809
  * Effect.succeed(
2541
2810
  * `Querying ${config.dbUrl}: ${sql}`
@@ -2543,7 +2812,7 @@ export const flatMap: {
2543
2812
  * })
2544
2813
  *
2545
2814
  * // Create logger layer based on config
2546
- * const loggerLayer = Layer.succeed(Logger)({
2815
+ * const loggerLayer = Layer.succeed(Logger, {
2547
2816
  * log: Effect.fn("Logger.log")((msg: string) =>
2548
2817
  * config.logLevel === "debug"
2549
2818
  * ? Effect.sync(() => console.log(`[DEBUG] ${msg}`))
@@ -2591,6 +2860,11 @@ export const flatMap: {
2591
2860
  /**
2592
2861
  * Performs the specified effect if this layer succeeds.
2593
2862
  *
2863
+ * **Details**
2864
+ *
2865
+ * The callback receives the services produced by this layer. Its result is
2866
+ * discarded, and the original layer output is preserved.
2867
+ *
2594
2868
  * @category sequencing
2595
2869
  * @since 2.0.0
2596
2870
  */
@@ -2598,6 +2872,11 @@ export const tap: {
2598
2872
  /**
2599
2873
  * Performs the specified effect if this layer succeeds.
2600
2874
  *
2875
+ * **Details**
2876
+ *
2877
+ * The callback receives the services produced by this layer. Its result is
2878
+ * discarded, and the original layer output is preserved.
2879
+ *
2601
2880
  * @category sequencing
2602
2881
  * @since 2.0.0
2603
2882
  */
@@ -2605,6 +2884,11 @@ export const tap: {
2605
2884
  /**
2606
2885
  * Performs the specified effect if this layer succeeds.
2607
2886
  *
2887
+ * **Details**
2888
+ *
2889
+ * The callback receives the services produced by this layer. Its result is
2890
+ * discarded, and the original layer output is preserved.
2891
+ *
2608
2892
  * @category sequencing
2609
2893
  * @since 2.0.0
2610
2894
  */
@@ -2626,6 +2910,12 @@ export const tap: {
2626
2910
  /**
2627
2911
  * Performs the specified effect if this layer fails.
2628
2912
  *
2913
+ * **Details**
2914
+ *
2915
+ * The callback receives the typed error. If the callback succeeds, the layer
2916
+ * still fails with the original error; if the callback fails, that failure is
2917
+ * added to the layer's error type.
2918
+ *
2629
2919
  * @category sequencing
2630
2920
  * @since 2.0.0
2631
2921
  */
@@ -2633,6 +2923,12 @@ export const tapError: {
2633
2923
  /**
2634
2924
  * Performs the specified effect if this layer fails.
2635
2925
  *
2926
+ * **Details**
2927
+ *
2928
+ * The callback receives the typed error. If the callback succeeds, the layer
2929
+ * still fails with the original error; if the callback fails, that failure is
2930
+ * added to the layer's error type.
2931
+ *
2636
2932
  * @category sequencing
2637
2933
  * @since 2.0.0
2638
2934
  */
@@ -2640,6 +2936,12 @@ export const tapError: {
2640
2936
  /**
2641
2937
  * Performs the specified effect if this layer fails.
2642
2938
  *
2939
+ * **Details**
2940
+ *
2941
+ * The callback receives the typed error. If the callback succeeds, the layer
2942
+ * still fails with the original error; if the callback fails, that failure is
2943
+ * added to the layer's error type.
2944
+ *
2643
2945
  * @category sequencing
2644
2946
  * @since 2.0.0
2645
2947
  */
@@ -2659,6 +2961,7 @@ export const tapError: {
2659
2961
  * Performs the specified effect when this layer fails with any cause.
2660
2962
  *
2661
2963
  * **Details**
2964
+ *
2662
2965
  * The callback receives the layer's `Cause`, so it can inspect typed errors,
2663
2966
  * defects, and interruption information. If the callback succeeds, the layer
2664
2967
  * fails again with the original cause; if the callback fails, that failure is
@@ -2672,6 +2975,7 @@ export const tapCause: {
2672
2975
  * Performs the specified effect when this layer fails with any cause.
2673
2976
  *
2674
2977
  * **Details**
2978
+ *
2675
2979
  * The callback receives the layer's `Cause`, so it can inspect typed errors,
2676
2980
  * defects, and interruption information. If the callback succeeds, the layer
2677
2981
  * fails again with the original cause; if the callback fails, that failure is
@@ -2685,6 +2989,7 @@ export const tapCause: {
2685
2989
  * Performs the specified effect when this layer fails with any cause.
2686
2990
  *
2687
2991
  * **Details**
2992
+ *
2688
2993
  * The callback receives the layer's `Cause`, so it can inspect typed errors,
2689
2994
  * defects, and interruption information. If the callback succeeds, the layer
2690
2995
  * fails again with the original cause; if the callback fails, that failure is
@@ -2710,8 +3015,13 @@ export const tapCause: {
2710
3015
  ))
2711
3016
 
2712
3017
  /**
2713
- * Translates effect failure into death of the fiber, making all failures
2714
- * unchecked and not a part of the type of the layer.
3018
+ * Converts layer construction failures into defects, removing them from the
3019
+ * layer's error type.
3020
+ *
3021
+ * **Details**
3022
+ *
3023
+ * Use this only when failures should be treated as unrecoverable defects rather
3024
+ * than typed errors that callers can handle.
2715
3025
  *
2716
3026
  * **Example** (Converting layer failures to defects)
2717
3027
  *
@@ -2727,7 +3037,7 @@ export const tapCause: {
2727
3037
  * }>()("Database") {}
2728
3038
  *
2729
3039
  * // Layer that can fail during construction
2730
- * const flakyDatabaseLayer = Layer.effect(Database)(Effect.gen(function*() {
3040
+ * const flakyDatabaseLayer = Layer.effect(Database, Effect.gen(function*() {
2731
3041
  * console.log("connecting")
2732
3042
  * return yield* new DatabaseError({ message: "Connection failed" })
2733
3043
  * }))
@@ -2774,7 +3084,16 @@ const catch_: {
2774
3084
 
2775
3085
  export {
2776
3086
  /**
2777
- * Recovers from all errors.
3087
+ * Recovers from all typed errors by switching to another layer.
3088
+ *
3089
+ * **When to use**
3090
+ *
3091
+ * Use `catch` when every typed construction error should use the same recovery
3092
+ * path. Use `catchTag` to recover from specific tagged errors, and `catchCause`
3093
+ * when recovery needs the full failure cause.
3094
+ *
3095
+ * @see {@link catchTag} for recovering from specific tagged errors
3096
+ * @see {@link catchCause} for recovering with access to the full cause
2778
3097
  *
2779
3098
  * @category error handling
2780
3099
  * @since 4.0.0
@@ -2785,6 +3104,12 @@ export {
2785
3104
  /**
2786
3105
  * Recovers from specific tagged errors.
2787
3106
  *
3107
+ * **When to use**
3108
+ *
3109
+ * Use `catchTag` when only some tagged construction errors should be recovered.
3110
+ * Use `catchCause` when recovery depends on defects, interruption, or other
3111
+ * cause information.
3112
+ *
2788
3113
  * **Example** (Recovering from tagged layer errors)
2789
3114
  *
2790
3115
  * ```ts
@@ -2796,15 +3121,17 @@ export {
2796
3121
  * readonly apiUrl: string
2797
3122
  * }>()("Config") {}
2798
3123
  *
2799
- * const configLayer = Layer.effect(Config)(Effect.fail(new ConfigError()))
3124
+ * const configLayer = Layer.effect(Config, Effect.fail(new ConfigError()))
2800
3125
  *
2801
- * const fallbackLayer = Layer.succeed(Config)({ apiUrl: "http://localhost" })
3126
+ * const fallbackLayer = Layer.succeed(Config, { apiUrl: "http://localhost" })
2802
3127
  *
2803
3128
  * const recovered = configLayer.pipe(
2804
3129
  * Layer.catchTag("ConfigError", () => fallbackLayer)
2805
3130
  * )
2806
3131
  * ```
2807
3132
  *
3133
+ * @see {@link catchCause} for recovering with access to the full cause
3134
+ *
2808
3135
  * @category error handling
2809
3136
  * @since 4.0.0
2810
3137
  */
@@ -2812,6 +3139,12 @@ export const catchTag: {
2812
3139
  /**
2813
3140
  * Recovers from specific tagged errors.
2814
3141
  *
3142
+ * **When to use**
3143
+ *
3144
+ * Use `catchTag` when only some tagged construction errors should be recovered.
3145
+ * Use `catchCause` when recovery depends on defects, interruption, or other
3146
+ * cause information.
3147
+ *
2815
3148
  * **Example** (Recovering from tagged layer errors)
2816
3149
  *
2817
3150
  * ```ts
@@ -2823,15 +3156,17 @@ export const catchTag: {
2823
3156
  * readonly apiUrl: string
2824
3157
  * }>()("Config") {}
2825
3158
  *
2826
- * const configLayer = Layer.effect(Config)(Effect.fail(new ConfigError()))
3159
+ * const configLayer = Layer.effect(Config, Effect.fail(new ConfigError()))
2827
3160
  *
2828
- * const fallbackLayer = Layer.succeed(Config)({ apiUrl: "http://localhost" })
3161
+ * const fallbackLayer = Layer.succeed(Config, { apiUrl: "http://localhost" })
2829
3162
  *
2830
3163
  * const recovered = configLayer.pipe(
2831
3164
  * Layer.catchTag("ConfigError", () => fallbackLayer)
2832
3165
  * )
2833
3166
  * ```
2834
3167
  *
3168
+ * @see {@link catchCause} for recovering with access to the full cause
3169
+ *
2835
3170
  * @category error handling
2836
3171
  * @since 4.0.0
2837
3172
  */
@@ -2850,6 +3185,12 @@ export const catchTag: {
2850
3185
  /**
2851
3186
  * Recovers from specific tagged errors.
2852
3187
  *
3188
+ * **When to use**
3189
+ *
3190
+ * Use `catchTag` when only some tagged construction errors should be recovered.
3191
+ * Use `catchCause` when recovery depends on defects, interruption, or other
3192
+ * cause information.
3193
+ *
2853
3194
  * **Example** (Recovering from tagged layer errors)
2854
3195
  *
2855
3196
  * ```ts
@@ -2861,15 +3202,17 @@ export const catchTag: {
2861
3202
  * readonly apiUrl: string
2862
3203
  * }>()("Config") {}
2863
3204
  *
2864
- * const configLayer = Layer.effect(Config)(Effect.fail(new ConfigError()))
3205
+ * const configLayer = Layer.effect(Config, Effect.fail(new ConfigError()))
2865
3206
  *
2866
- * const fallbackLayer = Layer.succeed(Config)({ apiUrl: "http://localhost" })
3207
+ * const fallbackLayer = Layer.succeed(Config, { apiUrl: "http://localhost" })
2867
3208
  *
2868
3209
  * const recovered = configLayer.pipe(
2869
3210
  * Layer.catchTag("ConfigError", () => fallbackLayer)
2870
3211
  * )
2871
3212
  * ```
2872
3213
  *
3214
+ * @see {@link catchCause} for recovering with access to the full cause
3215
+ *
2873
3216
  * @category error handling
2874
3217
  * @since 4.0.0
2875
3218
  */
@@ -2914,10 +3257,18 @@ export const catchTag: {
2914
3257
  /**
2915
3258
  * Recovers from any failure cause by switching to another layer.
2916
3259
  *
3260
+ * **When to use**
3261
+ *
3262
+ * Use `catchCause` when recovery needs more than the typed error, such as
3263
+ * defects or interruption information. Use `catchTag` when recovery only needs
3264
+ * to match specific tagged errors.
3265
+ *
2917
3266
  * **Details**
3267
+ *
2918
3268
  * The handler receives the full `Cause` of the failed layer, including typed
2919
- * errors, defects, and interruption information, and returns the fallback layer
2920
- * to build instead.
3269
+ * errors, unexpected defects, and interruption information, and returns the
3270
+ * fallback layer to build instead. Finalizers for resources acquired by the
3271
+ * failed layer are still run before the fallback layer is acquired.
2921
3272
  *
2922
3273
  * **Example** (Recovering from layer failures by cause)
2923
3274
  *
@@ -2932,13 +3283,13 @@ export const catchTag: {
2932
3283
  * readonly query: (sql: string) => Effect.Effect<string>
2933
3284
  * }>()("Database") {}
2934
3285
  *
2935
- * const primaryDatabaseLayer = Layer.effect(Database)(
3286
+ * const primaryDatabaseLayer = Layer.effect(Database,
2936
3287
  * Effect.fail(new DatabaseError({ message: "Primary DB unreachable" }))
2937
3288
  * )
2938
3289
  *
2939
3290
  * const databaseWithFallback = primaryDatabaseLayer.pipe(
2940
3291
  * Layer.catchCause(() => {
2941
- * return Layer.succeed(Database)({
3292
+ * return Layer.succeed(Database, {
2942
3293
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
2943
3294
  * })
2944
3295
  * })
@@ -2956,6 +3307,8 @@ export const catchTag: {
2956
3307
  * // Memory: SELECT * FROM users
2957
3308
  * ```
2958
3309
  *
3310
+ * @see {@link catchTag} for recovering from specific tagged errors
3311
+ *
2959
3312
  * @category error handling
2960
3313
  * @since 4.0.0
2961
3314
  */
@@ -2963,10 +3316,18 @@ export const catchCause: {
2963
3316
  /**
2964
3317
  * Recovers from any failure cause by switching to another layer.
2965
3318
  *
3319
+ * **When to use**
3320
+ *
3321
+ * Use `catchCause` when recovery needs more than the typed error, such as
3322
+ * defects or interruption information. Use `catchTag` when recovery only needs
3323
+ * to match specific tagged errors.
3324
+ *
2966
3325
  * **Details**
3326
+ *
2967
3327
  * The handler receives the full `Cause` of the failed layer, including typed
2968
- * errors, defects, and interruption information, and returns the fallback layer
2969
- * to build instead.
3328
+ * errors, unexpected defects, and interruption information, and returns the
3329
+ * fallback layer to build instead. Finalizers for resources acquired by the
3330
+ * failed layer are still run before the fallback layer is acquired.
2970
3331
  *
2971
3332
  * **Example** (Recovering from layer failures by cause)
2972
3333
  *
@@ -2981,13 +3342,13 @@ export const catchCause: {
2981
3342
  * readonly query: (sql: string) => Effect.Effect<string>
2982
3343
  * }>()("Database") {}
2983
3344
  *
2984
- * const primaryDatabaseLayer = Layer.effect(Database)(
3345
+ * const primaryDatabaseLayer = Layer.effect(Database,
2985
3346
  * Effect.fail(new DatabaseError({ message: "Primary DB unreachable" }))
2986
3347
  * )
2987
3348
  *
2988
3349
  * const databaseWithFallback = primaryDatabaseLayer.pipe(
2989
3350
  * Layer.catchCause(() => {
2990
- * return Layer.succeed(Database)({
3351
+ * return Layer.succeed(Database, {
2991
3352
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
2992
3353
  * })
2993
3354
  * })
@@ -3005,6 +3366,8 @@ export const catchCause: {
3005
3366
  * // Memory: SELECT * FROM users
3006
3367
  * ```
3007
3368
  *
3369
+ * @see {@link catchTag} for recovering from specific tagged errors
3370
+ *
3008
3371
  * @category error handling
3009
3372
  * @since 4.0.0
3010
3373
  */
@@ -3012,10 +3375,18 @@ export const catchCause: {
3012
3375
  /**
3013
3376
  * Recovers from any failure cause by switching to another layer.
3014
3377
  *
3378
+ * **When to use**
3379
+ *
3380
+ * Use `catchCause` when recovery needs more than the typed error, such as
3381
+ * defects or interruption information. Use `catchTag` when recovery only needs
3382
+ * to match specific tagged errors.
3383
+ *
3015
3384
  * **Details**
3385
+ *
3016
3386
  * The handler receives the full `Cause` of the failed layer, including typed
3017
- * errors, defects, and interruption information, and returns the fallback layer
3018
- * to build instead.
3387
+ * errors, unexpected defects, and interruption information, and returns the
3388
+ * fallback layer to build instead. Finalizers for resources acquired by the
3389
+ * failed layer are still run before the fallback layer is acquired.
3019
3390
  *
3020
3391
  * **Example** (Recovering from layer failures by cause)
3021
3392
  *
@@ -3030,13 +3401,13 @@ export const catchCause: {
3030
3401
  * readonly query: (sql: string) => Effect.Effect<string>
3031
3402
  * }>()("Database") {}
3032
3403
  *
3033
- * const primaryDatabaseLayer = Layer.effect(Database)(
3404
+ * const primaryDatabaseLayer = Layer.effect(Database,
3034
3405
  * Effect.fail(new DatabaseError({ message: "Primary DB unreachable" }))
3035
3406
  * )
3036
3407
  *
3037
3408
  * const databaseWithFallback = primaryDatabaseLayer.pipe(
3038
3409
  * Layer.catchCause(() => {
3039
- * return Layer.succeed(Database)({
3410
+ * return Layer.succeed(Database, {
3040
3411
  * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
3041
3412
  * })
3042
3413
  * })
@@ -3054,6 +3425,8 @@ export const catchCause: {
3054
3425
  * // Memory: SELECT * FROM users
3055
3426
  * ```
3056
3427
  *
3428
+ * @see {@link catchTag} for recovering from specific tagged errors
3429
+ *
3057
3430
  * @category error handling
3058
3431
  * @since 4.0.0
3059
3432
  */
@@ -3075,6 +3448,11 @@ export const catchCause: {
3075
3448
  /**
3076
3449
  * Updates a service in the context with a new implementation.
3077
3450
  *
3451
+ * **When to use**
3452
+ *
3453
+ * Use this to adapt or extend a service's behavior during the creation of a
3454
+ * layer.
3455
+ *
3078
3456
  * **Details**
3079
3457
  *
3080
3458
  * This function modifies the existing implementation of a service in the
@@ -3082,11 +3460,6 @@ export const catchCause: {
3082
3460
  * transformation function `f`, and replaces the old service with the
3083
3461
  * transformed one.
3084
3462
  *
3085
- * **When to Use**
3086
- *
3087
- * This is useful for adapting or extending a service's behavior during the
3088
- * creation of a layer.
3089
- *
3090
3463
  * @category utils
3091
3464
  * @since 3.13.0
3092
3465
  */
@@ -3094,6 +3467,11 @@ export const updateService: {
3094
3467
  /**
3095
3468
  * Updates a service in the context with a new implementation.
3096
3469
  *
3470
+ * **When to use**
3471
+ *
3472
+ * Use this to adapt or extend a service's behavior during the creation of a
3473
+ * layer.
3474
+ *
3097
3475
  * **Details**
3098
3476
  *
3099
3477
  * This function modifies the existing implementation of a service in the
@@ -3101,11 +3479,6 @@ export const updateService: {
3101
3479
  * transformation function `f`, and replaces the old service with the
3102
3480
  * transformed one.
3103
3481
  *
3104
- * **When to Use**
3105
- *
3106
- * This is useful for adapting or extending a service's behavior during the
3107
- * creation of a layer.
3108
- *
3109
3482
  * @category utils
3110
3483
  * @since 3.13.0
3111
3484
  */
@@ -3113,6 +3486,11 @@ export const updateService: {
3113
3486
  /**
3114
3487
  * Updates a service in the context with a new implementation.
3115
3488
  *
3489
+ * **When to use**
3490
+ *
3491
+ * Use this to adapt or extend a service's behavior during the creation of a
3492
+ * layer.
3493
+ *
3116
3494
  * **Details**
3117
3495
  *
3118
3496
  * This function modifies the existing implementation of a service in the
@@ -3120,11 +3498,6 @@ export const updateService: {
3120
3498
  * transformation function `f`, and replaces the old service with the
3121
3499
  * transformed one.
3122
3500
  *
3123
- * **When to Use**
3124
- *
3125
- * This is useful for adapting or extending a service's behavior during the
3126
- * creation of a layer.
3127
- *
3128
3501
  * @category utils
3129
3502
  * @since 3.13.0
3130
3503
  */
@@ -3145,6 +3518,13 @@ export const updateService: {
3145
3518
  /**
3146
3519
  * Creates a fresh version of this layer that will not be shared.
3147
3520
  *
3521
+ * **When to use**
3522
+ *
3523
+ * Use `fresh` when two parts of an application must receive separate instances
3524
+ * of a resource, such as two independent client sessions. Do not use it just to
3525
+ * work around confusing composition: by default, sharing the same layer value is
3526
+ * usually the desired behavior.
3527
+ *
3148
3528
  * **Example** (Creating non-shared layer instances)
3149
3529
  *
3150
3530
  * ```ts
@@ -3162,12 +3542,12 @@ export const updateService: {
3162
3542
  * readonly counterId: number
3163
3543
  * }>()("Right") {}
3164
3544
  *
3165
- * const leftLayer = Layer.effect(Left)(Effect.gen(function*() {
3545
+ * const leftLayer = Layer.effect(Left, Effect.gen(function*() {
3166
3546
  * const counter = yield* Counter
3167
3547
  * return { counterId: counter.id }
3168
3548
  * }))
3169
3549
  *
3170
- * const rightLayer = Layer.effect(Right)(Effect.gen(function*() {
3550
+ * const rightLayer = Layer.effect(Right, Effect.gen(function*() {
3171
3551
  * const counter = yield* Counter
3172
3552
  * return { counterId: counter.id }
3173
3553
  * }))
@@ -3181,7 +3561,7 @@ export const updateService: {
3181
3561
  * const program = Effect.gen(function*() {
3182
3562
  * const nextId = yield* Ref.make(0)
3183
3563
  *
3184
- * const counterLayer = Layer.effect(Counter)(Effect.gen(function*() {
3564
+ * const counterLayer = Layer.effect(Counter, Effect.gen(function*() {
3185
3565
  * const id = yield* Ref.updateAndGet(nextId, (n) => n + 1)
3186
3566
  * console.log("constructed Counter")
3187
3567
  * return { id }
@@ -3218,8 +3598,16 @@ export const fresh = <A, E, R>(self: Layer<A, E, R>): Layer<A, E, R> =>
3218
3598
  fromBuildUnsafe((_, scope) => self.build(makeMemoMapUnsafe(), scope))
3219
3599
 
3220
3600
  /**
3221
- * Builds this layer and uses it until it is interrupted. This is useful when
3222
- * your entire application is a layer, such as an HTTP server.
3601
+ * Builds this layer and keeps it alive until the returned effect is interrupted.
3602
+ *
3603
+ * **When to use**
3604
+ *
3605
+ * Use this when your entire application is a layer, such as an HTTP server.
3606
+ *
3607
+ * **Details**
3608
+ *
3609
+ * When the returned effect is interrupted, the layer scope is closed and all
3610
+ * finalizers registered during layer acquisition are run.
3223
3611
  *
3224
3612
  * **Example** (Launching an application layer)
3225
3613
  *
@@ -3236,7 +3624,7 @@ export const fresh = <A, E, R>(self: Layer<A, E, R>): Layer<A, E, R> =>
3236
3624
  * }>()("Logger") {}
3237
3625
  *
3238
3626
  * // Server layer that starts an HTTP server
3239
- * const serverLayer = Layer.effect(HttpServer)(Effect.gen(function*() {
3627
+ * const serverLayer = Layer.effect(HttpServer, Effect.gen(function*() {
3240
3628
  * yield* Console.log("Starting HTTP server...")
3241
3629
  *
3242
3630
  * return {
@@ -3251,7 +3639,7 @@ export const fresh = <A, E, R>(self: Layer<A, E, R>): Layer<A, E, R> =>
3251
3639
  * }
3252
3640
  * }))
3253
3641
  *
3254
- * const loggerLayer = Layer.succeed(Logger)({
3642
+ * const loggerLayer = Layer.succeed(Logger, {
3255
3643
  * log: Effect.fn("Logger.log")((msg: string) => Console.log(`[LOG] ${msg}`))
3256
3644
  * })
3257
3645
  *
@@ -3278,11 +3666,13 @@ export const launch = <RIn, E, ROut>(self: Layer<ROut, E, RIn>): Effect<never, E
3278
3666
  /**
3279
3667
  * A utility type for creating partial mocks of services in testing.
3280
3668
  *
3669
+ * **Details**
3670
+ *
3281
3671
  * This type makes Effect methods and Effect-returning functions optional,
3282
3672
  * while keeping non-Effect properties required. This allows you to provide
3283
3673
  * only the methods you need to test while leaving others unimplemented.
3284
3674
  *
3285
- * @category Testing
3675
+ * @category testing
3286
3676
  * @since 3.17.0
3287
3677
  */
3288
3678
  export type PartialEffectful<A extends object> = Types.Simplify<
@@ -3304,8 +3694,16 @@ type AnyEffectOrStream =
3304
3694
 
3305
3695
  /**
3306
3696
  * Creates a mock layer for testing purposes. You can provide a partial
3307
- * implementation of the service, and any methods not provided will
3308
- * throw an unimplemented defect when called.
3697
+ * implementation of the service. Any missing members that are `Effect`s,
3698
+ * `Stream`s, `Channel`s, or functions returning them will fail with an
3699
+ * unimplemented defect when used.
3700
+ *
3701
+ * **Details**
3702
+ *
3703
+ * Missing members are represented by a value that can be used as an `Effect`,
3704
+ * `Stream`, `Channel`, or as a function returning an `Effect`. This lets the
3705
+ * mock preserve the shape of common service methods while still failing loudly
3706
+ * when an unimplemented member is exercised.
3309
3707
  *
3310
3708
  * **Example** (Mocking services for tests)
3311
3709
  *
@@ -3346,14 +3744,22 @@ type AnyEffectOrStream =
3346
3744
  * )
3347
3745
  * ```
3348
3746
  *
3349
- * @category Testing
3747
+ * @category testing
3350
3748
  * @since 3.17.0
3351
3749
  */
3352
3750
  export const mock: {
3353
3751
  /**
3354
3752
  * Creates a mock layer for testing purposes. You can provide a partial
3355
- * implementation of the service, and any methods not provided will
3356
- * throw an unimplemented defect when called.
3753
+ * implementation of the service. Any missing members that are `Effect`s,
3754
+ * `Stream`s, `Channel`s, or functions returning them will fail with an
3755
+ * unimplemented defect when used.
3756
+ *
3757
+ * **Details**
3758
+ *
3759
+ * Missing members are represented by a value that can be used as an `Effect`,
3760
+ * `Stream`, `Channel`, or as a function returning an `Effect`. This lets the
3761
+ * mock preserve the shape of common service methods while still failing loudly
3762
+ * when an unimplemented member is exercised.
3357
3763
  *
3358
3764
  * **Example** (Mocking services for tests)
3359
3765
  *
@@ -3394,14 +3800,22 @@ export const mock: {
3394
3800
  * )
3395
3801
  * ```
3396
3802
  *
3397
- * @category Testing
3803
+ * @category testing
3398
3804
  * @since 3.17.0
3399
3805
  */
3400
3806
  <I, S extends object>(service: Context.Key<I, S>): (implementation: PartialEffectful<S>) => Layer<I>
3401
3807
  /**
3402
3808
  * Creates a mock layer for testing purposes. You can provide a partial
3403
- * implementation of the service, and any methods not provided will
3404
- * throw an unimplemented defect when called.
3809
+ * implementation of the service. Any missing members that are `Effect`s,
3810
+ * `Stream`s, `Channel`s, or functions returning them will fail with an
3811
+ * unimplemented defect when used.
3812
+ *
3813
+ * **Details**
3814
+ *
3815
+ * Missing members are represented by a value that can be used as an `Effect`,
3816
+ * `Stream`, `Channel`, or as a function returning an `Effect`. This lets the
3817
+ * mock preserve the shape of common service methods while still failing loudly
3818
+ * when an unimplemented member is exercised.
3405
3819
  *
3406
3820
  * **Example** (Mocking services for tests)
3407
3821
  *
@@ -3442,7 +3856,7 @@ export const mock: {
3442
3856
  * )
3443
3857
  * ```
3444
3858
  *
3445
- * @category Testing
3859
+ * @category testing
3446
3860
  * @since 3.17.0
3447
3861
  */
3448
3862
  <I, S extends object>(
@@ -3504,10 +3918,12 @@ const ChannelTypeId: Channel.TypeId = "~effect/Channel"
3504
3918
  // -----------------------------------------------------------------------------
3505
3919
 
3506
3920
  /**
3507
- * Ensures that an layer's success type extends a given type `ROut`.
3921
+ * Ensures that a layer's success type extends a given type `ROut`.
3922
+ *
3923
+ * **Details**
3508
3924
  *
3509
3925
  * This function provides compile-time type checking to ensure that the success
3510
- * value of an layer conforms to a specific type constraint.
3926
+ * value of a layer conforms to a specific type constraint.
3511
3927
  *
3512
3928
  * **Example** (Constraining layer success types)
3513
3929
  *
@@ -3529,17 +3945,19 @@ const ChannelTypeId: Channel.TypeId = "~effect/Channel"
3529
3945
  * // Type 'string' is not assignable to type 'number'
3530
3946
  * ```
3531
3947
  *
3532
- * @category Type constraints
3948
+ * @category utility types
3533
3949
  * @since 4.0.0
3534
3950
  */
3535
3951
  export const satisfiesSuccessType =
3536
3952
  <ROut>() => <ROut2 extends ROut, E, RIn>(layer: Layer<ROut2, E, RIn>): Layer<ROut2, E, RIn> => layer
3537
3953
 
3538
3954
  /**
3539
- * Ensures that an layer's error type extends a given type `E`.
3955
+ * Ensures that a layer's error type extends a given type `E`.
3956
+ *
3957
+ * **Details**
3540
3958
  *
3541
3959
  * This function provides compile-time type checking to ensure that the error
3542
- * type of an layer conforms to a specific type constraint.
3960
+ * type of a layer conforms to a specific type constraint.
3543
3961
  *
3544
3962
  * **Example** (Constraining layer error types)
3545
3963
  *
@@ -3562,17 +3980,19 @@ export const satisfiesSuccessType =
3562
3980
  * // Type 'string' is not assignable to type 'Error'
3563
3981
  * ```
3564
3982
  *
3565
- * @category Type constraints
3983
+ * @category utility types
3566
3984
  * @since 4.0.0
3567
3985
  */
3568
3986
  export const satisfiesErrorType =
3569
3987
  <E>() => <ROut, E2 extends E, RIn>(layer: Layer<ROut, E2, RIn>): Layer<ROut, E2, RIn> => layer
3570
3988
 
3571
3989
  /**
3572
- * Ensures that an layer's requirements type extends a given type `R`.
3990
+ * Ensures that a layer's requirements type extends a given type `R`.
3991
+ *
3992
+ * **Details**
3573
3993
  *
3574
3994
  * This function provides compile-time type checking to ensure that the
3575
- * requirements (context) type of an layer conforms to a specific type constraint.
3995
+ * requirements type of a layer conforms to a specific type constraint.
3576
3996
  *
3577
3997
  * **Example** (Constraining layer service requirements)
3578
3998
  *
@@ -3594,7 +4014,7 @@ export const satisfiesErrorType =
3594
4014
  * // Type 'string' is not assignable to type 'number'
3595
4015
  * ```
3596
4016
  *
3597
- * @category Type constraints
4017
+ * @category utility types
3598
4018
  * @since 4.0.0
3599
4019
  */
3600
4020
  export const satisfiesServicesType =
@@ -3613,8 +4033,8 @@ export const satisfiesServicesType =
3613
4033
  */
3614
4034
  export interface SpanOptions extends Tracer.SpanOptions {
3615
4035
  /**
3616
- * A function that will be called when the span associated with the layer is
3617
- * ending (i.e. when the `Scope` that the span is associated with is closed).
4036
+ * Runs when the span associated with the layer ends, which happens when the
4037
+ * layer scope is closed.
3618
4038
  */
3619
4039
  readonly onEnd?:
3620
4040
  | ((span: Tracer.Span, exit: Exit.Exit<unknown, unknown>) => Effect<void>)
@@ -3625,9 +4045,13 @@ export interface SpanOptions extends Tracer.SpanOptions {
3625
4045
  * Constructs a new `Layer` which creates a span and registers it as the current
3626
4046
  * parent span.
3627
4047
  *
4048
+ * **Details**
4049
+ *
3628
4050
  * This allows you to create a traced scope for layer construction, making all
3629
4051
  * operations within the layer constructor part of the same trace span. The span
3630
- * is automatically closed when the layer's scope is closed.
4052
+ * is automatically ended when the layer's scope is closed. If `onEnd` is
4053
+ * provided, it receives the span and the layer scope's exit value when the span
4054
+ * ends.
3631
4055
  *
3632
4056
  * **Example** (Tracing layer construction with a span)
3633
4057
  *
@@ -3688,6 +4112,7 @@ export const span = (
3688
4112
  * Constructs a layer that provides an existing span as the current parent span.
3689
4113
  *
3690
4114
  * **Details**
4115
+ *
3691
4116
  * The supplied span is made available through `Tracer.ParentSpan` for layers
3692
4117
  * that are built with this layer. This API does not create, end, or close the
3693
4118
  * span; the caller remains responsible for the span's lifetime.
@@ -3727,9 +4152,11 @@ export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
3727
4152
  succeedContext(Tracer.ParentSpan.context(span))
3728
4153
 
3729
4154
  /**
3730
- * Wraps a Layer with a new tracing span, making all operations in the layer
4155
+ * Wraps a `Layer` with a new tracing span, making all operations in the layer
3731
4156
  * constructor part of the named trace span.
3732
4157
  *
4158
+ * **Details**
4159
+ *
3733
4160
  * This creates a new span for the layer's construction and execution. The span
3734
4161
  * is automatically ended when the layer's scope is closed. This is useful for
3735
4162
  * tracking the lifecycle and performance of layer initialization.
@@ -3778,8 +4205,7 @@ export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
3778
4205
  *
3779
4206
  * yield* logger.log("Application ready")
3780
4207
  * return yield* database.query("SELECT * FROM users")
3781
- * }).pipe(Effect.provide(appLayer)
3782
- * )
4208
+ * }).pipe(Effect.provide(appLayer))
3783
4209
  * ```
3784
4210
  *
3785
4211
  * @category tracing
@@ -3787,9 +4213,11 @@ export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
3787
4213
  */
3788
4214
  export const withSpan: {
3789
4215
  /**
3790
- * Wraps a Layer with a new tracing span, making all operations in the layer
4216
+ * Wraps a `Layer` with a new tracing span, making all operations in the layer
3791
4217
  * constructor part of the named trace span.
3792
4218
  *
4219
+ * **Details**
4220
+ *
3793
4221
  * This creates a new span for the layer's construction and execution. The span
3794
4222
  * is automatically ended when the layer's scope is closed. This is useful for
3795
4223
  * tracking the lifecycle and performance of layer initialization.
@@ -3838,8 +4266,7 @@ export const withSpan: {
3838
4266
  *
3839
4267
  * yield* logger.log("Application ready")
3840
4268
  * return yield* database.query("SELECT * FROM users")
3841
- * }).pipe(Effect.provide(appLayer)
3842
- * )
4269
+ * }).pipe(Effect.provide(appLayer))
3843
4270
  * ```
3844
4271
  *
3845
4272
  * @category tracing
@@ -3849,9 +4276,11 @@ export const withSpan: {
3849
4276
  self: Layer<A, E, R>
3850
4277
  ) => Layer<A, E, Exclude<R, Tracer.ParentSpan>>
3851
4278
  /**
3852
- * Wraps a Layer with a new tracing span, making all operations in the layer
4279
+ * Wraps a `Layer` with a new tracing span, making all operations in the layer
3853
4280
  * constructor part of the named trace span.
3854
4281
  *
4282
+ * **Details**
4283
+ *
3855
4284
  * This creates a new span for the layer's construction and execution. The span
3856
4285
  * is automatically ended when the layer's scope is closed. This is useful for
3857
4286
  * tracking the lifecycle and performance of layer initialization.
@@ -3900,8 +4329,7 @@ export const withSpan: {
3900
4329
  *
3901
4330
  * yield* logger.log("Application ready")
3902
4331
  * return yield* database.query("SELECT * FROM users")
3903
- * }).pipe(Effect.provide(appLayer)
3904
- * )
4332
+ * }).pipe(Effect.provide(appLayer))
3905
4333
  * ```
3906
4334
  *
3907
4335
  * @category tracing
@@ -3945,9 +4373,15 @@ export const withSpan: {
3945
4373
  * as their parent.
3946
4374
  *
3947
4375
  * **Details**
4376
+ *
3948
4377
  * Use this to attach layer construction to an existing trace hierarchy. This API
3949
4378
  * does not create or end the supplied parent span.
3950
4379
  *
4380
+ * When the supplied span is a native `Span`, layer construction also receives
4381
+ * diagnostic information that helps associate failures with the layer call site.
4382
+ * External spans are only installed as the parent span and do not add this
4383
+ * diagnostic call-site information.
4384
+ *
3951
4385
  * **Example** (Attaching layers to an existing parent span)
3952
4386
  *
3953
4387
  * ```ts
@@ -4007,9 +4441,15 @@ export const withParentSpan: {
4007
4441
  * as their parent.
4008
4442
  *
4009
4443
  * **Details**
4444
+ *
4010
4445
  * Use this to attach layer construction to an existing trace hierarchy. This API
4011
4446
  * does not create or end the supplied parent span.
4012
4447
  *
4448
+ * When the supplied span is a native `Span`, layer construction also receives
4449
+ * diagnostic information that helps associate failures with the layer call site.
4450
+ * External spans are only installed as the parent span and do not add this
4451
+ * diagnostic call-site information.
4452
+ *
4013
4453
  * **Example** (Attaching layers to an existing parent span)
4014
4454
  *
4015
4455
  * ```ts
@@ -4071,9 +4511,15 @@ export const withParentSpan: {
4071
4511
  * as their parent.
4072
4512
  *
4073
4513
  * **Details**
4514
+ *
4074
4515
  * Use this to attach layer construction to an existing trace hierarchy. This API
4075
4516
  * does not create or end the supplied parent span.
4076
4517
  *
4518
+ * When the supplied span is a native `Span`, layer construction also receives
4519
+ * diagnostic information that helps associate failures with the layer call site.
4520
+ * External spans are only installed as the parent span and do not add this
4521
+ * diagnostic call-site information.
4522
+ *
4077
4523
  * **Example** (Attaching layers to an existing parent span)
4078
4524
  *
4079
4525
  * ```ts