effect 4.0.0-beta.6 → 4.0.0-beta.62

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 (1475) hide show
  1. package/dist/Array.d.ts +213 -385
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +149 -102
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +82 -45
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +105 -52
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +39 -32
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +36 -33
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Brand.d.ts +3 -5
  14. package/dist/Brand.d.ts.map +1 -1
  15. package/dist/Brand.js +1 -1
  16. package/dist/Brand.js.map +1 -1
  17. package/dist/Cache.d.ts +14 -45
  18. package/dist/Cache.d.ts.map +1 -1
  19. package/dist/Cache.js +21 -47
  20. package/dist/Cache.js.map +1 -1
  21. package/dist/Cause.d.ts +53 -22
  22. package/dist/Cause.d.ts.map +1 -1
  23. package/dist/Cause.js +108 -10
  24. package/dist/Cause.js.map +1 -1
  25. package/dist/Channel.d.ts +166 -48
  26. package/dist/Channel.d.ts.map +1 -1
  27. package/dist/Channel.js +176 -87
  28. package/dist/Channel.js.map +1 -1
  29. package/dist/Chunk.d.ts +112 -304
  30. package/dist/Chunk.d.ts.map +1 -1
  31. package/dist/Chunk.js +56 -88
  32. package/dist/Chunk.js.map +1 -1
  33. package/dist/Clock.d.ts +2 -2
  34. package/dist/Clock.d.ts.map +1 -1
  35. package/dist/Clock.js.map +1 -1
  36. package/dist/Combiner.d.ts +280 -13
  37. package/dist/Combiner.d.ts.map +1 -1
  38. package/dist/Combiner.js +198 -7
  39. package/dist/Combiner.js.map +1 -1
  40. package/dist/Config.d.ts +189 -29
  41. package/dist/Config.d.ts.map +1 -1
  42. package/dist/Config.js +85 -35
  43. package/dist/Config.js.map +1 -1
  44. package/dist/ConfigProvider.d.ts +6 -6
  45. package/dist/ConfigProvider.d.ts.map +1 -1
  46. package/dist/ConfigProvider.js +5 -5
  47. package/dist/ConfigProvider.js.map +1 -1
  48. package/dist/Console.d.ts +2 -2
  49. package/dist/Console.d.ts.map +1 -1
  50. package/dist/Console.js.map +1 -1
  51. package/dist/Context.d.ts +1150 -0
  52. package/dist/Context.d.ts.map +1 -0
  53. package/dist/{ServiceMap.js → Context.js} +181 -165
  54. package/dist/Context.js.map +1 -0
  55. package/dist/Cron.d.ts +11 -7
  56. package/dist/Cron.d.ts.map +1 -1
  57. package/dist/Cron.js +120 -63
  58. package/dist/Cron.js.map +1 -1
  59. package/dist/Data.d.ts +533 -365
  60. package/dist/Data.d.ts.map +1 -1
  61. package/dist/Data.js +125 -73
  62. package/dist/Data.js.map +1 -1
  63. package/dist/DateTime.d.ts +74 -255
  64. package/dist/DateTime.d.ts.map +1 -1
  65. package/dist/DateTime.js +17 -62
  66. package/dist/DateTime.js.map +1 -1
  67. package/dist/Deferred.d.ts +12 -5
  68. package/dist/Deferred.d.ts.map +1 -1
  69. package/dist/Deferred.js +13 -5
  70. package/dist/Deferred.js.map +1 -1
  71. package/dist/Duration.d.ts +74 -40
  72. package/dist/Duration.d.ts.map +1 -1
  73. package/dist/Duration.js +126 -87
  74. package/dist/Duration.js.map +1 -1
  75. package/dist/Effect.d.ts +1435 -927
  76. package/dist/Effect.d.ts.map +1 -1
  77. package/dist/Effect.js +516 -328
  78. package/dist/Effect.js.map +1 -1
  79. package/dist/Effectable.d.ts +29 -0
  80. package/dist/Effectable.d.ts.map +1 -0
  81. package/dist/Effectable.js +31 -0
  82. package/dist/Effectable.js.map +1 -0
  83. package/dist/Encoding.d.ts +1 -1
  84. package/dist/Equal.d.ts +276 -109
  85. package/dist/Equal.d.ts.map +1 -1
  86. package/dist/Equal.js +140 -48
  87. package/dist/Equal.js.map +1 -1
  88. package/dist/Equivalence.d.ts +60 -3
  89. package/dist/Equivalence.d.ts.map +1 -1
  90. package/dist/Equivalence.js +70 -13
  91. package/dist/Equivalence.js.map +1 -1
  92. package/dist/ErrorReporter.d.ts +374 -0
  93. package/dist/ErrorReporter.d.ts.map +1 -0
  94. package/dist/ErrorReporter.js +245 -0
  95. package/dist/ErrorReporter.js.map +1 -0
  96. package/dist/ExecutionPlan.d.ts +6 -6
  97. package/dist/ExecutionPlan.d.ts.map +1 -1
  98. package/dist/ExecutionPlan.js +4 -4
  99. package/dist/ExecutionPlan.js.map +1 -1
  100. package/dist/Exit.d.ts +24 -12
  101. package/dist/Exit.d.ts.map +1 -1
  102. package/dist/Exit.js +8 -4
  103. package/dist/Exit.js.map +1 -1
  104. package/dist/Fiber.d.ts +10 -8
  105. package/dist/Fiber.d.ts.map +1 -1
  106. package/dist/Fiber.js.map +1 -1
  107. package/dist/FiberHandle.d.ts +11 -10
  108. package/dist/FiberHandle.d.ts.map +1 -1
  109. package/dist/FiberHandle.js +12 -11
  110. package/dist/FiberHandle.js.map +1 -1
  111. package/dist/FiberMap.d.ts +22 -21
  112. package/dist/FiberMap.d.ts.map +1 -1
  113. package/dist/FiberMap.js +10 -10
  114. package/dist/FiberMap.js.map +1 -1
  115. package/dist/FiberSet.d.ts +2 -2
  116. package/dist/FiberSet.d.ts.map +1 -1
  117. package/dist/FiberSet.js +4 -4
  118. package/dist/FiberSet.js.map +1 -1
  119. package/dist/FileSystem.d.ts +20 -19
  120. package/dist/FileSystem.d.ts.map +1 -1
  121. package/dist/FileSystem.js +15 -11
  122. package/dist/FileSystem.js.map +1 -1
  123. package/dist/Filter.d.ts +4 -37
  124. package/dist/Filter.d.ts.map +1 -1
  125. package/dist/Filter.js +0 -13
  126. package/dist/Filter.js.map +1 -1
  127. package/dist/Formatter.d.ts +131 -47
  128. package/dist/Formatter.d.ts.map +1 -1
  129. package/dist/Formatter.js +243 -55
  130. package/dist/Formatter.js.map +1 -1
  131. package/dist/Function.d.ts +1 -9
  132. package/dist/Function.d.ts.map +1 -1
  133. package/dist/Function.js +2 -10
  134. package/dist/Function.js.map +1 -1
  135. package/dist/Graph.d.ts +65 -65
  136. package/dist/Graph.d.ts.map +1 -1
  137. package/dist/Graph.js +58 -60
  138. package/dist/Graph.js.map +1 -1
  139. package/dist/Hash.js +1 -1
  140. package/dist/Hash.js.map +1 -1
  141. package/dist/HashMap.d.ts +26 -19
  142. package/dist/HashMap.d.ts.map +1 -1
  143. package/dist/HashMap.js +7 -5
  144. package/dist/HashMap.js.map +1 -1
  145. package/dist/Inspectable.d.ts +0 -4
  146. package/dist/Inspectable.d.ts.map +1 -1
  147. package/dist/Inspectable.js +4 -13
  148. package/dist/Inspectable.js.map +1 -1
  149. package/dist/Iterable.d.ts +50 -50
  150. package/dist/Iterable.d.ts.map +1 -1
  151. package/dist/Iterable.js +106 -34
  152. package/dist/Iterable.js.map +1 -1
  153. package/dist/JsonSchema.d.ts +299 -10
  154. package/dist/JsonSchema.d.ts.map +1 -1
  155. package/dist/JsonSchema.js +323 -4
  156. package/dist/JsonSchema.js.map +1 -1
  157. package/dist/Latch.d.ts +69 -3
  158. package/dist/Latch.d.ts.map +1 -1
  159. package/dist/Latch.js +58 -0
  160. package/dist/Latch.js.map +1 -1
  161. package/dist/Layer.d.ts +599 -379
  162. package/dist/Layer.d.ts.map +1 -1
  163. package/dist/Layer.js +249 -180
  164. package/dist/Layer.js.map +1 -1
  165. package/dist/LayerMap.d.ts +27 -26
  166. package/dist/LayerMap.d.ts.map +1 -1
  167. package/dist/LayerMap.js +21 -18
  168. package/dist/LayerMap.js.map +1 -1
  169. package/dist/LogLevel.d.ts +32 -0
  170. package/dist/LogLevel.d.ts.map +1 -1
  171. package/dist/LogLevel.js +28 -100
  172. package/dist/LogLevel.js.map +1 -1
  173. package/dist/Logger.d.ts +31 -97
  174. package/dist/Logger.d.ts.map +1 -1
  175. package/dist/Logger.js +2 -3
  176. package/dist/Logger.js.map +1 -1
  177. package/dist/ManagedRuntime.d.ts +8 -8
  178. package/dist/ManagedRuntime.d.ts.map +1 -1
  179. package/dist/ManagedRuntime.js +34 -25
  180. package/dist/ManagedRuntime.js.map +1 -1
  181. package/dist/Metric.d.ts +23 -25
  182. package/dist/Metric.d.ts.map +1 -1
  183. package/dist/Metric.js +24 -26
  184. package/dist/Metric.js.map +1 -1
  185. package/dist/MutableHashMap.d.ts +7 -0
  186. package/dist/MutableHashMap.d.ts.map +1 -1
  187. package/dist/MutableHashMap.js +8 -0
  188. package/dist/MutableHashMap.js.map +1 -1
  189. package/dist/MutableHashSet.d.ts +7 -0
  190. package/dist/MutableHashSet.d.ts.map +1 -1
  191. package/dist/MutableHashSet.js +8 -0
  192. package/dist/MutableHashSet.js.map +1 -1
  193. package/dist/MutableList.d.ts.map +1 -1
  194. package/dist/MutableList.js +3 -0
  195. package/dist/MutableList.js.map +1 -1
  196. package/dist/Newtype.d.ts +291 -0
  197. package/dist/Newtype.d.ts.map +1 -0
  198. package/dist/Newtype.js +161 -0
  199. package/dist/Newtype.js.map +1 -0
  200. package/dist/Number.d.ts +74 -18
  201. package/dist/Number.d.ts.map +1 -1
  202. package/dist/Number.js +46 -18
  203. package/dist/Number.js.map +1 -1
  204. package/dist/Optic.d.ts +947 -18
  205. package/dist/Optic.d.ts.map +1 -1
  206. package/dist/Optic.js +454 -5
  207. package/dist/Optic.js.map +1 -1
  208. package/dist/Option.d.ts +25 -16
  209. package/dist/Option.d.ts.map +1 -1
  210. package/dist/Option.js +15 -9
  211. package/dist/Option.js.map +1 -1
  212. package/dist/Order.d.ts +6 -1
  213. package/dist/Order.d.ts.map +1 -1
  214. package/dist/Order.js +19 -14
  215. package/dist/Order.js.map +1 -1
  216. package/dist/PartitionedSemaphore.d.ts +183 -0
  217. package/dist/PartitionedSemaphore.d.ts.map +1 -0
  218. package/dist/PartitionedSemaphore.js +231 -0
  219. package/dist/PartitionedSemaphore.js.map +1 -0
  220. package/dist/Path.d.ts +2 -2
  221. package/dist/Path.d.ts.map +1 -1
  222. package/dist/Path.js +2 -2
  223. package/dist/Path.js.map +1 -1
  224. package/dist/PlatformError.d.ts +2 -2
  225. package/dist/Pool.d.ts +1 -1
  226. package/dist/Pool.d.ts.map +1 -1
  227. package/dist/Pool.js +5 -5
  228. package/dist/Pool.js.map +1 -1
  229. package/dist/Predicate.d.ts +1 -1
  230. package/dist/Predicate.d.ts.map +1 -1
  231. package/dist/PubSub.d.ts +5 -4
  232. package/dist/PubSub.d.ts.map +1 -1
  233. package/dist/PubSub.js +15 -8
  234. package/dist/PubSub.js.map +1 -1
  235. package/dist/Pull.d.ts.map +1 -1
  236. package/dist/Pull.js +1 -1
  237. package/dist/Pull.js.map +1 -1
  238. package/dist/Queue.d.ts +9 -6
  239. package/dist/Queue.d.ts.map +1 -1
  240. package/dist/Queue.js +7 -5
  241. package/dist/Queue.js.map +1 -1
  242. package/dist/Random.d.ts +36 -2
  243. package/dist/Random.d.ts.map +1 -1
  244. package/dist/Random.js +46 -35
  245. package/dist/Random.js.map +1 -1
  246. package/dist/RcMap.d.ts +4 -4
  247. package/dist/RcMap.d.ts.map +1 -1
  248. package/dist/RcMap.js +13 -13
  249. package/dist/RcMap.js.map +1 -1
  250. package/dist/RcRef.d.ts +1 -1
  251. package/dist/RcRef.d.ts.map +1 -1
  252. package/dist/Record.d.ts +63 -160
  253. package/dist/Record.d.ts.map +1 -1
  254. package/dist/Record.js +37 -56
  255. package/dist/Record.js.map +1 -1
  256. package/dist/Redactable.d.ts +139 -62
  257. package/dist/Redactable.d.ts.map +1 -1
  258. package/dist/Redactable.js +59 -55
  259. package/dist/Redactable.js.map +1 -1
  260. package/dist/Reducer.d.ts +166 -7
  261. package/dist/Reducer.d.ts.map +1 -1
  262. package/dist/Reducer.js +135 -1
  263. package/dist/Reducer.js.map +1 -1
  264. package/dist/References.d.ts +257 -229
  265. package/dist/References.d.ts.map +1 -1
  266. package/dist/References.js +240 -259
  267. package/dist/References.js.map +1 -1
  268. package/dist/Request.d.ts +5 -5
  269. package/dist/Request.d.ts.map +1 -1
  270. package/dist/Request.js.map +1 -1
  271. package/dist/RequestResolver.d.ts +25 -25
  272. package/dist/RequestResolver.d.ts.map +1 -1
  273. package/dist/RequestResolver.js +15 -16
  274. package/dist/RequestResolver.js.map +1 -1
  275. package/dist/Resource.d.ts +0 -3
  276. package/dist/Resource.d.ts.map +1 -1
  277. package/dist/Resource.js +5 -4
  278. package/dist/Resource.js.map +1 -1
  279. package/dist/Result.d.ts +1 -1
  280. package/dist/Result.d.ts.map +1 -1
  281. package/dist/Result.js +1 -2
  282. package/dist/Result.js.map +1 -1
  283. package/dist/Runtime.d.ts +66 -0
  284. package/dist/Runtime.d.ts.map +1 -1
  285. package/dist/Runtime.js +79 -6
  286. package/dist/Runtime.js.map +1 -1
  287. package/dist/Schedule.d.ts +174 -291
  288. package/dist/Schedule.d.ts.map +1 -1
  289. package/dist/Schedule.js +132 -120
  290. package/dist/Schedule.js.map +1 -1
  291. package/dist/Scheduler.d.ts +36 -125
  292. package/dist/Scheduler.d.ts.map +1 -1
  293. package/dist/Scheduler.js +37 -126
  294. package/dist/Scheduler.js.map +1 -1
  295. package/dist/Schema.d.ts +3213 -392
  296. package/dist/Schema.d.ts.map +1 -1
  297. package/dist/Schema.js +2058 -252
  298. package/dist/Schema.js.map +1 -1
  299. package/dist/SchemaAST.d.ts +13 -2
  300. package/dist/SchemaAST.d.ts.map +1 -1
  301. package/dist/SchemaAST.js +340 -257
  302. package/dist/SchemaAST.js.map +1 -1
  303. package/dist/SchemaGetter.d.ts +55 -13
  304. package/dist/SchemaGetter.d.ts.map +1 -1
  305. package/dist/SchemaGetter.js +73 -11
  306. package/dist/SchemaGetter.js.map +1 -1
  307. package/dist/SchemaIssue.d.ts.map +1 -1
  308. package/dist/SchemaIssue.js +29 -11
  309. package/dist/SchemaIssue.js.map +1 -1
  310. package/dist/SchemaParser.d.ts +44 -54
  311. package/dist/SchemaParser.d.ts.map +1 -1
  312. package/dist/SchemaParser.js +69 -4
  313. package/dist/SchemaParser.js.map +1 -1
  314. package/dist/SchemaRepresentation.d.ts +2 -2
  315. package/dist/SchemaRepresentation.d.ts.map +1 -1
  316. package/dist/SchemaRepresentation.js +63 -39
  317. package/dist/SchemaRepresentation.js.map +1 -1
  318. package/dist/SchemaTransformation.d.ts +245 -3
  319. package/dist/SchemaTransformation.d.ts.map +1 -1
  320. package/dist/SchemaTransformation.js +297 -33
  321. package/dist/SchemaTransformation.js.map +1 -1
  322. package/dist/Scope.d.ts +2 -2
  323. package/dist/Scope.d.ts.map +1 -1
  324. package/dist/Scope.js.map +1 -1
  325. package/dist/ScopedCache.d.ts +2 -2
  326. package/dist/ScopedCache.d.ts.map +1 -1
  327. package/dist/ScopedCache.js +5 -5
  328. package/dist/ScopedCache.js.map +1 -1
  329. package/dist/Semaphore.d.ts +148 -52
  330. package/dist/Semaphore.d.ts.map +1 -1
  331. package/dist/Semaphore.js +135 -117
  332. package/dist/Semaphore.js.map +1 -1
  333. package/dist/Sink.d.ts +22 -19
  334. package/dist/Sink.d.ts.map +1 -1
  335. package/dist/Sink.js +54 -7
  336. package/dist/Sink.js.map +1 -1
  337. package/dist/Stdio.d.ts +18 -6
  338. package/dist/Stdio.d.ts.map +1 -1
  339. package/dist/Stdio.js +20 -2
  340. package/dist/Stdio.js.map +1 -1
  341. package/dist/Stream.d.ts +465 -542
  342. package/dist/Stream.d.ts.map +1 -1
  343. package/dist/Stream.js +329 -145
  344. package/dist/Stream.js.map +1 -1
  345. package/dist/String.d.ts +114 -47
  346. package/dist/String.d.ts.map +1 -1
  347. package/dist/String.js +29 -47
  348. package/dist/String.js.map +1 -1
  349. package/dist/Struct.d.ts +7 -7
  350. package/dist/Struct.d.ts.map +1 -1
  351. package/dist/SubscriptionRef.d.ts +1 -2
  352. package/dist/SubscriptionRef.d.ts.map +1 -1
  353. package/dist/SubscriptionRef.js +83 -116
  354. package/dist/SubscriptionRef.js.map +1 -1
  355. package/dist/Terminal.d.ts +5 -4
  356. package/dist/Terminal.d.ts.map +1 -1
  357. package/dist/Terminal.js +2 -2
  358. package/dist/Terminal.js.map +1 -1
  359. package/dist/Tracer.d.ts +21 -20
  360. package/dist/Tracer.d.ts.map +1 -1
  361. package/dist/Tracer.js +13 -9
  362. package/dist/Tracer.js.map +1 -1
  363. package/dist/Trie.d.ts +44 -31
  364. package/dist/Trie.d.ts.map +1 -1
  365. package/dist/Trie.js +13 -9
  366. package/dist/Trie.js.map +1 -1
  367. package/dist/TxChunk.d.ts +4 -4
  368. package/dist/TxChunk.d.ts.map +1 -1
  369. package/dist/TxChunk.js +4 -4
  370. package/dist/TxChunk.js.map +1 -1
  371. package/dist/TxDeferred.d.ts +328 -0
  372. package/dist/TxDeferred.d.ts.map +1 -0
  373. package/dist/TxDeferred.js +197 -0
  374. package/dist/TxDeferred.js.map +1 -0
  375. package/dist/TxHashMap.d.ts +105 -86
  376. package/dist/TxHashMap.d.ts.map +1 -1
  377. package/dist/TxHashMap.js +51 -44
  378. package/dist/TxHashMap.js.map +1 -1
  379. package/dist/TxHashSet.d.ts +2 -2
  380. package/dist/TxHashSet.d.ts.map +1 -1
  381. package/dist/TxHashSet.js +16 -15
  382. package/dist/TxHashSet.js.map +1 -1
  383. package/dist/TxPriorityQueue.d.ts +609 -0
  384. package/dist/TxPriorityQueue.d.ts.map +1 -0
  385. package/dist/TxPriorityQueue.js +416 -0
  386. package/dist/TxPriorityQueue.js.map +1 -0
  387. package/dist/TxPubSub.d.ts +585 -0
  388. package/dist/TxPubSub.d.ts.map +1 -0
  389. package/dist/TxPubSub.js +521 -0
  390. package/dist/TxPubSub.js.map +1 -0
  391. package/dist/TxQueue.d.ts +1 -1
  392. package/dist/TxQueue.d.ts.map +1 -1
  393. package/dist/TxQueue.js +42 -57
  394. package/dist/TxQueue.js.map +1 -1
  395. package/dist/TxReentrantLock.d.ts +500 -0
  396. package/dist/TxReentrantLock.d.ts.map +1 -0
  397. package/dist/TxReentrantLock.js +481 -0
  398. package/dist/TxReentrantLock.js.map +1 -0
  399. package/dist/TxRef.d.ts +14 -20
  400. package/dist/TxRef.d.ts.map +1 -1
  401. package/dist/TxRef.js +8 -10
  402. package/dist/TxRef.js.map +1 -1
  403. package/dist/TxSemaphore.d.ts +162 -2
  404. package/dist/TxSemaphore.d.ts.map +1 -1
  405. package/dist/TxSemaphore.js +25 -10
  406. package/dist/TxSemaphore.js.map +1 -1
  407. package/dist/TxSubscriptionRef.d.ts +508 -0
  408. package/dist/TxSubscriptionRef.d.ts.map +1 -0
  409. package/dist/TxSubscriptionRef.js +293 -0
  410. package/dist/TxSubscriptionRef.js.map +1 -0
  411. package/dist/Types.d.ts +80 -22
  412. package/dist/Types.d.ts.map +1 -1
  413. package/dist/Unify.d.ts +8 -2
  414. package/dist/Unify.d.ts.map +1 -1
  415. package/dist/Unify.js.map +1 -1
  416. package/dist/Utils.d.ts +137 -65
  417. package/dist/Utils.d.ts.map +1 -1
  418. package/dist/Utils.js +38 -66
  419. package/dist/Utils.js.map +1 -1
  420. package/dist/index.d.ts +886 -71
  421. package/dist/index.d.ts.map +1 -1
  422. package/dist/index.js +886 -71
  423. package/dist/index.js.map +1 -1
  424. package/dist/internal/core.js.map +1 -1
  425. package/dist/internal/dateTime.js +77 -71
  426. package/dist/internal/dateTime.js.map +1 -1
  427. package/dist/internal/effect.js +502 -326
  428. package/dist/internal/effect.js.map +1 -1
  429. package/dist/internal/hashMap.js +7 -5
  430. package/dist/internal/hashMap.js.map +1 -1
  431. package/dist/internal/layer.js +3 -3
  432. package/dist/internal/layer.js.map +1 -1
  433. package/dist/internal/option.js +6 -0
  434. package/dist/internal/option.js.map +1 -1
  435. package/dist/internal/random.d.ts +2 -0
  436. package/dist/internal/random.d.ts.map +1 -0
  437. package/dist/internal/random.js +13 -0
  438. package/dist/internal/random.js.map +1 -0
  439. package/dist/internal/rcRef.js +9 -9
  440. package/dist/internal/rcRef.js.map +1 -1
  441. package/dist/internal/references.d.ts +2 -0
  442. package/dist/internal/references.d.ts.map +1 -0
  443. package/dist/internal/references.js +51 -0
  444. package/dist/internal/references.js.map +1 -0
  445. package/dist/internal/request.js +6 -6
  446. package/dist/internal/request.js.map +1 -1
  447. package/dist/internal/schedule.js +1 -1
  448. package/dist/internal/schedule.js.map +1 -1
  449. package/dist/internal/schema/annotations.js +2 -0
  450. package/dist/internal/schema/annotations.js.map +1 -1
  451. package/dist/internal/schema/representation.js +87 -109
  452. package/dist/internal/schema/representation.js.map +1 -1
  453. package/dist/internal/schema/schema.d.ts +10 -1
  454. package/dist/internal/schema/schema.d.ts.map +1 -1
  455. package/dist/internal/schema/schema.js +59 -1
  456. package/dist/internal/schema/schema.js.map +1 -1
  457. package/dist/internal/trie.js +8 -7
  458. package/dist/internal/trie.js.map +1 -1
  459. package/dist/testing/TestClock.d.ts +5 -5
  460. package/dist/testing/TestClock.d.ts.map +1 -1
  461. package/dist/testing/TestClock.js +2 -2
  462. package/dist/testing/TestClock.js.map +1 -1
  463. package/dist/testing/TestSchema.d.ts +267 -33
  464. package/dist/testing/TestSchema.d.ts.map +1 -1
  465. package/dist/testing/TestSchema.js +296 -23
  466. package/dist/testing/TestSchema.js.map +1 -1
  467. package/dist/testing/index.d.ts +64 -1
  468. package/dist/testing/index.d.ts.map +1 -1
  469. package/dist/testing/index.js +64 -1
  470. package/dist/testing/index.js.map +1 -1
  471. package/dist/unstable/ai/AiError.d.ts +127 -45
  472. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  473. package/dist/unstable/ai/AiError.js +29 -23
  474. package/dist/unstable/ai/AiError.js.map +1 -1
  475. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  476. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  477. package/dist/unstable/ai/AnthropicStructuredOutput.js +9 -2
  478. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  479. package/dist/unstable/ai/Chat.d.ts +39 -11
  480. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  481. package/dist/unstable/ai/Chat.js +40 -47
  482. package/dist/unstable/ai/Chat.js.map +1 -1
  483. package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
  484. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
  485. package/dist/unstable/ai/EmbeddingModel.js +127 -0
  486. package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
  487. package/dist/unstable/ai/IdGenerator.d.ts +2 -2
  488. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  489. package/dist/unstable/ai/IdGenerator.js +2 -2
  490. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  491. package/dist/unstable/ai/LanguageModel.d.ts +119 -49
  492. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  493. package/dist/unstable/ai/LanguageModel.js +260 -61
  494. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  495. package/dist/unstable/ai/McpSchema.d.ts +207 -112
  496. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  497. package/dist/unstable/ai/McpSchema.js +71 -19
  498. package/dist/unstable/ai/McpSchema.js.map +1 -1
  499. package/dist/unstable/ai/McpServer.d.ts +68 -15
  500. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  501. package/dist/unstable/ai/McpServer.js +225 -73
  502. package/dist/unstable/ai/McpServer.js.map +1 -1
  503. package/dist/unstable/ai/Model.d.ts +27 -9
  504. package/dist/unstable/ai/Model.d.ts.map +1 -1
  505. package/dist/unstable/ai/Model.js +25 -9
  506. package/dist/unstable/ai/Model.js.map +1 -1
  507. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  508. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  509. package/dist/unstable/ai/OpenAiStructuredOutput.js +9 -1
  510. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  511. package/dist/unstable/ai/Prompt.d.ts +17 -17
  512. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  513. package/dist/unstable/ai/Prompt.js +6 -9
  514. package/dist/unstable/ai/Prompt.js.map +1 -1
  515. package/dist/unstable/ai/Response.d.ts +24 -24
  516. package/dist/unstable/ai/Response.d.ts.map +1 -1
  517. package/dist/unstable/ai/Response.js +7 -8
  518. package/dist/unstable/ai/Response.js.map +1 -1
  519. package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
  520. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
  521. package/dist/unstable/ai/ResponseIdTracker.js +68 -0
  522. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
  523. package/dist/unstable/ai/Telemetry.d.ts +35 -2
  524. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  525. package/dist/unstable/ai/Telemetry.js +2 -2
  526. package/dist/unstable/ai/Telemetry.js.map +1 -1
  527. package/dist/unstable/ai/Tokenizer.d.ts +2 -2
  528. package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
  529. package/dist/unstable/ai/Tokenizer.js +2 -2
  530. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  531. package/dist/unstable/ai/Tool.d.ts +46 -16
  532. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  533. package/dist/unstable/ai/Tool.js +68 -22
  534. package/dist/unstable/ai/Tool.js.map +1 -1
  535. package/dist/unstable/ai/Toolkit.d.ts +4 -4
  536. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  537. package/dist/unstable/ai/Toolkit.js +14 -21
  538. package/dist/unstable/ai/Toolkit.js.map +1 -1
  539. package/dist/unstable/ai/index.d.ts +22 -1
  540. package/dist/unstable/ai/index.d.ts.map +1 -1
  541. package/dist/unstable/ai/index.js +22 -1
  542. package/dist/unstable/ai/index.js.map +1 -1
  543. package/dist/unstable/ai/internal/codec-transformer.js +5 -7
  544. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  545. package/dist/unstable/cli/Argument.d.ts +4 -7
  546. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  547. package/dist/unstable/cli/Argument.js +1 -3
  548. package/dist/unstable/cli/Argument.js.map +1 -1
  549. package/dist/unstable/cli/CliError.d.ts +51 -63
  550. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  551. package/dist/unstable/cli/CliError.js +32 -57
  552. package/dist/unstable/cli/CliError.js.map +1 -1
  553. package/dist/unstable/cli/CliOutput.d.ts +5 -4
  554. package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
  555. package/dist/unstable/cli/CliOutput.js +67 -12
  556. package/dist/unstable/cli/CliOutput.js.map +1 -1
  557. package/dist/unstable/cli/Command.d.ts +372 -59
  558. package/dist/unstable/cli/Command.d.ts.map +1 -1
  559. package/dist/unstable/cli/Command.js +328 -66
  560. package/dist/unstable/cli/Command.js.map +1 -1
  561. package/dist/unstable/cli/Completions.d.ts +97 -0
  562. package/dist/unstable/cli/Completions.d.ts.map +1 -0
  563. package/dist/unstable/cli/Completions.js +25 -0
  564. package/dist/unstable/cli/Completions.js.map +1 -0
  565. package/dist/unstable/cli/Flag.d.ts +4 -5
  566. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  567. package/dist/unstable/cli/Flag.js +1 -1
  568. package/dist/unstable/cli/Flag.js.map +1 -1
  569. package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
  570. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
  571. package/dist/unstable/cli/GlobalFlag.js +118 -0
  572. package/dist/unstable/cli/GlobalFlag.js.map +1 -0
  573. package/dist/unstable/cli/HelpDoc.d.ts +81 -11
  574. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  575. package/dist/unstable/cli/Param.d.ts +34 -6
  576. package/dist/unstable/cli/Param.d.ts.map +1 -1
  577. package/dist/unstable/cli/Param.js +24 -14
  578. package/dist/unstable/cli/Param.js.map +1 -1
  579. package/dist/unstable/cli/Primitive.d.ts +2 -2
  580. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  581. package/dist/unstable/cli/Primitive.js +1 -1
  582. package/dist/unstable/cli/Primitive.js.map +1 -1
  583. package/dist/unstable/cli/Prompt.js +266 -86
  584. package/dist/unstable/cli/Prompt.js.map +1 -1
  585. package/dist/unstable/cli/index.d.ts +10 -0
  586. package/dist/unstable/cli/index.d.ts.map +1 -1
  587. package/dist/unstable/cli/index.js +10 -0
  588. package/dist/unstable/cli/index.js.map +1 -1
  589. package/dist/unstable/cli/internal/command.d.ts +41 -15
  590. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  591. package/dist/unstable/cli/internal/command.js +84 -47
  592. package/dist/unstable/cli/internal/command.js.map +1 -1
  593. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  594. package/dist/unstable/cli/internal/completions/descriptor.d.ts +2 -0
  595. package/dist/unstable/cli/internal/completions/descriptor.d.ts.map +1 -0
  596. package/dist/unstable/cli/internal/completions/{CommandDescriptor.js → descriptor.js} +17 -5
  597. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -0
  598. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  599. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  600. package/dist/unstable/cli/internal/config.js +42 -0
  601. package/dist/unstable/cli/internal/config.js.map +1 -1
  602. package/dist/unstable/cli/internal/help.d.ts +33 -0
  603. package/dist/unstable/cli/internal/help.d.ts.map +1 -0
  604. package/dist/unstable/cli/internal/help.js +125 -0
  605. package/dist/unstable/cli/internal/help.js.map +1 -0
  606. package/dist/unstable/cli/internal/parser.js +155 -58
  607. package/dist/unstable/cli/internal/parser.js.map +1 -1
  608. package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
  609. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  610. package/dist/unstable/cluster/ClusterCron.js +1 -1
  611. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  612. package/dist/unstable/cluster/ClusterError.d.ts +7 -7
  613. package/dist/unstable/cluster/ClusterSchema.d.ts +28 -7
  614. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  615. package/dist/unstable/cluster/ClusterSchema.js +28 -8
  616. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  617. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +4 -2
  618. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  619. package/dist/unstable/cluster/ClusterWorkflowEngine.js +96 -63
  620. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  621. package/dist/unstable/cluster/DeliverAt.js +1 -1
  622. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  623. package/dist/unstable/cluster/Entity.d.ts +17 -16
  624. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  625. package/dist/unstable/cluster/Entity.js +31 -25
  626. package/dist/unstable/cluster/Entity.js.map +1 -1
  627. package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
  628. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  629. package/dist/unstable/cluster/EntityAddress.js +1 -1
  630. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  631. package/dist/unstable/cluster/EntityProxy.js +3 -3
  632. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  633. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  634. package/dist/unstable/cluster/EntityProxyServer.js +6 -6
  635. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  636. package/dist/unstable/cluster/EntityResource.d.ts +4 -4
  637. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  638. package/dist/unstable/cluster/EntityResource.js +2 -2
  639. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  640. package/dist/unstable/cluster/Envelope.d.ts +3 -3
  641. package/dist/unstable/cluster/HttpRunner.js +2 -2
  642. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  643. package/dist/unstable/cluster/K8sHttpClient.d.ts +5 -5
  644. package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
  645. package/dist/unstable/cluster/K8sHttpClient.js +7 -7
  646. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  647. package/dist/unstable/cluster/Message.d.ts +16 -10
  648. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  649. package/dist/unstable/cluster/Message.js +16 -8
  650. package/dist/unstable/cluster/Message.js.map +1 -1
  651. package/dist/unstable/cluster/MessageStorage.d.ts +46 -23
  652. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  653. package/dist/unstable/cluster/MessageStorage.js +40 -25
  654. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  655. package/dist/unstable/cluster/Reply.d.ts +7 -6
  656. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  657. package/dist/unstable/cluster/Reply.js +8 -7
  658. package/dist/unstable/cluster/Reply.js.map +1 -1
  659. package/dist/unstable/cluster/Runner.d.ts +1 -1
  660. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  661. package/dist/unstable/cluster/Runner.js +1 -1
  662. package/dist/unstable/cluster/Runner.js.map +1 -1
  663. package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
  664. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  665. package/dist/unstable/cluster/RunnerAddress.js +1 -1
  666. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  667. package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
  668. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  669. package/dist/unstable/cluster/RunnerHealth.js +2 -2
  670. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  671. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  672. package/dist/unstable/cluster/RunnerServer.js +10 -9
  673. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  674. package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
  675. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  676. package/dist/unstable/cluster/RunnerStorage.js +3 -3
  677. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  678. package/dist/unstable/cluster/Runners.d.ts +5 -4
  679. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  680. package/dist/unstable/cluster/Runners.js +16 -14
  681. package/dist/unstable/cluster/Runners.js.map +1 -1
  682. package/dist/unstable/cluster/ShardId.d.ts +35 -49
  683. package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
  684. package/dist/unstable/cluster/ShardId.js +65 -67
  685. package/dist/unstable/cluster/ShardId.js.map +1 -1
  686. package/dist/unstable/cluster/Sharding.d.ts +4 -4
  687. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  688. package/dist/unstable/cluster/Sharding.js +59 -49
  689. package/dist/unstable/cluster/Sharding.js.map +1 -1
  690. package/dist/unstable/cluster/ShardingConfig.d.ts +28 -27
  691. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  692. package/dist/unstable/cluster/ShardingConfig.js +27 -27
  693. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  694. package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
  695. package/dist/unstable/cluster/Snowflake.d.ts +2 -2
  696. package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
  697. package/dist/unstable/cluster/Snowflake.js +2 -2
  698. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  699. package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
  700. package/dist/unstable/cluster/SqlMessageStorage.js +24 -20
  701. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  702. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  703. package/dist/unstable/cluster/SqlRunnerStorage.js +7 -7
  704. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  705. package/dist/unstable/cluster/internal/entityManager.js +30 -24
  706. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  707. package/dist/unstable/cluster/internal/entityReaper.js +2 -2
  708. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  709. package/dist/unstable/cluster/internal/resourceMap.js +3 -3
  710. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  711. package/dist/unstable/devtools/DevToolsClient.d.ts +2 -2
  712. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  713. package/dist/unstable/devtools/DevToolsClient.js +9 -8
  714. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  715. package/dist/unstable/devtools/DevToolsSchema.d.ts +4 -4
  716. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  717. package/dist/unstable/devtools/DevToolsSchema.js +9 -2
  718. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  719. package/dist/unstable/encoding/Msgpack.d.ts +1 -1
  720. package/dist/unstable/encoding/Ndjson.d.ts +9 -9
  721. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  722. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  723. package/dist/unstable/encoding/Sse.d.ts +3 -3
  724. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  725. package/dist/unstable/encoding/Sse.js +1 -1
  726. package/dist/unstable/encoding/Sse.js.map +1 -1
  727. package/dist/unstable/eventlog/Event.d.ts +0 -6
  728. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  729. package/dist/unstable/eventlog/Event.js +0 -5
  730. package/dist/unstable/eventlog/Event.js.map +1 -1
  731. package/dist/unstable/eventlog/EventGroup.d.ts +0 -2
  732. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  733. package/dist/unstable/eventlog/EventGroup.js +0 -2
  734. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  735. package/dist/unstable/eventlog/EventJournal.d.ts +27 -10
  736. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  737. package/dist/unstable/eventlog/EventJournal.js +130 -71
  738. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  739. package/dist/unstable/eventlog/EventLog.d.ts +94 -37
  740. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  741. package/dist/unstable/eventlog/EventLog.js +225 -151
  742. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  743. package/dist/unstable/eventlog/EventLogEncryption.d.ts +11 -9
  744. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  745. package/dist/unstable/eventlog/EventLogEncryption.js +15 -17
  746. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  747. package/dist/unstable/eventlog/EventLogMessage.d.ts +228 -0
  748. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -0
  749. package/dist/unstable/eventlog/EventLogMessage.js +214 -0
  750. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -0
  751. package/dist/unstable/eventlog/EventLogRemote.d.ts +112 -194
  752. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  753. package/dist/unstable/eventlog/EventLogRemote.js +168 -322
  754. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  755. package/dist/unstable/eventlog/EventLogServer.d.ts +26 -48
  756. package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
  757. package/dist/unstable/eventlog/EventLogServer.js +128 -199
  758. package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
  759. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +60 -0
  760. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -0
  761. package/dist/unstable/eventlog/EventLogServerEncrypted.js +166 -0
  762. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -0
  763. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +183 -0
  764. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -0
  765. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +461 -0
  766. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -0
  767. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +117 -0
  768. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -0
  769. package/dist/unstable/eventlog/EventLogSessionAuth.js +284 -0
  770. package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -0
  771. package/dist/unstable/eventlog/{SqlEventLogJournal.d.ts → SqlEventJournal.d.ts} +2 -2
  772. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -0
  773. package/dist/unstable/eventlog/{SqlEventLogJournal.js → SqlEventJournal.js} +28 -21
  774. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
  775. package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
  776. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
  777. package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +69 -27
  778. package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
  779. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
  780. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
  781. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +355 -0
  782. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
  783. package/dist/unstable/eventlog/index.d.ts +22 -2
  784. package/dist/unstable/eventlog/index.d.ts.map +1 -1
  785. package/dist/unstable/eventlog/index.js +22 -2
  786. package/dist/unstable/eventlog/index.js.map +1 -1
  787. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
  788. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
  789. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
  790. package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
  791. package/dist/unstable/http/Cookies.d.ts +51 -6
  792. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  793. package/dist/unstable/http/Cookies.js +27 -6
  794. package/dist/unstable/http/Cookies.js.map +1 -1
  795. package/dist/unstable/http/Etag.d.ts +2 -2
  796. package/dist/unstable/http/Etag.d.ts.map +1 -1
  797. package/dist/unstable/http/Etag.js +7 -3
  798. package/dist/unstable/http/Etag.js.map +1 -1
  799. package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
  800. package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
  801. package/dist/unstable/http/FetchHttpClient.js +5 -5
  802. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  803. package/dist/unstable/http/Headers.d.ts +24 -4
  804. package/dist/unstable/http/Headers.d.ts.map +1 -1
  805. package/dist/unstable/http/Headers.js +42 -13
  806. package/dist/unstable/http/Headers.js.map +1 -1
  807. package/dist/unstable/http/HttpBody.d.ts +1 -1
  808. package/dist/unstable/http/HttpClient.d.ts +125 -21
  809. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  810. package/dist/unstable/http/HttpClient.js +197 -19
  811. package/dist/unstable/http/HttpClient.js.map +1 -1
  812. package/dist/unstable/http/HttpClientError.d.ts +8 -8
  813. package/dist/unstable/http/HttpClientRequest.d.ts +43 -15
  814. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  815. package/dist/unstable/http/HttpClientRequest.js +131 -21
  816. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  817. package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
  818. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  819. package/dist/unstable/http/HttpClientResponse.js +18 -3
  820. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  821. package/dist/unstable/http/HttpEffect.d.ts +13 -11
  822. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  823. package/dist/unstable/http/HttpEffect.js +51 -51
  824. package/dist/unstable/http/HttpEffect.js.map +1 -1
  825. package/dist/unstable/http/HttpIncomingMessage.d.ts +5 -4
  826. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  827. package/dist/unstable/http/HttpIncomingMessage.js +6 -10
  828. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  829. package/dist/unstable/http/HttpMethod.d.ts +4 -4
  830. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  831. package/dist/unstable/http/HttpMethod.js +3 -3
  832. package/dist/unstable/http/HttpMethod.js.map +1 -1
  833. package/dist/unstable/http/HttpMiddleware.d.ts +4 -9
  834. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  835. package/dist/unstable/http/HttpMiddleware.js +47 -43
  836. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  837. package/dist/unstable/http/HttpPlatform.d.ts +2 -2
  838. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  839. package/dist/unstable/http/HttpPlatform.js +5 -4
  840. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  841. package/dist/unstable/http/HttpRouter.d.ts +9 -8
  842. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  843. package/dist/unstable/http/HttpRouter.js +36 -36
  844. package/dist/unstable/http/HttpRouter.js.map +1 -1
  845. package/dist/unstable/http/HttpServer.d.ts +2 -2
  846. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  847. package/dist/unstable/http/HttpServer.js +4 -4
  848. package/dist/unstable/http/HttpServer.js.map +1 -1
  849. package/dist/unstable/http/HttpServerError.d.ts +22 -34
  850. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  851. package/dist/unstable/http/HttpServerError.js +39 -45
  852. package/dist/unstable/http/HttpServerError.js.map +1 -1
  853. package/dist/unstable/http/HttpServerRequest.d.ts +19 -7
  854. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  855. package/dist/unstable/http/HttpServerRequest.js +307 -13
  856. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  857. package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
  858. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  859. package/dist/unstable/http/HttpServerRespondable.js +5 -5
  860. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  861. package/dist/unstable/http/HttpServerResponse.d.ts +52 -5
  862. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  863. package/dist/unstable/http/HttpServerResponse.js +240 -5
  864. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  865. package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
  866. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
  867. package/dist/unstable/http/HttpStaticServer.js +353 -0
  868. package/dist/unstable/http/HttpStaticServer.js.map +1 -0
  869. package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
  870. package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
  871. package/dist/unstable/http/HttpTraceContext.js +27 -15
  872. package/dist/unstable/http/HttpTraceContext.js.map +1 -1
  873. package/dist/unstable/http/Multipart.d.ts +7 -7
  874. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  875. package/dist/unstable/http/Multipart.js +7 -7
  876. package/dist/unstable/http/Multipart.js.map +1 -1
  877. package/dist/unstable/http/Url.d.ts +604 -0
  878. package/dist/unstable/http/Url.d.ts.map +1 -0
  879. package/dist/unstable/http/Url.js +256 -0
  880. package/dist/unstable/http/Url.js.map +1 -0
  881. package/dist/unstable/http/UrlParams.d.ts +18 -9
  882. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  883. package/dist/unstable/http/UrlParams.js +6 -7
  884. package/dist/unstable/http/UrlParams.js.map +1 -1
  885. package/dist/unstable/http/index.d.ts +8 -0
  886. package/dist/unstable/http/index.d.ts.map +1 -1
  887. package/dist/unstable/http/index.js +8 -0
  888. package/dist/unstable/http/index.js.map +1 -1
  889. package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
  890. package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
  891. package/dist/unstable/http/internal/preResponseHandler.js +10 -0
  892. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
  893. package/dist/unstable/httpapi/HttpApi.d.ts +11 -11
  894. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  895. package/dist/unstable/httpapi/HttpApi.js +8 -8
  896. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  897. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +12 -9
  898. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  899. package/dist/unstable/httpapi/HttpApiBuilder.js +73 -48
  900. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  901. package/dist/unstable/httpapi/HttpApiClient.d.ts +82 -7
  902. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  903. package/dist/unstable/httpapi/HttpApiClient.js +79 -11
  904. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  905. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +210 -105
  906. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  907. package/dist/unstable/httpapi/HttpApiEndpoint.js +52 -47
  908. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  909. package/dist/unstable/httpapi/HttpApiError.d.ts +66 -29
  910. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  911. package/dist/unstable/httpapi/HttpApiError.js +138 -32
  912. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  913. package/dist/unstable/httpapi/HttpApiGroup.d.ts +9 -8
  914. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  915. package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
  916. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  917. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -17
  918. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  919. package/dist/unstable/httpapi/HttpApiMiddleware.js +38 -8
  920. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  921. package/dist/unstable/httpapi/HttpApiSchema.d.ts +88 -9
  922. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  923. package/dist/unstable/httpapi/HttpApiSchema.js +86 -11
  924. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  925. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
  926. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  927. package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
  928. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  929. package/dist/unstable/httpapi/OpenApi.d.ts +17 -25
  930. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  931. package/dist/unstable/httpapi/OpenApi.js +59 -60
  932. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  933. package/dist/unstable/observability/Otlp.d.ts +12 -12
  934. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  935. package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
  936. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  937. package/dist/unstable/observability/OtlpExporter.js +8 -8
  938. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  939. package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
  940. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  941. package/dist/unstable/observability/OtlpLogger.js +7 -4
  942. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  943. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
  944. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  945. package/dist/unstable/observability/OtlpMetrics.js +2 -2
  946. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  947. package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
  948. package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
  949. package/dist/unstable/observability/OtlpSerialization.js +2 -2
  950. package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
  951. package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
  952. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  953. package/dist/unstable/observability/OtlpTracer.js +7 -3
  954. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  955. package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
  956. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  957. package/dist/unstable/observability/PrometheusMetrics.js +4 -33
  958. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  959. package/dist/unstable/observability/internal/protobuf.js +4 -4
  960. package/dist/unstable/observability/internal/protobuf.js.map +1 -1
  961. package/dist/unstable/persistence/KeyValueStore.d.ts +24 -3
  962. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  963. package/dist/unstable/persistence/KeyValueStore.js +144 -2
  964. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  965. package/dist/unstable/persistence/Persistable.d.ts +2 -2
  966. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  967. package/dist/unstable/persistence/Persistable.js +1 -1
  968. package/dist/unstable/persistence/Persistable.js.map +1 -1
  969. package/dist/unstable/persistence/PersistedCache.d.ts +1 -2
  970. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  971. package/dist/unstable/persistence/PersistedCache.js +10 -11
  972. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  973. package/dist/unstable/persistence/PersistedQueue.d.ts +16 -16
  974. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  975. package/dist/unstable/persistence/PersistedQueue.js +9 -9
  976. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  977. package/dist/unstable/persistence/Persistence.d.ts +5 -5
  978. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  979. package/dist/unstable/persistence/Persistence.js +5 -5
  980. package/dist/unstable/persistence/Persistence.js.map +1 -1
  981. package/dist/unstable/persistence/RateLimiter.d.ts +9 -9
  982. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  983. package/dist/unstable/persistence/RateLimiter.js +4 -4
  984. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  985. package/dist/unstable/persistence/Redis.d.ts +3 -3
  986. package/dist/unstable/persistence/Redis.d.ts.map +1 -1
  987. package/dist/unstable/persistence/Redis.js +2 -2
  988. package/dist/unstable/persistence/Redis.js.map +1 -1
  989. package/dist/unstable/process/ChildProcess.d.ts +5 -128
  990. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  991. package/dist/unstable/process/ChildProcess.js +1 -65
  992. package/dist/unstable/process/ChildProcess.js.map +1 -1
  993. package/dist/unstable/process/ChildProcessSpawner.d.ts +83 -8
  994. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  995. package/dist/unstable/process/ChildProcessSpawner.js +22 -2
  996. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  997. package/dist/unstable/reactivity/AsyncResult.d.ts +37 -17
  998. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  999. package/dist/unstable/reactivity/AsyncResult.js +9 -0
  1000. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  1001. package/dist/unstable/reactivity/Atom.d.ts +108 -47
  1002. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  1003. package/dist/unstable/reactivity/Atom.js +105 -25
  1004. package/dist/unstable/reactivity/Atom.js.map +1 -1
  1005. package/dist/unstable/reactivity/AtomHttpApi.d.ts +25 -20
  1006. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  1007. package/dist/unstable/reactivity/AtomHttpApi.js +58 -26
  1008. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  1009. package/dist/unstable/reactivity/AtomRegistry.d.ts +8 -2
  1010. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  1011. package/dist/unstable/reactivity/AtomRegistry.js +57 -14
  1012. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  1013. package/dist/unstable/reactivity/AtomRpc.d.ts +12 -12
  1014. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  1015. package/dist/unstable/reactivity/AtomRpc.js +59 -31
  1016. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  1017. package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
  1018. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  1019. package/dist/unstable/reactivity/Reactivity.js +6 -6
  1020. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  1021. package/dist/unstable/rpc/Rpc.d.ts +137 -19
  1022. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  1023. package/dist/unstable/rpc/Rpc.js +99 -7
  1024. package/dist/unstable/rpc/Rpc.js.map +1 -1
  1025. package/dist/unstable/rpc/RpcClient.d.ts +26 -47
  1026. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  1027. package/dist/unstable/rpc/RpcClient.js +117 -75
  1028. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  1029. package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
  1030. package/dist/unstable/rpc/RpcGroup.d.ts +15 -11
  1031. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  1032. package/dist/unstable/rpc/RpcGroup.js +30 -20
  1033. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  1034. package/dist/unstable/rpc/RpcMiddleware.d.ts +12 -12
  1035. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  1036. package/dist/unstable/rpc/RpcMiddleware.js +5 -5
  1037. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  1038. package/dist/unstable/rpc/RpcSchema.d.ts +14 -1
  1039. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  1040. package/dist/unstable/rpc/RpcSchema.js +17 -2
  1041. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  1042. package/dist/unstable/rpc/RpcSerialization.d.ts +13 -2
  1043. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  1044. package/dist/unstable/rpc/RpcSerialization.js +60 -27
  1045. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  1046. package/dist/unstable/rpc/RpcServer.d.ts +8 -12
  1047. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  1048. package/dist/unstable/rpc/RpcServer.js +73 -43
  1049. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  1050. package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
  1051. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  1052. package/dist/unstable/rpc/RpcWorker.js +4 -4
  1053. package/dist/unstable/rpc/RpcWorker.js.map +1 -1
  1054. package/dist/unstable/rpc/Utils.d.ts +6 -3
  1055. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  1056. package/dist/unstable/rpc/Utils.js +46 -5
  1057. package/dist/unstable/rpc/Utils.js.map +1 -1
  1058. package/dist/unstable/schema/Model.d.ts +24 -3
  1059. package/dist/unstable/schema/Model.d.ts.map +1 -1
  1060. package/dist/unstable/schema/Model.js +17 -4
  1061. package/dist/unstable/schema/Model.js.map +1 -1
  1062. package/dist/unstable/schema/VariantSchema.d.ts +7 -7
  1063. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  1064. package/dist/unstable/schema/VariantSchema.js +7 -18
  1065. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  1066. package/dist/unstable/socket/Socket.d.ts +35 -15
  1067. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  1068. package/dist/unstable/socket/Socket.js +34 -27
  1069. package/dist/unstable/socket/Socket.js.map +1 -1
  1070. package/dist/unstable/socket/SocketServer.d.ts +8 -5
  1071. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  1072. package/dist/unstable/socket/SocketServer.js +2 -2
  1073. package/dist/unstable/socket/SocketServer.js.map +1 -1
  1074. package/dist/unstable/sql/Migrator.d.ts +1 -1
  1075. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  1076. package/dist/unstable/sql/Migrator.js +2 -2
  1077. package/dist/unstable/sql/Migrator.js.map +1 -1
  1078. package/dist/unstable/sql/SqlClient.d.ts +24 -6
  1079. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  1080. package/dist/unstable/sql/SqlClient.js +37 -32
  1081. package/dist/unstable/sql/SqlClient.js.map +1 -1
  1082. package/dist/unstable/sql/SqlConnection.d.ts +2 -2
  1083. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  1084. package/dist/unstable/sql/SqlConnection.js +5 -2
  1085. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  1086. package/dist/unstable/sql/SqlError.d.ts +237 -17
  1087. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  1088. package/dist/unstable/sql/SqlError.js +260 -4
  1089. package/dist/unstable/sql/SqlError.js.map +1 -1
  1090. package/dist/unstable/sql/SqlModel.d.ts +8 -9
  1091. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  1092. package/dist/unstable/sql/SqlModel.js +12 -38
  1093. package/dist/unstable/sql/SqlModel.js.map +1 -1
  1094. package/dist/unstable/sql/SqlResolver.js +24 -17
  1095. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  1096. package/dist/unstable/sql/SqlSchema.d.ts +17 -6
  1097. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  1098. package/dist/unstable/sql/SqlSchema.js +17 -7
  1099. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  1100. package/dist/unstable/sql/Statement.d.ts +3 -5
  1101. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  1102. package/dist/unstable/sql/Statement.js +14 -13
  1103. package/dist/unstable/sql/Statement.js.map +1 -1
  1104. package/dist/unstable/workers/Transferable.d.ts +4 -4
  1105. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  1106. package/dist/unstable/workers/Transferable.js +7 -7
  1107. package/dist/unstable/workers/Transferable.js.map +1 -1
  1108. package/dist/unstable/workers/Worker.d.ts +3 -3
  1109. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  1110. package/dist/unstable/workers/Worker.js +6 -3
  1111. package/dist/unstable/workers/Worker.js.map +1 -1
  1112. package/dist/unstable/workers/WorkerError.d.ts +5 -5
  1113. package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
  1114. package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
  1115. package/dist/unstable/workers/WorkerRunner.js +5 -2
  1116. package/dist/unstable/workers/WorkerRunner.js.map +1 -1
  1117. package/dist/unstable/workflow/Activity.d.ts +8 -3
  1118. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  1119. package/dist/unstable/workflow/Activity.js +25 -11
  1120. package/dist/unstable/workflow/Activity.js.map +1 -1
  1121. package/dist/unstable/workflow/DurableClock.d.ts +3 -6
  1122. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  1123. package/dist/unstable/workflow/DurableClock.js +6 -6
  1124. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  1125. package/dist/unstable/workflow/DurableDeferred.d.ts +2 -5
  1126. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  1127. package/dist/unstable/workflow/DurableDeferred.js +33 -15
  1128. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  1129. package/dist/unstable/workflow/Workflow.d.ts +12 -14
  1130. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  1131. package/dist/unstable/workflow/Workflow.js +30 -26
  1132. package/dist/unstable/workflow/Workflow.js.map +1 -1
  1133. package/dist/unstable/workflow/WorkflowEngine.d.ts +24 -7
  1134. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  1135. package/dist/unstable/workflow/WorkflowEngine.js +165 -16
  1136. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  1137. package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
  1138. package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
  1139. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  1140. package/package.json +11 -10
  1141. package/src/Array.ts +304 -447
  1142. package/src/BigDecimal.ts +137 -82
  1143. package/src/BigInt.ts +53 -45
  1144. package/src/Brand.ts +3 -5
  1145. package/src/Cache.ts +27 -54
  1146. package/src/Cause.ts +57 -22
  1147. package/src/Channel.ts +687 -220
  1148. package/src/Chunk.ts +149 -331
  1149. package/src/Clock.ts +2 -2
  1150. package/src/Combiner.ts +280 -13
  1151. package/src/Config.ts +214 -52
  1152. package/src/ConfigProvider.ts +5 -5
  1153. package/src/Console.ts +2 -2
  1154. package/src/Context.ts +1454 -0
  1155. package/src/Cron.ts +155 -63
  1156. package/src/Data.ts +530 -368
  1157. package/src/DateTime.ts +77 -258
  1158. package/src/Deferred.ts +15 -6
  1159. package/src/Duration.ts +151 -81
  1160. package/src/Effect.ts +1633 -1055
  1161. package/src/Effectable.ts +47 -0
  1162. package/src/Equal.ts +293 -109
  1163. package/src/Equivalence.ts +114 -52
  1164. package/src/ErrorReporter.ts +458 -0
  1165. package/src/ExecutionPlan.ts +8 -9
  1166. package/src/Exit.ts +24 -12
  1167. package/src/Fiber.ts +17 -8
  1168. package/src/FiberHandle.ts +15 -14
  1169. package/src/FiberMap.ts +27 -27
  1170. package/src/FiberSet.ts +5 -5
  1171. package/src/FileSystem.ts +30 -26
  1172. package/src/Filter.ts +4 -62
  1173. package/src/Formatter.ts +268 -60
  1174. package/src/Function.ts +2 -10
  1175. package/src/Graph.ts +123 -112
  1176. package/src/Hash.ts +2 -2
  1177. package/src/HashMap.ts +26 -19
  1178. package/src/Inspectable.ts +2 -22
  1179. package/src/Iterable.ts +117 -63
  1180. package/src/JsonSchema.ts +383 -10
  1181. package/src/Latch.ts +85 -3
  1182. package/src/Layer.ts +728 -441
  1183. package/src/LayerMap.ts +38 -35
  1184. package/src/LogLevel.ts +37 -0
  1185. package/src/Logger.ts +35 -102
  1186. package/src/ManagedRuntime.ts +61 -48
  1187. package/src/Metric.ts +64 -66
  1188. package/src/MutableHashMap.ts +9 -0
  1189. package/src/MutableHashSet.ts +9 -0
  1190. package/src/MutableList.ts +3 -0
  1191. package/src/Newtype.ts +308 -0
  1192. package/src/Number.ts +98 -29
  1193. package/src/Optic.ts +948 -19
  1194. package/src/Option.ts +34 -24
  1195. package/src/Order.ts +39 -32
  1196. package/src/PartitionedSemaphore.ts +414 -0
  1197. package/src/Path.ts +2 -2
  1198. package/src/Pool.ts +9 -9
  1199. package/src/Predicate.ts +1 -1
  1200. package/src/PubSub.ts +20 -11
  1201. package/src/Pull.ts +1 -1
  1202. package/src/Queue.ts +11 -9
  1203. package/src/Random.ts +51 -14
  1204. package/src/RcMap.ts +19 -19
  1205. package/src/RcRef.ts +1 -1
  1206. package/src/Record.ts +94 -199
  1207. package/src/Redactable.ts +146 -72
  1208. package/src/Reducer.ts +166 -7
  1209. package/src/References.ts +283 -287
  1210. package/src/Request.ts +5 -5
  1211. package/src/RequestResolver.ts +34 -35
  1212. package/src/Resource.ts +6 -5
  1213. package/src/Result.ts +2 -4
  1214. package/src/Runtime.ts +102 -6
  1215. package/src/Schedule.ts +243 -336
  1216. package/src/Scheduler.ts +52 -129
  1217. package/src/Schema.ts +3769 -597
  1218. package/src/SchemaAST.ts +480 -302
  1219. package/src/SchemaGetter.ts +80 -24
  1220. package/src/SchemaIssue.ts +28 -15
  1221. package/src/SchemaParser.ts +100 -29
  1222. package/src/SchemaRepresentation.ts +57 -33
  1223. package/src/SchemaTransformation.ts +321 -32
  1224. package/src/Scope.ts +2 -2
  1225. package/src/ScopedCache.ts +8 -8
  1226. package/src/Semaphore.ts +268 -182
  1227. package/src/Sink.ts +89 -34
  1228. package/src/Stdio.ts +29 -6
  1229. package/src/Stream.ts +908 -752
  1230. package/src/String.ts +122 -69
  1231. package/src/Struct.ts +7 -7
  1232. package/src/SubscriptionRef.ts +98 -118
  1233. package/src/Terminal.ts +5 -4
  1234. package/src/Tracer.ts +23 -22
  1235. package/src/Trie.ts +44 -31
  1236. package/src/TxChunk.ts +26 -16
  1237. package/src/TxDeferred.ts +391 -0
  1238. package/src/TxHashMap.ts +347 -291
  1239. package/src/TxHashSet.ts +54 -61
  1240. package/src/TxPriorityQueue.ts +762 -0
  1241. package/src/TxPubSub.ts +787 -0
  1242. package/src/TxQueue.ts +221 -245
  1243. package/src/TxReentrantLock.ts +729 -0
  1244. package/src/TxRef.ts +31 -31
  1245. package/src/TxSemaphore.ts +203 -31
  1246. package/src/TxSubscriptionRef.ts +637 -0
  1247. package/src/Types.ts +75 -23
  1248. package/src/Unify.ts +26 -2
  1249. package/src/Utils.ts +137 -111
  1250. package/src/index.ts +896 -73
  1251. package/src/internal/core.ts +9 -10
  1252. package/src/internal/dateTime.ts +91 -96
  1253. package/src/internal/effect.ts +1179 -614
  1254. package/src/internal/hashMap.ts +12 -10
  1255. package/src/internal/layer.ts +7 -7
  1256. package/src/internal/option.ts +7 -0
  1257. package/src/internal/random.ts +20 -0
  1258. package/src/internal/rcRef.ts +12 -12
  1259. package/src/internal/references.ts +72 -0
  1260. package/src/internal/request.ts +8 -8
  1261. package/src/internal/schedule.ts +3 -1
  1262. package/src/internal/schema/annotations.ts +2 -0
  1263. package/src/internal/schema/representation.ts +82 -97
  1264. package/src/internal/schema/schema.ts +68 -1
  1265. package/src/internal/trie.ts +21 -15
  1266. package/src/testing/TestClock.ts +6 -6
  1267. package/src/testing/TestSchema.ts +333 -36
  1268. package/src/testing/index.ts +64 -1
  1269. package/src/unstable/ai/AiError.ts +111 -53
  1270. package/src/unstable/ai/AnthropicStructuredOutput.ts +7 -3
  1271. package/src/unstable/ai/Chat.ts +136 -88
  1272. package/src/unstable/ai/EmbeddingModel.ts +209 -0
  1273. package/src/unstable/ai/IdGenerator.ts +2 -2
  1274. package/src/unstable/ai/LanguageModel.ts +685 -255
  1275. package/src/unstable/ai/McpSchema.ts +84 -22
  1276. package/src/unstable/ai/McpServer.ts +307 -87
  1277. package/src/unstable/ai/Model.ts +44 -13
  1278. package/src/unstable/ai/OpenAiStructuredOutput.ts +9 -2
  1279. package/src/unstable/ai/Prompt.ts +23 -29
  1280. package/src/unstable/ai/Response.ts +29 -31
  1281. package/src/unstable/ai/ResponseIdTracker.ts +95 -0
  1282. package/src/unstable/ai/Telemetry.ts +2 -2
  1283. package/src/unstable/ai/Tokenizer.ts +2 -2
  1284. package/src/unstable/ai/Tool.ts +62 -36
  1285. package/src/unstable/ai/Toolkit.ts +17 -26
  1286. package/src/unstable/ai/index.ts +24 -1
  1287. package/src/unstable/ai/internal/codec-transformer.ts +3 -9
  1288. package/src/unstable/cli/Argument.ts +5 -8
  1289. package/src/unstable/cli/CliError.ts +67 -66
  1290. package/src/unstable/cli/CliOutput.ts +87 -15
  1291. package/src/unstable/cli/Command.ts +808 -193
  1292. package/src/unstable/cli/Completions.ts +107 -0
  1293. package/src/unstable/cli/Flag.ts +5 -6
  1294. package/src/unstable/cli/GlobalFlag.ts +242 -0
  1295. package/src/unstable/cli/HelpDoc.ts +91 -11
  1296. package/src/unstable/cli/Param.ts +54 -27
  1297. package/src/unstable/cli/Primitive.ts +2 -2
  1298. package/src/unstable/cli/Prompt.ts +275 -104
  1299. package/src/unstable/cli/index.ts +12 -0
  1300. package/src/unstable/cli/internal/command.ts +125 -64
  1301. package/src/unstable/cli/internal/completions/bash.ts +7 -7
  1302. package/src/unstable/cli/internal/completions/{CommandDescriptor.ts → descriptor.ts} +16 -58
  1303. package/src/unstable/cli/internal/completions/fish.ts +7 -7
  1304. package/src/unstable/cli/internal/completions/zsh.ts +8 -14
  1305. package/src/unstable/cli/internal/config.ts +49 -0
  1306. package/src/unstable/cli/internal/help.ts +171 -0
  1307. package/src/unstable/cli/internal/parser.ts +201 -84
  1308. package/src/unstable/cluster/ClusterCron.ts +2 -2
  1309. package/src/unstable/cluster/ClusterSchema.ts +38 -10
  1310. package/src/unstable/cluster/ClusterWorkflowEngine.ts +142 -80
  1311. package/src/unstable/cluster/DeliverAt.ts +1 -1
  1312. package/src/unstable/cluster/Entity.ts +58 -45
  1313. package/src/unstable/cluster/EntityAddress.ts +1 -1
  1314. package/src/unstable/cluster/EntityProxy.ts +3 -3
  1315. package/src/unstable/cluster/EntityProxyServer.ts +6 -6
  1316. package/src/unstable/cluster/EntityResource.ts +6 -6
  1317. package/src/unstable/cluster/HttpRunner.ts +2 -2
  1318. package/src/unstable/cluster/K8sHttpClient.ts +10 -10
  1319. package/src/unstable/cluster/Message.ts +30 -17
  1320. package/src/unstable/cluster/MessageStorage.ts +74 -45
  1321. package/src/unstable/cluster/Reply.ts +13 -10
  1322. package/src/unstable/cluster/Runner.ts +1 -1
  1323. package/src/unstable/cluster/RunnerAddress.ts +1 -1
  1324. package/src/unstable/cluster/RunnerHealth.ts +2 -2
  1325. package/src/unstable/cluster/RunnerServer.ts +11 -14
  1326. package/src/unstable/cluster/RunnerStorage.ts +9 -9
  1327. package/src/unstable/cluster/Runners.ts +22 -18
  1328. package/src/unstable/cluster/ShardId.ts +84 -74
  1329. package/src/unstable/cluster/Sharding.ts +75 -60
  1330. package/src/unstable/cluster/ShardingConfig.ts +39 -40
  1331. package/src/unstable/cluster/Snowflake.ts +2 -2
  1332. package/src/unstable/cluster/SqlMessageStorage.ts +29 -20
  1333. package/src/unstable/cluster/SqlRunnerStorage.ts +13 -7
  1334. package/src/unstable/cluster/internal/entityManager.ts +60 -41
  1335. package/src/unstable/cluster/internal/entityReaper.ts +2 -2
  1336. package/src/unstable/cluster/internal/resourceMap.ts +3 -3
  1337. package/src/unstable/devtools/DevToolsClient.ts +26 -21
  1338. package/src/unstable/devtools/DevToolsSchema.ts +16 -3
  1339. package/src/unstable/encoding/Ndjson.ts +17 -17
  1340. package/src/unstable/encoding/Sse.ts +3 -5
  1341. package/src/unstable/eventlog/Event.ts +0 -8
  1342. package/src/unstable/eventlog/EventGroup.ts +0 -4
  1343. package/src/unstable/eventlog/EventJournal.ts +148 -80
  1344. package/src/unstable/eventlog/EventLog.ts +360 -234
  1345. package/src/unstable/eventlog/EventLogEncryption.ts +18 -32
  1346. package/src/unstable/eventlog/EventLogMessage.ts +277 -0
  1347. package/src/unstable/eventlog/EventLogRemote.ts +264 -410
  1348. package/src/unstable/eventlog/EventLogServer.ts +183 -275
  1349. package/src/unstable/eventlog/EventLogServerEncrypted.ts +206 -0
  1350. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +749 -0
  1351. package/src/unstable/eventlog/EventLogSessionAuth.ts +437 -0
  1352. package/src/unstable/eventlog/{SqlEventLogJournal.ts → SqlEventJournal.ts} +38 -22
  1353. package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +110 -43
  1354. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +506 -0
  1355. package/src/unstable/eventlog/index.ts +27 -2
  1356. package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
  1357. package/src/unstable/http/Cookies.ts +94 -11
  1358. package/src/unstable/http/Etag.ts +7 -5
  1359. package/src/unstable/http/FetchHttpClient.ts +5 -5
  1360. package/src/unstable/http/Headers.ts +70 -20
  1361. package/src/unstable/http/HttpClient.ts +385 -42
  1362. package/src/unstable/http/HttpClientRequest.ts +151 -39
  1363. package/src/unstable/http/HttpClientResponse.ts +24 -8
  1364. package/src/unstable/http/HttpEffect.ts +71 -77
  1365. package/src/unstable/http/HttpIncomingMessage.ts +9 -8
  1366. package/src/unstable/http/HttpMethod.ts +16 -4
  1367. package/src/unstable/http/HttpMiddleware.ts +50 -50
  1368. package/src/unstable/http/HttpPlatform.ts +5 -4
  1369. package/src/unstable/http/HttpRouter.ts +46 -46
  1370. package/src/unstable/http/HttpServer.ts +5 -11
  1371. package/src/unstable/http/HttpServerError.ts +45 -47
  1372. package/src/unstable/http/HttpServerRequest.ts +414 -23
  1373. package/src/unstable/http/HttpServerRespondable.ts +6 -6
  1374. package/src/unstable/http/HttpServerResponse.ts +351 -13
  1375. package/src/unstable/http/HttpStaticServer.ts +456 -0
  1376. package/src/unstable/http/HttpTraceContext.ts +31 -17
  1377. package/src/unstable/http/Multipart.ts +8 -8
  1378. package/src/unstable/http/Url.ts +650 -0
  1379. package/src/unstable/http/UrlParams.ts +30 -18
  1380. package/src/unstable/http/index.ts +10 -0
  1381. package/src/unstable/http/internal/preResponseHandler.ts +15 -0
  1382. package/src/unstable/httpapi/HttpApi.ts +22 -22
  1383. package/src/unstable/httpapi/HttpApiBuilder.ts +156 -66
  1384. package/src/unstable/httpapi/HttpApiClient.ts +185 -34
  1385. package/src/unstable/httpapi/HttpApiEndpoint.ts +225 -114
  1386. package/src/unstable/httpapi/HttpApiError.ts +129 -30
  1387. package/src/unstable/httpapi/HttpApiGroup.ts +18 -17
  1388. package/src/unstable/httpapi/HttpApiMiddleware.ts +95 -32
  1389. package/src/unstable/httpapi/HttpApiSchema.ts +106 -11
  1390. package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
  1391. package/src/unstable/httpapi/OpenApi.ts +74 -73
  1392. package/src/unstable/observability/Otlp.ts +12 -12
  1393. package/src/unstable/observability/OtlpExporter.ts +14 -10
  1394. package/src/unstable/observability/OtlpLogger.ts +13 -9
  1395. package/src/unstable/observability/OtlpMetrics.ts +6 -6
  1396. package/src/unstable/observability/OtlpSerialization.ts +2 -2
  1397. package/src/unstable/observability/OtlpTracer.ts +14 -10
  1398. package/src/unstable/observability/PrometheusMetrics.ts +5 -5
  1399. package/src/unstable/observability/internal/protobuf.ts +4 -4
  1400. package/src/unstable/persistence/KeyValueStore.ts +226 -3
  1401. package/src/unstable/persistence/Persistable.ts +3 -3
  1402. package/src/unstable/persistence/PersistedCache.ts +20 -17
  1403. package/src/unstable/persistence/PersistedQueue.ts +21 -21
  1404. package/src/unstable/persistence/Persistence.ts +7 -7
  1405. package/src/unstable/persistence/RateLimiter.ts +7 -7
  1406. package/src/unstable/persistence/Redis.ts +2 -2
  1407. package/src/unstable/process/ChildProcess.ts +6 -208
  1408. package/src/unstable/process/ChildProcessSpawner.ts +114 -15
  1409. package/src/unstable/reactivity/AsyncResult.ts +59 -17
  1410. package/src/unstable/reactivity/Atom.ts +280 -124
  1411. package/src/unstable/reactivity/AtomHttpApi.ts +127 -61
  1412. package/src/unstable/reactivity/AtomRegistry.ts +70 -16
  1413. package/src/unstable/reactivity/AtomRpc.ts +82 -37
  1414. package/src/unstable/reactivity/Reactivity.ts +6 -6
  1415. package/src/unstable/rpc/Rpc.ts +212 -32
  1416. package/src/unstable/rpc/RpcClient.ts +161 -142
  1417. package/src/unstable/rpc/RpcGroup.ts +51 -34
  1418. package/src/unstable/rpc/RpcMiddleware.ts +28 -22
  1419. package/src/unstable/rpc/RpcSchema.ts +24 -6
  1420. package/src/unstable/rpc/RpcSerialization.ts +97 -54
  1421. package/src/unstable/rpc/RpcServer.ts +91 -65
  1422. package/src/unstable/rpc/RpcWorker.ts +5 -5
  1423. package/src/unstable/rpc/Utils.ts +63 -4
  1424. package/src/unstable/schema/Model.ts +35 -6
  1425. package/src/unstable/schema/VariantSchema.ts +14 -27
  1426. package/src/unstable/socket/Socket.ts +102 -62
  1427. package/src/unstable/socket/SocketServer.ts +2 -2
  1428. package/src/unstable/sql/Migrator.ts +7 -5
  1429. package/src/unstable/sql/SqlClient.ts +48 -19
  1430. package/src/unstable/sql/SqlConnection.ts +2 -2
  1431. package/src/unstable/sql/SqlError.ts +365 -11
  1432. package/src/unstable/sql/SqlModel.ts +57 -85
  1433. package/src/unstable/sql/SqlResolver.ts +28 -20
  1434. package/src/unstable/sql/SqlSchema.ts +42 -26
  1435. package/src/unstable/sql/Statement.ts +21 -25
  1436. package/src/unstable/workers/Transferable.ts +17 -19
  1437. package/src/unstable/workers/Worker.ts +4 -4
  1438. package/src/unstable/workers/WorkerRunner.ts +2 -2
  1439. package/src/unstable/workflow/Activity.ts +36 -13
  1440. package/src/unstable/workflow/DurableClock.ts +11 -11
  1441. package/src/unstable/workflow/DurableDeferred.ts +36 -18
  1442. package/src/unstable/workflow/Workflow.ts +46 -35
  1443. package/src/unstable/workflow/WorkflowEngine.ts +236 -23
  1444. package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
  1445. package/dist/NullOr.d.ts +0 -149
  1446. package/dist/NullOr.d.ts.map +0 -1
  1447. package/dist/NullOr.js +0 -152
  1448. package/dist/NullOr.js.map +0 -1
  1449. package/dist/ServiceMap.d.ts +0 -1126
  1450. package/dist/ServiceMap.d.ts.map +0 -1
  1451. package/dist/ServiceMap.js.map +0 -1
  1452. package/dist/internal/schema/to-codec.d.ts +0 -2
  1453. package/dist/internal/schema/to-codec.d.ts.map +0 -1
  1454. package/dist/internal/schema/to-codec.js +0 -129
  1455. package/dist/internal/schema/to-codec.js.map +0 -1
  1456. package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
  1457. package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
  1458. package/dist/unstable/cli/internal/builtInFlags.js +0 -44
  1459. package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
  1460. package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts +0 -2
  1461. package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts.map +0 -1
  1462. package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +0 -1
  1463. package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
  1464. package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
  1465. package/dist/unstable/cli/internal/completions/Completions.js +0 -23
  1466. package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
  1467. package/dist/unstable/eventlog/SqlEventLogJournal.d.ts.map +0 -1
  1468. package/dist/unstable/eventlog/SqlEventLogJournal.js.map +0 -1
  1469. package/dist/unstable/eventlog/SqlEventLogServer.d.ts.map +0 -1
  1470. package/dist/unstable/eventlog/SqlEventLogServer.js.map +0 -1
  1471. package/src/NullOr.ts +0 -204
  1472. package/src/ServiceMap.ts +0 -1410
  1473. package/src/internal/schema/to-codec.ts +0 -148
  1474. package/src/unstable/cli/internal/builtInFlags.ts +0 -78
  1475. package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/dist/Effect.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as Context from "./Context.js";
