effect 4.0.0-beta.74 → 4.0.0-beta.75

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 (796) hide show
  1. package/dist/Array.d.ts +729 -611
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +273 -213
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BigDecimal.d.ts +37 -30
  6. package/dist/BigDecimal.d.ts.map +1 -1
  7. package/dist/BigDecimal.js +19 -16
  8. package/dist/BigDecimal.js.map +1 -1
  9. package/dist/BigInt.d.ts +34 -40
  10. package/dist/BigInt.d.ts.map +1 -1
  11. package/dist/BigInt.js +16 -16
  12. package/dist/BigInt.js.map +1 -1
  13. package/dist/Boolean.d.ts +8 -8
  14. package/dist/Boolean.js +4 -4
  15. package/dist/Brand.d.ts +13 -11
  16. package/dist/Brand.d.ts.map +1 -1
  17. package/dist/Brand.js +10 -8
  18. package/dist/Brand.js.map +1 -1
  19. package/dist/Cause.d.ts +21 -23
  20. package/dist/Cause.d.ts.map +1 -1
  21. package/dist/Cause.js +21 -23
  22. package/dist/Cause.js.map +1 -1
  23. package/dist/Channel.d.ts +219 -9
  24. package/dist/Channel.d.ts.map +1 -1
  25. package/dist/Channel.js +83 -3
  26. package/dist/Channel.js.map +1 -1
  27. package/dist/ChannelSchema.d.ts +11 -11
  28. package/dist/ChannelSchema.js +5 -5
  29. package/dist/Chunk.d.ts +69 -16
  30. package/dist/Chunk.d.ts.map +1 -1
  31. package/dist/Chunk.js +43 -8
  32. package/dist/Chunk.js.map +1 -1
  33. package/dist/Clock.d.ts +3 -3
  34. package/dist/Clock.js +3 -3
  35. package/dist/Combiner.d.ts +9 -13
  36. package/dist/Combiner.d.ts.map +1 -1
  37. package/dist/Combiner.js +9 -13
  38. package/dist/Combiner.js.map +1 -1
  39. package/dist/Config.d.ts +49 -56
  40. package/dist/Config.d.ts.map +1 -1
  41. package/dist/Config.js +40 -43
  42. package/dist/Config.js.map +1 -1
  43. package/dist/ConfigProvider.d.ts +34 -44
  44. package/dist/ConfigProvider.d.ts.map +1 -1
  45. package/dist/ConfigProvider.js +24 -32
  46. package/dist/ConfigProvider.js.map +1 -1
  47. package/dist/Console.d.ts +2 -2
  48. package/dist/Console.js +2 -2
  49. package/dist/Context.d.ts +60 -72
  50. package/dist/Context.d.ts.map +1 -1
  51. package/dist/Context.js +28 -32
  52. package/dist/Context.js.map +1 -1
  53. package/dist/Cron.d.ts +2 -2
  54. package/dist/Cron.js +2 -2
  55. package/dist/Crypto.d.ts +4 -4
  56. package/dist/Crypto.js +4 -4
  57. package/dist/Data.d.ts +21 -15
  58. package/dist/Data.d.ts.map +1 -1
  59. package/dist/Data.js +7 -7
  60. package/dist/Data.js.map +1 -1
  61. package/dist/DateTime.d.ts +35 -16
  62. package/dist/DateTime.d.ts.map +1 -1
  63. package/dist/DateTime.js +35 -8
  64. package/dist/DateTime.js.map +1 -1
  65. package/dist/Deferred.d.ts +24 -15
  66. package/dist/Deferred.d.ts.map +1 -1
  67. package/dist/Deferred.js +8 -5
  68. package/dist/Deferred.js.map +1 -1
  69. package/dist/Duration.d.ts +44 -31
  70. package/dist/Duration.d.ts.map +1 -1
  71. package/dist/Duration.js +22 -11
  72. package/dist/Duration.js.map +1 -1
  73. package/dist/Effect.d.ts +516 -416
  74. package/dist/Effect.d.ts.map +1 -1
  75. package/dist/Effect.js +234 -174
  76. package/dist/Effect.js.map +1 -1
  77. package/dist/Encoding.d.ts +5 -0
  78. package/dist/Encoding.d.ts.map +1 -1
  79. package/dist/Encoding.js +5 -0
  80. package/dist/Encoding.js.map +1 -1
  81. package/dist/Equal.d.ts +26 -39
  82. package/dist/Equal.d.ts.map +1 -1
  83. package/dist/Equal.js +10 -17
  84. package/dist/Equal.js.map +1 -1
  85. package/dist/Equivalence.d.ts +71 -99
  86. package/dist/Equivalence.d.ts.map +1 -1
  87. package/dist/Equivalence.js +53 -73
  88. package/dist/Equivalence.js.map +1 -1
  89. package/dist/ErrorReporter.d.ts +1 -1
  90. package/dist/ErrorReporter.js +1 -1
  91. package/dist/Exit.d.ts +79 -96
  92. package/dist/Exit.d.ts.map +1 -1
  93. package/dist/Exit.js +57 -64
  94. package/dist/Exit.js.map +1 -1
  95. package/dist/Fiber.d.ts +8 -6
  96. package/dist/Fiber.d.ts.map +1 -1
  97. package/dist/Fiber.js +8 -6
  98. package/dist/Fiber.js.map +1 -1
  99. package/dist/FiberHandle.d.ts +25 -0
  100. package/dist/FiberHandle.d.ts.map +1 -1
  101. package/dist/FiberHandle.js +15 -0
  102. package/dist/FiberHandle.js.map +1 -1
  103. package/dist/FiberMap.d.ts +35 -0
  104. package/dist/FiberMap.d.ts.map +1 -1
  105. package/dist/FiberMap.js +15 -0
  106. package/dist/FiberMap.js.map +1 -1
  107. package/dist/FiberSet.d.ts +20 -0
  108. package/dist/FiberSet.d.ts.map +1 -1
  109. package/dist/FiberSet.js +10 -0
  110. package/dist/FiberSet.js.map +1 -1
  111. package/dist/Filter.d.ts +4 -4
  112. package/dist/Filter.js +4 -4
  113. package/dist/Formatter.d.ts +14 -19
  114. package/dist/Formatter.d.ts.map +1 -1
  115. package/dist/Formatter.js +14 -19
  116. package/dist/Formatter.js.map +1 -1
  117. package/dist/Function.d.ts +15 -16
  118. package/dist/Function.d.ts.map +1 -1
  119. package/dist/Function.js +9 -10
  120. package/dist/Function.js.map +1 -1
  121. package/dist/Graph.d.ts +2 -2
  122. package/dist/Graph.js +2 -2
  123. package/dist/HKT.d.ts +2 -2
  124. package/dist/Hash.d.ts +2 -1
  125. package/dist/Hash.d.ts.map +1 -1
  126. package/dist/Hash.js +2 -1
  127. package/dist/Hash.js.map +1 -1
  128. package/dist/HashMap.d.ts +15 -0
  129. package/dist/HashMap.d.ts.map +1 -1
  130. package/dist/HashMap.js +5 -0
  131. package/dist/HashMap.js.map +1 -1
  132. package/dist/HashRing.d.ts +9 -9
  133. package/dist/HashRing.js +3 -3
  134. package/dist/Iterable.d.ts +24 -12
  135. package/dist/Iterable.d.ts.map +1 -1
  136. package/dist/Iterable.js +16 -6
  137. package/dist/Iterable.js.map +1 -1
  138. package/dist/JsonPatch.d.ts +2 -3
  139. package/dist/JsonPatch.d.ts.map +1 -1
  140. package/dist/JsonPatch.js +2 -3
  141. package/dist/JsonPatch.js.map +1 -1
  142. package/dist/JsonPointer.d.ts +2 -6
  143. package/dist/JsonPointer.d.ts.map +1 -1
  144. package/dist/JsonPointer.js +2 -6
  145. package/dist/JsonPointer.js.map +1 -1
  146. package/dist/JsonSchema.d.ts +17 -13
  147. package/dist/JsonSchema.d.ts.map +1 -1
  148. package/dist/JsonSchema.js +17 -13
  149. package/dist/JsonSchema.js.map +1 -1
  150. package/dist/Latch.d.ts +4 -3
  151. package/dist/Latch.d.ts.map +1 -1
  152. package/dist/Latch.js +4 -3
  153. package/dist/Latch.js.map +1 -1
  154. package/dist/Layer.d.ts +92 -114
  155. package/dist/Layer.d.ts.map +1 -1
  156. package/dist/Layer.js +38 -46
  157. package/dist/Layer.js.map +1 -1
  158. package/dist/Logger.d.ts +11 -14
  159. package/dist/Logger.d.ts.map +1 -1
  160. package/dist/Logger.js +11 -14
  161. package/dist/Logger.js.map +1 -1
  162. package/dist/Match.d.ts +2 -2
  163. package/dist/Match.js +2 -2
  164. package/dist/Metric.d.ts +89 -109
  165. package/dist/Metric.d.ts.map +1 -1
  166. package/dist/Metric.js +51 -61
  167. package/dist/Metric.js.map +1 -1
  168. package/dist/MutableHashMap.d.ts +21 -12
  169. package/dist/MutableHashMap.d.ts.map +1 -1
  170. package/dist/MutableHashMap.js +7 -4
  171. package/dist/MutableHashMap.js.map +1 -1
  172. package/dist/MutableList.d.ts +15 -0
  173. package/dist/MutableList.d.ts.map +1 -1
  174. package/dist/MutableList.js +15 -0
  175. package/dist/MutableList.js.map +1 -1
  176. package/dist/MutableRef.d.ts +56 -42
  177. package/dist/MutableRef.d.ts.map +1 -1
  178. package/dist/MutableRef.js +28 -22
  179. package/dist/MutableRef.js.map +1 -1
  180. package/dist/Newtype.d.ts +10 -7
  181. package/dist/Newtype.d.ts.map +1 -1
  182. package/dist/Newtype.js +10 -7
  183. package/dist/Newtype.js.map +1 -1
  184. package/dist/Number.d.ts +23 -11
  185. package/dist/Number.d.ts.map +1 -1
  186. package/dist/Number.js +9 -5
  187. package/dist/Number.js.map +1 -1
  188. package/dist/Optic.d.ts +16 -16
  189. package/dist/Optic.d.ts.map +1 -1
  190. package/dist/Optic.js +10 -9
  191. package/dist/Optic.js.map +1 -1
  192. package/dist/Option.d.ts +196 -168
  193. package/dist/Option.d.ts.map +1 -1
  194. package/dist/Option.js +96 -79
  195. package/dist/Option.js.map +1 -1
  196. package/dist/Order.d.ts +118 -179
  197. package/dist/Order.d.ts.map +1 -1
  198. package/dist/Order.js +92 -144
  199. package/dist/Order.js.map +1 -1
  200. package/dist/PartitionedSemaphore.d.ts +14 -14
  201. package/dist/PartitionedSemaphore.js +6 -6
  202. package/dist/Path.d.ts +2 -2
  203. package/dist/Path.js +2 -2
  204. package/dist/Pipeable.d.ts +2 -2
  205. package/dist/Pipeable.js +2 -2
  206. package/dist/PlatformError.d.ts +4 -4
  207. package/dist/PlatformError.js +4 -4
  208. package/dist/Pool.d.ts +7 -11
  209. package/dist/Pool.d.ts.map +1 -1
  210. package/dist/Pool.js +3 -5
  211. package/dist/Pool.js.map +1 -1
  212. package/dist/Predicate.d.ts +274 -263
  213. package/dist/Predicate.d.ts.map +1 -1
  214. package/dist/Predicate.js +128 -123
  215. package/dist/Predicate.js.map +1 -1
  216. package/dist/PubSub.d.ts +24 -14
  217. package/dist/PubSub.d.ts.map +1 -1
  218. package/dist/PubSub.js +16 -6
  219. package/dist/PubSub.js.map +1 -1
  220. package/dist/Pull.d.ts +4 -4
  221. package/dist/Pull.js +4 -4
  222. package/dist/Queue.d.ts +46 -7
  223. package/dist/Queue.d.ts.map +1 -1
  224. package/dist/Queue.js +46 -7
  225. package/dist/Queue.js.map +1 -1
  226. package/dist/RcRef.d.ts +0 -4
  227. package/dist/RcRef.d.ts.map +1 -1
  228. package/dist/RcRef.js.map +1 -1
  229. package/dist/Redactable.d.ts +2 -2
  230. package/dist/Redactable.js +2 -2
  231. package/dist/Redacted.d.ts +3 -3
  232. package/dist/Redacted.js +3 -3
  233. package/dist/Reducer.d.ts +2 -3
  234. package/dist/Reducer.d.ts.map +1 -1
  235. package/dist/Reducer.js +2 -3
  236. package/dist/Reducer.js.map +1 -1
  237. package/dist/Ref.d.ts +17 -16
  238. package/dist/Ref.d.ts.map +1 -1
  239. package/dist/Ref.js +15 -14
  240. package/dist/Ref.js.map +1 -1
  241. package/dist/References.d.ts +4 -4
  242. package/dist/References.js +4 -4
  243. package/dist/Request.d.ts +18 -18
  244. package/dist/Request.js +6 -6
  245. package/dist/Resource.d.ts +2 -2
  246. package/dist/Resource.js +2 -2
  247. package/dist/Result.d.ts +77 -33
  248. package/dist/Result.d.ts.map +1 -1
  249. package/dist/Result.js +42 -19
  250. package/dist/Result.js.map +1 -1
  251. package/dist/Runtime.d.ts +11 -8
  252. package/dist/Runtime.d.ts.map +1 -1
  253. package/dist/Runtime.js +11 -8
  254. package/dist/Runtime.js.map +1 -1
  255. package/dist/Schedule.d.ts +107 -45
  256. package/dist/Schedule.d.ts.map +1 -1
  257. package/dist/Schedule.js +41 -29
  258. package/dist/Schedule.js.map +1 -1
  259. package/dist/Scheduler.d.ts +6 -4
  260. package/dist/Scheduler.d.ts.map +1 -1
  261. package/dist/Scheduler.js +6 -4
  262. package/dist/Scheduler.js.map +1 -1
  263. package/dist/Schema.d.ts +443 -371
  264. package/dist/Schema.d.ts.map +1 -1
  265. package/dist/Schema.js +518 -427
  266. package/dist/Schema.js.map +1 -1
  267. package/dist/SchemaAST.d.ts +42 -21
  268. package/dist/SchemaAST.d.ts.map +1 -1
  269. package/dist/SchemaAST.js +80 -59
  270. package/dist/SchemaAST.js.map +1 -1
  271. package/dist/SchemaGetter.d.ts +126 -106
  272. package/dist/SchemaGetter.d.ts.map +1 -1
  273. package/dist/SchemaGetter.js +121 -101
  274. package/dist/SchemaGetter.js.map +1 -1
  275. package/dist/SchemaIssue.d.ts +37 -39
  276. package/dist/SchemaIssue.d.ts.map +1 -1
  277. package/dist/SchemaIssue.js +16 -17
  278. package/dist/SchemaIssue.js.map +1 -1
  279. package/dist/SchemaParser.d.ts +72 -153
  280. package/dist/SchemaParser.d.ts.map +1 -1
  281. package/dist/SchemaParser.js +72 -145
  282. package/dist/SchemaParser.js.map +1 -1
  283. package/dist/SchemaRepresentation.d.ts +30 -21
  284. package/dist/SchemaRepresentation.d.ts.map +1 -1
  285. package/dist/SchemaRepresentation.js +26 -22
  286. package/dist/SchemaRepresentation.js.map +1 -1
  287. package/dist/SchemaTransformation.d.ts +169 -145
  288. package/dist/SchemaTransformation.d.ts.map +1 -1
  289. package/dist/SchemaTransformation.js +183 -159
  290. package/dist/SchemaTransformation.js.map +1 -1
  291. package/dist/SchemaUtils.js +2 -2
  292. package/dist/SchemaUtils.js.map +1 -1
  293. package/dist/Scope.d.ts +15 -0
  294. package/dist/Scope.d.ts.map +1 -1
  295. package/dist/Scope.js +15 -0
  296. package/dist/Scope.js.map +1 -1
  297. package/dist/ScopedCache.d.ts +1 -1
  298. package/dist/ScopedCache.js +1 -1
  299. package/dist/ScopedRef.d.ts +14 -18
  300. package/dist/ScopedRef.d.ts.map +1 -1
  301. package/dist/ScopedRef.js +6 -8
  302. package/dist/ScopedRef.js.map +1 -1
  303. package/dist/Semaphore.d.ts +9 -9
  304. package/dist/Semaphore.js +3 -3
  305. package/dist/Sink.d.ts +13 -13
  306. package/dist/Sink.d.ts.map +1 -1
  307. package/dist/Sink.js +9 -9
  308. package/dist/Sink.js.map +1 -1
  309. package/dist/Stdio.d.ts +4 -5
  310. package/dist/Stdio.d.ts.map +1 -1
  311. package/dist/Stdio.js +4 -5
  312. package/dist/Stdio.js.map +1 -1
  313. package/dist/Stream.d.ts +321 -44
  314. package/dist/Stream.d.ts.map +1 -1
  315. package/dist/Stream.js +137 -22
  316. package/dist/Stream.js.map +1 -1
  317. package/dist/String.d.ts +6 -9
  318. package/dist/String.d.ts.map +1 -1
  319. package/dist/String.js +2 -3
  320. package/dist/String.js.map +1 -1
  321. package/dist/Struct.d.ts +15 -13
  322. package/dist/Struct.d.ts.map +1 -1
  323. package/dist/Struct.js +11 -9
  324. package/dist/Struct.js.map +1 -1
  325. package/dist/SubscriptionRef.d.ts +24 -19
  326. package/dist/SubscriptionRef.d.ts.map +1 -1
  327. package/dist/SubscriptionRef.js +12 -7
  328. package/dist/SubscriptionRef.js.map +1 -1
  329. package/dist/SynchronizedRef.d.ts +88 -63
  330. package/dist/SynchronizedRef.d.ts.map +1 -1
  331. package/dist/SynchronizedRef.js +32 -23
  332. package/dist/SynchronizedRef.js.map +1 -1
  333. package/dist/Tracer.d.ts +4 -4
  334. package/dist/Tracer.js +4 -4
  335. package/dist/Trie.d.ts +15 -0
  336. package/dist/Trie.d.ts.map +1 -1
  337. package/dist/Trie.js +5 -0
  338. package/dist/Trie.js.map +1 -1
  339. package/dist/Tuple.d.ts +25 -19
  340. package/dist/Tuple.d.ts.map +1 -1
  341. package/dist/Tuple.js +17 -13
  342. package/dist/Tuple.js.map +1 -1
  343. package/dist/TxReentrantLock.d.ts +6 -3
  344. package/dist/TxReentrantLock.d.ts.map +1 -1
  345. package/dist/TxReentrantLock.js +2 -1
  346. package/dist/TxReentrantLock.js.map +1 -1
  347. package/dist/TxRef.d.ts +16 -16
  348. package/dist/TxRef.js +8 -8
  349. package/dist/TxSubscriptionRef.d.ts +43 -27
  350. package/dist/TxSubscriptionRef.d.ts.map +1 -1
  351. package/dist/TxSubscriptionRef.js +19 -13
  352. package/dist/TxSubscriptionRef.js.map +1 -1
  353. package/dist/Types.d.ts +12 -38
  354. package/dist/Types.d.ts.map +1 -1
  355. package/dist/Types.js +0 -2
  356. package/dist/UndefinedOr.d.ts +15 -14
  357. package/dist/UndefinedOr.d.ts.map +1 -1
  358. package/dist/UndefinedOr.js +11 -10
  359. package/dist/UndefinedOr.js.map +1 -1
  360. package/dist/Unify.d.ts +2 -2
  361. package/dist/internal/schema/annotations.js.map +1 -1
  362. package/dist/internal/schema/arbitrary.js +9 -9
  363. package/dist/internal/schema/arbitrary.js.map +1 -1
  364. package/dist/internal/schema/equivalence.js +9 -9
  365. package/dist/internal/schema/equivalence.js.map +1 -1
  366. package/dist/internal/schema/representation.js +14 -14
  367. package/dist/internal/schema/representation.js.map +1 -1
  368. package/dist/internal/schema/schema.js +11 -11
  369. package/dist/internal/schema/schema.js.map +1 -1
  370. package/dist/testing/TestSchema.d.ts +10 -10
  371. package/dist/testing/TestSchema.d.ts.map +1 -1
  372. package/dist/testing/TestSchema.js +9 -9
  373. package/dist/testing/TestSchema.js.map +1 -1
  374. package/dist/unstable/ai/AiError.d.ts +4 -2
  375. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  376. package/dist/unstable/ai/AiError.js +4 -2
  377. package/dist/unstable/ai/AiError.js.map +1 -1
  378. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +17 -20
  379. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  380. package/dist/unstable/ai/AnthropicStructuredOutput.js +36 -39
  381. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  382. package/dist/unstable/ai/Chat.d.ts +4 -5
  383. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  384. package/dist/unstable/ai/Chat.js +4 -5
  385. package/dist/unstable/ai/Chat.js.map +1 -1
  386. package/dist/unstable/ai/EmbeddingModel.d.ts +4 -4
  387. package/dist/unstable/ai/EmbeddingModel.js +4 -4
  388. package/dist/unstable/ai/IdGenerator.d.ts +2 -3
  389. package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
  390. package/dist/unstable/ai/IdGenerator.js +2 -3
  391. package/dist/unstable/ai/IdGenerator.js.map +1 -1
  392. package/dist/unstable/ai/LanguageModel.d.ts +3 -2
  393. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  394. package/dist/unstable/ai/LanguageModel.js +5 -4
  395. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  396. package/dist/unstable/ai/McpSchema.d.ts +14 -12
  397. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  398. package/dist/unstable/ai/McpSchema.js +19 -17
  399. package/dist/unstable/ai/McpSchema.js.map +1 -1
  400. package/dist/unstable/ai/McpServer.d.ts +11 -4
  401. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  402. package/dist/unstable/ai/McpServer.js +8 -5
  403. package/dist/unstable/ai/McpServer.js.map +1 -1
  404. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +20 -18
  405. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  406. package/dist/unstable/ai/OpenAiStructuredOutput.js +45 -43
  407. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  408. package/dist/unstable/ai/Prompt.d.ts +2 -2
  409. package/dist/unstable/ai/Prompt.js +3 -3
  410. package/dist/unstable/ai/Prompt.js.map +1 -1
  411. package/dist/unstable/ai/ResponseIdTracker.d.ts +3 -2
  412. package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
  413. package/dist/unstable/ai/ResponseIdTracker.js +3 -2
  414. package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
  415. package/dist/unstable/ai/Telemetry.d.ts +21 -6
  416. package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
  417. package/dist/unstable/ai/Telemetry.js +7 -2
  418. package/dist/unstable/ai/Telemetry.js.map +1 -1
  419. package/dist/unstable/ai/Tool.d.ts +7 -6
  420. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  421. package/dist/unstable/ai/Tool.js +8 -7
  422. package/dist/unstable/ai/Tool.js.map +1 -1
  423. package/dist/unstable/ai/Toolkit.d.ts +2 -2
  424. package/dist/unstable/ai/Toolkit.js +2 -2
  425. package/dist/unstable/cli/Command.d.ts +37 -16
  426. package/dist/unstable/cli/Command.d.ts.map +1 -1
  427. package/dist/unstable/cli/Command.js +15 -8
  428. package/dist/unstable/cli/Command.js.map +1 -1
  429. package/dist/unstable/cli/Completions.d.ts +1 -1
  430. package/dist/unstable/cli/Completions.js +1 -1
  431. package/dist/unstable/cli/Flag.d.ts +7 -6
  432. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  433. package/dist/unstable/cli/Flag.js +7 -6
  434. package/dist/unstable/cli/Flag.js.map +1 -1
  435. package/dist/unstable/cli/GlobalFlag.d.ts +6 -1
  436. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  437. package/dist/unstable/cli/GlobalFlag.js +7 -2
  438. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  439. package/dist/unstable/cli/Param.d.ts +3 -3
  440. package/dist/unstable/cli/Param.d.ts.map +1 -1
  441. package/dist/unstable/cli/Param.js +13 -10
  442. package/dist/unstable/cli/Param.js.map +1 -1
  443. package/dist/unstable/cli/Primitive.d.ts +3 -2
  444. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  445. package/dist/unstable/cli/Primitive.js +3 -2
  446. package/dist/unstable/cli/Primitive.js.map +1 -1
  447. package/dist/unstable/cluster/ClusterCron.d.ts +1 -2
  448. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  449. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  450. package/dist/unstable/cluster/ClusterMetrics.d.ts +5 -0
  451. package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
  452. package/dist/unstable/cluster/ClusterMetrics.js +5 -0
  453. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  454. package/dist/unstable/cluster/ClusterSchema.d.ts +3 -3
  455. package/dist/unstable/cluster/ClusterSchema.js +3 -3
  456. package/dist/unstable/cluster/ClusterWorkflowEngine.js +15 -15
  457. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  458. package/dist/unstable/cluster/EntityResource.d.ts +10 -0
  459. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  460. package/dist/unstable/cluster/EntityResource.js +10 -0
  461. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  462. package/dist/unstable/cluster/Envelope.d.ts +2 -2
  463. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  464. package/dist/unstable/cluster/Envelope.js +2 -2
  465. package/dist/unstable/cluster/Envelope.js.map +1 -1
  466. package/dist/unstable/cluster/Reply.d.ts +2 -2
  467. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  468. package/dist/unstable/cluster/Reply.js +12 -12
  469. package/dist/unstable/cluster/Reply.js.map +1 -1
  470. package/dist/unstable/cluster/RunnerHealth.d.ts +2 -1
  471. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  472. package/dist/unstable/cluster/RunnerHealth.js +2 -1
  473. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  474. package/dist/unstable/cluster/RunnerServer.d.ts +2 -2
  475. package/dist/unstable/cluster/RunnerServer.js +2 -2
  476. package/dist/unstable/cluster/Runners.d.ts +3 -3
  477. package/dist/unstable/cluster/Runners.js +3 -3
  478. package/dist/unstable/cluster/ShardId.js +3 -3
  479. package/dist/unstable/cluster/ShardId.js.map +1 -1
  480. package/dist/unstable/cluster/Sharding.d.ts +3 -3
  481. package/dist/unstable/cluster/Sharding.js +3 -3
  482. package/dist/unstable/cluster/ShardingConfig.d.ts +4 -4
  483. package/dist/unstable/cluster/ShardingConfig.js +4 -4
  484. package/dist/unstable/cluster/Snowflake.d.ts +1 -1
  485. package/dist/unstable/cluster/Snowflake.js +3 -3
  486. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  487. package/dist/unstable/cluster/internal/entityManager.js +2 -2
  488. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  489. package/dist/unstable/encoding/Msgpack.d.ts +2 -2
  490. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  491. package/dist/unstable/encoding/Msgpack.js +5 -5
  492. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  493. package/dist/unstable/encoding/Ndjson.d.ts +5 -0
  494. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  495. package/dist/unstable/encoding/Ndjson.js +5 -0
  496. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  497. package/dist/unstable/encoding/Sse.d.ts +2 -2
  498. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  499. package/dist/unstable/encoding/Sse.js +2 -2
  500. package/dist/unstable/encoding/Sse.js.map +1 -1
  501. package/dist/unstable/eventlog/EventGroup.d.ts +2 -1
  502. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  503. package/dist/unstable/eventlog/EventGroup.js +2 -1
  504. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  505. package/dist/unstable/eventlog/EventJournal.d.ts +10 -0
  506. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  507. package/dist/unstable/eventlog/EventJournal.js +10 -0
  508. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  509. package/dist/unstable/eventlog/EventLog.d.ts +3 -3
  510. package/dist/unstable/eventlog/EventLog.js +3 -3
  511. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +2 -3
  512. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  513. package/dist/unstable/eventlog/EventLogServerEncrypted.js +2 -3
  514. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  515. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -7
  516. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  517. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +5 -7
  518. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  519. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +4 -4
  520. package/dist/unstable/eventlog/EventLogSessionAuth.js +4 -4
  521. package/dist/unstable/http/Cookies.js +4 -4
  522. package/dist/unstable/http/Cookies.js.map +1 -1
  523. package/dist/unstable/http/Etag.d.ts +2 -3
  524. package/dist/unstable/http/Etag.d.ts.map +1 -1
  525. package/dist/unstable/http/Etag.js +2 -3
  526. package/dist/unstable/http/Etag.js.map +1 -1
  527. package/dist/unstable/http/Headers.js +2 -2
  528. package/dist/unstable/http/Headers.js.map +1 -1
  529. package/dist/unstable/http/HttpBody.js +2 -2
  530. package/dist/unstable/http/HttpBody.js.map +1 -1
  531. package/dist/unstable/http/HttpClient.d.ts +2 -2
  532. package/dist/unstable/http/HttpClient.js +2 -2
  533. package/dist/unstable/http/HttpClientRequest.d.ts +30 -3
  534. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  535. package/dist/unstable/http/HttpClientRequest.js +10 -1
  536. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  537. package/dist/unstable/http/HttpRouter.d.ts +1 -1
  538. package/dist/unstable/http/HttpRouter.js +1 -1
  539. package/dist/unstable/http/HttpServerResponse.d.ts +25 -20
  540. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  541. package/dist/unstable/http/HttpServerResponse.js +13 -8
  542. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  543. package/dist/unstable/http/Multipart.js +3 -3
  544. package/dist/unstable/http/Multipart.js.map +1 -1
  545. package/dist/unstable/http/UrlParams.d.ts +30 -0
  546. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  547. package/dist/unstable/http/UrlParams.js +16 -6
  548. package/dist/unstable/http/UrlParams.js.map +1 -1
  549. package/dist/unstable/httpapi/HttpApi.d.ts +3 -2
  550. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  551. package/dist/unstable/httpapi/HttpApi.js +3 -2
  552. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  553. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  554. package/dist/unstable/httpapi/HttpApiBuilder.js +10 -8
  555. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  556. package/dist/unstable/httpapi/HttpApiClient.js +15 -15
  557. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  558. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +3 -3
  559. package/dist/unstable/httpapi/HttpApiMiddleware.js +3 -3
  560. package/dist/unstable/httpapi/HttpApiSchema.d.ts +2 -2
  561. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  562. package/dist/unstable/httpapi/HttpApiSchema.js +9 -9
  563. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  564. package/dist/unstable/httpapi/OpenApi.js +11 -11
  565. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  566. package/dist/unstable/observability/OtlpResource.d.ts +5 -0
  567. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  568. package/dist/unstable/observability/OtlpResource.js +5 -0
  569. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  570. package/dist/unstable/observability/PrometheusMetrics.d.ts +4 -2
  571. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  572. package/dist/unstable/observability/PrometheusMetrics.js +4 -2
  573. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  574. package/dist/unstable/reactivity/Atom.d.ts +3 -3
  575. package/dist/unstable/reactivity/Atom.js +3 -3
  576. package/dist/unstable/rpc/RpcSchema.d.ts +2 -2
  577. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  578. package/dist/unstable/rpc/RpcSerialization.d.ts +2 -2
  579. package/dist/unstable/rpc/RpcSerialization.js +2 -2
  580. package/dist/unstable/schema/Model.js +5 -5
  581. package/dist/unstable/schema/Model.js.map +1 -1
  582. package/dist/unstable/schema/VariantSchema.d.ts +2 -2
  583. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  584. package/dist/unstable/sql/SqlSchema.d.ts +4 -4
  585. package/dist/unstable/sql/SqlSchema.js +4 -4
  586. package/dist/unstable/workers/Transferable.d.ts +2 -2
  587. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  588. package/dist/unstable/workers/Transferable.js +5 -5
  589. package/dist/unstable/workers/Transferable.js.map +1 -1
  590. package/dist/unstable/workflow/DurableDeferred.js +7 -7
  591. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  592. package/dist/unstable/workflow/DurableQueue.d.ts +1 -2
  593. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  594. package/dist/unstable/workflow/DurableQueue.js +1 -2
  595. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  596. package/dist/unstable/workflow/Workflow.d.ts +35 -15
  597. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  598. package/dist/unstable/workflow/Workflow.js +94 -72
  599. package/dist/unstable/workflow/Workflow.js.map +1 -1
  600. package/dist/unstable/workflow/WorkflowEngine.d.ts +10 -2
  601. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  602. package/dist/unstable/workflow/WorkflowEngine.js +16 -8
  603. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  604. package/dist/unstable/workflow/WorkflowProxy.d.ts +2 -4
  605. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  606. package/dist/unstable/workflow/WorkflowProxy.js +9 -11
  607. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  608. package/dist/unstable/workflow/WorkflowProxyServer.js +7 -7
  609. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  610. package/package.json +1 -1
  611. package/src/Array.ts +729 -611
  612. package/src/BigDecimal.ts +37 -30
  613. package/src/BigInt.ts +34 -40
  614. package/src/Boolean.ts +8 -8
  615. package/src/Brand.ts +16 -14
  616. package/src/Cause.ts +21 -23
  617. package/src/Channel.ts +249 -9
  618. package/src/ChannelSchema.ts +11 -11
  619. package/src/Chunk.ts +69 -16
  620. package/src/Clock.ts +3 -3
  621. package/src/Combiner.ts +9 -13
  622. package/src/Config.ts +60 -67
  623. package/src/ConfigProvider.ts +34 -44
  624. package/src/Console.ts +2 -2
  625. package/src/Context.ts +60 -72
  626. package/src/Cron.ts +2 -2
  627. package/src/Crypto.ts +4 -4
  628. package/src/Data.ts +21 -15
  629. package/src/DateTime.ts +35 -16
  630. package/src/Deferred.ts +24 -15
  631. package/src/Duration.ts +44 -31
  632. package/src/Effect.ts +516 -416
  633. package/src/Encoding.ts +5 -0
  634. package/src/Equal.ts +26 -39
  635. package/src/Equivalence.ts +71 -99
  636. package/src/ErrorReporter.ts +1 -1
  637. package/src/Exit.ts +79 -96
  638. package/src/Fiber.ts +8 -6
  639. package/src/FiberHandle.ts +25 -0
  640. package/src/FiberMap.ts +35 -0
  641. package/src/FiberSet.ts +20 -0
  642. package/src/Filter.ts +4 -4
  643. package/src/Formatter.ts +14 -19
  644. package/src/Function.ts +15 -16
  645. package/src/Graph.ts +2 -2
  646. package/src/HKT.ts +2 -2
  647. package/src/Hash.ts +2 -1
  648. package/src/HashMap.ts +15 -0
  649. package/src/HashRing.ts +9 -9
  650. package/src/Iterable.ts +24 -12
  651. package/src/JsonPatch.ts +2 -3
  652. package/src/JsonPointer.ts +2 -6
  653. package/src/JsonSchema.ts +17 -13
  654. package/src/Latch.ts +4 -3
  655. package/src/Layer.ts +92 -114
  656. package/src/Logger.ts +15 -18
  657. package/src/Match.ts +2 -2
  658. package/src/Metric.ts +109 -137
  659. package/src/MutableHashMap.ts +35 -20
  660. package/src/MutableList.ts +15 -0
  661. package/src/MutableRef.ts +56 -42
  662. package/src/Newtype.ts +10 -7
  663. package/src/Number.ts +23 -11
  664. package/src/Optic.ts +25 -22
  665. package/src/Option.ts +196 -168
  666. package/src/Order.ts +118 -179
  667. package/src/PartitionedSemaphore.ts +14 -14
  668. package/src/Path.ts +2 -2
  669. package/src/Pipeable.ts +2 -2
  670. package/src/PlatformError.ts +4 -4
  671. package/src/Pool.ts +7 -11
  672. package/src/Predicate.ts +274 -263
  673. package/src/PubSub.ts +24 -14
  674. package/src/Pull.ts +4 -4
  675. package/src/Queue.ts +46 -7
  676. package/src/RcRef.ts +0 -4
  677. package/src/Redactable.ts +2 -2
  678. package/src/Redacted.ts +3 -3
  679. package/src/Reducer.ts +2 -3
  680. package/src/Ref.ts +43 -40
  681. package/src/References.ts +4 -4
  682. package/src/Request.ts +18 -18
  683. package/src/Resource.ts +2 -2
  684. package/src/Result.ts +87 -33
  685. package/src/Runtime.ts +11 -8
  686. package/src/Schedule.ts +112 -45
  687. package/src/Scheduler.ts +6 -4
  688. package/src/Schema.ts +843 -649
  689. package/src/SchemaAST.ts +148 -117
  690. package/src/SchemaGetter.ts +142 -121
  691. package/src/SchemaIssue.ts +39 -41
  692. package/src/SchemaParser.ts +173 -229
  693. package/src/SchemaRepresentation.ts +38 -28
  694. package/src/SchemaTransformation.ts +233 -207
  695. package/src/SchemaUtils.ts +2 -2
  696. package/src/Scope.ts +15 -0
  697. package/src/ScopedCache.ts +1 -1
  698. package/src/ScopedRef.ts +14 -18
  699. package/src/Semaphore.ts +9 -9
  700. package/src/Sink.ts +13 -13
  701. package/src/Stdio.ts +4 -5
  702. package/src/Stream.ts +354 -57
  703. package/src/String.ts +6 -9
  704. package/src/Struct.ts +15 -13
  705. package/src/SubscriptionRef.ts +24 -19
  706. package/src/SynchronizedRef.ts +88 -63
  707. package/src/Tracer.ts +4 -4
  708. package/src/Trie.ts +15 -0
  709. package/src/Tuple.ts +25 -19
  710. package/src/TxReentrantLock.ts +6 -3
  711. package/src/TxRef.ts +16 -16
  712. package/src/TxSubscriptionRef.ts +43 -27
  713. package/src/Types.ts +12 -39
  714. package/src/UndefinedOr.ts +15 -14
  715. package/src/Unify.ts +2 -2
  716. package/src/internal/schema/annotations.ts +4 -4
  717. package/src/internal/schema/arbitrary.ts +16 -16
  718. package/src/internal/schema/equivalence.ts +11 -11
  719. package/src/internal/schema/representation.ts +23 -23
  720. package/src/internal/schema/schema.ts +17 -17
  721. package/src/testing/TestSchema.ts +20 -20
  722. package/src/unstable/ai/AiError.ts +4 -2
  723. package/src/unstable/ai/AnthropicStructuredOutput.ts +59 -56
  724. package/src/unstable/ai/Chat.ts +4 -5
  725. package/src/unstable/ai/EmbeddingModel.ts +4 -4
  726. package/src/unstable/ai/IdGenerator.ts +2 -3
  727. package/src/unstable/ai/LanguageModel.ts +5 -4
  728. package/src/unstable/ai/McpSchema.ts +19 -17
  729. package/src/unstable/ai/McpServer.ts +14 -7
  730. package/src/unstable/ai/OpenAiStructuredOutput.ts +72 -61
  731. package/src/unstable/ai/Prompt.ts +5 -5
  732. package/src/unstable/ai/ResponseIdTracker.ts +3 -2
  733. package/src/unstable/ai/Telemetry.ts +21 -6
  734. package/src/unstable/ai/Tool.ts +11 -10
  735. package/src/unstable/ai/Toolkit.ts +2 -2
  736. package/src/unstable/cli/Command.ts +37 -16
  737. package/src/unstable/cli/Completions.ts +1 -1
  738. package/src/unstable/cli/Flag.ts +7 -6
  739. package/src/unstable/cli/GlobalFlag.ts +7 -1
  740. package/src/unstable/cli/Param.ts +23 -18
  741. package/src/unstable/cli/Primitive.ts +3 -2
  742. package/src/unstable/cluster/ClusterCron.ts +1 -2
  743. package/src/unstable/cluster/ClusterMetrics.ts +5 -0
  744. package/src/unstable/cluster/ClusterSchema.ts +3 -3
  745. package/src/unstable/cluster/ClusterWorkflowEngine.ts +15 -15
  746. package/src/unstable/cluster/EntityResource.ts +10 -0
  747. package/src/unstable/cluster/Envelope.ts +3 -3
  748. package/src/unstable/cluster/Reply.ts +14 -12
  749. package/src/unstable/cluster/RunnerHealth.ts +2 -1
  750. package/src/unstable/cluster/RunnerServer.ts +2 -2
  751. package/src/unstable/cluster/Runners.ts +3 -3
  752. package/src/unstable/cluster/ShardId.ts +3 -3
  753. package/src/unstable/cluster/Sharding.ts +3 -3
  754. package/src/unstable/cluster/ShardingConfig.ts +4 -4
  755. package/src/unstable/cluster/Snowflake.ts +3 -3
  756. package/src/unstable/cluster/internal/entityManager.ts +2 -2
  757. package/src/unstable/encoding/Msgpack.ts +6 -6
  758. package/src/unstable/encoding/Ndjson.ts +5 -0
  759. package/src/unstable/encoding/Sse.ts +2 -2
  760. package/src/unstable/eventlog/EventGroup.ts +2 -1
  761. package/src/unstable/eventlog/EventJournal.ts +10 -0
  762. package/src/unstable/eventlog/EventLog.ts +3 -3
  763. package/src/unstable/eventlog/EventLogServerEncrypted.ts +2 -3
  764. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +5 -7
  765. package/src/unstable/eventlog/EventLogSessionAuth.ts +4 -4
  766. package/src/unstable/http/Cookies.ts +4 -4
  767. package/src/unstable/http/Etag.ts +2 -3
  768. package/src/unstable/http/Headers.ts +2 -2
  769. package/src/unstable/http/HttpBody.ts +2 -2
  770. package/src/unstable/http/HttpClient.ts +2 -2
  771. package/src/unstable/http/HttpClientRequest.ts +30 -3
  772. package/src/unstable/http/HttpRouter.ts +1 -1
  773. package/src/unstable/http/HttpServerResponse.ts +25 -20
  774. package/src/unstable/http/Multipart.ts +3 -3
  775. package/src/unstable/http/UrlParams.ts +36 -6
  776. package/src/unstable/httpapi/HttpApi.ts +5 -4
  777. package/src/unstable/httpapi/HttpApiBuilder.ts +14 -13
  778. package/src/unstable/httpapi/HttpApiClient.ts +16 -16
  779. package/src/unstable/httpapi/HttpApiMiddleware.ts +3 -3
  780. package/src/unstable/httpapi/HttpApiSchema.ts +15 -15
  781. package/src/unstable/httpapi/OpenApi.ts +18 -18
  782. package/src/unstable/observability/OtlpResource.ts +5 -0
  783. package/src/unstable/observability/PrometheusMetrics.ts +4 -2
  784. package/src/unstable/reactivity/Atom.ts +3 -3
  785. package/src/unstable/rpc/RpcSchema.ts +2 -2
  786. package/src/unstable/rpc/RpcSerialization.ts +2 -2
  787. package/src/unstable/schema/Model.ts +5 -5
  788. package/src/unstable/schema/VariantSchema.ts +2 -2
  789. package/src/unstable/sql/SqlSchema.ts +4 -4
  790. package/src/unstable/workers/Transferable.ts +6 -6
  791. package/src/unstable/workflow/DurableDeferred.ts +7 -7
  792. package/src/unstable/workflow/DurableQueue.ts +1 -2
  793. package/src/unstable/workflow/Workflow.ts +159 -114
  794. package/src/unstable/workflow/WorkflowEngine.ts +16 -8
  795. package/src/unstable/workflow/WorkflowProxy.ts +9 -11
  796. package/src/unstable/workflow/WorkflowProxyServer.ts +7 -7
