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/src/SchemaAST.ts CHANGED
@@ -17,7 +17,7 @@ import * as Effect from "./Effect.ts"
17
17
  import * as Exit from "./Exit.ts"
18
18
  import { format, formatPropertyKey } from "./Formatter.ts"
19
19
  import { identity, memoize, memoizeIdempotent } from "./Function.ts"
20
- import { effectIsExit, iterateEager } from "./internal/effect.ts"
20
+ import { effectIsExit, iterateConcurrent, iterateEager, resolveConcurrency } from "./internal/effect.ts"
21
21
  import * as InternalRecord from "./internal/record.ts"
22
22
  import * as InternalAnnotations from "./internal/schema/annotations.ts"
23
23
  import * as InternalSchemaCause from "./internal/schema/cause.ts"
@@ -30,7 +30,7 @@ import * as SchemaGetter from "./SchemaGetter.ts"
30
30
  import * as SchemaIssue from "./SchemaIssue.ts"
31
31
  import type * as SchemaParser from "./SchemaParser.ts"
32
32
  import * as SchemaTransformation from "./SchemaTransformation.ts"
33
- import type * as FastCheck from "./testing/FastCheck.ts"
33
+ import type * as Types from "./Types.ts"
34
34
 
35
35
  /**
36
36
  * Discriminated union of all AST node types.
@@ -41,14 +41,13 @@ import type * as FastCheck from "./testing/FastCheck.ts"
41
41
  * ({@link isString}, {@link isObjects}, etc.) to narrow to a specific variant,
42
42
  * then access variant-specific fields.
43
43
  *
44
- * - All variants share the {@link Base} fields: `annotations`, `checks`,
45
- * `encoding`, `context`.
44
+ * - All variants share the `annotations`, `checks`, `encoding`, and `context`
45
+ * fields.
46
46
  * - Discriminate on the `_tag` field (e.g. `"String"`, `"Objects"`, `"Union"`).
47
47
  *
48
- * @see {@link Base}
49
48
  * @see {@link isAST}
50
49
  * @category models
51
- * @since 3.10.0
50
+ * @since 4.0.0
52
51
  */
53
52
  export type AST =
54
53
  | Declaration
@@ -398,7 +397,25 @@ export const isSuspend = makeGuard("Suspend")
398
397
  * @category models
399
398
  * @since 4.0.0
400
399
  */