1
2
  import * as Duration from "./Duration.js";
2
3
  import * as Exit from "./Exit.js";
3
4
  import { constant, dual } from "./Function.js";
@@ -9,7 +10,6 @@ import * as internalRequest from "./internal/request.js";
9
10
  import * as internalSchedule from "./internal/schedule.js";
10
11
  import * as Metric from "./Metric.js";
11
12
  import { CurrentLogAnnotations, CurrentLogSpans } from "./References.js";
12
- import * as ServiceMap from "./ServiceMap.js";
13
13
  import { internalCall, SingleShotGen } from "./Utils.js";
14
14
  const TypeId = core.EffectTypeId;
15
15
  /**
@@ -35,7 +35,7 @@ export class YieldableClass {
35
35
  * @since 2.0.0
36
36
  * @category Guards
37
37
  */
38
- export const isEffect = u => typeof u === "object" && u !== null && TypeId in u;
38
+ export const isEffect = core.isEffect;
39
39
  /**
40
40
  * Combines multiple effects into one, returning results based on the input
41
41
  * structure.
@@ -181,7 +181,6 @@ export const isEffect = u => typeof u === "object" && u !== null && TypeId in u;
181
181
  * ```
182
182
  *
183
183
  * @see {@link forEach} for iterating over elements and applying an effect.
184
- * @see {@link allWith} for a data-last version of this function.
185
184
  *
186
185
  * @since 2.0.0
187
186
  * @category Collecting
@@ -215,6 +214,72 @@ export const all = internal.all;
215
214
  * @category Collecting
216
215
  */
