effect 4.0.0-rc.112 → 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 (1229) 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 +86 -50
  16. package/dist/Array.d.ts.map +1 -1
  17. package/dist/Array.js +58 -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 +66 -39
  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 +33 -15
  122. package/dist/Iterable.d.ts.map +1 -1
  123. package/dist/Iterable.js +58 -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.js +8 -22
  132. package/dist/JsonSchema.js.map +1 -1
  133. package/dist/Layer.d.ts +47 -4
  134. package/dist/Layer.d.ts.map +1 -1
  135. package/dist/Layer.js +4 -6
  136. package/dist/Layer.js.map +1 -1
  137. package/dist/LayerMap.d.ts +1 -3
  138. package/dist/LayerMap.d.ts.map +1 -1
  139. package/dist/LayerMap.js +7 -5
  140. package/dist/LayerMap.js.map +1 -1
  141. package/dist/LayerRef.d.ts.map +1 -1
  142. package/dist/LayerRef.js +7 -5
  143. package/dist/LayerRef.js.map +1 -1
  144. package/dist/Logger.d.ts +114 -9
  145. package/dist/Logger.d.ts.map +1 -1
  146. package/dist/Logger.js +109 -9
  147. package/dist/Logger.js.map +1 -1
  148. package/dist/ManagedRuntime.js +1 -1
  149. package/dist/ManagedRuntime.js.map +1 -1
  150. package/dist/Match.d.ts +43 -31
  151. package/dist/Match.d.ts.map +1 -1
  152. package/dist/Match.js +5 -2
  153. package/dist/Match.js.map +1 -1
  154. package/dist/Metric.d.ts +11 -4
  155. package/dist/Metric.d.ts.map +1 -1
  156. package/dist/Metric.js +14 -18
  157. package/dist/Metric.js.map +1 -1
  158. package/dist/MutableHashMap.d.ts +1 -1
  159. package/dist/MutableHashMap.d.ts.map +1 -1
  160. package/dist/MutableHashMap.js +1 -1
  161. package/dist/MutableHashMap.js.map +1 -1
  162. package/dist/MutableHashSet.d.ts +1 -1
  163. package/dist/MutableHashSet.d.ts.map +1 -1
  164. package/dist/MutableHashSet.js +1 -1
  165. package/dist/MutableHashSet.js.map +1 -1
  166. package/dist/MutableList.d.ts +13 -2
  167. package/dist/MutableList.d.ts.map +1 -1
  168. package/dist/MutableList.js +18 -2
  169. package/dist/MutableList.js.map +1 -1
  170. package/dist/Number.d.ts +6 -0
  171. package/dist/Number.d.ts.map +1 -1
  172. package/dist/Number.js +3 -1
  173. package/dist/Number.js.map +1 -1
  174. package/dist/Optic.d.ts.map +1 -1
  175. package/dist/Optic.js +5 -4
  176. package/dist/Optic.js.map +1 -1
  177. package/dist/Option.d.ts +1 -1
  178. package/dist/Option.d.ts.map +1 -1
  179. package/dist/Option.js +1 -1
  180. package/dist/Option.js.map +1 -1
  181. package/dist/Order.d.ts +1 -0
  182. package/dist/Order.d.ts.map +1 -1
  183. package/dist/Order.js +3 -1
  184. package/dist/Order.js.map +1 -1
  185. package/dist/PartitionedSemaphore.d.ts.map +1 -1
  186. package/dist/PartitionedSemaphore.js +1 -2
  187. package/dist/PartitionedSemaphore.js.map +1 -1
  188. package/dist/Path.d.ts +1 -1
  189. package/dist/Path.d.ts.map +1 -1
  190. package/dist/Path.js +1 -1
  191. package/dist/Path.js.map +1 -1
  192. package/dist/PlatformError.d.ts +1 -1
  193. package/dist/PlatformError.d.ts.map +1 -1
  194. package/dist/PlatformError.js +1 -1
  195. package/dist/PlatformError.js.map +1 -1
  196. package/dist/Pool.d.ts +38 -1
  197. package/dist/Pool.d.ts.map +1 -1
  198. package/dist/Pool.js +81 -5
  199. package/dist/Pool.js.map +1 -1
  200. package/dist/PrimaryKey.d.ts +1 -1
  201. package/dist/PrimaryKey.d.ts.map +1 -1
  202. package/dist/PrimaryKey.js +1 -1
  203. package/dist/PrimaryKey.js.map +1 -1
  204. package/dist/PubSub.d.ts +21 -9
  205. package/dist/PubSub.d.ts.map +1 -1
  206. package/dist/PubSub.js +18 -14
  207. package/dist/PubSub.js.map +1 -1
  208. package/dist/Queue.d.ts +82 -6
  209. package/dist/Queue.d.ts.map +1 -1
  210. package/dist/Queue.js +116 -27
  211. package/dist/Queue.js.map +1 -1
  212. package/dist/Random.d.ts +17 -4
  213. package/dist/Random.d.ts.map +1 -1
  214. package/dist/Random.js +1 -1
  215. package/dist/Random.js.map +1 -1
  216. package/dist/RcMap.d.ts.map +1 -1
  217. package/dist/RcMap.js +15 -9
  218. package/dist/RcMap.js.map +1 -1
  219. package/dist/Redacted.d.ts +1 -1
  220. package/dist/Redacted.d.ts.map +1 -1
  221. package/dist/Redacted.js +1 -1
  222. package/dist/Redacted.js.map +1 -1
  223. package/dist/RequestResolver.d.ts +15 -9
  224. package/dist/RequestResolver.d.ts.map +1 -1
  225. package/dist/RequestResolver.js +33 -15
  226. package/dist/RequestResolver.js.map +1 -1
  227. package/dist/Result.d.ts +1 -1
  228. package/dist/Result.d.ts.map +1 -1
  229. package/dist/Result.js +1 -1
  230. package/dist/Result.js.map +1 -1
  231. package/dist/Scheduler.d.ts.map +1 -1
  232. package/dist/Scheduler.js +19 -10
  233. package/dist/Scheduler.js.map +1 -1
  234. package/dist/Schema.d.ts +2155 -2415
  235. package/dist/Schema.d.ts.map +1 -1
  236. package/dist/Schema.js +2755 -4174
  237. package/dist/Schema.js.map +1 -1
  238. package/dist/SchemaAST.d.ts +354 -183
  239. package/dist/SchemaAST.d.ts.map +1 -1
  240. package/dist/SchemaAST.js +277 -601
  241. package/dist/SchemaAST.js.map +1 -1
  242. package/dist/SchemaGetter.d.ts +46 -22
  243. package/dist/SchemaGetter.d.ts.map +1 -1
  244. package/dist/SchemaGetter.js +56 -53
  245. package/dist/SchemaGetter.js.map +1 -1
  246. package/dist/SchemaIssue.d.ts +122 -188
  247. package/dist/SchemaIssue.d.ts.map +1 -1
  248. package/dist/SchemaIssue.js +48 -263
  249. package/dist/SchemaIssue.js.map +1 -1
  250. package/dist/SchemaParser.js +2 -9
  251. package/dist/SchemaParser.js.map +1 -1
  252. package/dist/SchemaRepresentation.d.ts +1099 -16
  253. package/dist/SchemaRepresentation.d.ts.map +1 -1
  254. package/dist/SchemaRepresentation.js +1341 -20
  255. package/dist/SchemaRepresentation.js.map +1 -1
  256. package/dist/SchemaTransformation.d.ts +49 -16
  257. package/dist/SchemaTransformation.d.ts.map +1 -1
  258. package/dist/SchemaTransformation.js +75 -98
  259. package/dist/SchemaTransformation.js.map +1 -1
  260. package/dist/ScopedCache.d.ts.map +1 -1
  261. package/dist/ScopedCache.js +10 -3
  262. package/dist/ScopedCache.js.map +1 -1
  263. package/dist/Sink.d.ts +9 -4
  264. package/dist/Sink.d.ts.map +1 -1
  265. package/dist/Sink.js +49 -31
  266. package/dist/Sink.js.map +1 -1
  267. package/dist/Stream.d.ts +221 -35
  268. package/dist/Stream.d.ts.map +1 -1
  269. package/dist/Stream.js +168 -84
  270. package/dist/Stream.js.map +1 -1
  271. package/dist/String.d.ts +16 -6
  272. package/dist/String.d.ts.map +1 -1
  273. package/dist/String.js +12 -5
  274. package/dist/String.js.map +1 -1
  275. package/dist/Struct.d.ts.map +1 -1
  276. package/dist/Struct.js +7 -4
  277. package/dist/Struct.js.map +1 -1
  278. package/dist/SynchronizedRef.d.ts +3 -2
  279. package/dist/SynchronizedRef.d.ts.map +1 -1
  280. package/dist/SynchronizedRef.js.map +1 -1
  281. package/dist/Terminal.d.ts +3 -3
  282. package/dist/Terminal.d.ts.map +1 -1
  283. package/dist/Terminal.js +3 -3
  284. package/dist/Terminal.js.map +1 -1
  285. package/dist/Tracer.d.ts +27 -7
  286. package/dist/Tracer.d.ts.map +1 -1
  287. package/dist/Tracer.js +38 -13
  288. package/dist/Tracer.js.map +1 -1
  289. package/dist/Trie.d.ts +1 -1
  290. package/dist/Trie.d.ts.map +1 -1
  291. package/dist/Tuple.d.ts +2 -1
  292. package/dist/Tuple.d.ts.map +1 -1
  293. package/dist/Tuple.js.map +1 -1
  294. package/dist/TxChunk.d.ts +1 -1
  295. package/dist/TxChunk.d.ts.map +1 -1
  296. package/dist/TxChunk.js +1 -1
  297. package/dist/TxChunk.js.map +1 -1
  298. package/dist/TxDeferred.d.ts +1 -1
  299. package/dist/TxDeferred.d.ts.map +1 -1
  300. package/dist/TxDeferred.js +1 -1
  301. package/dist/TxDeferred.js.map +1 -1
  302. package/dist/TxHashMap.d.ts +1 -1
  303. package/dist/TxHashMap.d.ts.map +1 -1
  304. package/dist/TxHashMap.js +1 -1
  305. package/dist/TxHashMap.js.map +1 -1
  306. package/dist/TxHashSet.d.ts +1 -1
  307. package/dist/TxHashSet.d.ts.map +1 -1
  308. package/dist/TxHashSet.js +1 -1
  309. package/dist/TxHashSet.js.map +1 -1
  310. package/dist/TxPriorityQueue.d.ts +1 -1
  311. package/dist/TxPriorityQueue.d.ts.map +1 -1
  312. package/dist/TxPriorityQueue.js +1 -1
  313. package/dist/TxPriorityQueue.js.map +1 -1
  314. package/dist/TxPubSub.d.ts +1 -1
  315. package/dist/TxPubSub.d.ts.map +1 -1
  316. package/dist/TxPubSub.js +1 -1
  317. package/dist/TxPubSub.js.map +1 -1
  318. package/dist/TxQueue.d.ts +9 -9
  319. package/dist/TxQueue.d.ts.map +1 -1
  320. package/dist/TxQueue.js +93 -86
  321. package/dist/TxQueue.js.map +1 -1
  322. package/dist/TxReentrantLock.d.ts +29 -1
  323. package/dist/TxReentrantLock.d.ts.map +1 -1
  324. package/dist/TxReentrantLock.js +29 -1
  325. package/dist/TxReentrantLock.js.map +1 -1
  326. package/dist/TxRef.d.ts +1 -1
  327. package/dist/TxRef.d.ts.map +1 -1
  328. package/dist/TxRef.js +1 -1
  329. package/dist/TxRef.js.map +1 -1
  330. package/dist/TxSemaphore.d.ts +1 -1
  331. package/dist/TxSemaphore.d.ts.map +1 -1
  332. package/dist/TxSemaphore.js +1 -1
  333. package/dist/TxSemaphore.js.map +1 -1
  334. package/dist/TxSubscriptionRef.d.ts +1 -1
  335. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  336. package/dist/TxSubscriptionRef.js +1 -1
  337. package/dist/TxSubscriptionRef.js.map +1 -1
  338. package/dist/Types.d.ts +33 -19
  339. package/dist/Types.d.ts.map +1 -1
  340. package/dist/Utils.d.ts.map +1 -1
  341. package/dist/Utils.js +2 -1
  342. package/dist/Utils.js.map +1 -1
  343. package/dist/index.d.ts +4 -0
  344. package/dist/index.d.ts.map +1 -1
  345. package/dist/index.js +4 -0
  346. package/dist/index.js.map +1 -1
  347. package/dist/internal/arbitrary/model.d.ts +2 -0
  348. package/dist/internal/arbitrary/model.d.ts.map +1 -0
  349. package/dist/internal/arbitrary/model.js +495 -0
  350. package/dist/internal/arbitrary/model.js.map +1 -0
  351. package/dist/internal/arbitrary/regexp.d.ts +2 -0
  352. package/dist/internal/arbitrary/regexp.d.ts.map +1 -0
  353. package/dist/internal/arbitrary/regexp.js +789 -0
  354. package/dist/internal/arbitrary/regexp.js.map +1 -0
  355. package/dist/internal/arbitrary/runner.d.ts +2 -0
  356. package/dist/internal/arbitrary/runner.d.ts.map +1 -0
  357. package/dist/internal/arbitrary/runner.js +496 -0
  358. package/dist/internal/arbitrary/runner.js.map +1 -0
  359. package/dist/internal/arbitrary/schema.d.ts.map +1 -0
  360. package/dist/internal/arbitrary/schema.js +1340 -0
  361. package/dist/internal/arbitrary/schema.js.map +1 -0
  362. package/dist/internal/core.js +27 -13
  363. package/dist/internal/core.js.map +1 -1
  364. package/dist/internal/count.d.ts +2 -0
  365. package/dist/internal/count.d.ts.map +1 -0
  366. package/dist/internal/count.js +14 -0
  367. package/dist/internal/count.js.map +1 -0
  368. package/dist/internal/dateTime.js +4 -10
  369. package/dist/internal/dateTime.js.map +1 -1
  370. package/dist/internal/effect.js +386 -251
  371. package/dist/internal/effect.js.map +1 -1
  372. package/dist/internal/graph.js +3 -1
  373. package/dist/internal/graph.js.map +1 -1
  374. package/dist/internal/hashMap.js +5 -3
  375. package/dist/internal/hashMap.js.map +1 -1
  376. package/dist/internal/hashSet.js +1 -1
  377. package/dist/internal/hashSet.js.map +1 -1
  378. package/dist/internal/matcher.js +1 -1
  379. package/dist/internal/matcher.js.map +1 -1
  380. package/dist/internal/metric.js +1 -1
  381. package/dist/internal/metric.js.map +1 -1
  382. package/dist/internal/option.js +6 -5
  383. package/dist/internal/option.js.map +1 -1
  384. package/dist/internal/random.js +17 -0
  385. package/dist/internal/random.js.map +1 -1
  386. package/dist/internal/rcRef.js +10 -7
  387. package/dist/internal/rcRef.js.map +1 -1
  388. package/dist/internal/references.js +1 -0
  389. package/dist/internal/references.js.map +1 -1
  390. package/dist/internal/request.js +13 -6
  391. package/dist/internal/request.js.map +1 -1
  392. package/dist/internal/result.js +11 -9
  393. package/dist/internal/result.js.map +1 -1
  394. package/dist/internal/schema/annotations.js +1 -1
  395. package/dist/internal/schema/annotations.js.map +1 -1
  396. package/dist/internal/schema/fromJsonSchemaDocument.js +14 -12
  397. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
  398. package/dist/internal/schema/fromRepresentation.js +5 -5
  399. package/dist/internal/schema/fromRepresentation.js.map +1 -1
  400. package/dist/internal/schema/make.d.ts +2 -0
  401. package/dist/internal/schema/make.d.ts.map +1 -0
  402. package/dist/internal/schema/{schema.js → make.js} +1 -25
  403. package/dist/internal/schema/make.js.map +1 -0
  404. package/dist/internal/schema/parser.d.ts +0 -12
  405. package/dist/internal/schema/parser.d.ts.map +1 -1
  406. package/dist/internal/schema/parser.js +7 -0
  407. package/dist/internal/schema/parser.js.map +1 -1
  408. package/dist/internal/schema/standardSchema.d.ts +2 -0
  409. package/dist/internal/schema/standardSchema.d.ts.map +1 -0
  410. package/dist/internal/schema/standardSchema.js +112 -0
  411. package/dist/internal/schema/standardSchema.js.map +1 -0
  412. package/dist/internal/schema/toCodeDocument.js +34 -22
  413. package/dist/internal/schema/toCodeDocument.js.map +1 -1
  414. package/dist/internal/schema/toCodec.d.ts +2 -0
  415. package/dist/internal/schema/toCodec.d.ts.map +1 -0
  416. package/dist/internal/schema/toCodec.js +242 -0
  417. package/dist/internal/schema/toCodec.js.map +1 -0
  418. package/dist/internal/schema/toDifferJsonPatch.d.ts +2 -0
  419. package/dist/internal/schema/toDifferJsonPatch.d.ts.map +1 -0
  420. package/dist/internal/schema/toDifferJsonPatch.js +20 -0
  421. package/dist/internal/schema/toDifferJsonPatch.js.map +1 -0
  422. package/dist/internal/schema/toEncoderXml.d.ts +2 -0
  423. package/dist/internal/schema/toEncoderXml.d.ts.map +1 -0
  424. package/dist/internal/schema/toEncoderXml.js +104 -0
  425. package/dist/internal/schema/toEncoderXml.js.map +1 -0
  426. package/dist/internal/schema/toEquivalence.js +66 -0
  427. package/dist/internal/schema/toEquivalence.js.map +1 -1
  428. package/dist/internal/schema/toFormatter.d.ts +2 -0
  429. package/dist/internal/schema/toFormatter.d.ts.map +1 -0
  430. package/dist/internal/schema/toFormatter.js +227 -0
  431. package/dist/internal/schema/toFormatter.js.map +1 -0
  432. package/dist/internal/schema/toIso.d.ts +2 -0
  433. package/dist/internal/schema/toIso.d.ts.map +1 -0
  434. package/dist/internal/schema/toIso.js +17 -0
  435. package/dist/internal/schema/toIso.js.map +1 -0
  436. package/dist/internal/schema/toJsonSchemaDocument.js +122 -71
  437. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  438. package/dist/internal/schema/toRepresentation.js +3 -1
  439. package/dist/internal/schema/toRepresentation.js.map +1 -1
  440. package/dist/internal/schemaError.d.ts +4 -0
  441. package/dist/internal/schemaError.d.ts.map +1 -0
  442. package/dist/internal/schemaError.js +6 -0
  443. package/dist/internal/schemaError.js.map +1 -0
  444. package/dist/internal/stream.js +5 -6
  445. package/dist/internal/stream.js.map +1 -1
  446. package/dist/internal/tracer.d.ts +1 -3
  447. package/dist/internal/tracer.d.ts.map +1 -1
  448. package/dist/internal/tracer.js +6 -0
  449. package/dist/internal/tracer.js.map +1 -1
  450. package/dist/internal/trie.js +2 -2
  451. package/dist/internal/trie.js.map +1 -1
  452. package/dist/internal/uuid.d.ts +1 -2
  453. package/dist/internal/uuid.d.ts.map +1 -1
  454. package/dist/internal/uuid.js +2 -0
  455. package/dist/internal/uuid.js.map +1 -1
  456. package/dist/testing/TestSchema.d.ts +9 -11
  457. package/dist/testing/TestSchema.d.ts.map +1 -1
  458. package/dist/testing/TestSchema.js +20 -18
  459. package/dist/testing/TestSchema.js.map +1 -1
  460. package/dist/testing/index.d.ts +0 -4
  461. package/dist/testing/index.d.ts.map +1 -1
  462. package/dist/testing/index.js +0 -4
  463. package/dist/testing/index.js.map +1 -1
  464. package/dist/unstable/ai/AiError.d.ts +74 -23
  465. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  466. package/dist/unstable/ai/AiError.js +59 -5
  467. package/dist/unstable/ai/AiError.js.map +1 -1
  468. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  469. package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -1
  470. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  471. package/dist/unstable/ai/Chat.d.ts +27 -32
  472. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  473. package/dist/unstable/ai/Chat.js +10 -13
  474. package/dist/unstable/ai/Chat.js.map +1 -1
  475. package/dist/unstable/ai/EmbeddingModel.d.ts +23 -16
  476. package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
  477. package/dist/unstable/ai/EmbeddingModel.js +13 -11
  478. package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
  479. package/dist/unstable/ai/LanguageModel.d.ts +48 -37
  480. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  481. package/dist/unstable/ai/LanguageModel.js +150 -47
  482. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  483. package/dist/unstable/ai/McpServer.d.ts +2 -2
  484. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  485. package/dist/unstable/ai/McpServer.js +21 -12
  486. package/dist/unstable/ai/McpServer.js.map +1 -1
  487. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  488. package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -1
  489. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  490. package/dist/unstable/ai/Prompt.d.ts +1 -1
  491. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  492. package/dist/unstable/ai/Prompt.js +15 -4
  493. package/dist/unstable/ai/Prompt.js.map +1 -1
  494. package/dist/unstable/ai/Response.d.ts +37 -94
  495. package/dist/unstable/ai/Response.d.ts.map +1 -1
  496. package/dist/unstable/ai/Response.js +46 -96
  497. package/dist/unstable/ai/Response.js.map +1 -1
  498. package/dist/unstable/ai/Tokenizer.js +4 -5
  499. package/dist/unstable/ai/Tokenizer.js.map +1 -1
  500. package/dist/unstable/ai/Tool.d.ts +38 -20
  501. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  502. package/dist/unstable/ai/Tool.js +27 -1
  503. package/dist/unstable/ai/Tool.js.map +1 -1
  504. package/dist/unstable/ai/Toolkit.d.ts +1 -1
  505. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  506. package/dist/unstable/ai/Toolkit.js +30 -18
  507. package/dist/unstable/ai/Toolkit.js.map +1 -1
  508. package/dist/unstable/ai/internal/structured-output.js +8 -5
  509. package/dist/unstable/ai/internal/structured-output.js.map +1 -1
  510. package/dist/unstable/arbitrary/Arbitrary.d.ts +626 -0
  511. package/dist/unstable/arbitrary/Arbitrary.d.ts.map +1 -0
  512. package/dist/unstable/arbitrary/Arbitrary.js +238 -0
  513. package/dist/unstable/arbitrary/Arbitrary.js.map +1 -0
  514. package/dist/unstable/arbitrary/index.d.ts +8 -0
  515. package/dist/unstable/arbitrary/index.d.ts.map +1 -0
  516. package/dist/unstable/arbitrary/index.js +9 -0
  517. package/dist/unstable/arbitrary/index.js.map +1 -0
  518. package/dist/unstable/cli/Argument.d.ts +104 -108
  519. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  520. package/dist/unstable/cli/Argument.js +56 -57
  521. package/dist/unstable/cli/Argument.js.map +1 -1
  522. package/dist/unstable/cli/CliError.d.ts +2 -0
  523. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  524. package/dist/unstable/cli/CliError.js +2 -0
  525. package/dist/unstable/cli/CliError.js.map +1 -1
  526. package/dist/unstable/cli/CliOutput.js +26 -3
  527. package/dist/unstable/cli/CliOutput.js.map +1 -1
  528. package/dist/unstable/cli/Command.d.ts +73 -73
  529. package/dist/unstable/cli/Command.js +18 -18
  530. package/dist/unstable/cli/Completions.d.ts +4 -4
  531. package/dist/unstable/cli/Completions.d.ts.map +1 -1
  532. package/dist/unstable/cli/Flag.d.ts +150 -161
  533. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  534. package/dist/unstable/cli/Flag.js +79 -90
  535. package/dist/unstable/cli/Flag.js.map +1 -1
  536. package/dist/unstable/cli/GlobalFlag.d.ts +3 -3
  537. package/dist/unstable/cli/GlobalFlag.js +13 -13
  538. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  539. package/dist/unstable/cli/Param.d.ts +118 -126
  540. package/dist/unstable/cli/Param.d.ts.map +1 -1
  541. package/dist/unstable/cli/Param.js +104 -113
  542. package/dist/unstable/cli/Param.js.map +1 -1
  543. package/dist/unstable/cli/Primitive.d.ts +69 -58
  544. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  545. package/dist/unstable/cli/Primitive.js +65 -66
  546. package/dist/unstable/cli/Primitive.js.map +1 -1
  547. package/dist/unstable/cli/Prompt.d.ts +23 -24
  548. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  549. package/dist/unstable/cli/Prompt.js +68 -63
  550. package/dist/unstable/cli/Prompt.js.map +1 -1
  551. package/dist/unstable/cli/internal/completions/descriptor.js +23 -11
  552. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  553. package/dist/unstable/cli/internal/completions/zsh.js +2 -2
  554. package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
  555. package/dist/unstable/cli/internal/config.js +4 -4
  556. package/dist/unstable/cli/internal/parser.js +1 -1
  557. package/dist/unstable/cli/internal/parser.js.map +1 -1
  558. package/dist/unstable/cli/internal/wizard.d.ts.map +1 -1
  559. package/dist/unstable/cli/internal/wizard.js +14 -13
  560. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  561. package/dist/unstable/cluster/ClusterSchema.d.ts +13 -0
  562. package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
  563. package/dist/unstable/cluster/ClusterSchema.js +16 -1
  564. package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
  565. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  566. package/dist/unstable/cluster/ClusterWorkflowEngine.js +57 -14
  567. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  568. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  569. package/dist/unstable/cluster/Entity.js +2 -0
  570. package/dist/unstable/cluster/Entity.js.map +1 -1
  571. package/dist/unstable/cluster/EntityProxyServer.d.ts +2 -2
  572. package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
  573. package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
  574. package/dist/unstable/cluster/Envelope.d.ts +4 -4
  575. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  576. package/dist/unstable/cluster/Envelope.js +2 -3
  577. package/dist/unstable/cluster/Envelope.js.map +1 -1
  578. package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
  579. package/dist/unstable/cluster/HttpRunner.js +5 -2
  580. package/dist/unstable/cluster/HttpRunner.js.map +1 -1
  581. package/dist/unstable/cluster/MessageStorage.d.ts +34 -4
  582. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  583. package/dist/unstable/cluster/MessageStorage.js +28 -9
  584. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  585. package/dist/unstable/cluster/Reply.d.ts +1 -1
  586. package/dist/unstable/cluster/Sharding.d.ts +1 -1
  587. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  588. package/dist/unstable/cluster/Sharding.js +32 -17
  589. package/dist/unstable/cluster/Sharding.js.map +1 -1
  590. package/dist/unstable/cluster/ShardingConfig.js +23 -23
  591. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  592. package/dist/unstable/cluster/SocketRunner.d.ts +2 -2
  593. package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
  594. package/dist/unstable/cluster/SocketRunner.js +4 -3
  595. package/dist/unstable/cluster/SocketRunner.js.map +1 -1
  596. package/dist/unstable/cluster/SqlMessageStorage.js +11 -8
  597. package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
  598. package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
  599. package/dist/unstable/cluster/SqlRunnerStorage.js +11 -4
  600. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  601. package/dist/unstable/cluster/internal/clusterAbandon.d.ts +5 -0
  602. package/dist/unstable/cluster/internal/clusterAbandon.d.ts.map +1 -0
  603. package/dist/unstable/cluster/internal/clusterAbandon.js +9 -0
  604. package/dist/unstable/cluster/internal/clusterAbandon.js.map +1 -0
  605. package/dist/unstable/cluster/internal/entityManager.js +7 -4
  606. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  607. package/dist/unstable/cluster/internal/interruptors.js +30 -1
  608. package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
  609. package/dist/unstable/cluster/internal/resourceRef.js +12 -7
  610. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  611. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  612. package/dist/unstable/devtools/DevToolsClient.js +12 -7
  613. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  614. package/dist/unstable/encoding/Ini.d.ts +2 -0
  615. package/dist/unstable/encoding/Ini.d.ts.map +1 -1
  616. package/dist/unstable/encoding/Ini.js +2 -0
  617. package/dist/unstable/encoding/Ini.js.map +1 -1
  618. package/dist/unstable/encoding/SchemaBinary.d.ts +27 -3
  619. package/dist/unstable/encoding/SchemaBinary.d.ts.map +1 -1
  620. package/dist/unstable/encoding/SchemaBinary.js +108 -39
  621. package/dist/unstable/encoding/SchemaBinary.js.map +1 -1
  622. package/dist/unstable/encoding/Sse.js +1 -1
  623. package/dist/unstable/encoding/Sse.js.map +1 -1
  624. package/dist/unstable/encoding/Toml.d.ts +2 -0
  625. package/dist/unstable/encoding/Toml.d.ts.map +1 -1
  626. package/dist/unstable/encoding/Toml.js +6 -4
  627. package/dist/unstable/encoding/Toml.js.map +1 -1
  628. package/dist/unstable/encoding/Yaml.d.ts +2 -0
  629. package/dist/unstable/encoding/Yaml.d.ts.map +1 -1
  630. package/dist/unstable/encoding/Yaml.js +16 -5
  631. package/dist/unstable/encoding/Yaml.js.map +1 -1
  632. package/dist/unstable/encoding/index.d.ts +0 -4
  633. package/dist/unstable/encoding/index.d.ts.map +1 -1
  634. package/dist/unstable/encoding/index.js +0 -4
  635. package/dist/unstable/encoding/index.js.map +1 -1
  636. package/dist/unstable/eventlog/Event.d.ts +5 -5
  637. package/dist/unstable/eventlog/Event.d.ts.map +1 -1
  638. package/dist/unstable/eventlog/Event.js +3 -3
  639. package/dist/unstable/eventlog/Event.js.map +1 -1
  640. package/dist/unstable/eventlog/EventJournal.d.ts +7 -7
  641. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  642. package/dist/unstable/eventlog/EventJournal.js +9 -9
  643. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  644. package/dist/unstable/eventlog/EventLog.d.ts +1 -1
  645. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  646. package/dist/unstable/eventlog/EventLog.js +4 -4
  647. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  648. package/dist/unstable/eventlog/EventLogMessage.d.ts +11 -5
  649. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  650. package/dist/unstable/eventlog/EventLogMessage.js +25 -15
  651. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  652. package/dist/unstable/eventlog/EventLogRemote.d.ts +7 -1
  653. package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
  654. package/dist/unstable/eventlog/EventLogRemote.js +13 -3
  655. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  656. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +2 -2
  657. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  658. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  659. package/dist/unstable/eventlog/SqlEventJournal.js +26 -13
  660. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  661. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
  662. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +5 -1
  663. package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
  664. package/dist/unstable/http/Cookies.d.ts +1 -45
  665. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  666. package/dist/unstable/http/Cookies.js +2 -64
  667. package/dist/unstable/http/Cookies.js.map +1 -1
  668. package/dist/unstable/http/FetchHttpClient.js +1 -1
  669. package/dist/unstable/http/FetchHttpClient.js.map +1 -1
  670. package/dist/unstable/http/FindMyWay/internal/router.js +124 -33
  671. package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -1
  672. package/dist/unstable/http/FindMyWay.d.ts +15 -5
  673. package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
  674. package/dist/unstable/http/FindMyWay.js +3 -1
  675. package/dist/unstable/http/FindMyWay.js.map +1 -1
  676. package/dist/unstable/http/Headers.d.ts +0 -22
  677. package/dist/unstable/http/Headers.d.ts.map +1 -1
  678. package/dist/unstable/http/Headers.js +3 -34
  679. package/dist/unstable/http/Headers.js.map +1 -1
  680. package/dist/unstable/http/HttpBody.d.ts +41 -10
  681. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  682. package/dist/unstable/http/HttpBody.js +64 -10
  683. package/dist/unstable/http/HttpBody.js.map +1 -1
  684. package/dist/unstable/http/HttpClient.d.ts +1 -1
  685. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  686. package/dist/unstable/http/HttpClient.js +28 -18
  687. package/dist/unstable/http/HttpClient.js.map +1 -1
  688. package/dist/unstable/http/HttpClientRequest.d.ts +28 -6
  689. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  690. package/dist/unstable/http/HttpClientRequest.js +8 -19
  691. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  692. package/dist/unstable/http/HttpClientResponse.d.ts +6 -1
  693. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  694. package/dist/unstable/http/HttpClientResponse.js +10 -6
  695. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  696. package/dist/unstable/http/HttpEffect.d.ts +16 -0
  697. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  698. package/dist/unstable/http/HttpEffect.js +121 -65
  699. package/dist/unstable/http/HttpEffect.js.map +1 -1
  700. package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -3
  701. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  702. package/dist/unstable/http/HttpIncomingMessage.js +1 -13
  703. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  704. package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
  705. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  706. package/dist/unstable/http/HttpMiddleware.js +29 -21
  707. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  708. package/dist/unstable/http/HttpPlatform.d.ts +12 -11
  709. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  710. package/dist/unstable/http/HttpPlatform.js +36 -10
  711. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  712. package/dist/unstable/http/HttpRouter.d.ts +5 -1
  713. package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
  714. package/dist/unstable/http/HttpRouter.js +22 -8
  715. package/dist/unstable/http/HttpRouter.js.map +1 -1
  716. package/dist/unstable/http/HttpServer.d.ts +11 -42
  717. package/dist/unstable/http/HttpServer.d.ts.map +1 -1
  718. package/dist/unstable/http/HttpServer.js +16 -20
  719. package/dist/unstable/http/HttpServer.js.map +1 -1
  720. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  721. package/dist/unstable/http/HttpServerRequest.js +11 -11
  722. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  723. package/dist/unstable/http/HttpServerRespondable.js +1 -1
  724. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  725. package/dist/unstable/http/HttpServerResponse.d.ts +9 -13
  726. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  727. package/dist/unstable/http/HttpServerResponse.js +34 -44
  728. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  729. package/dist/unstable/http/HttpStaticServer.d.ts +2 -2
  730. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
  731. package/dist/unstable/http/HttpStaticServer.js +19 -19
  732. package/dist/unstable/http/HttpStaticServer.js.map +1 -1
  733. package/dist/unstable/http/Mime.d.ts +28 -0
  734. package/dist/unstable/http/Mime.d.ts.map +1 -0
  735. package/dist/unstable/http/Mime.js +72 -0
  736. package/dist/unstable/http/Mime.js.map +1 -0
  737. package/dist/unstable/http/Multipart.d.ts +22 -9
  738. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  739. package/dist/unstable/http/Multipart.js +26 -10
  740. package/dist/unstable/http/Multipart.js.map +1 -1
  741. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +1 -1
  742. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -1
  743. package/dist/unstable/http/MultipartParser/internal/multipart.js +8 -3
  744. package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -1
  745. package/dist/unstable/http/MultipartParser.d.ts +4 -3
  746. package/dist/unstable/http/MultipartParser.d.ts.map +1 -1
  747. package/dist/unstable/http/MultipartParser.js.map +1 -1
  748. package/dist/unstable/http/UrlParams.d.ts +0 -97
  749. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  750. package/dist/unstable/http/UrlParams.js +3 -104
  751. package/dist/unstable/http/UrlParams.js.map +1 -1
  752. package/dist/unstable/http/index.d.ts +4 -0
  753. package/dist/unstable/http/index.d.ts.map +1 -1
  754. package/dist/unstable/http/index.js +4 -0
  755. package/dist/unstable/http/index.js.map +1 -1
  756. package/dist/unstable/http/internal/compression.js +8 -11
  757. package/dist/unstable/http/internal/compression.js.map +1 -1
  758. package/dist/unstable/http/internal/headers.d.ts +2 -0
  759. package/dist/unstable/http/internal/headers.d.ts.map +1 -0
  760. package/dist/unstable/http/internal/headers.js +5 -0
  761. package/dist/unstable/http/internal/headers.js.map +1 -0
  762. package/dist/unstable/http/internal/httpBody.js +8 -0
  763. package/dist/unstable/http/internal/httpBody.js.map +1 -1
  764. package/dist/unstable/http/internal/mimeTypes.d.ts +361 -0
  765. package/dist/unstable/http/internal/mimeTypes.d.ts.map +1 -0
  766. package/dist/unstable/http/internal/mimeTypes.js +363 -0
  767. package/dist/unstable/http/internal/mimeTypes.js.map +1 -0
  768. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +13 -0
  769. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  770. package/dist/unstable/httpapi/HttpApiBuilder.js +23 -6
  771. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  772. package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -3
  773. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  774. package/dist/unstable/httpapi/HttpApiClient.js +25 -13
  775. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  776. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +8 -3
  777. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  778. package/dist/unstable/httpapi/HttpApiEndpoint.js +9 -6
  779. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  780. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  781. package/dist/unstable/httpapi/HttpApiError.js +3 -1
  782. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  783. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  784. package/dist/unstable/httpapi/HttpApiMiddleware.js +7 -5
  785. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  786. package/dist/unstable/httpapi/HttpApiSchema.d.ts +12 -0
  787. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  788. package/dist/unstable/httpapi/HttpApiSchema.js +8 -10
  789. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  790. package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
  791. package/dist/unstable/httpapi/HttpApiTest.js +8 -2
  792. package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
  793. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  794. package/dist/unstable/httpapi/OpenApi.js +31 -20
  795. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  796. package/dist/unstable/net/IpInterface.d.ts +140 -0
  797. package/dist/unstable/net/IpInterface.d.ts.map +1 -0
  798. package/dist/unstable/net/IpInterface.js +149 -0
  799. package/dist/unstable/net/IpInterface.js.map +1 -0
  800. package/dist/unstable/net/IpNetwork.d.ts +227 -0
  801. package/dist/unstable/net/IpNetwork.d.ts.map +1 -0
  802. package/dist/unstable/net/IpNetwork.js +239 -0
  803. package/dist/unstable/net/IpNetwork.js.map +1 -0
  804. package/dist/unstable/net/NetAddress.d.ts +705 -0
  805. package/dist/unstable/net/NetAddress.d.ts.map +1 -0
  806. package/dist/unstable/net/NetAddress.js +956 -0
  807. package/dist/unstable/net/NetAddress.js.map +1 -0
  808. package/dist/unstable/net/index.d.ts +16 -0
  809. package/dist/unstable/net/index.d.ts.map +1 -0
  810. package/dist/unstable/net/index.js +17 -0
  811. package/dist/unstable/net/index.js.map +1 -0
  812. package/dist/unstable/observability/OtlpExporter.d.ts +1 -0
  813. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  814. package/dist/unstable/observability/OtlpExporter.js +4 -6
  815. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  816. package/dist/unstable/observability/OtlpLogger.js +9 -9
  817. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  818. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  819. package/dist/unstable/observability/OtlpMetrics.js +9 -8
  820. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  821. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  822. package/dist/unstable/observability/OtlpResource.js +2 -2
  823. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  824. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  825. package/dist/unstable/observability/OtlpTracer.js +82 -55
  826. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  827. package/dist/unstable/observability/internal/otlpEnv.d.ts +1 -1
  828. package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
  829. package/dist/unstable/observability/internal/otlpEnv.js +5 -9
  830. package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
  831. package/dist/unstable/persistence/PersistedCache.js +1 -1
  832. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  833. package/dist/unstable/persistence/PersistedQueue.d.ts +114 -14
  834. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  835. package/dist/unstable/persistence/PersistedQueue.js +799 -234
  836. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  837. package/dist/unstable/persistence/RateLimiter.d.ts +28 -15
  838. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  839. package/dist/unstable/persistence/RateLimiter.js +33 -41
  840. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  841. package/dist/unstable/process/ChildProcess.d.ts +8 -2
  842. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  843. package/dist/unstable/process/ChildProcess.js +7 -2
  844. package/dist/unstable/process/ChildProcess.js.map +1 -1
  845. package/dist/unstable/process/ChildProcessSpawner.d.ts +1 -1
  846. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  847. package/dist/unstable/process/ChildProcessSpawner.js +1 -1
  848. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  849. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  850. package/dist/unstable/reactivity/Atom.js +6 -3
  851. package/dist/unstable/reactivity/Atom.js.map +1 -1
  852. package/dist/unstable/reactivity/AtomHttpApi.d.ts +3 -6
  853. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  854. package/dist/unstable/reactivity/AtomHttpApi.js +6 -3
  855. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  856. package/dist/unstable/reactivity/AtomRegistry.js +2 -3
  857. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  858. package/dist/unstable/reactivity/AtomRpc.d.ts +2 -2
  859. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  860. package/dist/unstable/reactivity/AtomRpc.js +1 -1
  861. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  862. package/dist/unstable/reactivity/Hydration.d.ts +6 -4
  863. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
  864. package/dist/unstable/reactivity/Hydration.js +20 -6
  865. package/dist/unstable/reactivity/Hydration.js.map +1 -1
  866. package/dist/unstable/reactivity/Reactivity.d.ts +26 -26
  867. package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
  868. package/dist/unstable/reactivity/Reactivity.js +10 -12
  869. package/dist/unstable/reactivity/Reactivity.js.map +1 -1
  870. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  871. package/dist/unstable/rpc/RpcClient.js +64 -64
  872. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  873. package/dist/unstable/rpc/RpcClientError.d.ts +1 -1
  874. package/dist/unstable/rpc/RpcMessage.d.ts +3 -1
  875. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  876. package/dist/unstable/rpc/RpcMessage.js +1 -1
  877. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  878. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  879. package/dist/unstable/rpc/RpcMiddleware.js +7 -5
  880. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  881. package/dist/unstable/rpc/RpcSerialization.d.ts +5 -39
  882. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  883. package/dist/unstable/rpc/RpcSerialization.js +22 -115
  884. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  885. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  886. package/dist/unstable/rpc/RpcServer.js +104 -57
  887. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  888. package/dist/unstable/schema/Model.d.ts.map +1 -1
  889. package/dist/unstable/schema/Model.js +7 -6
  890. package/dist/unstable/schema/Model.js.map +1 -1
  891. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  892. package/dist/unstable/schema/VariantSchema.js +3 -0
  893. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  894. package/dist/unstable/socket/Socket.d.ts +287 -102
  895. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  896. package/dist/unstable/socket/Socket.js +408 -215
  897. package/dist/unstable/socket/Socket.js.map +1 -1
  898. package/dist/unstable/socket/SocketServer.d.ts +5 -32
  899. package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
  900. package/dist/unstable/socket/SocketServer.js +3 -3
  901. package/dist/unstable/socket/SocketServer.js.map +1 -1
  902. package/dist/unstable/sql/SqlClient.d.ts +20 -0
  903. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  904. package/dist/unstable/sql/SqlClient.js +14 -7
  905. package/dist/unstable/sql/SqlClient.js.map +1 -1
  906. package/dist/unstable/sql/SqlConnection.d.ts +15 -0
  907. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  908. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  909. package/dist/unstable/sql/SqlModel.d.ts +1 -1
  910. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  911. package/dist/unstable/sql/Statement.d.ts +13 -5
  912. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  913. package/dist/unstable/sql/Statement.js +29 -15
  914. package/dist/unstable/sql/Statement.js.map +1 -1
  915. package/dist/unstable/workers/Transferable.js +1 -1
  916. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  917. package/dist/unstable/workers/Worker.js +3 -1
  918. package/dist/unstable/workers/Worker.js.map +1 -1
  919. package/dist/unstable/workflow/Activity.d.ts +7 -0
  920. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  921. package/dist/unstable/workflow/Activity.js +14 -4
  922. package/dist/unstable/workflow/Activity.js.map +1 -1
  923. package/dist/unstable/workflow/DurableClock.js +1 -1
  924. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  925. package/dist/unstable/workflow/DurableDeferred.d.ts +2 -2
  926. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  927. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  928. package/dist/unstable/workflow/DurableQueue.d.ts +8 -0
  929. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  930. package/dist/unstable/workflow/DurableQueue.js +8 -0
  931. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  932. package/dist/unstable/workflow/Workflow.d.ts +5 -0
  933. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  934. package/dist/unstable/workflow/Workflow.js +70 -12
  935. package/dist/unstable/workflow/Workflow.js.map +1 -1
  936. package/dist/unstable/workflow/WorkflowEngine.d.ts +6 -0
  937. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  938. package/dist/unstable/workflow/WorkflowEngine.js +11 -0
  939. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  940. package/package.json +7 -9
  941. package/src/Array.ts +118 -67
  942. package/src/BigDecimal.ts +50 -28
  943. package/src/ByteSize.ts +838 -0
  944. package/src/Cache.ts +17 -3
  945. package/src/Cause.ts +1 -1
  946. package/src/Channel.ts +183 -48
  947. package/src/Chunk.ts +65 -36
  948. package/src/Config.ts +237 -248
  949. package/src/ConfigProvider.ts +7 -8
  950. package/src/Context.ts +31 -0
  951. package/src/Cron.ts +2 -2
  952. package/src/Crypto.ts +3 -2
  953. package/src/Deferred.ts +7 -6
  954. package/src/Duration.ts +1 -1
  955. package/src/Effect.ts +226 -122
  956. package/src/Effectable.ts +78 -9
  957. package/src/Encoding.ts +101 -11
  958. package/src/Equal.ts +1 -1
  959. package/src/ExecutionPlan.ts +3 -0
  960. package/src/Fiber.ts +33 -8
  961. package/src/FiberHandle.ts +3 -3
  962. package/src/FiberMap.ts +19 -10
  963. package/src/FileSystem.ts +55 -230
  964. package/src/Formatter.ts +21 -3
  965. package/src/Graph.ts +55 -25
  966. package/src/Hash.ts +5 -16
  967. package/src/HashRing.ts +9 -2
  968. package/src/HashSet.ts +56 -0
  969. package/src/Iterable.ts +66 -41
  970. package/src/JsonPatch.ts +4 -4
  971. package/src/JsonPointer.ts +97 -4
  972. package/src/JsonSchema.ts +8 -26
  973. package/src/Layer.ts +59 -18
  974. package/src/LayerMap.ts +8 -6
  975. package/src/LayerRef.ts +7 -5
  976. package/src/Logger.ts +125 -18
  977. package/src/ManagedRuntime.ts +1 -1
  978. package/src/Match.ts +33 -14
  979. package/src/Metric.ts +24 -21
  980. package/src/MutableHashMap.ts +1 -1
  981. package/src/MutableHashSet.ts +1 -1
  982. package/src/MutableList.ts +18 -2
  983. package/src/Number.ts +7 -1
  984. package/src/Optic.ts +8 -4
  985. package/src/Option.ts +1 -1
  986. package/src/Order.ts +3 -1
  987. package/src/PartitionedSemaphore.ts +1 -2
  988. package/src/Path.ts +1 -1
  989. package/src/PlatformError.ts +1 -1
  990. package/src/Pool.ts +125 -8
  991. package/src/PrimaryKey.ts +1 -1
  992. package/src/PubSub.ts +32 -20
  993. package/src/Queue.ts +119 -28
  994. package/src/Random.ts +20 -6
  995. package/src/RcMap.ts +20 -13
  996. package/src/Redacted.ts +1 -1
  997. package/src/RequestResolver.ts +49 -26
  998. package/src/Result.ts +1 -1
  999. package/src/Scheduler.ts +21 -11
  1000. package/src/Schema.ts +4809 -6368
  1001. package/src/SchemaAST.ts +1031 -284
  1002. package/src/SchemaGetter.ts +75 -21
  1003. package/src/SchemaIssue.ts +259 -15
  1004. package/src/SchemaParser.ts +2 -12
  1005. package/src/SchemaRepresentation.ts +1593 -29
  1006. package/src/SchemaTransformation.ts +145 -22
  1007. package/src/ScopedCache.ts +10 -3
  1008. package/src/Sink.ts +31 -15
  1009. package/src/Stream.ts +294 -76
  1010. package/src/String.ts +20 -9
  1011. package/src/Struct.ts +8 -4
  1012. package/src/SynchronizedRef.ts +3 -5
  1013. package/src/Terminal.ts +3 -3
  1014. package/src/Tracer.ts +43 -14
  1015. package/src/Tuple.ts +3 -1
  1016. package/src/TxChunk.ts +1 -1
  1017. package/src/TxDeferred.ts +1 -1
  1018. package/src/TxHashMap.ts +1 -1
  1019. package/src/TxHashSet.ts +92 -11
  1020. package/src/TxPriorityQueue.ts +1 -1
  1021. package/src/TxPubSub.ts +1 -1
  1022. package/src/TxQueue.ts +22 -17
  1023. package/src/TxReentrantLock.ts +29 -1
  1024. package/src/TxRef.ts +1 -1
  1025. package/src/TxSemaphore.ts +1 -1
  1026. package/src/TxSubscriptionRef.ts +1 -1
  1027. package/src/Types.ts +40 -17
  1028. package/src/Utils.ts +3 -1
  1029. package/src/index.ts +5 -0
  1030. package/src/internal/arbitrary/model.ts +701 -0
  1031. package/src/internal/arbitrary/regexp.ts +855 -0
  1032. package/src/internal/arbitrary/runner.ts +608 -0
  1033. package/src/internal/arbitrary/schema.ts +1800 -0
  1034. package/src/internal/core.ts +48 -22
  1035. package/src/internal/count.ts +14 -0
  1036. package/src/internal/dateTime.ts +8 -10
  1037. package/src/internal/effect.ts +475 -295
  1038. package/src/internal/graph.ts +6 -1
  1039. package/src/internal/hashMap.ts +5 -3
  1040. package/src/internal/hashSet.ts +1 -1
  1041. package/src/internal/matcher.ts +34 -19
  1042. package/src/internal/metric.ts +1 -1
  1043. package/src/internal/option.ts +8 -6
  1044. package/src/internal/random.ts +20 -7
  1045. package/src/internal/rcRef.ts +10 -7
  1046. package/src/internal/references.ts +1 -0
  1047. package/src/internal/request.ts +12 -7
  1048. package/src/internal/result.ts +15 -11
  1049. package/src/internal/schema/annotations.ts +3 -3
  1050. package/src/internal/schema/fromJsonSchemaDocument.ts +14 -29
  1051. package/src/internal/schema/fromRepresentation.ts +5 -3
  1052. package/src/internal/schema/{schema.ts → make.ts} +0 -40
  1053. package/src/internal/schema/parser.ts +8 -0
  1054. package/src/internal/schema/standardSchema.ts +125 -0
  1055. package/src/internal/schema/toCodeDocument.ts +58 -44
  1056. package/src/internal/schema/toCodec.ts +312 -0
  1057. package/src/internal/schema/toDifferJsonPatch.ts +24 -0
  1058. package/src/internal/schema/toEncoderXml.ts +110 -0
  1059. package/src/internal/schema/toEquivalence.ts +76 -0
  1060. package/src/internal/schema/toFormatter.ts +230 -0
  1061. package/src/internal/schema/toIso.ts +20 -0
  1062. package/src/internal/schema/toJsonSchemaDocument.ts +125 -67
  1063. package/src/internal/schema/toRepresentation.ts +1 -1
  1064. package/src/internal/schemaError.ts +8 -0
  1065. package/src/internal/stream.ts +14 -6
  1066. package/src/internal/tracer.ts +4 -0
  1067. package/src/internal/trie.ts +5 -2
  1068. package/src/internal/uuid.ts +4 -0
  1069. package/src/testing/TestSchema.ts +36 -30
  1070. package/src/testing/index.ts +0 -5
  1071. package/src/unstable/ai/AiError.ts +69 -5
  1072. package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -1
  1073. package/src/unstable/ai/Chat.ts +35 -36
  1074. package/src/unstable/ai/EmbeddingModel.ts +27 -15
  1075. package/src/unstable/ai/LanguageModel.ts +283 -100
  1076. package/src/unstable/ai/McpServer.ts +36 -20
  1077. package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -1
  1078. package/src/unstable/ai/Prompt.ts +19 -4
  1079. package/src/unstable/ai/Response.ts +107 -189
  1080. package/src/unstable/ai/Tokenizer.ts +4 -5
  1081. package/src/unstable/ai/Tool.ts +58 -35
  1082. package/src/unstable/ai/Toolkit.ts +43 -37
  1083. package/src/unstable/ai/internal/structured-output.ts +5 -5
  1084. package/src/unstable/arbitrary/Arbitrary.ts +715 -0
  1085. package/src/unstable/arbitrary/index.ts +10 -0
  1086. package/src/unstable/cli/Argument.ts +111 -115
  1087. package/src/unstable/cli/CliError.ts +2 -0
  1088. package/src/unstable/cli/CliOutput.ts +40 -3
  1089. package/src/unstable/cli/Command.ts +74 -74
  1090. package/src/unstable/cli/Completions.ts +4 -4
  1091. package/src/unstable/cli/Flag.ts +158 -169
  1092. package/src/unstable/cli/GlobalFlag.ts +13 -13
  1093. package/src/unstable/cli/Param.ts +150 -159
  1094. package/src/unstable/cli/Primitive.ts +75 -76
  1095. package/src/unstable/cli/Prompt.ts +88 -87
  1096. package/src/unstable/cli/internal/completions/descriptor.ts +23 -11
  1097. package/src/unstable/cli/internal/completions/zsh.ts +2 -2
  1098. package/src/unstable/cli/internal/config.ts +4 -4
  1099. package/src/unstable/cli/internal/parser.ts +1 -1
  1100. package/src/unstable/cli/internal/wizard.ts +18 -13
  1101. package/src/unstable/cluster/ClusterSchema.ts +19 -1
  1102. package/src/unstable/cluster/ClusterWorkflowEngine.ts +66 -16
  1103. package/src/unstable/cluster/Entity.ts +3 -0
  1104. package/src/unstable/cluster/EntityProxyServer.ts +6 -2
  1105. package/src/unstable/cluster/Envelope.ts +3 -3
  1106. package/src/unstable/cluster/HttpRunner.ts +7 -2
  1107. package/src/unstable/cluster/MessageStorage.ts +62 -21
  1108. package/src/unstable/cluster/Reply.ts +2 -2
  1109. package/src/unstable/cluster/Sharding.ts +44 -19
  1110. package/src/unstable/cluster/ShardingConfig.ts +23 -23
  1111. package/src/unstable/cluster/SocketRunner.ts +5 -4
  1112. package/src/unstable/cluster/SqlMessageStorage.ts +12 -8
  1113. package/src/unstable/cluster/SqlRunnerStorage.ts +18 -10
  1114. package/src/unstable/cluster/internal/clusterAbandon.ts +14 -0
  1115. package/src/unstable/cluster/internal/entityManager.ts +12 -4
  1116. package/src/unstable/cluster/internal/interruptors.ts +58 -1
  1117. package/src/unstable/cluster/internal/resourceRef.ts +15 -7
  1118. package/src/unstable/devtools/DevToolsClient.ts +13 -3
  1119. package/src/unstable/encoding/Ini.ts +2 -0
  1120. package/src/unstable/encoding/SchemaBinary.ts +150 -44
  1121. package/src/unstable/encoding/Sse.ts +1 -1
  1122. package/src/unstable/encoding/Toml.ts +7 -5
  1123. package/src/unstable/encoding/Yaml.ts +18 -5
  1124. package/src/unstable/encoding/index.ts +0 -5
  1125. package/src/unstable/eventlog/Event.ts +7 -7
  1126. package/src/unstable/eventlog/EventJournal.ts +9 -9
  1127. package/src/unstable/eventlog/EventLog.ts +5 -5
  1128. package/src/unstable/eventlog/EventLogMessage.ts +25 -15
  1129. package/src/unstable/eventlog/EventLogRemote.ts +15 -4
  1130. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +2 -2
  1131. package/src/unstable/eventlog/SqlEventJournal.ts +32 -9
  1132. package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +11 -1
  1133. package/src/unstable/http/Cookies.ts +2 -102
  1134. package/src/unstable/http/FetchHttpClient.ts +1 -1
  1135. package/src/unstable/http/FindMyWay/internal/router.ts +139 -33
  1136. package/src/unstable/http/FindMyWay.ts +15 -5
  1137. package/src/unstable/http/Headers.ts +3 -48
  1138. package/src/unstable/http/HttpBody.ts +107 -36
  1139. package/src/unstable/http/HttpClient.ts +41 -30
  1140. package/src/unstable/http/HttpClientRequest.ts +32 -18
  1141. package/src/unstable/http/HttpClientResponse.ts +16 -3
  1142. package/src/unstable/http/HttpEffect.ts +145 -73
  1143. package/src/unstable/http/HttpIncomingMessage.ts +4 -4
  1144. package/src/unstable/http/HttpMiddleware.ts +43 -24
  1145. package/src/unstable/http/HttpPlatform.ts +62 -20
  1146. package/src/unstable/http/HttpRouter.ts +27 -16
  1147. package/src/unstable/http/HttpServer.ts +18 -57
  1148. package/src/unstable/http/HttpServerRequest.ts +17 -15
  1149. package/src/unstable/http/HttpServerRespondable.ts +1 -1
  1150. package/src/unstable/http/HttpServerResponse.ts +49 -40
  1151. package/src/unstable/http/HttpStaticServer.ts +30 -28
  1152. package/src/unstable/http/Mime.ts +76 -0
  1153. package/src/unstable/http/Multipart.ts +35 -18
  1154. package/src/unstable/http/MultipartParser/internal/multipart.ts +10 -3
  1155. package/src/unstable/http/MultipartParser.ts +4 -3
  1156. package/src/unstable/http/UrlParams.ts +3 -161
  1157. package/src/unstable/http/index.ts +5 -0
  1158. package/src/unstable/http/internal/compression.ts +11 -12
  1159. package/src/unstable/http/internal/headers.ts +7 -0
  1160. package/src/unstable/http/internal/httpBody.ts +9 -0
  1161. package/src/unstable/http/internal/mimeTypes.ts +395 -0
  1162. package/src/unstable/httpapi/HttpApiBuilder.ts +52 -6
  1163. package/src/unstable/httpapi/HttpApiClient.ts +44 -24
  1164. package/src/unstable/httpapi/HttpApiEndpoint.ts +24 -11
  1165. package/src/unstable/httpapi/HttpApiError.ts +3 -1
  1166. package/src/unstable/httpapi/HttpApiMiddleware.ts +7 -5
  1167. package/src/unstable/httpapi/HttpApiSchema.ts +14 -7
  1168. package/src/unstable/httpapi/HttpApiTest.ts +6 -1
  1169. package/src/unstable/httpapi/OpenApi.ts +32 -22
  1170. package/src/unstable/net/IpInterface.ts +242 -0
  1171. package/src/unstable/net/IpNetwork.ts +357 -0
  1172. package/src/unstable/net/NetAddress.ts +1271 -0
  1173. package/src/unstable/net/index.ts +20 -0
  1174. package/src/unstable/observability/OtlpExporter.ts +5 -6
  1175. package/src/unstable/observability/OtlpLogger.ts +9 -9
  1176. package/src/unstable/observability/OtlpMetrics.ts +9 -8
  1177. package/src/unstable/observability/OtlpResource.ts +5 -4
  1178. package/src/unstable/observability/OtlpTracer.ts +103 -81
  1179. package/src/unstable/observability/internal/otlpEnv.ts +10 -13
  1180. package/src/unstable/persistence/PersistedCache.ts +1 -1
  1181. package/src/unstable/persistence/PersistedQueue.ts +1100 -291
  1182. package/src/unstable/persistence/RateLimiter.ts +64 -58
  1183. package/src/unstable/process/ChildProcess.ts +15 -4
  1184. package/src/unstable/process/ChildProcessSpawner.ts +1 -1
  1185. package/src/unstable/reactivity/Atom.ts +6 -3
  1186. package/src/unstable/reactivity/AtomHttpApi.ts +21 -10
  1187. package/src/unstable/reactivity/AtomRegistry.ts +2 -4
  1188. package/src/unstable/reactivity/AtomRpc.ts +6 -5
  1189. package/src/unstable/reactivity/Hydration.ts +26 -7
  1190. package/src/unstable/reactivity/Reactivity.ts +49 -36
  1191. package/src/unstable/rpc/RpcClient.ts +62 -59
  1192. package/src/unstable/rpc/RpcMessage.ts +3 -1
  1193. package/src/unstable/rpc/RpcMiddleware.ts +7 -5
  1194. package/src/unstable/rpc/RpcSerialization.ts +27 -117
  1195. package/src/unstable/rpc/RpcServer.ts +143 -80
  1196. package/src/unstable/schema/Model.ts +8 -7
  1197. package/src/unstable/schema/VariantSchema.ts +3 -0
  1198. package/src/unstable/socket/Socket.ts +714 -383
  1199. package/src/unstable/socket/SocketServer.ts +5 -35
  1200. package/src/unstable/sql/SqlClient.ts +42 -7
  1201. package/src/unstable/sql/SqlConnection.ts +18 -0
  1202. package/src/unstable/sql/SqlModel.ts +1 -1
  1203. package/src/unstable/sql/Statement.ts +46 -20
  1204. package/src/unstable/workers/Transferable.ts +1 -1
  1205. package/src/unstable/workers/Worker.ts +3 -1
  1206. package/src/unstable/workflow/Activity.ts +20 -9
  1207. package/src/unstable/workflow/DurableClock.ts +1 -1
  1208. package/src/unstable/workflow/DurableDeferred.ts +6 -0
  1209. package/src/unstable/workflow/DurableQueue.ts +8 -0
  1210. package/src/unstable/workflow/Workflow.ts +105 -28
  1211. package/src/unstable/workflow/WorkflowEngine.ts +22 -0
  1212. package/dist/internal/schema/schema.d.ts.map +0 -1
  1213. package/dist/internal/schema/schema.js.map +0 -1
  1214. package/dist/internal/schema/toArbitrary.d.ts +0 -2
  1215. package/dist/internal/schema/toArbitrary.d.ts.map +0 -1
  1216. package/dist/internal/schema/toArbitrary.js +0 -705
  1217. package/dist/internal/schema/toArbitrary.js.map +0 -1
  1218. package/dist/testing/FastCheck.d.ts +0 -90
  1219. package/dist/testing/FastCheck.d.ts.map +0 -1
  1220. package/dist/testing/FastCheck.js +0 -90
  1221. package/dist/testing/FastCheck.js.map +0 -1
  1222. package/dist/unstable/encoding/Msgpack.d.ts +0 -185
  1223. package/dist/unstable/encoding/Msgpack.d.ts.map +0 -1
  1224. package/dist/unstable/encoding/Msgpack.js +0 -227
  1225. package/dist/unstable/encoding/Msgpack.js.map +0 -1
  1226. package/src/internal/schema/toArbitrary.ts +0 -843
  1227. package/src/testing/FastCheck.ts +0 -90
  1228. package/src/unstable/encoding/Msgpack.ts +0 -432
  1229. /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}.
