effect 4.0.0-rc.111 → 4.0.0-rc.113

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 (1293) hide show
  1. package/AGENTS.md +24 -9
  2. package/CLAUDE.md +24 -9
  3. package/ai-docs/package.json +2 -2
  4. package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +18 -5
  5. package/ai-docs/src/01_effect/01_basics/index.md +5 -3
  6. package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +1 -1
  7. package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +2 -2
  8. package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +2 -2
  9. package/ai-docs/src/03_stream/30_encoding.ts +5 -7
  10. package/ai-docs/src/08_observability/10_logging.ts +1 -1
  11. package/ai-docs/src/70_cli/10_basics.ts +7 -7
  12. package/ai-docs/src/71_ai/10_language-model.ts +2 -2
  13. package/ai-docs/src/71_ai/20_tools.ts +1 -1
  14. package/ai-docs/src/71_ai/30_chat.ts +1 -1
  15. package/dist/Array.d.ts +109 -52
  16. package/dist/Array.d.ts.map +1 -1
  17. package/dist/Array.js +65 -32
  18. package/dist/Array.js.map +1 -1
  19. package/dist/BigDecimal.d.ts +5 -1
  20. package/dist/BigDecimal.d.ts.map +1 -1
  21. package/dist/BigDecimal.js +40 -23
  22. package/dist/BigDecimal.js.map +1 -1
  23. package/dist/ByteSize.d.ts +633 -0
  24. package/dist/ByteSize.d.ts.map +1 -0
  25. package/dist/ByteSize.js +524 -0
  26. package/dist/ByteSize.js.map +1 -0
  27. package/dist/Cache.d.ts.map +1 -1
  28. package/dist/Cache.js +17 -3
  29. package/dist/Cache.js.map +1 -1
  30. package/dist/Cause.d.ts +1 -1
  31. package/dist/Cause.d.ts.map +1 -1
  32. package/dist/Channel.d.ts +97 -24
  33. package/dist/Channel.d.ts.map +1 -1
  34. package/dist/Channel.js +68 -41
  35. package/dist/Channel.js.map +1 -1
  36. package/dist/Chunk.d.ts +49 -28
  37. package/dist/Chunk.d.ts.map +1 -1
  38. package/dist/Chunk.js +27 -18
  39. package/dist/Chunk.js.map +1 -1
  40. package/dist/Config.d.ts +162 -201
  41. package/dist/Config.d.ts.map +1 -1
  42. package/dist/Config.js +103 -212
  43. package/dist/Config.js.map +1 -1
  44. package/dist/ConfigProvider.d.ts +4 -4
  45. package/dist/ConfigProvider.d.ts.map +1 -1
  46. package/dist/ConfigProvider.js +7 -7
  47. package/dist/ConfigProvider.js.map +1 -1
  48. package/dist/Context.d.ts +31 -0
  49. package/dist/Context.d.ts.map +1 -1
  50. package/dist/Context.js.map +1 -1
  51. package/dist/Cron.d.ts +2 -2
  52. package/dist/Cron.d.ts.map +1 -1
  53. package/dist/Cron.js +2 -2
  54. package/dist/Cron.js.map +1 -1
  55. package/dist/Crypto.d.ts +1 -1
  56. package/dist/Crypto.d.ts.map +1 -1
  57. package/dist/Crypto.js +3 -2
  58. package/dist/Crypto.js.map +1 -1
  59. package/dist/DateTime.d.ts +2 -2
  60. package/dist/DateTime.d.ts.map +1 -1
  61. package/dist/Deferred.d.ts.map +1 -1
  62. package/dist/Deferred.js +6 -6
  63. package/dist/Deferred.js.map +1 -1
  64. package/dist/Duration.d.ts +1 -1
  65. package/dist/Duration.d.ts.map +1 -1
  66. package/dist/Duration.js +1 -1
  67. package/dist/Duration.js.map +1 -1
  68. package/dist/Effect.d.ts +220 -113
  69. package/dist/Effect.d.ts.map +1 -1
  70. package/dist/Effect.js +27 -26
  71. package/dist/Effect.js.map +1 -1
  72. package/dist/Effectable.d.ts +58 -2
  73. package/dist/Effectable.d.ts.map +1 -1
  74. package/dist/Effectable.js +58 -6
  75. package/dist/Effectable.js.map +1 -1
  76. package/dist/Encoding.d.ts +3 -1
  77. package/dist/Encoding.d.ts.map +1 -1
  78. package/dist/Encoding.js +40 -10
  79. package/dist/Encoding.js.map +1 -1
  80. package/dist/Equal.d.ts +1 -1
  81. package/dist/Equal.d.ts.map +1 -1
  82. package/dist/Equal.js +1 -1
  83. package/dist/Equal.js.map +1 -1
  84. package/dist/ExecutionPlan.d.ts.map +1 -1
  85. package/dist/ExecutionPlan.js +1 -0
  86. package/dist/ExecutionPlan.js.map +1 -1
  87. package/dist/Fiber.d.ts +32 -8
  88. package/dist/Fiber.d.ts.map +1 -1
  89. package/dist/Fiber.js.map +1 -1
  90. package/dist/FiberHandle.js +3 -3
  91. package/dist/FiberHandle.js.map +1 -1
  92. package/dist/FiberMap.d.ts +12 -6
  93. package/dist/FiberMap.d.ts.map +1 -1
  94. package/dist/FiberMap.js +11 -6
  95. package/dist/FiberMap.js.map +1 -1
  96. package/dist/FileSystem.d.ts +42 -210
  97. package/dist/FileSystem.d.ts.map +1 -1
  98. package/dist/FileSystem.js +16 -148
  99. package/dist/FileSystem.js.map +1 -1
  100. package/dist/Formatter.d.ts +1 -0
  101. package/dist/Formatter.d.ts.map +1 -1
  102. package/dist/Formatter.js +19 -3
  103. package/dist/Formatter.js.map +1 -1
  104. package/dist/Graph.d.ts +48 -20
  105. package/dist/Graph.d.ts.map +1 -1
  106. package/dist/Graph.js +20 -5
  107. package/dist/Graph.js.map +1 -1
  108. package/dist/Hash.d.ts +1 -1
  109. package/dist/Hash.d.ts.map +1 -1
  110. package/dist/Hash.js +5 -14
  111. package/dist/Hash.js.map +1 -1
  112. package/dist/HashMap.d.ts +1 -1
  113. package/dist/HashMap.d.ts.map +1 -1
  114. package/dist/HashRing.d.ts +6 -1
  115. package/dist/HashRing.d.ts.map +1 -1
  116. package/dist/HashRing.js +9 -2
  117. package/dist/HashRing.js.map +1 -1
  118. package/dist/HashSet.d.ts +1 -1
  119. package/dist/HashSet.d.ts.map +1 -1
  120. package/dist/HashSet.js.map +1 -1
  121. package/dist/Iterable.d.ts +56 -17
  122. package/dist/Iterable.d.ts.map +1 -1
  123. package/dist/Iterable.js +65 -45
  124. package/dist/Iterable.js.map +1 -1
  125. package/dist/JsonPatch.js +4 -4
  126. package/dist/JsonPatch.js.map +1 -1
  127. package/dist/JsonPointer.d.ts +68 -4
  128. package/dist/JsonPointer.d.ts.map +1 -1
  129. package/dist/JsonPointer.js +90 -4
  130. package/dist/JsonPointer.js.map +1 -1
  131. package/dist/JsonSchema.d.ts +67 -94
  132. package/dist/JsonSchema.d.ts.map +1 -1
  133. package/dist/JsonSchema.js +752 -397
  134. package/dist/JsonSchema.js.map +1 -1
  135. package/dist/Layer.d.ts +47 -4
  136. package/dist/Layer.d.ts.map +1 -1
  137. package/dist/Layer.js +4 -6
  138. package/dist/Layer.js.map +1 -1
  139. package/dist/LayerMap.d.ts +24 -3
  140. package/dist/LayerMap.d.ts.map +1 -1
  141. package/dist/LayerMap.js +9 -5
  142. package/dist/LayerMap.js.map +1 -1
  143. package/dist/LayerRef.d.ts.map +1 -1
  144. package/dist/LayerRef.js +7 -5
  145. package/dist/LayerRef.js.map +1 -1
  146. package/dist/Logger.d.ts +114 -9
  147. package/dist/Logger.d.ts.map +1 -1
  148. package/dist/Logger.js +109 -9
  149. package/dist/Logger.js.map +1 -1
  150. package/dist/ManagedRuntime.js +1 -1
  151. package/dist/ManagedRuntime.js.map +1 -1
  152. package/dist/Match.d.ts +43 -31
  153. package/dist/Match.d.ts.map +1 -1
  154. package/dist/Match.js +5 -2
  155. package/dist/Match.js.map +1 -1
  156. package/dist/Metric.d.ts +11 -4
  157. package/dist/Metric.d.ts.map +1 -1
  158. package/dist/Metric.js +14 -18
  159. package/dist/Metric.js.map +1 -1
  160. package/dist/MutableHashMap.d.ts +1 -1
  161. package/dist/MutableHashMap.d.ts.map +1 -1
  162. package/dist/MutableHashMap.js +1 -1
  163. package/dist/MutableHashMap.js.map +1 -1
  164. package/dist/MutableHashSet.d.ts +1 -1
  165. package/dist/MutableHashSet.d.ts.map +1 -1
  166. package/dist/MutableHashSet.js +1 -1
  167. package/dist/MutableHashSet.js.map +1 -1
  168. package/dist/MutableList.d.ts +13 -2
  169. package/dist/MutableList.d.ts.map +1 -1
  170. package/dist/MutableList.js +18 -2
  171. package/dist/MutableList.js.map +1 -1
  172. package/dist/Number.d.ts +6 -0
  173. package/dist/Number.d.ts.map +1 -1
  174. package/dist/Number.js +3 -1
  175. package/dist/Number.js.map +1 -1
  176. package/dist/Optic.d.ts.map +1 -1
  177. package/dist/Optic.js +5 -4
  178. package/dist/Optic.js.map +1 -1
  179. package/dist/Option.d.ts +1 -1
  180. package/dist/Option.d.ts.map +1 -1
  181. package/dist/Option.js +1 -1
  182. package/dist/Option.js.map +1 -1
  183. package/dist/Order.d.ts +1 -0
  184. package/dist/Order.d.ts.map +1 -1
  185. package/dist/Order.js +3 -1
  186. package/dist/Order.js.map +1 -1
  187. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  188. package/dist/PartitionedSemaphore.js +1 -2
  189. package/dist/PartitionedSemaphore.js.map +1 -1
  190. package/dist/Path.d.ts +1 -1
  191. package/dist/Path.d.ts.map +1 -1
  192. package/dist/Path.js +1 -1
  193. package/dist/Path.js.map +1 -1
  194. package/dist/PlatformError.d.ts +1 -1
  195. package/dist/PlatformError.d.ts.map +1 -1
  196. package/dist/PlatformError.js +1 -1
  197. package/dist/PlatformError.js.map +1 -1
  198. package/dist/Pool.d.ts +137 -10
  199. package/dist/Pool.d.ts.map +1 -1
  200. package/dist/Pool.js +332 -75
  201. package/dist/Pool.js.map +1 -1
  202. package/dist/PrimaryKey.d.ts +1 -1
  203. package/dist/PrimaryKey.d.ts.map +1 -1
  204. package/dist/PrimaryKey.js +1 -1
  205. package/dist/PrimaryKey.js.map +1 -1
  206. package/dist/PubSub.d.ts +21 -9
  207. package/dist/PubSub.d.ts.map +1 -1
  208. package/dist/PubSub.js +18 -14
  209. package/dist/PubSub.js.map +1 -1
  210. package/dist/Queue.d.ts +82 -6
  211. package/dist/Queue.d.ts.map +1 -1
  212. package/dist/Queue.js +116 -27
  213. package/dist/Queue.js.map +1 -1
  214. package/dist/Random.d.ts +17 -4
  215. package/dist/Random.d.ts.map +1 -1
  216. package/dist/Random.js +1 -1
  217. package/dist/Random.js.map +1 -1
  218. package/dist/RcMap.d.ts +137 -0
  219. package/dist/RcMap.d.ts.map +1 -1
  220. package/dist/RcMap.js +72 -9
  221. package/dist/RcMap.js.map +1 -1
  222. package/dist/Record.d.ts +13 -0
  223. package/dist/Record.d.ts.map +1 -1
  224. package/dist/Record.js.map +1 -1
  225. package/dist/Redacted.d.ts +1 -1
  226. package/dist/Redacted.d.ts.map +1 -1
  227. package/dist/Redacted.js +1 -1
  228. package/dist/Redacted.js.map +1 -1
  229. package/dist/RequestResolver.d.ts +15 -9
  230. package/dist/RequestResolver.d.ts.map +1 -1
  231. package/dist/RequestResolver.js +33 -15
  232. package/dist/RequestResolver.js.map +1 -1
  233. package/dist/Result.d.ts +1 -1
  234. package/dist/Result.d.ts.map +1 -1
  235. package/dist/Result.js +1 -1
  236. package/dist/Result.js.map +1 -1
  237. package/dist/Scheduler.d.ts.map +1 -1
  238. package/dist/Scheduler.js +19 -10
  239. package/dist/Scheduler.js.map +1 -1
  240. package/dist/Schema.d.ts +2200 -2433
  241. package/dist/Schema.d.ts.map +1 -1
  242. package/dist/Schema.js +2797 -4184
  243. package/dist/Schema.js.map +1 -1
  244. package/dist/SchemaAST.d.ts +359 -176
  245. package/dist/SchemaAST.d.ts.map +1 -1
  246. package/dist/SchemaAST.js +373 -630
  247. package/dist/SchemaAST.js.map +1 -1
  248. package/dist/SchemaGetter.d.ts +46 -22
  249. package/dist/SchemaGetter.d.ts.map +1 -1
  250. package/dist/SchemaGetter.js +56 -53
  251. package/dist/SchemaGetter.js.map +1 -1
  252. package/dist/SchemaIssue.d.ts +123 -200
  253. package/dist/SchemaIssue.d.ts.map +1 -1
  254. package/dist/SchemaIssue.js +59 -263
  255. package/dist/SchemaIssue.js.map +1 -1
  256. package/dist/SchemaParser.js +2 -9
  257. package/dist/SchemaParser.js.map +1 -1
  258. package/dist/SchemaRepresentation.d.ts +1276 -172
  259. package/dist/SchemaRepresentation.d.ts.map +1 -1
  260. package/dist/SchemaRepresentation.js +1371 -29
  261. package/dist/SchemaRepresentation.js.map +1 -1
  262. package/dist/SchemaTransformation.d.ts +49 -16
  263. package/dist/SchemaTransformation.d.ts.map +1 -1
  264. package/dist/SchemaTransformation.js +75 -98
  265. package/dist/SchemaTransformation.js.map +1 -1
  266. package/dist/Scope.d.ts +9 -2
  267. package/dist/Scope.d.ts.map +1 -1
  268. package/dist/Scope.js.map +1 -1
  269. package/dist/ScopedCache.d.ts.map +1 -1
  270. package/dist/ScopedCache.js +10 -3
  271. package/dist/ScopedCache.js.map +1 -1
  272. package/dist/Sink.d.ts +9 -4
  273. package/dist/Sink.d.ts.map +1 -1
  274. package/dist/Sink.js +49 -31
  275. package/dist/Sink.js.map +1 -1
  276. package/dist/StandardSchema.d.ts +125 -0
  277. package/dist/StandardSchema.d.ts.map +1 -0
  278. package/dist/StandardSchema.js +9 -0
  279. package/dist/StandardSchema.js.map +1 -0
  280. package/dist/Stream.d.ts +221 -35
  281. package/dist/Stream.d.ts.map +1 -1
  282. package/dist/Stream.js +168 -84
  283. package/dist/Stream.js.map +1 -1
  284. package/dist/String.d.ts +16 -6
  285. package/dist/String.d.ts.map +1 -1
  286. package/dist/String.js +12 -5
  287. package/dist/String.js.map +1 -1
  288. package/dist/Struct.d.ts.map +1 -1
  289. package/dist/Struct.js +7 -4
  290. package/dist/Struct.js.map +1 -1
  291. package/dist/SynchronizedRef.d.ts +3 -2
  292. package/dist/SynchronizedRef.d.ts.map +1 -1
  293. package/dist/SynchronizedRef.js.map +1 -1
  294. package/dist/Terminal.d.ts +3 -3
  295. package/dist/Terminal.d.ts.map +1 -1
  296. package/dist/Terminal.js +3 -3
  297. package/dist/Terminal.js.map +1 -1
  298. package/dist/Tracer.d.ts +27 -7
  299. package/dist/Tracer.d.ts.map +1 -1
  300. package/dist/Tracer.js +38 -13
  301. package/dist/Tracer.js.map +1 -1
  302. package/dist/Trie.d.ts +1 -1
  303. package/dist/Trie.d.ts.map +1 -1
  304. package/dist/Tuple.d.ts +2 -1
  305. package/dist/Tuple.d.ts.map +1 -1
  306. package/dist/Tuple.js.map +1 -1
  307. package/dist/TxChunk.d.ts +1 -1
  308. package/dist/TxChunk.d.ts.map +1 -1
  309. package/dist/TxChunk.js +1 -1
  310. package/dist/TxChunk.js.map +1 -1
  311. package/dist/TxDeferred.d.ts +1 -1
  312. package/dist/TxDeferred.d.ts.map +1 -1
  313. package/dist/TxDeferred.js +1 -1
  314. package/dist/TxDeferred.js.map +1 -1
  315. package/dist/TxHashMap.d.ts +1 -1
  316. package/dist/TxHashMap.d.ts.map +1 -1
  317. package/dist/TxHashMap.js +1 -1
  318. package/dist/TxHashMap.js.map +1 -1
  319. package/dist/TxHashSet.d.ts +1 -1
  320. package/dist/TxHashSet.d.ts.map +1 -1
  321. package/dist/TxHashSet.js +1 -1
  322. package/dist/TxHashSet.js.map +1 -1
  323. package/dist/TxPriorityQueue.d.ts +1 -1
  324. package/dist/TxPriorityQueue.d.ts.map +1 -1
  325. package/dist/TxPriorityQueue.js +1 -1
  326. package/dist/TxPriorityQueue.js.map +1 -1
  327. package/dist/TxPubSub.d.ts +1 -1
  328. package/dist/TxPubSub.d.ts.map +1 -1
  329. package/dist/TxPubSub.js +1 -1
  330. package/dist/TxPubSub.js.map +1 -1
  331. package/dist/TxQueue.d.ts +9 -9
  332. package/dist/TxQueue.d.ts.map +1 -1
  333. package/dist/TxQueue.js +93 -86
  334. package/dist/TxQueue.js.map +1 -1
  335. package/dist/TxReentrantLock.d.ts +29 -1
  336. package/dist/TxReentrantLock.d.ts.map +1 -1
  337. package/dist/TxReentrantLock.js +29 -1
  338. package/dist/TxReentrantLock.js.map +1 -1
  339. package/dist/TxRef.d.ts +1 -1
  340. package/dist/TxRef.d.ts.map +1 -1
  341. package/dist/TxRef.js +1 -1
  342. package/dist/TxRef.js.map +1 -1
  343. package/dist/TxSemaphore.d.ts +1 -1
  344. package/dist/TxSemaphore.d.ts.map +1 -1
  345. package/dist/TxSemaphore.js +1 -1
  346. package/dist/TxSemaphore.js.map +1 -1
  347. package/dist/TxSubscriptionRef.d.ts +1 -1
  348. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  349. package/dist/TxSubscriptionRef.js +1 -1
  350. package/dist/TxSubscriptionRef.js.map +1 -1
  351. package/dist/Types.d.ts +33 -19
  352. package/dist/Types.d.ts.map +1 -1
  353. package/dist/Utils.d.ts.map +1 -1
  354. package/dist/Utils.js +2 -1
  355. package/dist/Utils.js.map +1 -1
  356. package/dist/index.d.ts +8 -0
  357. package/dist/index.d.ts.map +1 -1
  358. package/dist/index.js +8 -0
  359. package/dist/index.js.map +1 -1
  360. package/dist/internal/arbitrary/model.d.ts +2 -0
  361. package/dist/internal/arbitrary/model.d.ts.map +1 -0
  362. package/dist/internal/arbitrary/model.js +495 -0
  363. package/dist/internal/arbitrary/model.js.map +1 -0
  364. package/dist/internal/arbitrary/regexp.d.ts +2 -0
  365. package/dist/internal/arbitrary/regexp.d.ts.map +1 -0
  366. package/dist/internal/arbitrary/regexp.js +789 -0
  367. package/dist/internal/arbitrary/regexp.js.map +1 -0
  368. package/dist/internal/arbitrary/runner.d.ts +2 -0
  369. package/dist/internal/arbitrary/runner.d.ts.map +1 -0
  370. package/dist/internal/arbitrary/runner.js +496 -0
  371. package/dist/internal/arbitrary/runner.js.map +1 -0
  372. package/dist/internal/arbitrary/schema.d.ts.map +1 -0
  373. package/dist/internal/arbitrary/schema.js +1340 -0
  374. package/dist/internal/arbitrary/schema.js.map +1 -0
  375. package/dist/internal/core.js +27 -13
  376. package/dist/internal/core.js.map +1 -1
  377. package/dist/internal/count.d.ts +2 -0
  378. package/dist/internal/count.d.ts.map +1 -0
  379. package/dist/internal/count.js +14 -0
  380. package/dist/internal/count.js.map +1 -0
  381. package/dist/internal/dateTime.js +4 -10
  382. package/dist/internal/dateTime.js.map +1 -1
  383. package/dist/internal/effect.js +416 -258
  384. package/dist/internal/effect.js.map +1 -1
  385. package/dist/internal/graph.js +3 -1
  386. package/dist/internal/graph.js.map +1 -1
  387. package/dist/internal/hashMap.js +5 -3
  388. package/dist/internal/hashMap.js.map +1 -1
  389. package/dist/internal/hashSet.js +1 -1
  390. package/dist/internal/hashSet.js.map +1 -1
  391. package/dist/internal/matcher.js +1 -1
  392. package/dist/internal/matcher.js.map +1 -1
  393. package/dist/internal/metric.js +1 -1
  394. package/dist/internal/metric.js.map +1 -1
  395. package/dist/internal/option.js +6 -5
  396. package/dist/internal/option.js.map +1 -1
  397. package/dist/internal/random.js +17 -0
  398. package/dist/internal/random.js.map +1 -1
  399. package/dist/internal/rcRef.js +10 -7
  400. package/dist/internal/rcRef.js.map +1 -1
  401. package/dist/internal/references.js +1 -0
  402. package/dist/internal/references.js.map +1 -1
  403. package/dist/internal/request.js +13 -6
  404. package/dist/internal/request.js.map +1 -1
  405. package/dist/internal/result.js +11 -9
  406. package/dist/internal/result.js.map +1 -1
  407. package/dist/internal/schema/annotations.js +1 -1
  408. package/dist/internal/schema/annotations.js.map +1 -1
  409. package/dist/internal/schema/fromJsonSchemaDocument.js +238 -132
  410. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
  411. package/dist/internal/schema/fromRepresentation.js +5 -5
  412. package/dist/internal/schema/fromRepresentation.js.map +1 -1
  413. package/dist/internal/schema/make.d.ts +2 -0
  414. package/dist/internal/schema/make.d.ts.map +1 -0
  415. package/dist/internal/schema/{schema.js → make.js} +1 -25
  416. package/dist/internal/schema/make.js.map +1 -0
  417. package/dist/internal/schema/parser.d.ts +0 -12
  418. package/dist/internal/schema/parser.d.ts.map +1 -1
  419. package/dist/internal/schema/parser.js +7 -0
  420. package/dist/internal/schema/parser.js.map +1 -1
  421. package/dist/internal/schema/standardSchema.d.ts +2 -0
  422. package/dist/internal/schema/standardSchema.d.ts.map +1 -0
  423. package/dist/internal/schema/standardSchema.js +112 -0
  424. package/dist/internal/schema/standardSchema.js.map +1 -0
  425. package/dist/internal/schema/toCodeDocument.js +34 -22
  426. package/dist/internal/schema/toCodeDocument.js.map +1 -1
  427. package/dist/internal/schema/toCodec.d.ts +2 -0
  428. package/dist/internal/schema/toCodec.d.ts.map +1 -0
  429. package/dist/internal/schema/toCodec.js +242 -0
  430. package/dist/internal/schema/toCodec.js.map +1 -0
  431. package/dist/internal/schema/toDifferJsonPatch.d.ts +2 -0
  432. package/dist/internal/schema/toDifferJsonPatch.d.ts.map +1 -0
  433. package/dist/internal/schema/toDifferJsonPatch.js +20 -0
  434. package/dist/internal/schema/toDifferJsonPatch.js.map +1 -0
  435. package/dist/internal/schema/toEncoderXml.d.ts +2 -0
  436. package/dist/internal/schema/toEncoderXml.d.ts.map +1 -0
  437. package/dist/internal/schema/toEncoderXml.js +104 -0
  438. package/dist/internal/schema/toEncoderXml.js.map +1 -0
  439. package/dist/internal/schema/toEquivalence.js +66 -0
  440. package/dist/internal/schema/toEquivalence.js.map +1 -1
  441. package/dist/internal/schema/toFormatter.d.ts +2 -0
  442. package/dist/internal/schema/toFormatter.d.ts.map +1 -0
  443. package/dist/internal/schema/toFormatter.js +227 -0
  444. package/dist/internal/schema/toFormatter.js.map +1 -0
  445. package/dist/internal/schema/toIso.d.ts +2 -0
  446. package/dist/internal/schema/toIso.d.ts.map +1 -0
  447. package/dist/internal/schema/toIso.js +17 -0
  448. package/dist/internal/schema/toIso.js.map +1 -0
  449. package/dist/internal/schema/toJsonSchemaDocument.js +122 -71
  450. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  451. package/dist/internal/schema/toRepresentation.js +3 -1
  452. package/dist/internal/schema/toRepresentation.js.map +1 -1
  453. package/dist/internal/schemaError.d.ts +4 -0
  454. package/dist/internal/schemaError.d.ts.map +1 -0
  455. package/dist/internal/schemaError.js +6 -0
  456. package/dist/internal/schemaError.js.map +1 -0
  457. package/dist/internal/stream.js +5 -6
  458. package/dist/internal/stream.js.map +1 -1
  459. package/dist/internal/tracer.d.ts +1 -3
  460. package/dist/internal/tracer.d.ts.map +1 -1
  461. package/dist/internal/tracer.js +6 -0
  462. package/dist/internal/tracer.js.map +1 -1
  463. package/dist/internal/trie.js +2 -2
  464. package/dist/internal/trie.js.map +1 -1
  465. package/dist/internal/uuid.d.ts +1 -2
  466. package/dist/internal/uuid.d.ts.map +1 -1
  467. package/dist/internal/uuid.js +2 -0
  468. package/dist/internal/uuid.js.map +1 -1
  469. package/dist/testing/TestSchema.d.ts +9 -11
  470. package/dist/testing/TestSchema.d.ts.map +1 -1
  471. package/dist/testing/TestSchema.js +20 -18
  472. package/dist/testing/TestSchema.js.map +1 -1
  473. package/dist/testing/index.d.ts +0 -4
  474. package/dist/testing/index.d.ts.map +1 -1
  475. package/dist/testing/index.js +0 -4
  476. package/dist/testing/index.js.map +1 -1
  477. package/dist/unstable/ai/AiError.d.ts +98 -23
  478. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  479. package/dist/unstable/ai/AiError.js +98 -6
  480. package/dist/unstable/ai/AiError.js.map +1 -1
  481. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
  482. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  483. package/dist/unstable/ai/AnthropicStructuredOutput.js +5 -16
  484. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  485. package/dist/unstable/ai/Chat.d.ts +27 -32
  486. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  487. package/dist/unstable/ai/Chat.js +10 -13
  488. package/dist/unstable/ai/Chat.js.map +1 -1
  489. package/dist/unstable/ai/EmbeddingModel.d.ts +23 -16
  490. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
  491. package/dist/unstable/ai/EmbeddingModel.js +13 -11
  492. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  493. package/dist/unstable/ai/LanguageModel.d.ts +48 -37
  494. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  495. package/dist/unstable/ai/LanguageModel.js +150 -47
  496. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  497. package/dist/unstable/ai/McpServer.d.ts +2 -2
  498. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  499. package/dist/unstable/ai/McpServer.js +87 -78
  500. package/dist/unstable/ai/McpServer.js.map +1 -1
  501. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
  502. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  503. package/dist/unstable/ai/OpenAiStructuredOutput.js +3 -14
  504. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  505. package/dist/unstable/ai/Prompt.d.ts +2 -2
  506. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  507. package/dist/unstable/ai/Prompt.js +15 -4
  508. package/dist/unstable/ai/Prompt.js.map +1 -1
  509. package/dist/unstable/ai/Response.d.ts +37 -94
  510. package/dist/unstable/ai/Response.d.ts.map +1 -1
  511. package/dist/unstable/ai/Response.js +46 -96
  512. package/dist/unstable/ai/Response.js.map +1 -1
  513. package/dist/unstable/ai/Tokenizer.js +4 -5
  514. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  515. package/dist/unstable/ai/Tool.d.ts +38 -20
  516. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  517. package/dist/unstable/ai/Tool.js +27 -1
  518. package/dist/unstable/ai/Tool.js.map +1 -1
  519. package/dist/unstable/ai/Toolkit.d.ts +1 -1
  520. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  521. package/dist/unstable/ai/Toolkit.js +30 -18
  522. package/dist/unstable/ai/Toolkit.js.map +1 -1
  523. package/dist/unstable/ai/internal/codec-transformer.js +2 -2
  524. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  525. package/dist/unstable/ai/internal/structured-output.js +28 -5
  526. package/dist/unstable/ai/internal/structured-output.js.map +1 -1
  527. package/dist/unstable/arbitrary/Arbitrary.d.ts +626 -0
  528. package/dist/unstable/arbitrary/Arbitrary.d.ts.map +1 -0
  529. package/dist/unstable/arbitrary/Arbitrary.js +238 -0
  530. package/dist/unstable/arbitrary/Arbitrary.js.map +1 -0
  531. package/dist/unstable/arbitrary/index.d.ts +8 -0
  532. package/dist/unstable/arbitrary/index.d.ts.map +1 -0
  533. package/dist/unstable/arbitrary/index.js +9 -0
  534. package/dist/unstable/arbitrary/index.js.map +1 -0
  535. package/dist/unstable/cli/Argument.d.ts +104 -108
  536. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  537. package/dist/unstable/cli/Argument.js +56 -57
  538. package/dist/unstable/cli/Argument.js.map +1 -1
  539. package/dist/unstable/cli/CliError.d.ts +2 -0
  540. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  541. package/dist/unstable/cli/CliError.js +2 -0
  542. package/dist/unstable/cli/CliError.js.map +1 -1
  543. package/dist/unstable/cli/CliOutput.js +27 -4
  544. package/dist/unstable/cli/CliOutput.js.map +1 -1
  545. package/dist/unstable/cli/Command.d.ts +73 -73
  546. package/dist/unstable/cli/Command.d.ts.map +1 -1
  547. package/dist/unstable/cli/Command.js +22 -22
  548. package/dist/unstable/cli/Command.js.map +1 -1
  549. package/dist/unstable/cli/Completions.d.ts +4 -4
  550. package/dist/unstable/cli/Completions.d.ts.map +1 -1
  551. package/dist/unstable/cli/Flag.d.ts +150 -161
  552. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  553. package/dist/unstable/cli/Flag.js +79 -90
  554. package/dist/unstable/cli/Flag.js.map +1 -1
  555. package/dist/unstable/cli/GlobalFlag.d.ts +3 -3
  556. package/dist/unstable/cli/GlobalFlag.js +13 -13
  557. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  558. package/dist/unstable/cli/Param.d.ts +118 -126
  559. package/dist/unstable/cli/Param.d.ts.map +1 -1
  560. package/dist/unstable/cli/Param.js +104 -113
  561. package/dist/unstable/cli/Param.js.map +1 -1
  562. package/dist/unstable/cli/Primitive.d.ts +69 -58
  563. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  564. package/dist/unstable/cli/Primitive.js +65 -66
  565. package/dist/unstable/cli/Primitive.js.map +1 -1
  566. package/dist/unstable/cli/Prompt.d.ts +113 -59
  567. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  568. package/dist/unstable/cli/Prompt.js +391 -327
  569. package/dist/unstable/cli/Prompt.js.map +1 -1
  570. package/dist/unstable/cli/internal/completions/bash.js +109 -38
  571. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  572. package/dist/unstable/cli/internal/completions/descriptor.js +23 -11
  573. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  574. package/dist/unstable/cli/internal/completions/fish.js +15 -7
  575. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  576. package/dist/unstable/cli/internal/completions/zsh.js +6 -4
  577. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  578. package/dist/unstable/cli/internal/config.js +4 -4
  579. package/dist/unstable/cli/internal/parser.js +1 -1
  580. package/dist/unstable/cli/internal/parser.js.map +1 -1
  581. package/dist/unstable/cli/internal/wizard.d.ts +5 -1
  582. package/dist/unstable/cli/internal/wizard.d.ts.map +1 -1
  583. package/dist/unstable/cli/internal/wizard.js +34 -26
  584. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  585. package/dist/unstable/cluster/ClusterSchema.d.ts +13 -0
  586. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  587. package/dist/unstable/cluster/ClusterSchema.js +16 -1
  588. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  589. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  590. package/dist/unstable/cluster/ClusterWorkflowEngine.js +57 -14
  591. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  592. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  593. package/dist/unstable/cluster/Entity.js +2 -0
  594. package/dist/unstable/cluster/Entity.js.map +1 -1
  595. package/dist/unstable/cluster/EntityProxyServer.d.ts +2 -2
  596. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  597. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  598. package/dist/unstable/cluster/Envelope.d.ts +22 -5
  599. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  600. package/dist/unstable/cluster/Envelope.js +23 -3
  601. package/dist/unstable/cluster/Envelope.js.map +1 -1
  602. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  603. package/dist/unstable/cluster/HttpRunner.js +32 -13
  604. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  605. package/dist/unstable/cluster/Message.d.ts +17 -5
  606. package/dist/unstable/cluster/Message.d.ts.map +1 -1
  607. package/dist/unstable/cluster/Message.js +21 -8
  608. package/dist/unstable/cluster/Message.js.map +1 -1
  609. package/dist/unstable/cluster/MessageStorage.d.ts +34 -4
  610. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  611. package/dist/unstable/cluster/MessageStorage.js +33 -12
  612. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  613. package/dist/unstable/cluster/Reply.d.ts +5 -4
  614. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  615. package/dist/unstable/cluster/Reply.js +21 -12
  616. package/dist/unstable/cluster/Reply.js.map +1 -1
  617. package/dist/unstable/cluster/RunnerServer.d.ts +1 -1
  618. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  619. package/dist/unstable/cluster/RunnerServer.js +12 -6
  620. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  621. package/dist/unstable/cluster/Runners.d.ts +11 -5
  622. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  623. package/dist/unstable/cluster/Runners.js +56 -35
  624. package/dist/unstable/cluster/Runners.js.map +1 -1
  625. package/dist/unstable/cluster/Sharding.d.ts +1 -1
  626. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  627. package/dist/unstable/cluster/Sharding.js +32 -17
  628. package/dist/unstable/cluster/Sharding.js.map +1 -1
  629. package/dist/unstable/cluster/ShardingConfig.js +23 -23
  630. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  631. package/dist/unstable/cluster/SocketRunner.d.ts +2 -2
  632. package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
  633. package/dist/unstable/cluster/SocketRunner.js +4 -3
  634. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  635. package/dist/unstable/cluster/SqlMessageStorage.js +11 -8
  636. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  637. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  638. package/dist/unstable/cluster/SqlRunnerStorage.js +11 -4
  639. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  640. package/dist/unstable/cluster/internal/clusterAbandon.d.ts +5 -0
  641. package/dist/unstable/cluster/internal/clusterAbandon.d.ts.map +1 -0
  642. package/dist/unstable/cluster/internal/clusterAbandon.js +9 -0
  643. package/dist/unstable/cluster/internal/clusterAbandon.js.map +1 -0
  644. package/dist/unstable/cluster/internal/entityManager.js +10 -6
  645. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  646. package/dist/unstable/cluster/internal/interruptors.js +30 -1
  647. package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
  648. package/dist/unstable/cluster/internal/resourceRef.js +12 -7
  649. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  650. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  651. package/dist/unstable/devtools/DevToolsClient.js +12 -7
  652. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  653. package/dist/unstable/encoding/Ini.d.ts +2 -0
  654. package/dist/unstable/encoding/Ini.d.ts.map +1 -1
  655. package/dist/unstable/encoding/Ini.js +2 -0
  656. package/dist/unstable/encoding/Ini.js.map +1 -1
  657. package/dist/unstable/encoding/SchemaBinary.d.ts +273 -0
  658. package/dist/unstable/encoding/SchemaBinary.d.ts.map +1 -0
  659. package/dist/unstable/encoding/SchemaBinary.js +4573 -0
  660. package/dist/unstable/encoding/SchemaBinary.js.map +1 -0
  661. package/dist/unstable/encoding/Sse.js +1 -1
  662. package/dist/unstable/encoding/Sse.js.map +1 -1
  663. package/dist/unstable/encoding/Toml.d.ts +2 -0
  664. package/dist/unstable/encoding/Toml.d.ts.map +1 -1
  665. package/dist/unstable/encoding/Toml.js +6 -4
  666. package/dist/unstable/encoding/Toml.js.map +1 -1
  667. package/dist/unstable/encoding/Yaml.d.ts +2 -0
  668. package/dist/unstable/encoding/Yaml.d.ts.map +1 -1
  669. package/dist/unstable/encoding/Yaml.js +16 -5
  670. package/dist/unstable/encoding/Yaml.js.map +1 -1
  671. package/dist/unstable/encoding/index.d.ts +2 -2
  672. package/dist/unstable/encoding/index.d.ts.map +1 -1
  673. package/dist/unstable/encoding/index.js +2 -2
  674. package/dist/unstable/encoding/index.js.map +1 -1
  675. package/dist/unstable/eventlog/Event.d.ts +5 -5
  676. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  677. package/dist/unstable/eventlog/Event.js +3 -3
  678. package/dist/unstable/eventlog/Event.js.map +1 -1
  679. package/dist/unstable/eventlog/EventJournal.d.ts +15 -9
  680. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  681. package/dist/unstable/eventlog/EventJournal.js +26 -12
  682. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  683. package/dist/unstable/eventlog/EventLog.d.ts +1 -1
  684. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  685. package/dist/unstable/eventlog/EventLog.js +13 -9
  686. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  687. package/dist/unstable/eventlog/EventLogMessage.d.ts +11 -5
  688. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  689. package/dist/unstable/eventlog/EventLogMessage.js +25 -15
  690. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  691. package/dist/unstable/eventlog/EventLogRemote.d.ts +7 -1
  692. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  693. package/dist/unstable/eventlog/EventLogRemote.js +13 -3
  694. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  695. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +2 -2
  696. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  697. package/dist/unstable/eventlog/SqlEventJournal.d.ts +0 -10
  698. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  699. package/dist/unstable/eventlog/SqlEventJournal.js +29 -14
  700. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  701. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  702. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +5 -1
  703. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  704. package/dist/unstable/http/Cookies.d.ts +1 -45
  705. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  706. package/dist/unstable/http/Cookies.js +2 -64
  707. package/dist/unstable/http/Cookies.js.map +1 -1
  708. package/dist/unstable/http/FetchHttpClient.js +1 -1
  709. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  710. package/dist/unstable/http/FindMyWay/internal/router.js +124 -33
  711. package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -1
  712. package/dist/unstable/http/FindMyWay.d.ts +15 -5
  713. package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
  714. package/dist/unstable/http/FindMyWay.js +3 -1
  715. package/dist/unstable/http/FindMyWay.js.map +1 -1
  716. package/dist/unstable/http/Headers.d.ts +0 -22
  717. package/dist/unstable/http/Headers.d.ts.map +1 -1
  718. package/dist/unstable/http/Headers.js +3 -34
  719. package/dist/unstable/http/Headers.js.map +1 -1
  720. package/dist/unstable/http/HttpBody.d.ts +41 -10
  721. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  722. package/dist/unstable/http/HttpBody.js +64 -10
  723. package/dist/unstable/http/HttpBody.js.map +1 -1
  724. package/dist/unstable/http/HttpClient.d.ts +1 -1
  725. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  726. package/dist/unstable/http/HttpClient.js +28 -18
  727. package/dist/unstable/http/HttpClient.js.map +1 -1
  728. package/dist/unstable/http/HttpClientRequest.d.ts +28 -6
  729. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  730. package/dist/unstable/http/HttpClientRequest.js +8 -19
  731. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  732. package/dist/unstable/http/HttpClientResponse.d.ts +6 -1
  733. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  734. package/dist/unstable/http/HttpClientResponse.js +10 -6
  735. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  736. package/dist/unstable/http/HttpEffect.d.ts +16 -0
  737. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  738. package/dist/unstable/http/HttpEffect.js +121 -65
  739. package/dist/unstable/http/HttpEffect.js.map +1 -1
  740. package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -3
  741. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  742. package/dist/unstable/http/HttpIncomingMessage.js +1 -13
  743. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  744. package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
  745. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  746. package/dist/unstable/http/HttpMiddleware.js +29 -21
  747. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  748. package/dist/unstable/http/HttpPlatform.d.ts +12 -11
  749. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  750. package/dist/unstable/http/HttpPlatform.js +36 -10
  751. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  752. package/dist/unstable/http/HttpRouter.d.ts +5 -1
  753. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  754. package/dist/unstable/http/HttpRouter.js +22 -8
  755. package/dist/unstable/http/HttpRouter.js.map +1 -1
  756. package/dist/unstable/http/HttpServer.d.ts +11 -42
  757. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  758. package/dist/unstable/http/HttpServer.js +16 -20
  759. package/dist/unstable/http/HttpServer.js.map +1 -1
  760. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  761. package/dist/unstable/http/HttpServerRequest.js +11 -11
  762. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  763. package/dist/unstable/http/HttpServerRespondable.js +1 -1
  764. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  765. package/dist/unstable/http/HttpServerResponse.d.ts +9 -13
  766. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  767. package/dist/unstable/http/HttpServerResponse.js +34 -44
  768. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  769. package/dist/unstable/http/HttpStaticServer.d.ts +2 -2
  770. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  771. package/dist/unstable/http/HttpStaticServer.js +19 -19
  772. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  773. package/dist/unstable/http/Mime.d.ts +28 -0
  774. package/dist/unstable/http/Mime.d.ts.map +1 -0
  775. package/dist/unstable/http/Mime.js +72 -0
  776. package/dist/unstable/http/Mime.js.map +1 -0
  777. package/dist/unstable/http/Multipart.d.ts +22 -9
  778. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  779. package/dist/unstable/http/Multipart.js +26 -10
  780. package/dist/unstable/http/Multipart.js.map +1 -1
  781. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +1 -1
  782. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -1
  783. package/dist/unstable/http/MultipartParser/internal/multipart.js +8 -3
  784. package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -1
  785. package/dist/unstable/http/MultipartParser.d.ts +4 -3
  786. package/dist/unstable/http/MultipartParser.d.ts.map +1 -1
  787. package/dist/unstable/http/MultipartParser.js.map +1 -1
  788. package/dist/unstable/http/UrlParams.d.ts +0 -97
  789. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  790. package/dist/unstable/http/UrlParams.js +3 -104
  791. package/dist/unstable/http/UrlParams.js.map +1 -1
  792. package/dist/unstable/http/index.d.ts +4 -0
  793. package/dist/unstable/http/index.d.ts.map +1 -1
  794. package/dist/unstable/http/index.js +4 -0
  795. package/dist/unstable/http/index.js.map +1 -1
  796. package/dist/unstable/http/internal/compression.js +8 -11
  797. package/dist/unstable/http/internal/compression.js.map +1 -1
  798. package/dist/unstable/http/internal/headers.d.ts +2 -0
  799. package/dist/unstable/http/internal/headers.d.ts.map +1 -0
  800. package/dist/unstable/http/internal/headers.js +5 -0
  801. package/dist/unstable/http/internal/headers.js.map +1 -0
  802. package/dist/unstable/http/internal/httpBody.js +8 -0
  803. package/dist/unstable/http/internal/httpBody.js.map +1 -1
  804. package/dist/unstable/http/internal/mimeTypes.d.ts +361 -0
  805. package/dist/unstable/http/internal/mimeTypes.d.ts.map +1 -0
  806. package/dist/unstable/http/internal/mimeTypes.js +363 -0
  807. package/dist/unstable/http/internal/mimeTypes.js.map +1 -0
  808. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +13 -0
  809. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  810. package/dist/unstable/httpapi/HttpApiBuilder.js +28 -11
  811. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  812. package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -3
  813. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  814. package/dist/unstable/httpapi/HttpApiClient.js +25 -13
  815. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  816. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +8 -3
  817. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  818. package/dist/unstable/httpapi/HttpApiEndpoint.js +9 -6
  819. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  820. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  821. package/dist/unstable/httpapi/HttpApiError.js +3 -1
  822. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  823. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  824. package/dist/unstable/httpapi/HttpApiMiddleware.js +7 -5
  825. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  826. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  827. package/dist/unstable/httpapi/HttpApiScalar.js +15 -12
  828. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  829. package/dist/unstable/httpapi/HttpApiSchema.d.ts +12 -0
  830. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  831. package/dist/unstable/httpapi/HttpApiSchema.js +8 -10
  832. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  833. package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
  834. package/dist/unstable/httpapi/HttpApiSwagger.js +6 -3
  835. package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
  836. package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
  837. package/dist/unstable/httpapi/HttpApiTest.js +8 -2
  838. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  839. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  840. package/dist/unstable/httpapi/OpenApi.js +31 -20
  841. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  842. package/dist/unstable/net/IpInterface.d.ts +140 -0
  843. package/dist/unstable/net/IpInterface.d.ts.map +1 -0
  844. package/dist/unstable/net/IpInterface.js +149 -0
  845. package/dist/unstable/net/IpInterface.js.map +1 -0
  846. package/dist/unstable/net/IpNetwork.d.ts +227 -0
  847. package/dist/unstable/net/IpNetwork.d.ts.map +1 -0
  848. package/dist/unstable/net/IpNetwork.js +239 -0
  849. package/dist/unstable/net/IpNetwork.js.map +1 -0
  850. package/dist/unstable/net/NetAddress.d.ts +705 -0
  851. package/dist/unstable/net/NetAddress.d.ts.map +1 -0
  852. package/dist/unstable/net/NetAddress.js +956 -0
  853. package/dist/unstable/net/NetAddress.js.map +1 -0
  854. package/dist/unstable/net/index.d.ts +16 -0
  855. package/dist/unstable/net/index.d.ts.map +1 -0
  856. package/dist/unstable/net/index.js +17 -0
  857. package/dist/unstable/net/index.js.map +1 -0
  858. package/dist/unstable/observability/OtlpExporter.d.ts +1 -0
  859. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  860. package/dist/unstable/observability/OtlpExporter.js +4 -6
  861. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  862. package/dist/unstable/observability/OtlpLogger.js +9 -9
  863. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  864. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  865. package/dist/unstable/observability/OtlpMetrics.js +9 -8
  866. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  867. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  868. package/dist/unstable/observability/OtlpResource.js +2 -2
  869. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  870. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  871. package/dist/unstable/observability/OtlpTracer.js +82 -55
  872. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  873. package/dist/unstable/observability/internal/otlpEnv.d.ts +1 -1
  874. package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
  875. package/dist/unstable/observability/internal/otlpEnv.js +5 -9
  876. package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
  877. package/dist/unstable/persistence/PersistedCache.js +1 -1
  878. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  879. package/dist/unstable/persistence/PersistedQueue.d.ts +114 -14
  880. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  881. package/dist/unstable/persistence/PersistedQueue.js +799 -234
  882. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  883. package/dist/unstable/persistence/RateLimiter.d.ts +28 -15
  884. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  885. package/dist/unstable/persistence/RateLimiter.js +33 -41
  886. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  887. package/dist/unstable/process/ChildProcess.d.ts +8 -2
  888. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  889. package/dist/unstable/process/ChildProcess.js +7 -2
  890. package/dist/unstable/process/ChildProcess.js.map +1 -1
  891. package/dist/unstable/process/ChildProcessSpawner.d.ts +1 -1
  892. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  893. package/dist/unstable/process/ChildProcessSpawner.js +1 -1
  894. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  895. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  896. package/dist/unstable/reactivity/Atom.js +6 -3
  897. package/dist/unstable/reactivity/Atom.js.map +1 -1
  898. package/dist/unstable/reactivity/AtomHttpApi.d.ts +3 -6
  899. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  900. package/dist/unstable/reactivity/AtomHttpApi.js +6 -3
  901. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  902. package/dist/unstable/reactivity/AtomRegistry.js +2 -3
  903. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  904. package/dist/unstable/reactivity/AtomRpc.d.ts +2 -2
  905. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  906. package/dist/unstable/reactivity/AtomRpc.js +1 -1
  907. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  908. package/dist/unstable/reactivity/Hydration.d.ts +6 -4
  909. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  910. package/dist/unstable/reactivity/Hydration.js +20 -6
  911. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  912. package/dist/unstable/reactivity/Reactivity.d.ts +26 -26
  913. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  914. package/dist/unstable/reactivity/Reactivity.js +10 -12
  915. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  916. package/dist/unstable/rpc/RpcClient.d.ts +5 -0
  917. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  918. package/dist/unstable/rpc/RpcClient.js +94 -81
  919. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  920. package/dist/unstable/rpc/RpcClientError.d.ts +1 -1
  921. package/dist/unstable/rpc/RpcMessage.d.ts +66 -7
  922. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  923. package/dist/unstable/rpc/RpcMessage.js +68 -9
  924. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  925. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  926. package/dist/unstable/rpc/RpcMiddleware.js +7 -5
  927. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  928. package/dist/unstable/rpc/RpcSerialization.d.ts +28 -33
  929. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  930. package/dist/unstable/rpc/RpcSerialization.js +56 -92
  931. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  932. package/dist/unstable/rpc/RpcServer.d.ts +25 -0
  933. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  934. package/dist/unstable/rpc/RpcServer.js +125 -68
  935. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  936. package/dist/unstable/schema/Model.d.ts.map +1 -1
  937. package/dist/unstable/schema/Model.js +7 -6
  938. package/dist/unstable/schema/Model.js.map +1 -1
  939. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  940. package/dist/unstable/schema/VariantSchema.js +3 -0
  941. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  942. package/dist/unstable/socket/Socket.d.ts +287 -102
  943. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  944. package/dist/unstable/socket/Socket.js +408 -215
  945. package/dist/unstable/socket/Socket.js.map +1 -1
  946. package/dist/unstable/socket/SocketServer.d.ts +5 -32
  947. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  948. package/dist/unstable/socket/SocketServer.js +3 -3
  949. package/dist/unstable/socket/SocketServer.js.map +1 -1
  950. package/dist/unstable/sql/SqlClient.d.ts +20 -0
  951. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  952. package/dist/unstable/sql/SqlClient.js +14 -7
  953. package/dist/unstable/sql/SqlClient.js.map +1 -1
  954. package/dist/unstable/sql/SqlConnection.d.ts +15 -0
  955. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  956. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  957. package/dist/unstable/sql/SqlModel.d.ts +1 -1
  958. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  959. package/dist/unstable/sql/Statement.d.ts +13 -5
  960. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  961. package/dist/unstable/sql/Statement.js +29 -15
  962. package/dist/unstable/sql/Statement.js.map +1 -1
  963. package/dist/unstable/workers/Transferable.js +1 -1
  964. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  965. package/dist/unstable/workers/Worker.js +3 -1
  966. package/dist/unstable/workers/Worker.js.map +1 -1
  967. package/dist/unstable/workflow/Activity.d.ts +7 -0
  968. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  969. package/dist/unstable/workflow/Activity.js +14 -4
  970. package/dist/unstable/workflow/Activity.js.map +1 -1
  971. package/dist/unstable/workflow/DurableClock.js +1 -1
  972. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  973. package/dist/unstable/workflow/DurableDeferred.d.ts +2 -2
  974. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  975. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  976. package/dist/unstable/workflow/DurableQueue.d.ts +8 -0
  977. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  978. package/dist/unstable/workflow/DurableQueue.js +8 -0
  979. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  980. package/dist/unstable/workflow/Workflow.d.ts +5 -0
  981. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  982. package/dist/unstable/workflow/Workflow.js +70 -12
  983. package/dist/unstable/workflow/Workflow.js.map +1 -1
  984. package/dist/unstable/workflow/WorkflowEngine.d.ts +6 -0
  985. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  986. package/dist/unstable/workflow/WorkflowEngine.js +11 -0
  987. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  988. package/dist/unstable/workflow/WorkflowProxy.d.ts +2 -2
  989. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  990. package/dist/unstable/workflow/WorkflowProxy.js +4 -2
  991. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  992. package/package.json +8 -10
  993. package/src/Array.ts +142 -70
  994. package/src/BigDecimal.ts +50 -28
  995. package/src/ByteSize.ts +838 -0
  996. package/src/Cache.ts +17 -3
  997. package/src/Cause.ts +1 -1
  998. package/src/Channel.ts +185 -50
  999. package/src/Chunk.ts +65 -36
  1000. package/src/Config.ts +237 -248
  1001. package/src/ConfigProvider.ts +7 -8
  1002. package/src/Context.ts +31 -0
  1003. package/src/Cron.ts +2 -2
  1004. package/src/Crypto.ts +3 -2
  1005. package/src/Deferred.ts +7 -6
  1006. package/src/Duration.ts +1 -1
  1007. package/src/Effect.ts +226 -122
  1008. package/src/Effectable.ts +78 -9
  1009. package/src/Encoding.ts +101 -11
  1010. package/src/Equal.ts +1 -1
  1011. package/src/ExecutionPlan.ts +3 -0
  1012. package/src/Fiber.ts +33 -8
  1013. package/src/FiberHandle.ts +3 -3
  1014. package/src/FiberMap.ts +19 -10
  1015. package/src/FileSystem.ts +55 -230
  1016. package/src/Formatter.ts +21 -3
  1017. package/src/Graph.ts +55 -25
  1018. package/src/Hash.ts +5 -16
  1019. package/src/HashRing.ts +9 -2
  1020. package/src/HashSet.ts +56 -0
  1021. package/src/Iterable.ts +90 -44
  1022. package/src/JsonPatch.ts +4 -4
  1023. package/src/JsonPointer.ts +97 -4
  1024. package/src/JsonSchema.ts +998 -476
  1025. package/src/Layer.ts +59 -18
  1026. package/src/LayerMap.ts +38 -6
  1027. package/src/LayerRef.ts +7 -5
  1028. package/src/Logger.ts +125 -18
  1029. package/src/ManagedRuntime.ts +1 -1
  1030. package/src/Match.ts +33 -14
  1031. package/src/Metric.ts +24 -21
  1032. package/src/MutableHashMap.ts +1 -1
  1033. package/src/MutableHashSet.ts +1 -1
  1034. package/src/MutableList.ts +18 -2
  1035. package/src/Number.ts +7 -1
  1036. package/src/Optic.ts +8 -4
  1037. package/src/Option.ts +1 -1
  1038. package/src/Order.ts +3 -1
  1039. package/src/PartitionedSemaphore.ts +1 -2
  1040. package/src/Path.ts +1 -1
  1041. package/src/PlatformError.ts +1 -1
  1042. package/src/Pool.ts +535 -134
  1043. package/src/PrimaryKey.ts +1 -1
  1044. package/src/PubSub.ts +32 -20
  1045. package/src/Queue.ts +119 -28
  1046. package/src/Random.ts +20 -6
  1047. package/src/RcMap.ts +176 -13
  1048. package/src/Record.ts +15 -0
  1049. package/src/Redacted.ts +1 -1
  1050. package/src/RequestResolver.ts +49 -26
  1051. package/src/Result.ts +1 -1
  1052. package/src/Scheduler.ts +21 -11
  1053. package/src/Schema.ts +5032 -6518
  1054. package/src/SchemaAST.ts +1156 -316
  1055. package/src/SchemaGetter.ts +75 -21
  1056. package/src/SchemaIssue.ts +260 -16
  1057. package/src/SchemaParser.ts +2 -12
  1058. package/src/SchemaRepresentation.ts +1774 -189
  1059. package/src/SchemaTransformation.ts +145 -22
  1060. package/src/Scope.ts +9 -2
  1061. package/src/ScopedCache.ts +10 -3
  1062. package/src/Sink.ts +31 -15
  1063. package/src/StandardSchema.ts +207 -0
  1064. package/src/Stream.ts +294 -76
  1065. package/src/String.ts +20 -9
  1066. package/src/Struct.ts +8 -4
  1067. package/src/SynchronizedRef.ts +3 -5
  1068. package/src/Terminal.ts +3 -3
  1069. package/src/Tracer.ts +43 -14
  1070. package/src/Tuple.ts +3 -1
  1071. package/src/TxChunk.ts +1 -1
  1072. package/src/TxDeferred.ts +1 -1
  1073. package/src/TxHashMap.ts +1 -1
  1074. package/src/TxHashSet.ts +92 -11
  1075. package/src/TxPriorityQueue.ts +1 -1
  1076. package/src/TxPubSub.ts +1 -1
  1077. package/src/TxQueue.ts +22 -17
  1078. package/src/TxReentrantLock.ts +29 -1
  1079. package/src/TxRef.ts +1 -1
  1080. package/src/TxSemaphore.ts +1 -1
  1081. package/src/TxSubscriptionRef.ts +1 -1
  1082. package/src/Types.ts +40 -17
  1083. package/src/Utils.ts +3 -1
  1084. package/src/index.ts +10 -0
  1085. package/src/internal/arbitrary/model.ts +701 -0
  1086. package/src/internal/arbitrary/regexp.ts +855 -0
  1087. package/src/internal/arbitrary/runner.ts +608 -0
  1088. package/src/internal/arbitrary/schema.ts +1800 -0
  1089. package/src/internal/core.ts +48 -22
  1090. package/src/internal/count.ts +14 -0
  1091. package/src/internal/dateTime.ts +8 -10
  1092. package/src/internal/effect.ts +510 -301
  1093. package/src/internal/graph.ts +6 -1
  1094. package/src/internal/hashMap.ts +5 -3
  1095. package/src/internal/hashSet.ts +1 -1
  1096. package/src/internal/matcher.ts +34 -19
  1097. package/src/internal/metric.ts +1 -1
  1098. package/src/internal/option.ts +8 -6
  1099. package/src/internal/random.ts +20 -7
  1100. package/src/internal/rcRef.ts +10 -7
  1101. package/src/internal/references.ts +1 -0
  1102. package/src/internal/request.ts +12 -7
  1103. package/src/internal/result.ts +15 -11
  1104. package/src/internal/schema/annotations.ts +3 -3
  1105. package/src/internal/schema/fromJsonSchemaDocument.ts +326 -160
  1106. package/src/internal/schema/fromRepresentation.ts +5 -3
  1107. package/src/internal/schema/{schema.ts → make.ts} +0 -40
  1108. package/src/internal/schema/parser.ts +8 -0
  1109. package/src/internal/schema/standardSchema.ts +125 -0
  1110. package/src/internal/schema/toCodeDocument.ts +58 -44
  1111. package/src/internal/schema/toCodec.ts +312 -0
  1112. package/src/internal/schema/toDifferJsonPatch.ts +24 -0
  1113. package/src/internal/schema/toEncoderXml.ts +110 -0
  1114. package/src/internal/schema/toEquivalence.ts +76 -0
  1115. package/src/internal/schema/toFormatter.ts +230 -0
  1116. package/src/internal/schema/toIso.ts +20 -0
  1117. package/src/internal/schema/toJsonSchemaDocument.ts +125 -67
  1118. package/src/internal/schema/toRepresentation.ts +1 -1
  1119. package/src/internal/schemaError.ts +8 -0
  1120. package/src/internal/stream.ts +14 -6
  1121. package/src/internal/tracer.ts +4 -0
  1122. package/src/internal/trie.ts +5 -2
  1123. package/src/internal/uuid.ts +4 -0
  1124. package/src/testing/TestSchema.ts +36 -30
  1125. package/src/testing/index.ts +0 -5
  1126. package/src/unstable/ai/AiError.ts +126 -6
  1127. package/src/unstable/ai/AnthropicStructuredOutput.ts +8 -5
  1128. package/src/unstable/ai/Chat.ts +35 -36
  1129. package/src/unstable/ai/EmbeddingModel.ts +27 -15
  1130. package/src/unstable/ai/LanguageModel.ts +283 -100
  1131. package/src/unstable/ai/McpServer.ts +105 -92
  1132. package/src/unstable/ai/OpenAiStructuredOutput.ts +6 -3
  1133. package/src/unstable/ai/Prompt.ts +20 -5
  1134. package/src/unstable/ai/Response.ts +107 -189
  1135. package/src/unstable/ai/Tokenizer.ts +4 -5
  1136. package/src/unstable/ai/Tool.ts +58 -35
  1137. package/src/unstable/ai/Toolkit.ts +43 -37
  1138. package/src/unstable/ai/internal/codec-transformer.ts +3 -2
  1139. package/src/unstable/ai/internal/structured-output.ts +29 -6
  1140. package/src/unstable/arbitrary/Arbitrary.ts +715 -0
  1141. package/src/unstable/arbitrary/index.ts +10 -0
  1142. package/src/unstable/cli/Argument.ts +111 -115
  1143. package/src/unstable/cli/CliError.ts +2 -0
  1144. package/src/unstable/cli/CliOutput.ts +41 -4
  1145. package/src/unstable/cli/Command.ts +79 -78
  1146. package/src/unstable/cli/Completions.ts +4 -4
  1147. package/src/unstable/cli/Flag.ts +158 -169
  1148. package/src/unstable/cli/GlobalFlag.ts +13 -13
  1149. package/src/unstable/cli/Param.ts +150 -159
  1150. package/src/unstable/cli/Primitive.ts +75 -76
  1151. package/src/unstable/cli/Prompt.ts +543 -408
  1152. package/src/unstable/cli/internal/completions/bash.ts +113 -38
  1153. package/src/unstable/cli/internal/completions/descriptor.ts +23 -11
  1154. package/src/unstable/cli/internal/completions/fish.ts +17 -9
  1155. package/src/unstable/cli/internal/completions/zsh.ts +7 -4
  1156. package/src/unstable/cli/internal/config.ts +4 -4
  1157. package/src/unstable/cli/internal/parser.ts +1 -1
  1158. package/src/unstable/cli/internal/wizard.ts +60 -32
  1159. package/src/unstable/cluster/ClusterSchema.ts +19 -1
  1160. package/src/unstable/cluster/ClusterWorkflowEngine.ts +66 -16
  1161. package/src/unstable/cluster/Entity.ts +3 -0
  1162. package/src/unstable/cluster/EntityProxyServer.ts +6 -2
  1163. package/src/unstable/cluster/Envelope.ts +32 -3
  1164. package/src/unstable/cluster/HttpRunner.ts +52 -25
  1165. package/src/unstable/cluster/Message.ts +35 -13
  1166. package/src/unstable/cluster/MessageStorage.ts +69 -24
  1167. package/src/unstable/cluster/Reply.ts +36 -19
  1168. package/src/unstable/cluster/RunnerServer.ts +21 -11
  1169. package/src/unstable/cluster/Runners.ts +93 -80
  1170. package/src/unstable/cluster/Sharding.ts +44 -19
  1171. package/src/unstable/cluster/ShardingConfig.ts +23 -23
  1172. package/src/unstable/cluster/SocketRunner.ts +5 -4
  1173. package/src/unstable/cluster/SqlMessageStorage.ts +12 -8
  1174. package/src/unstable/cluster/SqlRunnerStorage.ts +18 -10
  1175. package/src/unstable/cluster/internal/clusterAbandon.ts +14 -0
  1176. package/src/unstable/cluster/internal/entityManager.ts +15 -6
  1177. package/src/unstable/cluster/internal/interruptors.ts +58 -1
  1178. package/src/unstable/cluster/internal/resourceRef.ts +15 -7
  1179. package/src/unstable/devtools/DevToolsClient.ts +13 -3
  1180. package/src/unstable/encoding/Ini.ts +2 -0
  1181. package/src/unstable/encoding/SchemaBinary.ts +5308 -0
  1182. package/src/unstable/encoding/Sse.ts +1 -1
  1183. package/src/unstable/encoding/Toml.ts +7 -5
  1184. package/src/unstable/encoding/Yaml.ts +18 -5
  1185. package/src/unstable/encoding/index.ts +2 -2
  1186. package/src/unstable/eventlog/Event.ts +7 -7
  1187. package/src/unstable/eventlog/EventJournal.ts +22 -15
  1188. package/src/unstable/eventlog/EventLog.ts +24 -14
  1189. package/src/unstable/eventlog/EventLogMessage.ts +25 -15
  1190. package/src/unstable/eventlog/EventLogRemote.ts +15 -4
  1191. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +2 -2
  1192. package/src/unstable/eventlog/SqlEventJournal.ts +35 -10
  1193. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +11 -1
  1194. package/src/unstable/http/Cookies.ts +2 -102
  1195. package/src/unstable/http/FetchHttpClient.ts +1 -1
  1196. package/src/unstable/http/FindMyWay/internal/router.ts +139 -33
  1197. package/src/unstable/http/FindMyWay.ts +15 -5
  1198. package/src/unstable/http/Headers.ts +3 -48
  1199. package/src/unstable/http/HttpBody.ts +107 -36
  1200. package/src/unstable/http/HttpClient.ts +41 -30
  1201. package/src/unstable/http/HttpClientRequest.ts +32 -18
  1202. package/src/unstable/http/HttpClientResponse.ts +16 -3
  1203. package/src/unstable/http/HttpEffect.ts +145 -73
  1204. package/src/unstable/http/HttpIncomingMessage.ts +4 -4
  1205. package/src/unstable/http/HttpMiddleware.ts +43 -24
  1206. package/src/unstable/http/HttpPlatform.ts +62 -20
  1207. package/src/unstable/http/HttpRouter.ts +27 -16
  1208. package/src/unstable/http/HttpServer.ts +18 -57
  1209. package/src/unstable/http/HttpServerRequest.ts +17 -15
  1210. package/src/unstable/http/HttpServerRespondable.ts +1 -1
  1211. package/src/unstable/http/HttpServerResponse.ts +49 -40
  1212. package/src/unstable/http/HttpStaticServer.ts +30 -28
  1213. package/src/unstable/http/Mime.ts +76 -0
  1214. package/src/unstable/http/Multipart.ts +35 -18
  1215. package/src/unstable/http/MultipartParser/internal/multipart.ts +10 -3
  1216. package/src/unstable/http/MultipartParser.ts +4 -3
  1217. package/src/unstable/http/UrlParams.ts +3 -161
  1218. package/src/unstable/http/index.ts +5 -0
  1219. package/src/unstable/http/internal/compression.ts +11 -12
  1220. package/src/unstable/http/internal/headers.ts +7 -0
  1221. package/src/unstable/http/internal/httpBody.ts +9 -0
  1222. package/src/unstable/http/internal/mimeTypes.ts +395 -0
  1223. package/src/unstable/httpapi/HttpApiBuilder.ts +63 -11
  1224. package/src/unstable/httpapi/HttpApiClient.ts +44 -24
  1225. package/src/unstable/httpapi/HttpApiEndpoint.ts +24 -11
  1226. package/src/unstable/httpapi/HttpApiError.ts +3 -1
  1227. package/src/unstable/httpapi/HttpApiMiddleware.ts +7 -5
  1228. package/src/unstable/httpapi/HttpApiScalar.ts +30 -27
  1229. package/src/unstable/httpapi/HttpApiSchema.ts +14 -7
  1230. package/src/unstable/httpapi/HttpApiSwagger.ts +6 -3
  1231. package/src/unstable/httpapi/HttpApiTest.ts +6 -1
  1232. package/src/unstable/httpapi/OpenApi.ts +32 -22
  1233. package/src/unstable/net/IpInterface.ts +242 -0
  1234. package/src/unstable/net/IpNetwork.ts +357 -0
  1235. package/src/unstable/net/NetAddress.ts +1271 -0
  1236. package/src/unstable/net/index.ts +20 -0
  1237. package/src/unstable/observability/OtlpExporter.ts +5 -6
  1238. package/src/unstable/observability/OtlpLogger.ts +9 -9
  1239. package/src/unstable/observability/OtlpMetrics.ts +9 -8
  1240. package/src/unstable/observability/OtlpResource.ts +5 -4
  1241. package/src/unstable/observability/OtlpTracer.ts +103 -81
  1242. package/src/unstable/observability/internal/otlpEnv.ts +10 -13
  1243. package/src/unstable/persistence/PersistedCache.ts +1 -1
  1244. package/src/unstable/persistence/PersistedQueue.ts +1100 -291
  1245. package/src/unstable/persistence/RateLimiter.ts +64 -58
  1246. package/src/unstable/process/ChildProcess.ts +15 -4
  1247. package/src/unstable/process/ChildProcessSpawner.ts +1 -1
  1248. package/src/unstable/reactivity/Atom.ts +6 -3
  1249. package/src/unstable/reactivity/AtomHttpApi.ts +21 -10
  1250. package/src/unstable/reactivity/AtomRegistry.ts +2 -4
  1251. package/src/unstable/reactivity/AtomRpc.ts +6 -5
  1252. package/src/unstable/reactivity/Hydration.ts +26 -7
  1253. package/src/unstable/reactivity/Reactivity.ts +49 -36
  1254. package/src/unstable/rpc/RpcClient.ts +100 -82
  1255. package/src/unstable/rpc/RpcMessage.ts +78 -11
  1256. package/src/unstable/rpc/RpcMiddleware.ts +7 -5
  1257. package/src/unstable/rpc/RpcSerialization.ts +82 -92
  1258. package/src/unstable/rpc/RpcServer.ts +171 -93
  1259. package/src/unstable/schema/Model.ts +8 -7
  1260. package/src/unstable/schema/VariantSchema.ts +3 -0
  1261. package/src/unstable/socket/Socket.ts +714 -383
  1262. package/src/unstable/socket/SocketServer.ts +5 -35
  1263. package/src/unstable/sql/SqlClient.ts +42 -7
  1264. package/src/unstable/sql/SqlConnection.ts +18 -0
  1265. package/src/unstable/sql/SqlModel.ts +1 -1
  1266. package/src/unstable/sql/Statement.ts +46 -20
  1267. package/src/unstable/workers/Transferable.ts +1 -1
  1268. package/src/unstable/workers/Worker.ts +3 -1
  1269. package/src/unstable/workflow/Activity.ts +20 -9
  1270. package/src/unstable/workflow/DurableClock.ts +1 -1
  1271. package/src/unstable/workflow/DurableDeferred.ts +6 -0
  1272. package/src/unstable/workflow/DurableQueue.ts +8 -0
  1273. package/src/unstable/workflow/Workflow.ts +105 -28
  1274. package/src/unstable/workflow/WorkflowEngine.ts +22 -0
  1275. package/src/unstable/workflow/WorkflowProxy.ts +8 -4
  1276. package/dist/internal/schema/schema.d.ts.map +0 -1
  1277. package/dist/internal/schema/schema.js.map +0 -1
  1278. package/dist/internal/schema/toArbitrary.d.ts +0 -2
  1279. package/dist/internal/schema/toArbitrary.d.ts.map +0 -1
  1280. package/dist/internal/schema/toArbitrary.js +0 -705
  1281. package/dist/internal/schema/toArbitrary.js.map +0 -1
  1282. package/dist/testing/FastCheck.d.ts +0 -90
  1283. package/dist/testing/FastCheck.d.ts.map +0 -1
  1284. package/dist/testing/FastCheck.js +0 -90
  1285. package/dist/testing/FastCheck.js.map +0 -1
  1286. package/dist/unstable/encoding/Msgpack.d.ts +0 -185
  1287. package/dist/unstable/encoding/Msgpack.d.ts.map +0 -1
  1288. package/dist/unstable/encoding/Msgpack.js +0 -227
  1289. package/dist/unstable/encoding/Msgpack.js.map +0 -1
  1290. package/src/internal/schema/toArbitrary.ts +0 -843
  1291. package/src/testing/FastCheck.ts +0 -90
  1292. package/src/unstable/encoding/Msgpack.ts +0 -432
  1293. /package/dist/internal/{schema → arbitrary}/schema.d.ts +0 -0