401
- export class Link {
400
+ export interface Link {
401
+ readonly to: AST
402
+ readonly transformation:
403
+ | SchemaTransformation.Transformation<any, any, any, any>
404
+ | SchemaTransformation.Middleware<any, any, any, any, any, any>
405
+ }
406
+
407
+ /**
408
+ * Constructs a {@link Link}.
409
+ *
410
+ * @category constructors
411
+ * @since 4.0.0
412
+ */
413
+ export const Link: new(
414
+ to: AST,
415
+ transformation:
416
+ | SchemaTransformation.Transformation<any, any, any, any>
417
+ | SchemaTransformation.Middleware<any, any, any, any, any, any>
418
+ ) => Link = class {
402
419
  readonly to: AST
403
420
  readonly transformation:
404
421
  | SchemaTransformation.Transformation<any, any, any, any>
@@ -421,7 +438,7 @@ export class Link {
421
438
  *
422
439
  * **Details**
423
440
  *
424
- * Stored on {@link Base.encoding}. When `undefined`, the node has no
441
+ * Stored on an AST node's `encoding` field. When `undefined`, the node has no
425
442
  * encoding transformation (type and encoded forms are identical).
426
443
  *
427
444
  * @see {@link Link}
@@ -437,22 +454,25 @@ export type Encoding = readonly [Link, ...Array<Link>]
437
454
  * **Details**
438
455
  *
439
456
  * Pass to `Schema.decodeUnknown`, `Schema.encode`, and related APIs to customize
440
- * error reporting, excess property handling, output key ordering, check
441
- * execution, and asynchronous parser concurrency.
457
+ * error reporting, excess property handling, check execution, and product
458
+ * concurrency. Options apply throughout the parse; schema annotations do not
459
+ * override them.
442
460
  *
443
461
  * - `errors` — `"first"` (default) stops at the first error; `"all"` collects
444
462
  * every error.
445
463
  * - `onExcessProperty` — `"ignore"` (default) strips unknown object keys;
446
- * `"error"` fails; `"preserve"` keeps them.
447
- * - `propertyOrder` — `"none"` (default) lets the system choose key order;
448
- * `"original"` preserves input key order.
464
+ * `"error"` fails.
449
465
  * - `disableChecks` — skips validation checks while still applying defaults and
450
466
  * transformations.
451
- * - `concurrency` — maximum number of async parse effects to run concurrently;
452
- * defaults to `1`, or use `"unbounded"`.
467
+ * - `concurrency` — controls concurrent parsing of tuple elements, array
468
+ * elements, struct fields, and record entries using the same semantics as
469
+ * `Effect.forEach`; the default is sequential.
453
470
  * - `reportInput` — includes rejected input values in value-bearing schema
454
471
  * issues.
455
472
  *
473
+ * Object property order is unspecified, including in values passed to checks.
474
+ * Decoding and encoding do not guarantee preservation of input key order.
475
+ *
456
476
  * @category options
457
477
  * @since 3.10.0
458
478
  */
@@ -476,48 +496,45 @@ export interface ParseOptions {
476
496
  * **Details**
477
497
  *
478
498
  * The default, `"ignore"`, strips unspecified properties from the output. Use
479
- * `"error"` to fail when an excess property is present, or `"preserve"` to
480
- * keep excess properties in the output.
499
+ * `"error"` to fail when an excess property is present. A key is covered by a
500
+ * declared property or any index signature selecting that key. This applies
501
+ * to structs, records, and structs with rest. Values must satisfy every
502
+ * applicable index signature. Empty structs keep their non-nullish behavior.
481
503
  *
482
504
  * @default "ignore"
483
505
  */
484
- readonly onExcessProperty?: "ignore" | "error" | "preserve" | undefined
506
+ readonly onExcessProperty?: "ignore" | "error" | undefined
485
507
 
486
508
  /**
487
- * The `propertyOrder` option provides control over the order of object fields
488
- * in the output. This feature is useful when the sequence of keys is
489
- * important for the consuming processes or when maintaining the input order
490
- * enhances readability and usability.
509
+ * Whether to disable checks while still applying defaults and
510
+ * transformations.
511
+ */
512
+ readonly disableChecks?: boolean | undefined
513
+
514
+ /**
515
+ * Controls how many children of a product schema may parse concurrently.
491
516
  *
492
517
  * **Details**
493
518
  *
494
- * By default, the `propertyOrder` option is set to `"none"`. This means that
495
- * the internal system decides the order of keys to optimize parsing speed.
519
+ * This option has the same concurrency semantics as {@link Effect.forEach}.
520
+ * It applies to tuples, arrays, structs, records, and structs with rest. Each
521
+ * nested product applies the limit independently. Union members remain
522
+ * sequential, though products inside the current union member still receive
523
+ * the option.
496
524
  *
497
- * Setting `propertyOrder` to `"original"` ensures that the keys are ordered
498
- * as they appear in the input during the decoding/encoding process.
525
+ * Array and tuple outputs retain their element order. Other observable work,
526
+ * including issue accumulation and colliding transformed record keys, follows
527
+ * effect completion order when concurrency is greater than `1`.
499
528
  *
500
529
  * **Gotchas**
501
530
  *
502
- * The key order for `"none"` should not be considered stable and may change
503
- * in future updates without notice.
531
+ * With `errors: "first"`, the first observed child failure interrupts the
532
+ * remaining children and may not belong to the earliest product position.
533
+ * Concurrent children may perform effects before another child fails.
504
534
  *
505
- * @default "none"
535
+ * @default undefined
506
536
  */
507
- readonly propertyOrder?: "none" | "original" | undefined
508
-
509
- /**
510
- * Whether to disable checks while still applying defaults and
511
- * transformations.
512
- */
513
- readonly disableChecks?: boolean | undefined
514
-
515
- /**
516
- * The maximum number of async effects to run concurrently.
517
- *
518
- * @default 1
519
- */
520
- readonly concurrency?: number | "unbounded" | undefined
537
+ readonly concurrency?: Types.Concurrency | undefined
521
538
 
522
539
  /**
523
540
  * Whether schema issues should retain and report rejected input values.
@@ -533,13 +550,12 @@ export interface ParseOptions {
533
550
  * Enabling this option can retain or disclose secrets, personally
534
551
  * identifiable information, and large object graphs. The `input` field is
535
552
  * enumerable and may be included by object enumeration, spread, or
536
- * serialization. Disabling it on a nested schema does not redact that value
537
- * from an ancestor issue whose input reporting remains enabled. Issues
538
- * returned directly by user-defined declarations, checks, transformations,
539
- * and middleware are not modified; their authors decide whether to retain an
540
- * input. To respect this option, pass the callback's input and parse options
541
- * directly to a value-bearing issue constructor. Custom messages and
542
- * annotations remain the caller's responsibility regardless of this option.
553
+ * serialization. Issues returned directly by user-defined declarations,
554
+ * checks, transformations, and middleware are not modified; their authors
555
+ * decide whether to retain an input. To respect this option, pass the
556
+ * callback's input and parse options directly to a value-bearing issue
557
+ * constructor. Custom messages and annotations remain the caller's
558
+ * responsibility regardless of this option.
543
559
  * Formatting an issue with `SchemaIssue.makeFormatterDefault()`, reading
544
560
  * `SchemaError.message`, or formatting a Standard Schema failure can disclose
545
561
  * retained input.
@@ -553,7 +569,7 @@ export interface ParseOptions {
553
569
  export const defaultParseOptions: ParseOptions = {}
554
570
 
555
571
  /**
556
- * Represents per-property metadata attached to AST nodes via {@link Base.context}.
572
+ * Represents per-property metadata attached to an AST node's `context` field.
557
573
  *
558
574
  * **Details**
559
575
  *
@@ -568,12 +584,31 @@ export const defaultParseOptions: ParseOptions = {}
568
584
  * - `annotations` — key-level annotations (e.g. description of the key
569
585
  * itself).
570
586
  *
571
- * @see {@link optionalKey}
587
+ * @see `Schema.optionalKey`
572
588
  * @see {@link isOptional}
573
589
  * @category models
574
590
  * @since 4.0.0
575
591
  */
576
- export class Context {
592
+ export interface Context {
593
+ readonly isOptional: boolean
594
+ readonly isMutable: boolean
595
+ /** Used for constructor default values (e.g. `withConstructorDefault` API) */
596
+ readonly constructorDefault: Link | undefined
597
+ readonly annotations: Schema.Annotations.Key<unknown> | undefined
598
+ }
599
+
600
+ /**
601
+ * Constructs a {@link Context}.
602
+ *
603
+ * @category constructors
604
+ * @since 4.0.0
605
+ */
606
+ export const Context: new(
607
+ isOptional: boolean,
608
+ isMutable: boolean, /** Used for constructor default values (e.g. `withConstructorDefault` API) */
609
+ constructorDefault?: Link | undefined,
610
+ annotations?: Schema.Annotations.Key<unknown> | undefined
611
+ ) => Context = class {
577
612
  readonly isOptional: boolean
578
613
  readonly isMutable: boolean
579
614
  /** Used for constructor default values (e.g. `withConstructorDefault` API) */
@@ -595,8 +630,8 @@ export class Context {
595
630
  }
596
631
 
597
632
  /**
598
- * Non-empty array of validation {@link Check} values attached to an AST node
599
- * via {@link Base.checks}.
633
+ * Non-empty array of validation {@link Check} values attached to an AST node's
634
+ * `checks` field.
600
635
  *
601
636
  * **Details**
602
637
  *
@@ -612,28 +647,17 @@ export class Context {
612
647
  export type Checks = readonly [Check<any>, ...Array<Check<any>>]
613
648
 
614
649
  const TypeId = "~effect/Schema"
650
+ interface ASTNode {
651
+ readonly [TypeId]: typeof TypeId
652
+ readonly _tag: string
653
+ readonly annotations: Schema.Annotations.Annotations | undefined
654
+ readonly checks: Checks | undefined
655
+ readonly encoding: Encoding | undefined
656
+ readonly context: Context | undefined
657
+ toString(): string
658
+ }
615
659
 
616
- /**
617
- * Represents the abstract base class for all {@link AST} node variants.
618
- *
619
- * **Details**
620
- *
621
- * Every AST node extends `Base` and inherits these fields:
622
- *
623
- * - `annotations` — user-supplied metadata (identifier, title, description,
624
- * arbitrary keys).
625
- * - `checks` — optional {@link Checks} for post-type-match validation.
626
- * - `encoding` — optional {@link Encoding} chain for type ↔ wire
627
- * transformations.
628
- * - `context` — optional {@link Context} for per-property metadata.
629
- *
630
- * Subclasses add a `_tag` discriminant and variant-specific data.
631
- *
632
- * @see {@link AST}
633
- * @category models
634
- * @since 4.0.0
635
- */
636
- export abstract class Base {
660
+ abstract class ASTNodeImpl implements ASTNode {
637
661
  readonly [TypeId] = TypeId
638
662
  abstract readonly _tag: string
639
663
  readonly annotations: Schema.Annotations.Annotations | undefined
@@ -657,15 +681,9 @@ export abstract class Base {
657
681
  }
658
682
  }
659
683
 
660
- /**
661
- * Parser factory carried by a {@link Declaration}.
662
- *
663
- * @category models
664
- * @since 4.0.0
665
- */
666
- export type DeclarationRun = (
684
+ type DeclarationRun = (
667
685
  typeParameters: ReadonlyArray<AST>
668
- ) => (input: unknown, self: Declaration, options: ParseOptions) => Effect.Effect<any, SchemaIssue.Issue, any>
686
+ ) => (input: unknown, self: Declaration, options: ParseOptions) => Effect.Effect<any, SchemaIssue.Issue>
669
687
 
670
688
  /**
671
689
  * AST node for user-defined opaque types with custom parsing logic.
@@ -680,20 +698,60 @@ export type DeclarationRun = (
680
698
  * - `typeParameters` — inner schemas this declaration is parameterized over
681
699
  * (e.g. the element type for a custom collection).
682
700
  * - `run` — factory that receives `typeParameters` and returns a parser that
683
- * validates or transforms raw input.
701
+ * validates or transforms raw input. The `Effect` returned by the parser must
702
+ * complete synchronously.
684
703
  *
685
704
  * @see {@link isDeclaration}
686
705
  * @category models
687
- * @since 3.10.0
706
+ * @since 4.0.0
707
+ */
708
+ export interface Declaration extends ASTNode {
709
+ readonly _tag: "Declaration"
710
+ readonly typeParameters: ReadonlyArray<AST>
711
+ readonly run: DeclarationRun
712
+ readonly encodingChecks: Checks | undefined
713
+ /**
714
+ * Parser factory {@link flip} swaps in, so a declaration can behave
715
+ * differently when encoding. `undefined` reuses `run`.
716
+ */
717
+ readonly encodingRun: DeclarationRun | undefined
718
+ /** @internal */
719
+
720
+ getParser(): SchemaParser.Parser
721
+ /** @internal */
722
+
723
+ recur(recur: (ast: AST) => AST): Declaration
724
+ /** @internal */
725
+
726
+ flip(recur: (ast: AST) => AST): Declaration
727
+ /** @internal */
728
+
729
+ getExpected(): string
730
+ }
731
+
732
+ /**
733
+ * Constructs a {@link Declaration}.
734
+ *
735
+ * @category constructors
736
+ * @since 4.0.0
688
737
  */
689
- export class Declaration extends Base {
738
+ export const Declaration: new(
739
+ typeParameters: ReadonlyArray<AST>,
740
+ run: DeclarationRun,
741
+ annotations?: Schema.Annotations.Annotations,
742
+ checks?: Checks,
743
+ encoding?: Encoding,
744
+ context?: Context,
745
+ encodingChecks?: Checks,
746
+ encodingRun?: DeclarationRun
747
+ ) => Declaration = class extends ASTNodeImpl {
690
748
  readonly _tag = "Declaration"
691
749
  readonly typeParameters: ReadonlyArray<AST>
692
750
  readonly run: DeclarationRun
693
751
  readonly encodingChecks: Checks | undefined
694
752
  /**
695
753
  * Parser factory {@link flip} swaps in, so a declaration can behave
696
- * differently when encoding. `undefined` reuses {@link run}.
754
+ * differently when encoding. `undefined` reuses `run`.
697
755
  */
698
756
  readonly encodingRun: DeclarationRun | undefined
699
757
 
@@ -762,7 +820,28 @@ export class Declaration extends Base {
762
820
  * @category models
763
821
  * @since 4.0.0
764
822
  */
765
- export class Null extends Base {
823
+ export interface Null extends ASTNode {
824
+ readonly _tag: "Null"
825
+ /** @internal */
826
+
827
+ getParser(): SchemaParser.Parser
828
+ /** @internal */
829
+
830
+ getExpected(): string
831
+ }
832
+
833
+ /**
834
+ * Constructs a {@link Null}.
835
+ *
836
+ * @category constructors
837
+ * @since 4.0.0
838
+ */
839
+ export const Null: new(
840
+ annotations?: Schema.Annotations.Annotations | undefined,
841
+ checks?: Checks | undefined,
842
+ encoding?: Encoding | undefined,
843
+ context?: Context | undefined
844
+ ) => Null = class extends ASTNodeImpl {
766
845
  readonly _tag = "Null"
767
846
  /** @internal */
768
847
  getParser() {
@@ -802,7 +881,31 @@ export {
802
881
  * @category models
803
882
  * @since 4.0.0
804
883
  */
805
- export class Undefined extends Base {
884
+ export interface Undefined extends ASTNode {
885
+ readonly _tag: "Undefined"
886
+ /** @internal */
887
+
888
+ getParser(): SchemaParser.Parser
889
+ /** @internal */
890
+
891
+ toCodecJson(): AST
892
+ /** @internal */
893
+
894
+ getExpected(): string
895
+ }
896
+
897
+ /**
898
+ * Constructs a {@link Undefined}.
899
+ *
900
+ * @category constructors
901
+ * @since 4.0.0
902
+ */
903
+ export const Undefined: new(
904
+ annotations?: Schema.Annotations.Annotations | undefined,
905
+ checks?: Checks | undefined,
906
+ encoding?: Encoding | undefined,
907
+ context?: Context | undefined
908
+ ) => Undefined = class extends ASTNodeImpl {
806
909
  readonly _tag = "Undefined"
807
910
  /** @internal */
808
911
  getParser() {
@@ -862,7 +965,33 @@ export {
862
965
  * @category models
863
966
  * @since 4.0.0
864
967
  */
865
- export class Void extends Base {
968
+ export interface Void extends ASTNode {
969
+ readonly _tag: "Void"
970
+ /** @internal */
971
+
972
+ getParser(): (
973
+ input: unknown
974
+ ) => InternalParser.Success<undefined, never> | InternalParser.Success<typeof InternalParser.missing, never>
975
+ /** @internal */
976
+
977
+ toCodecJson(): AST
978
+ /** @internal */
979
+
980
+ getExpected(): string
981
+ }
982
+
983
+ /**
984
+ * Constructs a {@link Void}.
985
+ *
986
+ * @category constructors
987
+ * @since 4.0.0
988
+ */
989
+ export const Void: new(
990
+ annotations?: Schema.Annotations.Annotations | undefined,
991
+ checks?: Checks | undefined,
992
+ encoding?: Encoding | undefined,
993
+ context?: Context | undefined
994
+ ) => Void = class extends ASTNodeImpl {
866
995
  readonly _tag = "Void"
867
996
  /** @internal */
868
997
  getParser() {
@@ -917,7 +1046,28 @@ export {
917
1046
  * @category models
918
1047
  * @since 4.0.0
919
1048
  */
920
- export class Never extends Base {
1049
+ export interface Never extends ASTNode {
1050
+ readonly _tag: "Never"
1051
+ /** @internal */
1052
+
1053
+ getParser(): SchemaParser.Parser
1054
+ /** @internal */
1055
+
1056
+ getExpected(): string
1057
+ }
1058
+
1059
+ /**
1060
+ * Constructs a {@link Never}.
1061
+ *
1062
+ * @category constructors
1063
+ * @since 4.0.0
1064
+ */
1065
+ export const Never: new(
1066
+ annotations?: Schema.Annotations.Annotations | undefined,
1067
+ checks?: Checks | undefined,
1068
+ encoding?: Encoding | undefined,
1069
+ context?: Context | undefined
1070
+ ) => Never = class extends ASTNodeImpl {
921
1071
  readonly _tag = "Never"
922
1072
  /** @internal */
923
1073
  getParser() {
@@ -954,7 +1104,28 @@ export const never = new Never()
954
1104
  * @category models
955
1105
  * @since 4.0.0
956
1106
  */
957
- export class Any extends Base {
1107
+ export interface Any extends ASTNode {
1108
+ readonly _tag: "Any"
1109
+ /** @internal */
1110
+
1111
+ getParser(): SchemaParser.Parser
1112
+ /** @internal */
1113
+
1114
+ getExpected(): string
1115
+ }
1116
+
1117
+ /**
1118
+ * Constructs a {@link Any}.
1119
+ *
1120
+ * @category constructors
1121
+ * @since 4.0.0
1122
+ */
1123
+ export const Any: new(
1124
+ annotations?: Schema.Annotations.Annotations | undefined,
1125
+ checks?: Checks | undefined,
1126
+ encoding?: Encoding | undefined,
1127
+ context?: Context | undefined
1128
+ ) => Any = class extends ASTNodeImpl {
958
1129
  readonly _tag = "Any"
959
1130
  /** @internal */
960
1131
  getParser() {
@@ -994,7 +1165,28 @@ export const any = new Any()
994
1165
  * @category models
995
1166
  * @since 4.0.0
996
1167
  */
997
- export class Unknown extends Base {
1168
+ export interface Unknown extends ASTNode {
1169
+ readonly _tag: "Unknown"
1170
+ /** @internal */
1171
+
1172
+ getParser(): SchemaParser.Parser
1173
+ /** @internal */
1174
+
1175
+ getExpected(): string
1176
+ }
1177
+
1178
+ /**
1179
+ * Constructs a {@link Unknown}.
1180
+ *
1181
+ * @category constructors
1182
+ * @since 4.0.0
1183
+ */
1184
+ export const Unknown: new(
1185
+ annotations?: Schema.Annotations.Annotations | undefined,
1186
+ checks?: Checks | undefined,
1187
+ encoding?: Encoding | undefined,
1188
+ context?: Context | undefined
1189
+ ) => Unknown = class extends ASTNodeImpl {
998
1190
  readonly _tag = "Unknown"
999
1191
  /** @internal */
1000
1192
  getParser() {
@@ -1029,9 +1221,30 @@ export const unknown = new Unknown()
1029
1221
  * @see {@link isObjectKeyword}
1030
1222
  *
1031
1223
  * @category models
1032
- * @since 3.10.0
1224
+ * @since 4.0.0
1225
+ */
1226
+ export interface ObjectKeyword extends ASTNode {
1227
+ readonly _tag: "ObjectKeyword"
1228
+ /** @internal */
1229
+
1230
+ getParser(): SchemaParser.Parser
1231
+ /** @internal */
1232
+
1233
+ getExpected(): string
1234
+ }
1235
+
1236
+ /**
1237
+ * Constructs a {@link ObjectKeyword}.
1238
+ *
1239
+ * @category constructors
1240
+ * @since 4.0.0
1033
1241
  */
1034
- export class ObjectKeyword extends Base {
1242
+ export const ObjectKeyword: new(
1243
+ annotations?: Schema.Annotations.Annotations | undefined,
1244
+ checks?: Checks | undefined,
1245
+ encoding?: Encoding | undefined,
1246
+ context?: Context | undefined
1247
+ ) => ObjectKeyword = class extends ASTNodeImpl {
1035
1248
  readonly _tag = "ObjectKeyword"
1036
1249
  /** @internal */
1037
1250
  getParser() {
@@ -1071,7 +1284,43 @@ export const objectKeyword = new ObjectKeyword()
1071
1284
  * @category models
1072
1285
  * @since 4.0.0
1073
1286
  */
1074
- export class Enum extends Base {
1287
+ export interface Enum extends ASTNode {
1288
+ readonly _tag: "Enum"
1289
+ readonly enums: ReadonlyArray<
1290
+ readonly [
1291
+ string,
1292
+ string | number
1293
+ ]
1294
+ >
1295
+ /** @internal */
1296
+
1297
+ getParser(): SchemaParser.Parser
1298
+ /** @internal */
1299
+
1300
+ toCodecStringTree(): AST
1301
+ /** @internal */
1302
+
1303
+ getExpected(): string
1304
+ }
1305
+
1306
+ /**
1307
+ * Constructs a {@link Enum}. Numeric values must be finite.
1308
+ *
1309
+ * @category constructors
1310
+ * @since 4.0.0
1311
+ */
1312
+ export const Enum: new(
1313
+ enums: ReadonlyArray<
1314
+ readonly [
1315
+ string,
1316
+ string | number
1317
+ ]
1318
+ >,
1319
+ annotations?: Schema.Annotations.Annotations,
1320
+ checks?: Checks,
1321
+ encoding?: Encoding,
1322
+ context?: Context
1323
+ ) => Enum = class extends ASTNodeImpl {
1075
1324
  readonly _tag = "Enum"
1076
1325
  readonly enums: ReadonlyArray<readonly [string, string | number]>
1077
1326
 
@@ -1083,6 +1332,11 @@ export class Enum extends Base {
1083
1332
  context?: Context
1084
1333
  ) {
1085
1334
  super(annotations, checks, encoding, context)
1335
+ for (const [, value] of enums) {
1336
+ if (typeof value === "number" && !globalThis.Number.isFinite(value)) {
1337
+ throw new Error(`A numeric enum value must be finite, got ${format(value)}`)
1338
+ }
1339
+ }
1086
1340
  this.enums = enums
1087
1341
  }
1088
1342
  /** @internal */
@@ -1099,7 +1353,7 @@ export class Enum extends Base {
1099
1353
  const coercions = Object.fromEntries(this.enums.map(([_, v]) => [globalThis.String(v), v]))
1100
1354
  return replaceEncoding(this, [
1101
1355
  new Link(
1102
- new Union(Object.keys(coercions).map((k) => new Literal(k)), "anyOf"),
1356
+ new Union(Object.keys(coercions).map((k) => new Literal(k))),
1103
1357
  new SchemaTransformation.Transformation(
1104
1358
  SchemaGetter.transform((s) => coercions[s]),
1105
1359
  SchemaGetter.String()
@@ -1123,20 +1377,34 @@ type TemplateLiteralPart =
1123
1377
  | TemplateLiteral
1124
1378
  | Union<TemplateLiteralPart>
1125
1379
 
1126
- function isTemplateLiteralPart(ast: AST): ast is TemplateLiteralPart {
1380
+ function isTemplateLiteralPart(ast: AST, path: string, validated: WeakSet<AST>): ast is TemplateLiteralPart {
1381
+ if (validated.has(ast)) return true
1382
+ if (ast.encoding) {
1383
+ throw new Error(`TemplateLiteral parts cannot have an encoding at ${path}`)
1384
+ }
1385
+ let valid: boolean
1127
1386
  switch (ast._tag) {
1128
1387
  case "String":
1129
1388
  case "Number":
1130
1389
  case "BigInt":
1131
- return true
1390
+ valid = true
1391
+ break
1132
1392
  case "Literal":
1393
+ valid = !ast.checks
1394
+ break
1133
1395
  case "TemplateLiteral":
1134
- return !ast.checks
1396
+ valid = !ast.checks &&
1397
+ ast.parts.every((part, index) => isTemplateLiteralPart(part, `${path}.parts[${index}]`, validated))
1398
+ break
1135
1399
  case "Union":
1136
- return !ast.checks && ast.types.every(isTemplateLiteralPart)
1400
+ valid = !ast.checks &&
1401
+ ast.types.every((part, index) => isTemplateLiteralPart(part, `${path}.types[${index}]`, validated))
1402
+ break
1137
1403
  default:
1138
1404
  return false
1139
1405
  }
1406
+ if (valid) validated.add(ast)
1407
+ return valid
1140
1408
  }
1141
1409
 
1142
1410
  /**
@@ -1150,9 +1418,46 @@ function isTemplateLiteralPart(ast: AST): ast is TemplateLiteralPart {
1150
1418
  *
1151
1419
  * @see {@link isTemplateLiteral}
1152
1420
  * @category models
1153
- * @since 3.10.0
1421
+ * @since 4.0.0
1422
+ */
1423
+ export interface TemplateLiteral extends ASTNode {
1424
+ readonly _tag: "TemplateLiteral"
1425
+ readonly parts: ReadonlyArray<AST>
1426
+ /** @internal */
1427
+ readonly encodedParts: ReadonlyArray<TemplateLiteralPart>
1428
+ /** @internal */
1429
+ readonly literals: ReadonlyArray<string | undefined>
1430
+ /** @internal */
1431
+ readonly suffixLengths: ReadonlyArray<number>
1432
+ /** @internal */
1433
+
1434
+ getParser(compile: SchemaParser.Compiler): SchemaParser.Parser
1435
+ /** @internal */
1436
+
1437
+ getExpected(): string
1438
+ /** @internal */
1439
+
1440
+ matchPart(s: string, options: ParseOptions): string | undefined
1441
+ }
1442
+
1443
+ /**
1444
+ * Constructs a {@link TemplateLiteral}.
1445
+ *
1446
+ * **Gotchas**
1447
+ *
1448
+ * Throws if a part contains an encoding, including inside unions or nested
1449
+ * template literals. Parts must describe their values without transformations.
1450
+ *
1451
+ * @category constructors
1452
+ * @since 4.0.0
1154
1453
  */
1155
- export class TemplateLiteral extends Base {
1454
+ export const TemplateLiteral: new(
1455
+ parts: ReadonlyArray<AST>,
1456
+ annotations?: Schema.Annotations.Annotations,
1457
+ checks?: Checks,
1458
+ encoding?: Encoding,
1459
+ context?: Context
1460
+ ) => TemplateLiteral = class extends ASTNodeImpl {
1156
1461
  readonly _tag = "TemplateLiteral"
1157
1462
  readonly parts: ReadonlyArray<AST>
1158
1463
  /** @internal */
@@ -1172,14 +1477,14 @@ export class TemplateLiteral extends Base {
1172
1477
  super(annotations, checks, encoding, context)
1173
1478
  const encodedParts: Array<TemplateLiteralPart> = []
1174
1479
  const literals: Array<string | undefined> = []
1175
- for (const part of parts) {
1176
- const encoded = toEncoded(part)
1177
- if (isTemplateLiteralPart(encoded)) {
1178
- encodedParts.push(encoded)
1179
- literals.push(encoded._tag === "Literal" ? globalThis.String(encoded.literal) : undefined)
1180
- } else {
1181
- throw new Error(`Invalid TemplateLiteral part ${encoded._tag}`)
1480
+ const validated = new WeakSet<AST>()
1481
+ for (let index = 0; index < parts.length; index++) {
1482
+ const part = parts[index]
1483
+ if (!isTemplateLiteralPart(part, `parts[${index}]`, validated)) {
1484
+ throw new Error(`Invalid TemplateLiteral part ${part._tag}`)
1182
1485
  }
1486
+ encodedParts.push(part)
1487
+ literals.push(part._tag === "Literal" ? globalThis.String(part.literal) : undefined)
1183
1488
  }
1184
1489
  const suffixLengths = new Array<number>(encodedParts.length + 1)
1185
1490
  suffixLengths[encodedParts.length] = 0
@@ -1193,7 +1498,8 @@ export class TemplateLiteral extends Base {
1193
1498
  }
1194
1499
  /** @internal */
1195
1500
  getParser(compile: SchemaParser.Compiler): SchemaParser.Parser {
1196
- const parser = compile(this.asTemplateLiteralParser())
1501
+ const tuple = new Arrays(false, this.parts.map(partFromString), [])
1502
+ const parser = compile(decodeTo(string, tuple, templateLiteralTransformation(this)))
1197
1503
  return (input, options) => {
1198
1504
  if (input === InternalParser.missing) return InternalParser.missingExit
1199
1505
  const result = parser(input, options)
@@ -1214,28 +1520,46 @@ export class TemplateLiteral extends Base {
1214
1520
  matchPart(s: string, options: ParseOptions): string | undefined {
1215
1521
  return segmentTemplateLiteralParts(this, s, options) === undefined ? undefined : s
1216
1522
  }
1217
- /** @internal */
1218
- asTemplateLiteralParser(): Arrays {
1219
- const tuple = new Arrays(false, this.parts.map(partFromString), [])
1220
- return decodeTo(
1221
- string,
1222
- tuple,
1223
- new SchemaTransformation.Transformation(
1224
- SchemaGetter.transformOrFail((s: string, options) => {
1225
- const segments = segmentTemplateLiteralParts(this, s, options)
1226
- if (segments) return Effect.succeed(segments)
1227
- return Effect.fail(
1228
- new SchemaIssue.InvalidValue(
1229
- { expected: "a string matching template literal parts" },
1230
- s,
1231
- options
1232
- )
1233
- )
1234
- }),
1235
- SchemaGetter.transform((parts) => parts.join(""))
1523
+ }
1524
+
1525
+ /** @internal */
1526
+ export function templateLiteralParser(parts: ReadonlyArray<AST>): Arrays {
1527
+ // Encoded members can overlap even when decoding selects exactly one member.
1528
+ // Match their spellings here; the original tuple enforces the union's mode.
1529
+ const normalize = memoize((encoded: AST): AST => {
1530
+ if (encoded._tag !== "Union") return encoded
1531
+ const types = mapOrSame(encoded.types, normalize)
1532
+ return (encoded.options?.mode ?? "anyOf") === "anyOf" && types === encoded.types
1533
+ ? encoded
1534
+ : new Union(
1535
+ types,
1536
+ encoded.options === undefined ? undefined : { ...encoded.options, mode: "anyOf" },
1537
+ encoded.annotations,
1538
+ encoded.checks,
1539
+ undefined,
1540
+ encoded.context
1236
1541
  )
1237
- )
1238
- }
1542
+ })
1543
+ const template = new TemplateLiteral(parts.map((part) => normalize(toEncoded(part))))
1544
+ const tuple = new Arrays(false, parts.map(partFromString), [])
1545
+ return decodeTo(template, tuple, templateLiteralTransformation(template))
1546
+ }
1547
+
1548
+ function templateLiteralTransformation(template: TemplateLiteral) {
1549
+ return new SchemaTransformation.Transformation(
1550
+ SchemaGetter.transformEffect((s: string, options) => {
1551
+ const segments = segmentTemplateLiteralParts(template, s, options)
1552
+ if (segments) return Effect.succeed(segments)
1553
+ return Effect.fail(
1554
+ new SchemaIssue.InvalidValue(
1555
+ { expected: "a string matching template literal parts" },
1556
+ s,
1557
+ options
1558
+ )
1559
+ )
1560
+ }),
1561
+ SchemaGetter.transform((parts: ReadonlyArray<string>) => parts.join(""))
1562
+ )
1239
1563
  }
1240
1564
 
1241
1565
  /**
@@ -1248,9 +1572,35 @@ export class TemplateLiteral extends Base {
1248
1572
  *
1249
1573
  * @see {@link isUniqueSymbol}
1250
1574
  * @category models
1251
- * @since 3.10.0
1575
+ * @since 4.0.0
1576
+ */
1577
+ export interface UniqueSymbol extends ASTNode {
1578
+ readonly _tag: "UniqueSymbol"
1579
+ readonly symbol: symbol
1580
+ /** @internal */
1581
+
1582
+ getParser(): SchemaParser.Parser
1583
+ /** @internal */
1584
+
1585
+ toCodecStringTree(): AST
1586
+ /** @internal */
1587
+
1588
+ getExpected(): string
1589
+ }
1590
+
1591
+ /**
1592
+ * Constructs a {@link UniqueSymbol}.
1593
+ *
1594
+ * @category constructors
1595
+ * @since 4.0.0
1252
1596
  */
1253
- export class UniqueSymbol extends Base {
1597
+ export const UniqueSymbol: new(
1598
+ symbol: symbol,
1599
+ annotations?: Schema.Annotations.Annotations,
1600
+ checks?: Checks,
1601
+ encoding?: Encoding,
1602
+ context?: Context
1603
+ ) => UniqueSymbol = class extends ASTNodeImpl {
1254
1604
  readonly _tag = "UniqueSymbol"
1255
1605
  readonly symbol: symbol
1256
1606
 
@@ -1270,7 +1620,13 @@ export class UniqueSymbol extends Base {
1270
1620
  }
1271
1621
  /** @internal */
1272
1622
  toCodecStringTree(): AST {
1273
- return replaceEncoding(this, [symbolToString])
1623
+ const key = globalThis.Symbol.keyFor(this.symbol)
1624
+ return replaceEncoding(this, [
1625
+ new Link(
1626
+ key === undefined ? never : new Literal(globalThis.String(this.symbol)),
1627
+ symbolToString.transformation
1628
+ )
1629
+ ])
1274
1630
  }
1275
1631
  /** @internal */
1276
1632
  getExpected(): string {
@@ -1295,8 +1651,10 @@ export type LiteralValue = string | number | boolean | bigint
1295
1651
  * **Details**
1296
1652
  *
1297
1653
  * Parsing succeeds only when the input is strictly equal (`===`) to the
1298
- * stored `literal`. Numeric literals must be finite — `Infinity`, `-Infinity`,
1299
- * and `NaN` are rejected at construction time.
1654
+ * stored `literal`, preserving the input value. Both `0` and `-0` are accepted
1655
+ * by either zero literal, and parsing preserves the input's sign. Numeric
1656
+ * literals must be finite. `Infinity`, `-Infinity`, and `NaN` are rejected at
1657
+ * construction time.
1300
1658
  *
1301
1659
  * **Example** (Creating a literal AST)
1302
1660
  *
@@ -1307,12 +1665,44 @@ export type LiteralValue = string | number | boolean | bigint
1307
1665
  * ast.literal // => "active"
1308
1666
  * ```
1309
1667
  *
1310
- * @see {@link LiteralValue}
1311
- * @see {@link isLiteral}
1312
- * @category models
1313
- * @since 3.10.0
1668
+ * @see {@link LiteralValue}
1669
+ * @see {@link isLiteral}
1670
+ * @category models
1671
+ * @since 4.0.0
1672
+ */
1673
+ export interface Literal extends ASTNode {
1674
+ readonly _tag: "Literal"
1675
+ readonly literal: LiteralValue
1676
+ /** @internal */
1677
+
1678
+ getParser(): SchemaParser.Parser
1679
+ /** @internal */
1680
+
1681
+ matchPart(s: string, _options: ParseOptions): LiteralValue | undefined
1682
+ /** @internal */
1683
+
1684
+ toCodecJson(): AST
1685
+ /** @internal */
1686
+
1687
+ toCodecStringTree(): AST
1688
+ /** @internal */
1689
+
1690
+ getExpected(): string
1691
+ }
1692
+
1693
+ /**
1694
+ * Constructs a {@link Literal}.
1695
+ *
1696
+ * @category constructors
1697
+ * @since 4.0.0
1314
1698
  */
1315
- export class Literal extends Base {
1699
+ export const Literal: new(
1700
+ literal: LiteralValue,
1701
+ annotations?: Schema.Annotations.Annotations,
1702
+ checks?: Checks,
1703
+ encoding?: Encoding,
1704
+ context?: Context
1705
+ ) => Literal = class extends ASTNodeImpl {
1316
1706
  readonly _tag = "Literal"
1317
1707
  readonly literal: LiteralValue
1318
1708
 
@@ -1373,7 +1763,31 @@ function literalToString(ast: Literal): Literal {
1373
1763
  * @category models
1374
1764
  * @since 4.0.0
1375
1765
  */
1376
- export class String extends Base {
1766
+ export interface String extends ASTNode {
1767
+ readonly _tag: "String"
1768
+ /** @internal */
1769
+
1770
+ getParser(): SchemaParser.Parser
1771
+ /** @internal */
1772
+
1773
+ matchPart(s: string, options: ParseOptions): string | undefined
1774
+ /** @internal */
1775
+
1776
+ getExpected(): string
1777
+ }
1778
+
1779
+ /**
1780
+ * Constructs a {@link String}.
1781
+ *
1782
+ * @category constructors
1783
+ * @since 4.0.0
1784
+ */
1785
+ export const String: new(
1786
+ annotations?: Schema.Annotations.Annotations | undefined,
1787
+ checks?: Checks | undefined,
1788
+ encoding?: Encoding | undefined,
1789
+ context?: Context | undefined
1790
+ ) => String = class extends ASTNodeImpl {
1377
1791
  readonly _tag = "String"
1378
1792
  /** @internal */
1379
1793
  getParser() {
@@ -1424,7 +1838,40 @@ export const string = new String()
1424
1838
  * @category models
1425
1839
  * @since 4.0.0
1426
1840
  */
1427
- export class Number extends Base {
1841
+ export interface Number extends ASTNode {
1842
+ readonly _tag: "Number"
1843
+ /** @internal */
1844
+
1845
+ getParser(): SchemaParser.Parser
1846
+ /** @internal */
1847
+
1848
+ matchKey(s: string, options: ParseOptions): number | undefined
1849
+ /** @internal */
1850
+
1851
+ matchPart(s: string, options: ParseOptions): number | undefined
1852
+ /** @internal */
1853
+
1854
+ toCodecJson(): AST
1855
+ /** @internal */
1856
+
1857
+ toCodecStringTree(): AST
1858
+ /** @internal */
1859
+
1860
+ getExpected(): string
1861
+ }
1862
+
1863
+ /**
1864
+ * Constructs a {@link Number}.
1865
+ *
1866
+ * @category constructors
1867
+ * @since 4.0.0
1868
+ */
1869
+ export const Number: new(
1870
+ annotations?: Schema.Annotations.Annotations | undefined,
1871
+ checks?: Checks | undefined,
1872
+ encoding?: Encoding | undefined,
1873
+ context?: Context | undefined
1874
+ ) => Number = class extends ASTNodeImpl {
1428
1875
  readonly _tag = "Number"
1429
1876
  /** @internal */
1430
1877
  getParser() {
@@ -1499,7 +1946,28 @@ export const number = new Number()
1499
1946
  * @category models
1500
1947
  * @since 4.0.0
1501
1948
  */
1502
- export class Boolean extends Base {
1949
+ export interface Boolean extends ASTNode {
1950
+ readonly _tag: "Boolean"
1951
+ /** @internal */
1952
+
1953
+ getParser(): SchemaParser.Parser
1954
+ /** @internal */
1955
+
1956
+ getExpected(): string
1957
+ }
1958
+
1959
+ /**
1960
+ * Constructs a {@link Boolean}.
1961
+ *
1962
+ * @category constructors
1963
+ * @since 4.0.0
1964
+ */
1965
+ export const Boolean: new(
1966
+ annotations?: Schema.Annotations.Annotations | undefined,
1967
+ checks?: Checks | undefined,
1968
+ encoding?: Encoding | undefined,
1969
+ context?: Context | undefined
1970
+ ) => Boolean = class extends ASTNodeImpl {
1503
1971
  readonly _tag = "Boolean"
1504
1972
  /** @internal */
1505
1973
  getParser() {
@@ -1545,7 +2013,34 @@ export const boolean = new Boolean()
1545
2013
  * @category models
1546
2014
  * @since 4.0.0
1547
2015
  */
1548
- export class Symbol extends Base {
2016
+ export interface Symbol extends ASTNode {
2017
+ readonly _tag: "Symbol"
2018
+ /** @internal */
2019
+
2020
+ getParser(): SchemaParser.Parser
2021
+ /** @internal */
2022
+
2023
+ matchKey(s: symbol, options: ParseOptions): symbol | undefined
2024
+ /** @internal */
2025
+
2026
+ toCodecStringTree(): AST
2027
+ /** @internal */
2028
+
2029
+ getExpected(): string
2030
+ }
2031
+
2032
+ /**
2033
+ * Constructs a {@link Symbol}.
2034
+ *
2035
+ * @category constructors
2036
+ * @since 4.0.0
2037
+ */
2038
+ export const Symbol: new(
2039
+ annotations?: Schema.Annotations.Annotations | undefined,
2040
+ checks?: Checks | undefined,
2041
+ encoding?: Encoding | undefined,
2042
+ context?: Context | undefined
2043
+ ) => Symbol = class extends ASTNodeImpl {
1549
2044
  readonly _tag = "Symbol"
1550
2045
  /** @internal */
1551
2046
  getParser() {
@@ -1599,7 +2094,34 @@ export const symbol = new Symbol()
1599
2094
  * @category models
1600
2095
  * @since 4.0.0
1601
2096
  */
1602
- export class BigInt extends Base {
2097
+ export interface BigInt extends ASTNode {
2098
+ readonly _tag: "BigInt"
2099
+ /** @internal */
2100
+
2101
+ getParser(): SchemaParser.Parser
2102
+ /** @internal */
2103
+
2104
+ matchPart(s: string, options: ParseOptions): bigint | undefined
2105
+ /** @internal */
2106
+
2107
+ toCodecStringTree(): AST
2108
+ /** @internal */
2109
+
2110
+ getExpected(): string
2111
+ }
2112
+
2113
+ /**
2114
+ * Constructs a {@link BigInt}.
2115
+ *
2116
+ * @category constructors
2117
+ * @since 4.0.0
2118
+ */
2119
+ export const BigInt: new(
2120
+ annotations?: Schema.Annotations.Annotations | undefined,
2121
+ checks?: Checks | undefined,
2122
+ encoding?: Encoding | undefined,
2123
+ context?: Context | undefined
2124
+ ) => BigInt = class extends ASTNodeImpl {
1603
2125
  readonly _tag = "BigInt"
1604
2126
  /** @internal */
1605
2127
  getParser() {
@@ -1649,7 +2171,7 @@ export const bigInt = new BigInt()
1649
2171
  * **Details**
1650
2172
  *
1651
2173
  * - `elements` — positional element types (tuple elements). An element is
1652
- * optional if its {@link Context.isOptional} is `true`.
2174
+ * optional if its context's `isOptional` field is `true`.
1653
2175
  * - `rest` — the rest/variadic element types. When non-empty, the first
1654
2176
  * entry is the "spread" type (e.g. `...Array<string>`), and subsequent
1655
2177
  * entries are trailing positional elements after the spread.
@@ -1680,7 +2202,42 @@ export const bigInt = new BigInt()
1680
2202
  * @category models
1681
2203
  * @since 4.0.0
1682
2204
  */
1683
- export class Arrays extends Base {
2205
+ export interface Arrays extends ASTNode {
2206
+ readonly _tag: "Arrays"
2207
+ readonly isMutable: boolean
2208
+ readonly elements: ReadonlyArray<AST>
2209
+ readonly rest: ReadonlyArray<AST>
2210
+ readonly encodingChecks: Checks | undefined
2211
+ /** @internal */
2212
+
2213
+ getParser(compile: SchemaParser.Compiler, compileConstructorDefault?: SchemaParser.Compiler): SchemaParser.Parser
2214
+ /** @internal */
2215
+
2216
+ recur(recur: (ast: AST) => AST): Arrays
2217
+ /** @internal */
2218
+
2219
+ flip(recur: (ast: AST) => AST): Arrays
2220
+ /** @internal */
2221
+
2222
+ getExpected(): string
2223
+ }
2224
+
2225
+ /**
2226
+ * Constructs a {@link Arrays}.
2227
+ *
2228
+ * @category constructors
2229
+ * @since 4.0.0
2230
+ */
2231
+ export const Arrays: new(
2232
+ isMutable: boolean,
2233
+ elements: ReadonlyArray<AST>,
2234
+ rest: ReadonlyArray<AST>,
2235
+ annotations?: Schema.Annotations.Annotations,
2236
+ checks?: Checks,
2237
+ encoding?: Encoding,
2238
+ context?: Context,
2239
+ encodingChecks?: Checks
2240
+ ) => Arrays = class extends ASTNodeImpl {
1684
2241
  readonly _tag = "Arrays"
1685
2242
  readonly isMutable: boolean
1686
2243
  readonly elements: ReadonlyArray<AST>
@@ -1772,11 +2329,11 @@ export class Arrays extends Base {
1772
2329
  issues: undefined as Arr.NonEmptyArray<SchemaIssue.Issue> | undefined,
1773
2330
  options
1774
2331
  }
1775
- const concurrency = resolveConcurrency(options?.concurrency)
1776
- const eff = parseArray(state, input, {
1777
- concurrency: concurrency?.concurrency,
1778
- end: ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen)
1779
- })
2332
+ const end = ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen)
2333
+ const concurrency = options.concurrency === undefined ? 1 : resolveConcurrency(options.concurrency)
2334
+ const eff = concurrency === 1
2335
+ ? parseArray(state, input, 0, end)
2336
+ : parseArrayConcurrent(state, input, { concurrency, end })
1780
2337
  if (eff) yield* eff
1781
2338
 
1782
2339
  // ---------------------------------------------
@@ -1834,7 +2391,7 @@ export class Arrays extends Base {
1834
2391
  return "array"
1835
2392
  }
1836
2393
  }
1837
- const parseArray = iterateEager<{
2394
+ type ArrayParserState = {
1838
2395
  readonly ast: AST
1839
2396
  readonly input: unknown
1840
2397
  readonly len: number
@@ -1846,12 +2403,14 @@ const parseArray = iterateEager<{
1846
2403
  readonly options: ParseOptions
1847
2404
  readonly output: Array<unknown>
1848
2405
  issues: Array<SchemaIssue.Issue> | undefined
1849
- }, unknown>()({
1850
- onItem(s, item, i) {
2406
+ }
2407
+
2408
+ const parseArrayOptions = {
2409
+ onItem(s: ArrayParserState, item: unknown, i: number) {
1851
2410
  const value = i < s.len ? item : InternalParser.missing
1852
2411
  return s.getParser(s.tailThreshold, i).parser(value, s.options)
1853
2412
  },
1854
- step(s, item, exit, i) {
2413
+ step(s: ArrayParserState, item: unknown, exit: Exit.Exit<unknown, SchemaIssue.Issue>, i: number) {
1855
2414
  if (exit._tag === "Failure") {
1856
2415
  return wrapPropertyKeyIssue(s, s.ast, i, exit)
1857
2416
  }
@@ -1874,13 +2433,11 @@ const parseArray = iterateEager<{
1874
2433
  }
1875
2434
  }
1876
2435
  }
1877
- })
1878
-
1879
- const resolveConcurrency = (value: number | "unbounded" | undefined) => {
1880
- value = value === "unbounded" ? Infinity : value ?? 1
1881
- return value > 1 ? { concurrency: value } : undefined
1882
2436
  }
1883
2437
 
2438
+ const parseArray = iterateEager<ArrayParserState, unknown>()(parseArrayOptions)
2439
+ const parseArrayConcurrent = iterateConcurrent<ArrayParserState, unknown>()(parseArrayOptions)
2440
+
1884
2441
  const wrapPropertyKeyIssue = (
1885
2442
  s: {
1886
2443
  readonly input: unknown
@@ -1969,9 +2526,20 @@ export function getIndexSignatureKeys(
1969
2526
  *
1970
2527
  * @see {@link Objects}
1971
2528
  * @category models
1972
- * @since 3.10.0
2529
+ * @since 4.0.0
2530
+ */
2531
+ export interface PropertySignature {
2532
+ readonly name: PropertyKey
2533
+ readonly type: AST
2534
+ }
2535
+
2536
+ /**
2537
+ * Constructs a {@link PropertySignature}.
2538
+ *
2539
+ * @category constructors
2540
+ * @since 4.0.0
1973
2541
  */
1974
- export class PropertySignature {
2542
+ export const PropertySignature: new(name: PropertyKey, type: AST) => PropertySignature = class {
1975
2543
  readonly name: PropertyKey
1976
2544
  readonly type: AST
1977
2545
 
@@ -2031,9 +2599,20 @@ function isIndexSignatureParameter(ast: AST): ast is IndexSignatureParameter {
2031
2599
  * @see {@link Objects}
2032
2600
  * @see {@link PropertySignature}
2033
2601
  * @category models
2034
- * @since 3.10.0
2602
+ * @since 4.0.0
2603
+ */
2604
+ export interface IndexSignature {
2605
+ readonly parameter: IndexSignatureParameter
2606
+ readonly type: AST
2607
+ }
2608
+
2609
+ /**
2610
+ * Constructs a {@link IndexSignature}.
2611
+ *
2612
+ * @category constructors
2613
+ * @since 4.0.0
2035
2614
  */
2036
- export class IndexSignature {
2615
+ export const IndexSignature: new(parameter: AST, type: AST) => IndexSignature = class {
2037
2616
  readonly parameter: IndexSignatureParameter
2038
2617
  readonly type: AST
2039
2618
 
@@ -2094,7 +2673,40 @@ export class IndexSignature {
2094
2673
  * @category models
2095
2674
  * @since 4.0.0
2096
2675
  */
2097
- export class Objects extends Base {
2676
+ export interface Objects extends ASTNode {
2677
+ readonly _tag: "Objects"
2678
+ readonly propertySignatures: ReadonlyArray<PropertySignature>
2679
+ readonly indexSignatures: ReadonlyArray<IndexSignature>
2680
+ readonly encodingChecks: Checks | undefined
2681
+ /** @internal */
2682
+
2683
+ getParser(compile: SchemaParser.Compiler, compileConstructorDefault?: SchemaParser.Compiler): SchemaParser.Parser
2684
+ /** @internal */
2685
+
2686
+ flip(recur: (ast: AST) => AST): AST
2687
+ /** @internal */
2688
+
2689
+ recur(recur: (ast: AST) => AST, recurParameter?: (ast: AST) => AST): AST
2690
+ /** @internal */
2691
+
2692
+ getExpected(): string
2693
+ }
2694
+
2695
+ /**
2696
+ * Constructs a {@link Objects}.
2697
+ *
2698
+ * @category constructors
2699
+ * @since 4.0.0
2700
+ */
2701
+ export const Objects: new(
2702
+ propertySignatures: ReadonlyArray<PropertySignature>,
2703
+ indexSignatures: ReadonlyArray<IndexSignature>,
2704
+ annotations?: Schema.Annotations.Annotations,
2705
+ checks?: Checks,
2706
+ encoding?: Encoding,
2707
+ context?: Context,
2708
+ encodingChecks?: Checks
2709
+ ) => Objects = class extends ASTNodeImpl {
2098
2710
  readonly _tag = "Objects"
2099
2711
  readonly propertySignatures: ReadonlyArray<PropertySignature>
2100
2712
  readonly indexSignatures: ReadonlyArray<IndexSignature>
@@ -2129,7 +2741,7 @@ export class Objects extends Base {
2129
2741
  const ast = this
2130
2742
  const expectedKeys: Array<PropertyKey> = []
2131
2743
  for (const ps of ast.propertySignatures) {
2132
- expectedKeys.push(ps.name)
2744
+ expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name)
2133
2745
  }
2134
2746
  const hasProperties = expectedKeys.length
2135
2747
  const indexCount = ast.indexSignatures.length
@@ -2164,7 +2776,10 @@ export class Objects extends Base {
2164
2776
  ? inputValue
2165
2777
  : (exitValue as InternalParser.Success<unknown, SchemaIssue.Issue>)[InternalParser.args]
2166
2778
  if (k2 !== InternalParser.missing && value !== InternalParser.missing) {
2167
- if (hasProperties && (expectedKeysSet!.has(key) || expectedKeysSet!.has(k2))) return Exit.void
2779
+ if (
2780
+ hasProperties &&
2781
+ (expectedKeysSet!.has(key) || expectedKeysSet!.has(typeof k2 === "number" ? globalThis.String(k2) : k2))
2782
+ ) return Exit.void
2168
2783
  InternalRecord.assignProperty(s.out, k2, value)
2169
2784
  }
2170
2785
  return Exit.void
@@ -2205,13 +2820,13 @@ export class Objects extends Base {
2205
2820
  ? finishIndex(s, key, key, inputValue, result)
2206
2821
  : Effect.flatMap(Effect.exit(result), (exit) => finishIndex(s, key, key, inputValue, exit))
2207
2822
  }
2208
- const parseIndexes = indexCount ?
2209
- iterateEager<ObjectParserState, [key: PropertyKey, index: Index]>()({
2210
- onItem: (s, [key, index]) => parseIndex(s, key, index),
2211
- step: (_s, _, exit: Exit.Exit<void, SchemaIssue.Issue>) => exit._tag === "Failure" ? exit : undefined
2212
- }) :
2213
- undefined
2214
-
2823
+ const parseIndexes = indexCount
2824
+ ? iterateConcurrent<ObjectParserState, readonly [key: PropertyKey, index: Index]>()({
2825
+ onItem: (s, [key, index]) =>
2826
+ index.is.parameter === string ? parseStringIndex(s, key, index) : parseIndex(s, key, index),
2827
+ step: (_s, _item, exit) => exit._tag === "Failure" ? exit : undefined
2828
+ })
2829
+ : undefined
2215
2830
  const compileMembers = (): Array<ParsedProperty> => {
2216
2831
  if (!properties) {
2217
2832
  properties = ast.propertySignatures.map((ps) => ({
@@ -2252,62 +2867,65 @@ export class Objects extends Base {
2252
2867
  }
2253
2868
  const errorsAllOption = options.errors === "all"
2254
2869
  const onExcessPropertyError = options.onExcessProperty === "error"
2255
- const onExcessPropertyPreserve = options.onExcessProperty === "preserve"
2870
+ const concurrency = options.concurrency === undefined ? 1 : resolveConcurrency(options.concurrency)
2256
2871
 
2257
2872
  // ---------------------------------------------
2258
2873
  // handle excess properties
2259
2874
  // ---------------------------------------------
2260
- let inputKeys: Array<PropertyKey> | undefined
2261
- if (!indexCount && (onExcessPropertyError || onExcessPropertyPreserve)) {
2875
+ const indexKeys = indexCount && onExcessPropertyError
2876
+ ? ast.indexSignatures.map((index) => getIndexSignatureKeys(record, index.parameter, options))
2877
+ : undefined
2878
+ if (onExcessPropertyError) {
2262
2879
  expectedKeysSet ??= new Set(expectedKeys)
2263
- inputKeys = Reflect.ownKeys(record)
2880
+ const coveredKeys = indexKeys ? new Set(expectedKeysSet) : expectedKeysSet
2881
+ if (indexKeys) {
2882
+ for (const keys of indexKeys) {
2883
+ for (const key of keys) coveredKeys.add(key)
2884
+ }
2885
+ }
2886
+ const inputKeys = Reflect.ownKeys(record)
2264
2887
  for (let i = 0; i < inputKeys.length; i++) {
2265
2888
  const key = inputKeys[i]
2266
- if (!expectedKeysSet.has(key)) {
2889
+ if (!coveredKeys.has(key)) {
2267
2890
  // key is unexpected
2268
- if (onExcessPropertyError) {
2269
- const unexpected = new SchemaIssue.UnexpectedKey(ast, record[key], options)
2270
- const issue = new SchemaIssue.Pointer([key], unexpected)
2271
- if (errorsAllOption) {
2272
- if (state.issues) {
2273
- state.issues.push(issue)
2274
- } else {
2275
- state.issues = [issue]
2276
- }
2277
- continue
2891
+ const unexpected = new SchemaIssue.UnexpectedKey(ast, record[key], options)
2892
+ const issue = new SchemaIssue.Pointer([key], unexpected)
2893
+ if (errorsAllOption) {
2894
+ if (state.issues) {
2895
+ state.issues.push(issue)
2278
2896
  } else {
2279
- return yield* Effect.fail(
2280
- new SchemaIssue.Composite(ast, [issue], input, options)
2281
- )
2897
+ state.issues = [issue]
2282
2898
  }
2899
+ continue
2283
2900
  } else {
2284
- // preserve key
2285
- InternalRecord.assignProperty(out, key, record[key])
2901
+ return yield* Effect.fail(
2902
+ new SchemaIssue.Composite(ast, [issue], input, options)
2903
+ )
2286
2904
  }
2287
2905
  }
2288
2906
  }
2289
2907
  }
2290
2908
 
2291
- const concurrency = resolveConcurrency(options?.concurrency)
2292
-
2293
2909
  // ---------------------------------------------
2294
2910
  // handle property signatures
2295
2911
  // ---------------------------------------------
2296
2912
  if (hasProperties) {
2297
- const eff = parseProperties(state, properties!, concurrency)
2913
+ const eff = concurrency === 1
2914
+ ? parseProperties(state, properties!)
2915
+ : parsePropertiesConcurrent(state, properties!, { concurrency })
2298
2916
  if (eff) yield* eff
2299
2917
  }
2300
2918
 
2301
2919
  // ---------------------------------------------
2302
2920
  // handle index signatures
2303
2921
  // ---------------------------------------------
2304
- if (indexCount && !concurrency) {
2922
+ if (indexCount && concurrency === 1) {
2305
2923
  for (let i = 0; i < indexCount; i++) {
2306
2924
  const index = indexes![i]
2307
2925
  const parse = index.is.parameter === string ? parseStringIndex : parseIndex
2308
- const keys = index.is.parameter === string
2926
+ const keys = indexKeys?.[i] ?? (index.is.parameter === string
2309
2927
  ? Object.keys(record)
2310
- : getIndexSignatureKeys(record, index.is.parameter, options)
2928
+ : getIndexSignatureKeys(record, index.is.parameter, options))
2311
2929
  for (let j = 0; j < keys.length; j++) {
2312
2930
  const eff = parse(state, keys[j], index)
2313
2931
  if (!effectIsExit(eff)) yield* eff
@@ -2315,15 +2933,17 @@ export class Objects extends Base {
2315
2933
  }
2316
2934
  }
2317
2935
  } else if (parseIndexes) {
2318
- const keyPairs = Arr.empty<[PropertyKey, Index]>()
2936
+ const keyPairs = Arr.empty<readonly [PropertyKey, Index]>()
2319
2937
  for (let i = 0; i < indexCount; i++) {
2320
2938
  const index = indexes![i]
2321
- const keys = getIndexSignatureKeys(record, index.is.parameter, options)
2939
+ const keys = indexKeys?.[i] ?? (index.is.parameter === string
2940
+ ? Object.keys(record)
2941
+ : getIndexSignatureKeys(record, index.is.parameter, options))
2322
2942
  for (let j = 0; j < keys.length; j++) {
2323
2943
  keyPairs.push([keys[j], index])
2324
2944
  }
2325
2945
  }
2326
- const eff = parseIndexes(state, keyPairs, concurrency)
2946
+ const eff = parseIndexes(state, keyPairs, { concurrency })
2327
2947
  if (eff) yield* eff
2328
2948
  }
2329
2949
 
@@ -2332,17 +2952,6 @@ export class Objects extends Base {
2332
2952
  new SchemaIssue.Composite(ast, state.issues, input, options)
2333
2953
  )
2334
2954
  }
2335
- if (options.propertyOrder === "original") {
2336
- // preserve input keys order
2337
- const keys = (inputKeys ?? Reflect.ownKeys(record)).concat(expectedKeys)
2338
- const preserved: Record<PropertyKey, unknown> = {}
2339
- for (const key of keys) {
2340
- if (Object.hasOwn(out, key)) {
2341
- InternalRecord.assignProperty(preserved, key, out[key])
2342
- }
2343
- }
2344
- return preserved
2345
- }
2346
2955
  return out
2347
2956
  })
2348
2957
 
@@ -2372,8 +2981,7 @@ export class Objects extends Base {
2372
2981
  if (
2373
2982
  options.errors === "all" ||
2374
2983
  options.onExcessProperty !== undefined ||
2375
- options.propertyOrder === "original" ||
2376
- options.concurrency !== undefined
2984
+ (options.concurrency !== undefined && resolveConcurrency(options.concurrency) !== 1)
2377
2985
  ) {
2378
2986
  return fallback(input, options)
2379
2987
  }
@@ -2388,7 +2996,7 @@ export class Objects extends Base {
2388
2996
  for (let index = 0; index < props.length; index++) {
2389
2997
  const property = props[index]
2390
2998
  const name = property.name
2391
- const hasKey = Object.hasOwn(record, name)
2999
+ const hasKey = hasPropertySignature(record, name)
2392
3000
  const value = hasKey ? record[name] : InternalParser.missing
2393
3001
  const exit = property.parser(value, options)
2394
3002
  if (!effectIsExit(exit)) {
@@ -2498,9 +3106,9 @@ function stepProperty(
2498
3106
  }
2499
3107
  }
2500
3108
 
2501
- const parseProperties = iterateEager<ObjectParserState, ParsedProperty>()({
2502
- onItem(s, p) {
2503
- if (!Object.hasOwn(s.input, p.name)) {
3109
+ const parsePropertiesOptions = {
3110
+ onItem(s: ObjectParserState, p: ParsedProperty) {
3111
+ if (!hasPropertySignature(s.input, p.name)) {
2504
3112
  return p.parser(InternalParser.missing, s.options)
2505
3113
  }
2506
3114
  const value = s.input[p.name]
@@ -2508,7 +3116,10 @@ const parseProperties = iterateEager<ObjectParserState, ParsedProperty>()({
2508
3116
  return p.parser(value, s.options)
2509
3117
  },
2510
3118
  step: stepProperty
2511
- })
3119
+ }
3120
+
3121
+ const parseProperties = iterateEager<ObjectParserState, ParsedProperty>()(parsePropertiesOptions)
3122
+ const parsePropertiesConcurrent = iterateConcurrent<ObjectParserState, ParsedProperty>()(parsePropertiesOptions)
2512
3123
 
2513
3124
  function combineChecks(a: Checks | undefined, b: Checks | undefined): Checks | undefined {
2514
3125
  if (!a) return b
@@ -2548,10 +3159,10 @@ export function tuple<Elements extends Schema.Tuple.Elements>(
2548
3159
  /** @internal */
2549
3160
  export function union<Members extends ReadonlyArray<{ readonly ast: AST }>>(
2550
3161
  members: Members,
2551
- mode: "anyOf" | "oneOf",
3162
+ options: UnionOptions | undefined,
2552
3163
  checks: Checks | undefined
2553
3164
  ): Union<Members[number]["ast"]> {
2554
- return new Union(members.map(getAST), mode, undefined, checks)
3165
+ return new Union(members.map(getAST), options, undefined, checks)
2555
3166
  }
2556
3167
 
2557
3168
  /** @internal */
@@ -2578,6 +3189,23 @@ export function tupleWithRest(ast: Arrays, rest: ReadonlyArray<AST>): Arrays {
2578
3189
  return new Arrays(ast.isMutable, ast.elements, rest, undefined, ast.checks)
2579
3190
  }
2580
3191
 
3192
+ /** @internal */
3193
+ export function mutable(ast: Arrays): Arrays {
3194
+ if (ast.encoding) {
3195
+ throw new Error("mutable does not support encodings")
3196
+ }
3197
+ return new Arrays(
3198
+ true,
3199
+ ast.elements,
3200
+ ast.rest,
3201
+ ast.annotations,
3202
+ ast.checks,
3203
+ undefined,
3204
+ ast.context,
3205
+ ast.encodingChecks
3206
+ )
3207
+ }
3208
+
2581
3209
  type Type =
2582
3210
  | "null"
2583
3211
  | "array"
@@ -2715,6 +3343,9 @@ type SentinelIndex = Map<PropertyKey, SentinelEntry>
2715
3343
  const candidateIndexCache = new WeakMap<ReadonlyArray<AST>, CandidateIndex>()
2716
3344
  const emptyCandidates: ReadonlyArray<never> = Object.freeze([])
2717
3345
 
3346
+ const hasPropertySignature = (input: object, key: PropertyKey): boolean =>
3347
+ key === "__proto__" ? Object.hasOwn(input, key) : key in input
3348
+
2718
3349
  function getIndex(types: ReadonlyArray<AST>): CandidateIndex {
2719
3350
  let index = candidateIndexCache.get(types)
2720
3351
  if (index) return index
@@ -2772,7 +3403,7 @@ function getIndex(types: ReadonlyArray<AST>): CandidateIndex {
2772
3403
  }
2773
3404
  index = (input, isConstructor) => {
2774
3405
  if (Predicate.isObjectKeyword(input)) {
2775
- const value = Object.hasOwn(input, key) ? (input as any)[key] : undefined
3406
+ const value = hasPropertySignature(input, key) ? (input as any)[key] : undefined
2776
3407
  if (value !== undefined) return candidates.get(value) ?? emptyCandidates
2777
3408
  if (isConstructor) return types
2778
3409
  }
@@ -2804,7 +3435,7 @@ function getIndex(types: ReadonlyArray<AST>): CandidateIndex {
2804
3435
  // discriminated candidate.
2805
3436
  if (commonSentinel) {
2806
3437
  const [key, [byValue]] = commonSentinel
2807
- const hasKey = Object.hasOwn(input, key)
3438
+ const hasKey = hasPropertySignature(input, key)
2808
3439
  const value = hasKey ? (input as any)[key] : undefined
2809
3440
  if (hasKey && (!isConstructor || value !== undefined)) {
2810
3441
  const match = byValue.get(value)
@@ -2818,7 +3449,7 @@ function getIndex(types: ReadonlyArray<AST>): CandidateIndex {
2818
3449
  // absent and undefined keys as unconstrained and therefore selects every candidate that owns the key.
2819
3450
  if (directKey === undefined) {
2820
3451
  for (const [key, [byValue, all]] of bySentinel) {
2821
- const hasKey = Object.hasOwn(input, key)
3452
+ const hasKey = hasPropertySignature(input, key)
2822
3453
  const value = hasKey ? (input as any)[key] : undefined
2823
3454
  if (hasKey && (!isConstructor || value !== undefined)) {
2824
3455
  const match = byValue.get(value)
@@ -2833,7 +3464,7 @@ function getIndex(types: ReadonlyArray<AST>): CandidateIndex {
2833
3464
  // Missing keys are neutral. An observed key rejects only selected candidates that own it and do not match.
2834
3465
  for (const [key, [byValue, all]] of bySentinel) {
2835
3466
  if (key === directKey) continue
2836
- const hasKey = Object.hasOwn(input, key)
3467
+ const hasKey = hasPropertySignature(input, key)
2837
3468
  const value = hasKey ? (input as any)[key] : undefined
2838
3469
  if (hasKey && (!isConstructor || value !== undefined)) {
2839
3470
  const match = byValue.get(value)
@@ -2886,7 +3517,7 @@ export function getCandidates(
2886
3517
  * **Details**
2887
3518
  *
2888
3519
  * - `types` — the member AST nodes.
2889
- * - `mode` — `"anyOf"` succeeds on the first match (like TypeScript unions);
3520
+ * - `options.mode` selects matching behavior. `"anyOf"` succeeds on the first match;
2890
3521
  * `"oneOf"` requires exactly one member to match (fails if multiple do).
2891
3522
  *
2892
3523
  * During parsing, members are tried in order. An internal candidate index
@@ -2902,23 +3533,70 @@ export function getCandidates(
2902
3533
  * const ast = schema.ast
2903
3534
  *
2904
3535
  * if (SchemaAST.isUnion(ast)) {
2905
- * [ast.types.length, ast.mode] // => [2, "anyOf"]
3536
+ * [ast.types.length, ast.options?.mode ?? "anyOf"] // => [2, "anyOf"]
2906
3537
  * }
2907
3538
  * ```
2908
3539
  *
2909
3540
  * @see {@link isUnion}
2910
3541
  * @category models
2911
- * @since 3.10.0
3542
+ * @since 4.0.0
3543
+ */
3544
+ export interface Union<A extends AST = AST> extends ASTNode {
3545
+ readonly _tag: "Union"
3546
+ readonly types: ReadonlyArray<A>
3547
+ readonly options: UnionOptions | undefined
3548
+ readonly encodingChecks: Checks | undefined
3549
+ /** @internal */
3550
+
3551
+ getParser(compile: SchemaParser.Compiler, compileConstructorDefault?: SchemaParser.Compiler): SchemaParser.Parser
3552
+ /** @internal */
3553
+
3554
+ recur(recur: (ast: AST) => AST): Union<AST>
3555
+ /** @internal */
3556
+
3557
+ flip(recur: (ast: AST) => AST): Union<AST>
3558
+ /** @internal */
3559
+
3560
+ matchPart(s: string, options: ParseOptions): LiteralValue | undefined
3561
+ /** @internal */
3562
+
3563
+ getExpected(getExpected: (ast: AST) => string): string
3564
+ }
3565
+
3566
+ /**
3567
+ * Local matching options stored on {@link Union} nodes.
3568
+ *
3569
+ * @category options
3570
+ * @since 4.0.0
3571
+ */
3572
+ export interface UnionOptions {
3573
+ /** Defaults to `"anyOf"`; `"oneOf"` requires exactly one matching member. */
3574
+ readonly mode?: "anyOf" | "oneOf" | undefined
3575
+ }
3576
+
3577
+ /**
3578
+ * Constructs a {@link Union}.
3579
+ *
3580
+ * @category constructors
3581
+ * @since 4.0.0
2912
3582
  */
2913
- export class Union<A extends AST = AST> extends Base {
3583
+ export const Union: new<A extends AST = AST>(
3584
+ types: ReadonlyArray<A>,
3585
+ options?: UnionOptions,
3586
+ annotations?: Schema.Annotations.Annotations,
3587
+ checks?: Checks,
3588
+ encoding?: Encoding,
3589
+ context?: Context,
3590
+ encodingChecks?: Checks
3591
+ ) => Union<A> = class<A extends AST = AST> extends ASTNodeImpl {
2914
3592
  readonly _tag = "Union"
2915
3593
  readonly types: ReadonlyArray<A>
2916
- readonly mode: "anyOf" | "oneOf"
3594
+ readonly options: UnionOptions | undefined
2917
3595
  readonly encodingChecks: Checks | undefined
2918
3596
 
2919
3597
  constructor(
2920
3598
  types: ReadonlyArray<A>,
2921
- mode: "anyOf" | "oneOf",
3599
+ options?: UnionOptions,
2922
3600
  annotations?: Schema.Annotations.Annotations,
2923
3601
  checks?: Checks,
2924
3602
  encoding?: Encoding,
@@ -2927,7 +3605,7 @@ export class Union<A extends AST = AST> extends Base {
2927
3605
  ) {
2928
3606
  super(annotations, checks, encoding, context)
2929
3607
  this.types = types
2930
- this.mode = mode
3608
+ this.options = options
2931
3609
  this.encodingChecks = encodingChecks
2932
3610
  }
2933
3611
  /** @internal */
@@ -2944,6 +3622,9 @@ export class Union<A extends AST = AST> extends Base {
2944
3622
  }
2945
3623
  const candidates = getCandidates(input, ast.types, compileConstructorDefault !== undefined)
2946
3624
 
3625
+ if (candidates.length === 0) {
3626
+ return Effect.fail(new SchemaIssue.AnyOf(ast, [], input, options))
3627
+ }
2947
3628
  if (candidates.length === 1) {
2948
3629
  const result = compile(candidates[0])(input, options)
2949
3630
  if ((result as Exit.Exit<unknown, SchemaIssue.Issue>)._tag === "Success") return result
@@ -2957,12 +3638,11 @@ export class Union<A extends AST = AST> extends Base {
2957
3638
  compile,
2958
3639
  input,
2959
3640
  out: undefined,
2960
- successes: ast.mode === "oneOf" ? [] : undefined,
3641
+ successes: ast.options?.mode === "oneOf" ? [] : undefined,
2961
3642
  issues: undefined as Arr.NonEmptyArray<SchemaIssue.Issue> | undefined,
2962
3643
  options
2963
3644
  }
2964
- const concurrency = resolveConcurrency(options?.concurrency)
2965
- const eff = parseUnion(state, candidates, concurrency ? { ...concurrency, orderedStep: true } : undefined)
3645
+ const eff = parseUnion(state, candidates)
2966
3646
  if (!eff) {
2967
3647
  if (state.out) return state.out
2968
3648
  return Effect.fail(new SchemaIssue.AnyOf(ast, state.issues ?? [], input, options))
@@ -2974,18 +3654,22 @@ export class Union<A extends AST = AST> extends Base {
2974
3654
  })
2975
3655
  }
2976
3656
  }
2977
- private _rebuild(recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) {
3657
+ private _rebuild(
3658
+ recur: (ast: AST) => AST,
3659
+ checks: Checks | undefined,
3660
+ encodingChecks: Checks | undefined
3661
+ ): Union<AST> {
2978
3662
  const types = mapOrSame(this.types, recur)
2979
3663
  return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ?
2980
3664
  this :
2981
- new Union(types, this.mode, this.annotations, checks, undefined, this.context, encodingChecks)
3665
+ new Union(types, this.options, this.annotations, checks, undefined, this.context, encodingChecks)
2982
3666
  }
2983
3667
  /** @internal */
2984
- recur(recur: (ast: AST) => AST) {
3668
+ recur(recur: (ast: AST) => AST): Union<AST> {
2985
3669
  return this._rebuild(recur, this.checks, this.encodingChecks)
2986
3670
  }
2987
3671
  /** @internal */
2988
- flip(recur: (ast: AST) => AST) {
3672
+ flip(recur: (ast: AST) => AST): Union<AST> {
2989
3673
  return this._rebuild(recur, this.encodingChecks, this.checks)
2990
3674
  }
2991
3675
  /** @internal */
@@ -3086,7 +3770,7 @@ const nonFiniteLiterals = new Union([
3086
3770
  new Literal("Infinity"),
3087
3771
  new Literal("-Infinity"),
3088
3772
  new Literal("NaN")
3089
- ], "anyOf")
3773
+ ])
3090
3774
 
3091
3775
  function formatIsMutable(isMutable: boolean | undefined): string {
3092
3776
  return isMutable ? "" : "readonly "
@@ -3139,9 +3823,35 @@ export function memoizeThunk<A>(f: () => A): () => A {
3139
3823
  *
3140
3824
  * @see {@link isSuspend}
3141
3825
  * @category models
3142
- * @since 3.10.0
3826
+ * @since 4.0.0
3827
+ */
3828
+ export interface Suspend extends ASTNode {
3829
+ readonly _tag: "Suspend"
3830
+ readonly thunk: () => AST
3831
+ /** @internal */
3832
+
3833
+ getParser(compile: SchemaParser.Compiler): SchemaParser.Parser
3834
+ /** @internal */
3835
+
3836
+ recur(recur: (ast: AST) => AST): Suspend
3837
+ /** @internal */
3838
+
3839
+ getExpected(getExpected: (ast: AST) => string): string
3840
+ }
3841
+
3842
+ /**
3843
+ * Constructs a {@link Suspend}.
3844
+ *
3845
+ * @category constructors
3846
+ * @since 4.0.0
3143
3847
  */
3144
- export class Suspend extends Base {
3848
+ export const Suspend: new(
3849
+ thunk: () => AST,
3850
+ annotations?: Schema.Annotations.Annotations,
3851
+ checks?: Checks,
3852
+ encoding?: Encoding,
3853
+ context?: Context
3854
+ ) => Suspend = class extends ASTNodeImpl {
3145
3855
  readonly _tag = "Suspend"
3146
3856
  readonly thunk: () => AST
3147
3857
 
@@ -3204,7 +3914,32 @@ export class Suspend extends Base {
3204
3914
  * @category models
3205
3915
  * @since 4.0.0
3206
3916
  */
3207
- export class Filter<in E> extends Pipeable.Class {
3917
+ export interface Filter<in E> extends Pipeable.Pipeable {
3918
+ readonly _tag: "Filter"
3919
+ readonly run: (input: E, self: AST, options: ParseOptions) => SchemaIssue.Issue | undefined
3920
+ readonly annotations: Schema.Annotations.Filter | undefined
3921
+ /**
3922
+ * Whether the parsing process should be aborted after this check has failed.
3923
+ */
3924
+ readonly aborted: boolean
3925
+ annotate(annotations: Schema.Annotations.Filter): Filter<E>
3926
+ abort(): Filter<E>
3927
+ and(other: Check<E>, annotations?: Schema.Annotations.Filter): FilterGroup<E>
3928
+ }
3929
+
3930
+ /**
3931
+ * Constructs a {@link Filter}.
3932
+ *
3933
+ * @category constructors
3934
+ * @since 4.0.0
3935
+ */
3936
+ export const Filter: new<E>(
3937
+ run: (input: E, self: AST, options: ParseOptions) => SchemaIssue.Issue | undefined,
3938
+ annotations?: Schema.Annotations.Filter | undefined, /**
3939
+ * Whether the parsing process should be aborted after this check has failed.
3940
+ */
3941
+ aborted?: boolean
3942
+ ) => Filter<E> = class<in E> extends Pipeable.Class {
3208
3943
  readonly _tag = "Filter"
3209
3944
  readonly run: (input: E, self: AST, options: ParseOptions) => SchemaIssue.Issue | undefined
3210
3945
  readonly annotations: Schema.Annotations.Filter | undefined
@@ -3252,7 +3987,30 @@ export class Filter<in E> extends Pipeable.Class {
3252
3987
  * @category models
3253
3988
  * @since 4.0.0
3254
3989
  */
3255
- export class FilterGroup<in E> extends Pipeable.Class {
3990
+ export interface FilterGroup<in E> extends Pipeable.Pipeable {
3991
+ readonly _tag: "FilterGroup"
3992
+ readonly checks: readonly [
3993
+ Check<E>,
3994
+ ...Array<Check<E>>
3995
+ ]
3996
+ readonly annotations: Schema.Annotations.Filter | undefined
3997
+ annotate(annotations: Schema.Annotations.Filter): FilterGroup<E>
3998
+ and(other: Check<E>, annotations?: Schema.Annotations.Filter): FilterGroup<E>
3999
+ }
4000
+
4001
+ /**
4002
+ * Constructs a {@link FilterGroup}.
4003
+ *
4004
+ * @category constructors
4005
+ * @since 4.0.0
4006
+ */
4007
+ export const FilterGroup: new<E>(
4008
+ checks: readonly [
4009
+ Check<E>,
4010
+ ...Array<Check<E>>
4011
+ ],
4012
+ annotations?: Schema.Annotations.Filter | undefined
4013
+ ) => FilterGroup<E> = class<in E> extends Pipeable.Class {
3256
4014
  readonly _tag = "FilterGroup"
3257
4015
  readonly checks: readonly [Check<E>, ...Array<Check<E>>]
3258
4016
  readonly annotations: Schema.Annotations.Filter | undefined
@@ -3280,7 +4038,7 @@ export class FilterGroup<in E> extends Pipeable.Class {
3280
4038
  *
3281
4039
  * **Details**
3282
4040
  *
3283
- * Stored in the {@link Checks} array on {@link Base.checks}.
4041
+ * Stored in an AST node's {@link Checks} array.
3284
4042
  *
3285
4043
  * @see {@link Filter}
3286
4044
  * @see {@link FilterGroup}
@@ -3326,11 +4084,8 @@ export function isFinite(annotations?: Schema.Annotations.Filter) {
3326
4084
  },
3327
4085
  toJsonSchema: () => ({ type: "number" }),
3328
4086
  toCode: () => ({ runtime: "Schema.isFinite()" }),
3329
- arbitrary: {
3330
- constraint: {
3331
- noInfinity: true,
3332
- noNaN: true
3333
- }
4087
+ arbitraryConstraint: {
4088
+ number: "finite"
3334
4089
  },
3335
4090
  ...annotations
3336
4091
  }
@@ -3341,7 +4096,7 @@ export function isFinite(annotations?: Schema.Annotations.Filter) {
3341
4096
  export const finite = appendChecks(number, [isFinite()])
3342
4097
 
3343
4098
  const numberToJson = new Link(
3344
- new Union([finite, nonFiniteLiterals], "anyOf"),
4099
+ new Union([finite, nonFiniteLiterals]),
3345
4100
  new SchemaTransformation.Transformation(
3346
4101
  SchemaGetter.Number(),
3347
4102
  SchemaGetter.transform((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))
@@ -3367,8 +4122,12 @@ const numberToJson = new Link(
3367
4122
  *
3368
4123
  * **Gotchas**
3369
4124
  *
3370
- * When deriving an arbitrary, only `regExp.source` is used. Regular expression
3371
- * flags are ignored because fast-check does not support them.
4125
+ * Arbitrary metadata preserves both `regExp.source` and `regExp.flags`.
4126
+ * Implementations that cannot consume all flags may still use the source as a
4127
+ * generation hint because the Schema filter validates every generated value.
4128
+ * JSON Schema has no way to carry JavaScript regular-expression flags. The
4129
+ * generated `pattern` contains the source only, so validation can differ when
4130
+ * the RegExp uses flags or relies on JavaScript's non-Unicode behavior.
3372
4131
  *
3373
4132
  * **Example** (Validating an email pattern)
3374
4133
  *
@@ -3399,10 +4158,8 @@ export function isPattern(regExp: globalThis.RegExp, annotations?: Schema.Annota
3399
4158
  payload: { source, flags: regExp.flags }
3400
4159
  },
3401
4160
  toJsonSchema: () => ({ pattern: source }),
3402
- arbitrary: {
3403
- constraint: {
3404
- patterns: [regExp.source]
3405
- }
4161
+ arbitraryConstraint: {
4162
+ patterns: [{ source: regExp.source, flags: regExp.flags }]
3406
4163
  },
3407
4164
  ...annotations
3408
4165
  }
@@ -3614,7 +4371,7 @@ const optionalKeyLastLink = applyToLastLink(optionalKey)
3614
4371
 
3615
4372
  /** @internal */
3616
4373
  export const optional = memoize(<A extends AST>(ast: A): Union<A | Undefined> =>
3617
- optionalKey(new Union([ast, undefined_], "anyOf"))
4374
+ optionalKey(new Union([ast, undefined_]))
3618
4375
  )
3619
4376
 
3620
4377
  /** @internal */
@@ -3651,9 +4408,8 @@ export function withConstructorDefault<A extends AST>(
3651
4408
  *
3652
4409
  * **Details**
3653
4410
  *
3654
- * This is the low-level primitive behind `Schema.transform` and
3655
- * `Schema.transformOrFail`. It appends a {@link Link} to the `to` node's
3656
- * encoding chain.
4411
+ * This is the low-level primitive behind `Schema.decodeTo`. It appends a
4412
+ * {@link Link} to the `to` node's encoding chain.
3657
4413
  *
3658
4414
  * - Returns a new AST with the same type as `to`.
3659
4415
  *
@@ -3723,7 +4479,7 @@ export function record(key: AST, value: AST): Objects {
3723
4479
  * Checks `ast.context?.isOptional`. Defaults to `false` when no
3724
4480
  * {@link Context} is set.
3725
4481
  *
3726
- * @see {@link optionalKey}
4482
+ * @see `Schema.optionalKey`
3727
4483
  * @see {@link Context}
3728
4484
  * @category predicates
3729
4485
  * @since 4.0.0
@@ -3886,7 +4642,7 @@ function fromConst<const T>(
3886
4642
  ast: AST,
3887
4643
  value: T
3888
4644
  ): SchemaParser.Parser {
3889
- const succeed = InternalParser.succeed(value)
4645
+ const succeed = value === 0 ? InternalParser.sameExit : InternalParser.succeed(value)
3890
4646
  return (input, options) => {
3891
4647
  if (input === InternalParser.missing) return InternalParser.missingExit
3892
4648
  if (input === value) return succeed
@@ -3959,14 +4715,6 @@ function segmentTemplateLiteralParts(
3959
4715
  return go(0, 0) ? out : undefined
3960
4716
  }
3961
4717
 
3962
- /** @internal */
3963
- export const enumsToLiterals = memoize((ast: Enum): Union<Literal> => {
3964
- return new Union(
3965
- ast.enums.map((e) => new Literal(e[1], { title: e[0] })),
3966
- "anyOf"
3967
- )
3968
- })
3969
-
3970
4718
  const parameterFromPropertyKey = applyToSelfOrLastLinkEncodingIdempotent((ast) => {
3971
4719
  switch (ast._tag) {
3972
4720
  default:
@@ -4038,7 +4786,7 @@ const finiteToString = new Link(
4038
4786
  )
4039
4787
 
4040
4788
  const numberToString = new Link(
4041
- new Union([finiteString, nonFiniteLiterals], "anyOf"),
4789
+ new Union([finiteString, nonFiniteLiterals]),
4042
4790
  SchemaTransformation.numberFromString
4043
4791
  )
4044
4792
 
@@ -4075,7 +4823,7 @@ const bigIntToString = new Link(
4075
4823
  SchemaTransformation.bigintFromString
4076
4824
  )
4077
4825
 
4078
- const REGEXP_PATTERN = "Symbol\\((.*)\\)"
4826
+ const REGEXP_PATTERN = "Symbol\\(([\\s\\S]*)\\)"
4079
4827
 
4080
4828
  const isStringSymbolRegExp = new globalThis.RegExp(`^${REGEXP_PATTERN}$`)
4081
4829
 
@@ -4089,7 +4837,7 @@ const symbolToString = new Link(
4089
4837
  symbolString,
4090
4838
  new SchemaTransformation.Transformation(
4091
4839
  SchemaGetter.transform((description) => globalThis.Symbol.for(isStringSymbolRegExp.exec(description)![1])),
4092
- SchemaGetter.transformOrFail((sym: symbol, options) => {
4840
+ SchemaGetter.transformEffect((sym: symbol, options) => {
4093
4841
  const key = globalThis.Symbol.keyFor(sym)
4094
4842
  if (key !== undefined) {
4095
4843
  return Effect.succeed(globalThis.String(sym))
@@ -4187,7 +4935,7 @@ export function getConstructorDescriptor(ast: AST): ConstructorDescriptor | unde
4187
4935
  *
4188
4936
  * If the node has {@link Checks}, returns annotations from the last check
4189
4937
  * (which is where user-supplied annotations end up after `.pipe(Schema.annotations(...))`).
4190
- * Otherwise returns `Base.annotations` directly.
4938
+ * Otherwise returns the node's `annotations` directly.
4191
4939
  *
4192
4940
  * **Example** (Reading annotations)
4193
4941
  *
@@ -4362,8 +5110,7 @@ export const Json = new Declaration(
4362
5110
  },
4363
5111
  expected: "JSON value",
4364
5112
  toCodecJson: () => undefined,
4365
- toCodecStringTree: () => unknownToStringTree,
4366
- toArbitrary: () => (fc: typeof FastCheck) => fc.jsonValue()
5113
+ toCodecStringTree: () => unknownToStringTree
4367
5114
  }
4368
5115
  )
4369
5116
 
@@ -4386,7 +5133,7 @@ export const objectKeywordToJson = new Link(
4386
5133
  new Union([
4387
5134
  new Arrays(false, [], [Json]),
4388
5135
  new Objects([], [new IndexSignature(string, Json)])
4389
- ], "anyOf"),
5136
+ ]),
4390
5137
  SchemaTransformation.passthrough()
4391
5138
  )
4392
5139