330
+ * Constructs a {@link Context}.
344
331
  *
345
- * **Details**
346
- *
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,32 +364,19 @@ 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**
418
- *
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.
367
+ * Constructs a {@link Declaration}.
428
368
  *
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
377
  /**
439
378
  * Parser factory {@link flip} swaps in, so a declaration can behave
440
- * differently when encoding. `undefined` reuses {@link run}.
379
+ * differently when encoding. `undefined` reuses `run`.
441
380
  */
442
381
  encodingRun;
443
382
  constructor(typeParameters, run, annotations, checks, encoding, context, encodingChecks, encodingRun) {
@@ -473,20 +412,14 @@ export class Declaration extends Base {
473
412
  if (typeof expected === "string") return expected;
474
413
  return "<Declaration>";
475
414
  }
476
- }
415
+ };
477
416
  /**
478
- * AST node matching the `null` literal value.
479
- *
480
- * **Details**
417
+ * Constructs a {@link Null}.
481
418
  *
482
- * Parsing succeeds only when the input is exactly `null`.
483
- *
484
- * @see {@link null_ null}
485
- * @see {@link isNull}
486
- * @category models
419
+ * @category constructors
487
420
  * @since 4.0.0
488
421
  */
489
- export class Null extends Base {
422
+ export const Null = class extends ASTNodeImpl {
490
423
  _tag = "Null";
491
424
  /** @internal */
492
425
  getParser() {
@@ -496,7 +429,7 @@ export class Null extends Base {
496
429
  getExpected() {
497
430
  return "null";
498
431
  }
499
- }
432
+ };
500
433
  const null_ = /*#__PURE__*/new Null();
501
434
  export {
502
435
  /**
@@ -512,18 +445,12 @@ export {
512
445
  */
513
446
  null_ as null };
514
447
  /**
515
- * AST node matching the `undefined` value.
516
- *
517
- * **Details**
448
+ * Constructs a {@link Undefined}.
518
449
  *
519
- * Parsing succeeds only when the input is exactly `undefined`.
520
- *
521
- * @see {@link undefined}
522
- * @see {@link isUndefined}
523
- * @category models
450
+ * @category constructors
524
451
  * @since 4.0.0
525
452
  */
526
- export class Undefined extends Base {
453
+ export const Undefined = class extends ASTNodeImpl {
527
454
  _tag = "Undefined";
528
455
  /** @internal */
529
456
  getParser() {
@@ -537,7 +464,7 @@ export class Undefined extends Base {
537
464
  getExpected() {
538
465
  return "undefined";
539
466
  }
540
- }
467
+ };
541
468
  const undefinedToNull = /*#__PURE__*/new Link(null_, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(() => undefined), /*#__PURE__*/SchemaGetter.transform(() => null)));
542
469
  const undefined_ = /*#__PURE__*/new Undefined();
543
470
  export {
@@ -554,26 +481,12 @@ export {
554
481
  */
555
482
  undefined_ as undefined };
556
483
  /**
557
- * AST node matching TypeScript `void` return-value semantics.
558
- *
559
- * **When to use**
560
- *
561
- * Use when you need an AST node for a value whose result is intentionally
562
- * ignored.
563
- *
564
- * **Details**
484
+ * Constructs a {@link Void}.
565
485
  *
566
- * Parsers built from this node accept any present runtime input and map it to
567
- * `undefined`. Public schemas built from it may still expose `void` as their
568
- * typed decoded and encoded representation.
569
- *
570
- * @see {@link undefined} for the AST singleton that matches only exact `undefined`
571
- * @see {@link void_ void}
572
- * @see {@link isVoid}
573
- * @category models
486
+ * @category constructors
574
487
  * @since 4.0.0
575
488
  */
576
- export class Void extends Base {
489
+ export const Void = class extends ASTNodeImpl {
577
490
  _tag = "Void";
578
491
  /** @internal */
579
492
  getParser() {
@@ -588,7 +501,7 @@ export class Void extends Base {
588
501
  getExpected() {
589
502
  return "void";
590
503
  }
591
- }
504
+ };
592
505
  const void_ = /*#__PURE__*/new Void();
593
506
  export {
594
507
  /**
@@ -613,19 +526,12 @@ export {
613
526
  */
614
527
  void_ as void };
615
528
  /**
616
- * AST node representing the `never` type — no value matches.
529
+ * Constructs a {@link Never}.
617
530
  *
618
- * **Details**
619
- *
620
- * Parsing always fails. Useful as a placeholder in unions or as the result
621
- * of narrowing that eliminates all options.
622
- *
623
- * @see {@link never}
624
- * @see {@link isNever}
625
- * @category models
531
+ * @category constructors
626
532
  * @since 4.0.0
627
533
  */
628
- export class Never extends Base {
534
+ export const Never = class extends ASTNodeImpl {
629
535
  _tag = "Never";
630
536
  /** @internal */
631
537
  getParser() {
@@ -635,7 +541,7 @@ export class Never extends Base {
635
541
  getExpected() {
636
542
  return "never";
637
543
  }
638
- }
544
+ };
639
545
  /**
640
546
  * Provides the singleton {@link Never} AST instance.
641
547
  *
@@ -652,15 +558,12 @@ export class Never extends Base {
652
558
  */
653
559
  export const never = /*#__PURE__*/new Never();
654
560
  /**
655
- * AST node representing the `any` type — every value matches.
656
- *
657
- * @see {@link any}
658
- * @see {@link isAny}
561
+ * Constructs a {@link Any}.
659
562
  *
660
- * @category models
563
+ * @category constructors
661
564
  * @since 4.0.0
662
565
  */
663
- export class Any extends Base {
566
+ export const Any = class extends ASTNodeImpl {
664
567
  _tag = "Any";
665
568
  /** @internal */
666
569
  getParser() {
@@ -670,7 +573,7 @@ export class Any extends Base {
670
573
  getExpected() {
671
574
  return "any";
672
575
  }
673
- }
576
+ };
674
577
  /**
675
578
  * Provides the singleton {@link Any} AST instance.
676
579
  *
@@ -686,19 +589,12 @@ export class Any extends Base {
686
589
  */
687
590
  export const any = /*#__PURE__*/new Any();
688
591
  /**
689
- * AST node representing the `unknown` type — every value matches.
592
+ * Constructs a {@link Unknown}.
690
593
  *
691
- * **Details**
692
- *
693
- * Unlike {@link Any}, this is type-safe: the parsed result is typed as
694
- * `unknown` rather than `any`.
695
- *
696
- * @see {@link unknown}
697
- * @see {@link isUnknown}
698
- * @category models
594
+ * @category constructors
699
595
  * @since 4.0.0
700
596
  */
701
- export class Unknown extends Base {
597
+ export const Unknown = class extends ASTNodeImpl {
702
598
  _tag = "Unknown";
703
599
  /** @internal */
704
600
  getParser() {
@@ -708,7 +604,7 @@ export class Unknown extends Base {
708
604
  getExpected() {
709
605
  return "unknown";
710
606
  }
711
- }
607
+ };
712
608
  /**
713
609
  * Provides the singleton {@link Unknown} AST instance.
714
610
  *
@@ -724,16 +620,12 @@ export class Unknown extends Base {
724
620
  */
725
621
  export const unknown = /*#__PURE__*/new Unknown();
726
622
  /**
727
- * AST node matching the TypeScript `object` type — accepts objects, arrays,
728
- * and functions (anything non-primitive and non-null).
729
- *
730
- * @see {@link objectKeyword}
731
- * @see {@link isObjectKeyword}
623
+ * Constructs a {@link ObjectKeyword}.
732
624
  *
733
- * @category models
734
- * @since 3.10.0
625
+ * @category constructors
626
+ * @since 4.0.0
735
627
  */
736
- export class ObjectKeyword extends Base {
628
+ export const ObjectKeyword = class extends ASTNodeImpl {
737
629
  _tag = "ObjectKeyword";
738
630
  /** @internal */
739
631
  getParser() {
@@ -743,7 +635,7 @@ export class ObjectKeyword extends Base {
743
635
  getExpected() {
744
636
  return "object | array | function";
745
637
  }
746
- }
638
+ };
747
639
  /**
748
640
  * Provides the singleton {@link ObjectKeyword} AST instance.
749
641
  *
@@ -760,22 +652,21 @@ export class ObjectKeyword extends Base {
760
652
  */
761
653
  export const objectKeyword = /*#__PURE__*/new ObjectKeyword();
762
654
  /**
763
- * AST node representing a TypeScript `enum`.
764
- *
765
- * **Details**
766
- *
767
- * Holds `enums` as an array of `[name, value]` pairs where values are
768
- * `string | number`. Parsing succeeds when the input matches any enum value.
655
+ * Constructs a {@link Enum}. Numeric values must be finite.
769
656
  *
770
- * @see {@link isEnum}
771
- * @category models
657
+ * @category constructors
772
658
  * @since 4.0.0
773
659
  */
774
- export class Enum extends Base {
660
+ export const Enum = class extends ASTNodeImpl {
775
661
  _tag = "Enum";
776
662
  enums;
777
663
  constructor(enums, annotations, checks, encoding, context) {
778
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
+ }
779
670
  this.enums = enums;
780
671
  }
781
672
  /** @internal */
@@ -787,7 +678,7 @@ export class Enum extends Base {
787
678
  toCodecStringTree() {
788
679
  if (this.enums.some(([_, v]) => typeof v === "number")) {
789
680
  const coercions = Object.fromEntries(this.enums.map(([_, v]) => [globalThis.String(v), v]));
790
- 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()))]);
791
682
  }
792
683
  return this;
793
684
  }
@@ -795,36 +686,46 @@ export class Enum extends Base {
795
686
  getExpected() {
796
687
  return this.enums.map(([_, value]) => JSON.stringify(value)).join(" | ");
797
688
  }
798
- }
799
- 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;
800
696
  switch (ast._tag) {
801
697
  case "String":
802
698
  case "Number":
803
699
  case "BigInt":
804
- return true;
700
+ valid = true;
701
+ break;
805
702
  case "Literal":
703
+ valid = !ast.checks;
704
+ break;
806
705
  case "TemplateLiteral":
807
- return !ast.checks;
706
+ valid = !ast.checks && ast.parts.every((part, index) => isTemplateLiteralPart(part, `${path}.parts[${index}]`, validated));
707
+ break;
808
708
  case "Union":
809
- return !ast.checks && ast.types.every(isTemplateLiteralPart);
709
+ valid = !ast.checks && ast.types.every((part, index) => isTemplateLiteralPart(part, `${path}.types[${index}]`, validated));
710
+ break;
810
711
  default:
811
712
  return false;
812
713
  }
714
+ if (valid) validated.add(ast);
715
+ return valid;
813
716
  }
814
717
  /**
815
- * AST node representing a TypeScript template literal type
816
- * (e.g. `` `user_${string}` ``).
718
+ * Constructs a {@link TemplateLiteral}.
817
719
  *
818
- * **Details**
720
+ * **Gotchas**
819
721
  *
820
- * `parts` is an array of AST nodes; each part contributes to matching
821
- * 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.
822
724
  *
823
- * @see {@link isTemplateLiteral}
824
- * @category models
825
- * @since 3.10.0
725
+ * @category constructors
726
+ * @since 4.0.0
826
727
  */
827
- export class TemplateLiteral extends Base {
728
+ export const TemplateLiteral = class extends ASTNodeImpl {
828
729
  _tag = "TemplateLiteral";
829
730
  parts;
830
731
  /** @internal */
@@ -837,14 +738,14 @@ export class TemplateLiteral extends Base {
837
738
  super(annotations, checks, encoding, context);
838
739
  const encodedParts = [];
839
740
  const literals = [];
840
- for (const part of parts) {
841
- const encoded = toEncoded(part);
842
- if (isTemplateLiteralPart(encoded)) {
843
- encodedParts.push(encoded);
844
- literals.push(encoded._tag === "Literal" ? globalThis.String(encoded.literal) : undefined);
845
- } else {
846
- 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}`);
847
746
  }
747
+ encodedParts.push(part);
748
+ literals.push(part._tag === "Literal" ? globalThis.String(part.literal) : undefined);
848
749
  }
849
750
  const suffixLengths = new Array(encodedParts.length + 1);
850
751
  suffixLengths[encodedParts.length] = 0;
@@ -858,7 +759,8 @@ export class TemplateLiteral extends Base {
858
759
  }
859
760
  /** @internal */
860
761
  getParser(compile) {
861
- const parser = compile(this.asTemplateLiteralParser());
762
+ const tuple = new Arrays(false, this.parts.map(partFromString), []);
763
+ const parser = compile(decodeTo(string, tuple, templateLiteralTransformation(this)));
862
764
  return (input, options) => {
863
765
  if (input === InternalParser.missing) return InternalParser.missingExit;
864
766
  const result = parser(input, options);
@@ -879,31 +781,39 @@ export class TemplateLiteral extends Base {
879
781
  matchPart(s, options) {
880
782
  return segmentTemplateLiteralParts(this, s, options) === undefined ? undefined : s;
881
783
  }
882
- /** @internal */
883
- asTemplateLiteralParser() {
884
- const tuple = new Arrays(false, this.parts.map(partFromString), []);
885
- return decodeTo(string, tuple, new SchemaTransformation.Transformation(SchemaGetter.transformOrFail((s, options) => {
886
- const segments = segmentTemplateLiteralParts(this, s, options);
887
- if (segments) return Effect.succeed(segments);
888
- return Effect.fail(new SchemaIssue.InvalidValue({
889
- expected: "a string matching template literal parts"
890
- }, s, options));
891
- }), SchemaGetter.transform(parts => parts.join(""))));
892
- }
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("")));
893
809
  }
894
810
  /**
895
- * AST node matching a specific `unique symbol` value.
896
- *
897
- * **Details**
898
- *
899
- * Parsing succeeds only when the input is reference-equal to the stored
900
- * `symbol`.
811
+ * Constructs a {@link UniqueSymbol}.
901
812
  *
902
- * @see {@link isUniqueSymbol}
903
- * @category models
904
- * @since 3.10.0
813
+ * @category constructors
814
+ * @since 4.0.0
905
815
  */
906
- export class UniqueSymbol extends Base {
816
+ export const UniqueSymbol = class extends ASTNodeImpl {
907
817
  _tag = "UniqueSymbol";
908
818
  symbol;
909
819
  constructor(symbol, annotations, checks, encoding, context) {
@@ -916,38 +826,21 @@ export class UniqueSymbol extends Base {
916
826
  }
917
827
  /** @internal */
918
828
  toCodecStringTree() {
919
- 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)]);
920
831
  }
921
832
  /** @internal */
922
833
  getExpected() {
923
834
  return globalThis.String(this.symbol);
924
835
  }
925
- }
836
+ };
926
837
  /**
927
- * AST node matching an exact primitive value (string, number, boolean, or
928
- * bigint).
929
- *
930
- * **Details**
931
- *
932
- * Parsing succeeds only when the input is strictly equal (`===`) to the
933
- * stored `literal`. Numeric literals must be finite — `Infinity`, `-Infinity`,
934
- * and `NaN` are rejected at construction time.
838
+ * Constructs a {@link Literal}.
935
839
  *
936
- * **Example** (Creating a literal AST)
937
- *
938
- * ```ts import.meta.vitest
939
- * import { SchemaAST } from "effect"
940
- *
941
- * const ast = new SchemaAST.Literal("active")
942
- * ast.literal // => "active"
943
- * ```
944
- *
945
- * @see {@link LiteralValue}
946
- * @see {@link isLiteral}
947
- * @category models
948
- * @since 3.10.0
840
+ * @category constructors
841
+ * @since 4.0.0
949
842
  */
950
- export class Literal extends Base {
843
+ export const Literal = class extends ASTNodeImpl {
951
844
  _tag = "Literal";
952
845
  literal;
953
846
  constructor(literal, annotations, checks, encoding, context) {
@@ -977,21 +870,18 @@ export class Literal extends Base {
977
870
  getExpected() {
978
871
  return typeof this.literal === "string" ? JSON.stringify(this.literal) : globalThis.String(this.literal);
979
872
  }
980
- }
873
+ };
981
874
  function literalToString(ast) {
982
875
  const literalAsString = globalThis.String(ast.literal);
983
876
  return replaceEncoding(ast, [new Link(new Literal(literalAsString), new SchemaTransformation.Transformation(SchemaGetter.transform(() => ast.literal), SchemaGetter.transform(() => literalAsString)))]);
984
877
  }
985
878
  /**
986
- * AST node matching any `string` value.
987
- *
988
- * @see {@link string}
989
- * @see {@link isString}
879
+ * Constructs a {@link String}.
990
880
  *
991
- * @category models
881
+ * @category constructors
992
882
  * @since 4.0.0
993
883
  */
994
- export class String extends Base {
884
+ export const String = class extends ASTNodeImpl {
995
885
  _tag = "String";
996
886
  /** @internal */
997
887
  getParser() {
@@ -1006,7 +896,7 @@ export class String extends Base {
1006
896
  getExpected() {
1007
897
  return "string";
1008
898
  }
1009
- }
899
+ };
1010
900
  /**
1011
901
  * Provides the singleton {@link String} AST instance.
1012
902
  *
@@ -1022,25 +912,12 @@ export class String extends Base {
1022
912
  */
1023
913
  export const string = /*#__PURE__*/new String();
1024
914
  /**
1025
- * AST node matching any `number` value (including `NaN`, `Infinity`,
1026
- * `-Infinity`).
1027
- *
1028
- * **Details**
1029
- *
1030
- * Default JSON serialization:
915
+ * Constructs a {@link Number}.
1031
916
  *
1032
- * - Finite numbers are serialized as JSON numbers.
1033
- * - `Infinity`, `-Infinity`, and `NaN` are serialized as JSON strings.
1034
- *
1035
- * If the node has an `isFinite` or `isInt` check, the string fallback is
1036
- * skipped since non-finite values cannot occur.
1037
- *
1038
- * @see {@link number}
1039
- * @see {@link isNumber}
1040
- * @category models
917
+ * @category constructors
1041
918
  * @since 4.0.0
1042
919
  */
1043
- export class Number extends Base {
920
+ export const Number = class extends ASTNodeImpl {
1044
921
  _tag = "Number";
1045
922
  /** @internal */
1046
923
  getParser() {
@@ -1078,7 +955,7 @@ export class Number extends Base {
1078
955
  getExpected() {
1079
956
  return "number";
1080
957
  }
1081
- }
958
+ };
1082
959
  function hasCheck(checks, id) {
1083
960
  return checks.some(check => check.annotations?.representation?.id === id || check._tag === "FilterGroup" && hasCheck(check.checks, id));
1084
961
  }
@@ -1098,15 +975,12 @@ function hasCheck(checks, id) {
1098
975
  */
1099
976
  export const number = /*#__PURE__*/new Number();
1100
977
  /**
1101
- * AST node matching any `boolean` value (`true` or `false`).
978
+ * Constructs a {@link Boolean}.
1102
979
  *
1103
- * @see {@link boolean}
1104
- * @see {@link isBoolean}
1105
- *
1106
- * @category models
980
+ * @category constructors
1107
981
  * @since 4.0.0
1108
982
  */
1109
- export class Boolean extends Base {
983
+ export const Boolean = class extends ASTNodeImpl {
1110
984
  _tag = "Boolean";
1111
985
  /** @internal */
1112
986
  getParser() {
@@ -1116,7 +990,7 @@ export class Boolean extends Base {
1116
990
  getExpected() {
1117
991
  return "boolean";
1118
992
  }
1119
- }
993
+ };
1120
994
  /**
1121
995
  * Provides the singleton {@link Boolean} AST instance.
1122
996
  *
@@ -1133,24 +1007,12 @@ export class Boolean extends Base {
1133
1007
  */
1134
1008
  export const boolean = /*#__PURE__*/new Boolean();
1135
1009
  /**
1136
- * AST node matching any `symbol` value.
1010
+ * Constructs a {@link Symbol}.
1137
1011
  *
1138
- * **When to use**
1139
- *
1140
- * Use when you need the AST node class for schemas that match any JavaScript
1141
- * symbol value.
1142
- *
1143
- * **Details**
1144
- *
1145
- * When serialized to a string-based codec, symbols are converted via
1146
- * `Symbol.keyFor` and must be registered with `Symbol.for`.
1147
- *
1148
- * @see {@link symbol}
1149
- * @see {@link isSymbol}
1150
- * @category models
1012
+ * @category constructors
1151
1013
  * @since 4.0.0
1152
1014
  */
1153
- export class Symbol extends Base {
1015
+ export const Symbol = class extends ASTNodeImpl {
1154
1016
  _tag = "Symbol";
1155
1017
  /** @internal */
1156
1018
  getParser() {
@@ -1169,7 +1031,7 @@ export class Symbol extends Base {
1169
1031
  getExpected() {
1170
1032
  return "symbol";
1171
1033
  }
1172
- }
1034
+ };
1173
1035
  /**
1174
1036
  * Provides the singleton {@link Symbol} AST instance.
1175
1037
  *
@@ -1190,19 +1052,12 @@ export class Symbol extends Base {
1190
1052
  */
1191
1053
  export const symbol = /*#__PURE__*/new Symbol();
1192
1054
  /**
1193
- * AST node matching any `bigint` value.
1194
- *
1195
- * **Details**
1055
+ * Constructs a {@link BigInt}.
1196
1056
  *
1197
- * When serialized to a string-based codec, bigints are converted to/from
1198
- * their decimal string representation.
1199
- *
1200
- * @see {@link bigInt}
1201
- * @see {@link isBigInt}
1202
- * @category models
1057
+ * @category constructors
1203
1058
  * @since 4.0.0
1204
1059
  */
1205
- export class BigInt extends Base {
1060
+ export const BigInt = class extends ASTNodeImpl {
1206
1061
  _tag = "BigInt";
1207
1062
  /** @internal */
1208
1063
  getParser() {
@@ -1223,7 +1078,7 @@ export class BigInt extends Base {
1223
1078
  getExpected() {
1224
1079
  return "bigint";
1225
1080
  }
1226
- }
1081
+ };
1227
1082
  /**
1228
1083
  * Provides the singleton {@link BigInt} AST instance.
1229
1084
  *
@@ -1240,48 +1095,12 @@ export class BigInt extends Base {
1240
1095
  */
1241
1096
  export const bigInt = /*#__PURE__*/new BigInt();
1242
1097
  /**
1243
- * AST node for array-like types — both tuples and arrays.
1244
- *
1245
- * **When to use**
1098
+ * Constructs a {@link Arrays}.
1246
1099
  *
1247
- * Use when constructing or inspecting AST nodes for tuple or array-like schemas,
1248
- * including rest elements.
1249
- *
1250
- * **Details**
1251
- *
1252
- * - `elements` — positional element types (tuple elements). An element is
1253
- * optional if its {@link Context.isOptional} is `true`.
1254
- * - `rest` — the rest/variadic element types. When non-empty, the first
1255
- * entry is the "spread" type (e.g. `...Array<string>`), and subsequent
1256
- * entries are trailing positional elements after the spread.
1257
- * - `isMutable` — whether the resulting array is `readonly` (`false`) or
1258
- * mutable (`true`).
1259
- *
1260
- * **Gotchas**
1261
- *
1262
- * Construction enforces TypeScript ordering rules: a required element
1263
- * cannot follow an optional one, and an optional element cannot follow a
1264
- * rest element.
1265
- *
1266
- * **Example** (Inspecting a tuple AST)
1267
- *
1268
- * ```ts import.meta.vitest
1269
- * import { Schema, SchemaAST } from "effect"
1270
- *
1271
- * const schema = Schema.Tuple([Schema.String, Schema.Number])
1272
- * const ast = schema.ast
1273
- *
1274
- * if (SchemaAST.isArrays(ast)) {
1275
- * [ast.elements.length, ast.rest.length] // => [2, 0]
1276
- * }
1277
- * ```
1278
- *
1279
- * @see {@link isArrays}
1280
- * @see {@link Objects}
1281
- * @category models
1100
+ * @category constructors
1282
1101
  * @since 4.0.0
1283
1102
  */
1284
- export class Arrays extends Base {
1103
+ export const Arrays = class extends ASTNodeImpl {
1285
1104
  _tag = "Arrays";
1286
1105
  isMutable;
1287
1106
  elements;
@@ -1356,10 +1175,11 @@ export class Arrays extends Base {
1356
1175
  issues: undefined,
1357
1176
  options
1358
1177
  };
1359
- const concurrency = resolveConcurrency(options?.concurrency);
1360
- const eff = parseArray(state, input, {
1361
- concurrency: concurrency?.concurrency,
1362
- 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
1363
1183
  });
1364
1184
  if (eff) yield* eff;
1365
1185
  // ---------------------------------------------
@@ -1399,8 +1219,8 @@ export class Arrays extends Base {
1399
1219
  getExpected() {
1400
1220
  return "array";
1401
1221
  }
1402
- }
1403
- const parseArray = /*#__PURE__*/iterateEager()({
1222
+ };
1223
+ const parseArrayOptions = {
1404
1224
  onItem(s, item, i) {
1405
1225
  const value = i < s.len ? item : InternalParser.missing;
1406
1226
  return s.getParser(s.tailThreshold, i).parser(value, s.options);
@@ -1423,13 +1243,9 @@ const parseArray = /*#__PURE__*/iterateEager()({
1423
1243
  }
1424
1244
  }
1425
1245
  }
1426
- });
1427
- const resolveConcurrency = value => {
1428
- value = value === "unbounded" ? Infinity : value ?? 1;
1429
- return value > 1 ? {
1430
- concurrency: value
1431
- } : undefined;
1432
1246
  };
1247
+ const parseArray = /*#__PURE__*/iterateEager()(parseArrayOptions);
1248
+ const parseArrayConcurrent = /*#__PURE__*/iterateConcurrent()(parseArrayOptions);
1433
1249
  const wrapPropertyKeyIssue = (s, ast, key, exit) => {
1434
1250
  if (exit.cause.reasons.length === 0) {
1435
1251
  return exit;
@@ -1475,26 +1291,19 @@ export function getIndexSignatureKeys(input, parameter, options = defaultParseOp
1475
1291
  return go(parameterFromPropertyKey(toEncoded(parameter)));
1476
1292
  }
1477
1293
  /**
1478
- * Represents a named property within an {@link Objects} node.
1294
+ * Constructs a {@link PropertySignature}.
1479
1295
  *
1480
- * **Details**
1481
- *
1482
- * Pairs a `name` (any `PropertyKey`) with a `type` ({@link AST}). The
1483
- * property's optionality and mutability are determined by the `type`'s
1484
- * {@link Context}.
1485
- *
1486
- * @see {@link Objects}
1487
- * @category models
1488
- * @since 3.10.0
1296
+ * @category constructors
1297
+ * @since 4.0.0
1489
1298
  */
1490
- export class PropertySignature {
1299
+ export const PropertySignature = class {
1491
1300
  name;
1492
1301
  type;
1493
1302
  constructor(name, type) {
1494
1303
  this.name = name;
1495
1304
  this.type = type;
1496
1305
  }
1497
- }
1306
+ };
1498
1307
  function isIndexSignatureParameterSide(ast) {
1499
1308
  switch (ast._tag) {
1500
1309
  case "String":
@@ -1512,30 +1321,12 @@ function isIndexSignatureParameter(ast) {
1512
1321
  return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterSide(toEncoded(ast));
1513
1322
  }
1514
1323
  /**
1515
- * Represents an index signature entry within an {@link Objects} node.
1516
- *
1517
- * **When to use**
1518
- *
1519
- * Use when constructing or inspecting object AST entries for record-like keys
1520
- * and values.
1521
- *
1522
- * **Details**
1523
- *
1524
- * - `parameter` — the key type AST (e.g. {@link String} for `string` keys,
1525
- * {@link TemplateLiteral} for patterned keys).
1526
- * - `type` — the value type SchemaAST.
1324
+ * Constructs a {@link IndexSignature}.
1527
1325
  *
1528
- * **Gotchas**
1529
- *
1530
- * Using `Schema.optionalKey` on the value type is not allowed for index
1531
- * signatures (throws at construction); use `Schema.optional` instead.
1532
- *
1533
- * @see {@link Objects}
1534
- * @see {@link PropertySignature}
1535
- * @category models
1536
- * @since 3.10.0
1326
+ * @category constructors
1327
+ * @since 4.0.0
1537
1328
  */
1538
- export class IndexSignature {
1329
+ export const IndexSignature = class {
1539
1330
  parameter;
1540
1331
  type;
1541
1332
  constructor(parameter, type) {
@@ -1548,50 +1339,14 @@ export class IndexSignature {
1548
1339
  throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.");
1549
1340
  }
1550
1341
  }
1551
- }
1342
+ };
1552
1343
  /**
1553
- * AST node for object-like schemas, including structs and records.
1554
- *
1555
- * **When to use**
1556
- *
1557
- * Use when constructing or inspecting AST nodes for structs or records rather
1558
- * than array-like schemas.
1559
- *
1560
- * **Details**
1561
- *
1562
- * - `propertySignatures` — named properties with their types (struct fields).
1563
- * - `indexSignatures` — index signature entries (record patterns), each with
1564
- * a `parameter` AST for matching keys and a `type` AST for values.
1565
- *
1566
- * An `Objects` node with no properties and no index signatures performs only a
1567
- * non-nullish check: it accepts any value except `null` and `undefined`,
1568
- * including primitive values.
1569
- *
1570
- * **Gotchas**
1571
- *
1572
- * Duplicate property names throw at construction time.
1573
- *
1574
- * **Example** (Inspecting a struct AST)
1575
- *
1576
- * ```ts import.meta.vitest
1577
- * import { Schema, SchemaAST } from "effect"
1344
+ * Constructs a {@link Objects}.
1578
1345
  *
1579
- * const schema = Schema.Struct({ name: Schema.String })
1580
- * const ast = schema.ast
1581
- *
1582
- * if (SchemaAST.isObjects(ast)) {
1583
- * ast.propertySignatures.map((ps) => [ps.name, ps.type._tag]) // => [["name", "String"]]
1584
- * }
1585
- * ```
1586
- *
1587
- * @see {@link isObjects}
1588
- * @see {@link PropertySignature}
1589
- * @see {@link IndexSignature}
1590
- * @see {@link Arrays}
1591
- * @category models
1346
+ * @category constructors
1592
1347
  * @since 4.0.0
1593
1348
  */
1594
- export class Objects extends Base {
1349
+ export const Objects = class extends ASTNodeImpl {
1595
1350
  _tag = "Objects";
1596
1351
  propertySignatures;
1597
1352
  indexSignatures;
@@ -1613,7 +1368,7 @@ export class Objects extends Base {
1613
1368
  const ast = this;
1614
1369
  const expectedKeys = [];
1615
1370
  for (const ps of ast.propertySignatures) {
1616
- expectedKeys.push(ps.name);
1371
+ expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name);
1617
1372
  }
1618
1373
  const hasProperties = expectedKeys.length;
1619
1374
  const indexCount = ast.indexSignatures.length;
@@ -1632,7 +1387,7 @@ export class Objects extends Base {
1632
1387
  }
1633
1388
  const value = exitValue === InternalParser.sameExit ? inputValue : exitValue[InternalParser.args];
1634
1389
  if (k2 !== InternalParser.missing && value !== InternalParser.missing) {
1635
- 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;
1636
1391
  InternalRecord.assignProperty(s.out, k2, value);
1637
1392
  }
1638
1393
  return Exit.void;
@@ -1658,9 +1413,9 @@ export class Objects extends Base {
1658
1413
  const result = index.parserValue(inputValue, s.options);
1659
1414
  return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : Effect.flatMap(Effect.exit(result), exit => finishIndex(s, key, key, inputValue, exit));
1660
1415
  };
1661
- const parseIndexes = indexCount ? iterateEager()({
1662
- onItem: (s, [key, index]) => parseIndex(s, key, index),
1663
- 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
1664
1419
  }) : undefined;
1665
1420
  const compileMembers = () => {
1666
1421
  if (!properties) {
@@ -1697,54 +1452,56 @@ export class Objects extends Base {
1697
1452
  };
1698
1453
  const errorsAllOption = options.errors === "all";
1699
1454
  const onExcessPropertyError = options.onExcessProperty === "error";
1700
- const onExcessPropertyPreserve = options.onExcessProperty === "preserve";
1455
+ const concurrency = options.concurrency === undefined ? 1 : resolveConcurrency(options.concurrency);
1701
1456
  // ---------------------------------------------
1702
1457
  // handle excess properties
1703
1458
  // ---------------------------------------------
1704
- let inputKeys;
1705
- if (!indexCount && (onExcessPropertyError || onExcessPropertyPreserve)) {
1459
+ const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map(index => getIndexSignatureKeys(record, index.parameter, options)) : undefined;
1460
+ if (onExcessPropertyError) {
1706
1461
  expectedKeysSet ??= new Set(expectedKeys);
1707
- 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);
1708
1469
  for (let i = 0; i < inputKeys.length; i++) {
1709
1470
  const key = inputKeys[i];
1710
- if (!expectedKeysSet.has(key)) {
1471
+ if (!coveredKeys.has(key)) {
1711
1472
  // key is unexpected
1712
- if (onExcessPropertyError) {
1713
- const unexpected = new SchemaIssue.UnexpectedKey(ast, record[key], options);
1714
- const issue = new SchemaIssue.Pointer([key], unexpected);
1715
- if (errorsAllOption) {
1716
- if (state.issues) {
1717
- state.issues.push(issue);
1718
- } else {
1719
- state.issues = [issue];
1720
- }
1721
- 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);
1722
1478
  } else {
1723
- return yield* Effect.fail(new SchemaIssue.Composite(ast, [issue], input, options));
1479
+ state.issues = [issue];
1724
1480
  }
1481
+ continue;
1725
1482
  } else {
1726
- // preserve key
1727
- InternalRecord.assignProperty(out, key, record[key]);
1483
+ return yield* Effect.fail(new SchemaIssue.Composite(ast, [issue], input, options));
1728
1484
  }
1729
1485
  }
1730
1486
  }
1731
1487
  }
1732
- const concurrency = resolveConcurrency(options?.concurrency);
1733
1488
  // ---------------------------------------------
1734
1489
  // handle property signatures
1735
1490
  // ---------------------------------------------
1736
1491
  if (hasProperties) {
1737
- const eff = parseProperties(state, properties, concurrency);
1492
+ const eff = concurrency === 1 ? parseProperties(state, properties) : parsePropertiesConcurrent(state, properties, {
1493
+ concurrency
1494
+ });
1738
1495
  if (eff) yield* eff;
1739
1496
  }
1740
1497
  // ---------------------------------------------
1741
1498
  // handle index signatures
1742
1499
  // ---------------------------------------------
1743
- if (indexCount && !concurrency) {
1500
+ if (indexCount && concurrency === 1) {
1744
1501
  for (let i = 0; i < indexCount; i++) {
1745
1502
  const index = indexes[i];
1746
1503
  const parse = index.is.parameter === string ? parseStringIndex : parseIndex;
1747
- 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));
1748
1505
  for (let j = 0; j < keys.length; j++) {
1749
1506
  const eff = parse(state, keys[j], index);
1750
1507
  if (!effectIsExit(eff)) yield* eff;else if (eff._tag === "Failure") return yield* eff;
@@ -1754,28 +1511,19 @@ export class Objects extends Base {
1754
1511
  const keyPairs = Arr.empty();
1755
1512
  for (let i = 0; i < indexCount; i++) {
1756
1513
  const index = indexes[i];
1757
- 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));
1758
1515
  for (let j = 0; j < keys.length; j++) {
1759
1516
  keyPairs.push([keys[j], index]);
1760
1517
  }
1761
1518
  }
1762
- const eff = parseIndexes(state, keyPairs, concurrency);
1519
+ const eff = parseIndexes(state, keyPairs, {
1520
+ concurrency
1521
+ });
1763
1522
  if (eff) yield* eff;
1764
1523
  }
1765
1524
  if (state.issues) {
1766
1525
  return yield* Effect.fail(new SchemaIssue.Composite(ast, state.issues, input, options));
1767
1526
  }
1768
- if (options.propertyOrder === "original") {
1769
- // preserve input keys order
1770
- const keys = (inputKeys ?? Reflect.ownKeys(record)).concat(expectedKeys);
1771
- const preserved = {};
1772
- for (const key of keys) {
1773
- if (Object.hasOwn(out, key)) {
1774
- InternalRecord.assignProperty(preserved, key, out[key]);
1775
- }
1776
- }
1777
- return preserved;
1778
- }
1779
1527
  return out;
1780
1528
  });
1781
1529
  if (indexCount) return fallback;
@@ -1795,7 +1543,7 @@ export class Objects extends Base {
1795
1543
  // options, needs none of the generator the fallback runs per value.
1796
1544
  return (input, options) => {
1797
1545
  if (input === InternalParser.missing) return InternalParser.missingExit;
1798
- if (options.errors === "all" || options.onExcessProperty !== undefined || options.propertyOrder === "original" || options.concurrency !== undefined) {
1546
+ if (options.errors === "all" || options.onExcessProperty !== undefined || options.concurrency !== undefined && resolveConcurrency(options.concurrency) !== 1) {
1799
1547
  return fallback(input, options);
1800
1548
  }
1801
1549
  if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
@@ -1815,7 +1563,7 @@ export class Objects extends Base {
1815
1563
  for (let index = 0; index < props.length; index++) {
1816
1564
  const property = props[index];
1817
1565
  const name = property.name;
1818
- const hasKey = Object.hasOwn(record, name);
1566
+ const hasKey = hasPropertySignature(record, name);
1819
1567
  const value = hasKey ? record[name] : InternalParser.missing;
1820
1568
  const exit = property.parser(value, options);
1821
1569
  if (!effectIsExit(exit)) {
@@ -1860,7 +1608,7 @@ export class Objects extends Base {
1860
1608
  if (this.propertySignatures.length === 0 && this.indexSignatures.length === 0) return "object | array";
1861
1609
  return "object";
1862
1610
  }
1863
- }
1611
+ };
1864
1612
  function stepProperty(s, p, exit) {
1865
1613
  if (exit._tag === "Failure") {
1866
1614
  return wrapPropertyKeyIssue(s, s.ast, p.name, exit);
@@ -1882,9 +1630,9 @@ function stepProperty(s, p, exit) {
1882
1630
  }
1883
1631
  }
1884
1632
  }
1885
- const parseProperties = /*#__PURE__*/iterateEager()({
1633
+ const parsePropertiesOptions = {
1886
1634
  onItem(s, p) {
1887
- if (!Object.hasOwn(s.input, p.name)) {
1635
+ if (!hasPropertySignature(s.input, p.name)) {
1888
1636
  return p.parser(InternalParser.missing, s.options);
1889
1637
  }
1890
1638
  const value = s.input[p.name];
@@ -1892,7 +1640,9 @@ const parseProperties = /*#__PURE__*/iterateEager()({
1892
1640
  return p.parser(value, s.options);
1893
1641
  },
1894
1642
  step: stepProperty
1895
- });
1643
+ };
1644
+ const parseProperties = /*#__PURE__*/iterateEager()(parsePropertiesOptions);
1645
+ const parsePropertiesConcurrent = /*#__PURE__*/iterateConcurrent()(parsePropertiesOptions);
1896
1646
  function combineChecks(a, b) {
1897
1647
  if (!a) return b;
1898
1648
  if (!b) return a;
@@ -1913,8 +1663,8 @@ export function tuple(elements, checks = undefined) {
1913
1663
  return new Arrays(false, elements.map(e => e.ast), [], undefined, checks);
1914
1664
  }
1915
1665
  /** @internal */
1916
- export function union(members, mode, checks) {
1917
- 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);
1918
1668
  }
1919
1669
  /** @internal */
1920
1670
  export function structWithRest(ast, records) {
@@ -1938,6 +1688,13 @@ export function tupleWithRest(ast, rest) {
1938
1688
  }
1939
1689
  return new Arrays(ast.isMutable, ast.elements, rest, undefined, ast.checks);
1940
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
+ }
1941
1698
  const toCandidate = /*#__PURE__*/memoizeIdempotent(ast => {
1942
1699
  while (true) {
1943
1700
  if (isSuspend(ast)) return unknown;
@@ -2043,6 +1800,7 @@ export function collectSentinels(ast) {
2043
1800
  }
2044
1801
  const candidateIndexCache = /*#__PURE__*/new WeakMap();
2045
1802
  const emptyCandidates = /*#__PURE__*/Object.freeze([]);
1803
+ const hasPropertySignature = (input, key) => key === "__proto__" ? Object.hasOwn(input, key) : key in input;
2046
1804
  function getIndex(types) {
2047
1805
  let index = candidateIndexCache.get(types);
2048
1806
  if (index) return index;
@@ -2100,7 +1858,7 @@ function getIndex(types) {
2100
1858
  }
2101
1859
  index = (input, isConstructor) => {
2102
1860
  if (Predicate.isObjectKeyword(input)) {
2103
- const value = Object.hasOwn(input, key) ? input[key] : undefined;
1861
+ const value = hasPropertySignature(input, key) ? input[key] : undefined;
2104
1862
  if (value !== undefined) return candidates.get(value) ?? emptyCandidates;
2105
1863
  if (isConstructor) return types;
2106
1864
  }
@@ -2127,7 +1885,7 @@ function getIndex(types) {
2127
1885
  // discriminated candidate.
2128
1886
  if (commonSentinel) {
2129
1887
  const [key, [byValue]] = commonSentinel;
2130
- const hasKey = Object.hasOwn(input, key);
1888
+ const hasKey = hasPropertySignature(input, key);
2131
1889
  const value = hasKey ? input[key] : undefined;
2132
1890
  if (hasKey && (!isConstructor || value !== undefined)) {
2133
1891
  const match = byValue.get(value);
@@ -2140,7 +1898,7 @@ function getIndex(types) {
2140
1898
  // absent and undefined keys as unconstrained and therefore selects every candidate that owns the key.
2141
1899
  if (directKey === undefined) {
2142
1900
  for (const [key, [byValue, all]] of bySentinel) {
2143
- const hasKey = Object.hasOwn(input, key);
1901
+ const hasKey = hasPropertySignature(input, key);
2144
1902
  const value = hasKey ? input[key] : undefined;
2145
1903
  if (hasKey && (!isConstructor || value !== undefined)) {
2146
1904
  const match = byValue.get(value);
@@ -2155,7 +1913,7 @@ function getIndex(types) {
2155
1913
  // Missing keys are neutral. An observed key rejects only selected candidates that own it and do not match.
2156
1914
  for (const [key, [byValue, all]] of bySentinel) {
2157
1915
  if (key === directKey) continue;
2158
- const hasKey = Object.hasOwn(input, key);
1916
+ const hasKey = hasPropertySignature(input, key);
2159
1917
  const value = hasKey ? input[key] : undefined;
2160
1918
  if (hasKey && (!isConstructor || value !== undefined)) {
2161
1919
  const match = byValue.get(value);
@@ -2191,44 +1949,20 @@ export function getCandidates(input, types, isConstructor = false) {
2191
1949
  return getIndex(types)(input, isConstructor);
2192
1950
  }
2193
1951
  /**
2194
- * AST node representing a union of schemas.
2195
- *
2196
- * **Details**
2197
- *
2198
- * - `types` — the member AST nodes.
2199
- * - `mode` — `"anyOf"` succeeds on the first match (like TypeScript unions);
2200
- * `"oneOf"` requires exactly one member to match (fails if multiple do).
2201
- *
2202
- * During parsing, members are tried in order. An internal candidate index
2203
- * narrows which members to try based on the runtime type of the input and
2204
- * discriminant ("sentinel") fields, making large unions efficient.
2205
- *
2206
- * **Example** (Inspecting a union AST)
2207
- *
2208
- * ```ts import.meta.vitest
2209
- * import { Schema, SchemaAST } from "effect"
1952
+ * Constructs a {@link Union}.
2210
1953
  *
2211
- * const schema = Schema.Union([Schema.String, Schema.Number])
2212
- * const ast = schema.ast
2213
- *
2214
- * if (SchemaAST.isUnion(ast)) {
2215
- * [ast.types.length, ast.mode] // => [2, "anyOf"]
2216
- * }
2217
- * ```
2218
- *
2219
- * @see {@link isUnion}
2220
- * @category models
2221
- * @since 3.10.0
1954
+ * @category constructors
1955
+ * @since 4.0.0
2222
1956
  */
2223
- export class Union extends Base {
1957
+ export const Union = class extends ASTNodeImpl {
2224
1958
  _tag = "Union";
2225
1959
  types;
2226
- mode;
1960
+ options;
2227
1961
  encodingChecks;
2228
- constructor(types, mode, annotations, checks, encoding, context, encodingChecks) {
1962
+ constructor(types, options, annotations, checks, encoding, context, encodingChecks) {
2229
1963
  super(annotations, checks, encoding, context);
2230
1964
  this.types = types;
2231
- this.mode = mode;
1965
+ this.options = options;
2232
1966
  this.encodingChecks = encodingChecks;
2233
1967
  }
2234
1968
  /** @internal */
@@ -2240,6 +1974,9 @@ export class Union extends Base {
2240
1974
  return InternalParser.missingExit;
2241
1975
  }
2242
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
+ }
2243
1980
  if (candidates.length === 1) {
2244
1981
  const result = compile(candidates[0])(input, options);
2245
1982
  if (result._tag === "Success") return result;
@@ -2250,15 +1987,11 @@ export class Union extends Base {
2250
1987
  compile,
2251
1988
  input,
2252
1989
  out: undefined,
2253
- successes: ast.mode === "oneOf" ? [] : undefined,
1990
+ successes: ast.options?.mode === "oneOf" ? [] : undefined,
2254
1991
  issues: undefined,
2255
1992
  options
2256
1993
  };
2257
- const concurrency = resolveConcurrency(options?.concurrency);
2258
- const eff = parseUnion(state, candidates, concurrency ? {
2259
- ...concurrency,
2260
- orderedStep: true
2261
- } : undefined);
1994
+ const eff = parseUnion(state, candidates);
2262
1995
  if (!eff) {
2263
1996
  if (state.out) return state.out;
2264
1997
  return Effect.fail(new SchemaIssue.AnyOf(ast, state.issues ?? [], input, options));
@@ -2272,7 +2005,7 @@ export class Union extends Base {
2272
2005
  }
2273
2006
  _rebuild(recur, checks, encodingChecks) {
2274
2007
  const types = mapOrSame(this.types, recur);
2275
- 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);
2276
2009
  }
2277
2010
  /** @internal */
2278
2011
  recur(recur) {
@@ -2319,7 +2052,7 @@ export class Union extends Base {
2319
2052
  });
2320
2053
  return Array.from(new Set(types)).join(" | ");
2321
2054
  }
2322
- }
2055
+ };
2323
2056
  function failSingleUnionCandidate(ast, cause, input, options) {
2324
2057
  const issue = InternalSchemaCause.getSchemaIssue(cause);
2325
2058
  if (!issue) return Exit.failCause(cause);
@@ -2351,7 +2084,7 @@ const parseUnion = /*#__PURE__*/iterateEager()({
2351
2084
  }
2352
2085
  }
2353
2086
  });
2354
- 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")]);
2355
2088
  function formatIsMutable(isMutable) {
2356
2089
  return isMutable ? "" : "readonly ";
2357
2090
  }
@@ -2372,37 +2105,12 @@ export function memoizeThunk(f) {
2372
2105
  };
2373
2106
  }
2374
2107
  /**
2375
- * AST node for lazy/recursive schemas.
2108
+ * Constructs a {@link Suspend}.
2376
2109
  *
2377
- * **Details**
2378
- *
2379
- * Wraps a thunk (`() => AST`) that is memoized on first call. Use this to
2380
- * define recursive or mutually recursive schemas without infinite loops at
2381
- * construction time.
2382
- *
2383
- * **Example** (Defining recursive schema ASTs)
2384
- *
2385
- * ```ts import.meta.vitest
2386
- * import { Schema, SchemaAST } from "effect"
2387
- *
2388
- * interface Category {
2389
- * readonly name: string
2390
- * readonly children: ReadonlyArray<Category>
2391
- * }
2392
- *
2393
- * const Category = Schema.Struct({
2394
- * name: Schema.String,
2395
- * children: Schema.Array(Schema.suspend((): Schema.Codec<Category> => Category))
2396
- * })
2397
- *
2398
- * SchemaAST.isObjects(Category.ast) // => true
2399
- * ```
2400
- *
2401
- * @see {@link isSuspend}
2402
- * @category models
2403
- * @since 3.10.0
2110
+ * @category constructors
2111
+ * @since 4.0.0
2404
2112
  */
2405
- export class Suspend extends Base {
2113
+ export const Suspend = class extends ASTNodeImpl {
2406
2114
  _tag = "Suspend";
2407
2115
  thunk;
2408
2116
  constructor(thunk, annotations, checks, encoding, context) {
@@ -2425,32 +2133,14 @@ export class Suspend extends Base {
2425
2133
  getExpected(getExpected) {
2426
2134
  return getExpected(this.thunk());
2427
2135
  }
2428
- }
2429
- // -----------------------------------------------------------------------------
2430
- // Checks
2431
- // -----------------------------------------------------------------------------
2136
+ };
2432
2137
  /**
2433
- * Represents a single validation check attached to an AST node.
2434
- *
2435
- * **Details**
2138
+ * Constructs a {@link Filter}.
2436
2139
  *
2437
- * - `run` — the validation function. Returns `undefined` on success, or an
2438
- * `Issue` on failure.
2439
- * - `annotations` — optional filter-level annotations (expected message,
2440
- * representation, arbitrary constraint hints).
2441
- * - `aborted` — when `true`, parsing stops immediately after this filter
2442
- * fails (no further checks run).
2443
- *
2444
- * Use `.annotate()` to add metadata and `.abort()` to mark as aborting.
2445
- * Combine with another check via `.and()` to form a {@link FilterGroup}.
2446
- *
2447
- * @see {@link FilterGroup}
2448
- * @see {@link Check}
2449
- * @see {@link isPattern}
2450
- * @category models
2140
+ * @category constructors
2451
2141
  * @since 4.0.0
2452
2142
  */
2453
- export class Filter extends Pipeable.Class {
2143
+ export const Filter = class extends Pipeable.Class {
2454
2144
  _tag = "Filter";
2455
2145
  run;
2456
2146
  annotations;
@@ -2480,22 +2170,14 @@ export class Filter extends Pipeable.Class {
2480
2170
  and(other, annotations) {
2481
2171
  return new FilterGroup([this, other], annotations);
2482
2172
  }
2483
- }
2173
+ };
2484
2174
  /**
2485
- * Represents a composite validation check grouping multiple {@link Check} values.
2175
+ * Constructs a {@link FilterGroup}.
2486
2176
  *
2487
- * **Details**
2488
- *
2489
- * Created by calling `.and()` on a {@link Filter} or another `FilterGroup`.
2490
- * All inner checks are run; failures from aborted filters still stop
2491
- * evaluation.
2492
- *
2493
- * @see {@link Filter}
2494
- * @see {@link Check}
2495
- * @category models
2177
+ * @category constructors
2496
2178
  * @since 4.0.0
2497
2179
  */
2498
- export class FilterGroup extends Pipeable.Class {
2180
+ export const FilterGroup = class extends Pipeable.Class {
2499
2181
  _tag = "FilterGroup";
2500
2182
  checks;
2501
2183
  annotations;
@@ -2513,7 +2195,7 @@ export class FilterGroup extends Pipeable.Class {
2513
2195
  and(other, annotations) {
2514
2196
  return new FilterGroup([this, other], annotations);
2515
2197
  }
2516
- }
2198
+ };
2517
2199
  /** @internal */
2518
2200
  export function makeFilter(filter, annotations, aborted = false) {
2519
2201
  return new Filter((input, ast, options) => SchemaIssue.normalizeFilterOutput(ast, filter(input, ast, options), input, options), annotations, aborted);
@@ -2537,18 +2219,15 @@ export function isFinite(annotations) {
2537
2219
  toCode: () => ({
2538
2220
  runtime: "Schema.isFinite()"
2539
2221
  }),
2540
- arbitrary: {
2541
- constraint: {
2542
- noInfinity: true,
2543
- noNaN: true
2544
- }
2222
+ arbitraryConstraint: {
2223
+ number: "finite"
2545
2224
  },
2546
2225
  ...annotations
2547
2226
  });
2548
2227
  }
2549
2228
  /** @internal */
2550
2229
  export const finite = /*#__PURE__*/appendChecks(number, [/*#__PURE__*/isFinite()]);
2551
- 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))));
2552
2231
  /**
2553
2232
  * Creates a {@link Filter} that validates strings by running `RegExp.test`.
2554
2233
  *
@@ -2568,8 +2247,12 @@ const numberToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finite, nonFi
2568
2247
  *
2569
2248
  * **Gotchas**
2570
2249
  *
2571
- * When deriving an arbitrary, only `regExp.source` is used. Regular expression
2572
- * 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.
2573
2256
  *
2574
2257
  * **Example** (Validating an email pattern)
2575
2258
  *
@@ -2603,10 +2286,11 @@ export function isPattern(regExp, annotations) {
2603
2286
  toJsonSchema: () => ({
2604
2287
  pattern: source
2605
2288
  }),
2606
- arbitrary: {
2607
- constraint: {
2608
- patterns: [regExp.source]
2609
- }
2289
+ arbitraryConstraint: {
2290
+ patterns: [{
2291
+ source: regExp.source,
2292
+ flags: regExp.flags
2293
+ }]
2610
2294
  },
2611
2295
  ...annotations
2612
2296
  });
@@ -2763,7 +2447,7 @@ export const optionalKey = /*#__PURE__*/memoizeIdempotent(ast => {
2763
2447
  });
2764
2448
  const optionalKeyLastLink = /*#__PURE__*/applyToLastLink(optionalKey);
2765
2449
  /** @internal */
2766
- export const optional = /*#__PURE__*/memoize(ast => optionalKey(new Union([ast, undefined_], "anyOf")));
2450
+ export const optional = /*#__PURE__*/memoize(ast => optionalKey(new Union([ast, undefined_])));
2767
2451
  /** @internal */
2768
2452
  export const mutableKey = /*#__PURE__*/memoizeIdempotent(ast => {
2769
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);
@@ -2783,9 +2467,8 @@ export function withConstructorDefault(ast, defaultValue) {
2783
2467
  *
2784
2468
  * **Details**
2785
2469
  *
2786
- * This is the low-level primitive behind `Schema.transform` and
2787
- * `Schema.transformOrFail`. It appends a {@link Link} to the `to` node's
2788
- * 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.
2789
2472
  *
2790
2473
  * - Returns a new AST with the same type as `to`.
2791
2474
  *
@@ -2847,7 +2530,7 @@ export function record(key, value) {
2847
2530
  * Checks `ast.context?.isOptional`. Defaults to `false` when no
2848
2531
  * {@link Context} is set.
2849
2532
  *
2850
- * @see {@link optionalKey}
2533
+ * @see `Schema.optionalKey`
2851
2534
  * @see {@link Context}
2852
2535
  * @category predicates
2853
2536
  * @since 4.0.0
@@ -2991,7 +2674,7 @@ export function containsUndefined(ast) {
2991
2674
  }
2992
2675
  }
2993
2676
  function fromConst(ast, value) {
2994
- const succeed = InternalParser.succeed(value);
2677
+ const succeed = value === 0 ? InternalParser.sameExit : InternalParser.succeed(value);
2995
2678
  return (input, options) => {
2996
2679
  if (input === InternalParser.missing) return InternalParser.missingExit;
2997
2680
  if (input === value) return succeed;
@@ -3053,12 +2736,6 @@ function segmentTemplateLiteralParts(ast, input, options) {
3053
2736
  }
3054
2737
  return go(0, 0) ? out : undefined;
3055
2738
  }
3056
- /** @internal */
3057
- export const enumsToLiterals = /*#__PURE__*/memoize(ast => {
3058
- return new Union(ast.enums.map(e => new Literal(e[1], {
3059
- title: e[0]
3060
- })), "anyOf");
3061
- });
3062
2739
  const parameterFromPropertyKey = /*#__PURE__*/applyToSelfOrLastLinkEncodingIdempotent(ast => {
3063
2740
  switch (ast._tag) {
3064
2741
  default:
@@ -3116,7 +2793,7 @@ export function isStringFinite(annotations) {
3116
2793
  }
3117
2794
  const finiteString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringFinite()]);
3118
2795
  const finiteToString = /*#__PURE__*/new Link(finiteString, SchemaTransformation.numberFromString);
3119
- 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);
3120
2797
  /**
3121
2798
  * signed integer only (no leading "+" because TypeScript doesn't support it)
3122
2799
  */
@@ -3141,14 +2818,14 @@ export const bigIntString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isSt
3141
2818
  expected: "a string representing a bigint"
3142
2819
  })]);
3143
2820
  const bigIntToString = /*#__PURE__*/new Link(bigIntString, SchemaTransformation.bigintFromString);
3144
- const REGEXP_PATTERN = "Symbol\\((.*)\\)";
2821
+ const REGEXP_PATTERN = "Symbol\\(([\\s\\S]*)\\)";
3145
2822
  const isStringSymbolRegExp = /*#__PURE__*/new globalThis.RegExp(`^${REGEXP_PATTERN}$`);
3146
2823
  /** @internal */
3147
2824
  export const symbolString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringSymbol()]);
3148
2825
  /**
3149
2826
  * to distinguish between Symbol and String, we need to add a check to the string keyword
3150
2827
  */
3151
- 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) => {
3152
2829
  const key = globalThis.Symbol.keyFor(sym);
3153
2830
  if (key !== undefined) {
3154
2831
  return Effect.succeed(globalThis.String(sym));
@@ -3217,7 +2894,7 @@ export function getConstructorDescriptor(ast) {
3217
2894
  *
3218
2895
  * If the node has {@link Checks}, returns annotations from the last check
3219
2896
  * (which is where user-supplied annotations end up after `.pipe(Schema.annotations(...))`).
3220
- * Otherwise returns `Base.annotations` directly.
2897
+ * Otherwise returns the node's `annotations` directly.
3221
2898
  *
3222
2899
  * **Example** (Reading annotations)
3223
2900
  *
@@ -3364,8 +3041,7 @@ export const Json = /*#__PURE__*/new Declaration([], () => (input, ast, options)
3364
3041
  },
3365
3042
  expected: "JSON value",
3366
3043
  toCodecJson: () => undefined,
3367
- toCodecStringTree: () => unknownToStringTree,
3368
- toArbitrary: () => fc => fc.jsonValue()
3044
+ toCodecStringTree: () => unknownToStringTree
3369
3045
  });
3370
3046
  /** @internal */
3371
3047
  export const MutableJson = /*#__PURE__*/annotate(Json, {
@@ -3377,7 +3053,7 @@ export const MutableJson = /*#__PURE__*/annotate(Json, {
3377
3053
  /** @internal */
3378
3054
  export const unknownToJson = /*#__PURE__*/new Link(Json, /*#__PURE__*/SchemaTransformation.passthrough());
3379
3055
  /** @internal */
3380
- 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());
3381
3057
  /**
3382
3058
  * Returns true if the value is a StringTree value.
3383
3059
  *