package/dist/SchemaAST.js CHANGED
@@ -16,7 +16,7 @@ import * as Effect from "./Effect.js";
16
16
  import * as Exit from "./Exit.js";
17
17
  import { format, formatPropertyKey } from "./Formatter.js";
18
18
  import { identity, memoize, memoizeIdempotent } from "./Function.js";
19
- import { effectIsExit, iterateEager } from "./internal/effect.js";
19
+ import { effectIsExit, iterateConcurrent, iterateEager, resolveConcurrency } from "./internal/effect.js";
20
20
  import * as InternalRecord from "./internal/record.js";
21
21
  import * as InternalAnnotations from "./internal/schema/annotations.js";
22
22
  import * as InternalSchemaCause from "./internal/schema/cause.js";
@@ -311,56 +311,28 @@ export const isUnion = /*#__PURE__*/makeGuard("Union");
311
311
  */
312
312
  export const isSuspend = /*#__PURE__*/makeGuard("Suspend");
313
313
  /**
314
- * Represents a single step in an {@link Encoding} chain.
314
+ * Constructs a {@link Link}.
315
315
  *
316
- * **Details**
317
- *
318
- * A link pairs a target {@link AST} with a `Transformation` or `Middleware`
319
- * that converts values between the current node and the target.
320
- *
321
- * - `to` — the AST node on the other side of this transformation step.
322
- * - `transformation` — the bidirectional conversion logic (decode/encode).
323
- *
324
- * Links are composed into a non-empty array ({@link Encoding}) attached to
325
- * AST nodes that have a different encoded representation.
326
- *
327
- * @see {@link Encoding}
328
- * @see {@link decodeTo}
329
- * @category models
316
+ * @category constructors
330
317
  * @since 4.0.0
331
318
  */