217
216
  export const partition = internal.partition;
217
+ /**
218
+ * Applies an effectful function to each element and accumulates all failures.
219
+ *
220
+ * This function always evaluates every element. If at least one effect fails,
221
+ * all failures are returned as a non-empty array and successes are discarded.
222
+ * If all effects succeed, it returns all collected successes.
223
+ *
224
+ * Use `discard: true` to ignore successful values while still validating all
225
+ * elements.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * import { Effect } from "effect"
230
+ *
231
+ * const program = Effect.validate([0, 1, 2, 3], (n) =>
232
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
233
+ * )
234
+ *
235
+ * Effect.runPromiseExit(program).then(console.log)
236
+ * // {
237
+ * // _id: 'Exit',
238
+ * // _tag: 'Failure',
239
+ * // cause: {
240
+ * // _id: 'Cause',
241
+ * // reasons: [
242
+ * // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
243
+ * // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
244
+ * // ]
245
+ * // }
246
+ * // }
247
+ * ```
248
+ *
249
+ * @since 4.0.0
250
+ * @category Error Accumulation
251
+ */
252
+ export const validate = internal.validate;
253
+ /**
254
+ * Returns the first element that satisfies an effectful predicate.
255
+ *
256
+ * The predicate receives the element and its index. Evaluation short-circuits
257
+ * as soon as an element matches.
258
+ *
259
+ * @example
260
+ * ```ts
261
+ * import { Effect } from "effect"
262
+ *
263
+ * const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
264
+ *
265
+ * Effect.runPromise(program).then(console.log)
266
+ * // { _id: 'Option', _tag: 'Some', value: 3 }
267
+ * ```
268
+ *
269
+ * @since 2.0.0
270
+ * @category Collecting
271
+ */
272
+ export const findFirst = internal.findFirst;
273
+ /**
274
+ * Returns the first value that passes an effectful `FilterEffect`.
275
+ *
276
+ * The filter receives the element and index. Evaluation short-circuits on the
277
+ * first `Result.succeed` and returns the transformed value in `Option.some`.
278
+ *
279
+ * @since 4.0.0
280
+ * @category Collecting
281
+ */
282
+ export const findFirstFilter = internal.findFirstFilter;
218
283
  /**
219
284
  * Executes an effectful operation for each element in an `Iterable`.
220
285
  *
@@ -409,16 +474,18 @@ export const promise = internal.promise;
409
474
  *
410
475
  * @example Custom Error Handling
411
476
  * ```ts
412
- * import { Effect } from "effect"
477
+ * import { Data, Effect } from "effect"
478
+ *
479
+ * class TodoFetchError extends Data.TaggedError("TodoFetchError")<{ readonly cause: unknown }> {}
413
480
  *
414
481
  * const getTodo = (id: number) =>
415
482
  * Effect.tryPromise({
416
483
  * try: () => fetch(`https://jsonplaceholder.typicode.com/todos/${id}`),
417
484
  * // remap the error
418
- * catch: (unknown) => new Error(`something went wrong ${unknown}`)
485
+ * catch: (cause) => new TodoFetchError({ cause })
419
486
  * })
420
487
  *
421
- * // ┌─── Effect<Response, Error, never>
488
+ * // ┌─── Effect<Response, TodoFetchError, never>
422
489
  * // ▼
423
490
  * const program = getTodo(1)
424
491
  * ```
@@ -645,8 +712,13 @@ undefined_ as undefined };
645
712
  *
646
713
  * **When to Use**
647
714
  *
648
- * Use `Effect.async` when dealing with APIs that use callback-style instead of
715
+ * Use `Effect.callback` when dealing with APIs that use callback-style instead of
649
716
  * `async/await` or `Promise`.
717
+ * * **Previously Known As**
718
+ *
719
+ * This API replaces the following from Effect 3.x:
720
+ *
721
+ * - `Effect.async`
650
722
  *
651
723
  * @example
652
724
  * ```ts
@@ -690,6 +762,51 @@ export const callback = internal.callback;
690
762
  * @category Creating Effects
691
763
  */