package/src/Schema.ts CHANGED
@@ -125,12 +125,12 @@ import * as Record_ from "./Record.ts"
125
125
  import * as Redacted_ from "./Redacted.ts"
126
126
  import * as Result_ from "./Result.ts"
127
127
  import * as Scheduler from "./Scheduler.ts"
128
- import * as AST from "./SchemaAST.ts"
129
- import * as Getter from "./SchemaGetter.ts"
130
- import * as Issue from "./SchemaIssue.ts"
131
- import * as Parser from "./SchemaParser.ts"
128
+ import * as SchemaAST from "./SchemaAST.ts"
129
+ import * as SchemaGetter from "./SchemaGetter.ts"
130
+ import * as SchemaIssue from "./SchemaIssue.ts"
131
+ import * as SchemaParser from "./SchemaParser.ts"
132
132
  import type * as SchemaRepresentation from "./SchemaRepresentation.ts"
133
- import * as Transformation from "./SchemaTransformation.ts"
133
+ import * as SchemaTransformation from "./SchemaTransformation.ts"
134
134
  import type { Assign, Lambda, Mutable, Simplify } from "./Struct.ts"
135
135
  import * as Struct_ from "./Struct.ts"
136
136
  import * as FastCheck from "./testing/FastCheck.ts"
@@ -189,7 +189,7 @@ export interface MakeOptions {
189
189
  /**
190
190
  * The parse options to use for the schema.
191
191
  */
192
- readonly parseOptions?: AST.ParseOptions | undefined
192
+ readonly parseOptions?: SchemaAST.ParseOptions | undefined
193
193
  /**
194
194
  * Whether to disable validation for the schema.
195
195
  */
@@ -220,7 +220,7 @@ export interface Bottom<
220
220
  out E,
221
221
  out RD,
222
222
  out RE,
223
- out Ast extends AST.AST,
223
+ out Ast extends SchemaAST.AST,
224
224
  out Rebuild extends Top,
225
225
  out TypeMakeIn = T,
226
226
  out Iso = T,
@@ -255,7 +255,7 @@ export interface Bottom<
255
255
 
256
256
  annotate(annotations: Annotations.Bottom<this["Type"], this["~type.parameters"]>): this["Rebuild"]
257
257
  annotateKey(annotations: Annotations.Key<this["Type"]>): this["Rebuild"]
258
- check(...checks: readonly [AST.Check<this["Type"]>, ...Array<AST.Check<this["Type"]>>]): this["Rebuild"]
258
+ check(...checks: readonly [SchemaAST.Check<this["Type"]>, ...Array<SchemaAST.Check<this["Type"]>>]): this["Rebuild"]
259
259
  rebuild(ast: this["ast"]): this["Rebuild"]
260
260
  /**
261
261
  * Constructs a value from the make input representation synchronously.
@@ -324,7 +324,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<T
324
324
  E,
325
325
  TypeParameters[number]["DecodingServices"],
326
326
  TypeParameters[number]["EncodingServices"],
327
- AST.Declaration,
327
+ SchemaAST.Declaration,
328
328
  declareConstructor<T, E, TypeParameters, Iso>,
329
329
  T,
330
330
  Iso,
@@ -337,6 +337,11 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<T
337
337
  * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas
338
338
  * and a decoder factory.
339
339
  *
340
+ * **When to use**
341
+ *
342
+ * Use when you are defining a schema for a generic container whose validation
343
+ * depends on one or more type-parameter schemas.
344
+ *
340
345
  * **Details**
341
346
  *
342
347
  * The outer call `declareConstructor<T, E, Iso>()` fixes the decoded type `T`,
@@ -366,7 +371,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<T
366
371
  * ([itemCodec]) =>
367
372
  * (u, ast, options) => {
368
373
  * if (!isBox(u)) {
369
- * return Effect.fail(new Issue.InvalidType(ast, Option.some(u)))
374
+ * return Effect.fail(new SchemaIssue.InvalidType(ast, Option.some(u)))
370
375
  * }
371
376
  * return Effect.map(
372
377
  * SchemaParser.decodeUnknownEffect(itemCodec)(u.value, options),
@@ -388,12 +393,16 @@ export function declareConstructor<T, E = T, Iso = T>() {
388
393
  typeParameters: {
389
394
  readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Type"], TypeParameters[K]["Encoded"]>
390
395
  }
391
- ) => (u: unknown, self: AST.Declaration, options: AST.ParseOptions) => Effect.Effect<T, Issue.Issue>,
396
+ ) => (
397
+ u: unknown,
398
+ self: SchemaAST.Declaration,
399
+ options: SchemaAST.ParseOptions
400
+ ) => Effect.Effect<T, SchemaIssue.Issue>,
392
401
  annotations?: Annotations.Declaration<T, TypeParameters>
393
402
  ): declareConstructor<T, E, TypeParameters, Iso> => {
394
403
  return make(
395
- new AST.Declaration(
396
- typeParameters.map(AST.getAST),
404
+ new SchemaAST.Declaration(
405
+ typeParameters.map(SchemaAST.getAST),
397
406
  (typeParameters) => run(typeParameters.map((ast) => make(ast)) as any),
398
407
  annotations
399
408
  )
@@ -416,10 +425,10 @@ export interface declare<T, Iso = T> extends declareConstructor<T, T, readonly [
416
425
  * function. The schema accepts any unknown value and succeeds when `is` returns
417
426
  * `true`, failing with an `InvalidType` issue otherwise.
418
427
  *
419
- * **Details**
428
+ * **When to use**
420
429
  *
421
- * Use this when the type has no type parameters. For parametric types such as
422
- * `Option<A>` or `Array<A>`, use {@link declareConstructor} instead.
430
+ * Use when you are defining a schema for an opaque type with no type parameters
431
+ * and validation can be expressed as a type guard.
423
432
  *
424
433
  * **Example** (Schema for a custom `UserId` branded type)
425
434
  *
@@ -451,7 +460,7 @@ export function declare<T, Iso = T>(
451
460
  () => (input, ast) =>
452
461
  is(input) ?
453
462
  Effect.succeed(input) :
454
- Effect.fail(new Issue.InvalidType(ast, Option_.some(input))),
463
+ Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input))),
455
464
  annotations
456
465
  )
457
466
  }
@@ -605,7 +614,7 @@ export function annotateEncoded<S extends Top>(annotations: Annotations.Bottom<S
605
614
  */
606
615
  export function annotateKey<S extends Top>(annotations: Annotations.Key<S["Type"]>) {
607
616
  return (self: S): S["Rebuild"] => {
608
- return self.rebuild(AST.annotateKey(self.ast, annotations))
617
+ return self.rebuild(SchemaAST.annotateKey(self.ast, annotations))
609
618
  }
610
619
  }
611
620
 
@@ -633,7 +642,7 @@ export interface Top extends
633
642
  unknown,
634
643
  unknown,
635
644
  unknown,
636
- AST.AST,
645
+ SchemaAST.AST,
637
646
  Top,
638
647
  unknown,
639
648
  unknown,
@@ -921,7 +930,7 @@ export {
921
930
  *
922
931
  * **Details**
923
932
  *
924
- * The `issue` field contains a structured {@link Issue.Issue} tree describing
933
+ * The `issue` field contains a structured {@link SchemaIssue.Issue} tree describing
925
934
  * every validation failure, including the path to the problematic value,
926
935
  * expected types, and actual values received. `message` renders the issue tree
927
936
  * as a human-readable string.
@@ -1045,17 +1054,17 @@ function makeStandardResult<A>(exit: Exit_.Exit<StandardSchemaV1.Result<A>>): St
1045
1054
  export function toStandardSchemaV1<S extends Decoder<unknown>>(
1046
1055
  self: S,
1047
1056
  options?: {
1048
- readonly leafHook?: Issue.LeafHook | undefined
1049
- readonly checkHook?: Issue.CheckHook | undefined
1050
- readonly parseOptions?: AST.ParseOptions | undefined
1057
+ readonly leafHook?: SchemaIssue.LeafHook | undefined
1058
+ readonly checkHook?: SchemaIssue.CheckHook | undefined
1059
+ readonly parseOptions?: SchemaAST.ParseOptions | undefined
1051
1060
  }
1052
1061
  ): StandardSchemaV1<S["Encoded"], S["Type"]> & S {
1053
- const decodeUnknownEffect = Parser.decodeUnknownEffect(self) as (
1062
+ const decodeUnknownEffect = SchemaParser.decodeUnknownEffect(self) as (
1054
1063
  input: unknown,
1055
- options?: AST.ParseOptions
1056
- ) => Effect.Effect<S["Type"], Issue.Issue>
1057
- const parseOptions: AST.ParseOptions = { errors: "all", ...options?.parseOptions }
1058
- const formatter = Issue.makeFormatterStandardSchemaV1(options)
1064
+ options?: SchemaAST.ParseOptions
1065
+ ) => Effect.Effect<S["Type"], SchemaIssue.Issue>
1066
+ const parseOptions: SchemaAST.ParseOptions = { errors: "all", ...options?.parseOptions }
1067
+ const formatter = SchemaIssue.makeFormatterStandardSchemaV1(options)
1059
1068
  const validate: StandardSchemaV1<S["Encoded"], S["Type"]>["~standard"]["validate"] = (value: unknown) => {
1060
1069
  const scheduler = new Scheduler.MixedScheduler()
1061
1070
  const fiber = Effect.runFork(
@@ -1177,7 +1186,7 @@ export function toStandardJSONSchemaV1<S extends Top>(self: S): StandardJSONSche
1177
1186
  * @category guards
1178
1187
  * @since 3.10.0
1179
1188
  */
1180
- export const is = Parser.is
1189
+ export const is = SchemaParser.is
1181
1190
 
1182
1191
  /**
1183
1192
  * Creates an assertion function that throws an error if the input doesn't match
@@ -1186,7 +1195,7 @@ export const is = Parser.is
1186
1195
  * **When to use**
1187
1196
  *
1188
1197
  * Use to validate unknown input at runtime while narrowing the value with a
1189
- * TypeScript `asserts` predicate.
1198
+ * TypeScript assertion signature.
1190
1199
  *
1191
1200
  * **Details**
1192
1201
  *
@@ -1216,7 +1225,7 @@ export const is = Parser.is
1216
1225
  * @category guards
1217
1226
  * @since 4.0.0
1218
1227
  */
1219
- export const asserts: <S extends Top, I>(schema: S, input: I) => asserts input is I & S["Type"] = Parser.asserts
1228
+ export const asserts: <S extends Top, I>(schema: S, input: I) => asserts input is I & S["Type"] = SchemaParser.asserts
1220
1229
 
1221
1230
  /**
1222
1231
  * Decodes an `unknown` input against a schema, returning an `Effect` that
@@ -1224,7 +1233,8 @@ export const asserts: <S extends Top, I>(schema: S, input: I) => asserts input i
1224
1233
  *
1225
1234
  * **When to use**
1226
1235
  *
1227
- * Use when decoding input whose type is not statically known.
1236
+ * Use when you need to decode unknown input in an `Effect` whose failure
1237
+ * channel is `SchemaError`.
1228
1238
  *
1229
1239
  * **Details**
1230
1240
  *
@@ -1233,12 +1243,17 @@ export const asserts: <S extends Top, I>(schema: S, input: I) => asserts input i
1233
1243
  * Options may be provided either when creating the decoder or when applying it;
1234
1244
  * application options override creation options.
1235
1245
  *
1246
+ * @see {@link SchemaParser.decodeUnknownEffect} for the adapter that fails with `SchemaIssue.Issue` directly
1247
+ *
1236
1248
  * @category decoding
1237
1249
  * @since 4.0.0
1238
1250
  */
1239
- export function decodeUnknownEffect<S extends Top>(schema: S, options?: AST.ParseOptions) {
1240
- const parser = Parser.decodeUnknownEffect(schema, options)
1241
- return (input: unknown, options?: AST.ParseOptions): Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]> => {
1251
+ export function decodeUnknownEffect<S extends Top>(schema: S, options?: SchemaAST.ParseOptions) {
1252
+ const parser = SchemaParser.decodeUnknownEffect(schema, options)
1253
+ return (
1254
+ input: unknown,
1255
+ options?: SchemaAST.ParseOptions
1256
+ ): Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]> => {
1242
1257
  return Effect.mapErrorEager(parser(input, options), (issue) => new SchemaError(issue))
1243
1258
  }
1244
1259
  }
@@ -1250,7 +1265,8 @@ export function decodeUnknownEffect<S extends Top>(schema: S, options?: AST.Pars
1250
1265
  *
1251
1266
  * **When to use**
1252
1267
  *
1253
- * Use when the input is already typed as the schema's `Encoded` type.
1268
+ * Use when you need to decode input already typed as the schema's `Encoded`
1269
+ * type in an `Effect` whose failure channel is `SchemaError`.
1254
1270
  *
1255
1271
  * **Details**
1256
1272
  *
@@ -1258,14 +1274,18 @@ export function decodeUnknownEffect<S extends Top>(schema: S, options?: AST.Pars
1258
1274
  * Options may be provided either when creating the decoder or when applying it;
1259
1275
  * application options override creation options.
1260
1276
  *
1277
+ * @see {@link SchemaParser.decodeEffect} for the adapter that fails with `SchemaIssue.Issue` directly
1278
+ *
1261
1279
  * @category decoding
1262
1280
  * @since 4.0.0
1263
1281
  */
1264
1282
  export const decodeEffect: <S extends Top>(
1265
1283
  schema: S,
1266
- options?: AST.ParseOptions
1267
- ) => (input: S["Encoded"], options?: AST.ParseOptions) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]> =
1268
- decodeUnknownEffect
1284
+ options?: SchemaAST.ParseOptions
1285
+ ) => (
1286
+ input: S["Encoded"],
1287
+ options?: SchemaAST.ParseOptions
1288
+ ) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]> = decodeUnknownEffect
1269
1289
 
1270
1290
  /**
1271
1291
  * Decodes an `unknown` input against a schema synchronously, returning an
@@ -1274,8 +1294,8 @@ export const decodeEffect: <S extends Top>(
1274
1294
  *
1275
1295
  * **When to use**
1276
1296
  *
1277
- * Use when the input type is not statically known and decoding should return an
1278
- * `Exit` instead of failing or throwing.
1297
+ * Use when you need to decode unknown input into an `Exit` whose failure
1298
+ * contains `SchemaError`.
1279
1299
  *
1280
1300
  * **Details**
1281
1301
  *
@@ -1285,12 +1305,14 @@ export const decodeEffect: <S extends Top>(
1285
1305
  * Options may be provided either when creating the decoder or when applying it;
1286
1306
  * application options override creation options.
1287
1307
  *
1308
+ * @see {@link SchemaParser.decodeUnknownExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
1309
+ *
1288
1310
  * @category decoding
1289
1311
  * @since 4.0.0
1290
1312
  */
1291
- export function decodeUnknownExit<S extends Decoder<unknown>>(schema: S, options?: AST.ParseOptions) {
1292
- const parser = Parser.decodeUnknownExit(schema, options)
1293
- return (input: unknown, options?: AST.ParseOptions): Exit_.Exit<S["Type"], SchemaError> => {
1313
+ export function decodeUnknownExit<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
1314
+ const parser = SchemaParser.decodeUnknownExit(schema, options)
1315
+ return (input: unknown, options?: SchemaAST.ParseOptions): Exit_.Exit<S["Type"], SchemaError> => {
1294
1316
  return Exit_.mapError(parser(input, options), (issue) => new SchemaError(issue))
1295
1317
  }
1296
1318
  }
@@ -1302,8 +1324,8 @@ export function decodeUnknownExit<S extends Decoder<unknown>>(schema: S, options
1302
1324
  *
1303
1325
  * **When to use**
1304
1326
  *
1305
- * Use when typed input should be decoded into an `Exit` instead of failing or
1306
- * throwing.
1327
+ * Use when you need to decode already typed `Encoded` input into an `Exit`
1328
+ * whose failure contains `SchemaError`.
1307
1329
  *
1308
1330
  * **Details**
1309
1331
  *
@@ -1312,13 +1334,15 @@ export function decodeUnknownExit<S extends Decoder<unknown>>(schema: S, options
1312
1334
  * Options may be provided either when creating the decoder or when applying it;
1313
1335
  * application options override creation options.
1314
1336
  *
1337
+ * @see {@link SchemaParser.decodeExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
1338
+ *
1315
1339
  * @category decoding
1316
1340
  * @since 4.0.0
1317
1341
  */
1318
1342
  export const decodeExit: <S extends Decoder<unknown>>(
1319
1343
  schema: S,
1320
- options?: AST.ParseOptions
1321
- ) => (input: S["Encoded"], options?: AST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError> = decodeUnknownExit
1344
+ options?: SchemaAST.ParseOptions
1345
+ ) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError> = decodeUnknownExit
1322
1346
 
1323
1347
  /**
1324
1348
  * Decodes an `unknown` input against a schema, returning an `Option` that is
@@ -1326,20 +1350,24 @@ export const decodeExit: <S extends Decoder<unknown>>(
1326
1350
  *
1327
1351
  * **When to use**
1328
1352
  *
1329
- * Use when the input type is not statically known and you only need to know
1353
+ * Use when you do not know the input type statically and only need to know
1330
1354
  * whether decoding succeeded.
1331
1355
  *
1332
1356
  * **Details**
1333
1357
  *
1334
1358
  * Prefer this over {@link decodeUnknownExit} or {@link decodeUnknownEffect}
1335
- * when you don't need error details. For typed input use {@link decodeOption}.
1359
+ * when you don't need error details. For input already typed as the schema's
1360
+ * `Encoded` type use {@link decodeOption}.
1336
1361
  * Options may be provided either when creating the decoder or when applying it;
1337
1362
  * application options override creation options.
1338
1363
  *
1339
1364
  * @category decoding
1340
1365
  * @since 3.10.0
1341
1366
  */
1342
- export const decodeUnknownOption = Parser.decodeUnknownOption
1367
+ export const decodeUnknownOption: <S extends Decoder<unknown>>(
1368
+ schema: S,
1369
+ options?: SchemaAST.ParseOptions
1370
+ ) => (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Type"]> = SchemaParser.decodeUnknownOption
1343
1371
 
1344
1372
  /**
1345
1373
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
@@ -1348,7 +1376,8 @@ export const decodeUnknownOption = Parser.decodeUnknownOption
1348
1376
  *
1349
1377
  * **When to use**
1350
1378
  *
1351
- * Use when typed input should be decoded and only success or failure matters.
1379
+ * Use when you already have input typed as the schema's `Encoded` type and
1380
+ * only need to know whether decoding succeeded.
1352
1381
  *
1353
1382
  * **Details**
1354
1383
  *
@@ -1359,37 +1388,48 @@ export const decodeUnknownOption = Parser.decodeUnknownOption
1359
1388
  * @category decoding
1360
1389
  * @since 3.10.0
1361
1390
  */
1362
- export const decodeOption = Parser.decodeOption
1391
+ export const decodeOption: <S extends Decoder<unknown>>(
1392
+ schema: S,
1393
+ options?: SchemaAST.ParseOptions
1394
+ ) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Type"]> = decodeUnknownOption
1363
1395
 
1364
1396
  /**
1365
1397
  * Decodes an `unknown` input against a schema, returning a `Result` that
1366
- * succeeds with the decoded value or fails with a schema issue.
1398
+ * succeeds with the decoded value or fails with a {@link SchemaError}.
1367
1399
  *
1368
1400
  * **When to use**
1369
1401
  *
1370
- * Use when the input type is not statically known and decoding should return a
1371
- * `Result` with structured issue data.
1402
+ * Use when you do not know the input type statically and want decoding to
1403
+ * return a `Result` with `SchemaError` failure data.
1372
1404
  *
1373
1405
  * **Details**
1374
1406
  *
1375
- * For typed input use {@link decodeResult}.
1407
+ * For input already typed as the schema's `Encoded` type use
1408
+ * {@link decodeResult}.
1376
1409
  * Options may be provided either when creating the decoder or when applying it;
1377
1410
  * application options override creation options.
1378
1411
  *
1412
+ * @see {@link SchemaParser.decodeUnknownResult} for the adapter that fails with `SchemaIssue.Issue` directly
1413
+ *
1379
1414
  * @category decoding
1380
1415
  * @since 4.0.0
1381
1416
  */
1382
- export const decodeUnknownResult = Parser.decodeUnknownResult
1417
+ export function decodeUnknownResult<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
1418
+ const parser = SchemaParser.decodeUnknownResult(schema, options)
1419
+ return (input: unknown, options?: SchemaAST.ParseOptions): Result_.Result<S["Type"], SchemaError> => {
1420
+ return Result_.mapError(parser(input, options), (issue) => new SchemaError(issue))
1421
+ }
1422
+ }
1383
1423
 
1384
1424
  /**
1385
1425
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
1386
1426
  * returning a `Result` that succeeds with the decoded value or fails with a
1387
- * schema issue.
1427
+ * {@link SchemaError}.
1388
1428
  *
1389
1429
  * **When to use**
1390
1430
  *
1391
- * Use when typed input should be decoded into a `Result` with structured issue
1392
- * data.
1431
+ * Use when you already have input typed as the schema's `Encoded` type and
1432
+ * want decoding to return a `Result` with `SchemaError` failure data.
1393
1433
  *
1394
1434
  * **Details**
1395
1435
  *
@@ -1397,38 +1437,55 @@ export const decodeUnknownResult = Parser.decodeUnknownResult
1397
1437
  * Options may be provided either when creating the decoder or when applying it;
1398
1438
  * application options override creation options.
1399
1439
  *
1440
+ * @see {@link SchemaParser.decodeResult} for the adapter that fails with `SchemaIssue.Issue` directly
1441
+ *
1400
1442
  * @category decoding
1401
1443
  * @since 4.0.0
1402
1444
  */
1403
- export const decodeResult = Parser.decodeResult
1445
+ export const decodeResult: <S extends Decoder<unknown>>(
1446
+ schema: S,
1447
+ options?: SchemaAST.ParseOptions
1448
+ ) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Result_.Result<S["Type"], SchemaError> =
1449
+ decodeUnknownResult
1404
1450
 
1405
1451
  /**
1406
1452
  * Decodes an `unknown` input against a schema, returning a `Promise` that
1407
- * resolves with the decoded value or rejects with a schema issue.
1453
+ * resolves with the decoded value or rejects with a {@link SchemaError}.
1408
1454
  *
1409
1455
  * **When to use**
1410
1456
  *
1411
- * Use when integrating unknown input validation with Promise-based APIs.
1457
+ * Use when you need decoding of unknown input to return a JavaScript `Promise`
1458
+ * that rejects with `SchemaError`.
1412
1459
  *
1413
1460
  * **Details**
1414
1461
  *
1415
- * For typed input use {@link decodePromise}.
1462
+ * For input already typed as the schema's `Encoded` type use
1463
+ * {@link decodePromise}.
1416
1464
  * Options may be provided either when creating the decoder or when applying it;
1417
1465
  * application options override creation options.
1418
1466
  *
1467
+ * @see {@link SchemaParser.decodeUnknownPromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1468
+ *
1419
1469
  * @category decoding
1420
1470
  * @since 3.10.0
1421
1471
  */
1422
- export const decodeUnknownPromise = Parser.decodeUnknownPromise
1472
+ export function decodeUnknownPromise<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
1473
+ const parser = decodeUnknownEffect(schema, options)
1474
+ return (input: unknown, options?: SchemaAST.ParseOptions): Promise<S["Type"]> => {
1475
+ return Effect.runPromise(parser(input, options))
1476
+ }
1477
+ }
1423
1478
 
1424
1479
  /**
1425
1480
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
1426
1481
  * returning a `Promise` that resolves with the decoded value or rejects with a
1427
- * schema issue.
1482
+ * {@link SchemaError}.
1428
1483
  *
1429
1484
  * **When to use**
1430
1485
  *
1431
- * Use when integrating typed input decoding with Promise-based APIs.
1486
+ * Use when you already have input typed as the schema's `Encoded` type and
1487
+ * need decoding to return a JavaScript `Promise` that rejects with
1488
+ * `SchemaError`.
1432
1489
  *
1433
1490
  * **Details**
1434
1491
  *
@@ -1436,23 +1493,28 @@ export const decodeUnknownPromise = Parser.decodeUnknownPromise
1436
1493
  * Options may be provided either when creating the decoder or when applying it;
1437
1494
  * application options override creation options.
1438
1495
  *
1496
+ * @see {@link SchemaParser.decodePromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1497
+ *
1439
1498
  * @category decoding
1440
1499
  * @since 3.10.0
1441
1500
  */
1442
- export const decodePromise = Parser.decodePromise
1501
+ export const decodePromise: <S extends Decoder<unknown>>(
1502
+ schema: S,
1503
+ options?: SchemaAST.ParseOptions
1504
+ ) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Promise<S["Type"]> = decodeUnknownPromise
1443
1505
 
1444
1506
  /**
1445
1507
  * Decodes an `unknown` input against a schema synchronously, returning the
1446
- * decoded value or throwing an `Error` whose cause contains the schema issue.
1508
+ * decoded value or throwing a {@link SchemaError}.
1447
1509
  *
1448
1510
  * **When to use**
1449
1511
  *
1450
- * Use when validating unknown data at a boundary and treating schema mismatches
1451
- * as exceptions.
1512
+ * Use when you need to validate unknown data at a synchronous boundary and want
1513
+ * schema mismatches to throw `SchemaError`.
1452
1514
  *
1453
1515
  * **Details**
1454
1516
  *
1455
- * For typed input use `decodeSync`.
1517
+ * For input already typed as the schema's `Encoded` type use `decodeSync`.
1456
1518
  * Only service-free schemas can be decoded synchronously. For non-throwing
1457
1519
  * alternatives see `decodeUnknownOption`, `decodeUnknownExit`, or
1458
1520
  * `decodeUnknownEffect`. Options may be provided either when creating the
@@ -1475,20 +1537,26 @@ export const decodePromise = Parser.decodePromise
1475
1537
  * // └─ Expected a numeric string, actual "not a number"
1476
1538
  * ```
1477
1539
  *
1540
+ * @see {@link SchemaParser.decodeUnknownSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
1541
+ *
1478
1542
  * @category decoding
1479
1543
  * @since 4.0.0
1480
1544
  */
1481
- export const decodeUnknownSync = Parser.decodeUnknownSync
1545
+ export function decodeUnknownSync<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
1546
+ const parser = decodeUnknownEffect(schema, options)
1547
+ return (input: unknown, options?: SchemaAST.ParseOptions): S["Type"] => {
1548
+ return Effect.runSync(parser(input, options) as Effect.Effect<S["Type"], SchemaError>)
1549
+ }
1550
+ }
1482
1551
 
1483
1552
  /**
1484
1553
  * Decodes a typed input (the schema's `Encoded` type) against a schema
1485
- * synchronously, returning the decoded value or throwing an `Error` whose cause
1486
- * contains the schema issue.
1554
+ * synchronously, returning the decoded value or throwing a {@link SchemaError}.
1487
1555
  *
1488
1556
  * **When to use**
1489
1557
  *
1490
- * Use when typed input should be decoded synchronously and schema mismatches
1491
- * should throw.
1558
+ * Use when you already have input typed as the schema's `Encoded` type and
1559
+ * want schema mismatches to throw `SchemaError` synchronously.
1492
1560
  *
1493
1561
  * **Details**
1494
1562
  *
@@ -1497,10 +1565,15 @@ export const decodeUnknownSync = Parser.decodeUnknownSync
1497
1565
  * provided either when creating the decoder or when applying it; application
1498
1566
  * options override creation options.
1499
1567
  *
1568
+ * @see {@link SchemaParser.decodeSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
1569
+ *
1500
1570
  * @category decoding
1501
1571
  * @since 4.0.0
1502
1572
  */
1503
- export const decodeSync = Parser.decodeSync
1573
+ export const decodeSync: <S extends Decoder<unknown>>(
1574
+ schema: S,
1575
+ options?: SchemaAST.ParseOptions
1576
+ ) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => S["Type"] = decodeUnknownSync
1504
1577
 
1505
1578
  /**
1506
1579
  * Encodes an `unknown` input against a schema, returning an `Effect` that
@@ -1508,11 +1581,12 @@ export const decodeSync = Parser.decodeSync
1508
1581
  *
1509
1582
  * **When to use**
1510
1583
  *
1511
- * Use when encoding input whose type is not statically known.
1584
+ * Use when you need to encode unknown input in an `Effect` whose failure
1585
+ * channel is `SchemaError`.
1512
1586
  *
1513
1587
  * **Details**
1514
1588
  *
1515
- * Prefer {@link encodeEffect} when the input is already typed as the schema's
1589
+ * Prefer {@link encodeEffect} when the value is already typed as the schema's
1516
1590
  * `Type`.
1517
1591
  * Options may be provided either when creating the encoder or when applying it;
1518
1592
  * application options override creation options.
@@ -1528,14 +1602,16 @@ export const decodeSync = Parser.decodeSync
1528
1602
  * // Output: "42"
1529
1603
  * ```
1530
1604
  *
1605
+ * @see {@link SchemaParser.encodeUnknownEffect} for the adapter that fails with `SchemaIssue.Issue` directly
1606
+ *
1531
1607
  * @category encoding
1532
1608
  * @since 4.0.0
1533
1609
  */
1534
- export function encodeUnknownEffect<S extends Top>(schema: S, options?: AST.ParseOptions) {
1535
- const parser = Parser.encodeUnknownEffect(schema, options)
1610
+ export function encodeUnknownEffect<S extends Top>(schema: S, options?: SchemaAST.ParseOptions) {
1611
+ const parser = SchemaParser.encodeUnknownEffect(schema, options)
1536
1612
  return (
1537
1613
  input: unknown,
1538
- options?: AST.ParseOptions
1614
+ options?: SchemaAST.ParseOptions
1539
1615
  ): Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]> => {
1540
1616
  return Effect.mapErrorEager(parser(input, options), (issue) => new SchemaError(issue))
1541
1617
  }
@@ -1548,7 +1624,8 @@ export function encodeUnknownEffect<S extends Top>(schema: S, options?: AST.Pars
1548
1624
  *
1549
1625
  * **When to use**
1550
1626
  *
1551
- * Use when the input is already typed as the schema's `Type`.
1627
+ * Use when you need to encode input already typed as the schema's `Type` in
1628
+ * an `Effect` whose failure channel is `SchemaError`.
1552
1629
  *
1553
1630
  * **Details**
1554
1631
  *
@@ -1556,14 +1633,18 @@ export function encodeUnknownEffect<S extends Top>(schema: S, options?: AST.Pars
1556
1633
  * Options may be provided either when creating the encoder or when applying it;
1557
1634
  * application options override creation options.
1558
1635
  *
1636
+ * @see {@link SchemaParser.encodeEffect} for the adapter that fails with `SchemaIssue.Issue` directly
1637
+ *
1559
1638
  * @category encoding
1560
1639
  * @since 4.0.0
1561
1640
  */
1562
1641
  export const encodeEffect: <S extends Top>(
1563
1642
  schema: S,
1564
- options?: AST.ParseOptions
1565
- ) => (input: S["Type"], options?: AST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]> =
1566
- encodeUnknownEffect
1643
+ options?: SchemaAST.ParseOptions
1644
+ ) => (
1645
+ input: S["Type"],
1646
+ options?: SchemaAST.ParseOptions
1647
+ ) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]> = encodeUnknownEffect
1567
1648
 
1568
1649
  /**
1569
1650
  * Encodes an `unknown` input against a schema synchronously, returning an
@@ -1572,22 +1653,24 @@ export const encodeEffect: <S extends Top>(
1572
1653
  *
1573
1654
  * **When to use**
1574
1655
  *
1575
- * Use when the input type is not statically known and encoding should return an
1576
- * `Exit` instead of failing or throwing.
1656
+ * Use when you need to encode unknown input into an `Exit` whose failure
1657
+ * contains `SchemaError`.
1577
1658
  *
1578
1659
  * **Details**
1579
1660
  *
1580
1661
  * Only usable with schemas that have no `EncodingServices` requirement. Prefer
1581
- * {@link encodeExit} when the input is already typed as the schema's `Type`.
1662
+ * {@link encodeExit} when the value is already typed as the schema's `Type`.
1582
1663
  * Options may be provided either when creating the encoder or when applying it;
1583
1664
  * application options override creation options.
1584
1665
  *
1666
+ * @see {@link SchemaParser.encodeUnknownExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
1667
+ *
1585
1668
  * @category encoding
1586
1669
  * @since 4.0.0
1587
1670
  */
1588
- export function encodeUnknownExit<S extends Encoder<unknown>>(schema: S, options?: AST.ParseOptions) {
1589
- const parser = Parser.encodeUnknownExit(schema, options)
1590
- return (input: unknown, options?: AST.ParseOptions): Exit_.Exit<S["Encoded"], SchemaError> => {
1671
+ export function encodeUnknownExit<S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
1672
+ const parser = SchemaParser.encodeUnknownExit(schema, options)
1673
+ return (input: unknown, options?: SchemaAST.ParseOptions): Exit_.Exit<S["Encoded"], SchemaError> => {
1591
1674
  return Exit_.mapError(parser(input, options), (issue) => new SchemaError(issue))
1592
1675
  }
1593
1676
  }
@@ -1599,8 +1682,8 @@ export function encodeUnknownExit<S extends Encoder<unknown>>(schema: S, options
1599
1682
  *
1600
1683
  * **When to use**
1601
1684
  *
1602
- * Use when typed input should be encoded into an `Exit` instead of failing or
1603
- * throwing.
1685
+ * Use when you need to encode already typed schema values into an `Exit` whose
1686
+ * failure contains `SchemaError`.
1604
1687
  *
1605
1688
  * **Details**
1606
1689
  *
@@ -1609,13 +1692,15 @@ export function encodeUnknownExit<S extends Encoder<unknown>>(schema: S, options
1609
1692
  * Options may be provided either when creating the encoder or when applying it;
1610
1693
  * application options override creation options.
1611
1694
  *
1695
+ * @see {@link SchemaParser.encodeExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
1696
+ *
1612
1697
  * @category encoding
1613
1698
  * @since 4.0.0
1614
1699
  */
1615
1700
  export const encodeExit: <S extends Encoder<unknown>>(
1616
1701
  schema: S,
1617
- options?: AST.ParseOptions
1618
- ) => (input: S["Type"], options?: AST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError> = encodeUnknownExit
1702
+ options?: SchemaAST.ParseOptions
1703
+ ) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError> = encodeUnknownExit
1619
1704
 
1620
1705
  /**
1621
1706
  * Encodes an `unknown` input against a schema, returning an `Option` that is
@@ -1623,20 +1708,25 @@ export const encodeExit: <S extends Encoder<unknown>>(
1623
1708
  *
1624
1709
  * **When to use**
1625
1710
  *
1626
- * Use when the input type is not statically known and you only need to know
1711
+ * Use when you do not know the input type statically and only need to know
1627
1712
  * whether encoding succeeded.
1628
1713
  *
1629
1714
  * **Details**
1630
1715
  *
1631
1716
  * Prefer this over {@link encodeUnknownExit} or {@link encodeUnknownEffect}
1632
- * when you don't need error details. For typed input use {@link encodeOption}.
1717
+ * when you don't need error details. For values already typed as the schema's
1718
+ * `Type` use {@link encodeOption}.
1633
1719
  * Options may be provided either when creating the encoder or when applying it;
1634
1720
  * application options override creation options.
1635
1721
  *
1636
1722
  * @category encoding
1637
1723
  * @since 3.10.0
1638
1724
  */
1639
- export const encodeUnknownOption = Parser.encodeUnknownOption
1725
+ export const encodeUnknownOption: <S extends Encoder<unknown>>(
1726
+ schema: S,
1727
+ options?: SchemaAST.ParseOptions
1728
+ ) => (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]> =
1729
+ SchemaParser.encodeUnknownOption
1640
1730
 
1641
1731
  /**
1642
1732
  * Encodes a typed input (the schema's `Type`) against a schema, returning an
@@ -1645,7 +1735,8 @@ export const encodeUnknownOption = Parser.encodeUnknownOption
1645
1735
  *
1646
1736
  * **When to use**
1647
1737
  *
1648
- * Use when typed input should be encoded and only success or failure matters.
1738
+ * Use when you already have a value typed as the schema's `Type` and only need
1739
+ * to know whether encoding succeeded.
1649
1740
  *
1650
1741
  * **Details**
1651
1742
  *
@@ -1656,36 +1747,47 @@ export const encodeUnknownOption = Parser.encodeUnknownOption
1656
1747
  * @category encoding
1657
1748
  * @since 3.10.0
1658
1749
  */
1659
- export const encodeOption = Parser.encodeOption
1750
+ export const encodeOption: <S extends Encoder<unknown>>(
1751
+ schema: S,
1752
+ options?: SchemaAST.ParseOptions
1753
+ ) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]> = encodeUnknownOption
1660
1754
 
1661
1755
  /**
1662
1756
  * Encodes an `unknown` input against a schema, returning a `Result` that
1663
- * succeeds with the encoded value or fails with a schema issue.
1757
+ * succeeds with the encoded value or fails with a {@link SchemaError}.
1664
1758
  *
1665
1759
  * **When to use**
1666
1760
  *
1667
- * Use when the input type is not statically known and encoding should return a
1668
- * `Result` with structured issue data.
1761
+ * Use when you do not know the input type statically and want encoding to
1762
+ * return a `Result` with `SchemaError` failure data.
1669
1763
  *
1670
1764
  * **Details**
1671
1765
  *
1672
- * For typed input use {@link encodeResult}.
1766
+ * For values already typed as the schema's `Type` use {@link encodeResult}.
1673
1767
  * Options may be provided either when creating the encoder or when applying it;
1674
1768
  * application options override creation options.
1675
1769
  *
1770
+ * @see {@link SchemaParser.encodeUnknownResult} for the adapter that fails with `SchemaIssue.Issue` directly
1771
+ *
1676
1772
  * @category encoding
1677
1773
  * @since 4.0.0
1678
1774
  */
1679
- export const encodeUnknownResult = Parser.encodeUnknownResult
1775
+ export function encodeUnknownResult<S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
1776
+ const parser = SchemaParser.encodeUnknownResult(schema, options)
1777
+ return (input: unknown, options?: SchemaAST.ParseOptions): Result_.Result<S["Encoded"], SchemaError> => {
1778
+ return Result_.mapError(parser(input, options), (issue) => new SchemaError(issue))
1779
+ }
1780
+ }
1680
1781
 
1681
1782
  /**
1682
1783
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
1683
- * `Result` that succeeds with the encoded value or fails with a schema issue.
1784
+ * `Result` that succeeds with the encoded value or fails with a
1785
+ * {@link SchemaError}.
1684
1786
  *
1685
1787
  * **When to use**
1686
1788
  *
1687
- * Use when typed input should be encoded into a `Result` with structured issue
1688
- * data.
1789
+ * Use when you already have a value typed as the schema's `Type` and want
1790
+ * encoding to return a `Result` with `SchemaError` failure data.
1689
1791
  *
1690
1792
  * **Details**
1691
1793
  *
@@ -1693,29 +1795,43 @@ export const encodeUnknownResult = Parser.encodeUnknownResult
1693
1795
  * Options may be provided either when creating the encoder or when applying it;
1694
1796
  * application options override creation options.
1695
1797
  *
1798
+ * @see {@link SchemaParser.encodeResult} for the adapter that fails with `SchemaIssue.Issue` directly
1799
+ *
1696
1800
  * @category encoding
1697
1801
  * @since 4.0.0
1698
1802
  */
1699
- export const encodeResult = Parser.encodeResult
1803
+ export const encodeResult: <S extends Encoder<unknown>>(
1804
+ schema: S,
1805
+ options?: SchemaAST.ParseOptions
1806
+ ) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Result_.Result<S["Encoded"], SchemaError> =
1807
+ encodeUnknownResult
1700
1808
 
1701
1809
  /**
1702
1810
  * Encodes an `unknown` input against a schema, returning a `Promise` that
1703
- * resolves with the encoded value or rejects with a schema issue.
1811
+ * resolves with the encoded value or rejects with a {@link SchemaError}.
1704
1812
  *
1705
1813
  * **When to use**
1706
1814
  *
1707
- * Use when integrating unknown input serialization with Promise-based APIs.
1815
+ * Use when you need encoding of unknown input to return a JavaScript `Promise`
1816
+ * that rejects with `SchemaError`.
1708
1817
  *
1709
1818
  * **Details**
1710
1819
  *
1711
- * For typed input use {@link encodePromise}.
1820
+ * For values already typed as the schema's `Type` use {@link encodePromise}.
1712
1821
  * Options may be provided either when creating the encoder or when applying it;
1713
1822
  * application options override creation options.
1714
1823
  *
1824
+ * @see {@link SchemaParser.encodeUnknownPromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1825
+ *
1715
1826
  * @category encoding
1716
1827
  * @since 3.10.0
1717
1828
  */
1718
- export const encodeUnknownPromise = Parser.encodeUnknownPromise
1829
+ export function encodeUnknownPromise<S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
1830
+ const parser = encodeUnknownEffect(schema, options)
1831
+ return (input: unknown, options?: SchemaAST.ParseOptions): Promise<S["Encoded"]> => {
1832
+ return Effect.runPromise(parser(input, options))
1833
+ }
1834
+ }
1719
1835
 
1720
1836
  /**
1721
1837
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
@@ -1724,7 +1840,8 @@ export const encodeUnknownPromise = Parser.encodeUnknownPromise
1724
1840
  *
1725
1841
  * **When to use**
1726
1842
  *
1727
- * Use when integrating typed input serialization with Promise-based APIs.
1843
+ * Use when you already have a value typed as the schema's `Type` and need
1844
+ * encoding to return a JavaScript `Promise` that rejects with `SchemaError`.
1728
1845
  *
1729
1846
  * **Details**
1730
1847
  *
@@ -1732,10 +1849,15 @@ export const encodeUnknownPromise = Parser.encodeUnknownPromise
1732
1849
  * Options may be provided either when creating the encoder or when applying it;
1733
1850
  * application options override creation options.
1734
1851
  *
1852
+ * @see {@link SchemaParser.encodePromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1853
+ *
1735
1854
  * @category encoding
1736
1855
  * @since 3.10.0
1737
1856
  */
1738
- export const encodePromise = Parser.encodePromise
1857
+ export const encodePromise: <S extends Encoder<unknown>>(
1858
+ schema: S,
1859
+ options?: SchemaAST.ParseOptions
1860
+ ) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]> = encodeUnknownPromise
1739
1861
 
1740
1862
  /**
1741
1863
  * Encodes an `unknown` input against a schema synchronously, throwing a
@@ -1743,21 +1865,28 @@ export const encodePromise = Parser.encodePromise
1743
1865
  *
1744
1866
  * **When to use**
1745
1867
  *
1746
- * Use when serializing unknown data at a boundary and treating schema
1747
- * mismatches as unrecoverable errors.
1868
+ * Use when you need to serialize unknown data at a synchronous boundary and
1869
+ * want schema mismatches to throw `SchemaError`.
1748
1870
  *
1749
1871
  * **Details**
1750
1872
  *
1751
1873
  * For non-throwing alternatives see {@link encodeUnknownOption},
1752
- * {@link encodeUnknownExit}, or {@link encodeUnknownEffect}. For typed input
1753
- * use {@link encodeSync}.
1874
+ * {@link encodeUnknownExit}, or {@link encodeUnknownEffect}. For values
1875
+ * already typed as the schema's `Type` use {@link encodeSync}.
1754
1876
  * Options may be provided either when creating the encoder or when applying it;
1755
1877
  * application options override creation options.
1756
1878
  *
1879
+ * @see {@link SchemaParser.encodeUnknownSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
1880
+ *
1757
1881
  * @category encoding
1758
1882
  * @since 4.0.0
1759
1883
  */
1760
- export const encodeUnknownSync = Parser.encodeUnknownSync
1884
+ export function encodeUnknownSync<S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) {
1885
+ const parser = encodeUnknownEffect(schema, options)
1886
+ return (input: unknown, options?: SchemaAST.ParseOptions): S["Encoded"] => {
1887
+ return Effect.runSync(parser(input, options) as Effect.Effect<S["Encoded"], SchemaError>)
1888
+ }
1889
+ }
1761
1890
 
1762
1891
  /**
1763
1892
  * Encodes a typed input (the schema's `Type`) against a schema synchronously,
@@ -1765,8 +1894,8 @@ export const encodeUnknownSync = Parser.encodeUnknownSync
1765
1894
  *
1766
1895
  * **When to use**
1767
1896
  *
1768
- * Use when typed input should be encoded synchronously and schema mismatches
1769
- * should throw.
1897
+ * Use when you already have a value typed as the schema's `Type` and want
1898
+ * schema mismatches to throw `SchemaError` synchronously.
1770
1899
  *
1771
1900
  * **Details**
1772
1901
  *
@@ -1774,10 +1903,15 @@ export const encodeUnknownSync = Parser.encodeUnknownSync
1774
1903
  * Options may be provided either when creating the encoder or when applying it;
1775
1904
  * application options override creation options.
1776
1905
  *
1906
+ * @see {@link SchemaParser.encodeSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
1907
+ *
1777
1908
  * @category encoding
1778
1909
  * @since 4.0.0
1779
1910
  */
1780
- export const encodeSync = Parser.encodeSync
1911
+ export const encodeSync: <S extends Encoder<unknown>>(
1912
+ schema: S,
1913
+ options?: SchemaAST.ParseOptions
1914
+ ) => (input: S["Type"], options?: SchemaAST.ParseOptions) => S["Encoded"] = encodeUnknownSync
1781
1915
 
1782
1916
  /**
1783
1917
  * Creates a schema from an AST (Abstract Syntax Tree) node.
@@ -1890,7 +2024,9 @@ interface optionalKeyLambda extends Lambda {
1890
2024
  * @category combinators
1891
2025
  * @since 4.0.0
1892
2026
  */
1893
- export const optionalKey = Struct_.lambda<optionalKeyLambda>((schema) => make(AST.optionalKey(schema.ast), { schema }))
2027
+ export const optionalKey = Struct_.lambda<optionalKeyLambda>((schema) =>
2028
+ make(SchemaAST.optionalKey(schema.ast), { schema })
2029
+ )
1894
2030
 
1895
2031
  interface requiredKeyLambda extends Lambda {
1896
2032
  <S extends Top>(self: optionalKey<S>): S
@@ -2020,7 +2156,9 @@ interface mutableKeyLambda extends Lambda {
2020
2156
  * @category combinators
2021
2157
  * @since 4.0.0
2022
2158
  */
2023
- export const mutableKey = Struct_.lambda<mutableKeyLambda>((schema) => make(AST.mutableKey(schema.ast), { schema }))
2159
+ export const mutableKey = Struct_.lambda<mutableKeyLambda>((schema) =>
2160
+ make(SchemaAST.mutableKey(schema.ast), { schema })
2161
+ )
2024
2162
 
2025
2163
  interface readonlyKeyLambda extends Lambda {
2026
2164
  <S extends Top>(self: mutableKey<S>): S
@@ -2079,7 +2217,7 @@ interface toTypeLambda extends Lambda {
2079
2217
  * @category transforming
2080
2218
  * @since 4.0.0
2081
2219
  */
2082
- export const toType = Struct_.lambda<toTypeLambda>((schema) => make(AST.toType(schema.ast), { schema }))
2220
+ export const toType = Struct_.lambda<toTypeLambda>((schema) => make(SchemaAST.toType(schema.ast), { schema }))
2083
2221
 
2084
2222
  /**
2085
2223
  * Type-level representation returned by {@link toEncoded}.
@@ -2093,7 +2231,7 @@ export interface toEncoded<S extends Top> extends
2093
2231
  S["Encoded"],
2094
2232
  never,
2095
2233
  never,
2096
- AST.AST,
2234
+ SchemaAST.AST,
2097
2235
  toEncoded<S>,
2098
2236
  S["Encoded"],
2099
2237
  S["Encoded"],
@@ -2119,7 +2257,7 @@ interface toEncodedLambda extends Lambda {
2119
2257
  * @category transforming
2120
2258
  * @since 4.0.0
2121
2259
  */
2122
- export const toEncoded = Struct_.lambda<toEncodedLambda>((schema) => make(AST.toEncoded(schema.ast), { schema }))
2260
+ export const toEncoded = Struct_.lambda<toEncodedLambda>((schema) => make(SchemaAST.toEncoded(schema.ast), { schema }))
2123
2261
 
2124
2262
  const FlipTypeId = "~effect/Schema/flip"
2125
2263
 
@@ -2135,7 +2273,7 @@ export interface flip<S extends Top> extends
2135
2273
  S["Type"],
2136
2274
  S["EncodingServices"],
2137
2275
  S["DecodingServices"],
2138
- AST.AST,
2276
+ SchemaAST.AST,
2139
2277
  flip<S>,
2140
2278
  S["Encoded"],
2141
2279
  S["Encoded"],
@@ -2183,9 +2321,9 @@ function isFlip$(schema: Top): schema is flip<any> {
2183
2321
  export function flip<S extends Top>(schema: S): S extends flip<infer F> ? F["Rebuild"] : flip<S>
2184
2322
  export function flip<S extends Top>(schema: S): flip<S> {
2185
2323
  if (isFlip$(schema)) {
2186
- return schema.schema.rebuild(AST.flip(schema.ast))
2324
+ return schema.schema.rebuild(SchemaAST.flip(schema.ast))
2187
2325
  }
2188
- return make(AST.flip(schema.ast), { [FlipTypeId]: FlipTypeId, schema })
2326
+ return make(SchemaAST.flip(schema.ast), { [FlipTypeId]: FlipTypeId, schema })
2189
2327
  }
2190
2328
 
2191
2329
  /**
@@ -2194,9 +2332,11 @@ export function flip<S extends Top>(schema: S): flip<S> {
2194
2332
  * @category models
2195
2333
  * @since 3.10.0
2196
2334
  */
2197
- export interface Literal<L extends AST.LiteralValue> extends Bottom<L, L, never, never, AST.Literal, Literal<L>> {
2335
+ export interface Literal<L extends SchemaAST.LiteralValue>
2336
+ extends Bottom<L, L, never, never, SchemaAST.Literal, Literal<L>>
2337
+ {
2198
2338
  readonly literal: L
2199
- transform<L2 extends AST.LiteralValue>(to: L2): decodeTo<Literal<L2>, Literal<L>>
2339
+ transform<L2 extends SchemaAST.LiteralValue>(to: L2): decodeTo<Literal<L2>, Literal<L>>
2200
2340
  }
2201
2341
 
2202
2342
  /**
@@ -2217,13 +2357,13 @@ export interface Literal<L extends AST.LiteralValue> extends Bottom<L, L, never,
2217
2357
  * @category constructors
2218
2358
  * @since 3.10.0
2219
2359
  */
2220
- export function Literal<L extends AST.LiteralValue>(literal: L): Literal<L> {
2221
- const out = make<Literal<L>>(new AST.Literal(literal), {
2360
+ export function Literal<L extends SchemaAST.LiteralValue>(literal: L): Literal<L> {
2361
+ const out = make<Literal<L>>(new SchemaAST.Literal(literal), {
2222
2362
  literal,
2223
- transform<L2 extends AST.LiteralValue>(to: L2): decodeTo<Literal<L2>, Literal<L>> {
2363
+ transform<L2 extends SchemaAST.LiteralValue>(to: L2): decodeTo<Literal<L2>, Literal<L>> {
2224
2364
  return out.pipe(decodeTo(Literal(to), {
2225
- decode: Getter.transform(() => to),
2226
- encode: Getter.transform(() => literal)
2365
+ decode: SchemaGetter.transform(() => to),
2366
+ encode: SchemaGetter.transform(() => literal)
2227
2367
  }))
2228
2368
  }
2229
2369
  })
@@ -2306,7 +2446,7 @@ export interface TemplateLiteral<Parts extends TemplateLiteral.Parts> extends
2306
2446
  TemplateLiteral.Encoded<Parts>,
2307
2447
  never,
2308
2448
  never,
2309
- AST.TemplateLiteral,
2449
+ SchemaAST.TemplateLiteral,
2310
2450
  TemplateLiteral<Parts>
2311
2451
  >
2312
2452
  {
@@ -2314,13 +2454,18 @@ export interface TemplateLiteral<Parts extends TemplateLiteral.Parts> extends
2314
2454
  }
2315
2455
 
2316
2456
  function templateLiteralFromParts<Parts extends TemplateLiteral.Parts>(parts: Parts) {
2317
- return new AST.TemplateLiteral(parts.map((part) => isSchema(part) ? part.ast : new AST.Literal(part)))
2457
+ return new SchemaAST.TemplateLiteral(parts.map((part) => isSchema(part) ? part.ast : new SchemaAST.Literal(part)))
2318
2458
  }
2319
2459
 
2320
2460
  /**
2321
2461
  * Creates a schema that validates strings matching a template literal pattern. Each part can be
2322
2462
  * a literal string/number/bigint or a schema whose encoded type is a string, number, or bigint.
2323
2463
  *
2464
+ * **When to use**
2465
+ *
2466
+ * Use when the decoded value should remain the matched string and you do not
2467
+ * need the individual template parts parsed into a tuple.
2468
+ *
2324
2469
  * **Example** (URL path pattern)
2325
2470
  *
2326
2471
  * ```ts
@@ -2376,7 +2521,7 @@ export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> exte
2376
2521
  TemplateLiteral.Encoded<Parts>,
2377
2522
  never,
2378
2523
  never,
2379
- AST.Arrays,
2524
+ SchemaAST.Arrays,
2380
2525
  TemplateLiteralParser<Parts>
2381
2526
  >
2382
2527
  {
@@ -2422,7 +2567,7 @@ export function TemplateLiteralParser<const Parts extends TemplateLiteral.Parts>
2422
2567
  * @since 4.0.0
2423
2568
  */
2424
2569
  export interface Enum<A extends { [x: string]: string | number }>
2425
- extends Bottom<A[keyof A], A[keyof A], never, never, AST.Enum, Enum<A>>
2570
+ extends Bottom<A[keyof A], A[keyof A], never, never, SchemaAST.Enum, Enum<A>>
2426
2571
  {
2427
2572
  readonly enums: A
2428
2573
  }
@@ -2449,7 +2594,7 @@ export interface Enum<A extends { [x: string]: string | number }>
2449
2594
  */
2450
2595
  export function Enum<A extends { [x: string]: string | number }>(enums: A): Enum<A> {
2451
2596
  return make(
2452
- new AST.Enum(
2597
+ new SchemaAST.Enum(
2453
2598
  Object.keys(enums).filter(
2454
2599
  (key) => typeof enums[enums[key]] !== "number"
2455
2600
  ).map((key) => [key, enums[key]])
@@ -2464,7 +2609,7 @@ export function Enum<A extends { [x: string]: string | number }>(enums: A): Enum
2464
2609
  * @category models
2465
2610
  * @since 3.10.0
2466
2611
  */
2467
- export interface Never extends Bottom<never, never, never, never, AST.Never, Never> {}
2612
+ export interface Never extends Bottom<never, never, never, never, SchemaAST.Never, Never> {}
2468
2613
 
2469
2614
  /**
2470
2615
  * Schema for the `never` type. Always fails validation — no value satisfies it.
@@ -2472,7 +2617,7 @@ export interface Never extends Bottom<never, never, never, never, AST.Never, Nev
2472
2617
  * @category schemas
2473
2618
  * @since 3.10.0
2474
2619
  */
2475
- export const Never: Never = make(AST.never)
2620
+ export const Never: Never = make(SchemaAST.never)
2476
2621
 
2477
2622
  /**
2478
2623
  * Type-level representation of {@link Any}.
@@ -2480,7 +2625,7 @@ export const Never: Never = make(AST.never)
2480
2625
  * @category models
2481
2626
  * @since 3.10.0
2482
2627
  */
2483
- export interface Any extends Bottom<any, any, never, never, AST.Any, Any> {}
2628
+ export interface Any extends Bottom<any, any, never, never, SchemaAST.Any, Any> {}
2484
2629
 
2485
2630
  /**
2486
2631
  * Schema for the `any` type. Accepts any value without validation.
@@ -2489,7 +2634,7 @@ export interface Any extends Bottom<any, any, never, never, AST.Any, Any> {}
2489
2634
  * @category schemas
2490
2635
  * @since 3.10.0
2491
2636
  */
2492
- export const Any: Any = make(AST.any)
2637
+ export const Any: Any = make(SchemaAST.any)
2493
2638
 
2494
2639
  /**
2495
2640
  * Type-level representation of {@link Unknown}.
@@ -2497,16 +2642,21 @@ export const Any: Any = make(AST.any)
2497
2642
  * @category models
2498
2643
  * @since 3.10.0
2499
2644
  */
2500
- export interface Unknown extends Bottom<unknown, unknown, never, never, AST.Unknown, Unknown> {}
2645
+ export interface Unknown extends Bottom<unknown, unknown, never, never, SchemaAST.Unknown, Unknown> {}
2501
2646
 
2502
2647
  /**
2503
2648
  * Schema for the `unknown` type. Accepts any value without validation.
2504
2649
  *
2650
+ * **When to use**
2651
+ *
2652
+ * Use as a top schema when you need to accept any input while preserving
2653
+ * TypeScript's `unknown` safety at use sites.
2654
+ *
2505
2655
  * @see {@link Any} for the `any` variant.
2506
2656
  * @category schemas
2507
2657
  * @since 3.10.0
2508
2658
  */
2509
- export const Unknown: Unknown = make(AST.unknown)
2659
+ export const Unknown: Unknown = make(SchemaAST.unknown)
2510
2660
 
2511
2661
  /**
2512
2662
  * Type-level representation of {@link Null}.
@@ -2514,7 +2664,7 @@ export const Unknown: Unknown = make(AST.unknown)
2514
2664
  * @category models
2515
2665
  * @since 3.10.0
2516
2666
  */
2517
- export interface Null extends Bottom<null, null, never, never, AST.Null, Null> {}
2667
+ export interface Null extends Bottom<null, null, never, never, SchemaAST.Null, Null> {}
2518
2668
 
2519
2669
  /**
2520
2670
  * Schema for the `null` literal. Validates that the input is strictly `null`.
@@ -2523,7 +2673,7 @@ export interface Null extends Bottom<null, null, never, never, AST.Null, Null> {
2523
2673
  * @category schemas
2524
2674
  * @since 3.10.0
2525
2675
  */
2526
- export const Null: Null = make(AST.null)
2676
+ export const Null: Null = make(SchemaAST.null)
2527
2677
 
2528
2678
  /**
2529
2679
  * Type-level representation of {@link Undefined}.
@@ -2531,7 +2681,7 @@ export const Null: Null = make(AST.null)
2531
2681
  * @category models
2532
2682
  * @since 3.10.0
2533
2683
  */
2534
- export interface Undefined extends Bottom<undefined, undefined, never, never, AST.Undefined, Undefined> {}
2684
+ export interface Undefined extends Bottom<undefined, undefined, never, never, SchemaAST.Undefined, Undefined> {}
2535
2685
 
2536
2686
  /**
2537
2687
  * Schema for the `undefined` literal. Validates that the input is strictly `undefined`.
@@ -2540,7 +2690,7 @@ export interface Undefined extends Bottom<undefined, undefined, never, never, AS
2540
2690
  * @category schemas
2541
2691
  * @since 3.10.0
2542
2692
  */
2543
- export const Undefined: Undefined = make(AST.undefined)
2693
+ export const Undefined: Undefined = make(SchemaAST.undefined)
2544
2694
 
2545
2695
  /**
2546
2696
  * Type-level representation of {@link String}.
@@ -2548,7 +2698,7 @@ export const Undefined: Undefined = make(AST.undefined)
2548
2698
  * @category models
2549
2699
  * @since 4.0.0
2550
2700
  */
2551
- export interface String extends Bottom<string, string, never, never, AST.String, String> {}
2701
+ export interface String extends Bottom<string, string, never, never, SchemaAST.String, String> {}
2552
2702
 
2553
2703
  /**
2554
2704
  * Schema for `string` values. Validates that the input is `typeof` `"string"`.
@@ -2556,7 +2706,7 @@ export interface String extends Bottom<string, string, never, never, AST.String,
2556
2706
  * @category schemas
2557
2707
  * @since 4.0.0
2558
2708
  */
2559
- export const String: String = make(AST.string)
2709
+ export const String: String = make(SchemaAST.string)
2560
2710
 
2561
2711
  /**
2562
2712
  * Type-level representation of {@link Number}.
@@ -2564,7 +2714,7 @@ export const String: String = make(AST.string)
2564
2714
  * @category models
2565
2715
  * @since 4.0.0
2566
2716
  */
2567
- export interface Number extends Bottom<number, number, never, never, AST.Number, Number> {}
2717
+ export interface Number extends Bottom<number, number, never, never, SchemaAST.Number, Number> {}
2568
2718
 
2569
2719
  /**
2570
2720
  * Schema for `number` values, including `NaN`, `Infinity`, and `-Infinity`.
@@ -2580,7 +2730,7 @@ export interface Number extends Bottom<number, number, never, never, AST.Number,
2580
2730
  * @category schemas
2581
2731
  * @since 4.0.0
2582
2732
  */
2583
- export const Number: Number = make(AST.number)
2733
+ export const Number: Number = make(SchemaAST.number)
2584
2734
 
2585
2735
  /**
2586
2736
  * Type-level representation of {@link Boolean}.
@@ -2588,7 +2738,7 @@ export const Number: Number = make(AST.number)
2588
2738
  * @category models
2589
2739
  * @since 4.0.0
2590
2740
  */
2591
- export interface Boolean extends Bottom<boolean, boolean, never, never, AST.Boolean, Boolean> {}
2741
+ export interface Boolean extends Bottom<boolean, boolean, never, never, SchemaAST.Boolean, Boolean> {}
2592
2742
 
2593
2743
  /**
2594
2744
  * Schema for `boolean` values. Validates that the input is `typeof` `"boolean"`.
@@ -2602,7 +2752,7 @@ export interface Boolean extends Bottom<boolean, boolean, never, never, AST.Bool
2602
2752
  * @category boolean
2603
2753
  * @since 4.0.0
2604
2754
  */
2605
- export const Boolean: Boolean = make(AST.boolean)
2755
+ export const Boolean: Boolean = make(SchemaAST.boolean)
2606
2756
 
2607
2757
  /**
2608
2758
  * Type-level representation of {@link Symbol}.
@@ -2610,7 +2760,7 @@ export const Boolean: Boolean = make(AST.boolean)
2610
2760
  * @category models
2611
2761
  * @since 4.0.0
2612
2762
  */
2613
- export interface Symbol extends Bottom<symbol, symbol, never, never, AST.Symbol, Symbol> {}
2763
+ export interface Symbol extends Bottom<symbol, symbol, never, never, SchemaAST.Symbol, Symbol> {}
2614
2764
 
2615
2765
  /**
2616
2766
  * Schema for `symbol` values. Validates that the input is `typeof` `"symbol"`.
@@ -2619,7 +2769,7 @@ export interface Symbol extends Bottom<symbol, symbol, never, never, AST.Symbol,
2619
2769
  * @category schemas
2620
2770
  * @since 4.0.0
2621
2771
  */
2622
- export const Symbol: Symbol = make(AST.symbol)
2772
+ export const Symbol: Symbol = make(SchemaAST.symbol)
2623
2773
 
2624
2774
  /**
2625
2775
  * Type-level representation of {@link BigInt}.
@@ -2627,7 +2777,7 @@ export const Symbol: Symbol = make(AST.symbol)
2627
2777
  * @category models
2628
2778
  * @since 4.0.0
2629
2779
  */
2630
- export interface BigInt extends Bottom<bigint, bigint, never, never, AST.BigInt, BigInt> {}
2780
+ export interface BigInt extends Bottom<bigint, bigint, never, never, SchemaAST.BigInt, BigInt> {}
2631
2781
 
2632
2782
  /**
2633
2783
  * Schema for `bigint` values. Validates that the input is `typeof` `"bigint"`.
@@ -2642,7 +2792,7 @@ export interface BigInt extends Bottom<bigint, bigint, never, never, AST.BigInt,
2642
2792
  * @category schemas
2643
2793
  * @since 4.0.0
2644
2794
  */
2645
- export const BigInt: BigInt = make(AST.bigInt)
2795
+ export const BigInt: BigInt = make(SchemaAST.bigInt)
2646
2796
 
2647
2797
  /**
2648
2798
  * Type-level representation of {@link Void}.
@@ -2650,7 +2800,7 @@ export const BigInt: BigInt = make(AST.bigInt)
2650
2800
  * @category models
2651
2801
  * @since 3.10.0
2652
2802
  */
2653
- export interface Void extends Bottom<void, void, never, never, AST.Void, Void> {}
2803
+ export interface Void extends Bottom<void, void, never, never, SchemaAST.Void, Void> {}
2654
2804
 
2655
2805
  /**
2656
2806
  * Schema for the `void` type. Accepts `undefined` as the encoded value.
@@ -2658,7 +2808,7 @@ export interface Void extends Bottom<void, void, never, never, AST.Void, Void> {
2658
2808
  * @category schemas
2659
2809
  * @since 3.10.0
2660
2810
  */
2661
- export const Void: Void = make(AST.void)
2811
+ export const Void: Void = make(SchemaAST.void)
2662
2812
 
2663
2813
  /**
2664
2814
  * Type-level representation of {@link ObjectKeyword}.
@@ -2666,7 +2816,7 @@ export const Void: Void = make(AST.void)
2666
2816
  * @category models
2667
2817
  * @since 4.0.0
2668
2818
  */
2669
- export interface ObjectKeyword extends Bottom<object, object, never, never, AST.ObjectKeyword, ObjectKeyword> {}
2819
+ export interface ObjectKeyword extends Bottom<object, object, never, never, SchemaAST.ObjectKeyword, ObjectKeyword> {}
2670
2820
 
2671
2821
  /**
2672
2822
  * Schema for the `object` type. Validates that the input is a non-null object or function
@@ -2675,7 +2825,7 @@ export interface ObjectKeyword extends Bottom<object, object, never, never, AST.
2675
2825
  * @category schemas
2676
2826
  * @since 4.0.0
2677
2827
  */
2678
- export const ObjectKeyword: ObjectKeyword = make(AST.objectKeyword)
2828
+ export const ObjectKeyword: ObjectKeyword = make(SchemaAST.objectKeyword)
2679
2829
 
2680
2830
  /**
2681
2831
  * Type-level representation returned by {@link UniqueSymbol}.
@@ -2684,7 +2834,7 @@ export const ObjectKeyword: ObjectKeyword = make(AST.objectKeyword)
2684
2834
  * @since 4.0.0
2685
2835
  */
2686
2836
  export interface UniqueSymbol<sym extends symbol>
2687
- extends Bottom<sym, sym, never, never, AST.UniqueSymbol, UniqueSymbol<sym>>
2837
+ extends Bottom<sym, sym, never, never, SchemaAST.UniqueSymbol, UniqueSymbol<sym>>
2688
2838
  {}
2689
2839
 
2690
2840
  /**
@@ -2704,7 +2854,7 @@ export interface UniqueSymbol<sym extends symbol>
2704
2854
  * @since 4.0.0
2705
2855
  */
2706
2856
  export function UniqueSymbol<const sym extends symbol>(symbol: sym): UniqueSymbol<sym> {
2707
- return make(new AST.UniqueSymbol(symbol))
2857
+ return make(new SchemaAST.UniqueSymbol(symbol))
2708
2858
  }
2709
2859
 
2710
2860
  /**
@@ -2880,7 +3030,7 @@ export interface Struct<Fields extends Struct.Fields> extends
2880
3030
  Struct.Encoded<Fields>,
2881
3031
  Struct.DecodingServices<Fields>,
2882
3032
  Struct.EncodingServices<Fields>,
2883
- AST.Objects,
3033
+ SchemaAST.Objects,
2884
3034
  Struct<Fields>,
2885
3035
  Struct.MakeIn<Fields>,
2886
3036
  Struct.Iso<Fields>
@@ -2932,7 +3082,7 @@ export interface Struct<Fields extends Struct.Fields> extends
2932
3082
  ): Struct<Simplify<Readonly<To>>>
2933
3083
  }
2934
3084
 
2935
- function makeStruct<const Fields extends Struct.Fields>(ast: AST.Objects, fields: Fields): Struct<Fields> {
3085
+ function makeStruct<const Fields extends Struct.Fields>(ast: SchemaAST.Objects, fields: Fields): Struct<Fields> {
2936
3086
  return make(ast, {
2937
3087
  fields,
2938
3088
  mapFields<To extends Struct.Fields>(
@@ -2943,7 +3093,7 @@ function makeStruct<const Fields extends Struct.Fields>(ast: AST.Objects, fields
2943
3093
  } | undefined
2944
3094
  ): Struct<To> {
2945
3095
  const fields = f(this.fields)
2946
- return makeStruct(AST.struct(fields, options?.unsafePreserveChecks ? this.ast.checks : undefined), fields)
3096
+ return makeStruct(SchemaAST.struct(fields, options?.unsafePreserveChecks ? this.ast.checks : undefined), fields)
2947
3097
  }
2948
3098
  })
2949
3099
  }
@@ -2982,7 +3132,7 @@ function makeStruct<const Fields extends Struct.Fields>(ast: AST.Objects, fields
2982
3132
  * @since 3.10.0
2983
3133
  */
2984
3134
  export function Struct<const Fields extends Struct.Fields>(fields: Fields): Struct<Fields> {
2985
- return makeStruct(AST.struct(fields, undefined), fields)
3135
+ return makeStruct(SchemaAST.struct(fields, undefined), fields)
2986
3136
  }
2987
3137
 
2988
3138
  interface fieldsAssign<NewFields extends Struct.Fields> extends Lambda {
@@ -2999,8 +3149,8 @@ interface fieldsAssign<NewFields extends Struct.Fields> extends Lambda {
2999
3149
  *
3000
3150
  * **When to use**
3001
3151
  *
3002
- * Use to add the same fields to an existing struct or to every struct member of
3003
- * a union.
3152
+ * Use to add the same fields to an existing struct or every struct member of a
3153
+ * union.
3004
3154
  *
3005
3155
  * **Details**
3006
3156
  *
@@ -3091,7 +3241,7 @@ export function encodeKeys<
3091
3241
  }
3092
3242
  return Struct(fields).pipe(decodeTo(
3093
3243
  self,
3094
- Transformation.transform<any, any>({
3244
+ SchemaTransformation.transform<any, any>({
3095
3245
  decode: Struct_.renameKeys(reverseMapping),
3096
3246
  encode: Struct_.renameKeys(mapping)
3097
3247
  })
@@ -3143,7 +3293,7 @@ export function extendTo<S extends Struct<Struct.Fields>, const Fields extends S
3143
3293
  const to = Struct({ ...f, ...fields })
3144
3294
  return self.pipe(decodeTo(
3145
3295
  to,
3146
- Transformation.transform({
3296
+ SchemaTransformation.transform({
3147
3297
  decode: (input) => {
3148
3298
  const out: any = { ...input }
3149
3299
  for (const k in fields) {
@@ -3302,7 +3452,7 @@ export interface $Record<Key extends Record.Key, Value extends Top> extends
3302
3452
  Record.Encoded<Key, Value>,
3303
3453
  Record.DecodingServices<Key, Value>,
3304
3454
  Record.EncodingServices<Key, Value>,
3305
- AST.Objects,
3455
+ SchemaAST.Objects,
3306
3456
  $Record<Key, Value>,
3307
3457
  Simplify<Record.MakeIn<Key, Value>>,
3308
3458
  Record.Iso<Key, Value>
@@ -3344,9 +3494,9 @@ export function Record<Key extends Record.Key, Value extends Top>(
3344
3494
  }
3345
3495
  ): $Record<Key, Value> {
3346
3496
  const keyValueCombiner = options?.keyValueCombiner?.decode || options?.keyValueCombiner?.encode
3347
- ? new AST.KeyValueCombiner(options.keyValueCombiner.decode, options.keyValueCombiner.encode)
3497
+ ? new SchemaAST.KeyValueCombiner(options.keyValueCombiner.decode, options.keyValueCombiner.encode)
3348
3498
  : undefined
3349
- return make(AST.record(key.ast, value.ast, keyValueCombiner), { key, value })
3499
+ return make(SchemaAST.record(key.ast, value.ast, keyValueCombiner), { key, value })
3350
3500
  }
3351
3501
 
3352
3502
  /**
@@ -3367,7 +3517,7 @@ export declare namespace StructWithRest {
3367
3517
  * @category utility types
3368
3518
  * @since 4.0.0
3369
3519
  */
3370
- export type Objects = Top & { readonly ast: AST.Objects }
3520
+ export type Objects = Top & { readonly ast: SchemaAST.Objects }
3371
3521
 
3372
3522
  /**
3373
3523
  * Readonly list of record schemas that provide the additional index signatures
@@ -3382,6 +3532,14 @@ export declare namespace StructWithRest {
3382
3532
  Head & MergeTuple<Tail>
3383
3533
  : {}
3384
3534
 
3535
+ type Intersect<
3536
+ S extends Objects,
3537
+ Records extends StructWithRest.Records,
3538
+ Side extends "Type" | "Iso" | "Encoded" | "~type.make"
3539
+ > =
3540
+ & S[Side]
3541
+ & MergeTuple<{ readonly [K in keyof Records]: Records[K][Side] }>
3542
+
3385
3543
  /**
3386
3544
  * Computes the decoded type for `StructWithRest` by intersecting the base object
3387
3545
  * schema's decoded `Type` with the decoded types of all rest record schemas.
@@ -3389,9 +3547,7 @@ export declare namespace StructWithRest {
3389
3547
  * @category utility types
3390
3548
  * @since 3.10.0
3391
3549
  */
3392
- export type Type<S extends Objects, Records extends StructWithRest.Records> =
3393
- & S["Type"]
3394
- & MergeTuple<{ readonly [K in keyof Records]: Records[K]["Type"] }>
3550
+ export type Type<S extends Objects, Records extends StructWithRest.Records> = Intersect<S, Records, "Type">
3395
3551
 
3396
3552
  /**
3397
3553
  * Computes the iso type for `StructWithRest` by intersecting the base object
@@ -3400,9 +3556,7 @@ export declare namespace StructWithRest {
3400
3556
  * @category utility types
3401
3557
  * @since 4.0.0
3402
3558
  */
3403
- export type Iso<S extends Objects, Records extends StructWithRest.Records> =
3404
- & S["Iso"]
3405
- & MergeTuple<{ readonly [K in keyof Records]: Records[K]["Iso"] }>
3559
+ export type Iso<S extends Objects, Records extends StructWithRest.Records> = Intersect<S, Records, "Iso">
3406
3560
 
3407
3561
  /**
3408
3562
  * Computes the encoded type for `StructWithRest` by intersecting the base object
@@ -3411,9 +3565,25 @@ export declare namespace StructWithRest {
3411
3565
  * @category utility types
3412
3566
  * @since 3.10.0
3413
3567
  */
3414
- export type Encoded<S extends Objects, Records extends StructWithRest.Records> =
3415
- & S["Encoded"]
3416
- & MergeTuple<{ readonly [K in keyof Records]: Records[K]["Encoded"] }>
3568
+ export type Encoded<S extends Objects, Records extends StructWithRest.Records> = Intersect<S, Records, "Encoded">
3569
+
3570
+ /**
3571
+ * Computes the input type accepted when constructing a `StructWithRest` value by
3572
+ * intersecting the base object's make input with the make inputs of all rest
3573
+ * record schemas.
3574
+ *
3575
+ * @category utility types
3576
+ * @since 4.0.0
3577
+ */
3578
+ export type MakeIn<S extends Objects, Records extends StructWithRest.Records> = Intersect<S, Records, "~type.make">
3579
+
3580
+ type Services<
3581
+ S extends Objects,
3582
+ Records extends StructWithRest.Records,
3583
+ Side extends "DecodingServices" | "EncodingServices"
3584
+ > =
3585
+ | S[Side]
3586
+ | { [K in keyof Records]: Records[K][Side] }[number]
3417
3587
 
3418
3588
  /**
3419
3589
  * Union of the decoding service requirements of the base object schema and all
@@ -3422,9 +3592,11 @@ export declare namespace StructWithRest {
3422
3592
  * @category utility types
3423
3593
  * @since 4.0.0
3424
3594
  */
3425
- export type DecodingServices<S extends Objects, Records extends StructWithRest.Records> =
3426
- | S["DecodingServices"]
3427
- | { [K in keyof Records]: Records[K]["DecodingServices"] }[number]
3595
+ export type DecodingServices<S extends Objects, Records extends StructWithRest.Records> = Services<
3596
+ S,
3597
+ Records,
3598
+ "DecodingServices"
3599
+ >
3428
3600
 
3429
3601
  /**
3430
3602
  * Union of the encoding service requirements of the base object schema and all
@@ -3433,21 +3605,43 @@ export declare namespace StructWithRest {
3433
3605
  * @category utility types
3434
3606
  * @since 4.0.0
3435
3607
  */
3436
- export type EncodingServices<S extends Objects, Records extends StructWithRest.Records> =
3437
- | S["EncodingServices"]
3438
- | { [K in keyof Records]: Records[K]["EncodingServices"] }[number]
3608
+ export type EncodingServices<S extends Objects, Records extends StructWithRest.Records> = Services<
3609
+ S,
3610
+ Records,
3611
+ "EncodingServices"
3612
+ >
3613
+
3614
+ type IncompatibleKeys<A, B, OK extends (keyof A & keyof B) = Extract<keyof A, keyof B>> = {
3615
+ [K in OK]: Required<Pick<A, K>>[K] extends B[K] ? never : K
3616
+ }[OK]
3617
+
3618
+ type IncompatibleSideKeys<
3619
+ S extends Objects,
3620
+ Records extends StructWithRest.Records,
3621
+ Side extends "Type" | "Encoded" | "Iso" | "~type.make"
3622
+ > = {
3623
+ [I in keyof Records]: Records[I][Side] extends object ? IncompatibleKeys<S[Side], Records[I][Side]> : never
3624
+ }[number]
3439
3625
 
3440
3626
  /**
3441
- * Computes the input type accepted when constructing a `StructWithRest` value by
3442
- * intersecting the base object's make input with the make inputs of all rest
3443
- * record schemas.
3627
+ * Validates that the records are compatible with the struct.
3444
3628
  *
3445
3629
  * @category utility types
3446
3630
  * @since 4.0.0
3447
3631
  */
3448
- export type MakeIn<S extends Objects, Records extends StructWithRest.Records> =
3449
- & S["~type.make"]
3450
- & MergeTuple<{ readonly [K in keyof Records]: Records[K]["~type.make"] }>
3632
+ export type ValidateRecords<S extends Objects, Records extends StructWithRest.Records> = [
3633
+ | IncompatibleSideKeys<S, Records, "Type">
3634
+ | IncompatibleSideKeys<S, Records, "Encoded">
3635
+ | IncompatibleSideKeys<S, Records, "Iso">
3636
+ | IncompatibleSideKeys<S, Records, "~type.make">
3637
+ ] extends [never] ? unknown
3638
+ : {
3639
+ "incompatible index signatures":
3640
+ | IncompatibleSideKeys<S, Records, "Type">
3641
+ | IncompatibleSideKeys<S, Records, "Encoded">
3642
+ | IncompatibleSideKeys<S, Records, "Iso">
3643
+ | IncompatibleSideKeys<S, Records, "~type.make">
3644
+ }
3451
3645
  }
3452
3646
 
3453
3647
  /**
@@ -3465,7 +3659,7 @@ export interface StructWithRest<
3465
3659
  Simplify<StructWithRest.Encoded<S, Records>>,
3466
3660
  StructWithRest.DecodingServices<S, Records>,
3467
3661
  StructWithRest.EncodingServices<S, Records>,
3468
- AST.Objects,
3662
+ SchemaAST.Objects,
3469
3663
  StructWithRest<S, Records>,
3470
3664
  Simplify<StructWithRest.MakeIn<S, Records>>,
3471
3665
  Simplify<StructWithRest.Iso<S, Records>>
@@ -3486,10 +3680,10 @@ export interface StructWithRest<
3486
3680
  *
3487
3681
  * const schema = Schema.StructWithRest(
3488
3682
  * Schema.Struct({ id: Schema.Number }),
3489
- * [Schema.Record(Schema.String, Schema.String)]
3683
+ * [Schema.Record(Schema.String, Schema.Number)]
3490
3684
  * )
3491
3685
  *
3492
- * // { readonly id: number } & { readonly [x: string]: string }
3686
+ * // { readonly id: number, readonly [x: string]: number }
3493
3687
  * type T = typeof schema.Type
3494
3688
  * ```
3495
3689
  *
@@ -3501,9 +3695,9 @@ export function StructWithRest<
3501
3695
  const Records extends StructWithRest.Records
3502
3696
  >(
3503
3697
  schema: S,
3504
- records: Records
3698
+ records: Records & StructWithRest.ValidateRecords<S, Records>
3505
3699
  ): StructWithRest<S, Records> {
3506
- return make(AST.structWithRest(schema.ast, records.map(AST.getAST)), { schema, records })
3700
+ return make(SchemaAST.structWithRest(schema.ast, records.map(SchemaAST.getAST)), { schema, records })
3507
3701
  }
3508
3702
 
3509
3703
  /**
@@ -3649,7 +3843,7 @@ export interface Tuple<Elements extends Tuple.Elements> extends
3649
3843
  Tuple.Encoded<Elements>,
3650
3844
  Tuple.DecodingServices<Elements>,
3651
3845
  Tuple.EncodingServices<Elements>,
3652
- AST.Arrays,
3846
+ SchemaAST.Arrays,
3653
3847
  Tuple<Elements>,
3654
3848
  Tuple.MakeIn<Elements>,
3655
3849
  Tuple.Iso<Elements>
@@ -3680,7 +3874,7 @@ export interface Tuple<Elements extends Tuple.Elements> extends
3680
3874
  ): Tuple<Simplify<Readonly<To>>>
3681
3875
  }
3682
3876
 
3683
- function makeTuple<Elements extends Tuple.Elements>(ast: AST.Arrays, elements: Elements): Tuple<Elements> {
3877
+ function makeTuple<Elements extends Tuple.Elements>(ast: SchemaAST.Arrays, elements: Elements): Tuple<Elements> {
3684
3878
  return make(ast, {
3685
3879
  elements,
3686
3880
  mapElements<To extends Tuple.Elements>(
@@ -3691,7 +3885,7 @@ function makeTuple<Elements extends Tuple.Elements>(ast: AST.Arrays, elements: E
3691
3885
  } | undefined
3692
3886
  ): Tuple<Simplify<Readonly<To>>> {
3693
3887
  const elements = f(this.elements)
3694
- return makeTuple(AST.tuple(elements, options?.unsafePreserveChecks ? this.ast.checks : undefined), elements)
3888
+ return makeTuple(SchemaAST.tuple(elements, options?.unsafePreserveChecks ? this.ast.checks : undefined), elements)
3695
3889
  }
3696
3890
  })
3697
3891
  }
@@ -3715,7 +3909,7 @@ function makeTuple<Elements extends Tuple.Elements>(ast: AST.Arrays, elements: E
3715
3909
  * @since 3.10.0
3716
3910
  */
3717
3911
  export function Tuple<const Elements extends ReadonlyArray<Top>>(elements: Elements): Tuple<Elements> {
3718
- return makeTuple(AST.tuple(elements), elements)
3912
+ return makeTuple(SchemaAST.tuple(elements), elements)
3719
3913
  }
3720
3914
 
3721
3915
  /**
@@ -3741,7 +3935,7 @@ export declare namespace TupleWithRest {
3741
3935
  export type TupleType = Top & {
3742
3936
  readonly Type: ReadonlyArray<unknown>
3743
3937
  readonly Encoded: ReadonlyArray<unknown>
3744
- readonly ast: AST.Arrays
3938
+ readonly ast: SchemaAST.Arrays
3745
3939
  readonly "~type.make": ReadonlyArray<unknown>
3746
3940
  readonly "Iso": ReadonlyArray<unknown>
3747
3941
  }
@@ -3855,7 +4049,7 @@ export interface TupleWithRest<
3855
4049
  TupleWithRest.Encoded<S["Encoded"], Rest>,
3856
4050
  S["DecodingServices"] | Rest[number]["DecodingServices"],
3857
4051
  S["EncodingServices"] | Rest[number]["EncodingServices"],
3858
- AST.Arrays,
4052
+ SchemaAST.Arrays,
3859
4053
  TupleWithRest<S, Rest>,
3860
4054
  TupleWithRest.MakeIn<S["~type.make"], Rest>,
3861
4055
  TupleWithRest.Iso<S["Iso"], Rest>
@@ -3899,7 +4093,7 @@ export function TupleWithRest<S extends Tuple<Tuple.Elements>, const Rest extend
3899
4093
  schema: S,
3900
4094
  rest: Rest
3901
4095
  ): TupleWithRest<S, Rest> {
3902
- return make(AST.tupleWithRest(schema.ast, rest.map(AST.getAST)), { schema, rest })
4096
+ return make(SchemaAST.tupleWithRest(schema.ast, rest.map(SchemaAST.getAST)), { schema, rest })
3903
4097
  }
3904
4098
 
3905
4099
  /**
@@ -3914,7 +4108,7 @@ export interface $Array<S extends Top> extends
3914
4108
  ReadonlyArray<S["Encoded"]>,
3915
4109
  S["DecodingServices"],
3916
4110
  S["EncodingServices"],
3917
- AST.Arrays,
4111
+ SchemaAST.Arrays,
3918
4112
  $Array<S>,
3919
4113
  ReadonlyArray<S["~type.make"]>,
3920
4114
  ReadonlyArray<S["Iso"]>
@@ -3933,7 +4127,7 @@ interface ArrayLambda extends Lambda {
3933
4127
  * @since 4.0.0
3934
4128
  */
3935
4129
  const ArraySchema = Struct_.lambda<ArrayLambda>((schema) =>
3936
- make(new AST.Arrays(false, [], [schema.ast]), { value: schema })
4130
+ make(new SchemaAST.Arrays(false, [], [schema.ast]), { value: schema })
3937
4131
  )
3938
4132
 
3939
4133
  export {
@@ -3970,7 +4164,7 @@ export interface NonEmptyArray<S extends Top> extends
3970
4164
  readonly [S["Encoded"], ...Array<S["Encoded"]>],
3971
4165
  S["DecodingServices"],
3972
4166
  S["EncodingServices"],
3973
- AST.Arrays,
4167
+ SchemaAST.Arrays,
3974
4168
  NonEmptyArray<S>,
3975
4169
  readonly [S["~type.make"], ...Array<S["~type.make"]>],
3976
4170
  readonly [S["Iso"], ...Array<S["Iso"]>]
@@ -4003,7 +4197,7 @@ interface NonEmptyArrayLambda extends Lambda {
4003
4197
  * @since 3.10.0
4004
4198
  */
4005
4199
  export const NonEmptyArray = Struct_.lambda<NonEmptyArrayLambda>((schema) =>
4006
- make(new AST.Arrays(false, [schema.ast], [schema.ast]), { value: schema })
4200
+ make(new SchemaAST.Arrays(false, [schema.ast], [schema.ast]), { value: schema })
4007
4201
  )
4008
4202
 
4009
4203
  /**
@@ -4045,7 +4239,7 @@ export interface ArrayEnsure<S extends Top> extends decodeTo<$Array<toType<S>>,
4045
4239
  export function ArrayEnsure<S extends Top>(schema: S): ArrayEnsure<S> {
4046
4240
  return Union([schema, ArraySchema(schema)]).pipe(decodeTo(
4047
4241
  ArraySchema(toType(schema)),
4048
- Transformation.transform({
4242
+ SchemaTransformation.transform({
4049
4243
  decode: Arr.ensure,
4050
4244
  encode: (array) => array.length === 1 ? array[0] : array
4051
4245
  })
@@ -4083,7 +4277,7 @@ export function UniqueArray<S extends Top>(item: S): UniqueArray<S> {
4083
4277
  * @category transforming
4084
4278
  * @since 3.10.0
4085
4279
  */
4086
- export interface mutable<S extends Top & { readonly "ast": AST.Arrays }> extends
4280
+ export interface mutable<S extends Top & { readonly "ast": SchemaAST.Arrays }> extends
4087
4281
  Bottom<
4088
4282
  Mutable<S["Type"]>,
4089
4283
  Mutable<S["Encoded"]>,
@@ -4107,8 +4301,9 @@ export interface mutable<S extends Top & { readonly "ast": AST.Arrays }> extends
4107
4301
  }
4108
4302
 
4109
4303
  interface mutableLambda extends Lambda {
4110
- <S extends Top & { readonly "ast": AST.Arrays }>(self: S): mutable<S>
4111
- readonly "~lambda.out": this["~lambda.in"] extends Top & { readonly "ast": AST.Arrays } ? mutable<this["~lambda.in"]>
4304
+ <S extends Top & { readonly "ast": SchemaAST.Arrays }>(self: S): mutable<S>
4305
+ readonly "~lambda.out": this["~lambda.in"] extends Top & { readonly "ast": SchemaAST.Arrays } ?
4306
+ mutable<this["~lambda.in"]>
4112
4307
  : "Error: schema not eligible for mutable"
4113
4308
  }
4114
4309
 
@@ -4130,7 +4325,7 @@ interface mutableLambda extends Lambda {
4130
4325
  * @since 3.10.0
4131
4326
  */
4132
4327
  export const mutable = Struct_.lambda<mutableLambda>((schema) => {
4133
- return make(new AST.Arrays(true, schema.ast.elements, schema.ast.rest), { schema })
4328
+ return make(new SchemaAST.Arrays(true, schema.ast.elements, schema.ast.rest), { schema })
4134
4329
  })
4135
4330
 
4136
4331
  /**
@@ -4145,7 +4340,7 @@ export interface Union<Members extends ReadonlyArray<Top>> extends
4145
4340
  { [K in keyof Members]: Members[K]["Encoded"] }[number],
4146
4341
  { [K in keyof Members]: Members[K]["DecodingServices"] }[number],
4147
4342
  { [K in keyof Members]: Members[K]["EncodingServices"] }[number],
4148
- AST.Union<{ [K in keyof Members]: Members[K]["ast"] }[number]>,
4343
+ SchemaAST.Union<{ [K in keyof Members]: Members[K]["ast"] }[number]>,
4149
4344
  Union<Members>,
4150
4345
  { [K in keyof Members]: Members[K]["~type.make"] }[number],
4151
4346
  { [K in keyof Members]: Members[K]["Iso"] }[number]
@@ -4177,7 +4372,7 @@ export interface Union<Members extends ReadonlyArray<Top>> extends
4177
4372
  }
4178
4373
 
4179
4374
  function makeUnion<Members extends ReadonlyArray<Top>>(
4180
- ast: AST.Union<Members[number]["ast"]>,
4375
+ ast: SchemaAST.Union<Members[number]["ast"]>,
4181
4376
  members: Members
4182
4377
  ): Union<Members> {
4183
4378
  return make(ast, {
@@ -4191,7 +4386,7 @@ function makeUnion<Members extends ReadonlyArray<Top>>(
4191
4386
  ): Union<Simplify<Readonly<To>>> {
4192
4387
  const members = f(this.members)
4193
4388
  return makeUnion(
4194
- AST.union(members, this.ast.mode, options?.unsafePreserveChecks ? this.ast.checks : undefined),
4389
+ SchemaAST.union(members, this.ast.mode, options?.unsafePreserveChecks ? this.ast.checks : undefined),
4195
4390
  members
4196
4391
  )
4197
4392
  }
@@ -4226,7 +4421,7 @@ export function Union<const Members extends ReadonlyArray<Top>>(
4226
4421
  members: Members,
4227
4422
  options?: { mode?: "anyOf" | "oneOf" }
4228
4423
  ): Union<Members> {
4229
- return makeUnion(AST.union(members, options?.mode ?? "anyOf", undefined), members)
4424
+ return makeUnion(SchemaAST.union(members, options?.mode ?? "anyOf", undefined), members)
4230
4425
  }
4231
4426
 
4232
4427
  /**
@@ -4235,8 +4430,8 @@ export function Union<const Members extends ReadonlyArray<Top>>(
4235
4430
  * @category models
4236
4431
  * @since 4.0.0
4237
4432
  */
4238
- export interface Literals<L extends ReadonlyArray<AST.LiteralValue>>
4239
- extends Bottom<L[number], L[number], never, never, AST.Union<AST.Literal>, Literals<L>>
4433
+ export interface Literals<L extends ReadonlyArray<SchemaAST.LiteralValue>>
4434
+ extends Bottom<L[number], L[number], never, never, SchemaAST.Union<SchemaAST.Literal>, Literals<L>>
4240
4435
  {
4241
4436
  readonly literals: L
4242
4437
  readonly members: { readonly [K in keyof L]: Literal<L[K]> }
@@ -4247,7 +4442,7 @@ export interface Literals<L extends ReadonlyArray<AST.LiteralValue>>
4247
4442
 
4248
4443
  pick<const L2 extends ReadonlyArray<L[number]>>(literals: L2): Literals<L2>
4249
4444
 
4250
- transform<const L2 extends { readonly [I in keyof L]: AST.LiteralValue }>(
4445
+ transform<const L2 extends { readonly [I in keyof L]: SchemaAST.LiteralValue }>(
4251
4446
  to: L2
4252
4447
  ): Union<{ [I in keyof L]: decodeTo<Literal<L2[I]>, Literal<L[I]>> }>
4253
4448
  }
@@ -4268,9 +4463,9 @@ export interface Literals<L extends ReadonlyArray<AST.LiteralValue>>
4268
4463
  * @category constructors
4269
4464
  * @since 4.0.0
4270
4465
  */
4271
- export function Literals<const L extends ReadonlyArray<AST.LiteralValue>>(literals: L): Literals<L> {
4466
+ export function Literals<const L extends ReadonlyArray<SchemaAST.LiteralValue>>(literals: L): Literals<L> {
4272
4467
  const members = literals.map(Literal) as { readonly [K in keyof L]: Literal<L[K]> }
4273
- return make(AST.union(members, "anyOf", undefined), {
4468
+ return make(SchemaAST.union(members, "anyOf", undefined), {
4274
4469
  literals,
4275
4470
  members,
4276
4471
  mapMembers<To extends ReadonlyArray<Top>>(
@@ -4282,7 +4477,7 @@ export function Literals<const L extends ReadonlyArray<AST.LiteralValue>>(litera
4282
4477
  pick<const L2 extends ReadonlyArray<L[number]>>(literals: L2): Literals<L2> {
4283
4478
  return Literals(literals)
4284
4479
  },
4285
- transform<const L2 extends { readonly [I in keyof L]: AST.LiteralValue }>(
4480
+ transform<const L2 extends { readonly [I in keyof L]: SchemaAST.LiteralValue }>(
4286
4481
  to: L2
4287
4482
  ): Union<{ [I in keyof L]: decodeTo<Literal<L2[I]>, Literal<L[I]>> }> {
4288
4483
  return Union(members.map((member, index) => member.transform(to[index]))) as any
@@ -4371,7 +4566,7 @@ export interface suspend<S extends Top> extends
4371
4566
  S["Encoded"],
4372
4567
  S["DecodingServices"],
4373
4568
  S["EncodingServices"],
4374
- AST.Suspend,
4569
+ SchemaAST.Suspend,
4375
4570
  suspend<S>,
4376
4571
  S["~type.make.in"],
4377
4572
  S["Iso"],
@@ -4410,7 +4605,7 @@ export interface suspend<S extends Top> extends
4410
4605
  * @since 3.10.0
4411
4606
  */
4412
4607
  export function suspend<S extends Top>(f: () => S): suspend<S> {
4413
- return make(new AST.Suspend(() => f().ast))
4608
+ return make(new SchemaAST.Suspend(() => f().ast))
4414
4609
  }
4415
4610
 
4416
4611
  /**
@@ -4430,7 +4625,9 @@ export function suspend<S extends Top>(f: () => S): suspend<S> {
4430
4625
  * @category filtering
4431
4626
  * @since 4.0.0
4432
4627
  */
4433
- export function check<S extends Top>(...checks: readonly [AST.Check<S["Type"]>, ...Array<AST.Check<S["Type"]>>]) {
4628
+ export function check<S extends Top>(
4629
+ ...checks: readonly [SchemaAST.Check<S["Type"]>, ...Array<SchemaAST.Check<S["Type"]>>]
4630
+ ) {
4434
4631
  return (self: S): S["Rebuild"] => self.check(...checks)
4435
4632
  }
4436
4633
 
@@ -4482,7 +4679,7 @@ export function refine<S extends Top, T extends S["Type"]>(
4482
4679
  annotations?: Annotations.Filter
4483
4680
  ) {
4484
4681
  return (schema: S): refine<T, S> =>
4485
- make(AST.appendChecks(schema.ast, [AST.makeFilterByGuard(refinement, annotations)]), { schema })
4682
+ make(SchemaAST.appendChecks(schema.ast, [SchemaAST.makeFilterByGuard(refinement, annotations)]), { schema })
4486
4683
  }
4487
4684
 
4488
4685
  type DistributeBrands<B> = UnionToIntersection<B extends infer U extends string ? Brand.Brand<U> : never>
@@ -4537,7 +4734,7 @@ export interface brand<S extends Top, B> extends
4537
4734
  */
4538
4735
  export function brand<B extends string>(identifier: B) {
4539
4736
  return <S extends Top>(schema: S): brand<S["Rebuild"], B> =>
4540
- make(AST.brand(schema.ast, identifier), { schema, identifier })
4737
+ make(SchemaAST.brand(schema.ast, identifier), { schema, identifier })
4541
4738
  }
4542
4739
 
4543
4740
  /**
@@ -4610,13 +4807,13 @@ export interface middlewareDecoding<S extends Top, RD> extends
4610
4807
  */
4611
4808
  export function middlewareDecoding<S extends Top, RD>(
4612
4809
  decode: (
4613
- effect: Effect.Effect<Option_.Option<S["Type"]>, Issue.Issue, S["DecodingServices"]>,
4614
- options: AST.ParseOptions
4615
- ) => Effect.Effect<Option_.Option<S["Type"]>, Issue.Issue, RD>
4810
+ effect: Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, S["DecodingServices"]>,
4811
+ options: SchemaAST.ParseOptions
4812
+ ) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, RD>
4616
4813
  ) {
4617
4814
  return (schema: S): middlewareDecoding<S, RD> =>
4618
4815
  make(
4619
- AST.middlewareDecoding(schema.ast, new Transformation.Middleware(decode, identity)),
4816
+ SchemaAST.middlewareDecoding(schema.ast, new SchemaTransformation.Middleware(decode, identity)),
4620
4817
  { schema }
4621
4818
  )
4622
4819
  }
@@ -4676,13 +4873,13 @@ export interface middlewareEncoding<S extends Top, RE> extends
4676
4873
  */
4677
4874
  export function middlewareEncoding<S extends Top, RE>(
4678
4875
  encode: (
4679
- effect: Effect.Effect<Option_.Option<S["Encoded"]>, Issue.Issue, S["EncodingServices"]>,
4680
- options: AST.ParseOptions
4681
- ) => Effect.Effect<Option_.Option<S["Encoded"]>, Issue.Issue, RE>
4876
+ effect: Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, S["EncodingServices"]>,
4877
+ options: SchemaAST.ParseOptions
4878
+ ) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, RE>
4682
4879
  ) {
4683
4880
  return (schema: S): middlewareEncoding<S, RE> =>
4684
4881
  make(
4685
- AST.middlewareEncoding(schema.ast, new Transformation.Middleware(identity, encode)),
4882
+ SchemaAST.middlewareEncoding(schema.ast, new SchemaTransformation.Middleware(identity, encode)),
4686
4883
  { schema }
4687
4884
  )
4688
4885
  }
@@ -4710,7 +4907,7 @@ export function middlewareEncoding<S extends Top, RE>(
4710
4907
  * @since 4.0.0
4711
4908
  */
4712
4909
  export function catchDecoding<S extends Top>(
4713
- f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, Issue.Issue>
4910
+ f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue>
4714
4911
  ): (self: S) => S["Rebuild"] {
4715
4912
  return catchDecodingWithContext(f)
4716
4913
  }
@@ -4720,7 +4917,8 @@ export function catchDecoding<S extends Top>(
4720
4917
  *
4721
4918
  * **When to use**
4722
4919
  *
4723
- * Use when decoding fallback logic needs services from the Effect context.
4920
+ * Use when you need decoding fallback logic to require services from the Effect
4921
+ * context.
4724
4922
  *
4725
4923
  * **Details**
4726
4924
  *
@@ -4735,7 +4933,7 @@ export function catchDecoding<S extends Top>(
4735
4933
  * @since 4.0.0
4736
4934
  */
4737
4935
  export function catchDecodingWithContext<S extends Top, R = never>(
4738
- f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, Issue.Issue, R>
4936
+ f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, R>
4739
4937
  ) {
4740
4938
  return (self: S): middlewareDecoding<S, S["DecodingServices"] | R> =>
4741
4939
  self.pipe(middlewareDecoding(Effect.catchEager(f)))
@@ -4754,7 +4952,7 @@ export function catchDecodingWithContext<S extends Top, R = never>(
4754
4952
  * @since 4.0.0
4755
4953
  */
4756
4954
  export function catchEncoding<S extends Top>(
4757
- f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, Issue.Issue>
4955
+ f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue>
4758
4956
  ): (self: S) => S["Rebuild"] {
4759
4957
  return catchEncodingWithContext(f)
4760
4958
  }
@@ -4764,7 +4962,8 @@ export function catchEncoding<S extends Top>(
4764
4962
  *
4765
4963
  * **When to use**
4766
4964
  *
4767
- * Use when encoding fallback logic needs services from the Effect context.
4965
+ * Use when you need encoding fallback logic to require services from the Effect
4966
+ * context.
4768
4967
  *
4769
4968
  * **Details**
4770
4969
  *
@@ -4779,7 +4978,7 @@ export function catchEncoding<S extends Top>(
4779
4978
  * @since 4.0.0
4780
4979
  */
4781
4980
  export function catchEncodingWithContext<S extends Top, R = never>(
4782
- f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, Issue.Issue, R>
4981
+ f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, R>
4783
4982
  ) {
4784
4983
  return (self: S): middlewareEncoding<S, S["EncodingServices"] | R> =>
4785
4984
  self.pipe(middlewareEncoding(Effect.catchEager(f)))
@@ -4825,25 +5024,28 @@ export interface compose<To extends Top, From extends Top> extends decodeTo<To,
4825
5024
  /**
4826
5025
  * Creates a schema that transforms from a source schema to a target schema.
4827
5026
  *
5027
+ * **When to use**
5028
+ *
5029
+ * Use when decoding should change the schema's decoded type or encoded shape,
5030
+ * with an optional custom bidirectional transformation.
5031
+ *
4828
5032
  * **Details**
4829
5033
  *
4830
- * This is a curried function: call it with the target schema `to` (and optionally a transformation),
4831
- * then call the returned function with the source schema `from`. The resulting schema decodes from
4832
- * `From["Encoded"]` to `To["Type"]` and encodes from `To["Type"]` back to `From["Encoded"]`.
5034
+ * Call it with the target schema `to` and then pipe the source schema `from`
5035
+ * into the returned function. The resulting schema decodes from
5036
+ * `From["Encoded"]` to `To["Type"]` and encodes from `To["Type"]` back to
5037
+ * `From["Encoded"]`.
5038
+ *
5039
+ * When no transformation is provided, `SchemaTransformation.passthrough()` is
5040
+ * used, so `From["Type"]` must already be compatible with `To["Encoded"]`.
5041
+ * The resulting schema combines decoding and encoding services from both
5042
+ * schemas and any custom transformation.
4833
5043
  *
4834
- * Key guarantees:
4835
- * - Resulting schema has `Type = To["Type"]` and `Encoded = From["Encoded"]`
4836
- * - When `transformation` is omitted, uses `Transformation.passthrough()` (schema composition)
4837
- * - Combines decoding/encoding services from both `from` and `to` schemas
4838
- * - Transformation `decode` maps `From["Type"]` → `To["Encoded"]` (used during encoding)
4839
- * - Transformation `encode` maps `To["Encoded"]` → `From["Type"]` (used during decoding)
5044
+ * **Gotchas**
4840
5045
  *
4841
- * Common mistakes:
4842
- * - **Direction confusion**: Remember `to` is the target (what you decode TO), `from` is the source (what you decode FROM)
4843
- * - **Currying**: This is curried - must use pipe: `from.pipe(Schema.decodeTo(to))`
4844
- * - **Transformation direction**: `decode` goes `From["Type"]` → `To["Encoded"]`, `encode` goes `To["Encoded"]` → `From["Type"]`
4845
- * - **Passthrough assumption**: Without transformation, schemas must satisfy `To["Encoded"] === From["Type"]` or use passthrough helpers
4846
- * - **Service dependencies**: Resulting schema requires services from both schemas; use `Schema.provideService` if needed
5046
+ * In a custom transformation, `decode` maps `From["Type"]` to `To["Encoded"]`
5047
+ * and is used on the encoding path, while `encode` maps `To["Encoded"]` to
5048
+ * `From["Type"]` and is used on the decoding path.
4847
5049
  *
4848
5050
  * **Example** (String to Number with transformation)
4849
5051
  *
@@ -4871,23 +5073,23 @@ export function decodeTo<To extends Top>(to: To): <From extends Top>(from: From)
4871
5073
  export function decodeTo<To extends Top, From extends Top, RD = never, RE = never>(
4872
5074
  to: To,
4873
5075
  transformation: {
4874
- readonly decode: Getter.Getter<NoInfer<To["Encoded"]>, NoInfer<From["Type"]>, RD>
4875
- readonly encode: Getter.Getter<NoInfer<From["Type"]>, NoInfer<To["Encoded"]>, RE>
5076
+ readonly decode: SchemaGetter.Getter<NoInfer<To["Encoded"]>, NoInfer<From["Type"]>, RD>
5077
+ readonly encode: SchemaGetter.Getter<NoInfer<From["Type"]>, NoInfer<To["Encoded"]>, RE>
4876
5078
  }
4877
5079
  ): (from: From) => decodeTo<To, From, RD, RE>
4878
5080
  export function decodeTo<To extends Top, From extends Top, RD = never, RE = never>(
4879
5081
  to: To,
4880
5082
  transformation?: {
4881
- readonly decode: Getter.Getter<To["Encoded"], From["Type"], RD>
4882
- readonly encode: Getter.Getter<From["Type"], To["Encoded"], RE>
5083
+ readonly decode: SchemaGetter.Getter<To["Encoded"], From["Type"], RD>
5084
+ readonly encode: SchemaGetter.Getter<From["Type"], To["Encoded"], RE>
4883
5085
  } | undefined
4884
5086
  ) {
4885
5087
  return (from: From) => {
4886
5088
  return make(
4887
- AST.decodeTo(
5089
+ SchemaAST.decodeTo(
4888
5090
  from.ast,
4889
5091
  to.ast,
4890
- transformation ? Transformation.make(transformation) : Transformation.passthrough()
5092
+ transformation ? SchemaTransformation.make(transformation) : SchemaTransformation.passthrough()
4891
5093
  ),
4892
5094
  {
4893
5095
  from,
@@ -4900,23 +5102,26 @@ export function decodeTo<To extends Top, From extends Top, RD = never, RE = neve
4900
5102
  /**
4901
5103
  * Applies a transformation to a schema, creating a new schema with the same type but transformed encoding/decoding.
4902
5104
  *
5105
+ * **When to use**
5106
+ *
5107
+ * Use when the decoded type stays the same and the transformation only
5108
+ * normalizes values during encoding and decoding.
5109
+ *
4903
5110
  * **Details**
4904
5111
  *
4905
- * This is a curried function: call it with a transformation object, then call the returned function with a schema.
4906
- * The resulting schema has `Type = S["Type"]` and `Encoded = S["Encoded"]`, with the transformation applied during
4907
- * encoding and decoding operations.
5112
+ * Call it with a transformation object and then pipe a schema into the returned
5113
+ * function. The resulting schema keeps the same `Type` and `Encoded` types as
5114
+ * the source schema, while applying the transformation during both decoding and
5115
+ * encoding.
5116
+ *
5117
+ * Internally this uses `toType(self)` as the target schema and combines service
5118
+ * requirements from the source schema and the transformation.
4908
5119
  *
4909
- * Key guarantees:
4910
- * - Resulting schema has `Type = S["Type"]` and `Encoded = S["Encoded"]`
4911
- * - Uses `toType(self)` as the target schema internally (creates a schema where both Type and Encoded are `S["Type"]`)
4912
- * - Combines decoding/encoding services from the source schema and transformation
4913
- * - Transformation `decode` maps `S["Type"]` → `S["Type"]` (used during encoding)
4914
- * - Transformation `encode` maps `S["Type"]` → `S["Type"]` (used during decoding)
5120
+ * **Gotchas**
4915
5121
  *
4916
- * Common mistakes:
4917
- * - **Currying**: This is curried - must use pipe: `schema.pipe(Schema.decode(transformation))`
4918
- * - **Transformation direction**: `decode` and `encode` both operate on `S["Type"]` (same type, different values)
4919
- * - **Service dependencies**: Resulting schema requires services from the source schema and transformation; use `Schema.provideService` if needed
5122
+ * Use {@link decodeTo} instead when the transformation should change the
5123
+ * decoded type. For this helper, both transformation getters operate on
5124
+ * `S["Type"]` values.
4920
5125
  *
4921
5126
  * **Example** (Trimming string values during encoding/decoding)
4922
5127
  *
@@ -4938,8 +5143,8 @@ export function decodeTo<To extends Top, From extends Top, RD = never, RE = neve
4938
5143
  * @since 3.10.0
4939
5144
  */
4940
5145
  export function decode<S extends Top, RD = never, RE = never>(transformation: {
4941
- readonly decode: Getter.Getter<S["Type"], S["Type"], RD>
4942
- readonly encode: Getter.Getter<S["Type"], S["Type"], RE>
5146
+ readonly decode: SchemaGetter.Getter<S["Type"], S["Type"], RD>
5147
+ readonly encode: SchemaGetter.Getter<S["Type"], S["Type"], RE>
4943
5148
  }) {
4944
5149
  return (self: S): decodeTo<toType<S>, S, RD, RE> => {
4945
5150
  return self.pipe(decodeTo(toType(self), transformation))
@@ -4981,15 +5186,15 @@ export function encodeTo<To extends Top>(
4981
5186
  export function encodeTo<To extends Top, From extends Top, RD = never, RE = never>(
4982
5187
  to: To,
4983
5188
  transformation: {
4984
- readonly decode: Getter.Getter<NoInfer<From["Encoded"]>, NoInfer<To["Type"]>, RD>
4985
- readonly encode: Getter.Getter<NoInfer<To["Type"]>, NoInfer<From["Encoded"]>, RE>
5189
+ readonly decode: SchemaGetter.Getter<NoInfer<From["Encoded"]>, NoInfer<To["Type"]>, RD>
5190
+ readonly encode: SchemaGetter.Getter<NoInfer<To["Type"]>, NoInfer<From["Encoded"]>, RE>
4986
5191
  }
4987
5192
  ): (from: From) => decodeTo<From, To, RD, RE>
4988
5193
  export function encodeTo<To extends Top, From extends Top, RD = never, RE = never>(
4989
5194
  to: To,
4990
5195
  transformation?: {
4991
- readonly decode: Getter.Getter<From["Encoded"], To["Type"], RD>
4992
- readonly encode: Getter.Getter<To["Type"], From["Encoded"], RE>
5196
+ readonly decode: SchemaGetter.Getter<From["Encoded"], To["Type"], RD>
5197
+ readonly encode: SchemaGetter.Getter<To["Type"], From["Encoded"], RE>
4993
5198
  }
4994
5199
  ) {
4995
5200
  return (from: From): decodeTo<From, To, RD, RE> => {
@@ -5025,8 +5230,8 @@ export function encodeTo<To extends Top, From extends Top, RD = never, RE = neve
5025
5230
  * @since 3.10.0
5026
5231
  */
5027
5232
  export function encode<S extends Top, RD = never, RE = never>(transformation: {
5028
- readonly decode: Getter.Getter<S["Encoded"], S["Encoded"], RD>
5029
- readonly encode: Getter.Getter<S["Encoded"], S["Encoded"], RE>
5233
+ readonly decode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RD>
5234
+ readonly encode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RE>
5030
5235
  }) {
5031
5236
  return (self: S): decodeTo<S, toEncoded<S>, RD, RE> => {
5032
5237
  return toEncoded(self).pipe(decodeTo(self, transformation))
@@ -5108,7 +5313,7 @@ export function withConstructorDefault<S extends Top & WithoutConstructorDefault
5108
5313
  defaultValue: Effect.Effect<S["~type.make.in"], SchemaError>
5109
5314
  ) {
5110
5315
  return (schema: S): withConstructorDefault<S> =>
5111
- make(AST.withConstructorDefault(schema.ast, Effect.mapErrorEager(defaultValue, (e) => e.issue)), { schema })
5316
+ make(SchemaAST.withConstructorDefault(schema.ast, Effect.mapErrorEager(defaultValue, (e) => e.issue)), { schema })
5112
5317
  }
5113
5318
 
5114
5319
  /**
@@ -5175,10 +5380,10 @@ export function withDecodingDefaultKey<S extends Top, R = never>(
5175
5380
  defaultValue: Effect.Effect<S["Encoded"], SchemaError, R>,
5176
5381
  options?: DecodingDefaultOptions
5177
5382
  ) {
5178
- const encode = options?.encodingStrategy === "omit" ? Getter.omit() : Getter.passthrough()
5383
+ const encode = options?.encodingStrategy === "omit" ? SchemaGetter.omit() : SchemaGetter.passthrough()
5179
5384
  return (self: S): withDecodingDefaultKey<S, R> => {
5180
5385
  return optionalKey(toEncoded(self)).pipe(decodeTo(self, {
5181
- decode: Getter.withDefault(Effect.mapErrorEager(defaultValue, (e) => e.issue)),
5386
+ decode: SchemaGetter.withDefault(Effect.mapErrorEager(defaultValue, (e) => e.issue)),
5182
5387
  encode
5183
5388
  }))
5184
5389
  }
@@ -5245,6 +5450,11 @@ export interface withDecodingDefault<S extends Top, R = never> extends decodeTo<
5245
5450
  * and provides a default `Encoded` value when the field is missing or
5246
5451
  * `undefined` during decoding.
5247
5452
  *
5453
+ * **When to use**
5454
+ *
5455
+ * Use when the default is expressed in the encoded representation, before the
5456
+ * field's decoding transformation runs.
5457
+ *
5248
5458
  * **Details**
5249
5459
  *
5250
5460
  * The default value is specified in terms of the `Encoded` type (before any
@@ -5278,10 +5488,10 @@ export function withDecodingDefault<S extends Top, R = never>(
5278
5488
  defaultValue: Effect.Effect<S["Encoded"], SchemaError, R>,
5279
5489
  options?: DecodingDefaultOptions
5280
5490
  ) {
5281
- const encode = options?.encodingStrategy === "omit" ? Getter.omit() : Getter.passthrough()
5491
+ const encode = options?.encodingStrategy === "omit" ? SchemaGetter.omit() : SchemaGetter.passthrough()
5282
5492
  return (self: S): withDecodingDefault<S, R> => {
5283
5493
  return optional(toEncoded(self)).pipe(decodeTo(self, {
5284
- decode: Getter.withDefault(Effect.mapErrorEager(defaultValue, (e) => e.issue)),
5494
+ decode: SchemaGetter.withDefault(Effect.mapErrorEager(defaultValue, (e) => e.issue)),
5285
5495
  encode
5286
5496
  }))
5287
5497
  }
@@ -5304,6 +5514,11 @@ export interface withDecodingDefaultType<S extends Top, R = never>
5304
5514
  * and provides a default `Type` value when the field is missing or
5305
5515
  * `undefined` during decoding.
5306
5516
  *
5517
+ * **When to use**
5518
+ *
5519
+ * Use when the default is already in the decoded representation and should not
5520
+ * pass through the field's decoding transformation.
5521
+ *
5307
5522
  * **Details**
5308
5523
  *
5309
5524
  * Unlike {@link withDecodingDefault}, the default value is specified in terms
@@ -5339,7 +5554,7 @@ export function withDecodingDefaultType<S extends Top, R = never>(
5339
5554
  * @category constructors
5340
5555
  * @since 3.10.0
5341
5556
  */
5342
- export interface tag<Tag extends AST.LiteralValue> extends withConstructorDefault<Literal<Tag>> {}
5557
+ export interface tag<Tag extends SchemaAST.LiteralValue> extends withConstructorDefault<Literal<Tag>> {}
5343
5558
 
5344
5559
  /**
5345
5560
  * Combines a {@link Literal} schema with {@link withConstructorDefault}, making it ideal
@@ -5363,7 +5578,7 @@ export interface tag<Tag extends AST.LiteralValue> extends withConstructorDefaul
5363
5578
  * @category constructors
5364
5579
  * @since 3.10.0
5365
5580
  */
5366
- export function tag<Tag extends AST.LiteralValue>(literal: Tag): tag<Tag> {
5581
+ export function tag<Tag extends SchemaAST.LiteralValue>(literal: Tag): tag<Tag> {
5367
5582
  return Literal(literal).pipe(withConstructorDefault(Effect.succeed(literal)))
5368
5583
  }
5369
5584
 
@@ -5399,7 +5614,7 @@ export function tag<Tag extends AST.LiteralValue>(literal: Tag): tag<Tag> {
5399
5614
  * @category constructors
5400
5615
  * @since 4.0.0
5401
5616
  */
5402
- export function tagDefaultOmit<Tag extends AST.LiteralValue>(literal: Tag) {
5617
+ export function tagDefaultOmit<Tag extends SchemaAST.LiteralValue>(literal: Tag) {
5403
5618
  return tag(literal).pipe(withDecodingDefaultKey(Effect.succeed(literal), { encodingStrategy: "omit" }))
5404
5619
  }
5405
5620
 
@@ -5409,7 +5624,7 @@ export function tagDefaultOmit<Tag extends AST.LiteralValue>(literal: Tag) {
5409
5624
  * @category models
5410
5625
  * @since 3.10.0
5411
5626
  */
5412
- export type TaggedStruct<Tag extends AST.LiteralValue, Fields extends Struct.Fields> = Struct<
5627
+ export type TaggedStruct<Tag extends SchemaAST.LiteralValue, Fields extends Struct.Fields> = Struct<
5413
5628
  Simplify<{ readonly _tag: tag<Tag> } & Fields>
5414
5629
  >
5415
5630
 
@@ -5459,7 +5674,7 @@ export type TaggedStruct<Tag extends AST.LiteralValue, Fields extends Struct.Fie
5459
5674
  * @category constructors
5460
5675
  * @since 3.10.0
5461
5676
  */
5462
- export function TaggedStruct<const Tag extends AST.LiteralValue, const Fields extends Struct.Fields>(
5677
+ export function TaggedStruct<const Tag extends SchemaAST.LiteralValue, const Fields extends Struct.Fields>(
5463
5678
  value: Tag,
5464
5679
  fields: Fields
5465
5680
  ): TaggedStruct<Tag, Fields> {
@@ -5554,13 +5769,13 @@ export function toTaggedUnion<const Tag extends PropertyKey>(tag: Tag) {
5554
5769
  const ast = schema.ast
5555
5770
 
5556
5771
  if (
5557
- AST.isUnion(ast) && "members" in schema && globalThis.Array.isArray(schema.members) &&
5772
+ SchemaAST.isUnion(ast) && "members" in schema && globalThis.Array.isArray(schema.members) &&
5558
5773
  schema.members.every(isSchema)
5559
5774
  ) {
5560
5775
  return schema.members.forEach(walk)
5561
5776
  }
5562
5777
 
5563
- const sentinels = AST.collectSentinels(ast)
5778
+ const sentinels = SchemaAST.collectSentinels(ast)
5564
5779
  if (sentinels.length > 0) {
5565
5780
  const literal = sentinels.find((s) => s.key === tag)?.literal
5566
5781
  if (Predicate.isPropertyKey(literal)) {
@@ -5599,7 +5814,7 @@ export interface TaggedUnion<Cases extends Record<string, Top>> extends
5599
5814
  { [K in keyof Cases]: Cases[K]["Encoded"] }[keyof Cases],
5600
5815
  { [K in keyof Cases]: Cases[K]["DecodingServices"] }[keyof Cases],
5601
5816
  { [K in keyof Cases]: Cases[K]["EncodingServices"] }[keyof Cases],
5602
- AST.Union<AST.Objects>,
5817
+ SchemaAST.Union<SchemaAST.Objects>,
5603
5818
  TaggedUnion<Cases>,
5604
5819
  { [K in keyof Cases]: Cases[K]["~type.make"] }[keyof Cases]
5605
5820
  >
@@ -5755,7 +5970,7 @@ export function instanceOf<C extends abstract new(...args: any) => any, Iso = In
5755
5970
  }
5756
5971
 
5757
5972
  /**
5758
- * Constructs an `AST.Link` that describes how a value of type `T` encodes to and decodes from a `To` schema.
5973
+ * Constructs an `SchemaAST.Link` that describes how a value of type `T` encodes to and decodes from a `To` schema.
5759
5974
  * Used when building low-level AST transformations that bridge two schema types.
5760
5975
  *
5761
5976
  * @category transforming
@@ -5765,11 +5980,11 @@ export function link<T>() {
5765
5980
  return <To extends Top>(
5766
5981
  encodeTo: To,
5767
5982
  transformation: {
5768
- readonly decode: Getter.Getter<T, NoInfer<To["Type"]>>
5769
- readonly encode: Getter.Getter<NoInfer<To["Type"]>, T>
5983
+ readonly decode: SchemaGetter.Getter<T, NoInfer<To["Type"]>>
5984
+ readonly encode: SchemaGetter.Getter<NoInfer<To["Type"]>, T>
5770
5985
  }
5771
- ): AST.Link => {
5772
- return new AST.Link(encodeTo.ast, Transformation.make(transformation))
5986
+ ): SchemaAST.Link => {
5987
+ return new SchemaAST.Link(encodeTo.ast, SchemaTransformation.make(transformation))
5773
5988
  }
5774
5989
  }
5775
5990
 
@@ -5836,10 +6051,10 @@ export function link<T>() {
5836
6051
  * @since 4.0.0
5837
6052
  */
5838
6053
  export const makeFilter: <T>(
5839
- filter: (input: T, ast: AST.AST, options: AST.ParseOptions) => FilterOutput,
6054
+ filter: (input: T, ast: SchemaAST.AST, options: SchemaAST.ParseOptions) => FilterOutput,
5840
6055
  annotations?: Annotations.Filter | undefined,
5841
6056
  abort?: boolean
5842
- ) => AST.Filter<T> = AST.makeFilter
6057
+ ) => SchemaAST.Filter<T> = SchemaAST.makeFilter
5843
6058
 
5844
6059
  /**
5845
6060
  * A single failure reported by a filter predicate. Used as the element type
@@ -5848,20 +6063,20 @@ export const makeFilter: <T>(
5848
6063
  * **Details**
5849
6064
  *
5850
6065
  * - `string`: failure with that string as the message. Produces an
5851
- * {@link Issue.InvalidValue} wrapping the input, with the string used as
6066
+ * {@link SchemaIssue.InvalidValue} wrapping the input, with the string used as
5852
6067
  * the issue's `message` annotation.
5853
- * - {@link Issue.Issue}: a fully-formed issue, returned as-is.
6068
+ * - {@link SchemaIssue.Issue}: a fully-formed issue, returned as-is.
5854
6069
  * - `{ path, issue }`: failure attached to a nested path. `issue` is either
5855
- * a `string` (wrapped in an {@link Issue.InvalidValue}) or a full
5856
- * {@link Issue.Issue}; the result is wrapped in an {@link Issue.Pointer}
6070
+ * a `string` (wrapped in an {@link SchemaIssue.InvalidValue}) or a full
6071
+ * {@link SchemaIssue.Issue}; the result is wrapped in an {@link SchemaIssue.Pointer}
5857
6072
  * at the given `path`.
5858
6073
  *
5859
6074
  * @category models
5860
6075
  * @since 3.10.0
5861
6076
  */
5862
- export type FilterIssue = string | Issue.Issue | {
6077
+ export type FilterIssue = string | SchemaIssue.Issue | {
5863
6078
  readonly path: ReadonlyArray<PropertyKey>
5864
- readonly issue: string | Issue.Issue
6079
+ readonly issue: string | SchemaIssue.Issue
5865
6080
  }
5866
6081
 
5867
6082
  /**
@@ -5869,20 +6084,20 @@ export type FilterIssue = string | Issue.Issue | {
5869
6084
  *
5870
6085
  * **Details**
5871
6086
  *
5872
- * Each shape is normalized into an {@link Issue.Issue} (or `undefined` for
6087
+ * Each shape is normalized into an {@link SchemaIssue.Issue} (or `undefined` for
5873
6088
  * success) before being attached to the parse result:
5874
6089
  *
5875
6090
  * - `undefined`: success. The input satisfies the filter.
5876
6091
  * - `true`: success. Equivalent to `undefined`, useful when the predicate is
5877
6092
  * a plain boolean expression.
5878
- * - `false`: generic failure. Produces an {@link Issue.InvalidValue} wrapping
6093
+ * - `false`: generic failure. Produces an {@link SchemaIssue.InvalidValue} wrapping
5879
6094
  * the input, with no custom message.
5880
6095
  * - {@link FilterIssue}: a single failure. See {@link FilterIssue} for the
5881
- * shapes (`string`, {@link Issue.Issue}, or `{ path, issue }`).
6096
+ * shapes (`string`, {@link SchemaIssue.Issue}, or `{ path, issue }`).
5882
6097
  * - `ReadonlyArray<FilterIssue>`: several failures reported together. An
5883
6098
  * empty array is treated as success; a single-element array is equivalent
5884
6099
  * to returning that element directly; otherwise the entries are grouped
5885
- * into an {@link Issue.Composite}.
6100
+ * into an {@link SchemaIssue.Composite}.
5886
6101
  *
5887
6102
  * @category models
5888
6103
  * @since 3.10.0
@@ -5894,17 +6109,17 @@ export type FilterOutput =
5894
6109
  | ReadonlyArray<FilterIssue>
5895
6110
 
5896
6111
  /**
5897
- * Groups multiple checks into a single {@link AST.FilterGroup}, applying
6112
+ * Groups multiple checks into a single {@link SchemaAST.FilterGroup}, applying
5898
6113
  * optional shared annotations to the group as a whole.
5899
6114
  *
5900
6115
  * @category constructors
5901
6116
  * @since 4.0.0
5902
6117
  */
5903
6118
  export function makeFilterGroup<T>(
5904
- checks: readonly [AST.Check<T>, ...Array<AST.Check<T>>],
6119
+ checks: readonly [SchemaAST.Check<T>, ...Array<SchemaAST.Check<T>>],
5905
6120
  annotations: Annotations.Filter | undefined = undefined
5906
- ): AST.FilterGroup<T> {
5907
- return new AST.FilterGroup(checks, annotations)
6121
+ ): SchemaAST.FilterGroup<T> {
6122
+ return new SchemaAST.FilterGroup(checks, annotations)
5908
6123
  }
5909
6124
 
5910
6125
  const TRIMMED_PATTERN = "^\\S[\\s\\S]*\\S$|^\\S$|^$"
@@ -5963,8 +6178,8 @@ export function isTrimmed(annotations?: Annotations.Filter) {
5963
6178
  * @category String checks
5964
6179
  * @since 4.0.0
5965
6180
  */
5966
- export const isPattern: (regExp: globalThis.RegExp, annotations?: Annotations.Filter) => AST.Filter<string> =
5967
- AST.isPattern
6181
+ export const isPattern: (regExp: globalThis.RegExp, annotations?: Annotations.Filter) => SchemaAST.Filter<string> =
6182
+ SchemaAST.isPattern
5968
6183
 
5969
6184
  /**
5970
6185
  * Validates that a string represents a finite number.
@@ -5984,7 +6199,7 @@ export const isPattern: (regExp: globalThis.RegExp, annotations?: Annotations.Fi
5984
6199
  * @category String checks
5985
6200
  * @since 4.0.0
5986
6201
  */
5987
- export const isStringFinite: (annotations?: Annotations.Filter) => AST.Filter<string> = AST.isStringFinite
6202
+ export const isStringFinite: (annotations?: Annotations.Filter) => SchemaAST.Filter<string> = SchemaAST.isStringFinite
5988
6203
 
5989
6204
  /**
5990
6205
  * Validates that a string is a signed base-10 integer literal for Effect's
@@ -6003,7 +6218,7 @@ export const isStringFinite: (annotations?: Annotations.Filter) => AST.Filter<st
6003
6218
  * @category String checks
6004
6219
  * @since 4.0.0
6005
6220
  */
6006
- export const isStringBigInt: (annotations?: Annotations.Filter) => AST.Filter<string> = AST.isStringBigInt
6221
+ export const isStringBigInt: (annotations?: Annotations.Filter) => SchemaAST.Filter<string> = SchemaAST.isStringBigInt
6007
6222
 
6008
6223
  /**
6009
6224
  * Validates that a string has the `Symbol(description)` format used by Effect's
@@ -6017,7 +6232,7 @@ export const isStringBigInt: (annotations?: Annotations.Filter) => AST.Filter<st
6017
6232
  * @category String checks
6018
6233
  * @since 4.0.0
6019
6234
  */
6020
- export const isStringSymbol: (annotations?: Annotations.Filter) => AST.Filter<string> = AST.isStringSymbol
6235
+ export const isStringSymbol: (annotations?: Annotations.Filter) => SchemaAST.Filter<string> = SchemaAST.isStringSymbol
6021
6236
 
6022
6237
  /**
6023
6238
  * Returns a RegExp for validating an RFC 4122 UUID.
@@ -6874,7 +7089,7 @@ export function isInt(annotations?: Annotations.Filter) {
6874
7089
  * @since 4.0.0
6875
7090
  */
6876
7091
  export function isInt32(annotations?: Annotations.Filter) {
6877
- return new AST.FilterGroup(
7092
+ return new SchemaAST.FilterGroup(
6878
7093
  [
6879
7094
  isInt(annotations),
6880
7095
  isBetween({ minimum: -2147483648, maximum: 2147483647 })
@@ -6906,7 +7121,7 @@ export function isInt32(annotations?: Annotations.Filter) {
6906
7121
  * @since 4.0.0
6907
7122
  */
6908
7123
  export function isUint32(annotations?: Annotations.Filter) {
6909
- return new AST.FilterGroup(
7124
+ return new SchemaAST.FilterGroup(
6910
7125
  [
6911
7126
  isInt(),
6912
7127
  isBetween({ minimum: 0, maximum: 4294967295 })
@@ -7377,7 +7592,7 @@ export function isMinLength(minLength: number, annotations?: Annotations.Filter)
7377
7592
  _tag: "isMinLength",
7378
7593
  minLength
7379
7594
  },
7380
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
7595
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7381
7596
  toArbitraryConstraint: {
7382
7597
  string: {
7383
7598
  minLength
@@ -7444,7 +7659,7 @@ export function isMaxLength(maxLength: number, annotations?: Annotations.Filter)
7444
7659
  _tag: "isMaxLength",
7445
7660
  maxLength
7446
7661
  },
7447
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
7662
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7448
7663
  toArbitraryConstraint: {
7449
7664
  string: {
7450
7665
  maxLength
@@ -7492,7 +7707,7 @@ export function isLengthBetween(minimum: number, maximum: number, annotations?:
7492
7707
  minimum,
7493
7708
  maximum
7494
7709
  },
7495
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
7710
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7496
7711
  toArbitraryConstraint: {
7497
7712
  string: {
7498
7713
  minLength: minimum,
@@ -7538,7 +7753,7 @@ export function isMinSize(minSize: number, annotations?: Annotations.Filter) {
7538
7753
  _tag: "isMinSize",
7539
7754
  minSize
7540
7755
  },
7541
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
7756
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7542
7757
  toArbitraryConstraint: {
7543
7758
  array: {
7544
7759
  minLength: minSize
@@ -7579,7 +7794,7 @@ export function isMaxSize(maxSize: number, annotations?: Annotations.Filter) {
7579
7794
  _tag: "isMaxSize",
7580
7795
  maxSize
7581
7796
  },
7582
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
7797
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7583
7798
  toArbitraryConstraint: {
7584
7799
  array: {
7585
7800
  maxLength: maxSize
@@ -7624,7 +7839,7 @@ export function isSizeBetween(minimum: number, maximum: number, annotations?: An
7624
7839
  minimum,
7625
7840
  maximum
7626
7841
  },
7627
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
7842
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7628
7843
  toArbitraryConstraint: {
7629
7844
  array: {
7630
7845
  minLength: minimum,
@@ -7667,7 +7882,7 @@ export function isMinProperties(minProperties: number, annotations?: Annotations
7667
7882
  _tag: "isMinProperties",
7668
7883
  minProperties
7669
7884
  },
7670
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
7885
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7671
7886
  toArbitraryConstraint: {
7672
7887
  array: {
7673
7888
  minLength: minProperties
@@ -7708,7 +7923,7 @@ export function isMaxProperties(maxProperties: number, annotations?: Annotations
7708
7923
  _tag: "isMaxProperties",
7709
7924
  maxProperties
7710
7925
  },
7711
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
7926
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7712
7927
  toArbitraryConstraint: {
7713
7928
  array: {
7714
7929
  maxLength: maxProperties
@@ -7753,7 +7968,7 @@ export function isPropertiesLengthBetween(minimum: number, maximum: number, anno
7753
7968
  minimum,
7754
7969
  maximum
7755
7970
  },
7756
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
7971
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7757
7972
  toArbitraryConstraint: {
7758
7973
  array: {
7759
7974
  minLength: minimum,
@@ -7783,20 +7998,20 @@ export function isPropertiesLengthBetween(minimum: number, maximum: number, anno
7783
7998
  */
7784
7999
  export function isPropertyNames(keySchema: Top, annotations?: Annotations.Filter) {
7785
8000
  const propertyNames = toEncoded(keySchema)
7786
- const parser = Parser._issue(propertyNames.ast)
8001
+ const parser = SchemaParser._issue(propertyNames.ast)
7787
8002
  return makeFilter<object>(
7788
8003
  (input, ast, options) => {
7789
8004
  const keys = Reflect.ownKeys(input)
7790
- const issues: Array<Issue.Issue> = []
8005
+ const issues: Array<SchemaIssue.Issue> = []
7791
8006
  for (const key of keys) {
7792
8007
  const issue = parser(key, options)
7793
8008
  if (issue !== undefined) {
7794
- issues.push(new Issue.Pointer([key], issue))
8009
+ issues.push(new SchemaIssue.Pointer([key], issue))
7795
8010
  if (options.errors === "first") break
7796
8011
  }
7797
8012
  }
7798
8013
  if (Arr.isArrayNonEmpty(issues)) {
7799
- return new Issue.Composite(ast, Option_.some(input), issues)
8014
+ return new SchemaIssue.Composite(ast, Option_.some(input), issues)
7800
8015
  }
7801
8016
  return true
7802
8017
  },
@@ -7806,7 +8021,7 @@ export function isPropertyNames(keySchema: Top, annotations?: Annotations.Filter
7806
8021
  _tag: "isPropertyNames",
7807
8022
  propertyNames: propertyNames.ast
7808
8023
  },
7809
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
8024
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
7810
8025
  ...annotations
7811
8026
  }
7812
8027
  )
@@ -7952,14 +8167,15 @@ export function Option<A extends Top>(value: A): Option<A> {
7952
8167
  return Effect.succeedNone
7953
8168
  }
7954
8169
  return Effect.mapBothEager(
7955
- Parser.decodeUnknownEffect(value)(input.value, options),
8170
+ SchemaParser.decodeUnknownEffect(value)(input.value, options),
7956
8171
  {
7957
8172
  onSuccess: Option_.some,
7958
- onFailure: (issue) => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["value"], issue)])
8173
+ onFailure: (issue) =>
8174
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["value"], issue)])
7959
8175
  }
7960
8176
  )
7961
8177
  }
7962
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
8178
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
7963
8179
  },
7964
8180
  {
7965
8181
  typeConstructor: {
@@ -7977,7 +8193,7 @@ export function Option<A extends Top>(value: A): Option<A> {
7977
8193
  Struct({ _tag: Literal("Some"), value }),
7978
8194
  Struct({ _tag: Literal("None") })
7979
8195
  ]),
7980
- Transformation.transform({
8196
+ SchemaTransformation.transform({
7981
8197
  decode: (e) => e._tag === "None" ? Option_.none() : Option_.some(e.value),
7982
8198
  encode: (o) => (Option_.isSome(o) ? { _tag: "Some", value: o.value } as const : { _tag: "None" } as const)
7983
8199
  })
@@ -8015,13 +8231,8 @@ export interface OptionFromNullOr<S extends Top> extends decodeTo<Option<toType<
8015
8231
  *
8016
8232
  * **Details**
8017
8233
  *
8018
- * Decoding:
8019
- * - `null` is decoded as `None`
8020
- * - other values are decoded as `Some`
8021
- *
8022
- * Encoding:
8023
- * - `None` is encoded as `null`
8024
- * - `Some` is encoded as the value
8234
+ * Decoding maps `null` to `None` and all other values to `Some`. Encoding maps
8235
+ * `None` to `null` and maps `Some` to its value.
8025
8236
  *
8026
8237
  * @category Option
8027
8238
  * @since 3.10.0
@@ -8029,7 +8240,7 @@ export interface OptionFromNullOr<S extends Top> extends decodeTo<Option<toType<
8029
8240
  export function OptionFromNullOr<S extends Top>(schema: S): OptionFromNullOr<S> {
8030
8241
  return NullOr(schema).pipe(decodeTo(
8031
8242
  Option(toType(schema)),
8032
- Transformation.optionFromNullOr()
8243
+ SchemaTransformation.optionFromNullOr()
8033
8244
  ))
8034
8245
  }
8035
8246
 
@@ -8044,17 +8255,13 @@ export interface OptionFromUndefinedOr<S extends Top> extends decodeTo<Option<to
8044
8255
  }
8045
8256
 
8046
8257
  /**
8047
- * Decodes an undefined-or value `T` to a required `Option<T>` value.
8258
+ * Decodes a required value that may be `undefined` to a required `Option<T>`
8259
+ * value.
8048
8260
  *
8049
8261
  * **Details**
8050
8262
  *
8051
- * Decoding:
8052
- * - `undefined` is decoded as `None`
8053
- * - other values are decoded as `Some`
8054
- *
8055
- * Encoding:
8056
- * - `None` is encoded as `undefined`
8057
- * - `Some` is encoded as the value
8263
+ * Decoding maps `undefined` to `None` and all other values to `Some`. Encoding
8264
+ * maps `None` to `undefined` and maps `Some` to its value.
8058
8265
  *
8059
8266
  * @category Option
8060
8267
  * @since 3.10.0
@@ -8062,7 +8269,7 @@ export interface OptionFromUndefinedOr<S extends Top> extends decodeTo<Option<to
8062
8269
  export function OptionFromUndefinedOr<S extends Top>(schema: S): OptionFromUndefinedOr<S> {
8063
8270
  return UndefinedOr(schema).pipe(decodeTo(
8064
8271
  Option(toType(schema)),
8065
- Transformation.optionFromUndefinedOr()
8272
+ SchemaTransformation.optionFromUndefinedOr()
8066
8273
  ))
8067
8274
  }
8068
8275
 
@@ -8081,13 +8288,10 @@ export interface OptionFromNullishOr<S extends Top> extends decodeTo<Option<toTy
8081
8288
  *
8082
8289
  * **Details**
8083
8290
  *
8084
- * Decoding:
8085
- * - `null` and `undefined` are decoded as `None`
8086
- * - other values are decoded as `Some`
8087
- *
8088
- * Encoding:
8089
- * - `None` is encoded as `null` or `undefined` depending on the provided `options.onNoneEncoding` (defaults to `undefined`)
8090
- * - `Some` is encoded as the value
8291
+ * Decoding maps `null` and `undefined` to `None` and all other values to
8292
+ * `Some`. Encoding maps `None` to `null` or `undefined` depending on
8293
+ * `options.onNoneEncoding`, which defaults to `undefined`, and maps `Some` to
8294
+ * its value.
8091
8295
  *
8092
8296
  * @category Option
8093
8297
  * @since 3.10.0
@@ -8100,7 +8304,7 @@ export function OptionFromNullishOr<S extends Top>(
8100
8304
  ): OptionFromNullishOr<S> {
8101
8305
  return NullishOr(schema).pipe(decodeTo(
8102
8306
  Option(toType(schema)),
8103
- Transformation.optionFromNullishOr(options)
8307
+ SchemaTransformation.optionFromNullishOr(options)
8104
8308
  ))
8105
8309
  }
8106
8310
 
@@ -8119,13 +8323,8 @@ export interface OptionFromOptionalKey<S extends Top> extends decodeTo<Option<to
8119
8323
  *
8120
8324
  * **Details**
8121
8325
  *
8122
- * Decoding:
8123
- * - a missing key is decoded as `None`
8124
- * - a present value is decoded as `Some`
8125
- *
8126
- * Encoding:
8127
- * - `None` is encoded as missing key
8128
- * - `Some` is encoded as the value
8326
+ * Decoding maps a missing key to `None` and a present value to `Some`.
8327
+ * Encoding maps `None` to a missing key and maps `Some` to its value.
8129
8328
  *
8130
8329
  * @category Option
8131
8330
  * @since 4.0.0
@@ -8133,7 +8332,7 @@ export interface OptionFromOptionalKey<S extends Top> extends decodeTo<Option<to
8133
8332
  export function OptionFromOptionalKey<S extends Top>(schema: S): OptionFromOptionalKey<S> {
8134
8333
  return optionalKey(schema).pipe(decodeTo(
8135
8334
  Option(toType(schema)),
8136
- Transformation.optionFromOptionalKey()
8335
+ SchemaTransformation.optionFromOptionalKey()
8137
8336
  ))
8138
8337
  }
8139
8338
 
@@ -8148,19 +8347,14 @@ export interface OptionFromOptional<S extends Top> extends decodeTo<Option<toTyp
8148
8347
  }
8149
8348
 
8150
8349
  /**
8151
- * Decodes an optional or `undefined` value `A` to an required `Option<A>`
8350
+ * Decodes an optional or `undefined` value `A` to a required `Option<A>`
8152
8351
  * value.
8153
8352
  *
8154
8353
  * **Details**
8155
8354
  *
8156
- * Decoding:
8157
- * - a missing key is decoded as `None`
8158
- * - a present key with an `undefined` value is decoded as `None`
8159
- * - all other values are decoded as `Some`
8160
- *
8161
- * Encoding:
8162
- * - `None` is encoded as missing key
8163
- * - `Some` is encoded as the value
8355
+ * Decoding maps a missing key or a present `undefined` value to `None`, and
8356
+ * maps all other values to `Some`. Encoding maps `None` to a missing key and
8357
+ * maps `Some` to its value.
8164
8358
  *
8165
8359
  * @category Option
8166
8360
  * @since 4.0.0
@@ -8168,7 +8362,7 @@ export interface OptionFromOptional<S extends Top> extends decodeTo<Option<toTyp
8168
8362
  export function OptionFromOptional<S extends Top>(schema: S): OptionFromOptional<S> {
8169
8363
  return optional(schema).pipe(decodeTo(
8170
8364
  Option(toType(schema)),
8171
- Transformation.optionFromOptional<any>()
8365
+ SchemaTransformation.optionFromOptional<any>()
8172
8366
  ))
8173
8367
  }
8174
8368
 
@@ -8188,17 +8382,10 @@ export interface OptionFromOptionalNullOr<S extends Top> extends decodeTo<Option
8188
8382
  *
8189
8383
  * **Details**
8190
8384
  *
8191
- * Decoding:
8192
- * - a missing key is decoded as `None`
8193
- * - a present key with an `undefined` value is decoded as `None`
8194
- * - a present key with a `null` value is decoded as `None`
8195
- * - all other values are decoded as `Some`
8196
- *
8197
- * Encoding (controlled by `options.onNoneEncoding`):
8198
- * - `"omit"` (default): `None` is encoded as a missing key
8199
- * - `null`: `None` is encoded as `null`
8200
- * - `undefined`: `None` is encoded as `undefined`
8201
- * - `Some` is always encoded as the value
8385
+ * Decoding maps a missing key, `undefined`, or `null` to `None`, and maps all
8386
+ * other values to `Some`. Encoding maps `Some` to its value. `None` is encoded
8387
+ * according to `options.onNoneEncoding`: `"omit"` encodes a missing key,
8388
+ * `null` encodes `null`, and `undefined` encodes `undefined`.
8202
8389
  *
8203
8390
  * @category Option
8204
8391
  * @since 4.0.0
@@ -8215,7 +8402,7 @@ export function OptionFromOptionalNullOr<S extends Top>(
8215
8402
  : undefined as S["Type"] | null | undefined
8216
8403
  return optional(NullOr(schema)).pipe(decodeTo(
8217
8404
  Option(toType(schema)),
8218
- Transformation.transformOptional<Option_.Option<S["Type"]>, S["Type"] | null | undefined>({
8405
+ SchemaTransformation.transformOptional<Option_.Option<S["Type"]>, S["Type"] | null | undefined>({
8219
8406
  decode: (oe) => oe.pipe(Option_.filter(Predicate.isNotNullish), Option_.some),
8220
8407
  encode: onNoneEncoding === "omit"
8221
8408
  ? Option_.flatten
@@ -8276,18 +8463,20 @@ export function Result<A extends Top, E extends Top>(
8276
8463
  [success, failure],
8277
8464
  ([success, failure]) => (input, ast, options) => {
8278
8465
  if (!Result_.isResult(input)) {
8279
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
8466
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
8280
8467
  }
8281
8468
  switch (input._tag) {
8282
8469
  case "Success":
8283
- return Effect.mapBothEager(Parser.decodeEffect(success)(input.success, options), {
8470
+ return Effect.mapBothEager(SchemaParser.decodeEffect(success)(input.success, options), {
8284
8471
  onSuccess: Result_.succeed,
8285
- onFailure: (issue) => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["success"], issue)])
8472
+ onFailure: (issue) =>
8473
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["success"], issue)])
8286
8474
  })
8287
8475
  case "Failure":
8288
- return Effect.mapBothEager(Parser.decodeEffect(failure)(input.failure, options), {
8476
+ return Effect.mapBothEager(SchemaParser.decodeEffect(failure)(input.failure, options), {
8289
8477
  onSuccess: Result_.fail,
8290
- onFailure: (issue) => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["failure"], issue)])
8478
+ onFailure: (issue) =>
8479
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["failure"], issue)])
8291
8480
  })
8292
8481
  }
8293
8482
  },
@@ -8307,7 +8496,7 @@ export function Result<A extends Top, E extends Top>(
8307
8496
  Struct({ _tag: Literal("Success"), success }),
8308
8497
  Struct({ _tag: Literal("Failure"), failure })
8309
8498
  ]),
8310
- Transformation.transform({
8499
+ SchemaTransformation.transform({
8311
8500
  decode: (e): Result_.Result<A["Encoded"], E["Encoded"]> =>
8312
8501
  e._tag === "Success" ? Result_.succeed(e.success) : Result_.fail(e.failure),
8313
8502
  encode: (r) =>
@@ -8379,43 +8568,44 @@ export function Redacted<S extends Top>(value: S, options?: {
8379
8568
  readonly disallowJsonEncode?: boolean | undefined
8380
8569
  }): Redacted<S> {
8381
8570
  const decodeLabel = typeof options?.label === "string"
8382
- ? Parser.decodeUnknownEffect(Literal(options.label))
8571
+ ? SchemaParser.decodeUnknownEffect(Literal(options.label))
8383
8572
  : undefined
8384
8573
  const schema = declareConstructor<Redacted_.Redacted<S["Type"]>, Redacted_.Redacted<S["Encoded"]>>()(
8385
8574
  [value],
8386
8575
  ([value]) => (input, ast, poptions) => {
8387
8576
  if (Redacted_.isRedacted(input)) {
8388
- const label: Effect.Effect<void, Issue.Issue, never> = decodeLabel !== undefined
8577
+ const label: Effect.Effect<void, SchemaIssue.Issue, never> = decodeLabel !== undefined
8389
8578
  ? Effect.mapErrorEager(
8390
8579
  decodeLabel(input.label, poptions),
8391
- (issue) => new Issue.Pointer(["label"], issue)
8580
+ (issue) => new SchemaIssue.Pointer(["label"], issue)
8392
8581
  )
8393
8582
  : Effect.void
8394
8583
  return Effect.flatMapEager(
8395
8584
  label,
8396
8585
  () =>
8397
8586
  Effect.mapBothEager(
8398
- Parser.decodeUnknownEffect(value)(Redacted_.value(input), poptions),
8587
+ SchemaParser.decodeUnknownEffect(value)(Redacted_.value(input), poptions),
8399
8588
  {
8400
8589
  onSuccess: () => input,
8401
8590
  onFailure: (/** ignore the actual issue because of security reasons */) => {
8402
8591
  const oinput = Option_.some(input)
8403
- return new Issue.Composite(ast, oinput, [
8404
- new Issue.Pointer(["value"], new Issue.InvalidValue(oinput))
8592
+ return new SchemaIssue.Composite(ast, oinput, [
8593
+ new SchemaIssue.Pointer(["value"], new SchemaIssue.InvalidValue(oinput))
8405
8594
  ])
8406
8595
  }
8407
8596
  }
8408
8597
  )
8409
8598
  )
8410
8599
  }
8411
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
8600
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
8412
8601
  },
8413
8602
  {
8414
8603
  typeConstructor: {
8415
- _tag: "effect/Redacted"
8604
+ _tag: "effect/Redacted",
8605
+ options
8416
8606
  },
8417
8607
  generation: {
8418
- runtime: `Schema.Redacted(?)`,
8608
+ runtime: options !== undefined ? `Schema.Redacted(?, ${format(options)})` : `Schema.Redacted(?)`,
8419
8609
  Type: `Redacted.Redacted<?>`,
8420
8610
  importDeclaration: `import * as Redacted from "effect/Redacted"`
8421
8611
  },
@@ -8424,13 +8614,13 @@ export function Redacted<S extends Top>(value: S, options?: {
8424
8614
  link<Redacted_.Redacted<S["Encoded"]>>()(
8425
8615
  redact(value),
8426
8616
  {
8427
- decode: Getter.transform((e) => Redacted_.make(e, { label: options?.label })),
8617
+ decode: SchemaGetter.transform((e) => Redacted_.make(e, { label: options?.label })),
8428
8618
  encode: options?.disallowJsonEncode ?
8429
- Getter.forbidden((oe) =>
8619
+ SchemaGetter.forbidden((oe) =>
8430
8620
  "Cannot serialize Redacted" +
8431
8621
  (Option_.isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")
8432
8622
  ) :
8433
- Getter.transform(Redacted_.value)
8623
+ SchemaGetter.transform(Redacted_.value)
8434
8624
  }
8435
8625
  ),
8436
8626
  toArbitrary: ([value]) => () => value.map((a) => Redacted_.make(a, { label: options?.label })),
@@ -8461,7 +8651,7 @@ export interface RedactedFromValue<S extends Top>
8461
8651
  * @since 4.0.0
8462
8652
  */
8463
8653
  export function redact<S extends Top>(schema: S): middlewareDecoding<S, S["DecodingServices"]> {
8464
- return schema.pipe(middlewareDecoding(Effect.mapErrorEager(Issue.redact)))
8654
+ return schema.pipe(middlewareDecoding(Effect.mapErrorEager(SchemaIssue.redact)))
8465
8655
  }
8466
8656
 
8467
8657
  /**
@@ -8483,13 +8673,13 @@ export function RedactedFromValue<S extends Top>(value: S, options?: {
8483
8673
  disallowJsonEncode: options?.disallowEncode
8484
8674
  }),
8485
8675
  {
8486
- decode: Getter.transform((t) => Redacted_.make(t, { label: options?.label })),
8676
+ decode: SchemaGetter.transform((t) => Redacted_.make(t, { label: options?.label })),
8487
8677
  encode: options?.disallowEncode ?
8488
- Getter.forbidden((oe) =>
8678
+ SchemaGetter.forbidden((oe) =>
8489
8679
  "Cannot encode Redacted" +
8490
8680
  (Option_.isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")
8491
8681
  ) :
8492
- Getter.transform(Redacted_.value)
8682
+ SchemaGetter.transform(Redacted_.value)
8493
8683
  }
8494
8684
  )
8495
8685
  )
@@ -8542,8 +8732,8 @@ export type CauseReasonIso<E extends Top, D extends Top> = {
8542
8732
  *
8543
8733
  * **When to use**
8544
8734
  *
8545
- * Use to validate, transform, or serialize individual `Cause.Reason` values
8546
- * when typed failures and unexpected defects need separate schemas.
8735
+ * Use when serializing or decoding individual cause reasons separately from a
8736
+ * full failure cause, with distinct schemas for typed errors and defects.
8547
8737
  *
8548
8738
  * **Details**
8549
8739
  *
@@ -8561,24 +8751,25 @@ export function CauseReason<E extends Top, D extends Top>(error: E, defect: D):
8561
8751
  [error, defect],
8562
8752
  ([error, defect]) => (input, ast, options) => {
8563
8753
  if (!Cause_.isReason(input)) {
8564
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
8754
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
8565
8755
  }
8566
8756
  switch (input._tag) {
8567
8757
  case "Fail":
8568
8758
  return Effect.mapBothEager(
8569
- Parser.decodeUnknownEffect(error)(input.error, options),
8759
+ SchemaParser.decodeUnknownEffect(error)(input.error, options),
8570
8760
  {
8571
8761
  onSuccess: Cause_.makeFailReason,
8572
- onFailure: (issue) => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["error"], issue)])
8762
+ onFailure: (issue) =>
8763
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["error"], issue)])
8573
8764
  }
8574
8765
  )
8575
8766
  case "Die":
8576
8767
  return Effect.mapBothEager(
8577
- Parser.decodeUnknownEffect(defect)(input.defect, options),
8768
+ SchemaParser.decodeUnknownEffect(defect)(input.defect, options),
8578
8769
  {
8579
8770
  onSuccess: Cause_.makeDieReason,
8580
8771
  onFailure: (issue) =>
8581
- new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["defect"], issue)])
8772
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["defect"], issue)])
8582
8773
  }
8583
8774
  )
8584
8775
  case "Interrupt":
@@ -8602,7 +8793,7 @@ export function CauseReason<E extends Top, D extends Top>(error: E, defect: D):
8602
8793
  Struct({ _tag: Literal("Die"), defect }),
8603
8794
  Struct({ _tag: Literal("Interrupt"), fiberId: UndefinedOr(Finite) })
8604
8795
  ]),
8605
- Transformation.transform({
8796
+ SchemaTransformation.transform({
8606
8797
  decode: (e) => {
8607
8798
  switch (e._tag) {
8608
8799
  case "Fail":
@@ -8727,11 +8918,12 @@ export function Cause<E extends Top, D extends Top>(error: E, defect: D): Cause<
8727
8918
  const failures = ArraySchema(CauseReason(error, defect))
8728
8919
  return (input, ast, options) => {
8729
8920
  if (!Cause_.isCause(input)) {
8730
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
8921
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
8731
8922
  }
8732
- return Effect.mapBothEager(Parser.decodeUnknownEffect(failures)(input.reasons, options), {
8923
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(failures)(input.reasons, options), {
8733
8924
  onSuccess: Cause_.fromReasons,
8734
- onFailure: (issue) => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["failures"], issue)])
8925
+ onFailure: (issue) =>
8926
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["failures"], issue)])
8735
8927
  })
8736
8928
  }
8737
8929
  },
@@ -8748,7 +8940,7 @@ export function Cause<E extends Top, D extends Top>(error: E, defect: D): Cause<
8748
8940
  toCodec: ([error, defect]) =>
8749
8941
  link<Cause_.Cause<E["Encoded"]>>()(
8750
8942
  ArraySchema(CauseReason(error, defect)),
8751
- Transformation.transform({
8943
+ SchemaTransformation.transform({
8752
8944
  decode: Cause_.fromReasons,
8753
8945
  encode: ({ reasons: failures }) => failures
8754
8946
  })
@@ -8815,7 +9007,7 @@ export const Error: Error = instanceOf(globalThis.Error, {
8815
9007
  Type: `globalThis.Error`
8816
9008
  },
8817
9009
  expected: "Error",
8818
- toCodecJson: () => link<globalThis.Error>()(ErrorJsonEncoded, Transformation.errorFromErrorJsonEncoded()),
9010
+ toCodecJson: () => link<globalThis.Error>()(ErrorJsonEncoded, SchemaTransformation.errorFromErrorJsonEncoded()),
8819
9011
  toArbitrary: () => (fc) => fc.string().map((message) => new globalThis.Error(message))
8820
9012
  })
8821
9013
 
@@ -8844,7 +9036,7 @@ export const ErrorWithStack: Error = instanceOf(globalThis.Error, {
8844
9036
  toCodecJson: () =>
8845
9037
  link<globalThis.Error>()(
8846
9038
  ErrorJsonEncoded,
8847
- Transformation.errorFromErrorJsonEncoded({
9039
+ SchemaTransformation.errorFromErrorJsonEncoded({
8848
9040
  includeStack: true
8849
9041
  })
8850
9042
  ),
@@ -8875,9 +9067,9 @@ export interface Defect extends
8875
9067
  readonly "Rebuild": Defect
8876
9068
  }
8877
9069
 
8878
- const defectTransformation = new Transformation.Transformation(
8879
- Getter.passthrough(),
8880
- Getter.transform((u) => {
9070
+ const defectTransformation = new SchemaTransformation.Transformation(
9071
+ SchemaGetter.passthrough(),
9072
+ SchemaGetter.transform((u) => {
8881
9073
  try {
8882
9074
  return JSON.parse(JSON.stringify(u))
8883
9075
  } catch {
@@ -8900,7 +9092,7 @@ const defectTransformation = new Transformation.Transformation(
8900
9092
  * @since 3.10.0
8901
9093
  */
8902
9094
  export const Defect: Defect = Union([
8903
- ErrorJsonEncoded.pipe(decodeTo(Error, Transformation.errorFromErrorJsonEncoded())),
9095
+ ErrorJsonEncoded.pipe(decodeTo(Error, SchemaTransformation.errorFromErrorJsonEncoded())),
8904
9096
  Any.pipe(decodeTo(
8905
9097
  Unknown.annotate({
8906
9098
  toCodecJson: () => link<unknown>()(Any, defectTransformation),
@@ -8919,7 +9111,7 @@ export const Defect: Defect = Union([
8919
9111
  export const DefectWithStack: Defect = Union([
8920
9112
  ErrorJsonEncoded.pipe(decodeTo(
8921
9113
  ErrorWithStack,
8922
- Transformation.errorFromErrorJsonEncoded({
9114
+ SchemaTransformation.errorFromErrorJsonEncoded({
8923
9115
  includeStack: true
8924
9116
  })
8925
9117
  )),
@@ -8975,6 +9167,11 @@ export type ExitIso<A extends Top, E extends Top, D extends Top> = {
8975
9167
  * Creates a schema for `Exit` values using schemas for the success value, typed
8976
9168
  * failure, and unexpected defect channels.
8977
9169
  *
9170
+ * **When to use**
9171
+ *
9172
+ * Use when serializing or validating an effect outcome where success, typed
9173
+ * failure, and defects each need their own schema.
9174
+ *
8978
9175
  * @category Exit
8979
9176
  * @since 3.10.0
8980
9177
  */
@@ -8989,25 +9186,25 @@ export function Exit<A extends Top, E extends Top, D extends Top>(value: A, erro
8989
9186
  const cause = Cause(error, defect)
8990
9187
  return (input, ast, options) => {
8991
9188
  if (!Exit_.isExit(input)) {
8992
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
9189
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
8993
9190
  }
8994
9191
  switch (input._tag) {
8995
9192
  case "Success":
8996
9193
  return Effect.mapBothEager(
8997
- Parser.decodeUnknownEffect(value)(input.value, options),
9194
+ SchemaParser.decodeUnknownEffect(value)(input.value, options),
8998
9195
  {
8999
9196
  onSuccess: Exit_.succeed,
9000
9197
  onFailure: (issue) =>
9001
- new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["value"], issue)])
9198
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["value"], issue)])
9002
9199
  }
9003
9200
  )
9004
9201
  case "Failure":
9005
9202
  return Effect.mapBothEager(
9006
- Parser.decodeUnknownEffect(cause)(input.cause, options),
9203
+ SchemaParser.decodeUnknownEffect(cause)(input.cause, options),
9007
9204
  {
9008
9205
  onSuccess: Exit_.failCause,
9009
9206
  onFailure: (issue) =>
9010
- new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["cause"], issue)])
9207
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["cause"], issue)])
9011
9208
  }
9012
9209
  )
9013
9210
  }
@@ -9029,7 +9226,7 @@ export function Exit<A extends Top, E extends Top, D extends Top>(value: A, erro
9029
9226
  Struct({ _tag: Literal("Success"), value }),
9030
9227
  Struct({ _tag: Literal("Failure"), cause: Cause(error, defect) })
9031
9228
  ]),
9032
- Transformation.transform({
9229
+ SchemaTransformation.transform({
9033
9230
  decode: (e): Exit_.Exit<A["Encoded"], E["Encoded"]> =>
9034
9231
  e._tag === "Success" ? Exit_.succeed(e.value) : Exit_.failCause(e.cause),
9035
9232
  encode: (exit) =>
@@ -9119,15 +9316,15 @@ export function ReadonlyMap<Key extends Top, Value extends Top>(key: Key, value:
9119
9316
  return (input, ast, options) => {
9120
9317
  if (input instanceof globalThis.Map) {
9121
9318
  return Effect.mapBothEager(
9122
- Parser.decodeUnknownEffect(array)([...input], options),
9319
+ SchemaParser.decodeUnknownEffect(array)([...input], options),
9123
9320
  {
9124
9321
  onSuccess: (array: ReadonlyArray<readonly [Key["Type"], Value["Type"]]>) => new globalThis.Map(array),
9125
9322
  onFailure: (issue) =>
9126
- new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["entries"], issue)])
9323
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["entries"], issue)])
9127
9324
  }
9128
9325
  )
9129
9326
  }
9130
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
9327
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
9131
9328
  }
9132
9329
  },
9133
9330
  {
@@ -9142,7 +9339,7 @@ export function ReadonlyMap<Key extends Top, Value extends Top>(key: Key, value:
9142
9339
  toCodec: ([key, value]) =>
9143
9340
  link<globalThis.Map<Key["Encoded"], Value["Encoded"]>>()(
9144
9341
  ArraySchema(Tuple([key, value])),
9145
- Transformation.transform({
9342
+ SchemaTransformation.transform({
9146
9343
  decode: (e) => new globalThis.Map(e),
9147
9344
  encode: (map) => [...map.entries()]
9148
9345
  })
@@ -9214,15 +9411,15 @@ export function HashMap<Key extends Top, Value extends Top>(key: Key, value: Val
9214
9411
  return (input, ast, options) => {
9215
9412
  if (HashMap_.isHashMap(input)) {
9216
9413
  return Effect.mapBothEager(
9217
- Parser.decodeUnknownEffect(entries)(HashMap_.toEntries(input), options),
9414
+ SchemaParser.decodeUnknownEffect(entries)(HashMap_.toEntries(input), options),
9218
9415
  {
9219
9416
  onSuccess: HashMap_.fromIterable,
9220
9417
  onFailure: (issue) =>
9221
- new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["entries"], issue)])
9418
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["entries"], issue)])
9222
9419
  }
9223
9420
  )
9224
9421
  }
9225
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
9422
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
9226
9423
  }
9227
9424
  },
9228
9425
  {
@@ -9238,7 +9435,7 @@ export function HashMap<Key extends Top, Value extends Top>(key: Key, value: Val
9238
9435
  toCodec: ([key, value]) =>
9239
9436
  link<HashMap_.HashMap<Key["Encoded"], Value["Encoded"]>>()(
9240
9437
  ArraySchema(Tuple([key, value])),
9241
- Transformation.transform({
9438
+ SchemaTransformation.transform({
9242
9439
  decode: HashMap_.fromIterable,
9243
9440
  encode: HashMap_.toEntries
9244
9441
  })
@@ -9309,15 +9506,15 @@ export function ReadonlySet<Value extends Top>(value: Value): $ReadonlySet<Value
9309
9506
  return (input, ast, options) => {
9310
9507
  if (input instanceof globalThis.Set) {
9311
9508
  return Effect.mapBothEager(
9312
- Parser.decodeUnknownEffect(array)([...input], options),
9509
+ SchemaParser.decodeUnknownEffect(array)([...input], options),
9313
9510
  {
9314
9511
  onSuccess: (array: ReadonlyArray<Value["Type"]>) => new globalThis.Set(array),
9315
9512
  onFailure: (issue) =>
9316
- new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["values"], issue)])
9513
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["values"], issue)])
9317
9514
  }
9318
9515
  )
9319
9516
  }
9320
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
9517
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
9321
9518
  }
9322
9519
  },
9323
9520
  {
@@ -9332,7 +9529,7 @@ export function ReadonlySet<Value extends Top>(value: Value): $ReadonlySet<Value
9332
9529
  toCodec: ([value]) =>
9333
9530
  link<globalThis.Set<Value["Encoded"]>>()(
9334
9531
  ArraySchema(value),
9335
- Transformation.transform({
9532
+ SchemaTransformation.transform({
9336
9533
  decode: (e) => new globalThis.Set(e),
9337
9534
  encode: (set) => [...set.values()]
9338
9535
  })
@@ -9403,15 +9600,15 @@ export function HashSet<Value extends Top>(value: Value): HashSet<Value> {
9403
9600
  return (input, ast, options) => {
9404
9601
  if (HashSet_.isHashSet(input)) {
9405
9602
  return Effect.mapBothEager(
9406
- Parser.decodeUnknownEffect(values)(Arr.fromIterable(input), options),
9603
+ SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options),
9407
9604
  {
9408
9605
  onSuccess: HashSet_.fromIterable,
9409
9606
  onFailure: (issue) =>
9410
- new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["values"], issue)])
9607
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["values"], issue)])
9411
9608
  }
9412
9609
  )
9413
9610
  }
9414
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
9611
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
9415
9612
  }
9416
9613
  },
9417
9614
  {
@@ -9426,7 +9623,7 @@ export function HashSet<Value extends Top>(value: Value): HashSet<Value> {
9426
9623
  toCodec: ([value]) =>
9427
9624
  link<HashSet_.HashSet<Value["Encoded"]>>()(
9428
9625
  ArraySchema(value),
9429
- Transformation.transform({
9626
+ SchemaTransformation.transform({
9430
9627
  decode: HashSet_.fromIterable,
9431
9628
  encode: Arr.fromIterable
9432
9629
  })
@@ -9504,15 +9701,15 @@ export function Chunk<Value extends Top>(value: Value): Chunk<Value> {
9504
9701
  return (input, ast, options) => {
9505
9702
  if (Chunk_.isChunk(input)) {
9506
9703
  return Effect.mapBothEager(
9507
- Parser.decodeUnknownEffect(values)(Arr.fromIterable(input), options),
9704
+ SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options),
9508
9705
  {
9509
9706
  onSuccess: Chunk_.fromIterable,
9510
9707
  onFailure: (issue) =>
9511
- new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["values"], issue)])
9708
+ new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["values"], issue)])
9512
9709
  }
9513
9710
  )
9514
9711
  }
9515
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
9712
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
9516
9713
  }
9517
9714
  },
9518
9715
  {
@@ -9527,7 +9724,7 @@ export function Chunk<Value extends Top>(value: Value): Chunk<Value> {
9527
9724
  toCodec: ([value]) =>
9528
9725
  link<Chunk_.Chunk<Value["Encoded"]>>()(
9529
9726
  ArraySchema(value),
9530
- Transformation.transform({
9727
+ SchemaTransformation.transform({
9531
9728
  decode: Chunk_.fromIterable,
9532
9729
  encode: Arr.fromIterable
9533
9730
  })
@@ -9590,11 +9787,11 @@ export const RegExp: RegExp = instanceOf(
9590
9787
  source: String,
9591
9788
  flags: String
9592
9789
  }),
9593
- Transformation.transformOrFail({
9790
+ SchemaTransformation.transformOrFail({
9594
9791
  decode: (e) =>
9595
9792
  Effect.try({
9596
9793
  try: () => new globalThis.RegExp(e.source, e.flags),
9597
- catch: (e) => new Issue.InvalidValue(Option_.some(e), { message: globalThis.String(e) })
9794
+ catch: (e) => new SchemaIssue.InvalidValue(Option_.some(e), { message: globalThis.String(e) })
9598
9795
  }),
9599
9796
  encode: (regExp) =>
9600
9797
  Effect.succeed({
@@ -9667,7 +9864,7 @@ export const URL: URL = instanceOf(
9667
9864
  toCodecJson: () =>
9668
9865
  link<globalThis.URL>()(
9669
9866
  URLString,
9670
- Transformation.urlFromString
9867
+ SchemaTransformation.urlFromString
9671
9868
  ),
9672
9869
  toArbitrary: () => (fc) => fc.webUrl().map((s) => new globalThis.URL(s)),
9673
9870
  toEquivalence: () => (a, b) => a.toString() === b.toString()
@@ -9698,7 +9895,7 @@ export interface URLFromString extends decodeTo<URL, String> {
9698
9895
  * @category URL
9699
9896
  * @since 4.0.0
9700
9897
  */
9701
- export const URLFromString: URLFromString = URLString.pipe(decodeTo(URL, Transformation.urlFromString))
9898
+ export const URLFromString: URLFromString = URLString.pipe(decodeTo(URL, SchemaTransformation.urlFromString))
9702
9899
 
9703
9900
  /**
9704
9901
  * Type-level representation of {@link Date}.
@@ -9717,8 +9914,8 @@ const DateString = String.annotate({ expected: "a string in ISO 8601 format that
9717
9914
  *
9718
9915
  * **When to use**
9719
9916
  *
9720
- * Use to validate in-memory values that must already be JavaScript `Date`
9721
- * instances.
9917
+ * Use to validate in-memory values that must already be JavaScript date
9918
+ * objects.
9722
9919
  *
9723
9920
  * **Details**
9724
9921
  *
@@ -9754,7 +9951,7 @@ export const Date: Date = instanceOf(
9754
9951
  toCodecJson: () =>
9755
9952
  link<globalThis.Date>()(
9756
9953
  DateString,
9757
- Transformation.dateFromString
9954
+ SchemaTransformation.dateFromString
9758
9955
  ),
9759
9956
  toArbitrary: () => (fc, ctx) => fc.date(ctx?.constraints?.date)
9760
9957
  }
@@ -9797,7 +9994,7 @@ export interface DateFromString extends decodeTo<Date, String> {
9797
9994
  * @category Date
9798
9995
  * @since 3.10.0
9799
9996
  */
9800
- export const DateFromString: DateFromString = DateString.pipe(decodeTo(Date, Transformation.dateFromString))
9997
+ export const DateFromString: DateFromString = DateString.pipe(decodeTo(Date, SchemaTransformation.dateFromString))
9801
9998
 
9802
9999
  /**
9803
10000
  * Type-level representation of {@link DateValid}.
@@ -9873,7 +10070,7 @@ export const Duration: Duration = declare(
9873
10070
  Struct({ _tag: Literal("Nanos"), value: BigInt }),
9874
10071
  Struct({ _tag: Literal("Millis"), value: Int })
9875
10072
  ]),
9876
- Transformation.transform({
10073
+ SchemaTransformation.transform({
9877
10074
  decode: (e) => {
9878
10075
  switch (e._tag) {
9879
10076
  case "Infinity":
@@ -9940,7 +10137,7 @@ export interface DurationFromString extends decodeTo<Duration, String> {
9940
10137
  * @since 4.0.0
9941
10138
  */
9942
10139
  export const DurationFromString: DurationFromString = DurationString.pipe(
9943
- decodeTo(Duration, Transformation.durationFromString)
10140
+ decodeTo(Duration, SchemaTransformation.durationFromString)
9944
10141
  )
9945
10142
 
9946
10143
  /**
@@ -9973,7 +10170,7 @@ const bigint0 = globalThis.BigInt(0)
9973
10170
  * @since 3.10.0
9974
10171
  */
9975
10172
  export const DurationFromNanos: DurationFromNanos = BigInt.check(isGreaterThanOrEqualToBigInt(bigint0)).pipe(
9976
- decodeTo(Duration, Transformation.durationFromNanos)
10173
+ decodeTo(Duration, SchemaTransformation.durationFromNanos)
9977
10174
  )
9978
10175
 
9979
10176
  /**
@@ -10005,7 +10202,7 @@ export interface DurationFromMillis extends decodeTo<Duration, Number> {
10005
10202
  * @since 3.10.0
10006
10203
  */
10007
10204
  export const DurationFromMillis: DurationFromMillis = Number.check(isGreaterThanOrEqualTo(0)).pipe(
10008
- decodeTo(Duration, Transformation.durationFromMillis)
10205
+ decodeTo(Duration, SchemaTransformation.durationFromMillis)
10009
10206
  )
10010
10207
 
10011
10208
  /**
@@ -10025,7 +10222,7 @@ const BigDecimalString = String.annotate({ expected: "a string that will be deco
10025
10222
  *
10026
10223
  * **When to use**
10027
10224
  *
10028
- * Use when values are already Effect decimal instances and need schema
10225
+ * Use when you already have Effect decimal instances and need schema
10029
10226
  * validation, formatting, equivalence, and JSON string serialization.
10030
10227
  *
10031
10228
  * **Details**
@@ -10054,7 +10251,7 @@ export const BigDecimal: BigDecimal = declare(
10054
10251
  toCodecJson: () =>
10055
10252
  link<BigDecimal_.BigDecimal>()(
10056
10253
  BigDecimalString,
10057
- Transformation.bigDecimalFromString
10254
+ SchemaTransformation.bigDecimalFromString
10058
10255
  ),
10059
10256
  toArbitrary: () => (fc) =>
10060
10257
  fc.tuple(fc.bigInt(), fc.integer({ min: 0, max: 20 }))
@@ -10102,7 +10299,7 @@ export interface BigDecimalFromString extends decodeTo<BigDecimal, String> {
10102
10299
  * @since 4.0.0
10103
10300
  */
10104
10301
  export const BigDecimalFromString: BigDecimalFromString = BigDecimalString.pipe(
10105
- decodeTo(BigDecimal, Transformation.bigDecimalFromString)
10302
+ decodeTo(BigDecimal, SchemaTransformation.bigDecimalFromString)
10106
10303
  )
10107
10304
 
10108
10305
  /**
@@ -10222,8 +10419,8 @@ export function fromJsonString<S extends Top>(schema: S): fromJsonString<S> {
10222
10419
  return String.annotate({
10223
10420
  expected: "a string that will be decoded as JSON",
10224
10421
  contentMediaType: "application/json",
10225
- contentSchema: AST.toEncoded(schema.ast)
10226
- }).pipe(decodeTo(schema, Transformation.fromJsonString))
10422
+ contentSchema: SchemaAST.toEncoded(schema.ast)
10423
+ }).pipe(decodeTo(schema, SchemaTransformation.fromJsonString))
10227
10424
  }
10228
10425
 
10229
10426
  /**
@@ -10264,12 +10461,12 @@ export const File: File = instanceOf(globalThis.File, {
10264
10461
  name: String,
10265
10462
  lastModified: Number
10266
10463
  }),
10267
- Transformation.transformOrFail({
10464
+ SchemaTransformation.transformOrFail({
10268
10465
  decode: (e) =>
10269
10466
  Result_.match(Encoding.decodeBase64(e.data), {
10270
10467
  onFailure: (error) =>
10271
10468
  Effect.fail(
10272
- new Issue.InvalidValue(Option_.some(e.data), {
10469
+ new SchemaIssue.InvalidValue(Option_.some(e.data), {
10273
10470
  message: error.message
10274
10471
  })
10275
10472
  ),
@@ -10292,7 +10489,7 @@ export const File: File = instanceOf(globalThis.File, {
10292
10489
  }
10293
10490
  },
10294
10491
  catch: (e) =>
10295
- new Issue.InvalidValue(Option_.some(file), {
10492
+ new SchemaIssue.InvalidValue(Option_.some(file), {
10296
10493
  message: globalThis.String(e)
10297
10494
  })
10298
10495
  })
@@ -10341,7 +10538,7 @@ export const FormData: FormData = instanceOf(globalThis.FormData, {
10341
10538
  ])
10342
10539
  ])
10343
10540
  ),
10344
- Transformation.transformOrFail({
10541
+ SchemaTransformation.transformOrFail({
10345
10542
  decode: (e) => {
10346
10543
  const out = new globalThis.FormData()
10347
10544
  for (const [key, entry] of e) {
@@ -10463,7 +10660,7 @@ export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
10463
10660
  * @since 4.0.0
10464
10661
  */
10465
10662
  export function fromFormData<S extends Top>(schema: S): fromFormData<S> {
10466
- return FormData.pipe(decodeTo(schema, Transformation.fromFormData))
10663
+ return FormData.pipe(decodeTo(schema, SchemaTransformation.fromFormData))
10467
10664
  }
10468
10665
 
10469
10666
  /**
@@ -10498,7 +10695,7 @@ export const URLSearchParams: URLSearchParams = instanceOf(globalThis.URLSearchP
10498
10695
  toCodecJson: () =>
10499
10696
  link<globalThis.URLSearchParams>()(
10500
10697
  String.annotate({ expected: "a query string that will be decoded as URLSearchParams" }),
10501
- Transformation.transform({
10698
+ SchemaTransformation.transform({
10502
10699
  decode: (e) => new globalThis.URLSearchParams(e),
10503
10700
  encode: (params) => params.toString()
10504
10701
  })
@@ -10596,7 +10793,7 @@ export interface fromURLSearchParams<S extends Top> extends decodeTo<S, URLSearc
10596
10793
  * @since 4.0.0
10597
10794
  */
10598
10795
  export function fromURLSearchParams<S extends Top>(schema: S): fromURLSearchParams<S> {
10599
- return URLSearchParams.pipe(decodeTo(schema, Transformation.fromURLSearchParams))
10796
+ return URLSearchParams.pipe(decodeTo(schema, SchemaTransformation.fromURLSearchParams))
10600
10797
  }
10601
10798
 
10602
10799
  /**
@@ -10664,7 +10861,7 @@ export interface NumberFromString extends decodeTo<Finite, String> {
10664
10861
  */
10665
10862
  export const NumberFromString: NumberFromString = String.annotate({
10666
10863
  expected: "a string that will be decoded as a number"
10667
- }).pipe(decodeTo(Number, Transformation.numberFromString))
10864
+ }).pipe(decodeTo(Number, SchemaTransformation.numberFromString))
10668
10865
 
10669
10866
  /**
10670
10867
  * Type-level representation of {@link FiniteFromString}.
@@ -10693,7 +10890,7 @@ export interface FiniteFromString extends decodeTo<Finite, String> {
10693
10890
  */
10694
10891
  export const FiniteFromString: FiniteFromString = String.annotate({
10695
10892
  expected: "a string that will be decoded as a finite number"
10696
- }).pipe(decodeTo(Finite, Transformation.numberFromString))
10893
+ }).pipe(decodeTo(Finite, SchemaTransformation.numberFromString))
10697
10894
 
10698
10895
  /**
10699
10896
  * Type-level representation of {@link BigIntFromString}.
@@ -10733,8 +10930,8 @@ export interface BigIntFromString extends decodeTo<BigInt, String> {
10733
10930
  * @category BigInt
10734
10931
  * @since 4.0.0
10735
10932
  */
10736
- export const BigIntFromString: BigIntFromString = make<String>(AST.bigIntString).pipe(
10737
- decodeTo(BigInt, Transformation.bigintFromString)
10933
+ export const BigIntFromString: BigIntFromString = make<String>(SchemaAST.bigIntString).pipe(
10934
+ decodeTo(BigInt, SchemaTransformation.bigintFromString)
10738
10935
  )
10739
10936
 
10740
10937
  /**
@@ -10781,7 +10978,7 @@ export interface Trim extends decodeTo<Trimmed, String> {
10781
10978
  */
10782
10979
  export const Trim: Trim = String.annotate({
10783
10980
  expected: "a string that will be decoded as a trimmed string"
10784
- }).pipe(decodeTo(Trimmed, Transformation.trim()))
10981
+ }).pipe(decodeTo(Trimmed, SchemaTransformation.trim()))
10785
10982
 
10786
10983
  /**
10787
10984
  * Type-level representation of {@link StringFromBase64}.
@@ -10810,7 +11007,7 @@ export interface StringFromBase64 extends decodeTo<String, String> {
10810
11007
  export const StringFromBase64: StringFromBase64 = String.annotate({
10811
11008
  expected: "a base64 encoded string that will be decoded as a UTF-8 string"
10812
11009
  }).pipe(
10813
- decodeTo(String, Transformation.stringFromBase64String)
11010
+ decodeTo(String, SchemaTransformation.stringFromBase64String)
10814
11011
  )
10815
11012
 
10816
11013
  /**
@@ -10840,7 +11037,7 @@ export interface StringFromBase64Url extends decodeTo<String, String> {
10840
11037
  export const StringFromBase64Url: StringFromBase64Url = String.annotate({
10841
11038
  expected: "a base64 (URL) encoded string that will be decoded as a UTF-8 string"
10842
11039
  }).pipe(
10843
- decodeTo(String, Transformation.stringFromBase64UrlString)
11040
+ decodeTo(String, SchemaTransformation.stringFromBase64UrlString)
10844
11041
  )
10845
11042
 
10846
11043
  /**
@@ -10870,7 +11067,7 @@ export interface StringFromHex extends decodeTo<String, String> {
10870
11067
  export const StringFromHex: StringFromHex = String.annotate({
10871
11068
  expected: "a hex encoded string that will be decoded as a UTF-8 string"
10872
11069
  }).pipe(
10873
- decodeTo(String, Transformation.stringFromHexString)
11070
+ decodeTo(String, SchemaTransformation.stringFromHexString)
10874
11071
  )
10875
11072
 
10876
11073
  /**
@@ -10919,7 +11116,7 @@ export interface StringFromUriComponent extends decodeTo<String, String> {
10919
11116
  export const StringFromUriComponent: StringFromUriComponent = String.annotate({
10920
11117
  expected: "a URI component encoded string that will be decoded as a UTF-8 string"
10921
11118
  }).pipe(
10922
- decodeTo(String, Transformation.stringFromUriComponent)
11119
+ decodeTo(String, SchemaTransformation.stringFromUriComponent)
10923
11120
  )
10924
11121
 
10925
11122
  /**
@@ -10981,7 +11178,7 @@ export interface BooleanFromBit extends decodeTo<Boolean, Literals<readonly [0,
10981
11178
  export const BooleanFromBit: BooleanFromBit = Literals([0, 1]).pipe(
10982
11179
  decodeTo(
10983
11180
  Boolean,
10984
- Transformation.transform({
11181
+ SchemaTransformation.transform({
10985
11182
  decode: (bit) => bit === 1,
10986
11183
  encode: (bool) => bool ? 1 : 0
10987
11184
  })
@@ -11028,7 +11225,7 @@ export const Uint8Array: Uint8Array = instanceOf(globalThis.Uint8Array<ArrayBuff
11028
11225
  toCodecJson: () =>
11029
11226
  link<globalThis.Uint8Array<ArrayBufferLike>>()(
11030
11227
  Base64String,
11031
- Transformation.uint8ArrayFromBase64String
11228
+ SchemaTransformation.uint8ArrayFromBase64String
11032
11229
  ),
11033
11230
  toArbitrary: () => (fc) => fc.uint8Array()
11034
11231
  })
@@ -11059,7 +11256,7 @@ export interface Uint8ArrayFromBase64 extends decodeTo<Uint8Array, String> {
11059
11256
  * @since 3.10.0
11060
11257
  */
11061
11258
  export const Uint8ArrayFromBase64: Uint8ArrayFromBase64 = Base64String.pipe(
11062
- decodeTo(Uint8Array, Transformation.uint8ArrayFromBase64String)
11259
+ decodeTo(Uint8Array, SchemaTransformation.uint8ArrayFromBase64String)
11063
11260
  )
11064
11261
 
11065
11262
  /**
@@ -11091,8 +11288,8 @@ export const Uint8ArrayFromBase64Url: Uint8ArrayFromBase64Url = String.annotate(
11091
11288
  expected: "a base64 (URL) encoded string that will be decoded as a Uint8Array"
11092
11289
  }).pipe(
11093
11290
  decodeTo(Uint8Array, {
11094
- decode: Getter.decodeBase64Url(),
11095
- encode: Getter.encodeBase64Url()
11291
+ decode: SchemaGetter.decodeBase64Url(),
11292
+ encode: SchemaGetter.encodeBase64Url()
11096
11293
  })
11097
11294
  )
11098
11295
 
@@ -11125,8 +11322,8 @@ export const Uint8ArrayFromHex: Uint8ArrayFromHex = String.annotate({
11125
11322
  expected: "a hex encoded string that will be decoded as a Uint8Array"
11126
11323
  }).pipe(
11127
11324
  decodeTo(Uint8Array, {
11128
- decode: Getter.decodeHex(),
11129
- encode: Getter.encodeHex()
11325
+ decode: SchemaGetter.decodeHex(),
11326
+ encode: SchemaGetter.encodeHex()
11130
11327
  })
11131
11328
  )
11132
11329
 
@@ -11176,7 +11373,7 @@ export const DateTimeUtc: DateTimeUtc = declare(
11176
11373
  toCodecJson: () =>
11177
11374
  link<DateTime.Utc>()(
11178
11375
  String,
11179
- Transformation.dateTimeUtcFromString
11376
+ SchemaTransformation.dateTimeUtcFromString
11180
11377
  ),
11181
11378
  toArbitrary: () => (fc, ctx) =>
11182
11379
  fc.date({ noInvalidDate: true, ...ctx?.constraints?.date }).map((date) => DateTime.fromDateUnsafe(date)),
@@ -11200,8 +11397,8 @@ export interface DateTimeUtcFromDate extends decodeTo<DateTimeUtc, Date> {
11200
11397
  *
11201
11398
  * **When to use**
11202
11399
  *
11203
- * Use when a boundary provides valid JavaScript `Date` objects but the decoded
11204
- * model should use `DateTime.Utc`.
11400
+ * Use when you need to decode valid JavaScript `Date` objects into
11401
+ * `DateTime.Utc` values.
11205
11402
  *
11206
11403
  * **Details**
11207
11404
  *
@@ -11221,8 +11418,8 @@ export interface DateTimeUtcFromDate extends decodeTo<DateTimeUtc, Date> {
11221
11418
  */
11222
11419
  export const DateTimeUtcFromDate: DateTimeUtcFromDate = DateValid.pipe(
11223
11420
  decodeTo(DateTimeUtc, {
11224
- decode: Getter.dateTimeUtcFromInput(),
11225
- encode: Getter.transform(DateTime.toDateUtc)
11421
+ decode: SchemaGetter.dateTimeUtcFromInput(),
11422
+ encode: SchemaGetter.transform(DateTime.toDateUtc)
11226
11423
  })
11227
11424
  )
11228
11425
 
@@ -11258,7 +11455,7 @@ export const DateTimeUtcFromString: DateTimeUtcFromString = String.annotate({
11258
11455
  }).pipe(
11259
11456
  decodeTo(
11260
11457
  DateTimeUtc,
11261
- Transformation.dateTimeUtcFromString
11458
+ SchemaTransformation.dateTimeUtcFromString
11262
11459
  )
11263
11460
  )
11264
11461
 
@@ -11288,8 +11485,8 @@ export interface DateTimeUtcFromMillis extends decodeTo<instanceOf<DateTime.Utc>
11288
11485
  */
11289
11486
  export const DateTimeUtcFromMillis: DateTimeUtcFromMillis = Number.pipe(
11290
11487
  decodeTo(DateTimeUtc, {
11291
- decode: Getter.dateTimeUtcFromInput(),
11292
- encode: Getter.transform(DateTime.toEpochMillis)
11488
+ decode: SchemaGetter.dateTimeUtcFromInput(),
11489
+ encode: SchemaGetter.transform(DateTime.toEpochMillis)
11293
11490
  })
11294
11491
  )
11295
11492
 
@@ -11330,7 +11527,7 @@ export const TimeZoneOffset: TimeZoneOffset = declare(
11330
11527
  toCodecJson: () =>
11331
11528
  link<DateTime.TimeZone.Offset>()(
11332
11529
  Number,
11333
- Transformation.timeZoneOffsetFromNumber
11530
+ SchemaTransformation.timeZoneOffsetFromNumber
11334
11531
  ),
11335
11532
  toArbitrary: () => (fc) =>
11336
11533
  fc.integer({ min: -12 * 60 * 60 * 1000, max: 14 * 60 * 60 * 1000 }).map((n) => DateTime.zoneMakeOffset(n)),
@@ -11378,7 +11575,7 @@ export const TimeZoneNamed: TimeZoneNamed = declare(
11378
11575
  toCodecJson: () =>
11379
11576
  link<DateTime.TimeZone.Named>()(
11380
11577
  TimeZoneNamedString,
11381
- Transformation.timeZoneNamedFromString
11578
+ SchemaTransformation.timeZoneNamedFromString
11382
11579
  ),
11383
11580
  toArbitrary: () => (fc) =>
11384
11581
  fc.constantFrom(
@@ -11416,7 +11613,7 @@ export interface TimeZoneNamedFromString extends decodeTo<TimeZoneNamed, String>
11416
11613
  * @since 4.0.0
11417
11614
  */
11418
11615
  export const TimeZoneNamedFromString: TimeZoneNamedFromString = TimeZoneNamedString.pipe(
11419
- decodeTo(TimeZoneNamed, Transformation.timeZoneNamedFromString)
11616
+ decodeTo(TimeZoneNamed, SchemaTransformation.timeZoneNamedFromString)
11420
11617
  )
11421
11618
 
11422
11619
  /**
@@ -11461,7 +11658,7 @@ export const TimeZone: TimeZone = declare(
11461
11658
  toCodecJson: () =>
11462
11659
  link<DateTime.TimeZone>()(
11463
11660
  TimeZoneString,
11464
- Transformation.timeZoneFromString
11661
+ SchemaTransformation.timeZoneFromString
11465
11662
  ),
11466
11663
  toArbitrary: () => (fc) =>
11467
11664
  fc.oneof(
@@ -11502,7 +11699,7 @@ export interface TimeZoneFromString extends decodeTo<TimeZone, String> {
11502
11699
  * @since 4.0.0
11503
11700
  */
11504
11701
  export const TimeZoneFromString: TimeZoneFromString = TimeZoneString.pipe(
11505
- decodeTo(TimeZone, Transformation.timeZoneFromString)
11702
+ decodeTo(TimeZone, SchemaTransformation.timeZoneFromString)
11506
11703
  )
11507
11704
 
11508
11705
  /**
@@ -11549,7 +11746,7 @@ export const DateTimeZoned: DateTimeZoned = declare(
11549
11746
  toCodecJson: () =>
11550
11747
  link<DateTime.Zoned>()(
11551
11748
  DateTimeZonedString,
11552
- Transformation.dateTimeZonedFromString
11749
+ SchemaTransformation.dateTimeZonedFromString
11553
11750
  ),
11554
11751
  toArbitrary: () => (fc, ctx) =>
11555
11752
  fc.tuple(
@@ -11591,7 +11788,7 @@ export interface DateTimeZonedFromString extends decodeTo<DateTimeZoned, String>
11591
11788
  * @since 4.0.0
11592
11789
  */
11593
11790
  export const DateTimeZonedFromString: DateTimeZonedFromString = DateTimeZonedString.pipe(
11594
- decodeTo(DateTimeZoned, Transformation.dateTimeZonedFromString)
11791
+ decodeTo(DateTimeZoned, SchemaTransformation.dateTimeZonedFromString)
11595
11792
  )
11596
11793
 
11597
11794
  // -----------------------------------------------------------------------------
@@ -11610,7 +11807,7 @@ export interface Class<Self, S extends Top & { readonly fields: Struct.Fields },
11610
11807
  S["Encoded"],
11611
11808
  S["DecodingServices"],
11612
11809
  S["EncodingServices"],
11613
- AST.Declaration,
11810
+ SchemaAST.Declaration,
11614
11811
  decodeTo<declareConstructor<Self, S["Encoded"], readonly [S], S["Iso"]>, S>,
11615
11812
  RequiredKeys<S["~type.make.in"]> extends never ? void | S["~type.make.in"] : S["~type.make.in"],
11616
11813
  S["Iso"],
@@ -11702,32 +11899,32 @@ function makeClass<
11702
11899
  static readonly identifier = identifier
11703
11900
  static readonly fields = struct.fields
11704
11901
 
11705
- static get ast(): AST.Declaration {
11902
+ static get ast(): SchemaAST.Declaration {
11706
11903
  return getClassSchema(this).ast
11707
11904
  }
11708
11905
  static pipe() {
11709
11906
  return Pipeable.pipeArguments(this, arguments)
11710
11907
  }
11711
- static rebuild(ast: AST.Declaration) {
11908
+ static rebuild(ast: SchemaAST.Declaration) {
11712
11909
  return getClassSchema(this).rebuild(ast)
11713
11910
  }
11714
11911
  static make(input: S["~type.make.in"], options?: MakeOptions): Self {
11715
11912
  return new this(input, options)
11716
11913
  }
11717
11914
  static makeOption(input: S["~type.make.in"], options?: MakeOptions): Option_.Option<Self> {
11718
- return Parser.makeOption(getClassSchema(this) as any)(input ?? {}, options) as any
11915
+ return SchemaParser.makeOption(getClassSchema(this) as any)(input ?? {}, options) as any
11719
11916
  }
11720
11917
  static makeEffect(input: S["~type.make.in"], options?: MakeOptions): Effect.Effect<Self, SchemaError> {
11721
11918
  return (getClassSchema(this) as any).makeEffect(input ?? {}, options)
11722
11919
  }
11723
11920
  static annotate(annotations: Annotations.Declaration<Self, readonly [S]>) {
11724
- return this.rebuild(AST.annotate(this.ast, annotations))
11921
+ return this.rebuild(SchemaAST.annotate(this.ast, annotations))
11725
11922
  }
11726
11923
  static annotateKey(annotations: Annotations.Key<Self>) {
11727
- return this.rebuild(AST.annotateKey(this.ast, annotations))
11924
+ return this.rebuild(SchemaAST.annotateKey(this.ast, annotations))
11728
11925
  }
11729
- static check(...checks: readonly [AST.Check<Self>, ...Array<AST.Check<Self>>]) {
11730
- return this.rebuild(AST.appendChecks(this.ast, checks))
11926
+ static check(...checks: readonly [SchemaAST.Check<Self>, ...Array<SchemaAST.Check<Self>>]) {
11927
+ return this.rebuild(SchemaAST.appendChecks(this.ast, checks))
11731
11928
  }
11732
11929
  static extend<Extended>(
11733
11930
  identifier: string
@@ -11740,7 +11937,7 @@ function makeClass<
11740
11937
  return makeClass(
11741
11938
  this,
11742
11939
  identifier,
11743
- makeStruct(AST.struct(fields, struct.ast.checks, { identifier }), fields),
11940
+ makeStruct(SchemaAST.struct(fields, struct.ast.checks, { identifier }), fields),
11744
11941
  annotations,
11745
11942
  proto
11746
11943
  )
@@ -11764,9 +11961,9 @@ function makeClass<
11764
11961
  }
11765
11962
 
11766
11963
  function getClassTransformation(self: new(...args: ReadonlyArray<any>) => any) {
11767
- return new Transformation.Transformation<any, any, never, never>(
11768
- Getter.transform((input) => new self(input)),
11769
- Getter.passthrough()
11964
+ return new SchemaTransformation.Transformation<any, any, never, never>(
11965
+ SchemaGetter.transform((input) => new self(input)),
11966
+ SchemaGetter.passthrough()
11770
11967
  )
11771
11968
  }
11772
11969
 
@@ -11786,22 +11983,22 @@ function getClassSchemaFactory<S extends Top>(
11786
11983
  if (memo === undefined) {
11787
11984
  const transformation = getClassTransformation(self)
11788
11985
  const to = make<declareConstructor<Self, S["Encoded"], readonly [S]>>(
11789
- new AST.Declaration(
11986
+ new SchemaAST.Declaration(
11790
11987
  [from.ast],
11791
11988
  () => (input, ast) => {
11792
11989
  return input instanceof self ||
11793
11990
  Predicate.hasProperty(input, getClassTypeId(identifier)) ?
11794
11991
  Effect.succeed(input) :
11795
- Effect.fail(new Issue.InvalidType(ast, Option_.some(input)))
11992
+ Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)))
11796
11993
  },
11797
11994
  {
11798
11995
  identifier,
11799
- [AST.ClassTypeId]: ([from]: readonly [AST.AST]) => new AST.Link(from, transformation),
11800
- toCodec: ([from]: readonly [Codec<S["Encoded"]>]) => new AST.Link(from.ast, transformation),
11996
+ [SchemaAST.ClassTypeId]: ([from]: readonly [SchemaAST.AST]) => new SchemaAST.Link(from, transformation),
11997
+ toCodec: ([from]: readonly [Codec<S["Encoded"]>]) => new SchemaAST.Link(from.ast, transformation),
11801
11998
  toArbitrary: ([from]: readonly [FastCheck.Arbitrary<S["Type"]>]) => () =>
11802
11999
  from.map((args) => new self(args)),
11803
12000
  toFormatter: ([from]: readonly [Formatter<S["Type"]>]) => (t: Self) => `${self.identifier}(${from(t)})`,
11804
- "~sentinels": AST.collectSentinels(from.ast),
12001
+ "~sentinels": SchemaAST.collectSentinels(from.ast),
11805
12002
  ...annotations
11806
12003
  }
11807
12004
  )
@@ -11826,9 +12023,8 @@ type MissingSelfGeneric<Usage extends string> =
11826
12023
  *
11827
12024
  * **When to use**
11828
12025
  *
11829
- * Use to define a schema-backed data class when you want validated
11830
- * construction, schema-derived decoding/encoding, and class-style methods or
11831
- * inheritance.
12026
+ * Use when you need a schema-backed data class with validated construction,
12027
+ * schema-derived decoding/encoding, and class-style methods or inheritance.
11832
12028
  *
11833
12029
  * **Details**
11834
12030
  *
@@ -11887,9 +12083,8 @@ export const Class: {
11887
12083
  *
11888
12084
  * **When to use**
11889
12085
  *
11890
- * Use to define a schema-backed data class when you want validated
11891
- * construction, schema-derived decoding/encoding, and class-style methods or
11892
- * inheritance.
12086
+ * Use when you need a schema-backed data class with validated construction,
12087
+ * schema-derived decoding/encoding, and class-style methods or inheritance.
11893
12088
  *
11894
12089
  * **Details**
11895
12090
  *
@@ -11948,9 +12143,8 @@ export const Class: {
11948
12143
  *
11949
12144
  * **When to use**
11950
12145
  *
11951
- * Use to define a schema-backed data class when you want validated
11952
- * construction, schema-derived decoding/encoding, and class-style methods or
11953
- * inheritance.
12146
+ * Use when you need a schema-backed data class with validated construction,
12147
+ * schema-derived decoding/encoding, and class-style methods or inheritance.
11954
12148
  *
11955
12149
  * **Details**
11956
12150
  *
@@ -12012,9 +12206,8 @@ export const Class: {
12012
12206
  *
12013
12207
  * **When to use**
12014
12208
  *
12015
- * Use to define a schema-backed data class when you want validated
12016
- * construction, schema-derived decoding/encoding, and class-style methods or
12017
- * inheritance.
12209
+ * Use when you need a schema-backed data class with validated construction,
12210
+ * schema-derived decoding/encoding, and class-style methods or inheritance.
12018
12211
  *
12019
12212
  * **Details**
12020
12213
  *
@@ -12595,18 +12788,18 @@ export function overrideToFormatter<S extends Top>(toFormatter: () => Formatter<
12595
12788
  */
12596
12789
  export function toFormatter<T>(schema: Schema<T>, options?: {
12597
12790
  readonly onBefore?:
12598
- | ((ast: AST.AST, recur: (ast: AST.AST) => Formatter<any>) => Formatter<any> | undefined)
12791
+ | ((ast: SchemaAST.AST, recur: (ast: SchemaAST.AST) => Formatter<any>) => Formatter<any> | undefined)
12599
12792
  | undefined
12600
12793
  }): Formatter<T> {
12601
12794
  return recur(schema.ast)
12602
12795
 
12603
- function recur(ast: AST.AST): Formatter<T> {
12796
+ function recur(ast: SchemaAST.AST): Formatter<T> {
12604
12797
  // ---------------------------------------------
12605
12798
  // handle annotation
12606
12799
  // ---------------------------------------------
12607
12800
  const annotation = InternalAnnotations.resolve(ast)?.["toFormatter"]
12608
12801
  if (typeof annotation === "function") {
12609
- return annotation(AST.isDeclaration(ast) ? ast.typeParameters.map(recur) : [])
12802
+ return annotation(SchemaAST.isDeclaration(ast) ? ast.typeParameters.map(recur) : [])
12610
12803
  }
12611
12804
  // ---------------------------------------------
12612
12805
  // handle onBefore
@@ -12623,7 +12816,7 @@ export function toFormatter<T>(schema: Schema<T>, options?: {
12623
12816
  return on(ast)
12624
12817
  }
12625
12818
 
12626
- function on(ast: AST.AST): Formatter<any> {
12819
+ function on(ast: SchemaAST.AST): Formatter<any> {
12627
12820
  switch (ast._tag) {
12628
12821
  default:
12629
12822
  return format
@@ -12642,7 +12835,7 @@ export function toFormatter<T>(schema: Schema<T>, options?: {
12642
12835
  // ---------------------------------------------
12643
12836
  for (; i < elements.length; i++) {
12644
12837
  if (t.length < i + 1) {
12645
- if (AST.isOptional(ast.elements[i])) {
12838
+ if (SchemaAST.isOptional(ast.elements[i])) {
12646
12839
  continue
12647
12840
  }
12648
12841
  } else {
@@ -12685,7 +12878,7 @@ export function toFormatter<T>(schema: Schema<T>, options?: {
12685
12878
  const ps = ast.propertySignatures[i]
12686
12879
  const name = ps.name
12687
12880
  visited.add(name)
12688
- if (AST.isOptional(ps.type) && !Object.hasOwn(t, name)) {
12881
+ if (SchemaAST.isOptional(ps.type) && !Object.hasOwn(t, name)) {
12689
12882
  continue
12690
12883
  }
12691
12884
  out.push(`${formatPropertyKey(name)}: ${propertySignatures[i](t[name])}`)
@@ -12694,7 +12887,7 @@ export function toFormatter<T>(schema: Schema<T>, options?: {
12694
12887
  // handle index signatures
12695
12888
  // ---------------------------------------------
12696
12889
  for (let i = 0; i < indexSignatures.length; i++) {
12697
- const keys = AST.getIndexSignatureKeys(t, ast.indexSignatures[i].parameter)
12890
+ const keys = SchemaAST.getIndexSignatureKeys(t, ast.indexSignatures[i].parameter)
12698
12891
  for (const key of keys) {
12699
12892
  if (visited.has(key)) {
12700
12893
  continue
@@ -12708,10 +12901,10 @@ export function toFormatter<T>(schema: Schema<T>, options?: {
12708
12901
  }
12709
12902
  }
12710
12903
  case "Union": {
12711
- const getCandidates = (t: any) => AST.getCandidates(t, ast.types)
12904
+ const getCandidates = (t: any) => SchemaAST.getCandidates(t, ast.types)
12712
12905
  return (t) => {
12713
12906
  const candidates = getCandidates(t)
12714
- const refinements = candidates.map(Parser._is)
12907
+ const refinements = candidates.map(SchemaParser._is)
12715
12908
  for (let i = 0; i < candidates.length; i++) {
12716
12909
  const is = refinements[i]
12717
12910
  if (is(t)) {
@@ -12722,7 +12915,7 @@ export function toFormatter<T>(schema: Schema<T>, options?: {
12722
12915
  }
12723
12916
  }
12724
12917
  case "Suspend": {
12725
- const get = AST.memoizeThunk(() => recur(ast.thunk()))
12918
+ const get = SchemaAST.memoizeThunk(() => recur(ast.thunk()))
12726
12919
  return (t) => get()(t)
12727
12920
  }
12728
12921
  }
@@ -12739,8 +12932,8 @@ export function toFormatter<T>(schema: Schema<T>, options?: {
12739
12932
  *
12740
12933
  * **When to use**
12741
12934
  *
12742
- * Use when the default structural equivalence derived by {@link toEquivalence}
12743
- * is not appropriate for a type.
12935
+ * Use when you need a custom equivalence instead of the default structural
12936
+ * equivalence derived by {@link toEquivalence}.
12744
12937
  *
12745
12938
  * @category instances
12746
12939
  * @since 4.0.0
@@ -12903,28 +13096,28 @@ export function toCodecJson<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T,
12903
13096
  return make(toCodecJsonTop(schema.ast))
12904
13097
  }
12905
13098
 
12906
- const toCodecJsonTop = AST.toCodec((ast) => {
13099
+ const toCodecJsonTop = SchemaAST.toCodec((ast) => {
12907
13100
  const out = toCodecJsonBase(ast, toCodecJsonTop)
12908
- return out !== ast && AST.isOptional(ast) ? AST.optionalKeyLastLink(out) : out
13101
+ return out !== ast && SchemaAST.isOptional(ast) ? SchemaAST.optionalKeyLastLink(out) : out
12909
13102
  })
12910
13103
 
12911
- function toCodecJsonBase(ast: AST.AST, recur: (ast: AST.AST) => AST.AST): AST.AST {
13104
+ function toCodecJsonBase(ast: SchemaAST.AST, recur: (ast: SchemaAST.AST) => SchemaAST.AST): SchemaAST.AST {
12912
13105
  switch (ast._tag) {
12913
13106
  case "Declaration": {
12914
13107
  const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec
12915
13108
  if (Predicate.isFunction(getLink)) {
12916
- const tps = AST.isDeclaration(ast)
12917
- ? ast.typeParameters.map((tp) => InternalSchema.make(AST.toEncoded(tp)))
13109
+ const tps = SchemaAST.isDeclaration(ast)
13110
+ ? ast.typeParameters.map((tp) => InternalSchema.make(SchemaAST.toEncoded(tp)))
12918
13111
  : []
12919
13112
  const link = getLink(tps)
12920
13113
  const to = recur(link.to)
12921
- return AST.replaceEncoding(ast, to === link.to ? [link] : [new AST.Link(to, link.transformation)])
13114
+ return SchemaAST.replaceEncoding(ast, to === link.to ? [link] : [new SchemaAST.Link(to, link.transformation)])
12922
13115
  }
12923
- return AST.replaceEncoding(ast, [AST.unknownToNull])
13116
+ return SchemaAST.replaceEncoding(ast, [SchemaAST.unknownToNull])
12924
13117
  }
12925
13118
  case "Unknown":
12926
13119
  case "ObjectKeyword":
12927
- return AST.replaceEncoding(ast, [AST.unknownToJson])
13120
+ return SchemaAST.replaceEncoding(ast, [SchemaAST.unknownToJson])
12928
13121
  case "Undefined":
12929
13122
  case "Void":
12930
13123
  case "Literal":
@@ -12943,7 +13136,7 @@ function toCodecJsonBase(ast: AST.AST, recur: (ast: AST.AST) => AST.AST): AST.AS
12943
13136
  case "Union": {
12944
13137
  const sortedTypes = InternalSchema.jsonReorder(ast.types)
12945
13138
  if (sortedTypes !== ast.types) {
12946
- return new AST.Union(
13139
+ return new SchemaAST.Union(
12947
13140
  sortedTypes,
12948
13141
  ast.mode,
12949
13142
  ast.annotations,
@@ -12970,22 +13163,22 @@ function toCodecJsonBase(ast: AST.AST, recur: (ast: AST.AST) => AST.AST): AST.AS
12970
13163
  * @since 4.0.0
12971
13164
  */
12972
13165
  export function toCodecIso<S extends Top>(schema: S): Codec<S["Type"], S["Iso"]> {
12973
- return make(toCodecIsoTop(AST.toType(schema.ast)))
13166
+ return make(toCodecIsoTop(SchemaAST.toType(schema.ast)))
12974
13167
  }
12975
13168
 
12976
- const toCodecIsoTop = memoize((ast: AST.AST): AST.AST => {
13169
+ const toCodecIsoTop = memoize((ast: SchemaAST.AST): SchemaAST.AST => {
12977
13170
  const out = toCodecIsoBase(ast, toCodecIsoTop)
12978
- return out !== ast && AST.isOptional(ast) ? AST.optionalKeyLastLink(out) : out
13171
+ return out !== ast && SchemaAST.isOptional(ast) ? SchemaAST.optionalKeyLastLink(out) : out
12979
13172
  })
12980
13173
 
12981
- function toCodecIsoBase(ast: AST.AST, recur: (ast: AST.AST) => AST.AST): AST.AST {
13174
+ function toCodecIsoBase(ast: SchemaAST.AST, recur: (ast: SchemaAST.AST) => SchemaAST.AST): SchemaAST.AST {
12982
13175
  switch (ast._tag) {
12983
13176
  case "Declaration": {
12984
13177
  const getLink = ast.annotations?.toCodecIso ?? ast.annotations?.toCodec
12985
13178
  if (Predicate.isFunction(getLink)) {
12986
13179
  const link = getLink(ast.typeParameters.map((tp) => InternalSchema.make(tp)))
12987
13180
  const to = recur(link.to)
12988
- return AST.replaceEncoding(ast, to === link.to ? [link] : [new AST.Link(to, link.transformation)])
13181
+ return SchemaAST.replaceEncoding(ast, to === link.to ? [link] : [new SchemaAST.Link(to, link.transformation)])
12989
13182
  }
12990
13183
  return ast
12991
13184
  }
@@ -13165,7 +13358,7 @@ const xml = {
13165
13358
  }
13166
13359
  }
13167
13360
 
13168
- function getStringTreePriority(ast: AST.AST): number {
13361
+ function getStringTreePriority(ast: SchemaAST.AST): number {
13169
13362
  switch (ast._tag) {
13170
13363
  case "Null":
13171
13364
  case "Boolean":
@@ -13182,30 +13375,30 @@ function getStringTreePriority(ast: AST.AST): number {
13182
13375
  const treeReorder = InternalSchema.makeReorder(getStringTreePriority)
13183
13376
 
13184
13377
  function serializerTree(
13185
- ast: AST.AST,
13186
- recur: (ast: AST.AST) => AST.AST,
13187
- onMissingAnnotation: (ast: AST.AST) => AST.AST
13188
- ): AST.AST {
13378
+ ast: SchemaAST.AST,
13379
+ recur: (ast: SchemaAST.AST) => SchemaAST.AST,
13380
+ onMissingAnnotation: (ast: SchemaAST.AST) => SchemaAST.AST
13381
+ ): SchemaAST.AST {
13189
13382
  switch (ast._tag) {
13190
13383
  case "Declaration": {
13191
13384
  const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec
13192
13385
  if (Predicate.isFunction(getLink)) {
13193
- const tps = AST.isDeclaration(ast)
13194
- ? ast.typeParameters.map((tp) => make(recur(AST.toEncoded(tp))))
13386
+ const tps = SchemaAST.isDeclaration(ast)
13387
+ ? ast.typeParameters.map((tp) => make(recur(SchemaAST.toEncoded(tp))))
13195
13388
  : []
13196
13389
  const link = getLink(tps)
13197
13390
  const to = recur(link.to)
13198
- return AST.replaceEncoding(ast, to === link.to ? [link] : [new AST.Link(to, link.transformation)])
13391
+ return SchemaAST.replaceEncoding(ast, to === link.to ? [link] : [new SchemaAST.Link(to, link.transformation)])
13199
13392
  }
13200
13393
  return onMissingAnnotation(ast)
13201
13394
  }
13202
13395
  case "Null":
13203
- return AST.replaceEncoding(ast, [nullToString])
13396
+ return SchemaAST.replaceEncoding(ast, [nullToString])
13204
13397
  case "Boolean":
13205
- return AST.replaceEncoding(ast, [booleanToString])
13398
+ return SchemaAST.replaceEncoding(ast, [booleanToString])
13206
13399
  case "Unknown":
13207
13400
  case "ObjectKeyword":
13208
- return AST.replaceEncoding(ast, [AST.unknownToStringTree])
13401
+ return SchemaAST.replaceEncoding(ast, [SchemaAST.unknownToStringTree])
13209
13402
  case "Enum":
13210
13403
  case "Number":
13211
13404
  case "Literal":
@@ -13222,7 +13415,7 @@ function serializerTree(
13222
13415
  case "Union": {
13223
13416
  const sortedTypes = treeReorder(ast.types)
13224
13417
  if (sortedTypes !== ast.types) {
13225
- return new AST.Union(
13418
+ return new SchemaAST.Union(
13226
13419
  sortedTypes,
13227
13420
  ast.mode,
13228
13421
  ast.annotations,
@@ -13241,75 +13434,75 @@ function serializerTree(
13241
13434
  return ast
13242
13435
  }
13243
13436
 
13244
- const nullToString = new AST.Link(
13245
- new AST.Literal("null"),
13246
- new Transformation.Transformation(
13247
- Getter.transform(() => null),
13248
- Getter.transform(() => "null")
13437
+ const nullToString = new SchemaAST.Link(
13438
+ new SchemaAST.Literal("null"),
13439
+ new SchemaTransformation.Transformation(
13440
+ SchemaGetter.transform(() => null),
13441
+ SchemaGetter.transform(() => "null")
13249
13442
  )
13250
13443
  )
13251
13444
 
13252
- const booleanToString = new AST.Link(
13253
- new AST.Union([new AST.Literal("true"), new AST.Literal("false")], "anyOf"),
13254
- new Transformation.Transformation(
13255
- Getter.transform((s) => s === "true"),
13256
- Getter.String()
13445
+ const booleanToString = new SchemaAST.Link(
13446
+ new SchemaAST.Union([new SchemaAST.Literal("true"), new SchemaAST.Literal("false")], "anyOf"),
13447
+ new SchemaTransformation.Transformation(
13448
+ SchemaGetter.transform((s) => s === "true"),
13449
+ SchemaGetter.String()
13257
13450
  )
13258
13451
  )
13259
13452
 
13260
- const serializerStringTree = AST.toCodec((ast) => {
13261
- const out = serializerTree(ast, serializerStringTree, (ast) => AST.replaceEncoding(ast, [unknownToUndefined]))
13262
- if (out !== ast && AST.isOptional(ast)) {
13263
- return AST.optionalKeyLastLink(out)
13453
+ const serializerStringTree = SchemaAST.toCodec((ast) => {
13454
+ const out = serializerTree(ast, serializerStringTree, (ast) => SchemaAST.replaceEncoding(ast, [unknownToUndefined]))
13455
+ if (out !== ast && SchemaAST.isOptional(ast)) {
13456
+ return SchemaAST.optionalKeyLastLink(out)
13264
13457
  }
13265
13458
  return out
13266
13459
  })
13267
13460
 
13268
- const unknownToUndefined = new AST.Link(
13269
- AST.undefined,
13270
- new Transformation.Transformation(
13271
- Getter.passthrough(),
13272
- Getter.transform(() => undefined)
13461
+ const unknownToUndefined = new SchemaAST.Link(
13462
+ SchemaAST.undefined,
13463
+ new SchemaTransformation.Transformation(
13464
+ SchemaGetter.passthrough(),
13465
+ SchemaGetter.transform(() => undefined)
13273
13466
  )
13274
13467
  )
13275
13468
 
13276
- const serializerStringTreeKeepDeclarations = AST.toCodec((ast) => {
13469
+ const serializerStringTreeKeepDeclarations = SchemaAST.toCodec((ast) => {
13277
13470
  const out = serializerTree(ast, serializerStringTreeKeepDeclarations, identity)
13278
- if (out !== ast && AST.isOptional(ast)) {
13279
- return AST.optionalKeyLastLink(out)
13471
+ if (out !== ast && SchemaAST.isOptional(ast)) {
13472
+ return SchemaAST.optionalKeyLastLink(out)
13280
13473
  }
13281
13474
  return out
13282
13475
  })
13283
13476
 
13284
13477
  const SERIALIZER_ENSURE_ARRAY = "~effect/Schema/SERIALIZER_ENSURE_ARRAY"
13285
13478
 
13286
- const toCodecEnsureArray = AST.toCodec((ast) => {
13287
- if (AST.isUnion(ast) && ast.annotations?.[SERIALIZER_ENSURE_ARRAY]) {
13479
+ const toCodecEnsureArray = SchemaAST.toCodec((ast) => {
13480
+ if (SchemaAST.isUnion(ast) && ast.annotations?.[SERIALIZER_ENSURE_ARRAY]) {
13288
13481
  return ast
13289
13482
  }
13290
13483
  const out = onSerializerEnsureArray(ast)
13291
- if (AST.isArrays(out)) {
13292
- const ensure = new AST.Union(
13484
+ if (SchemaAST.isArrays(out)) {
13485
+ const ensure = new SchemaAST.Union(
13293
13486
  [
13294
13487
  out,
13295
- AST.decodeTo(
13296
- AST.string,
13488
+ SchemaAST.decodeTo(
13489
+ SchemaAST.string,
13297
13490
  out,
13298
- new Transformation.Transformation(
13299
- Getter.split(),
13300
- Getter.passthrough()
13491
+ new SchemaTransformation.Transformation(
13492
+ SchemaGetter.split(),
13493
+ SchemaGetter.passthrough()
13301
13494
  )
13302
13495
  )
13303
13496
  ],
13304
13497
  "anyOf",
13305
13498
  { [SERIALIZER_ENSURE_ARRAY]: true }
13306
13499
  )
13307
- return AST.isOptional(ast) ? AST.optionalKey(ensure) : ensure
13500
+ return SchemaAST.isOptional(ast) ? SchemaAST.optionalKey(ensure) : ensure
13308
13501
  }
13309
13502
  return out
13310
13503
  })
13311
13504
 
13312
- function onSerializerEnsureArray(ast: AST.AST): AST.AST {
13505
+ function onSerializerEnsureArray(ast: SchemaAST.AST): SchemaAST.AST {
13313
13506
  switch (ast._tag) {
13314
13507
  default:
13315
13508
  return ast
@@ -13335,7 +13528,7 @@ function onSerializerEnsureArray(ast: AST.AST): AST.AST {
13335
13528
  */
13336
13529
  export function toIso<S extends Top>(schema: S): Optic_.Iso<S["Type"], S["Iso"]> {
13337
13530
  const serializer = toCodecIso(schema)
13338
- return Optic_.makeIso(Parser.encodeSync(serializer), Parser.decodeSync(serializer))
13531
+ return Optic_.makeIso(SchemaParser.encodeSync(serializer), SchemaParser.decodeSync(serializer))
13339
13532
  }
13340
13533
 
13341
13534
  /**
@@ -13406,14 +13599,14 @@ export interface overrideToCodecIso<S extends Top, Iso> extends
13406
13599
  export function overrideToCodecIso<S extends Top, Iso>(
13407
13600
  to: Codec<Iso>,
13408
13601
  transformation: {
13409
- readonly decode: Getter.Getter<S["Type"], Iso>
13410
- readonly encode: Getter.Getter<Iso, S["Type"]>
13602
+ readonly decode: SchemaGetter.Getter<S["Type"], Iso>
13603
+ readonly encode: SchemaGetter.Getter<Iso, S["Type"]>
13411
13604
  }
13412
13605
  ) {
13413
13606
  return (schema: S): overrideToCodecIso<S, Iso> => {
13414
13607
  return make(
13415
- AST.annotate(schema.ast, {
13416
- toCodecIso: () => new AST.Link(to.ast, Transformation.make(transformation))
13608
+ SchemaAST.annotate(schema.ast, {
13609
+ toCodecIso: () => new SchemaAST.Link(to.ast, SchemaTransformation.make(transformation))
13417
13610
  }),
13418
13611
  { schema }
13419
13612
  )
@@ -13434,8 +13627,8 @@ export function overrideToCodecIso<S extends Top, Iso>(
13434
13627
  */
13435
13628
  export function toDifferJsonPatch<T, E>(schema: Codec<T, E>): Differ<T, JsonPatch.JsonPatch> {
13436
13629
  const serializer = toCodecJson(schema)
13437
- const get = Parser.encodeSync(serializer)
13438
- const set = Parser.decodeSync(serializer)
13630
+ const get = SchemaParser.encodeSync(serializer)
13631
+ const set = SchemaParser.decodeSync(serializer)
13439
13632
  return {
13440
13633
  empty: [],
13441
13634
  diff: (oldValue, newValue) => JsonPatch.get(get(oldValue), get(newValue)),
@@ -13535,7 +13728,7 @@ export interface JsonObject {
13535
13728
  * @category schemas
13536
13729
  * @since 4.0.0
13537
13730
  */
13538
- export const Json: Codec<Json> = make(AST.Json)
13731
+ export const Json: Codec<Json> = make(SchemaAST.Json)
13539
13732
 
13540
13733
  /**
13541
13734
  * Recursive TypeScript type for mutable JSON values: `null`, `number`,
@@ -13571,7 +13764,7 @@ export interface MutableJsonObject {
13571
13764
  * @category schemas
13572
13765
  * @since 4.0.0
13573
13766
  */
13574
- export const MutableJson: Codec<MutableJson> = make(AST.MutableJson)
13767
+ export const MutableJson: Codec<MutableJson> = make(SchemaAST.MutableJson)
13575
13768
 
13576
13769
  // -----------------------------------------------------------------------------
13577
13770
  // Annotations
@@ -13761,7 +13954,7 @@ export declare namespace Annotations {
13761
13954
  * filter/refinement instead.
13762
13955
  */
13763
13956
  readonly identifier?: string | undefined
13764
- readonly parseOptions?: AST.ParseOptions | undefined
13957
+ readonly parseOptions?: SchemaAST.ParseOptions | undefined
13765
13958
  /**
13766
13959
  * Optional metadata used to identify or extend the filter with custom data.
13767
13960
  */
@@ -13817,19 +14010,20 @@ export declare namespace Annotations {
13817
14010
  extends Bottom<T, TypeParameters>
13818
14011
  {
13819
14012
  readonly toCodec?:
13820
- | ((typeParameters: TypeParameters.Encoded<TypeParameters>) => AST.Link)
14013
+ | ((typeParameters: TypeParameters.Encoded<TypeParameters>) => SchemaAST.Link)
13821
14014
  | undefined
13822
14015
  readonly toCodecJson?:
13823
- | ((typeParameters: TypeParameters.Encoded<TypeParameters>) => AST.Link)
14016
+ | ((typeParameters: TypeParameters.Encoded<TypeParameters>) => SchemaAST.Link)
13824
14017
  | undefined
13825
14018
  readonly toCodecIso?:
13826
- | ((typeParameters: TypeParameters.Type<TypeParameters>) => AST.Link)
14019
+ | ((typeParameters: TypeParameters.Type<TypeParameters>) => SchemaAST.Link)
13827
14020
  | undefined
13828
14021
  readonly toArbitrary?: ToArbitrary.Declaration<T, TypeParameters> | undefined
13829
14022
  readonly toEquivalence?: ToEquivalence.Declaration<T, TypeParameters> | undefined
13830
14023
  readonly toFormatter?: ToFormatter.Declaration<T, TypeParameters> | undefined
13831
14024
  readonly typeConstructor?: {
13832
14025
  readonly _tag: string
14026
+ readonly [key: string]: unknown
13833
14027
  } | undefined
13834
14028
  readonly generation?: {
13835
14029
  readonly runtime: string
@@ -13838,11 +14032,11 @@ export declare namespace Annotations {
13838
14032
  readonly importDeclaration?: string | undefined
13839
14033
  } | undefined
13840
14034
  /**
13841
- * Used to collect sentinels from a Declaration AST.
14035
+ * Used to collect sentinels from a Declaration SchemaAST.
13842
14036
  *
13843
14037
  * @internal
13844
14038
  */
13845
- readonly "~sentinels"?: ReadonlyArray<AST.Sentinel> | undefined
14039
+ readonly "~sentinels"?: ReadonlyArray<SchemaAST.Sentinel> | undefined
13846
14040
  }
13847
14041
 
13848
14042
  /**
@@ -14262,7 +14456,7 @@ export declare namespace Annotations {
14262
14456
  }
14263
14457
  readonly isPropertyNames: {
14264
14458
  readonly _tag: "isPropertyNames"
14265
- readonly propertyNames: AST.AST
14459
+ readonly propertyNames: SchemaAST.AST
14266
14460
  }
14267
14461
  // Arrays Meta
14268
14462
  readonly isUnique: {