332
- export class Link {
319
+ export const Link = class {
333
320
  to;
334
321
  transformation;
335
322
  constructor(to, transformation) {
336
323
  this.to = to;
337
324
  this.transformation = transformation;
338
325
  }
339
- }
326
+ };
340
327
  /** @internal */
341
328
  export const defaultParseOptions = {};
342
329
  /**
343
- * Represents per-property metadata attached to AST nodes via {@link Base.context}.
344
- *
345
- * **Details**
330
+ * Constructs a {@link Context}.
346
331
  *
347
- * Tracks whether a property key is optional, mutable, has a constructor
348
- * default, or carries key-level annotations. Typically set by helpers like
349
- * {@link optionalKey} and `Schema.mutableKey`.
350
- *
351
- * - `isOptional` — the property key may be absent from the input.
352
- * - `isMutable` — the property is `readonly` when `false`.
353
- * - `constructorDefault` — a {@link Link} applied during construction to
354
- * supply missing values.
355
- * - `annotations` — key-level annotations (e.g. description of the key
356
- * itself).
357
- *
358
- * @see {@link optionalKey}
359
- * @see {@link isOptional}
360
- * @category models
332
+ * @category constructors
361
333
  * @since 4.0.0
362
334
  */
363
- export class Context {
335
+ export const Context = class {
364
336
  isOptional;
365
337
  isMutable;
366
338
  /** Used for constructor default values (e.g. `withConstructorDefault` API) */
@@ -373,29 +345,9 @@ export class Context {
373
345
  this.constructorDefault = constructorDefault;
374
346
  this.annotations = annotations;
375
347
  }
376
- }
348
+ };
377
349
  const TypeId = "~effect/Schema";