692
764
  export const never = internal.never;
765
+ /**
766
+ * An `Effect` containing an empty record `{}`, used as the starting point for
767
+ * do notation chains.
768
+ *
769
+ * @example
770
+ * ```ts
771
+ * import { Effect } from "effect"
772
+ * import { pipe } from "effect/Function"
773
+ *
774
+ * const program = pipe(
775
+ * Effect.Do,
776
+ * Effect.bind("x", () => Effect.succeed(2)),
777
+ * Effect.bind("y", ({ x }) => Effect.succeed(x + 1)),
778
+ * Effect.let("sum", ({ x, y }) => x + y)
779
+ * )
780
+ * ```
781
+ *
782
+ * @since 4.0.0
783
+ * @category Do notation
784
+ */
785
+ export const Do = internal.Do;
786
+ /**
787
+ * Gives a name to the success value of an `Effect`, creating a single-key
788
+ * record used in do notation pipelines.
789
+ *
790
+ * @since 4.0.0
791
+ * @category Do notation
792
+ */
793
+ export const bindTo = internal.bindTo;
794
+ const let_ = internal.let;
795
+ export {
796
+ /**
797
+ * Adds a computed plain value to the do notation record.
798
+ *
799
+ * @since 4.0.0
800
+ * @category Do notation
801
+ */
802
+ let_ as let };
803
+ /**
804
+ * Adds an `Effect` value to the do notation record under a given name.
805
+ *
806
+ * @since 4.0.0
807
+ * @category Do notation
808
+ */
809
+ export const bind = internal.bind;
693
810
  /**
694
811
  * Provides a way to write effectful code using generator functions, simplifying
695
812
  * control flow and error handling.
@@ -707,16 +824,18 @@ export const never = internal.never;
707
824
  *
708
825
  * @example
709
826
  * ```ts
710
- * import { Effect } from "effect"
827
+ * import { Data, Effect } from "effect"
828
+ *
829
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
711
830
  *
712
831
  * const addServiceCharge = (amount: number) => amount + 1
713
832
  *
714
833
  * const applyDiscount = (
715
834
  * total: number,
716
835
  * discountRate: number
717
- * ): Effect.Effect<number, Error> =>
836
+ * ): Effect.Effect<number, DiscountRateError> =>
718
837
  * discountRate === 0
719
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
838
+ * ? Effect.fail(new DiscountRateError())
720
839
  * : Effect.succeed(total - (total * discountRate) / 100)
721
840
  *
722
841
  * const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))
@@ -753,12 +872,14 @@ export const gen = internal.gen;
753
872
  * @example
754
873
  * ```ts
755
874
  * // Title: Creating a Failed Effect
756
- * import { Effect } from "effect"
875
+ * import { Data, Effect } from "effect"
876
+ *
877
+ * class OperationFailedError extends Data.TaggedError("OperationFailedError")<{}> {}
757
878
  *
758
- * // ┌─── Effect<never, Error, never>
879
+ * // ┌─── Effect<never, OperationFailedError, never>
759
880
  * // ▼
760
881
  * const failure = Effect.fail(
761
- * new Error("Operation failed due to network error")
882
+ * new OperationFailedError()
762
883
  * )
763
884
  * ```
764
885
  *
@@ -774,9 +895,11 @@ export const fail = internal.fail;
774
895
  *
775
896
  * @example
776
897
  * ```ts
777
- * import { Effect } from "effect"
898
+ * import { Data, Effect } from "effect"
899
+ *
900
+ * class ProgramError extends Data.TaggedError("ProgramError")<{ readonly failedAt: Date }> {}
778
901
  *
779
- * const program = Effect.failSync(() => new Error("Something went wrong"))
902
+ * const program = Effect.failSync(() => new ProgramError({ failedAt: new Date() }))
780
903
  *
781
904
  * Effect.runPromiseExit(program).then(console.log)
782
905
  * // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
@@ -920,12 +1043,14 @@ export {
920
1043
  *
921
1044
  * @example Custom Error Handling
922
1045
  * ```ts
923
- * import { Effect } from "effect"
1046
+ * import { Data, Effect } from "effect"
1047
+ *
1048
+ * class JsonParsingError extends Data.TaggedError("JsonParsingError")<{ readonly cause: unknown }> {}
924
1049
  *
925
1050
  * const parseJSON = (input: string) =>
926
1051
  * Effect.try({
927
1052
  * try: () => JSON.parse(input),
928
- * catch: (error) => new Error(`JSON parsing failed: ${error}`)
1053
+ * catch: (cause) => new JsonParsingError({ cause })
929
1054
  * })
930
1055
  *
931
1056
  * Effect.runPromiseExit(parseJSON("invalid json")).then(console.log)
@@ -1050,17 +1175,17 @@ export const fromOption = internal.fromOption;
1050
1175
  * ```ts
1051
1176
  * import { Console, Effect } from "effect"
1052
1177
  *
1053
- * const input: string | null = null
1054
- *
1055
- * const program = Effect.gen(function*() {
1178
+ * const program = Effect.fn(function*(input: string | null) {
1056
1179
  * const value = yield* Effect.fromNullishOr(input)
1057
1180
  * yield* Console.log(value)
1058
- * }).pipe(
1181
+ * },
1059
1182
  * Effect.catch(() => Console.log("missing"))
1060
1183
  * )
1061
1184
  *
1062
- * Effect.runPromise(program)
1185
+ * Effect.runPromise(program(null))
1063
1186
  * // Output: missing
1187
+ * Effect.runPromise(program("hello"))
1188
+ * // Output: hello
1064
1189
  * ```
1065
1190
  *
1066
1191
  * @since 4.0.0
@@ -1124,15 +1249,17 @@ export const fromYieldable = internal.fromYieldable;
1124
1249
  *
1125
1250
  * @example
1126
1251
  * ```ts
1127
- * import { Effect, pipe } from "effect"
1252
+ * import { Data, Effect, pipe } from "effect"
1253
+ *
1254
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1128
1255
  *
1129
1256
  * // Function to apply a discount safely to a transaction amount
1130
1257
  * const applyDiscount = (
1131
1258
  * total: number,
1132
1259
  * discountRate: number
1133
- * ): Effect.Effect<number, Error> =>
1260
+ * ): Effect.Effect<number, DiscountRateError> =>
1134
1261
  * discountRate === 0
1135
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
1262
+ * ? Effect.fail(new DiscountRateError())
1136
1263
  * : Effect.succeed(total - (total * discountRate) / 100)
1137
1264
  *
1138
1265
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -1216,15 +1343,17 @@ export const flatten = internal.flatten;
1216
1343
  *
1217
1344
  * @example Applying a Discount Based on Fetched Amount
1218
1345
  * ```ts
1219
- * import { Effect, pipe } from "effect"
1346
+ * import { Data, Effect, pipe } from "effect"
1347
+ *
1348
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1220
1349
  *
1221
1350
  * // Function to apply a discount safely to a transaction amount
1222
1351
  * const applyDiscount = (
1223
1352
  * total: number,
1224
1353
  * discountRate: number
1225
- * ): Effect.Effect<number, Error> =>
1354
+ * ): Effect.Effect<number, DiscountRateError> =>
1226
1355
  * discountRate === 0
1227
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
1356
+ * ? Effect.fail(new DiscountRateError())
1228
1357
  * : Effect.succeed(total - (total * discountRate) / 100)
1229
1358
  *
1230
1359
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -1281,16 +1410,18 @@ export const andThen = internal.andThen;
1281
1410
  * @example
1282
1411
  * ```ts
1283
1412
  * // Title: Logging a step in a pipeline
1284
- * import { Effect, pipe } from "effect"
1413
+ * import { Data, Effect, pipe } from "effect"
1285
1414
  * import { Console } from "effect"
1286
1415
  *
1416
+ * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
1417
+ *
1287
1418
  * // Function to apply a discount safely to a transaction amount
1288
1419
  * const applyDiscount = (
1289
1420
  * total: number,
1290
1421
  * discountRate: number
1291
- * ): Effect.Effect<number, Error> =>
1422
+ * ): Effect.Effect<number, DiscountRateError> =>
1292
1423
  * discountRate === 0
1293
- * ? Effect.fail(new Error("Discount rate cannot be zero"))
1424
+ * ? Effect.fail(new DiscountRateError())
1294
1425
  * : Effect.succeed(total - (total * discountRate) / 100)
1295
1426
  *
1296
1427
  * // Simulated asynchronous task to fetch a transaction amount from database
@@ -1697,12 +1828,12 @@ export {
1697
1828
  *
1698
1829
  * **Details**
1699
1830
  *
1700
- * The `catchAll` function catches any errors that may occur during the
1831
+ * The `catch` function catches any errors that may occur during the
1701
1832
  * execution of an effect and allows you to handle them by specifying a fallback
1702
1833
  * effect. This ensures that the program continues without failing by recovering
1703
1834
  * from errors using the provided fallback logic.
1704
1835
  *
1705
- * **Note**: `catchAll` only handles recoverable errors. It will not recover
1836
+ * **Note**: `catch` only handles recoverable errors. It will not recover
1706
1837
  * from unrecoverable defects.
1707
1838
  *
1708
1839
  * @see {@link catchCause} for a version that can recover from both recoverable and unrecoverable errors.
@@ -1767,7 +1898,8 @@ export const catchTag = internal.catchTag;
1767
1898
  * once. Instead of using {@link catchTag} multiple times, you can pass an
1768
1899
  * object where each key is an error type's `_tag`, and the value is the handler
1769
1900
  * for that specific error. This allows you to catch and recover from multiple
1770
- * error types in a single call.
1901
+ * error types in a single call. You can also provide a fallback handler for
1902
+ * unhandled errors.
1771
1903
  *
1772
1904
  * The error type must have a readonly `_tag` field to use `catchTag`. This
1773
1905
  * field is used to identify and match errors.
@@ -1998,15 +2130,14 @@ export const catchCause = internal.catchCause;
1998
2130
  */
1999
2131
  export const catchDefect = internal.catchDefect;
2000
2132
  /**
2001
- * Recovers from specific errors using a `Filter`, `Predicate`, or
2002
- * `Refinement`.
2133
+ * Recovers from specific errors using a `Predicate` or `Refinement`.
2003
2134
  *
2004
2135
  * **When to Use**
2005
2136
  *
2006
- * `catchIf` lets you recover from errors that match a condition. Pass a
2007
- * `Filter` for transformation, a `Refinement` for type narrowing, or a
2008
- * `Predicate` for simple boolean matching. Non-matching errors re-fail with
2009
- * the original cause. Defects and interrupts are not caught.
2137
+ * `catchIf` lets you recover from errors that match a condition. Use a
2138
+ * `Refinement` for type narrowing or a `Predicate` for simple boolean
2139
+ * matching. Non-matching errors re-fail with the original cause. Defects and
2140
+ * interrupts are not caught.
2010
2141
  *
2011
2142
  * **Previously Known As**
2012
2143
  *
@@ -2033,7 +2164,7 @@ export const catchDefect = internal.catchDefect;
2033
2164
  *
2034
2165
  * // With a Filter
2035
2166
  * const recovered2 = program.pipe(
2036
- * Effect.catchIf(
2167
+ * Effect.catchFilter(
2037
2168
  * Filter.tagged("NotFound"),
2038
2169
  * (error) => Effect.succeed(`missing:${error.id}`)
2039
2170
  * )
@@ -2044,6 +2175,13 @@ export const catchDefect = internal.catchDefect;
2044
2175
  * @category Error Handling
2045
2176
  */
2046
2177
  export const catchIf = internal.catchIf;
2178
+ /**
2179
+ * Recovers from specific errors using a `Filter`.
2180
+ *
2181
+ * @since 4.0.0
2182
+ * @category Error Handling
2183
+ */
2184
+ export const catchFilter = internal.catchFilter;
2047
2185
  /**
2048
2186
  * Catches `NoSuchElementError` failures and converts them to `Option.none`.
2049
2187
  *
@@ -2110,6 +2248,13 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
2110
2248
  * @category Error Handling
2111
2249
  */
2112
2250
  export const catchCauseIf = internal.catchCauseIf;
2251
+ /**
2252
+ * Recovers from specific failures based on a `Filter`.
2253
+ *
2254
+ * @since 4.0.0
2255
+ * @category Error Handling
2256
+ */
2257
+ export const catchCauseFilter = internal.catchCauseFilter;
2113
2258
  /**
2114
2259
  * The `mapError` function is used to transform or modify the error
2115
2260
  * produced by an effect, without affecting its success value.
@@ -2125,17 +2270,19 @@ export const catchCauseIf = internal.catchCauseIf;
2125
2270
  *
2126
2271
  * @example
2127
2272
  * ```ts
2128
- * import { Effect } from "effect"
2273
+ * import { Data, Effect } from "effect"
2274
+ *
2275
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
2129
2276
  *
2130
2277
  * // ┌─── Effect<number, string, never>
2131
2278
  * // ▼
2132
2279
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
2133
2280
  *
2134
- * // ┌─── Effect<number, Error, never>
2281
+ * // ┌─── Effect<number, TaskError, never>
2135
2282
  * // ▼
2136
2283
  * const mapped = Effect.mapError(
2137
2284
  * simulatedTask,
2138
- * (message) => new Error(message)
2285
+ * (message) => new TaskError({ message })
2139
2286
  * )
2140
2287
  * ```
2141
2288
  *
@@ -2155,16 +2302,18 @@ export const mapError = internal.mapError;
2155
2302
  *
2156
2303
  * @example
2157
2304
  * ```ts
2158
- * import { Effect } from "effect"
2305
+ * import { Data, Effect } from "effect"
2306
+ *
2307
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
2159
2308
  *
2160
2309
  * // ┌─── Effect<number, string, never>
2161
2310
  * // ▼
2162
2311
  * const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
2163
2312
  *
2164
- * // ┌─── Effect<boolean, Error, never>
2313
+ * // ┌─── Effect<boolean, TaskError, never>
2165
2314
  * // ▼
2166
2315
  * const modified = Effect.mapBoth(simulatedTask, {
2167
- * onFailure: (message) => new Error(message),
2316
+ * onFailure: (message) => new TaskError({ message }),
2168
2317
  * onSuccess: (n) => n > 0
2169
2318
  * })
2170
2319
  * ```
@@ -2194,11 +2343,13 @@ export const mapBoth = internal.mapBoth;
2194
2343
  * @example
2195
2344
  * ```ts
2196
2345
  * // Title: Propagating an Error as a Defect
2197
- * import { Effect } from "effect"
2346
+ * import { Data, Effect } from "effect"
2347
+ *
2348
+ * class DivideByZeroError extends Data.TaggedError("DivideByZeroError")<{}> {}
2198
2349
  *
2199
2350
  * const divide = (a: number, b: number) =>
2200
2351
  * b === 0
2201
- * ? Effect.fail(new Error("Cannot divide by zero"))
2352
+ * ? Effect.fail(new DivideByZeroError())
2202
2353
  * : Effect.succeed(a / b)
2203
2354
  *
2204
2355
  * // ┌─── Effect<number, never, never>
@@ -2207,7 +2358,7 @@ export const mapBoth = internal.mapBoth;
2207
2358
  *
2208
2359
  * Effect.runPromise(program).catch(console.error)
2209
2360
  * // Output:
2210
- * // (FiberFailure) Error: Cannot divide by zero
2361
+ * // (FiberFailure) DivideByZeroError
2211
2362
  * // ...stack trace...
2212
2363
  * ```
2213
2364
  *
@@ -2344,6 +2495,13 @@ export const tapCause = internal.tapCause;
2344
2495
  * @category Sequencing
2345
2496
  */