378
- /**
379
- * Represents the abstract base class for all {@link AST} node variants.
380
- *
381
- * **Details**
382
- *
383
- * Every AST node extends `Base` and inherits these fields:
384
- *
385
- * - `annotations` — user-supplied metadata (identifier, title, description,
386
- * arbitrary keys).
387
- * - `checks` — optional {@link Checks} for post-type-match validation.
388
- * - `encoding` — optional {@link Encoding} chain for type ↔ wire
389
- * transformations.
390
- * - `context` — optional {@link Context} for per-property metadata.
391
- *
392
- * Subclasses add a `_tag` discriminant and variant-specific data.
393
- *
394
- * @see {@link AST}
395
- * @category models
396
- * @since 4.0.0
397
- */
398
- export class Base {
350
+ class ASTNodeImpl {
399
351
  [TypeId] = TypeId;
400
352
  annotations;
401
353
  checks;
@@ -412,34 +364,27 @@ export class Base {
412
364
  }
413
365
  }
414
366
  /**
415
- * AST node for user-defined opaque types with custom parsing logic.
416
- *
417
- * **When to use**
367
+ * Constructs a {@link Declaration}.
418
368
  *
419
- * Use when you need a custom schema AST node because none of the built-in
420
- * nodes fit.
421
- *
422
- * **Details**
423
- *
424
- * - `typeParameters` — inner schemas this declaration is parameterized over
425
- * (e.g. the element type for a custom collection).
426
- * - `run` — factory that receives `typeParameters` and returns a parser that
427
- * validates or transforms raw input.
428
- *
429
- * @see {@link isDeclaration}
430
- * @category models
431
- * @since 3.10.0
369
+ * @category constructors
370
+ * @since 4.0.0
432
371
  */
433
- export class Declaration extends Base {
372
+ export const Declaration = class extends ASTNodeImpl {
434
373
  _tag = "Declaration";
435
374
  typeParameters;
436
375
  run;
437
376
  encodingChecks;
438
- constructor(typeParameters, run, annotations, checks, encoding, context, encodingChecks) {
377
+ /**
378
+ * Parser factory {@link flip} swaps in, so a declaration can behave
379
+ * differently when encoding. `undefined` reuses `run`.
380
+ */
381
+ encodingRun;
382
+ constructor(typeParameters, run, annotations, checks, encoding, context, encodingChecks, encodingRun) {
439
383
  super(annotations, checks, encoding, context);
440
384
  this.typeParameters = typeParameters;
441
385
  this.run = run;
442
386
  this.encodingChecks = encodingChecks;
387
+ this.encodingRun = encodingRun;
443
388
  }
444
389
  /** @internal */
445
390
  getParser() {
@@ -449,17 +394,17 @@ export class Declaration extends Base {
449
394
  return (run ??= this.run(this.typeParameters))(input, this, options);
450
395
  };
451
396
  }
452
- _rebuild(recur, checks, encodingChecks) {
397
+ _rebuild(recur, checks, encodingChecks, run, encodingRun) {
453
398
  const tps = mapOrSame(this.typeParameters, recur);
454
- return tps === this.typeParameters && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Declaration(tps, this.run, this.annotations, checks, undefined, this.context, encodingChecks);
399
+ return tps === this.typeParameters && checks === this.checks && encodingChecks === this.encodingChecks && run === this.run && encodingRun === this.encodingRun ? this : new Declaration(tps, run, this.annotations, checks, undefined, this.context, encodingChecks, encodingRun);
455
400
  }
456
401
  /** @internal */
457
402
  recur(recur) {
458
- return this._rebuild(recur, this.checks, this.encodingChecks);
403
+ return this._rebuild(recur, this.checks, this.encodingChecks, this.run, this.encodingRun);
459
404
  }
460
405
  /** @internal */
461
406
  flip(recur) {
462
- return this._rebuild(recur, this.encodingChecks, this.checks);
407
+ return this._rebuild(recur, this.encodingChecks, this.checks, this.encodingRun ?? this.run, this.run);
463
408
  }
464
409
  /** @internal */
465
410
  getExpected() {
@@ -467,20 +412,14 @@ export class Declaration extends Base {
467
412
  if (typeof expected === "string") return expected;
468
413
  return "<Declaration>";
469
414
  }
470
- }
415
+ };
471
416
  /**
472
- * AST node matching the `null` literal value.
473
- *
474
- * **Details**
417
+ * Constructs a {@link Null}.
475
418
  *
476
- * Parsing succeeds only when the input is exactly `null`.
477
- *
478
- * @see {@link null_ null}
479
- * @see {@link isNull}
480
- * @category models
419
+ * @category constructors
481
420
  * @since 4.0.0
482
421
  */
483
- export class Null extends Base {
422
+ export const Null = class extends ASTNodeImpl {
484
423
  _tag = "Null";
485
424
  /** @internal */
486
425
  getParser() {
@@ -490,7 +429,7 @@ export class Null extends Base {
490
429
  getExpected() {
491
430
  return "null";
492
431
  }
493
- }
432
+ };
494
433
  const null_ = /*#__PURE__*/new Null();
495
434
  export {
496
435
  /**
@@ -506,18 +445,12 @@ export {
506
445
  */
507
446
  null_ as null };
508
447
  /**
509
- * AST node matching the `undefined` value.
510
- *
511
- * **Details**
448
+ * Constructs a {@link Undefined}.
512
449
  *
513
- * Parsing succeeds only when the input is exactly `undefined`.
514
- *
515
- * @see {@link undefined}
516
- * @see {@link isUndefined}
517
- * @category models
450
+ * @category constructors
518
451
  * @since 4.0.0
519
452
  */
520
- export class Undefined extends Base {
453
+ export const Undefined = class extends ASTNodeImpl {
521
454
  _tag = "Undefined";
522
455
  /** @internal */
523
456
  getParser() {
@@ -531,7 +464,7 @@ export class Undefined extends Base {
531
464
  getExpected() {
532
465
  return "undefined";
533
466
  }
534
- }
467
+ };
535
468
  const undefinedToNull = /*#__PURE__*/new Link(null_, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(() => undefined), /*#__PURE__*/SchemaGetter.transform(() => null)));
536
469
  const undefined_ = /*#__PURE__*/new Undefined();
537
470
  export {
@@ -548,26 +481,12 @@ export {
548
481
  */
549
482
  undefined_ as undefined };
550
483
  /**
551
- * AST node matching TypeScript `void` return-value semantics.
552
- *
553
- * **When to use**
554
- *
555
- * Use when you need an AST node for a value whose result is intentionally
556
- * ignored.
557
- *
558
- * **Details**
559
- *
560
- * Parsers built from this node accept any present runtime input and map it to
561
- * `undefined`. Public schemas built from it may still expose `void` as their
562
- * typed decoded and encoded representation.
484
+ * Constructs a {@link Void}.
563
485
  *
564
- * @see {@link undefined} for the AST singleton that matches only exact `undefined`
565
- * @see {@link void_ void}
566
- * @see {@link isVoid}
567
- * @category models
486
+ * @category constructors
568
487
  * @since 4.0.0
569
488
  */
570
- export class Void extends Base {
489
+ export const Void = class extends ASTNodeImpl {
571
490
  _tag = "Void";
572
491
  /** @internal */
573
492
  getParser() {
@@ -582,7 +501,7 @@ export class Void extends Base {
582
501
  getExpected() {
583
502
  return "void";
584
503
  }
585
- }
504
+ };
586
505
  const void_ = /*#__PURE__*/new Void();
587
506
  export {
588
507
  /**
@@ -607,19 +526,12 @@ export {
607
526
  */
608
527
  void_ as void };
609
528
  /**
610
- * AST node representing the `never` type — no value matches.
611
- *
612
- * **Details**
613
- *
614
- * Parsing always fails. Useful as a placeholder in unions or as the result
615
- * of narrowing that eliminates all options.
529
+ * Constructs a {@link Never}.
616
530
  *
617
- * @see {@link never}
618
- * @see {@link isNever}
619
- * @category models
531
+ * @category constructors
620
532
  * @since 4.0.0
621
533
  */
622
- export class Never extends Base {
534
+ export const Never = class extends ASTNodeImpl {
623
535
  _tag = "Never";
624
536
  /** @internal */
625
537
  getParser() {
@@ -629,7 +541,7 @@ export class Never extends Base {
629
541
  getExpected() {
630
542
  return "never";
631
543
  }
632
- }
544
+ };
633
545
  /**
634
546
  * Provides the singleton {@link Never} AST instance.
635
547
  *
@@ -646,15 +558,12 @@ export class Never extends Base {
646
558
  */
647
559
  export const never = /*#__PURE__*/new Never();
648
560
  /**
649
- * AST node representing the `any` type — every value matches.
561
+ * Constructs a {@link Any}.
650
562
  *
651
- * @see {@link any}
652
- * @see {@link isAny}
653
- *
654
- * @category models
563
+ * @category constructors
655
564
  * @since 4.0.0
656
565
  */
657
- export class Any extends Base {
566
+ export const Any = class extends ASTNodeImpl {
658
567
  _tag = "Any";
659
568
  /** @internal */
660
569
  getParser() {
@@ -664,7 +573,7 @@ export class Any extends Base {
664
573
  getExpected() {
665
574
  return "any";
666
575
  }
667
- }
576
+ };
668
577
  /**
669
578
  * Provides the singleton {@link Any} AST instance.
670
579
  *
@@ -680,19 +589,12 @@ export class Any extends Base {
680
589
  */
681
590
  export const any = /*#__PURE__*/new Any();
682
591
  /**
683
- * AST node representing the `unknown` type — every value matches.
684
- *
685
- * **Details**
592
+ * Constructs a {@link Unknown}.
686
593
  *
687
- * Unlike {@link Any}, this is type-safe: the parsed result is typed as
688
- * `unknown` rather than `any`.
689
- *
690
- * @see {@link unknown}
691
- * @see {@link isUnknown}
692
- * @category models
594
+ * @category constructors
693
595
  * @since 4.0.0
694
596
  */
695
- export class Unknown extends Base {
597
+ export const Unknown = class extends ASTNodeImpl {
696
598
  _tag = "Unknown";
697
599
  /** @internal */
698
600
  getParser() {
@@ -702,7 +604,7 @@ export class Unknown extends Base {
702
604
  getExpected() {
703
605
  return "unknown";
704
606
  }
705
- }
607
+ };
706
608
  /**
707
609
  * Provides the singleton {@link Unknown} AST instance.
708
610
  *
@@ -718,16 +620,12 @@ export class Unknown extends Base {
718
620
  */
719
621
  export const unknown = /*#__PURE__*/new Unknown();
720
622
  /**
721
- * AST node matching the TypeScript `object` type — accepts objects, arrays,
722
- * and functions (anything non-primitive and non-null).
723
- *
724
- * @see {@link objectKeyword}
725
- * @see {@link isObjectKeyword}
623
+ * Constructs a {@link ObjectKeyword}.
726
624
  *
727
- * @category models
728
- * @since 3.10.0
625
+ * @category constructors
626
+ * @since 4.0.0
729
627
  */
730
- export class ObjectKeyword extends Base {
628
+ export const ObjectKeyword = class extends ASTNodeImpl {
731
629
  _tag = "ObjectKeyword";
732
630
  /** @internal */
733
631
  getParser() {
@@ -737,7 +635,7 @@ export class ObjectKeyword extends Base {
737
635
  getExpected() {
738
636
  return "object | array | function";
739
637
  }
740
- }
638
+ };
741
639
  /**
742
640
  * Provides the singleton {@link ObjectKeyword} AST instance.
743
641
  *
@@ -754,22 +652,21 @@ export class ObjectKeyword extends Base {
754
652
  */
755
653
  export const objectKeyword = /*#__PURE__*/new ObjectKeyword();
756
654
  /**
757
- * AST node representing a TypeScript `enum`.
758
- *
759
- * **Details**
655
+ * Constructs a {@link Enum}. Numeric values must be finite.
760
656
  *
761
- * Holds `enums` as an array of `[name, value]` pairs where values are
762
- * `string | number`. Parsing succeeds when the input matches any enum value.
763
- *
764
- * @see {@link isEnum}
765
- * @category models
657
+ * @category constructors
766
658
  * @since 4.0.0
767
659
  */
768
- export class Enum extends Base {
660
+ export const Enum = class extends ASTNodeImpl {
769
661
  _tag = "Enum";
770
662
  enums;
771
663
  constructor(enums, annotations, checks, encoding, context) {
772
664
  super(annotations, checks, encoding, context);
665
+ for (const [, value] of enums) {
666
+ if (typeof value === "number" && !globalThis.Number.isFinite(value)) {
667
+ throw new Error(`A numeric enum value must be finite, got ${format(value)}`);
668
+ }
669
+ }
773
670
  this.enums = enums;
774
671
  }
775
672
  /** @internal */
@@ -781,7 +678,7 @@ export class Enum extends Base {
781
678
  toCodecStringTree() {
782
679
  if (this.enums.some(([_, v]) => typeof v === "number")) {
783
680
  const coercions = Object.fromEntries(this.enums.map(([_, v]) => [globalThis.String(v), v]));
784
- return replaceEncoding(this, [new Link(new Union(Object.keys(coercions).map(k => new Literal(k)), "anyOf"), new SchemaTransformation.Transformation(SchemaGetter.transform(s => coercions[s]), SchemaGetter.String()))]);
681
+ return replaceEncoding(this, [new Link(new Union(Object.keys(coercions).map(k => new Literal(k))), new SchemaTransformation.Transformation(SchemaGetter.transform(s => coercions[s]), SchemaGetter.String()))]);
785
682
  }
786
683
  return this;
787
684
  }
@@ -789,36 +686,46 @@ export class Enum extends Base {
789
686
  getExpected() {
790
687
  return this.enums.map(([_, value]) => JSON.stringify(value)).join(" | ");
791
688
  }
792
- }
793
- function isTemplateLiteralPart(ast) {
689
+ };
690
+ function isTemplateLiteralPart(ast, path, validated) {
691
+ if (validated.has(ast)) return true;
692
+ if (ast.encoding) {
693
+ throw new Error(`TemplateLiteral parts cannot have an encoding at ${path}`);
694
+ }
695
+ let valid;
794
696
  switch (ast._tag) {
795
697
  case "String":
796
698
  case "Number":
797
699
  case "BigInt":
798
- return true;
700
+ valid = true;
701
+ break;
799
702
  case "Literal":
703
+ valid = !ast.checks;
704
+ break;
800
705
  case "TemplateLiteral":
801
- return !ast.checks;
706
+ valid = !ast.checks && ast.parts.every((part, index) => isTemplateLiteralPart(part, `${path}.parts[${index}]`, validated));
707
+ break;
802
708
  case "Union":
803
- return !ast.checks && ast.types.every(isTemplateLiteralPart);
709
+ valid = !ast.checks && ast.types.every((part, index) => isTemplateLiteralPart(part, `${path}.types[${index}]`, validated));
710
+ break;
804
711
  default:
805
712
  return false;
806
713
  }
714
+ if (valid) validated.add(ast);
715
+ return valid;
807
716
  }
808
717
  /**
809
- * AST node representing a TypeScript template literal type
810
- * (e.g. `` `user_${string}` ``).
718
+ * Constructs a {@link TemplateLiteral}.
811
719
  *
812
- * **Details**
720
+ * **Gotchas**
813
721
  *
814
- * `parts` is an array of AST nodes; each part contributes to matching
815
- * strings at runtime.
722
+ * Throws if a part contains an encoding, including inside unions or nested
723
+ * template literals. Parts must describe their values without transformations.
816
724
  *
817
- * @see {@link isTemplateLiteral}
818
- * @category models
819
- * @since 3.10.0
725
+ * @category constructors
726
+ * @since 4.0.0
820
727
  */
821
- export class TemplateLiteral extends Base {
728
+ export const TemplateLiteral = class extends ASTNodeImpl {
822
729
  _tag = "TemplateLiteral";
823
730
  parts;
824
731
  /** @internal */
@@ -831,14 +738,14 @@ export class TemplateLiteral extends Base {
831
738
  super(annotations, checks, encoding, context);
832
739
  const encodedParts = [];
833
740
  const literals = [];
834
- for (const part of parts) {
835
- const encoded = toEncoded(part);
836
- if (isTemplateLiteralPart(encoded)) {
837
- encodedParts.push(encoded);
838
- literals.push(encoded._tag === "Literal" ? globalThis.String(encoded.literal) : undefined);
839
- } else {
840
- throw new Error(`Invalid TemplateLiteral part ${encoded._tag}`);
741
+ const validated = new WeakSet();
742
+ for (let index = 0; index < parts.length; index++) {
743
+ const part = parts[index];
744
+ if (!isTemplateLiteralPart(part, `parts[${index}]`, validated)) {
745
+ throw new Error(`Invalid TemplateLiteral part ${part._tag}`);
841
746
  }
747
+ encodedParts.push(part);
748
+ literals.push(part._tag === "Literal" ? globalThis.String(part.literal) : undefined);
842
749
  }
843
750
  const suffixLengths = new Array(encodedParts.length + 1);
844
751
  suffixLengths[encodedParts.length] = 0;
@@ -852,7 +759,8 @@ export class TemplateLiteral extends Base {
852
759
  }
853
760
  /** @internal */
854
761
  getParser(compile) {
855
- const parser = compile(this.asTemplateLiteralParser());
762
+ const tuple = new Arrays(false, this.parts.map(partFromString), []);
763
+ const parser = compile(decodeTo(string, tuple, templateLiteralTransformation(this)));
856
764
  return (input, options) => {
857
765
  if (input === InternalParser.missing) return InternalParser.missingExit;
858
766
  const result = parser(input, options);
@@ -873,31 +781,39 @@ export class TemplateLiteral extends Base {
873
781
  matchPart(s, options) {
874
782
  return segmentTemplateLiteralParts(this, s, options) === undefined ? undefined : s;
875
783
  }
876
- /** @internal */
877
- asTemplateLiteralParser() {
878
- const tuple = new Arrays(false, this.parts.map(partFromString), []);
879
- return decodeTo(string, tuple, new SchemaTransformation.Transformation(SchemaGetter.transformOrFail((s, options) => {
880
- const segments = segmentTemplateLiteralParts(this, s, options);
881
- if (segments) return Effect.succeed(segments);
882
- return Effect.fail(new SchemaIssue.InvalidValue({
883
- expected: "a string matching template literal parts"
884
- }, s, options));
885
- }), SchemaGetter.transform(parts => parts.join(""))));
886
- }
784
+ };
785
+ /** @internal */
786
+ export function templateLiteralParser(parts) {
787
+ // Encoded members can overlap even when decoding selects exactly one member.
788
+ // Match their spellings here; the original tuple enforces the union's mode.
789
+ const normalize = memoize(encoded => {
790
+ if (encoded._tag !== "Union") return encoded;
791
+ const types = mapOrSame(encoded.types, normalize);
792
+ return (encoded.options?.mode ?? "anyOf") === "anyOf" && types === encoded.types ? encoded : new Union(types, encoded.options === undefined ? undefined : {
793
+ ...encoded.options,
794
+ mode: "anyOf"
795
+ }, encoded.annotations, encoded.checks, undefined, encoded.context);
796
+ });
797
+ const template = new TemplateLiteral(parts.map(part => normalize(toEncoded(part))));
798
+ const tuple = new Arrays(false, parts.map(partFromString), []);
799
+ return decodeTo(template, tuple, templateLiteralTransformation(template));
800
+ }
801
+ function templateLiteralTransformation(template) {
802
+ return new SchemaTransformation.Transformation(SchemaGetter.transformEffect((s, options) => {
803
+ const segments = segmentTemplateLiteralParts(template, s, options);
804
+ if (segments) return Effect.succeed(segments);
805
+ return Effect.fail(new SchemaIssue.InvalidValue({
806
+ expected: "a string matching template literal parts"
807
+ }, s, options));
808
+ }), SchemaGetter.transform(parts => parts.join("")));
887
809
  }
888
810
  /**
889
- * AST node matching a specific `unique symbol` value.
890
- *
891
- * **Details**
811
+ * Constructs a {@link UniqueSymbol}.
892
812
  *
893
- * Parsing succeeds only when the input is reference-equal to the stored
894
- * `symbol`.
895
- *
896
- * @see {@link isUniqueSymbol}
897
- * @category models
898
- * @since 3.10.0
813
+ * @category constructors
814
+ * @since 4.0.0
899
815
  */
900
- export class UniqueSymbol extends Base {
816
+ export const UniqueSymbol = class extends ASTNodeImpl {
901
817
  _tag = "UniqueSymbol";
902
818
  symbol;
903
819
  constructor(symbol, annotations, checks, encoding, context) {
@@ -910,38 +826,21 @@ export class UniqueSymbol extends Base {
910
826
  }
911
827
  /** @internal */
912
828
  toCodecStringTree() {
913
- return replaceEncoding(this, [symbolToString]);
829
+ const key = globalThis.Symbol.keyFor(this.symbol);
830
+ return replaceEncoding(this, [new Link(key === undefined ? never : new Literal(globalThis.String(this.symbol)), symbolToString.transformation)]);
914
831
  }
915
832
  /** @internal */
916
833
  getExpected() {
917
834
  return globalThis.String(this.symbol);
918
835
  }
919
- }
836
+ };
920
837
  /**
921
- * AST node matching an exact primitive value (string, number, boolean, or
922
- * bigint).
923
- *
924
- * **Details**
925
- *
926
- * Parsing succeeds only when the input is strictly equal (`===`) to the
927
- * stored `literal`. Numeric literals must be finite — `Infinity`, `-Infinity`,
928
- * and `NaN` are rejected at construction time.
929
- *
930
- * **Example** (Creating a literal AST)
931
- *
932
- * ```ts import.meta.vitest
933
- * import { SchemaAST } from "effect"
838
+ * Constructs a {@link Literal}.
934
839
  *
935
- * const ast = new SchemaAST.Literal("active")
936
- * ast.literal // => "active"
937
- * ```
938
- *
939
- * @see {@link LiteralValue}
940
- * @see {@link isLiteral}
941
- * @category models
942
- * @since 3.10.0
840
+ * @category constructors
841
+ * @since 4.0.0
943
842
  */
944
- export class Literal extends Base {
843
+ export const Literal = class extends ASTNodeImpl {
945
844
  _tag = "Literal";
946
845
  literal;
947
846
  constructor(literal, annotations, checks, encoding, context) {
@@ -971,21 +870,18 @@ export class Literal extends Base {
971
870
  getExpected() {
972
871
  return typeof this.literal === "string" ? JSON.stringify(this.literal) : globalThis.String(this.literal);
973
872
  }
974
- }
873
+ };
975
874
  function literalToString(ast) {
976
875
  const literalAsString = globalThis.String(ast.literal);
977
876
  return replaceEncoding(ast, [new Link(new Literal(literalAsString), new SchemaTransformation.Transformation(SchemaGetter.transform(() => ast.literal), SchemaGetter.transform(() => literalAsString)))]);
978
877
  }
979
878
  /**
980
- * AST node matching any `string` value.
981
- *
982
- * @see {@link string}
983
- * @see {@link isString}
879
+ * Constructs a {@link String}.
984
880
  *
985
- * @category models
881
+ * @category constructors
986
882
  * @since 4.0.0
987
883
  */
988
- export class String extends Base {
884
+ export const String = class extends ASTNodeImpl {
989
885
  _tag = "String";
990
886
  /** @internal */
991
887
  getParser() {
@@ -1000,7 +896,7 @@ export class String extends Base {
1000
896
  getExpected() {
1001
897
  return "string";
1002
898
  }
1003
- }
899
+ };
1004
900
  /**
1005
901
  * Provides the singleton {@link String} AST instance.
1006
902
  *
@@ -1016,25 +912,12 @@ export class String extends Base {
1016
912
  */
1017
913
  export const string = /*#__PURE__*/new String();
1018
914
  /**
1019
- * AST node matching any `number` value (including `NaN`, `Infinity`,
1020
- * `-Infinity`).
1021
- *
1022
- * **Details**
1023
- *
1024
- * Default JSON serialization:
1025
- *
1026
- * - Finite numbers are serialized as JSON numbers.
1027
- * - `Infinity`, `-Infinity`, and `NaN` are serialized as JSON strings.
1028
- *
1029
- * If the node has an `isFinite` or `isInt` check, the string fallback is
1030
- * skipped since non-finite values cannot occur.
915
+ * Constructs a {@link Number}.
1031
916
  *
1032
- * @see {@link number}
1033
- * @see {@link isNumber}
1034
- * @category models
917
+ * @category constructors
1035
918
  * @since 4.0.0
1036
919
  */
1037
- export class Number extends Base {
920
+ export const Number = class extends ASTNodeImpl {
1038
921
  _tag = "Number";
1039
922
  /** @internal */
1040
923
  getParser() {
@@ -1072,7 +955,7 @@ export class Number extends Base {
1072
955
  getExpected() {
1073
956
  return "number";
1074
957
  }
1075
- }
958
+ };
1076
959
  function hasCheck(checks, id) {
1077
960
  return checks.some(check => check.annotations?.representation?.id === id || check._tag === "FilterGroup" && hasCheck(check.checks, id));
1078
961
  }
@@ -1092,15 +975,12 @@ function hasCheck(checks, id) {
1092
975
  */
1093
976
  export const number = /*#__PURE__*/new Number();
1094
977
  /**
1095
- * AST node matching any `boolean` value (`true` or `false`).
978
+ * Constructs a {@link Boolean}.
1096
979
  *
1097
- * @see {@link boolean}
1098
- * @see {@link isBoolean}
1099
- *
1100
- * @category models
980
+ * @category constructors
1101
981
  * @since 4.0.0
1102
982
  */
1103
- export class Boolean extends Base {
983
+ export const Boolean = class extends ASTNodeImpl {
1104
984
  _tag = "Boolean";
1105
985
  /** @internal */
1106
986
  getParser() {
@@ -1110,7 +990,7 @@ export class Boolean extends Base {
1110
990
  getExpected() {
1111
991
  return "boolean";
1112
992
  }
1113
- }
993
+ };
1114
994
  /**
1115
995
  * Provides the singleton {@link Boolean} AST instance.
1116
996
  *
@@ -1127,24 +1007,12 @@ export class Boolean extends Base {
1127
1007
  */
1128
1008
  export const boolean = /*#__PURE__*/new Boolean();
1129
1009
  /**
1130
- * AST node matching any `symbol` value.
1131
- *
1132
- * **When to use**
1133
- *
1134
- * Use when you need the AST node class for schemas that match any JavaScript
1135
- * symbol value.
1010
+ * Constructs a {@link Symbol}.
1136
1011
  *
1137
- * **Details**
1138
- *
1139
- * When serialized to a string-based codec, symbols are converted via
1140
- * `Symbol.keyFor` and must be registered with `Symbol.for`.
1141
- *
1142
- * @see {@link symbol}
1143
- * @see {@link isSymbol}
1144
- * @category models
1012
+ * @category constructors
1145
1013
  * @since 4.0.0
1146
1014
  */
1147
- export class Symbol extends Base {
1015
+ export const Symbol = class extends ASTNodeImpl {
1148
1016
  _tag = "Symbol";
1149
1017
  /** @internal */
1150
1018
  getParser() {
@@ -1163,7 +1031,7 @@ export class Symbol extends Base {
1163
1031
  getExpected() {
1164
1032
  return "symbol";
1165
1033
  }
1166
- }
1034
+ };
1167
1035
  /**
1168
1036
  * Provides the singleton {@link Symbol} AST instance.
1169
1037
  *
@@ -1184,19 +1052,12 @@ export class Symbol extends Base {
1184
1052
  */
1185
1053
  export const symbol = /*#__PURE__*/new Symbol();
1186
1054
  /**
1187
- * AST node matching any `bigint` value.
1055
+ * Constructs a {@link BigInt}.
1188
1056
  *
1189
- * **Details**
1190
- *
1191
- * When serialized to a string-based codec, bigints are converted to/from
1192
- * their decimal string representation.
1193
- *
1194
- * @see {@link bigInt}
1195
- * @see {@link isBigInt}
1196
- * @category models
1057
+ * @category constructors
1197
1058
  * @since 4.0.0
1198
1059
  */
1199
- export class BigInt extends Base {
1060
+ export const BigInt = class extends ASTNodeImpl {
1200
1061
  _tag = "BigInt";
1201
1062
  /** @internal */
1202
1063
  getParser() {
@@ -1217,7 +1078,7 @@ export class BigInt extends Base {
1217
1078
  getExpected() {
1218
1079
  return "bigint";
1219
1080
  }
1220
- }
1081
+ };
1221
1082
  /**
1222
1083
  * Provides the singleton {@link BigInt} AST instance.
1223
1084
  *
@@ -1234,48 +1095,12 @@ export class BigInt extends Base {
1234
1095
  */
1235
1096
  export const bigInt = /*#__PURE__*/new BigInt();
1236
1097
  /**
1237
- * AST node for array-like types — both tuples and arrays.
1238
- *
1239
- * **When to use**
1240
- *
1241
- * Use when constructing or inspecting AST nodes for tuple or array-like schemas,
1242
- * including rest elements.
1243
- *
1244
- * **Details**
1245
- *
1246
- * - `elements` — positional element types (tuple elements). An element is
1247
- * optional if its {@link Context.isOptional} is `true`.
1248
- * - `rest` — the rest/variadic element types. When non-empty, the first
1249
- * entry is the "spread" type (e.g. `...Array<string>`), and subsequent
1250
- * entries are trailing positional elements after the spread.
1251
- * - `isMutable` — whether the resulting array is `readonly` (`false`) or
1252
- * mutable (`true`).
1253
- *
1254
- * **Gotchas**
1255
- *
1256
- * Construction enforces TypeScript ordering rules: a required element
1257
- * cannot follow an optional one, and an optional element cannot follow a
1258
- * rest element.
1098
+ * Constructs a {@link Arrays}.
1259
1099
  *
1260
- * **Example** (Inspecting a tuple AST)
1261
- *
1262
- * ```ts import.meta.vitest
1263
- * import { Schema, SchemaAST } from "effect"
1264
- *
1265
- * const schema = Schema.Tuple([Schema.String, Schema.Number])
1266
- * const ast = schema.ast
1267
- *
1268
- * if (SchemaAST.isArrays(ast)) {
1269
- * [ast.elements.length, ast.rest.length] // => [2, 0]
1270
- * }
1271
- * ```
1272
- *
1273
- * @see {@link isArrays}
1274
- * @see {@link Objects}
1275
- * @category models
1100
+ * @category constructors
1276
1101
  * @since 4.0.0
1277
1102
  */
1278
- export class Arrays extends Base {
1103
+ export const Arrays = class extends ASTNodeImpl {
1279
1104
  _tag = "Arrays";
1280
1105
  isMutable;
1281
1106
  elements;
@@ -1350,10 +1175,11 @@ export class Arrays extends Base {
1350
1175
  issues: undefined,
1351
1176
  options
1352
1177
  };
1353
- const concurrency = resolveConcurrency(options?.concurrency);
1354
- const eff = parseArray(state, input, {
1355
- concurrency: concurrency?.concurrency,
1356
- end: ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen)
1178
+ const end = ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen);
1179
+ const concurrency = options.concurrency === undefined ? 1 : resolveConcurrency(options.concurrency);
1180
+ const eff = concurrency === 1 ? parseArray(state, input, 0, end) : parseArrayConcurrent(state, input, {
1181
+ concurrency,
1182
+ end
1357
1183
  });
1358
1184
  if (eff) yield* eff;
1359
1185
  // ---------------------------------------------
@@ -1393,8 +1219,8 @@ export class Arrays extends Base {
1393
1219
  getExpected() {
1394
1220
  return "array";
1395
1221
  }
1396
- }
1397
- const parseArray = /*#__PURE__*/iterateEager()({
1222
+ };
1223
+ const parseArrayOptions = {
1398
1224
  onItem(s, item, i) {
1399
1225
  const value = i < s.len ? item : InternalParser.missing;
1400
1226
  return s.getParser(s.tailThreshold, i).parser(value, s.options);
@@ -1417,13 +1243,9 @@ const parseArray = /*#__PURE__*/iterateEager()({
1417
1243
  }
1418
1244
  }
1419
1245
  }
1420
- });
1421
- const resolveConcurrency = value => {
1422
- value = value === "unbounded" ? Infinity : value ?? 1;
1423
- return value > 1 ? {
1424
- concurrency: value
1425
- } : undefined;
1426
1246
  };
1247
+ const parseArray = /*#__PURE__*/iterateEager()(parseArrayOptions);
1248
+ const parseArrayConcurrent = /*#__PURE__*/iterateConcurrent()(parseArrayOptions);
1427
1249
  const wrapPropertyKeyIssue = (s, ast, key, exit) => {
1428
1250
  if (exit.cause.reasons.length === 0) {
1429
1251
  return exit;
@@ -1469,26 +1291,19 @@ export function getIndexSignatureKeys(input, parameter, options = defaultParseOp
1469
1291
  return go(parameterFromPropertyKey(toEncoded(parameter)));
1470
1292
  }
1471
1293
  /**
1472
- * Represents a named property within an {@link Objects} node.
1294
+ * Constructs a {@link PropertySignature}.
1473
1295
  *
1474
- * **Details**
1475
- *
1476
- * Pairs a `name` (any `PropertyKey`) with a `type` ({@link AST}). The
1477
- * property's optionality and mutability are determined by the `type`'s
1478
- * {@link Context}.
1479
- *
1480
- * @see {@link Objects}
1481
- * @category models
1482
- * @since 3.10.0
1296
+ * @category constructors
1297
+ * @since 4.0.0
1483
1298
  */
1484
- export class PropertySignature {
1299
+ export const PropertySignature = class {
1485
1300
  name;
1486
1301
  type;
1487
1302
  constructor(name, type) {
1488
1303
  this.name = name;
1489
1304
  this.type = type;
1490
1305
  }
1491
- }
1306
+ };
1492
1307
  function isIndexSignatureParameterSide(ast) {
1493
1308
  switch (ast._tag) {
1494
1309
  case "String":
@@ -1506,30 +1321,12 @@ function isIndexSignatureParameter(ast) {
1506
1321
  return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterSide(toEncoded(ast));
1507
1322
  }
1508
1323
  /**
1509
- * Represents an index signature entry within an {@link Objects} node.
1510
- *
1511
- * **When to use**
1512
- *
1513
- * Use when constructing or inspecting object AST entries for record-like keys
1514
- * and values.
1324
+ * Constructs a {@link IndexSignature}.
1515
1325
  *
1516
- * **Details**
1517
- *
1518
- * - `parameter` — the key type AST (e.g. {@link String} for `string` keys,
1519
- * {@link TemplateLiteral} for patterned keys).
1520
- * - `type` — the value type SchemaAST.
1521
- *
1522
- * **Gotchas**
1523
- *
1524
- * Using `Schema.optionalKey` on the value type is not allowed for index
1525
- * signatures (throws at construction); use `Schema.optional` instead.
1526
- *
1527
- * @see {@link Objects}
1528
- * @see {@link PropertySignature}
1529
- * @category models
1530
- * @since 3.10.0
1326
+ * @category constructors
1327
+ * @since 4.0.0
1531
1328
  */
1532
- export class IndexSignature {
1329
+ export const IndexSignature = class {
1533
1330
  parameter;
1534
1331
  type;
1535
1332
  constructor(parameter, type) {
@@ -1542,50 +1339,14 @@ export class IndexSignature {
1542
1339
  throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.");
1543
1340
  }
1544
1341
  }
1545
- }
1342
+ };
1546
1343
  /**
1547
- * AST node for object-like schemas, including structs and records.
1548
- *
1549
- * **When to use**
1550
- *
1551
- * Use when constructing or inspecting AST nodes for structs or records rather
1552
- * than array-like schemas.
1553
- *
1554
- * **Details**
1555
- *
1556
- * - `propertySignatures` — named properties with their types (struct fields).
1557
- * - `indexSignatures` — index signature entries (record patterns), each with
1558
- * a `parameter` AST for matching keys and a `type` AST for values.
1559
- *
1560
- * An `Objects` node with no properties and no index signatures performs only a
1561
- * non-nullish check: it accepts any value except `null` and `undefined`,
1562
- * including primitive values.
1563
- *
1564
- * **Gotchas**
1565
- *
1566
- * Duplicate property names throw at construction time.
1567
- *
1568
- * **Example** (Inspecting a struct AST)
1344
+ * Constructs a {@link Objects}.
1569
1345
  *
1570
- * ```ts import.meta.vitest
1571
- * import { Schema, SchemaAST } from "effect"
1572
- *
1573
- * const schema = Schema.Struct({ name: Schema.String })
1574
- * const ast = schema.ast
1575
- *
1576
- * if (SchemaAST.isObjects(ast)) {
1577
- * ast.propertySignatures.map((ps) => [ps.name, ps.type._tag]) // => [["name", "String"]]
1578
- * }
1579
- * ```
1580
- *
1581
- * @see {@link isObjects}
1582
- * @see {@link PropertySignature}
1583
- * @see {@link IndexSignature}
1584
- * @see {@link Arrays}
1585
- * @category models
1346
+ * @category constructors
1586
1347
  * @since 4.0.0
1587
1348
  */
1588
- export class Objects extends Base {
1349
+ export const Objects = class extends ASTNodeImpl {
1589
1350
  _tag = "Objects";
1590
1351
  propertySignatures;
1591
1352
  indexSignatures;
@@ -1607,7 +1368,7 @@ export class Objects extends Base {
1607
1368
  const ast = this;
1608
1369
  const expectedKeys = [];
1609
1370
  for (const ps of ast.propertySignatures) {
1610
- expectedKeys.push(ps.name);
1371
+ expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name);
1611
1372
  }
1612
1373
  const hasProperties = expectedKeys.length;
1613
1374
  const indexCount = ast.indexSignatures.length;
@@ -1626,7 +1387,7 @@ export class Objects extends Base {
1626
1387
  }
1627
1388
  const value = exitValue === InternalParser.sameExit ? inputValue : exitValue[InternalParser.args];
1628
1389
  if (k2 !== InternalParser.missing && value !== InternalParser.missing) {
1629
- if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(k2))) return Exit.void;
1390
+ if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(typeof k2 === "number" ? globalThis.String(k2) : k2))) return Exit.void;
1630
1391
  InternalRecord.assignProperty(s.out, k2, value);
1631
1392
  }
1632
1393
  return Exit.void;
@@ -1652,18 +1413,11 @@ export class Objects extends Base {
1652
1413
  const result = index.parserValue(inputValue, s.options);
1653
1414
  return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : Effect.flatMap(Effect.exit(result), exit => finishIndex(s, key, key, inputValue, exit));
1654
1415
  };
1655
- const parseIndexes = indexCount ? iterateEager()({
1656
- onItem: (s, [key, index]) => parseIndex(s, key, index),
1657
- step: (_s, _, exit) => exit._tag === "Failure" ? exit : undefined
1416
+ const parseIndexes = indexCount ? iterateConcurrent()({
1417
+ onItem: (s, [key, index]) => index.is.parameter === string ? parseStringIndex(s, key, index) : parseIndex(s, key, index),
1418
+ step: (_s, _item, exit) => exit._tag === "Failure" ? exit : undefined
1658
1419
  }) : undefined;
1659
- return Effect.fnUntracedEager(function* (input, options) {
1660
- if (input === InternalParser.missing) {
1661
- return InternalParser.missing;
1662
- }
1663
- // If the input is not a record, return early with an error
1664
- if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
1665
- return yield* Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
1666
- }
1420
+ const compileMembers = () => {
1667
1421
  if (!properties) {
1668
1422
  properties = ast.propertySignatures.map(ps => ({
1669
1423
  parser: compileConstructorDefault(ps.type),
@@ -1676,6 +1430,17 @@ export class Objects extends Base {
1676
1430
  parserValue: compileConstructorDefault(is.type)
1677
1431
  })) : undefined;
1678
1432
  }
1433
+ return properties;
1434
+ };
1435
+ const fallback = Effect.fnUntracedEager(function* (input, options) {
1436
+ if (input === InternalParser.missing) {
1437
+ return InternalParser.missing;
1438
+ }
1439
+ // If the input is not a record, return early with an error
1440
+ if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
1441
+ return yield* Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
1442
+ }
1443
+ compileMembers();
1679
1444
  const record = input;
1680
1445
  const out = {};
1681
1446
  const state = {
@@ -1687,54 +1452,56 @@ export class Objects extends Base {
1687
1452
  };
1688
1453
  const errorsAllOption = options.errors === "all";
1689
1454
  const onExcessPropertyError = options.onExcessProperty === "error";
1690
- const onExcessPropertyPreserve = options.onExcessProperty === "preserve";
1455
+ const concurrency = options.concurrency === undefined ? 1 : resolveConcurrency(options.concurrency);
1691
1456
  // ---------------------------------------------
1692
1457
  // handle excess properties
1693
1458
  // ---------------------------------------------
1694
- let inputKeys;
1695
- if (!indexCount && (onExcessPropertyError || onExcessPropertyPreserve)) {
1459
+ const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map(index => getIndexSignatureKeys(record, index.parameter, options)) : undefined;
1460
+ if (onExcessPropertyError) {
1696
1461
  expectedKeysSet ??= new Set(expectedKeys);
1697
- inputKeys = Reflect.ownKeys(record);
1462
+ const coveredKeys = indexKeys ? new Set(expectedKeysSet) : expectedKeysSet;
1463
+ if (indexKeys) {
1464
+ for (const keys of indexKeys) {
1465
+ for (const key of keys) coveredKeys.add(key);
1466
+ }
1467
+ }
1468
+ const inputKeys = Reflect.ownKeys(record);
1698
1469
  for (let i = 0; i < inputKeys.length; i++) {
1699
1470
  const key = inputKeys[i];
1700
- if (!expectedKeysSet.has(key)) {
1471
+ if (!coveredKeys.has(key)) {
1701
1472
  // key is unexpected
1702
- if (onExcessPropertyError) {
1703
- const unexpected = new SchemaIssue.UnexpectedKey(ast, record[key], options);
1704
- const issue = new SchemaIssue.Pointer([key], unexpected);
1705
- if (errorsAllOption) {
1706
- if (state.issues) {
1707
- state.issues.push(issue);
1708
- } else {
1709
- state.issues = [issue];
1710
- }
1711
- continue;
1473
+ const unexpected = new SchemaIssue.UnexpectedKey(ast, record[key], options);
1474
+ const issue = new SchemaIssue.Pointer([key], unexpected);
1475
+ if (errorsAllOption) {
1476
+ if (state.issues) {
1477
+ state.issues.push(issue);
1712
1478
  } else {
1713
- return yield* Effect.fail(new SchemaIssue.Composite(ast, [issue], input, options));
1479
+ state.issues = [issue];
1714
1480
  }
1481
+ continue;
1715
1482
  } else {
1716
- // preserve key
1717
- InternalRecord.assignProperty(out, key, record[key]);
1483
+ return yield* Effect.fail(new SchemaIssue.Composite(ast, [issue], input, options));
1718
1484
  }
1719
1485
  }
1720
1486
  }
1721
1487
  }
1722
- const concurrency = resolveConcurrency(options?.concurrency);
1723
1488
  // ---------------------------------------------
1724
1489
  // handle property signatures
1725
1490
  // ---------------------------------------------
1726
1491
  if (hasProperties) {
1727
- const eff = parseProperties(state, properties, concurrency);
1492
+ const eff = concurrency === 1 ? parseProperties(state, properties) : parsePropertiesConcurrent(state, properties, {
1493
+ concurrency
1494
+ });
1728
1495
  if (eff) yield* eff;
1729
1496
  }
1730
1497
  // ---------------------------------------------
1731
1498
  // handle index signatures
1732
1499
  // ---------------------------------------------
1733
- if (indexCount && !concurrency) {
1500
+ if (indexCount && concurrency === 1) {
1734
1501
  for (let i = 0; i < indexCount; i++) {
1735
1502
  const index = indexes[i];
1736
1503
  const parse = index.is.parameter === string ? parseStringIndex : parseIndex;
1737
- const keys = index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options);
1504
+ const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
1738
1505
  for (let j = 0; j < keys.length; j++) {
1739
1506
  const eff = parse(state, keys[j], index);
1740
1507
  if (!effectIsExit(eff)) yield* eff;else if (eff._tag === "Failure") return yield* eff;
@@ -1744,30 +1511,77 @@ export class Objects extends Base {
1744
1511
  const keyPairs = Arr.empty();
1745
1512
  for (let i = 0; i < indexCount; i++) {
1746
1513
  const index = indexes[i];
1747
- const keys = getIndexSignatureKeys(record, index.is.parameter, options);
1514
+ const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
1748
1515
  for (let j = 0; j < keys.length; j++) {
1749
1516
  keyPairs.push([keys[j], index]);
1750
1517
  }
1751
1518
  }
1752
- const eff = parseIndexes(state, keyPairs, concurrency);
1519
+ const eff = parseIndexes(state, keyPairs, {
1520
+ concurrency
1521
+ });
1753
1522
  if (eff) yield* eff;
1754
1523
  }
1755
1524
  if (state.issues) {
1756
1525
  return yield* Effect.fail(new SchemaIssue.Composite(ast, state.issues, input, options));
1757
1526
  }
1758
- if (options.propertyOrder === "original") {
1759
- // preserve input keys order
1760
- const keys = (inputKeys ?? Reflect.ownKeys(record)).concat(expectedKeys);
1761
- const preserved = {};
1762
- for (const key of keys) {
1763
- if (Object.hasOwn(out, key)) {
1764
- InternalRecord.assignProperty(preserved, key, out[key]);
1527
+ return out;
1528
+ });
1529
+ if (indexCount) return fallback;
1530
+ // Resumes at the property whose parser suspended, without replaying the
1531
+ // properties already parsed.
1532
+ const resume = (state, index, pending) => {
1533
+ const property = properties[index];
1534
+ return Effect.flatMap(Effect.exit(pending), exit => {
1535
+ const terminal = stepProperty(state, property, exit);
1536
+ if (terminal) return terminal;
1537
+ const done = () => InternalParser.succeed(state.out);
1538
+ const eff = parseProperties(state, properties.slice(index + 1));
1539
+ return eff ? Effect.flatMapEager(eff, done) : done();
1540
+ });
1541
+ };
1542
+ // Fast path: a struct without index signatures, under the default parse
1543
+ // options, needs none of the generator the fallback runs per value.
1544
+ return (input, options) => {
1545
+ if (input === InternalParser.missing) return InternalParser.missingExit;
1546
+ if (options.errors === "all" || options.onExcessProperty !== undefined || options.concurrency !== undefined && resolveConcurrency(options.concurrency) !== 1) {
1547
+ return fallback(input, options);
1548
+ }
1549
+ if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
1550
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
1551
+ }
1552
+ const props = compileMembers();
1553
+ const record = input;
1554
+ const out = {};
1555
+ const state = {
1556
+ ast,
1557
+ input: record,
1558
+ out,
1559
+ issues: undefined,
1560
+ options
1561
+ };
1562
+ try {
1563
+ for (let index = 0; index < props.length; index++) {
1564
+ const property = props[index];
1565
+ const name = property.name;
1566
+ const hasKey = hasPropertySignature(record, name);
1567
+ const value = hasKey ? record[name] : InternalParser.missing;
1568
+ const exit = property.parser(value, options);
1569
+ if (!effectIsExit(exit)) {
1570
+ return resume(state, index, exit);
1571
+ }
1572
+ if (exit === InternalParser.sameExit) {
1573
+ if (hasKey) InternalRecord.assignProperty(out, name, value);
1574
+ continue;
1765
1575
  }
1576
+ const terminal = stepProperty(state, property, exit);
1577
+ if (terminal) return terminal;
1766
1578
  }
1767
- return preserved;
1579
+ } catch (error) {
1580
+ // `Effect.fnUntracedEager` turns a synchronous throw into a defect
1581
+ return Effect.die(error);
1768
1582
  }
1769
- return out;
1770
- });
1583
+ return InternalParser.succeed(out);
1584
+ };
1771
1585
  }
1772
1586
  _rebuild(recur, recurParameter, checks, encodingChecks) {
1773
1587
  const props = mapOrSame(this.propertySignatures, ps => {
@@ -1794,38 +1608,41 @@ export class Objects extends Base {
1794
1608
  if (this.propertySignatures.length === 0 && this.indexSignatures.length === 0) return "object | array";
1795
1609
  return "object";
1796
1610
  }
1611
+ };
1612
+ function stepProperty(s, p, exit) {
1613
+ if (exit._tag === "Failure") {
1614
+ return wrapPropertyKeyIssue(s, s.ast, p.name, exit);
1615
+ }
1616
+ if (exit === InternalParser.sameExit) return;
1617
+ const value = exit[InternalParser.args];
1618
+ if (value !== InternalParser.missing) {
1619
+ InternalRecord.assignProperty(s.out, p.name, value);
1620
+ return;
1621
+ }
1622
+ delete s.out[p.name];
1623
+ if (!isOptional(p.type)) {
1624
+ const issue = new SchemaIssue.Pointer([p.name], new SchemaIssue.MissingKey(p.type.context?.annotations));
1625
+ if (s.options.errors === "all") {
1626
+ if (s.issues) s.issues.push(issue);else s.issues = [issue];
1627
+ return;
1628
+ } else {
1629
+ return Exit.fail(new SchemaIssue.Composite(s.ast, [issue], s.input, s.options));
1630
+ }
1631
+ }
1797
1632
  }
1798
- const parseProperties = /*#__PURE__*/iterateEager()({
1633
+ const parsePropertiesOptions = {
1799
1634
  onItem(s, p) {
1800
- if (!Object.hasOwn(s.input, p.name)) {
1635
+ if (!hasPropertySignature(s.input, p.name)) {
1801
1636
  return p.parser(InternalParser.missing, s.options);
1802
1637
  }
1803
1638
  const value = s.input[p.name];
1804
1639
  InternalRecord.assignProperty(s.out, p.name, value);
1805
1640
  return p.parser(value, s.options);
1806
1641
  },
1807
- step(s, p, exit) {
1808
- if (exit._tag === "Failure") {
1809
- return wrapPropertyKeyIssue(s, s.ast, p.name, exit);
1810
- }
1811
- if (exit === InternalParser.sameExit) return;
1812
- const value = exit[InternalParser.args];
1813
- if (value !== InternalParser.missing) {
1814
- InternalRecord.assignProperty(s.out, p.name, value);
1815
- return;
1816
- }
1817
- delete s.out[p.name];
1818
- if (!isOptional(p.type)) {
1819
- const issue = new SchemaIssue.Pointer([p.name], new SchemaIssue.MissingKey(p.type.context?.annotations));
1820
- if (s.options.errors === "all") {
1821
- if (s.issues) s.issues.push(issue);else s.issues = [issue];
1822
- return;
1823
- } else {
1824
- return Exit.fail(new SchemaIssue.Composite(s.ast, [issue], s.input, s.options));
1825
- }
1826
- }
1827
- }
1828
- });
1642
+ step: stepProperty
1643
+ };
1644
+ const parseProperties = /*#__PURE__*/iterateEager()(parsePropertiesOptions);
1645
+ const parsePropertiesConcurrent = /*#__PURE__*/iterateConcurrent()(parsePropertiesOptions);
1829
1646
  function combineChecks(a, b) {
1830
1647
  if (!a) return b;
1831
1648
  if (!b) return a;
@@ -1846,8 +1663,8 @@ export function tuple(elements, checks = undefined) {
1846
1663
  return new Arrays(false, elements.map(e => e.ast), [], undefined, checks);
1847
1664
  }
1848
1665
  /** @internal */
1849
- export function union(members, mode, checks) {
1850
- return new Union(members.map(getAST), mode, undefined, checks);
1666
+ export function union(members, options, checks) {
1667
+ return new Union(members.map(getAST), options, undefined, checks);
1851
1668
  }
1852
1669
  /** @internal */
1853
1670
  export function structWithRest(ast, records) {
@@ -1871,6 +1688,13 @@ export function tupleWithRest(ast, rest) {
1871
1688
  }
1872
1689
  return new Arrays(ast.isMutable, ast.elements, rest, undefined, ast.checks);
1873
1690
  }
1691
+ /** @internal */
1692
+ export function mutable(ast) {
1693
+ if (ast.encoding) {
1694
+ throw new Error("mutable does not support encodings");
1695
+ }
1696
+ return new Arrays(true, ast.elements, ast.rest, ast.annotations, ast.checks, undefined, ast.context, ast.encodingChecks);
1697
+ }
1874
1698
  const toCandidate = /*#__PURE__*/memoizeIdempotent(ast => {
1875
1699
  while (true) {
1876
1700
  if (isSuspend(ast)) return unknown;
@@ -1976,6 +1800,7 @@ export function collectSentinels(ast) {
1976
1800
  }
1977
1801
  const candidateIndexCache = /*#__PURE__*/new WeakMap();
1978
1802
  const emptyCandidates = /*#__PURE__*/Object.freeze([]);
1803
+ const hasPropertySignature = (input, key) => key === "__proto__" ? Object.hasOwn(input, key) : key in input;
1979
1804
  function getIndex(types) {
1980
1805
  let index = candidateIndexCache.get(types);
1981
1806
  if (index) return index;
@@ -2033,7 +1858,7 @@ function getIndex(types) {
2033
1858
  }
2034
1859
  index = (input, isConstructor) => {
2035
1860
  if (Predicate.isObjectKeyword(input)) {
2036
- const value = Object.hasOwn(input, key) ? input[key] : undefined;
1861
+ const value = hasPropertySignature(input, key) ? input[key] : undefined;
2037
1862
  if (value !== undefined) return candidates.get(value) ?? emptyCandidates;
2038
1863
  if (isConstructor) return types;
2039
1864
  }
@@ -2060,7 +1885,7 @@ function getIndex(types) {
2060
1885
  // discriminated candidate.
2061
1886
  if (commonSentinel) {
2062
1887
  const [key, [byValue]] = commonSentinel;
2063
- const hasKey = Object.hasOwn(input, key);
1888
+ const hasKey = hasPropertySignature(input, key);
2064
1889
  const value = hasKey ? input[key] : undefined;
2065
1890
  if (hasKey && (!isConstructor || value !== undefined)) {
2066
1891
  const match = byValue.get(value);
@@ -2073,7 +1898,7 @@ function getIndex(types) {
2073
1898
  // absent and undefined keys as unconstrained and therefore selects every candidate that owns the key.
2074
1899
  if (directKey === undefined) {
2075
1900
  for (const [key, [byValue, all]] of bySentinel) {
2076
- const hasKey = Object.hasOwn(input, key);
1901
+ const hasKey = hasPropertySignature(input, key);
2077
1902
  const value = hasKey ? input[key] : undefined;
2078
1903
  if (hasKey && (!isConstructor || value !== undefined)) {
2079
1904
  const match = byValue.get(value);
@@ -2088,7 +1913,7 @@ function getIndex(types) {
2088
1913
  // Missing keys are neutral. An observed key rejects only selected candidates that own it and do not match.
2089
1914
  for (const [key, [byValue, all]] of bySentinel) {
2090
1915
  if (key === directKey) continue;
2091
- const hasKey = Object.hasOwn(input, key);
1916
+ const hasKey = hasPropertySignature(input, key);
2092
1917
  const value = hasKey ? input[key] : undefined;
2093
1918
  if (hasKey && (!isConstructor || value !== undefined)) {
2094
1919
  const match = byValue.get(value);
@@ -2124,44 +1949,20 @@ export function getCandidates(input, types, isConstructor = false) {
2124
1949
  return getIndex(types)(input, isConstructor);
2125
1950
  }
2126
1951
  /**
2127
- * AST node representing a union of schemas.
2128
- *
2129
- * **Details**
2130
- *
2131
- * - `types` — the member AST nodes.
2132
- * - `mode` — `"anyOf"` succeeds on the first match (like TypeScript unions);
2133
- * `"oneOf"` requires exactly one member to match (fails if multiple do).
2134
- *
2135
- * During parsing, members are tried in order. An internal candidate index
2136
- * narrows which members to try based on the runtime type of the input and
2137
- * discriminant ("sentinel") fields, making large unions efficient.
2138
- *
2139
- * **Example** (Inspecting a union AST)
2140
- *
2141
- * ```ts import.meta.vitest
2142
- * import { Schema, SchemaAST } from "effect"
2143
- *
2144
- * const schema = Schema.Union([Schema.String, Schema.Number])
2145
- * const ast = schema.ast
1952
+ * Constructs a {@link Union}.
2146
1953
  *
2147
- * if (SchemaAST.isUnion(ast)) {
2148
- * [ast.types.length, ast.mode] // => [2, "anyOf"]
2149
- * }
2150
- * ```
2151
- *
2152
- * @see {@link isUnion}
2153
- * @category models
2154
- * @since 3.10.0
1954
+ * @category constructors
1955
+ * @since 4.0.0
2155
1956
  */
2156
- export class Union extends Base {
1957
+ export const Union = class extends ASTNodeImpl {
2157
1958
  _tag = "Union";
2158
1959
  types;
2159
- mode;
1960
+ options;
2160
1961
  encodingChecks;
2161
- constructor(types, mode, annotations, checks, encoding, context, encodingChecks) {
1962
+ constructor(types, options, annotations, checks, encoding, context, encodingChecks) {
2162
1963
  super(annotations, checks, encoding, context);
2163
1964
  this.types = types;
2164
- this.mode = mode;
1965
+ this.options = options;
2165
1966
  this.encodingChecks = encodingChecks;
2166
1967
  }
2167
1968
  /** @internal */
@@ -2173,6 +1974,9 @@ export class Union extends Base {
2173
1974
  return InternalParser.missingExit;
2174
1975
  }
2175
1976
  const candidates = getCandidates(input, ast.types, compileConstructorDefault !== undefined);
1977
+ if (candidates.length === 0) {
1978
+ return Effect.fail(new SchemaIssue.AnyOf(ast, [], input, options));
1979
+ }
2176
1980
  if (candidates.length === 1) {
2177
1981
  const result = compile(candidates[0])(input, options);
2178
1982
  if (result._tag === "Success") return result;
@@ -2183,15 +1987,11 @@ export class Union extends Base {
2183
1987
  compile,
2184
1988
  input,
2185
1989
  out: undefined,
2186
- successes: ast.mode === "oneOf" ? [] : undefined,
1990
+ successes: ast.options?.mode === "oneOf" ? [] : undefined,
2187
1991
  issues: undefined,
2188
1992
  options
2189
1993
  };
2190
- const concurrency = resolveConcurrency(options?.concurrency);
2191
- const eff = parseUnion(state, candidates, concurrency ? {
2192
- ...concurrency,
2193
- orderedStep: true
2194
- } : undefined);
1994
+ const eff = parseUnion(state, candidates);
2195
1995
  if (!eff) {
2196
1996
  if (state.out) return state.out;
2197
1997
  return Effect.fail(new SchemaIssue.AnyOf(ast, state.issues ?? [], input, options));
@@ -2205,7 +2005,7 @@ export class Union extends Base {
2205
2005
  }
2206
2006
  _rebuild(recur, checks, encodingChecks) {
2207
2007
  const types = mapOrSame(this.types, recur);
2208
- return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Union(types, this.mode, this.annotations, checks, undefined, this.context, encodingChecks);
2008
+ return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Union(types, this.options, this.annotations, checks, undefined, this.context, encodingChecks);
2209
2009
  }
2210
2010
  /** @internal */
2211
2011
  recur(recur) {
@@ -2252,7 +2052,7 @@ export class Union extends Base {
2252
2052
  });
2253
2053
  return Array.from(new Set(types)).join(" | ");
2254
2054
  }
2255
- }
2055
+ };
2256
2056
  function failSingleUnionCandidate(ast, cause, input, options) {
2257
2057
  const issue = InternalSchemaCause.getSchemaIssue(cause);
2258
2058
  if (!issue) return Exit.failCause(cause);
@@ -2284,7 +2084,7 @@ const parseUnion = /*#__PURE__*/iterateEager()({
2284
2084
  }
2285
2085
  }
2286
2086
  });
2287
- const nonFiniteLiterals = /*#__PURE__*/new Union([/*#__PURE__*/new Literal("Infinity"), /*#__PURE__*/new Literal("-Infinity"), /*#__PURE__*/new Literal("NaN")], "anyOf");
2087
+ const nonFiniteLiterals = /*#__PURE__*/new Union([/*#__PURE__*/new Literal("Infinity"), /*#__PURE__*/new Literal("-Infinity"), /*#__PURE__*/new Literal("NaN")]);
2288
2088
  function formatIsMutable(isMutable) {
2289
2089
  return isMutable ? "" : "readonly ";
2290
2090
  }
@@ -2305,37 +2105,12 @@ export function memoizeThunk(f) {
2305
2105
  };
2306
2106
  }
2307
2107
  /**
2308
- * AST node for lazy/recursive schemas.
2309
- *
2310
- * **Details**
2311
- *
2312
- * Wraps a thunk (`() => AST`) that is memoized on first call. Use this to
2313
- * define recursive or mutually recursive schemas without infinite loops at
2314
- * construction time.
2108
+ * Constructs a {@link Suspend}.
2315
2109
  *
2316
- * **Example** (Defining recursive schema ASTs)
2317
- *
2318
- * ```ts import.meta.vitest
2319
- * import { Schema, SchemaAST } from "effect"
2320
- *
2321
- * interface Category {
2322
- * readonly name: string
2323
- * readonly children: ReadonlyArray<Category>
2324
- * }
2325
- *
2326
- * const Category = Schema.Struct({
2327
- * name: Schema.String,
2328
- * children: Schema.Array(Schema.suspend((): Schema.Codec<Category> => Category))
2329
- * })
2330
- *
2331
- * SchemaAST.isObjects(Category.ast) // => true
2332
- * ```
2333
- *
2334
- * @see {@link isSuspend}
2335
- * @category models
2336
- * @since 3.10.0
2110
+ * @category constructors
2111
+ * @since 4.0.0
2337
2112
  */
2338
- export class Suspend extends Base {
2113
+ export const Suspend = class extends ASTNodeImpl {
2339
2114
  _tag = "Suspend";
2340
2115
  thunk;
2341
2116
  constructor(thunk, annotations, checks, encoding, context) {
@@ -2358,32 +2133,14 @@ export class Suspend extends Base {
2358
2133
  getExpected(getExpected) {
2359
2134
  return getExpected(this.thunk());
2360
2135
  }
2361
- }
2362
- // -----------------------------------------------------------------------------
2363
- // Checks
2364
- // -----------------------------------------------------------------------------
2136
+ };
2365
2137
  /**
2366
- * Represents a single validation check attached to an AST node.
2367
- *
2368
- * **Details**
2369
- *
2370
- * - `run` — the validation function. Returns `undefined` on success, or an
2371
- * `Issue` on failure.
2372
- * - `annotations` — optional filter-level annotations (expected message,
2373
- * representation, arbitrary constraint hints).
2374
- * - `aborted` — when `true`, parsing stops immediately after this filter
2375
- * fails (no further checks run).
2376
- *
2377
- * Use `.annotate()` to add metadata and `.abort()` to mark as aborting.
2378
- * Combine with another check via `.and()` to form a {@link FilterGroup}.
2138
+ * Constructs a {@link Filter}.
2379
2139
  *
2380
- * @see {@link FilterGroup}
2381
- * @see {@link Check}
2382
- * @see {@link isPattern}
2383
- * @category models
2140
+ * @category constructors
2384
2141
  * @since 4.0.0
2385
2142
  */
2386
- export class Filter extends Pipeable.Class {
2143
+ export const Filter = class extends Pipeable.Class {
2387
2144
  _tag = "Filter";
2388
2145
  run;
2389
2146
  annotations;
@@ -2413,22 +2170,14 @@ export class Filter extends Pipeable.Class {
2413
2170
  and(other, annotations) {
2414
2171
  return new FilterGroup([this, other], annotations);
2415
2172
  }
2416
- }
2173
+ };
2417
2174
  /**
2418
- * Represents a composite validation check grouping multiple {@link Check} values.
2419
- *
2420
- * **Details**
2175
+ * Constructs a {@link FilterGroup}.
2421
2176
  *
2422
- * Created by calling `.and()` on a {@link Filter} or another `FilterGroup`.
2423
- * All inner checks are run; failures from aborted filters still stop
2424
- * evaluation.
2425
- *
2426
- * @see {@link Filter}
2427
- * @see {@link Check}
2428
- * @category models
2177
+ * @category constructors
2429
2178
  * @since 4.0.0
2430
2179
  */
2431
- export class FilterGroup extends Pipeable.Class {
2180
+ export const FilterGroup = class extends Pipeable.Class {
2432
2181
  _tag = "FilterGroup";
2433
2182
  checks;
2434
2183
  annotations;
@@ -2446,7 +2195,7 @@ export class FilterGroup extends Pipeable.Class {
2446
2195
  and(other, annotations) {
2447
2196
  return new FilterGroup([this, other], annotations);
2448
2197
  }
2449
- }
2198
+ };
2450
2199
  /** @internal */
2451
2200
  export function makeFilter(filter, annotations, aborted = false) {
2452
2201
  return new Filter((input, ast, options) => SchemaIssue.normalizeFilterOutput(ast, filter(input, ast, options), input, options), annotations, aborted);
@@ -2470,18 +2219,15 @@ export function isFinite(annotations) {
2470
2219
  toCode: () => ({
2471
2220
  runtime: "Schema.isFinite()"
2472
2221
  }),
2473
- arbitrary: {
2474
- constraint: {
2475
- noInfinity: true,
2476
- noNaN: true
2477
- }
2222
+ arbitraryConstraint: {
2223
+ number: "finite"
2478
2224
  },
2479
2225
  ...annotations
2480
2226
  });
2481
2227
  }
2482
2228
  /** @internal */
2483
2229
  export const finite = /*#__PURE__*/appendChecks(number, [/*#__PURE__*/isFinite()]);
2484
- const numberToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finite, nonFiniteLiterals], "anyOf"), /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.Number(), /*#__PURE__*/SchemaGetter.transform(n => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
2230
+ const numberToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finite, nonFiniteLiterals]), /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.Number(), /*#__PURE__*/SchemaGetter.transform(n => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
2485
2231
  /**
2486
2232
  * Creates a {@link Filter} that validates strings by running `RegExp.test`.
2487
2233
  *
@@ -2501,8 +2247,12 @@ const numberToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finite, nonFi
2501
2247
  *
2502
2248
  * **Gotchas**
2503
2249
  *
2504
- * When deriving an arbitrary, only `regExp.source` is used. Regular expression
2505
- * flags are ignored because fast-check does not support them.
2250
+ * Arbitrary metadata preserves both `regExp.source` and `regExp.flags`.
2251
+ * Implementations that cannot consume all flags may still use the source as a
2252
+ * generation hint because the Schema filter validates every generated value.
2253
+ * JSON Schema has no way to carry JavaScript regular-expression flags. The
2254
+ * generated `pattern` contains the source only, so validation can differ when
2255
+ * the RegExp uses flags or relies on JavaScript's non-Unicode behavior.
2506
2256
  *
2507
2257
  * **Example** (Validating an email pattern)
2508
2258
  *
@@ -2536,10 +2286,11 @@ export function isPattern(regExp, annotations) {
2536
2286
  toJsonSchema: () => ({
2537
2287
  pattern: source
2538
2288
  }),
2539
- arbitrary: {
2540
- constraint: {
2541
- patterns: [regExp.source]
2542
- }
2289
+ arbitraryConstraint: {
2290
+ patterns: [{
2291
+ source: regExp.source,
2292
+ flags: regExp.flags
2293
+ }]
2543
2294
  },
2544
2295
  ...annotations
2545
2296
  });
@@ -2696,7 +2447,7 @@ export const optionalKey = /*#__PURE__*/memoizeIdempotent(ast => {
2696
2447
  });
2697
2448
  const optionalKeyLastLink = /*#__PURE__*/applyToLastLink(optionalKey);
2698
2449
  /** @internal */
2699
- export const optional = /*#__PURE__*/memoize(ast => optionalKey(new Union([ast, undefined_], "anyOf")));
2450
+ export const optional = /*#__PURE__*/memoize(ast => optionalKey(new Union([ast, undefined_])));
2700
2451
  /** @internal */
2701
2452
  export const mutableKey = /*#__PURE__*/memoizeIdempotent(ast => {
2702
2453
  const context = ast.context ? ast.context.isMutable === false ? new Context(ast.context.isOptional, true, ast.context.constructorDefault, ast.context.annotations) : ast.context : new Context(false, true);
@@ -2716,9 +2467,8 @@ export function withConstructorDefault(ast, defaultValue) {
2716
2467
  *
2717
2468
  * **Details**
2718
2469
  *
2719
- * This is the low-level primitive behind `Schema.transform` and
2720
- * `Schema.transformOrFail`. It appends a {@link Link} to the `to` node's
2721
- * encoding chain.
2470
+ * This is the low-level primitive behind `Schema.decodeTo`. It appends a
2471
+ * {@link Link} to the `to` node's encoding chain.
2722
2472
  *
2723
2473
  * - Returns a new AST with the same type as `to`.
2724
2474
  *
@@ -2780,7 +2530,7 @@ export function record(key, value) {
2780
2530
  * Checks `ast.context?.isOptional`. Defaults to `false` when no
2781
2531
  * {@link Context} is set.
2782
2532
  *
2783
- * @see {@link optionalKey}
2533
+ * @see `Schema.optionalKey`
2784
2534
  * @see {@link Context}
2785
2535
  * @category predicates
2786
2536
  * @since 4.0.0
@@ -2924,7 +2674,7 @@ export function containsUndefined(ast) {
2924
2674
  }
2925
2675
  }
2926
2676
  function fromConst(ast, value) {
2927
- const succeed = InternalParser.succeed(value);
2677
+ const succeed = value === 0 ? InternalParser.sameExit : InternalParser.succeed(value);
2928
2678
  return (input, options) => {
2929
2679
  if (input === InternalParser.missing) return InternalParser.missingExit;
2930
2680
  if (input === value) return succeed;
@@ -2986,12 +2736,6 @@ function segmentTemplateLiteralParts(ast, input, options) {
2986
2736
  }
2987
2737
  return go(0, 0) ? out : undefined;
2988
2738
  }
2989
- /** @internal */
2990
- export const enumsToLiterals = /*#__PURE__*/memoize(ast => {
2991
- return new Union(ast.enums.map(e => new Literal(e[1], {
2992
- title: e[0]
2993
- })), "anyOf");
2994
- });
2995
2739
  const parameterFromPropertyKey = /*#__PURE__*/applyToSelfOrLastLinkEncodingIdempotent(ast => {
2996
2740
  switch (ast._tag) {
2997
2741
  default:
@@ -3049,7 +2793,7 @@ export function isStringFinite(annotations) {
3049
2793
  }
3050
2794
  const finiteString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringFinite()]);
3051
2795
  const finiteToString = /*#__PURE__*/new Link(finiteString, SchemaTransformation.numberFromString);
3052
- const numberToString = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finiteString, nonFiniteLiterals], "anyOf"), SchemaTransformation.numberFromString);
2796
+ const numberToString = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finiteString, nonFiniteLiterals]), SchemaTransformation.numberFromString);
3053
2797
  /**
3054
2798
  * signed integer only (no leading "+" because TypeScript doesn't support it)
3055
2799
  */
@@ -3074,14 +2818,14 @@ export const bigIntString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isSt
3074
2818
  expected: "a string representing a bigint"
3075
2819
  })]);
3076
2820
  const bigIntToString = /*#__PURE__*/new Link(bigIntString, SchemaTransformation.bigintFromString);
3077
- const REGEXP_PATTERN = "Symbol\\((.*)\\)";
2821
+ const REGEXP_PATTERN = "Symbol\\(([\\s\\S]*)\\)";
3078
2822
  const isStringSymbolRegExp = /*#__PURE__*/new globalThis.RegExp(`^${REGEXP_PATTERN}$`);
3079
2823
  /** @internal */
3080
2824
  export const symbolString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringSymbol()]);
3081
2825
  /**
3082
2826
  * to distinguish between Symbol and String, we need to add a check to the string keyword
3083
2827
  */
3084
- const symbolToString = /*#__PURE__*/new Link(symbolString, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(description => globalThis.Symbol.for(isStringSymbolRegExp.exec(description)[1])), /*#__PURE__*/SchemaGetter.transformOrFail((sym, options) => {
2828
+ const symbolToString = /*#__PURE__*/new Link(symbolString, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(description => globalThis.Symbol.for(isStringSymbolRegExp.exec(description)[1])), /*#__PURE__*/SchemaGetter.transformEffect((sym, options) => {
3085
2829
  const key = globalThis.Symbol.keyFor(sym);
3086
2830
  if (key !== undefined) {
3087
2831
  return Effect.succeed(globalThis.String(sym));
@@ -3150,7 +2894,7 @@ export function getConstructorDescriptor(ast) {
3150
2894
  *
3151
2895
  * If the node has {@link Checks}, returns annotations from the last check
3152
2896
  * (which is where user-supplied annotations end up after `.pipe(Schema.annotations(...))`).
3153
- * Otherwise returns `Base.annotations` directly.
2897
+ * Otherwise returns the node's `annotations` directly.
3154
2898
  *
3155
2899
  * **Example** (Reading annotations)
3156
2900
  *
@@ -3297,8 +3041,7 @@ export const Json = /*#__PURE__*/new Declaration([], () => (input, ast, options)
3297
3041
  },
3298
3042
  expected: "JSON value",
3299
3043
  toCodecJson: () => undefined,
3300
- toCodecStringTree: () => unknownToStringTree,
3301
- toArbitrary: () => fc => fc.jsonValue()
3044
+ toCodecStringTree: () => unknownToStringTree
3302
3045
  });
3303
3046
  /** @internal */
3304
3047
  export const MutableJson = /*#__PURE__*/annotate(Json, {
@@ -3310,7 +3053,7 @@ export const MutableJson = /*#__PURE__*/annotate(Json, {
3310
3053
  /** @internal */
3311
3054
  export const unknownToJson = /*#__PURE__*/new Link(Json, /*#__PURE__*/SchemaTransformation.passthrough());
3312
3055
  /** @internal */
3313
- export const objectKeywordToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([/*#__PURE__*/new Arrays(false, [], [Json]), /*#__PURE__*/new Objects([], [/*#__PURE__*/new IndexSignature(string, Json)])], "anyOf"), /*#__PURE__*/SchemaTransformation.passthrough());
3056
+ export const objectKeywordToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([/*#__PURE__*/new Arrays(false, [], [Json]), /*#__PURE__*/new Objects([], [/*#__PURE__*/new IndexSignature(string, Json)])]), /*#__PURE__*/SchemaTransformation.passthrough());
3314
3057
  /**
3315
3058
  * Returns true if the value is a StringTree value.
3316
3059
  *