2346
2497
  export const tapCauseIf = internal.tapCauseIf;
2498
+ /**
2499
+ * Conditionally executes a side effect based on the cause of a failed effect.
2500
+ *
2501
+ * @since 4.0.0
2502
+ * @category Sequencing
2503
+ */
2504
+ export const tapCauseFilter = internal.tapCauseFilter;
2347
2505
  /**
2348
2506
  * Inspect severe errors or defects (non-recoverable failures) in an effect.
2349
2507
  *
@@ -2412,7 +2570,7 @@ export const tapDefect = internal.tapDefect;
2412
2570
  * attempts++
2413
2571
  * yield* Console.log(`Attempt ${attempts}`)
2414
2572
  * if (attempts < 3) {
2415
- * yield* Effect.fail("Not ready")
2573
+ * return yield* Effect.fail("Not ready")
2416
2574
  * }
2417
2575
  * return "Ready"
2418
2576
  * })
@@ -2454,13 +2612,15 @@ export const eventually = internal.eventually;
2454
2612
  *
2455
2613
  * @example
2456
2614
  * ```ts
2457
- * import { Effect, Schedule } from "effect"
2615
+ * import { Data, Effect, Schedule } from "effect"
2616
+ *
2617
+ * class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
2458
2618
  *
2459
2619
  * let attempt = 0
2460
- * const task = Effect.callback<string, Error>((resume) => {
2620
+ * const task = Effect.callback<string, AttemptError>((resume) => {
2461
2621
  * attempt++
2462
2622
  * if (attempt <= 2) {
2463
- * resume(Effect.fail(new Error(`Attempt ${attempt} failed`)))
2623
+ * resume(Effect.fail(new AttemptError({ attempt })))
2464
2624
  * } else {
2465
2625
  * resume(Effect.succeed("Success!"))
2466
2626
  * }
@@ -2500,14 +2660,16 @@ export const retry = internalSchedule.retry;
2500
2660
  *
2501
2661
  * @example
2502
2662
  * ```ts
2503
- * import { Console, Effect, Schedule } from "effect"
2663
+ * import { Console, Data, Effect, Schedule } from "effect"
2664
+ *
2665
+ * class NetworkTimeoutError extends Data.TaggedError("NetworkTimeoutError")<{}> {}
2504
2666
  *
2505
2667
  * let attempt = 0
2506
2668
  * const networkRequest = Effect.gen(function*() {
2507
2669
  * attempt++
2508
2670
  * yield* Console.log(`Network attempt ${attempt}`)
2509
2671
  * if (attempt < 3) {
2510
- * return yield* Effect.fail(new Error("Network timeout"))
2672
+ * return yield* Effect.fail(new NetworkTimeoutError())
2511
2673
  * }
2512
2674
  * return "Network data"
2513
2675
  * })
@@ -2579,7 +2741,8 @@ export const sandbox = internal.sandbox;
2579
2741
  * it succeeds or fails. This is useful when you only care about the side
2580
2742
  * effects of the effect and do not need to handle or process its outcome.
2581
2743
  *
2582
- * Use the `log` option to emit the full {@link Cause} when the effect fails.
2744
+ * Use the `log` option to emit the full {@link Cause} when the effect fails,
2745
+ * and `message` to prepend a custom log message.
2583
2746
  *
2584
2747
  * @example
2585
2748
  * ```ts
@@ -2603,7 +2766,7 @@ export const sandbox = internal.sandbox;
2603
2766
  * const task = Effect.fail("Uh oh!")
2604
2767
  *
2605
2768
  * const program = task.pipe(Effect.ignore({ log: true }))
2606
- * const programWarn = task.pipe(Effect.ignore({ log: "Warn" }))
2769
+ * const programWarn = task.pipe(Effect.ignore({ log: "Warn", message: "Ignoring task failure" }))
2607
2770
  * ```
2608
2771
  *
2609
2772
  * **Previously Known As**
@@ -2619,7 +2782,8 @@ export const ignore = internal.ignore;
2619
2782
  /**
2620
2783
  * Ignores the effect's failure cause, including defects and interruptions.
2621
2784
  *
2622
- * Use the `log` option to emit the full {@link Cause} when the effect fails.
2785
+ * Use the `log` option to emit the full {@link Cause} when the effect fails,
2786
+ * and `message` to prepend a custom log message.
2623
2787
  *
2624
2788
  * @example
2625
2789
  * ```ts
@@ -2628,7 +2792,7 @@ export const ignore = internal.ignore;
2628
2792
  * const task = Effect.fail("boom")
2629
2793
  *
2630
2794
  * const program = task.pipe(Effect.ignoreCause)
2631
- * const programLog = task.pipe(Effect.ignoreCause({ log: true }))
2795
+ * const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
2632
2796
  * ```
2633
2797
  *
2634
2798
  * @since 4.0.0
@@ -2645,13 +2809,16 @@ export const ignoreCause = internal.ignoreCause;
2645
2809
  *
2646
2810
  * @example
2647
2811
  * ```ts
2648
- * import { Effect, ExecutionPlan, Layer, ServiceMap } from "effect"
2812
+ * import { Effect, ExecutionPlan, Layer, Context } from "effect"
2649
2813
  *
2650
- * const Endpoint = ServiceMap.Service<{ url: string }>("Endpoint")
2814
+ * const Endpoint = Context.Service<{ url: string }>("Endpoint")
2651
2815
  *
2652
2816
  * const fetchUrl = Effect.gen(function*() {
2653
2817
  * const endpoint = yield* Effect.service(Endpoint)
2654
- * return endpoint.url === "bad" ? yield* Effect.fail("Unavailable") : endpoint.url
2818
+ * if (endpoint.url === "bad") {
2819
+ * return yield* Effect.fail("Unavailable")
2820
+ * }
2821
+ * return endpoint.url
2655
2822
  * })
2656
2823
  *
2657
2824
  * const plan = ExecutionPlan.make(
@@ -2666,6 +2833,16 @@ export const ignoreCause = internal.ignoreCause;
2666
2833
  * @category Fallback
2667
2834
  */
2668
2835
  export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
2836
+ /**
2837
+ * Runs an effect and reports any errors to the configured `ErrorReporter`s.
2838
+ *
2839
+ * If the `defectsOnly` option is set to `true`, only defects (unrecoverable
2840
+ * errors) will be reported, while regular failures will be ignored.
2841
+ *
2842
+ * @since 4.0.0
2843
+ * @category Error Handling
2844
+ */
2845
+ export const withErrorReporting = internal.withErrorReporting;
2669
2846
  // -----------------------------------------------------------------------------
2670
2847
  // Fallback
2671
2848
  // -----------------------------------------------------------------------------
@@ -2711,6 +2888,50 @@ export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
2711
2888
  * @category Fallback
2712
2889
  */
2713
2890
  export const orElseSucceed = internal.orElseSucceed;
2891
+ /**
2892
+ * Runs a sequence of effects and returns the result of the first successful
2893
+ * one.
2894
+ *
2895
+ * **Details**
2896
+ *
2897
+ * This function executes the provided effects in sequence, stopping at the
2898
+ * first success. If an effect succeeds, its result is returned immediately and
2899
+ * no further effects in the sequence are executed.
2900
+ *
2901
+ * If all effects fail, the returned effect fails with the error from the last
2902
+ * effect. If the collection is empty, the returned effect defects with an
2903
+ * `Error` whose message is `"Received an empty collection of effects"`.
2904
+ *
2905
+ * **When to Use**
2906
+ *
2907
+ * Use `firstSuccessOf` when you have prioritized fallback strategies, such as
2908
+ * attempting multiple APIs, reading configuration from several sources, or
2909
+ * trying alternative resource locations in order.
2910
+ *
2911
+ * @example
2912
+ * ```ts
2913
+ * import { Effect } from "effect"
2914
+ *
2915
+ * const primary = Effect.fail("primary unavailable")
2916
+ * const secondary = Effect.succeed("secondary result")
2917
+ * const tertiary = Effect.sync(() => {
2918
+ * throw new Error("not evaluated")
2919
+ * })
2920
+ *
2921
+ * const program = Effect.firstSuccessOf([
2922
+ * primary,
2923
+ * secondary,
2924
+ * tertiary
2925
+ * ])
2926
+ *
2927
+ * console.log(Effect.runSync(program))
2928
+ * // Output: "secondary result"
2929
+ * ```
2930
+ *
2931
+ * @since 2.0.0
2932
+ * @category Fallback
2933
+ */
2934
+ export const firstSuccessOf = internal.firstSuccessOf;
2714
2935
  // -----------------------------------------------------------------------------
2715
2936
  // Delays & timeouts
2716
2937
  // -----------------------------------------------------------------------------
@@ -2830,7 +3051,7 @@ export const timeoutOption = internal.timeoutOption;
2830
3051
  * // Use cached data as fallback when timeout is reached
2831
3052
  * const program = Effect.timeoutOrElse(slowQuery, {
2832
3053
  * duration: "2 seconds",
2833
- * onTimeout: () =>
3054
+ * orElse: () =>
2834
3055
  * Effect.gen(function*() {
2835
3056
  * yield* Console.log("Query timed out, using cached data")
2836
3057
  * return "Cached result"
@@ -3042,12 +3263,12 @@ export const raceFirst = internal.raceFirst;
3042
3263
  // Filtering
3043
3264
  // -----------------------------------------------------------------------------
3044
3265
  /**
3045
- * Filters elements of an iterable using a predicate, refinement, effectful
3046
- * predicate, or `Filter.FilterEffect`.
3266
+ * Filters elements of an iterable using a predicate, refinement, or effectful
3267
+ * predicate.
3047
3268
  *
3048
3269
  * @example
3049
3270
  * ```ts
3050
- * import { Effect, Filter, Result } from "effect"
3271
+ * import { Effect } from "effect"
3051
3272
  *
3052
3273
  * // Sync predicate
3053
3274
  * const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
@@ -3055,16 +3276,27 @@ export const raceFirst = internal.raceFirst;
3055
3276
  * // Effectful predicate
3056
3277
  * const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
3057
3278
  *
3058
- * // FilterEffect
3059
- * const mapped = Effect.filter([1, 2, 3, 4], (n) =>
3060
- * Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
3061
- * )
3279
+ * // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
3062
3280
  * ```
3063
3281
  *
3064
3282
  * @since 2.0.0
3065
3283
  * @category Filtering
3066
3284
  */
3067
3285
  export const filter = internal.filter;
3286
+ /**
3287
+ * Filters and maps elements of an iterable with a `Filter`.
3288
+ *
3289
+ * @since 4.0.0
3290
+ * @category Filtering
3291
+ */
3292
+ export const filterMap = internal.filterMap;
3293
+ /**
3294
+ * Effectfully filters and maps elements of an iterable with a `FilterEffect`.
3295
+ *
3296
+ * @since 4.0.0
3297
+ * @category Filtering
3298
+ */
3299
+ export const filterMapEffect = internal.filterMapEffect;
3068
3300
  /**
3069
3301
  * Filters an effect, providing an alternative effect if the predicate fails.
3070
3302
  *
@@ -3096,6 +3328,13 @@ export const filter = internal.filter;
3096
3328
  * @category Filtering
3097
3329
  */
3098
3330
  export const filterOrElse = internal.filterOrElse;
3331
+ /**
3332
+ * Filters an effect with a `Filter`, providing an alternative effect on failure.
3333
+ *
3334
+ * @since 4.0.0
3335
+ * @category Filtering
3336
+ */
3337
+ export const filterMapOrElse = internal.filterMapOrElse;
3099
3338
  /**
3100
3339
  * Filters an effect, failing with a custom error if the predicate fails.
3101
3340
  *
@@ -3126,6 +3365,13 @@ export const filterOrElse = internal.filterOrElse;
3126
3365
  * @category Filtering
3127
3366
  */
3128
3367
  export const filterOrFail = internal.filterOrFail;
3368
+ /**
3369
+ * Filters an effect with a `Filter`, failing when the filter fails.
3370
+ *
3371
+ * @since 4.0.0
3372
+ * @category Filtering
3373
+ */
3374
+ export const filterMapOrFail = internal.filterMapOrFail;
3129
3375
  // -----------------------------------------------------------------------------
3130
3376
  // Conditional Operators
3131
3377
  // -----------------------------------------------------------------------------
@@ -3192,9 +3438,11 @@ export const when = internal.when;
3192
3438
  * @example
3193
3439
  * ```ts
3194
3440
  * // Title: Handling Both Success and Failure Cases
3195
- * import { Effect } from "effect"
3441
+ * import { Data, Effect } from "effect"
3196
3442
  *
3197
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
3443
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
3444
+ *
3445
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
3198
3446
  *
3199
3447
  * const program1 = Effect.match(success, {
3200
3448
  * onFailure: (error) => `failure: ${error.message}`,
@@ -3205,8 +3453,8 @@ export const when = internal.when;
3205
3453
  * Effect.runPromise(program1).then(console.log)
3206
3454
  * // Output: "success: 42"
3207
3455
  *
3208
- * const failure: Effect.Effect<number, Error> = Effect.fail(
3209
- * new Error("Uh oh!")
3456
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
3457
+ * new ExampleError({ message: "Uh oh!" })
3210
3458
  * )
3211
3459
  *
3212
3460
  * const program2 = Effect.match(failure, {
@@ -3350,9 +3598,11 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
3350
3598
  *
3351
3599
  * @example
3352
3600
  * ```ts
3353
- * import { Cause, Console, Effect, Result } from "effect"
3601
+ * import { Cause, Console, Data, Effect, Result } from "effect"
3602
+ *
3603
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
3354
3604
  *
3355
- * const task = Effect.fail(new Error("Task failed"))
3605
+ * const task = Effect.fail(new TaskError({ message: "Task failed" }))
3356
3606
  *
3357
3607
  * const program = Effect.matchCauseEffect(task, {
3358
3608
  * onFailure: (cause) =>
@@ -3408,11 +3658,13 @@ export const matchCauseEffect = internal.matchCauseEffect;
3408
3658
  * @example
3409
3659
  * ```ts
3410
3660
  * // Title: Handling Both Success and Failure Cases with Side Effects
3411
- * import { Effect } from "effect"
3661
+ * import { Data, Effect } from "effect"
3412
3662
  *
3413
- * const success: Effect.Effect<number, Error> = Effect.succeed(42)
3414
- * const failure: Effect.Effect<number, Error> = Effect.fail(
3415
- * new Error("Uh oh!")
3663
+ * class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
3664
+ *
3665
+ * const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
3666
+ * const failure: Effect.Effect<number, ExampleError> = Effect.fail(
3667
+ * new ExampleError({ message: "Uh oh!" })
3416
3668
  * )
3417
3669
  *
3418
3670
  * const program1 = Effect.matchEffect(success, {
@@ -3506,7 +3758,7 @@ export const isSuccess = internal.isSuccess;
3506
3758
  // Environment
3507
3759
  // -----------------------------------------------------------------------------
3508
3760
  /**
3509
- * Returns the complete service map from the current context.
3761
+ * Returns the complete context.
3510
3762
  *
3511
3763
  * This function allows you to access all services that are currently available
3512
3764
  * in the effect's environment. This can be useful for debugging, introspection,
@@ -3514,56 +3766,56 @@ export const isSuccess = internal.isSuccess;
3514
3766
  *
3515
3767
  * @example
3516
3768
  * ```ts
3517
- * import { Console, Effect, Option, ServiceMap } from "effect"
3769
+ * import { Console, Effect, Option, Context } from "effect"
3518
3770
  *
3519
- * const Logger = ServiceMap.Service<{
3771
+ * const Logger = Context.Service<{
3520
3772
  * log: (msg: string) => void
3521
3773
  * }>("Logger")
3522
- * const Database = ServiceMap.Service<{
3774
+ * const Database = Context.Service<{
3523
3775
  * query: (sql: string) => string
3524
3776
  * }>("Database")
3525
3777
  *
3526
3778
  * const program = Effect.gen(function*() {
3527
- * const allServices = yield* Effect.services()
3779
+ * const allServices = yield* Effect.context()
3528
3780
  *
3529
3781
  * // Check if specific services are available
3530
- * const loggerOption = ServiceMap.getOption(allServices, Logger)
3531
- * const databaseOption = ServiceMap.getOption(allServices, Database)
3782
+ * const loggerOption = Context.getOption(allServices, Logger)
3783
+ * const databaseOption = Context.getOption(allServices, Database)
3532
3784
  *
3533
3785
  * yield* Console.log(`Logger available: ${Option.isSome(loggerOption)}`)
3534
3786
  * yield* Console.log(`Database available: ${Option.isSome(databaseOption)}`)
3535
3787
  * })
3536
3788
  *
3537
- * const serviceMap = ServiceMap.make(Logger, { log: console.log })
3538
- * .pipe(ServiceMap.add(Database, { query: () => "result" }))
3789
+ * const context = Context.make(Logger, { log: console.log })
3790
+ * .pipe(Context.add(Database, { query: () => "result" }))
3539
3791
  *
3540
- * const provided = Effect.provideServices(program, serviceMap)
3792
+ * const provided = Effect.provideContext(program, context)
3541
3793
  * ```
3542
3794
  *
3543
3795
  * @since 2.0.0
3544
3796
  * @category Environment
3545
3797
  */
3546
- export const services = internal.services;
3798
+ export const context = internal.context;
3547
3799
  /**
3548
- * Transforms the current service map using the provided function.
3800
+ * Transforms the current context using the provided function.
3549
3801
  *
3550
- * This function allows you to access the complete service map and perform
3802
+ * This function allows you to access the complete context and perform
3551
3803
  * computations based on all available services. This is useful when you need
3552
3804
  * to conditionally execute logic based on what services are available.
3553
3805
  *
3554
3806
  * @example
3555
3807
  * ```ts
3556
- * import { Console, Effect, Option, ServiceMap } from "effect"
3808
+ * import { Console, Effect, Option, Context } from "effect"
3557
3809
  *
3558
- * const Logger = ServiceMap.Service<{
3810
+ * const Logger = Context.Service<{
3559
3811
  * log: (msg: string) => void
3560
3812
  * }>("Logger")
3561
- * const Cache = ServiceMap.Service<{
3813
+ * const Cache = Context.Service<{
3562
3814
  * get: (key: string) => string | null
3563
3815
  * }>("Cache")
3564
3816
  *
3565
- * const program = Effect.servicesWith((services) => {
3566
- * const cacheOption = ServiceMap.getOption(services, Cache)
3817
+ * const program = Effect.contextWith((services) => {
3818
+ * const cacheOption = Context.getOption(services, Cache)
3567
3819
  * const hasCache = Option.isSome(cacheOption)
3568
3820
  *
3569
3821
  * if (hasCache) {
@@ -3588,7 +3840,7 @@ export const services = internal.services;
3588
3840
  * @since 2.0.0
3589
3841
  * @category Environment
3590
3842
  */
3591
- export const servicesWith = internal.servicesWith;
3843
+ export const contextWith = internal.contextWith;
3592
3844
  /**
3593
3845
  * Provides dependencies to an effect using layers or a context. Use `options.local`
3594
3846
  * to build the layer every time; by default, layers are shared between provide
@@ -3596,16 +3848,16 @@ export const servicesWith = internal.servicesWith;
3596
3848
  *
3597
3849
  * @example
3598
3850
  * ```ts
3599
- * import { Effect, Layer, ServiceMap } from "effect"
3851
+ * import { Effect, Layer, Context } from "effect"
3600
3852
  *
3601
3853
  * interface Database {
3602
3854
  * readonly query: (sql: string) => Effect.Effect<string>
3603
3855
  * }
3604
3856
  *
3605
- * const Database = ServiceMap.Service<Database>("Database")
3857
+ * const Database = Context.Service<Database>("Database")
3606
3858
  *
3607
3859
  * const DatabaseLive = Layer.succeed(Database)({
3608
- * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
3860
+ * query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
3609
3861
  * })
3610
3862
  *
3611
3863
  * const program = Effect.gen(function*() {
@@ -3624,29 +3876,29 @@ export const servicesWith = internal.servicesWith;
3624
3876
  */
3625
3877
  export const provide = internalLayer.provide;
3626
3878
  /**
3627
- * Provides a service map to an effect, fulfilling its service requirements.
3879
+ * Provides a context to an effect, fulfilling its service requirements.
3628
3880
  *
3629
3881
  * **Details**
3630
3882
  *
3631
- * This function provides multiple services at once by supplying a service map
3883
+ * This function provides multiple services at once by supplying a context
3632
3884
  * that contains all the required services. It removes the provided services
3633
3885
  * from the effect's requirements, making them available to the effect.
3634
3886
  *
3635
3887
  * @example
3636
3888
  * ```ts
3637
- * import { Effect, ServiceMap } from "effect"
3889
+ * import { Effect, Context } from "effect"
3638
3890
  *
3639
3891
  * // Define service keys
3640
- * const Logger = ServiceMap.Service<{
3892
+ * const Logger = Context.Service<{
3641
3893
  * log: (msg: string) => void
3642
3894
  * }>("Logger")
3643
- * const Database = ServiceMap.Service<{
3895
+ * const Database = Context.Service<{
3644
3896
  * query: (sql: string) => string
3645
3897
  * }>("Database")
3646
3898
  *
3647
- * // Create service map with multiple services
3648
- * const serviceMap = ServiceMap.make(Logger, { log: console.log })
3649
- * .pipe(ServiceMap.add(Database, { query: () => "result" }))
3899
+ * // Create a context with multiple services
3900
+ * const context = Context.make(Logger, { log: console.log })
3901
+ * .pipe(Context.add(Database, { query: () => "result" }))
3650
3902
  *
3651
3903
  * // An effect that requires both services
3652
3904
  * const program = Effect.gen(function*() {
@@ -3656,25 +3908,25 @@ export const provide = internalLayer.provide;
3656
3908
  * return db.query("SELECT * FROM users")
3657
3909
  * })
3658
3910
  *
3659
- * const provided = Effect.provideServices(program, serviceMap)
3911
+ * const provided = Effect.provideContext(program, context)
3660
3912
  * ```
3661
3913
  *
3662
3914
  * @since 2.0.0
3663
3915
  * @category Environment
3664
3916
  */
3665
- export const provideServices = internal.provideServices;
3917
+ export const provideContext = internal.provideContext;
3666
3918
  /**
3667
3919
  * Accesses a service from the context.
3668
3920
  *
3669
3921
  * @example
3670
3922
  * ```ts
3671
- * import { Effect, ServiceMap } from "effect"
3923
+ * import { Effect, Context } from "effect"
3672
3924
  *
3673
3925
  * interface Database {
3674
3926
  * readonly query: (sql: string) => Effect.Effect<string>
3675
3927
  * }
3676
3928
  *
3677
- * const Database = ServiceMap.Service<Database>("Database")
3929
+ * const Database = Context.Service<Database>("Database")
3678
3930
  *
3679
3931
  * const program = Effect.gen(function*() {
3680
3932
  * const db = yield* Effect.service(Database)
@@ -3683,7 +3935,7 @@ export const provideServices = internal.provideServices;
3683
3935
  * ```
3684
3936
  *
3685
3937
  * @since 4.0.0
3686
- * @category ServiceMap
3938
+ * @category Context
3687
3939
  */
3688
3940
  export const service = internal.service;
3689
3941
  /**
@@ -3698,10 +3950,10 @@ export const service = internal.service;
3698
3950
  *
3699
3951
  * @example
3700
3952
  * ```ts
3701
- * import { Effect, Option, ServiceMap } from "effect"
3953
+ * import { Effect, Option, Context } from "effect"
3702
3954
  *
3703
3955
  * // Define a service key
3704
- * const Logger = ServiceMap.Service<{
3956
+ * const Logger = Context.Service<{
3705
3957
  * log: (msg: string) => void
3706
3958
  * }>("Logger")
3707
3959
  *
@@ -3718,7 +3970,7 @@ export const service = internal.service;
3718
3970
  * ```
3719
3971
  *
3720
3972
  * @since 2.0.0
3721
- * @category ServiceMap
3973
+ * @category Context
3722
3974
  */
3723
3975
  export const serviceOption = internal.serviceOption;
3724
3976
  /**
@@ -3731,13 +3983,13 @@ export const serviceOption = internal.serviceOption;
3731
3983
  *
3732
3984
  * @example
3733
3985
  * ```ts
3734
- * import { Effect, ServiceMap } from "effect"
3986
+ * import { Effect, Context } from "effect"
3735
3987
  *
3736
3988
  * // Define services
3737
- * const Logger = ServiceMap.Service<{
3989
+ * const Logger = Context.Service<{
3738
3990
  * log: (msg: string) => void
3739
3991
  * }>("Logger")
3740
- * const Config = ServiceMap.Service<{
3992
+ * const Config = Context.Service<{
3741
3993
  * name: string
3742
3994
  * }>("Config")
3743
3995
  *
@@ -3747,8 +3999,8 @@ export const serviceOption = internal.serviceOption;
3747
3999
  *
3748
4000
  * // Transform services by providing Config while keeping Logger requirement
3749
4001
  * const configured = program.pipe(
3750
- * Effect.updateServices((services: ServiceMap.ServiceMap<typeof Logger>) =>
3751
- * ServiceMap.add(services, Config, { name: "World" })
4002
+ * Effect.updateContext((context: Context.Context<typeof Logger>) =>
4003
+ * Context.add(context, Config, { name: "World" })
3752
4004
  * )
3753
4005
  * )
3754
4006
  *
@@ -3759,18 +4011,18 @@ export const serviceOption = internal.serviceOption;
3759
4011
  * ```
3760
4012
  *
3761
4013
  * @since 4.0.0
3762
- * @category ServiceMap
4014
+ * @category Context
3763
4015
  */
3764
- export const updateServices = internal.updateServices;
4016
+ export const updateContext = internal.updateContext;
3765
4017
  /**
3766
4018
  * Updates the service with the required service entry.
3767
4019
  *
3768
4020
  * @example
3769
4021
  * ```ts
3770
- * import { Console, Effect, ServiceMap } from "effect"
4022
+ * import { Console, Effect, Context } from "effect"
3771
4023
  *
3772
4024
  * // Define a counter service
3773
- * const Counter = ServiceMap.Service<{ count: number }>("Counter")
4025
+ * const Counter = Context.Service<{ count: number }>("Counter")
3774
4026
  *
3775
4027
  * const program = Effect.gen(function*() {
3776
4028
  * const updatedCounter = yield* Effect.service(Counter)
@@ -3788,7 +4040,7 @@ export const updateServices = internal.updateServices;
3788
4040
  * ```
3789
4041
  *
3790
4042
  * @since 2.0.0
3791
- * @category ServiceMap
4043
+ * @category Context
3792
4044
  */
3793
4045
  export const updateService = internal.updateService;
3794
4046
  /**
@@ -3805,10 +4057,10 @@ export const updateService = internal.updateService;
3805
4057
  *
3806
4058
  * @example
3807
4059
  * ```ts
3808
- * import { Console, Effect, ServiceMap } from "effect"
4060
+ * import { Console, Effect, Context } from "effect"
3809
4061
  *
3810
4062
  * // Define a service for configuration
3811
- * const Config = ServiceMap.Service<{
4063
+ * const Config = Context.Service<{
3812
4064
  * apiUrl: string
3813
4065
  * timeout: number
3814
4066
  * }>("Config")
@@ -3834,7 +4086,7 @@ export const updateService = internal.updateService;
3834
4086
  * ```
3835
4087
  *
3836
4088
  * @since 2.0.0
3837
- * @category ServiceMap
4089
+ * @category Context
3838
4090
  */
3839
4091
  export const provideService = internal.provideService;
3840
4092
  /**
@@ -3849,13 +4101,13 @@ export const provideService = internal.provideService;
3849
4101
  *
3850
4102
  * @example
3851
4103
  * ```ts
3852
- * import { Console, Effect, ServiceMap } from "effect"
4104
+ * import { Console, Effect, Context } from "effect"
3853
4105
  *
3854
4106
  * // Define a database connection service
3855
4107
  * interface DatabaseConnection {
3856
4108
  * readonly query: (sql: string) => Effect.Effect<string>
3857
4109
  * }
3858
- * const Database = ServiceMap.Service<DatabaseConnection>("Database")
4110
+ * const Database = Context.Service<DatabaseConnection>("Database")
3859
4111
  *
3860
4112
  * // Effect that creates a database connection
3861
4113
  * const createConnection = Effect.gen(function*() {
@@ -3887,7 +4139,7 @@ export const provideService = internal.provideService;
3887
4139
  * ```
3888
4140
  *
3889
4141
  * @since 2.0.0
3890
- * @category ServiceMap
4142
+ * @category Context
3891
4143
  */
3892
4144
  export const provideServiceEffect = internal.provideServiceEffect;
3893
4145
  // -----------------------------------------------------------------------------
@@ -4245,9 +4497,11 @@ export const ensuring = internal.ensuring;
4245
4497
  *
4246
4498
  * @example
4247
4499
  * ```ts
4248
- * import { Cause, Console, Effect } from "effect"
4500
+ * import { Cause, Data, Console, Effect } from "effect"
4249
4501
  *
4250
- * const task = Effect.fail(new Error("Something went wrong"))
4502
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
4503
+ *
4504
+ * const task = Effect.fail(new TaskError({ message: "Something went wrong" }))
4251
4505
  *
4252
4506
  * const program = Effect.onError(
4253
4507
  * task,
@@ -4256,8 +4510,8 @@ export const ensuring = internal.ensuring;
4256
4510
  *
4257
4511
  * Effect.runPromise(program).catch(console.error)
4258
4512
  * // Output:
4259
- * // Cleanup on error: Error: Something went wrong
4260
- * // Error: Something went wrong
4513
+ * // Cleanup on error: TaskError: Something went wrong
4514
+ * // TaskError: Something went wrong
4261
4515
  * ```
4262
4516
  *
4263
4517
  * @since 2.0.0
@@ -4266,7 +4520,7 @@ export const ensuring = internal.ensuring;
4266
4520
  export const onError = internal.onError;
4267
4521
  /**
4268
4522
  * Runs the finalizer only when this effect fails and the `Cause` matches the
4269
- * filter, passing the filtered failure and the original cause.
4523
+ * provided predicate.
4270
4524
  *
4271
4525
  * @example
4272
4526
  * ```ts
@@ -4288,6 +4542,13 @@ export const onError = internal.onError;
4288
4542
  * @category Resource Management & Finalization
4289
4543
  */
4290
4544
  export const onErrorIf = internal.onErrorIf;
4545
+ /**
4546
+ * Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
4547
+ *
4548
+ * @since 4.0.0
4549
+ * @category Resource Management & Finalization
4550
+ */
4551
+ export const onErrorFilter = internal.onErrorFilter;
4291
4552
  /**
4292
4553
  * The low level primitive that powers `onExit`.
4293
4554
  * function is used to run a finalizer when the effect exits, regardless of the
@@ -4325,20 +4586,20 @@ export const onExitPrimitive = internal.onExitPrimitive;
4325
4586
  */
4326
4587
  export const onExit = internal.onExit;
4327
4588
  /**
4328
- * Runs the cleanup effect only when the `Exit` passes the provided filter.
4329
- *
4330
- * The cleanup is skipped when the filter returns `Filter.fail`.
4589
+ * Runs the cleanup effect only when the `Exit` satisfies the provided
4590
+ * predicate.
4331
4591
  *
4332
4592
  * @example
4333
4593
  * ```ts
4334
- * import { Console, Effect, Exit, Filter } from "effect"
4335
- *
4336
- * const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
4594
+ * import { Console, Effect, Exit } from "effect"
4337
4595
  *
4338
4596
  * const program = Effect.onExitIf(
4339
4597
  * Effect.succeed(42),
4340
- * exitFilter,
4341
- * (success) => Console.log(`Succeeded with: ${success.value}`)
4598
+ * Exit.isSuccess,
4599
+ * (exit) =>
4600
+ * Exit.isSuccess(exit)
4601
+ * ? Console.log(`Succeeded with: ${exit.value}`)
4602
+ * : Effect.void
4342
4603
  * )
4343
4604
  * ```
4344
4605
  *
@@ -4346,6 +4607,13 @@ export const onExit = internal.onExit;
4346
4607
  * @category Resource Management & Finalization
4347
4608
  */
4348
4609
  export const onExitIf = internal.onExitIf;
4610
+ /**
4611
+ * Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
4612
+ *
4613
+ * @since 4.0.0
4614
+ * @category Resource Management & Finalization
4615
+ */
4616
+ export const onExitFilter = internal.onExitFilter;
4349
4617
  // -----------------------------------------------------------------------------
4350
4618
  // Caching
4351
4619
  // -----------------------------------------------------------------------------
@@ -4561,8 +4829,8 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
4561
4829
  * import { Effect } from "effect"
4562
4830
  *
4563
4831
  * const program = Effect.gen(function*() {
4564
- * yield* Effect.interrupt
4565
- * yield* Effect.succeed("This won't execute")
4832
+ * return yield* Effect.interrupt
4833
+ * yield* Effect.succeed("This won't execute and is unreachable")
4566
4834
  * })
4567
4835
  *
4568
4836
  * Effect.runPromise(program).catch(console.error)
@@ -4702,6 +4970,13 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
4702
4970
  * @category Interruption
4703
4971
  */
4704
4972
  export const interruptibleMask = internal.interruptibleMask;
4973
+ /**
4974
+ * Creates an AbortSignal that is managed by the provided scope.
4975
+ *
4976
+ * @since 4.0.0
4977
+ * @category Interruption
4978
+ */
4979
+ export const abortSignal = internal.abortSignal;
4705
4980
  /**
4706
4981
  * Repeats this effect forever (until the first error).
4707
4982
  *
@@ -4824,7 +5099,7 @@ export const repeat = internalSchedule.repeat;
4824
5099
  * attempt++
4825
5100
  * if (attempt <= 2) {
4826
5101
  * yield* Console.log(`Attempt ${attempt} failed`)
4827
- * yield* Effect.fail(`Error ${attempt}`)
5102
+ * return yield* Effect.fail(`Error ${attempt}`)
4828
5103
  * }
4829
5104
  * yield* Console.log(`Attempt ${attempt} succeeded`)
4830
5105
  * return "success"
@@ -5392,7 +5667,7 @@ export const withParentSpan = internal.withParentSpan;
5392
5667
  * )
5393
5668
  *
5394
5669
  * const program = Effect.gen(function*() {
5395
- * const name = yield* Effect.request(GetUser({ id: 1 }), Effect.succeed(resolver))
5670
+ * const name = yield* Effect.request(GetUser({ id: 1 }), resolver)
5396
5671
  * yield* Console.log(name)
5397
5672
  * })
5398
5673
  * ```
@@ -5400,7 +5675,7 @@ export const withParentSpan = internal.withParentSpan;
5400
5675
  export const request = internalRequest.request;
5401
5676
  /**
5402
5677
  * Low-level entry point that registers a request with a resolver and delivers the exit value via `onExit`.
5403
- * Use this when you already have a `ServiceMap` and need to enqueue a request outside an `Effect`.
5678
+ * Use this when you already have a `Context` and need to enqueue a request outside an `Effect`.
5404
5679
  *
5405
5680
  * It returns a canceler that removes the pending request entry.
5406
5681
  *
@@ -5645,15 +5920,15 @@ export const runFork = internal.runFork;
5645
5920
  *
5646
5921
  * @example
5647
5922
  * ```ts
5648
- * import { Effect, ServiceMap } from "effect"
5923
+ * import { Effect, Context } from "effect"
5649
5924
  *
5650
5925
  * interface Logger {
5651
5926
  * log: (message: string) => void
5652
5927
  * }
5653
5928
  *
5654
- * const Logger = ServiceMap.Service<Logger>("Logger")
5929
+ * const Logger = Context.Service<Logger>("Logger")
5655
5930
  *
5656
- * const services = ServiceMap.make(Logger, {
5931
+ * const services = Context.make(Logger, {
5657
5932
  * log: (message) => console.log(message)
5658
5933
  * })
5659
5934
  *
@@ -5677,15 +5952,15 @@ export const runForkWith = internal.runForkWith;
5677
5952
  *
5678
5953
  * @example
5679
5954
  * ```ts
5680
- * import { Console, Effect, Exit, ServiceMap } from "effect"
5955
+ * import { Console, Effect, Exit, Context } from "effect"
5681
5956
  *
5682
5957
  * interface Logger {
5683
5958
  * log: (message: string) => Effect.Effect<void>
5684
5959
  * }
5685
5960
  *
5686
- * const Logger = ServiceMap.Service<Logger>("Logger")
5961
+ * const Logger = Context.Service<Logger>("Logger")
5687
5962
  *
5688
- * const services = ServiceMap.make(Logger, {
5963
+ * const services = Context.make(Logger, {
5689
5964
  * log: (message) => Console.log(message)
5690
5965
  * })
5691
5966
  *
@@ -5789,15 +6064,15 @@ export const runPromise = internal.runPromise;
5789
6064
  *
5790
6065
  * @example
5791
6066
  * ```ts
5792
- * import { Effect, ServiceMap } from "effect"
6067
+ * import { Effect, Context } from "effect"
5793
6068
  *
5794
6069
  * interface Config {
5795
6070
  * apiUrl: string
5796
6071
  * }
5797
6072
  *
5798
- * const Config = ServiceMap.Service<Config>("Config")
6073
+ * const Config = Context.Service<Config>("Config")
5799
6074
  *
5800
- * const services = ServiceMap.make(Config, {
6075
+ * const context = Context.make(Config, {
5801
6076
  * apiUrl: "https://api.example.com"
5802
6077
  * })
5803
6078
  *
@@ -5806,7 +6081,7 @@ export const runPromise = internal.runPromise;
5806
6081
  * return `Connecting to ${config.apiUrl}`
5807
6082
  * })
5808
6083
  *
5809
- * Effect.runPromiseWith(services)(program).then(console.log)
6084
+ * Effect.runPromiseWith(context)(program).then(console.log)
5810
6085
  * ```
5811
6086
  *
5812
6087
  * @since 4.0.0
@@ -5866,15 +6141,15 @@ export const runPromiseExit = internal.runPromiseExit;
5866
6141
  *
5867
6142
  * @example
5868
6143
  * ```ts
5869
- * import { Effect, Exit, ServiceMap } from "effect"
6144
+ * import { Effect, Exit, Context } from "effect"
5870
6145
  *
5871
6146
  * interface Database {
5872
6147
  * query: (sql: string) => string
5873
6148
  * }
5874
6149
  *
5875
- * const Database = ServiceMap.Service<Database>("Database")
6150
+ * const Database = Context.Service<Database>("Database")
5876
6151
  *
5877
- * const services = ServiceMap.make(Database, {
6152
+ * const services = Context.make(Database, {
5878
6153
  * query: (sql) => `Result for: ${sql}`
5879
6154
  * })
5880
6155
  *
@@ -5957,15 +6232,15 @@ export const runSync = internal.runSync;
5957
6232
  *
5958
6233
  * @example
5959
6234
  * ```ts
5960
- * import { Effect, ServiceMap } from "effect"
6235
+ * import { Effect, Context } from "effect"
5961
6236
  *
5962
6237
  * interface MathService {
5963
6238
  * add: (a: number, b: number) => number
5964
6239
  * }
5965
6240
  *
5966
- * const MathService = ServiceMap.Service<MathService>("MathService")
6241
+ * const MathService = Context.Service<MathService>("MathService")
5967
6242
  *
5968
- * const services = ServiceMap.make(MathService, {
6243
+ * const context = Context.make(MathService, {
5969
6244
  * add: (a, b) => a + b
5970
6245
  * })
5971
6246
  *
@@ -5974,7 +6249,7 @@ export const runSync = internal.runSync;
5974
6249
  * return math.add(2, 3)
5975
6250
  * })
5976
6251
  *
5977
- * const result = Effect.runSyncWith(services)(program)
6252
+ * const result = Effect.runSyncWith(context)(program)
5978
6253
  * console.log(result) // 5
5979
6254
  * ```
5980
6255
  *
@@ -6057,10 +6332,10 @@ export const runSyncExit = internal.runSyncExit;
6057
6332
  *
6058
6333
  * @example
6059
6334
  * ```ts
6060
- * import { Effect, Exit, ServiceMap } from "effect"
6335
+ * import { Effect, Exit, Context } from "effect"
6061
6336
  *
6062
6337
  * // Define a logger service
6063
- * const Logger = ServiceMap.Service<{
6338
+ * const Logger = Context.Service<{
6064
6339
  * log: (msg: string) => void
6065
6340
  * }>("Logger")
6066
6341
  *
@@ -6070,12 +6345,12 @@ export const runSyncExit = internal.runSyncExit;
6070
6345
  * return 42
6071
6346
  * })
6072
6347
  *
6073
- * // Prepare services
6074
- * const services = ServiceMap.make(Logger, {
6348
+ * // Prepare context
6349
+ * const context = Context.make(Logger, {
6075
6350
  * log: (msg) => console.log(`[LOG] ${msg}`)
6076
6351
  * })
6077
6352
  *
6078
- * const exit = Effect.runSyncExitWith(services)(program)
6353
+ * const exit = Effect.runSyncExitWith(context)(program)
6079
6354
  *
6080
6355
  * if (Exit.isSuccess(exit)) {
6081
6356
  * console.log(`Success: ${exit.value}`)
@@ -6450,7 +6725,7 @@ export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.upda
6450
6725
  * @since 2.0.0
6451
6726
  * @category Logging
6452
6727
  */
6453
- export const annotateLogs = /*#__PURE__*/dual(args => core.isEffect(args[0]), (effect, ...args) => internal.updateService(effect, CurrentLogAnnotations, annotations => {
6728
+ export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect, ...args) => internal.updateService(effect, CurrentLogAnnotations, annotations => {
6454
6729
  const newAnnotations = {
6455
6730
  ...annotations
6456
6731
  };
@@ -6461,6 +6736,32 @@ export const annotateLogs = /*#__PURE__*/dual(args => core.isEffect(args[0]), (e
6461
6736
  }
6462
6737
  return newAnnotations;
6463
6738
  }));
6739
+ /**
6740
+ * Adds log annotations to the current scope.
6741
+ *
6742
+ * This differs from `annotateLogs`, which only annotates a specific effect.
6743
+ * `annotateLogsScoped` updates annotations for the entire current `Scope` and
6744
+ * restores the previous annotations when the scope closes.
6745
+ *
6746
+ * @example
6747
+ * ```ts
6748
+ * import { Effect } from "effect"
6749
+ *
6750
+ * const program = Effect.scoped(
6751
+ * Effect.gen(function*() {
6752
+ * yield* Effect.log("before")
6753
+ * yield* Effect.annotateLogsScoped({ requestId: "req-123" })
6754
+ * yield* Effect.log("inside scope")
6755
+ * })
6756
+ * )
6757
+ *
6758
+ * Effect.runPromise(program)
6759
+ * ```
6760
+ *
6761
+ * @since 4.0.0
6762
+ * @category Logging
6763
+ */
6764
+ export const annotateLogsScoped = internal.annotateLogsScoped;
6464
6765
  /**
6465
6766
  * Adds a span to each log line in this effect.
6466
6767
  *
@@ -6626,18 +6927,20 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
6626
6927
  *
6627
6928
  * @example
6628
6929
  * ```ts
6629
- * import { Effect, Metric } from "effect"
6930
+ * import { Data, Effect, Metric } from "effect"
6931
+ *
6932
+ * class ConnectionFailedError extends Data.TaggedError("ConnectionFailedError")<{}> {}
6630
6933
  *
6631
6934
  * // Track error types using frequency metric
6632
6935
  * const errorTypeFrequency = Metric.frequency("error_types")
6633
6936
  *
6634
- * const program = Effect.fail(new Error("Connection failed")).pipe(
6635
- * Effect.trackErrors(errorTypeFrequency, (error: Error) => error.name)
6937
+ * const program = Effect.fail(new ConnectionFailedError()).pipe(
6938
+ * Effect.trackErrors(errorTypeFrequency, (error: ConnectionFailedError) => error._tag)
6636
6939
  * )
6637
6940
  *
6638
6941
  * Effect.runPromiseExit(program).then(() =>
6639
6942
  * Effect.runPromise(Metric.value(errorTypeFrequency)).then(console.log)
6640
- * // Output: { occurrences: Map(1) { "Error" => 1 } }
6943
+ * // Output: { occurrences: Map(1) { "ConnectionFailedError" => 1 } }
6641
6944
  * )
6642
6945
  * ```
6643
6946
  *
@@ -6748,7 +7051,7 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
6748
7051
  const startTime = clock.currentTimeNanosUnsafe();
6749
7052
  return onExit(self, () => {
6750
7053
  const endTime = clock.currentTimeNanosUnsafe();
6751
- const duration = Duration.subtract(Duration.fromDurationInputUnsafe(endTime), Duration.fromDurationInputUnsafe(startTime));
7054
+ const duration = Duration.subtract(Duration.fromInputUnsafe(endTime), Duration.fromInputUnsafe(startTime));
6752
7055
  const input = f === undefined ? duration : internalCall(() => f(duration));
6753
7056
  return Metric.update(metric, input);
6754
7057
  });
@@ -6777,21 +7080,24 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
6777
7080
  * @since 4.0.0
6778
7081
  * @category Transactions
6779
7082
  */
6780
- export class Transaction extends /*#__PURE__*/ServiceMap.Service()("effect/Effect/Transaction") {}
7083
+ export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/Transaction") {}
6781
7084
  /**
6782
- * Defines a transaction. Transactions are "all or nothing" with respect to changes made to
6783
- * transactional values (i.e. TxRef) that occur within the transaction body.
7085
+ * Defines a transaction boundary. Transactions are "all or nothing" with respect to changes
7086
+ * made to transactional values (i.e. TxRef) that occur within the transaction body.
7087
+ *
7088
+ * If called inside an active transaction, `tx` composes with the current transaction and reuses
7089
+ * its journal and retry state instead of creating a nested boundary.
6784
7090
  *
6785
7091
  * In Effect transactions are optimistic with retry, that means transactions are retried when:
6786
7092
  *
6787
- * - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
7093
+ * - the body of the transaction explicitely calls to `Effect.txRetry` and any of the
6788
7094
  * accessed transactional values changes.
6789
7095
  *
6790
7096
  * - any of the accessed transactional values change during the execution of the transaction
6791
7097
  * due to a different transaction committing before the current.
6792
7098
  *
6793
- * - parent transaction retry, if you have a transaction within another transaction and
6794
- * the parent retries the child will also retry together with the parent.
7099
+ * The outermost `tx` call creates the transaction boundary and commits or rolls back the full
7100
+ * composed transaction.
6795
7101
  *
6796
7102
  * @example
6797
7103
  * ```ts
@@ -6801,10 +7107,10 @@ export class Transaction extends /*#__PURE__*/ServiceMap.Service()("effect/Effec
6801
7107
  * const ref1 = yield* TxRef.make(0)
6802
7108
  * const ref2 = yield* TxRef.make(0)
6803
7109
  *
6804
- * // All operations within atomic block succeed or fail together
6805
- * yield* Effect.atomic(Effect.gen(function*() {
7110
+ * // Nested tx calls compose into the same transaction
7111
+ * yield* Effect.tx(Effect.gen(function*() {
6806
7112
  * yield* TxRef.set(ref1, 10)
6807
- * yield* TxRef.set(ref2, 20)
7113
+ * yield* Effect.tx(TxRef.set(ref2, 20))
6808
7114
  * const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
6809
7115
  * console.log(`Transaction sum: ${sum}`)
6810
7116
  * }))
@@ -6817,139 +7123,19 @@ export class Transaction extends /*#__PURE__*/ServiceMap.Service()("effect/Effec
6817
7123
  * @since 4.0.0
6818
7124
  * @category Transactions
6819
7125
  */
6820
- export const atomic = effect => atomicWith(() => effect);
6821
- /**
6822
- * Executes a function within a transaction context, providing access to the transaction state.
6823
- *
6824
- * @example
6825
- * ```ts
6826
- * import { Effect, TxRef } from "effect"
6827
- *
6828
- * const program = Effect.atomicWith((txState) =>
6829
- * Effect.gen(function*() {
6830
- * const ref = yield* TxRef.make(0)
6831
- *
6832
- * // Access transaction state for debugging
6833
- * console.log(`Journal size: ${txState.journal.size}`)
6834
- * console.log(`Retry flag: ${txState.retry}`)
6835
- *
6836
- * yield* TxRef.set(ref, 42)
6837
- * return yield* TxRef.get(ref)
6838
- * })
6839
- * )
6840
- *
6841
- * Effect.runPromise(program).then(console.log) // 42
6842
- * ```
6843
- *
6844
- * @since 4.0.0
6845
- * @category Transactions
6846
- */
6847
- export const atomicWith = f => withFiber(fiber => {
6848
- // Check if transaction already exists and reuse it (composing behavior)
6849
- if (fiber.services.mapUnsafe.has(Transaction.key)) {
6850
- return internalCall(() => f(ServiceMap.getUnsafe(fiber.services, Transaction)));
7126
+ export const tx = effect => withFiber(fiber => {
7127
+ if (fiber.context.mapUnsafe.has(Transaction.key)) {
7128
+ return effect;
6851
7129
  }
6852
- // No existing transaction, create isolated one using transactionWith
6853
- return transactionWith(f);
6854
- });
6855
- /**
6856
- * Creates an isolated transaction that never composes with parent transactions.
6857
- *
6858
- * **Details**
6859
- *
6860
- * Unlike `Effect.atomic`, which composes with parent transactions when nested,
6861
- * `Effect.transaction` always creates a new isolated transaction boundary.
6862
- * This ensures complete isolation between different transaction scopes.
6863
- *
6864
- * **Key Differences from Effect.atomic:**
6865
- * - Always creates a new transaction, even when called within another transaction
6866
- * - Parent transaction failures don't affect isolated transactions
6867
- * - Isolated transaction failures don't affect parent transactions
6868
- * - Each transaction has its own journal and retry logic
6869
- *
6870
- * **When to Use:**
6871
- * - When you need guaranteed isolation between transaction scopes
6872
- * - For implementing independent operations that shouldn't be affected by outer transactions
6873
- * - When building transaction-based systems where isolation is critical
6874
- *
6875
- * @example
6876
- * ```ts
6877
- * import { Effect, TxRef } from "effect"
6878
- *
6879
- * const program = Effect.gen(function*() {
6880
- * const ref1 = yield* TxRef.make(0)
6881
- * const ref2 = yield* TxRef.make(100)
6882
- *
6883
- * // Nested atomic transaction - ref1 will be part of outer transaction
6884
- * yield* Effect.atomic(Effect.gen(function*() {
6885
- * yield* TxRef.set(ref1, 10)
6886
- *
6887
- * // This atomic operation composes with the parent
6888
- * yield* Effect.atomic(Effect.gen(function*() {
6889
- * yield* TxRef.set(ref1, 20) // Part of same transaction
6890
- * }))
6891
- * }))
6892
- *
6893
- * // Isolated transaction - ref2 will be in its own transaction
6894
- * yield* Effect.transaction(Effect.gen(function*() {
6895
- * yield* TxRef.set(ref2, 200)
6896
- * }))
6897
- *
6898
- * const val1 = yield* TxRef.get(ref1) // 20
6899
- * const val2 = yield* TxRef.get(ref2) // 200
6900
- * return { ref1: val1, ref2: val2 }
6901
- * })
6902
- * ```
6903
- *
6904
- * @since 4.0.0
6905
- * @category Transactions
6906
- */
6907
- export const transaction = effect => transactionWith(() => effect);
6908
- /**
6909
- * Executes a function within an isolated transaction context, providing access to the transaction state.
6910
- *
6911
- * This function always creates a new transaction boundary, regardless of whether it's called
6912
- * within another transaction. This ensures complete isolation between transaction scopes.
6913
- *
6914
- * @example
6915
- * ```ts
6916
- * import { Effect, TxRef } from "effect"
6917
- *
6918
- * const program = Effect.transactionWith((txState) =>
6919
- * Effect.gen(function*() {
6920
- * const ref = yield* TxRef.make(0)
6921
- *
6922
- * // This transaction is isolated - it has its own journal
6923
- * // txState.journal is independent of any parent transaction
6924
- *
6925
- * yield* TxRef.set(ref, 42)
6926
- * return yield* TxRef.get(ref)
6927
- * })
6928
- * )
6929
- *
6930
- * // Even when nested in another atomic block, this transaction is isolated
6931
- * const nestedProgram = Effect.atomic(
6932
- * Effect.gen(function*() {
6933
- * const result = yield* program // Runs in its own isolated transaction
6934
- * return result
6935
- * })
6936
- * )
6937
- * ```
6938
- *
6939
- * @since 4.0.0
6940
- * @category Transactions
6941
- */
6942
- export const transactionWith = f => withFiber(fiber => {
6943
- // Always create a new transaction state, never compose with parent
7130
+ // Create transaction state only at the outermost boundary
6944
7131
  const state = {
6945
7132
  journal: new Map(),
6946
7133
  retry: false
6947
7134
  };
6948
- const scheduler = fiber.currentScheduler;
6949
7135
  let result;
6950
7136
  return uninterruptibleMask(restore => flatMap(whileLoop({
6951
7137
  while: () => !result,
6952
- body: constant(restore(suspend(() => f(state))).pipe(provideService(Transaction, state), tapCause(() => {
7138
+ body: constant(restore(effect).pipe(provideService(Transaction, state), tapCause(() => {
6953
7139
  if (!state.retry) return void_;
6954
7140
  return restore(awaitPendingTransaction(state));
6955
7141
  }), exit)),
@@ -6958,7 +7144,7 @@ export const transactionWith = f => withFiber(fiber => {
6958
7144
  return clearTransaction(state);
6959
7145
  }
6960
7146
  if (Exit.isSuccess(exit)) {
6961
- commitTransaction(scheduler, state);
7147
+ commitTransaction(fiber, state);
6962
7148
  } else {
6963
7149
  clearTransaction(state);
6964
7150
  }
@@ -6995,7 +7181,7 @@ const awaitPendingTransaction = state => suspend(() => {
6995
7181
  return sync(clearPending);
6996
7182
  });
6997
7183
  });
6998
- function commitTransaction(scheduler, state) {
7184
+ function commitTransaction(fiber, state) {
6999
7185
  for (const [ref, {
7000
7186
  value
7001
7187
  }] of state.journal) {
@@ -7004,7 +7190,7 @@ function commitTransaction(scheduler, state) {
7004
7190
  ref.value = value;
7005
7191
  }
7006
7192
  for (const pending of ref.pending.values()) {
7007
- scheduler.scheduleTask(pending, 0);
7193
+ fiber.currentDispatcher.scheduleTask(pending, 0);
7008
7194
  }
7009
7195
  ref.pending.clear();
7010
7196
  }
@@ -7033,15 +7219,15 @@ function clearTransaction(state) {
7033
7219
  * // forks a fiber that increases the value of `ref` every 100 millis
7034
7220
  * yield* Effect.forkChild(Effect.forever(
7035
7221
  * // update to transactional value
7036
- * TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis"))
7222
+ * Effect.tx(TxRef.update(ref, (n) => n + 1)).pipe(Effect.delay("100 millis"))
7037
7223
  * ))
7038
7224
  *
7039
7225
  * // the following will retry 10 times until the `ref` value is 10
7040
- * yield* Effect.atomic(Effect.gen(function*() {
7226
+ * yield* Effect.tx(Effect.gen(function*() {
7041
7227
  * const value = yield* TxRef.get(ref)
7042
7228
  * if (value < 10) {
7043
7229
  * yield* Effect.log(`retry due to value: ${value}`)
7044
- * return yield* Effect.retryTransaction
7230
+ * return yield* Effect.txRetry
7045
7231
  * }
7046
7232
  * yield* Effect.log(`transaction done with value: ${value}`)
7047
7233
  * }))
@@ -7050,7 +7236,7 @@ function clearTransaction(state) {
7050
7236
  * Effect.runPromise(program).catch(console.error)
7051
7237
  * ```
7052
7238
  */
7053
- export const retryTransaction = /*#__PURE__*/flatMap(/*#__PURE__*/Transaction.asEffect(), state => {
7239
+ export const txRetry = /*#__PURE__*/flatMap(/*#__PURE__*/Transaction.asEffect(), state => {
7054
7240
  state.retry = true;
7055
7241
  return interrupt;
7056
7242
  });
@@ -7141,18 +7327,20 @@ export const satisfiesSuccessType = () => effect => effect;
7141
7327
  *
7142
7328
  * @example
7143
7329
  * ```ts
7144
- * import { Effect } from "effect"
7330
+ * import { Data, Effect } from "effect"
7331
+ *
7332
+ * class ValidationError extends Data.TaggedError("ValidationError")<{}> {}
7145
7333
  *
7146
- * // Define a constraint that the error type must be an Error
7147
- * const satisfiesError = Effect.satisfiesErrorType<Error>()
7334
+ * // Define a constraint that the error type must be a ValidationError
7335
+ * const satisfiesError = Effect.satisfiesErrorType<ValidationError>()
7148
7336
  *
7149
- * // This works - Effect<number, TypeError, never> extends Effect<number, Error, never>
7150
- * const validEffect = satisfiesError(Effect.fail(new TypeError("Invalid type")))
7337
+ * // This works - Effect<number, ValidationError, never> extends the constrained type
7338
+ * const validEffect = satisfiesError(Effect.fail(new ValidationError()))
7151
7339
  *
7152
7340
  * // This would cause a TypeScript compilation error:
7153
7341
  * // const invalidEffect = satisfiesError(Effect.fail("string error"))
7154
7342
  * // ^^^^^^^^^^^^^^^^^^^^^^^^^^^
7155
- * // Type 'string' is not assignable to type 'Error'
7343
+ * // Type 'string' is not assignable to type 'ValidationError'
7156
7344
  * ```
7157
7345
  *
7158
7346
  * @since 4.0.0