effect 4.0.0-beta.74 → 4.0.0-beta.76

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 (857) 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 +545 -411
  264. package/dist/Schema.d.ts.map +1 -1
  265. package/dist/Schema.js +662 -500
  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 +81 -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 +40 -22
  284. package/dist/SchemaRepresentation.d.ts.map +1 -1
  285. package/dist/SchemaRepresentation.js +38 -27
  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 +240 -177
  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 +15 -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 +20 -18
  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/CliError.js +1 -1
  426. package/dist/unstable/cli/CliError.js.map +1 -1
  427. package/dist/unstable/cli/Command.d.ts +37 -16
  428. package/dist/unstable/cli/Command.d.ts.map +1 -1
  429. package/dist/unstable/cli/Command.js +15 -8
  430. package/dist/unstable/cli/Command.js.map +1 -1
  431. package/dist/unstable/cli/Completions.d.ts +1 -1
  432. package/dist/unstable/cli/Completions.js +1 -1
  433. package/dist/unstable/cli/Flag.d.ts +7 -6
  434. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  435. package/dist/unstable/cli/Flag.js +7 -6
  436. package/dist/unstable/cli/Flag.js.map +1 -1
  437. package/dist/unstable/cli/GlobalFlag.d.ts +6 -1
  438. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
  439. package/dist/unstable/cli/GlobalFlag.js +7 -2
  440. package/dist/unstable/cli/GlobalFlag.js.map +1 -1
  441. package/dist/unstable/cli/Param.d.ts +3 -3
  442. package/dist/unstable/cli/Param.d.ts.map +1 -1
  443. package/dist/unstable/cli/Param.js +13 -10
  444. package/dist/unstable/cli/Param.js.map +1 -1
  445. package/dist/unstable/cli/Primitive.d.ts +3 -2
  446. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  447. package/dist/unstable/cli/Primitive.js +3 -2
  448. package/dist/unstable/cli/Primitive.js.map +1 -1
  449. package/dist/unstable/cluster/ClusterCron.d.ts +1 -2
  450. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  451. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  452. package/dist/unstable/cluster/ClusterError.js +2 -2
  453. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  454. package/dist/unstable/cluster/ClusterMetrics.d.ts +5 -0
  455. package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
  456. package/dist/unstable/cluster/ClusterMetrics.js +5 -0
  457. package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
  458. package/dist/unstable/cluster/ClusterSchema.d.ts +3 -3
  459. package/dist/unstable/cluster/ClusterSchema.js +3 -3
  460. package/dist/unstable/cluster/ClusterWorkflowEngine.js +15 -15
  461. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  462. package/dist/unstable/cluster/EntityResource.d.ts +10 -0
  463. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  464. package/dist/unstable/cluster/EntityResource.js +10 -0
  465. package/dist/unstable/cluster/EntityResource.js.map +1 -1
  466. package/dist/unstable/cluster/Envelope.d.ts +2 -2
  467. package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
  468. package/dist/unstable/cluster/Envelope.js +2 -2
  469. package/dist/unstable/cluster/Envelope.js.map +1 -1
  470. package/dist/unstable/cluster/Reply.d.ts +2 -2
  471. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  472. package/dist/unstable/cluster/Reply.js +13 -13
  473. package/dist/unstable/cluster/Reply.js.map +1 -1
  474. package/dist/unstable/cluster/RunnerHealth.d.ts +2 -1
  475. package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
  476. package/dist/unstable/cluster/RunnerHealth.js +2 -1
  477. package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
  478. package/dist/unstable/cluster/RunnerServer.d.ts +2 -2
  479. package/dist/unstable/cluster/RunnerServer.js +2 -2
  480. package/dist/unstable/cluster/Runners.d.ts +3 -3
  481. package/dist/unstable/cluster/Runners.js +3 -3
  482. package/dist/unstable/cluster/ShardId.js +3 -3
  483. package/dist/unstable/cluster/ShardId.js.map +1 -1
  484. package/dist/unstable/cluster/Sharding.d.ts +3 -3
  485. package/dist/unstable/cluster/Sharding.js +3 -3
  486. package/dist/unstable/cluster/ShardingConfig.d.ts +4 -4
  487. package/dist/unstable/cluster/ShardingConfig.js +4 -4
  488. package/dist/unstable/cluster/Snowflake.d.ts +1 -1
  489. package/dist/unstable/cluster/Snowflake.js +3 -3
  490. package/dist/unstable/cluster/Snowflake.js.map +1 -1
  491. package/dist/unstable/cluster/internal/entityManager.js +2 -2
  492. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  493. package/dist/unstable/devtools/DevToolsSchema.js +5 -1
  494. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  495. package/dist/unstable/encoding/Msgpack.d.ts +2 -2
  496. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  497. package/dist/unstable/encoding/Msgpack.js +5 -5
  498. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  499. package/dist/unstable/encoding/Ndjson.d.ts +5 -0
  500. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  501. package/dist/unstable/encoding/Ndjson.js +5 -0
  502. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  503. package/dist/unstable/encoding/Sse.d.ts +2 -2
  504. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  505. package/dist/unstable/encoding/Sse.js +2 -2
  506. package/dist/unstable/encoding/Sse.js.map +1 -1
  507. package/dist/unstable/eventlog/EventGroup.d.ts +2 -1
  508. package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
  509. package/dist/unstable/eventlog/EventGroup.js +2 -1
  510. package/dist/unstable/eventlog/EventGroup.js.map +1 -1
  511. package/dist/unstable/eventlog/EventJournal.d.ts +10 -0
  512. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  513. package/dist/unstable/eventlog/EventJournal.js +10 -0
  514. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  515. package/dist/unstable/eventlog/EventLog.d.ts +3 -3
  516. package/dist/unstable/eventlog/EventLog.js +3 -3
  517. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +2 -3
  518. package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
  519. package/dist/unstable/eventlog/EventLogServerEncrypted.js +2 -3
  520. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  521. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -7
  522. package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
  523. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +5 -7
  524. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  525. package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +4 -4
  526. package/dist/unstable/eventlog/EventLogSessionAuth.js +4 -4
  527. package/dist/unstable/http/Cookies.js +4 -4
  528. package/dist/unstable/http/Cookies.js.map +1 -1
  529. package/dist/unstable/http/Etag.d.ts +2 -3
  530. package/dist/unstable/http/Etag.d.ts.map +1 -1
  531. package/dist/unstable/http/Etag.js +2 -3
  532. package/dist/unstable/http/Etag.js.map +1 -1
  533. package/dist/unstable/http/Headers.js +2 -2
  534. package/dist/unstable/http/Headers.js.map +1 -1
  535. package/dist/unstable/http/HttpBody.js +2 -2
  536. package/dist/unstable/http/HttpBody.js.map +1 -1
  537. package/dist/unstable/http/HttpClient.d.ts +2 -2
  538. package/dist/unstable/http/HttpClient.js +2 -2
  539. package/dist/unstable/http/HttpClientError.js +1 -1
  540. package/dist/unstable/http/HttpClientError.js.map +1 -1
  541. package/dist/unstable/http/HttpClientRequest.d.ts +30 -3
  542. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  543. package/dist/unstable/http/HttpClientRequest.js +10 -1
  544. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  545. package/dist/unstable/http/HttpRouter.d.ts +1 -1
  546. package/dist/unstable/http/HttpRouter.js +1 -1
  547. package/dist/unstable/http/HttpServerResponse.d.ts +25 -20
  548. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  549. package/dist/unstable/http/HttpServerResponse.js +13 -8
  550. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  551. package/dist/unstable/http/Multipart.js +3 -3
  552. package/dist/unstable/http/Multipart.js.map +1 -1
  553. package/dist/unstable/http/UrlParams.d.ts +30 -0
  554. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  555. package/dist/unstable/http/UrlParams.js +16 -6
  556. package/dist/unstable/http/UrlParams.js.map +1 -1
  557. package/dist/unstable/httpapi/HttpApi.d.ts +3 -2
  558. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  559. package/dist/unstable/httpapi/HttpApi.js +3 -2
  560. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  561. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  562. package/dist/unstable/httpapi/HttpApiBuilder.js +10 -8
  563. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  564. package/dist/unstable/httpapi/HttpApiClient.js +15 -15
  565. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  566. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +3 -3
  567. package/dist/unstable/httpapi/HttpApiMiddleware.js +3 -3
  568. package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -0
  569. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  570. package/dist/unstable/httpapi/HttpApiScalar.js +12 -6
  571. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  572. package/dist/unstable/httpapi/HttpApiSchema.d.ts +2 -2
  573. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  574. package/dist/unstable/httpapi/HttpApiSchema.js +9 -9
  575. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  576. package/dist/unstable/httpapi/OpenApi.js +11 -11
  577. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  578. package/dist/unstable/observability/OtlpResource.d.ts +5 -0
  579. package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
  580. package/dist/unstable/observability/OtlpResource.js +5 -0
  581. package/dist/unstable/observability/OtlpResource.js.map +1 -1
  582. package/dist/unstable/observability/PrometheusMetrics.d.ts +4 -2
  583. package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
  584. package/dist/unstable/observability/PrometheusMetrics.js +4 -2
  585. package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
  586. package/dist/unstable/persistence/Persistable.js +1 -1
  587. package/dist/unstable/persistence/Persistable.js.map +1 -1
  588. package/dist/unstable/persistence/PersistedQueue.js +1 -1
  589. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  590. package/dist/unstable/persistence/Persistence.js +1 -1
  591. package/dist/unstable/persistence/Persistence.js.map +1 -1
  592. package/dist/unstable/persistence/RateLimiter.js +1 -1
  593. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  594. package/dist/unstable/persistence/Redis.js +1 -1
  595. package/dist/unstable/persistence/Redis.js.map +1 -1
  596. package/dist/unstable/reactivity/AsyncResult.js +1 -1
  597. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  598. package/dist/unstable/reactivity/Atom.d.ts +3 -3
  599. package/dist/unstable/reactivity/Atom.js +3 -3
  600. package/dist/unstable/rpc/Rpc.d.ts +1 -1
  601. package/dist/unstable/rpc/Rpc.js +2 -2
  602. package/dist/unstable/rpc/Rpc.js.map +1 -1
  603. package/dist/unstable/rpc/RpcClient.js +1 -1
  604. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  605. package/dist/unstable/rpc/RpcClientError.js +1 -1
  606. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  607. package/dist/unstable/rpc/RpcMessage.d.ts +2 -2
  608. package/dist/unstable/rpc/RpcMessage.js +3 -3
  609. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  610. package/dist/unstable/rpc/RpcSchema.d.ts +2 -2
  611. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  612. package/dist/unstable/rpc/RpcSerialization.d.ts +2 -2
  613. package/dist/unstable/rpc/RpcSerialization.js +2 -2
  614. package/dist/unstable/schema/Model.js +5 -5
  615. package/dist/unstable/schema/Model.js.map +1 -1
  616. package/dist/unstable/schema/VariantSchema.d.ts +2 -2
  617. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  618. package/dist/unstable/socket/Socket.js +3 -3
  619. package/dist/unstable/socket/Socket.js.map +1 -1
  620. package/dist/unstable/sql/SqlError.js +1 -1
  621. package/dist/unstable/sql/SqlError.js.map +1 -1
  622. package/dist/unstable/sql/SqlSchema.d.ts +4 -4
  623. package/dist/unstable/sql/SqlSchema.js +4 -4
  624. package/dist/unstable/workers/Transferable.d.ts +2 -2
  625. package/dist/unstable/workers/Transferable.d.ts.map +1 -1
  626. package/dist/unstable/workers/Transferable.js +5 -5
  627. package/dist/unstable/workers/Transferable.js.map +1 -1
  628. package/dist/unstable/workers/WorkerError.js +4 -4
  629. package/dist/unstable/workers/WorkerError.js.map +1 -1
  630. package/dist/unstable/workflow/Activity.js +1 -1
  631. package/dist/unstable/workflow/Activity.js.map +1 -1
  632. package/dist/unstable/workflow/DurableDeferred.js +8 -8
  633. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  634. package/dist/unstable/workflow/DurableQueue.d.ts +1 -2
  635. package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
  636. package/dist/unstable/workflow/DurableQueue.js +1 -2
  637. package/dist/unstable/workflow/DurableQueue.js.map +1 -1
  638. package/dist/unstable/workflow/Workflow.d.ts +35 -15
  639. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  640. package/dist/unstable/workflow/Workflow.js +96 -74
  641. package/dist/unstable/workflow/Workflow.js.map +1 -1
  642. package/dist/unstable/workflow/WorkflowEngine.d.ts +10 -2
  643. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  644. package/dist/unstable/workflow/WorkflowEngine.js +16 -8
  645. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  646. package/dist/unstable/workflow/WorkflowProxy.d.ts +2 -4
  647. package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
  648. package/dist/unstable/workflow/WorkflowProxy.js +9 -11
  649. package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
  650. package/dist/unstable/workflow/WorkflowProxyServer.js +7 -7
  651. package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
  652. package/package.json +1 -1
  653. package/src/Array.ts +729 -611
  654. package/src/BigDecimal.ts +37 -30
  655. package/src/BigInt.ts +34 -40
  656. package/src/Boolean.ts +8 -8
  657. package/src/Brand.ts +16 -14
  658. package/src/Cause.ts +21 -23
  659. package/src/Channel.ts +249 -9
  660. package/src/ChannelSchema.ts +11 -11
  661. package/src/Chunk.ts +69 -16
  662. package/src/Clock.ts +3 -3
  663. package/src/Combiner.ts +9 -13
  664. package/src/Config.ts +60 -67
  665. package/src/ConfigProvider.ts +34 -44
  666. package/src/Console.ts +2 -2
  667. package/src/Context.ts +60 -72
  668. package/src/Cron.ts +2 -2
  669. package/src/Crypto.ts +4 -4
  670. package/src/Data.ts +21 -15
  671. package/src/DateTime.ts +35 -16
  672. package/src/Deferred.ts +24 -15
  673. package/src/Duration.ts +44 -31
  674. package/src/Effect.ts +516 -416
  675. package/src/Encoding.ts +5 -0
  676. package/src/Equal.ts +26 -39
  677. package/src/Equivalence.ts +71 -99
  678. package/src/ErrorReporter.ts +1 -1
  679. package/src/Exit.ts +79 -96
  680. package/src/Fiber.ts +8 -6
  681. package/src/FiberHandle.ts +25 -0
  682. package/src/FiberMap.ts +35 -0
  683. package/src/FiberSet.ts +20 -0
  684. package/src/Filter.ts +4 -4
  685. package/src/Formatter.ts +14 -19
  686. package/src/Function.ts +15 -16
  687. package/src/Graph.ts +2 -2
  688. package/src/HKT.ts +2 -2
  689. package/src/Hash.ts +2 -1
  690. package/src/HashMap.ts +15 -0
  691. package/src/HashRing.ts +9 -9
  692. package/src/Iterable.ts +24 -12
  693. package/src/JsonPatch.ts +2 -3
  694. package/src/JsonPointer.ts +2 -6
  695. package/src/JsonSchema.ts +17 -13
  696. package/src/Latch.ts +4 -3
  697. package/src/Layer.ts +92 -114
  698. package/src/Logger.ts +15 -18
  699. package/src/Match.ts +2 -2
  700. package/src/Metric.ts +109 -137
  701. package/src/MutableHashMap.ts +35 -20
  702. package/src/MutableList.ts +15 -0
  703. package/src/MutableRef.ts +56 -42
  704. package/src/Newtype.ts +10 -7
  705. package/src/Number.ts +23 -11
  706. package/src/Optic.ts +25 -22
  707. package/src/Option.ts +196 -168
  708. package/src/Order.ts +118 -179
  709. package/src/PartitionedSemaphore.ts +14 -14
  710. package/src/Path.ts +2 -2
  711. package/src/Pipeable.ts +2 -2
  712. package/src/PlatformError.ts +4 -4
  713. package/src/Pool.ts +7 -11
  714. package/src/Predicate.ts +274 -263
  715. package/src/PubSub.ts +24 -14
  716. package/src/Pull.ts +4 -4
  717. package/src/Queue.ts +46 -7
  718. package/src/RcRef.ts +0 -4
  719. package/src/Redactable.ts +2 -2
  720. package/src/Redacted.ts +3 -3
  721. package/src/Reducer.ts +2 -3
  722. package/src/Ref.ts +43 -40
  723. package/src/References.ts +4 -4
  724. package/src/Request.ts +18 -18
  725. package/src/Resource.ts +2 -2
  726. package/src/Result.ts +87 -33
  727. package/src/Runtime.ts +11 -8
  728. package/src/Schedule.ts +112 -45
  729. package/src/Scheduler.ts +6 -4
  730. package/src/Schema.ts +1015 -759
  731. package/src/SchemaAST.ts +150 -117
  732. package/src/SchemaGetter.ts +142 -121
  733. package/src/SchemaIssue.ts +39 -41
  734. package/src/SchemaParser.ts +173 -229
  735. package/src/SchemaRepresentation.ts +50 -32
  736. package/src/SchemaTransformation.ts +308 -232
  737. package/src/SchemaUtils.ts +2 -2
  738. package/src/Scope.ts +15 -0
  739. package/src/ScopedCache.ts +1 -1
  740. package/src/ScopedRef.ts +14 -18
  741. package/src/Semaphore.ts +9 -9
  742. package/src/Sink.ts +13 -13
  743. package/src/Stdio.ts +4 -5
  744. package/src/Stream.ts +354 -57
  745. package/src/String.ts +6 -9
  746. package/src/Struct.ts +15 -13
  747. package/src/SubscriptionRef.ts +24 -19
  748. package/src/SynchronizedRef.ts +88 -63
  749. package/src/Tracer.ts +4 -4
  750. package/src/Trie.ts +15 -0
  751. package/src/Tuple.ts +25 -19
  752. package/src/TxReentrantLock.ts +6 -3
  753. package/src/TxRef.ts +16 -16
  754. package/src/TxSubscriptionRef.ts +43 -27
  755. package/src/Types.ts +12 -39
  756. package/src/UndefinedOr.ts +15 -14
  757. package/src/Unify.ts +2 -2
  758. package/src/internal/schema/annotations.ts +4 -4
  759. package/src/internal/schema/arbitrary.ts +16 -16
  760. package/src/internal/schema/equivalence.ts +11 -11
  761. package/src/internal/schema/representation.ts +24 -23
  762. package/src/internal/schema/schema.ts +17 -17
  763. package/src/testing/TestSchema.ts +20 -20
  764. package/src/unstable/ai/AiError.ts +4 -2
  765. package/src/unstable/ai/AnthropicStructuredOutput.ts +59 -56
  766. package/src/unstable/ai/Chat.ts +4 -5
  767. package/src/unstable/ai/EmbeddingModel.ts +4 -4
  768. package/src/unstable/ai/IdGenerator.ts +2 -3
  769. package/src/unstable/ai/LanguageModel.ts +5 -4
  770. package/src/unstable/ai/McpSchema.ts +20 -18
  771. package/src/unstable/ai/McpServer.ts +14 -7
  772. package/src/unstable/ai/OpenAiStructuredOutput.ts +72 -61
  773. package/src/unstable/ai/Prompt.ts +5 -5
  774. package/src/unstable/ai/ResponseIdTracker.ts +3 -2
  775. package/src/unstable/ai/Telemetry.ts +21 -6
  776. package/src/unstable/ai/Tool.ts +11 -10
  777. package/src/unstable/ai/Toolkit.ts +2 -2
  778. package/src/unstable/cli/CliError.ts +1 -1
  779. package/src/unstable/cli/Command.ts +37 -16
  780. package/src/unstable/cli/Completions.ts +1 -1
  781. package/src/unstable/cli/Flag.ts +7 -6
  782. package/src/unstable/cli/GlobalFlag.ts +7 -1
  783. package/src/unstable/cli/Param.ts +23 -18
  784. package/src/unstable/cli/Primitive.ts +3 -2
  785. package/src/unstable/cluster/ClusterCron.ts +1 -2
  786. package/src/unstable/cluster/ClusterError.ts +2 -2
  787. package/src/unstable/cluster/ClusterMetrics.ts +5 -0
  788. package/src/unstable/cluster/ClusterSchema.ts +3 -3
  789. package/src/unstable/cluster/ClusterWorkflowEngine.ts +15 -15
  790. package/src/unstable/cluster/EntityResource.ts +10 -0
  791. package/src/unstable/cluster/Envelope.ts +3 -3
  792. package/src/unstable/cluster/Reply.ts +15 -13
  793. package/src/unstable/cluster/RunnerHealth.ts +2 -1
  794. package/src/unstable/cluster/RunnerServer.ts +2 -2
  795. package/src/unstable/cluster/Runners.ts +3 -3
  796. package/src/unstable/cluster/ShardId.ts +3 -3
  797. package/src/unstable/cluster/Sharding.ts +3 -3
  798. package/src/unstable/cluster/ShardingConfig.ts +4 -4
  799. package/src/unstable/cluster/Snowflake.ts +3 -3
  800. package/src/unstable/cluster/internal/entityManager.ts +2 -2
  801. package/src/unstable/devtools/DevToolsSchema.ts +1 -1
  802. package/src/unstable/encoding/Msgpack.ts +6 -6
  803. package/src/unstable/encoding/Ndjson.ts +5 -0
  804. package/src/unstable/encoding/Sse.ts +2 -2
  805. package/src/unstable/eventlog/EventGroup.ts +2 -1
  806. package/src/unstable/eventlog/EventJournal.ts +10 -0
  807. package/src/unstable/eventlog/EventLog.ts +3 -3
  808. package/src/unstable/eventlog/EventLogServerEncrypted.ts +2 -3
  809. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +5 -7
  810. package/src/unstable/eventlog/EventLogSessionAuth.ts +4 -4
  811. package/src/unstable/http/Cookies.ts +4 -4
  812. package/src/unstable/http/Etag.ts +2 -3
  813. package/src/unstable/http/Headers.ts +2 -2
  814. package/src/unstable/http/HttpBody.ts +2 -2
  815. package/src/unstable/http/HttpClient.ts +2 -2
  816. package/src/unstable/http/HttpClientError.ts +1 -1
  817. package/src/unstable/http/HttpClientRequest.ts +30 -3
  818. package/src/unstable/http/HttpRouter.ts +1 -1
  819. package/src/unstable/http/HttpServerResponse.ts +25 -20
  820. package/src/unstable/http/Multipart.ts +3 -3
  821. package/src/unstable/http/UrlParams.ts +36 -6
  822. package/src/unstable/httpapi/HttpApi.ts +5 -4
  823. package/src/unstable/httpapi/HttpApiBuilder.ts +14 -13
  824. package/src/unstable/httpapi/HttpApiClient.ts +16 -16
  825. package/src/unstable/httpapi/HttpApiMiddleware.ts +3 -3
  826. package/src/unstable/httpapi/HttpApiScalar.ts +14 -7
  827. package/src/unstable/httpapi/HttpApiSchema.ts +15 -15
  828. package/src/unstable/httpapi/OpenApi.ts +18 -18
  829. package/src/unstable/observability/OtlpResource.ts +5 -0
  830. package/src/unstable/observability/PrometheusMetrics.ts +4 -2
  831. package/src/unstable/persistence/Persistable.ts +1 -1
  832. package/src/unstable/persistence/PersistedQueue.ts +1 -1
  833. package/src/unstable/persistence/Persistence.ts +1 -1
  834. package/src/unstable/persistence/RateLimiter.ts +1 -1
  835. package/src/unstable/persistence/Redis.ts +1 -1
  836. package/src/unstable/reactivity/AsyncResult.ts +1 -1
  837. package/src/unstable/reactivity/Atom.ts +3 -3
  838. package/src/unstable/rpc/Rpc.ts +3 -3
  839. package/src/unstable/rpc/RpcClient.ts +1 -1
  840. package/src/unstable/rpc/RpcClientError.ts +1 -1
  841. package/src/unstable/rpc/RpcMessage.ts +3 -3
  842. package/src/unstable/rpc/RpcSchema.ts +2 -2
  843. package/src/unstable/rpc/RpcSerialization.ts +2 -2
  844. package/src/unstable/schema/Model.ts +5 -5
  845. package/src/unstable/schema/VariantSchema.ts +2 -2
  846. package/src/unstable/socket/Socket.ts +3 -3
  847. package/src/unstable/sql/SqlError.ts +1 -1
  848. package/src/unstable/sql/SqlSchema.ts +4 -4
  849. package/src/unstable/workers/Transferable.ts +6 -6
  850. package/src/unstable/workers/WorkerError.ts +4 -4
  851. package/src/unstable/workflow/Activity.ts +1 -1
  852. package/src/unstable/workflow/DurableDeferred.ts +8 -8
  853. package/src/unstable/workflow/DurableQueue.ts +1 -2
  854. package/src/unstable/workflow/Workflow.ts +161 -116
  855. package/src/unstable/workflow/WorkflowEngine.ts +16 -8
  856. package/src/unstable/workflow/WorkflowProxy.ts +9 -11
  857. package/src/unstable/workflow/WorkflowProxyServer.ts +7 -7
package/dist/Schema.js CHANGED
@@ -31,7 +31,7 @@
31
31
  * - Type guard: {@link is}
32
32
  * - Assertion: {@link asserts}
33
33
  * - Add constraints: `.check(...)` with filters like {@link isMinLength},
34
- * {@link isGreaterThan}, {@link isPattern}, {@link isUUID}
34
+ * {@link isGreaterThan}, {@link isPattern}, {@link isUUID}, {@link isGUID}
35
35
  * - Transform between schemas: {@link decodeTo}, {@link encodeTo}
36
36
  * - Add a default for missing keys: {@link withDecodingDefault}, {@link withDecodingDefaultKey}
37
37
  * - Create branded types: {@link brand}
@@ -118,11 +118,11 @@ import * as Record_ from "./Record.js";
118
118
  import * as Redacted_ from "./Redacted.js";
119
119
  import * as Result_ from "./Result.js";
120
120
  import * as Scheduler from "./Scheduler.js";
121
- import * as AST from "./SchemaAST.js";
122
- import * as Getter from "./SchemaGetter.js";
123
- import * as Issue from "./SchemaIssue.js";
124
- import * as Parser from "./SchemaParser.js";
125
- import * as Transformation from "./SchemaTransformation.js";
121
+ import * as SchemaAST from "./SchemaAST.js";
122
+ import * as SchemaGetter from "./SchemaGetter.js";
123
+ import * as SchemaIssue from "./SchemaIssue.js";
124
+ import * as SchemaParser from "./SchemaParser.js";
125
+ import * as SchemaTransformation from "./SchemaTransformation.js";
126
126
  import * as Struct_ from "./Struct.js";
127
127
  import * as FastCheck from "./testing/FastCheck.js";
128
128
  const TypeId = InternalSchema.TypeId;
@@ -131,6 +131,11 @@ const TypeId = InternalSchema.TypeId;
131
131
  * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas
132
132
  * and a decoder factory.
133
133
  *
134
+ * **When to use**
135
+ *
136
+ * Use when you are defining a schema for a generic container whose validation
137
+ * depends on one or more type-parameter schemas.
138
+ *
134
139
  * **Details**
135
140
  *
136
141
  * The outer call `declareConstructor<T, E, Iso>()` fixes the decoded type `T`,
@@ -160,7 +165,7 @@ const TypeId = InternalSchema.TypeId;
160
165
  * ([itemCodec]) =>
161
166
  * (u, ast, options) => {
162
167
  * if (!isBox(u)) {
163
- * return Effect.fail(new Issue.InvalidType(ast, Option.some(u)))
168
+ * return Effect.fail(new SchemaIssue.InvalidType(ast, Option.some(u)))
164
169
  * }
165
170
  * return Effect.map(
166
171
  * SchemaParser.decodeUnknownEffect(itemCodec)(u.value, options),
@@ -177,7 +182,7 @@ const TypeId = InternalSchema.TypeId;
177
182
  */
178
183
  export function declareConstructor() {
179
184
  return (typeParameters, run, annotations) => {
180
- return make(new AST.Declaration(typeParameters.map(AST.getAST), typeParameters => run(typeParameters.map(ast => make(ast))), annotations));
185
+ return make(new SchemaAST.Declaration(typeParameters.map(SchemaAST.getAST), typeParameters => run(typeParameters.map(ast => make(ast))), annotations));
181
186
  };
182
187
  }
183
188
  /**
@@ -185,10 +190,10 @@ export function declareConstructor() {
185
190
  * function. The schema accepts any unknown value and succeeds when `is` returns
186
191
  * `true`, failing with an `InvalidType` issue otherwise.
187
192
  *
188
- * **Details**
193
+ * **When to use**
189
194
  *
190
- * Use this when the type has no type parameters. For parametric types such as
191
- * `Option<A>` or `Array<A>`, use {@link declareConstructor} instead.
195
+ * Use when you are defining a schema for an opaque type with no type parameters
196
+ * and validation can be expressed as a type guard.
192
197
  *
193
198
  * **Example** (Schema for a custom `UserId` branded type)
194
199
  *
@@ -212,7 +217,7 @@ export function declareConstructor() {
212
217
  * @since 3.10.0
213
218
  */
214
219
  export function declare(is, annotations) {
215
- return declareConstructor()([], () => (input, ast) => is(input) ? Effect.succeed(input) : Effect.fail(new Issue.InvalidType(ast, Option_.some(input))), annotations);
220
+ return declareConstructor()([], () => (input, ast) => is(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input))), annotations);
216
221
  }
217
222
  /**
218
223
  * Returns a schema widened to the fully-parameterized {@link Bottom} interface,
@@ -342,7 +347,7 @@ export function annotateEncoded(annotations) {
342
347
  */
343
348
  export function annotateKey(annotations) {
344
349
  return self => {
345
- return self.rebuild(AST.annotateKey(self.ast, annotations));
350
+ return self.rebuild(SchemaAST.annotateKey(self.ast, annotations));
346
351
  };
347
352
  }
348
353
  /**
@@ -380,7 +385,7 @@ export {
380
385
  *
381
386
  * **Details**
382
387
  *
383
- * The `issue` field contains a structured {@link Issue.Issue} tree describing
388
+ * The `issue` field contains a structured {@link SchemaIssue.Issue} tree describing
384
389
  * every validation failure, including the path to the problematic value,
385
390
  * expected types, and actual values received. `message` renders the issue tree
386
391
  * as a human-readable string.
@@ -500,12 +505,12 @@ function makeStandardResult(exit) {
500
505
  * @since 4.0.0
501
506
  */
502
507
  export function toStandardSchemaV1(self, options) {
503
- const decodeUnknownEffect = Parser.decodeUnknownEffect(self);
508
+ const decodeUnknownEffect = SchemaParser.decodeUnknownEffect(self);
504
509
  const parseOptions = {
505
510
  errors: "all",
506
511
  ...options?.parseOptions
507
512
  };
508
- const formatter = Issue.makeFormatterStandardSchemaV1(options);
513
+ const formatter = SchemaIssue.makeFormatterStandardSchemaV1(options);
509
514
  const validate = value => {
510
515
  const scheduler = new Scheduler.MixedScheduler();
511
516
  const fiber = Effect.runFork(Effect.match(decodeUnknownEffect(value, parseOptions), {
@@ -629,7 +634,7 @@ export function toStandardJSONSchemaV1(self) {
629
634
  * @category guards
630
635
  * @since 3.10.0
631
636
  */
632
- export const is = Parser.is;
637
+ export const is = SchemaParser.is;
633
638
  /**
634
639
  * Creates an assertion function that throws an error if the input doesn't match
635
640
  * the schema.
@@ -637,7 +642,7 @@ export const is = Parser.is;
637
642
  * **When to use**
638
643
  *
639
644
  * Use to validate unknown input at runtime while narrowing the value with a
640
- * TypeScript `asserts` predicate.
645
+ * TypeScript assertion signature.
641
646
  *
642
647
  * **Details**
643
648
  *
@@ -667,14 +672,15 @@ export const is = Parser.is;
667
672
  * @category guards
668
673
  * @since 4.0.0
669
674
  */
670
- export const asserts = Parser.asserts;
675
+ export const asserts = SchemaParser.asserts;
671
676
  /**
672
677
  * Decodes an `unknown` input against a schema, returning an `Effect` that
673
678
  * succeeds with the decoded value or fails with a {@link SchemaError}.
674
679
  *
675
680
  * **When to use**
676
681
  *
677
- * Use when decoding input whose type is not statically known.
682
+ * Use when you need to decode unknown input in an `Effect` whose failure
683
+ * channel is `SchemaError`.
678
684
  *
679
685
  * **Details**
680
686
  *
@@ -683,11 +689,13 @@ export const asserts = Parser.asserts;
683
689
  * Options may be provided either when creating the decoder or when applying it;
684
690
  * application options override creation options.
685
691
  *
692
+ * @see {@link SchemaParser.decodeUnknownEffect} for the adapter that fails with `SchemaIssue.Issue` directly
693
+ *
686
694
  * @category decoding
687
695
  * @since 4.0.0
688
696
  */
689
697
  export function decodeUnknownEffect(schema, options) {
690
- const parser = Parser.decodeUnknownEffect(schema, options);
698
+ const parser = SchemaParser.decodeUnknownEffect(schema, options);
691
699
  return (input, options) => {
692
700
  return Effect.mapErrorEager(parser(input, options), issue => new SchemaError(issue));
693
701
  };
@@ -699,7 +707,8 @@ export function decodeUnknownEffect(schema, options) {
699
707
  *
700
708
  * **When to use**
701
709
  *
702
- * Use when the input is already typed as the schema's `Encoded` type.
710
+ * Use when you need to decode input already typed as the schema's `Encoded`
711
+ * type in an `Effect` whose failure channel is `SchemaError`.
703
712
  *
704
713
  * **Details**
705
714
  *
@@ -707,6 +716,8 @@ export function decodeUnknownEffect(schema, options) {
707
716
  * Options may be provided either when creating the decoder or when applying it;
708
717
  * application options override creation options.
709
718
  *
719
+ * @see {@link SchemaParser.decodeEffect} for the adapter that fails with `SchemaIssue.Issue` directly
720
+ *
710
721
  * @category decoding
711
722
  * @since 4.0.0
712
723
  */
@@ -718,8 +729,8 @@ export const decodeEffect = decodeUnknownEffect;
718
729
  *
719
730
  * **When to use**
720
731
  *
721
- * Use when the input type is not statically known and decoding should return an
722
- * `Exit` instead of failing or throwing.
732
+ * Use when you need to decode unknown input into an `Exit` whose failure
733
+ * contains `SchemaError`.
723
734
  *
724
735
  * **Details**
725
736
  *
@@ -729,11 +740,13 @@ export const decodeEffect = decodeUnknownEffect;
729
740
  * Options may be provided either when creating the decoder or when applying it;
730
741
  * application options override creation options.
731
742
  *
743
+ * @see {@link SchemaParser.decodeUnknownExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
744
+ *
732
745
  * @category decoding
733
746
  * @since 4.0.0
734
747
  */
735
748
  export function decodeUnknownExit(schema, options) {
736
- const parser = Parser.decodeUnknownExit(schema, options);
749
+ const parser = SchemaParser.decodeUnknownExit(schema, options);
737
750
  return (input, options) => {
738
751
  return Exit_.mapError(parser(input, options), issue => new SchemaError(issue));
739
752
  };
@@ -745,8 +758,8 @@ export function decodeUnknownExit(schema, options) {
745
758
  *
746
759
  * **When to use**
747
760
  *
748
- * Use when typed input should be decoded into an `Exit` instead of failing or
749
- * throwing.
761
+ * Use when you need to decode already typed `Encoded` input into an `Exit`
762
+ * whose failure contains `SchemaError`.
750
763
  *
751
764
  * **Details**
752
765
  *
@@ -755,6 +768,8 @@ export function decodeUnknownExit(schema, options) {
755
768
  * Options may be provided either when creating the decoder or when applying it;
756
769
  * application options override creation options.
757
770
  *
771
+ * @see {@link SchemaParser.decodeExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
772
+ *
758
773
  * @category decoding
759
774
  * @since 4.0.0
760
775
  */
@@ -765,20 +780,21 @@ export const decodeExit = decodeUnknownExit;
765
780
  *
766
781
  * **When to use**
767
782
  *
768
- * Use when the input type is not statically known and you only need to know
783
+ * Use when you do not know the input type statically and only need to know
769
784
  * whether decoding succeeded.
770
785
  *
771
786
  * **Details**
772
787
  *
773
788
  * Prefer this over {@link decodeUnknownExit} or {@link decodeUnknownEffect}
774
- * when you don't need error details. For typed input use {@link decodeOption}.
789
+ * when you don't need error details. For input already typed as the schema's
790
+ * `Encoded` type use {@link decodeOption}.
775
791
  * Options may be provided either when creating the decoder or when applying it;
776
792
  * application options override creation options.
777
793
  *
778
794
  * @category decoding
779
795
  * @since 3.10.0
780
796
  */
781
- export const decodeUnknownOption = Parser.decodeUnknownOption;
797
+ export const decodeUnknownOption = SchemaParser.decodeUnknownOption;
782
798
  /**
783
799
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
784
800
  * returning an `Option` that is `Some` with the decoded value on success or
@@ -786,7 +802,8 @@ export const decodeUnknownOption = Parser.decodeUnknownOption;
786
802
  *
787
803
  * **When to use**
788
804
  *
789
- * Use when typed input should be decoded and only success or failure matters.
805
+ * Use when you already have input typed as the schema's `Encoded` type and
806
+ * only need to know whether decoding succeeded.
790
807
  *
791
808
  * **Details**
792
809
  *
@@ -797,35 +814,43 @@ export const decodeUnknownOption = Parser.decodeUnknownOption;
797
814
  * @category decoding
798
815
  * @since 3.10.0
799
816
  */
800
- export const decodeOption = Parser.decodeOption;
817
+ export const decodeOption = decodeUnknownOption;
801
818
  /**
802
819
  * Decodes an `unknown` input against a schema, returning a `Result` that
803
- * succeeds with the decoded value or fails with a schema issue.
820
+ * succeeds with the decoded value or fails with a {@link SchemaError}.
804
821
  *
805
822
  * **When to use**
806
823
  *
807
- * Use when the input type is not statically known and decoding should return a
808
- * `Result` with structured issue data.
824
+ * Use when you do not know the input type statically and want decoding to
825
+ * return a `Result` with `SchemaError` failure data.
809
826
  *
810
827
  * **Details**
811
828
  *
812
- * For typed input use {@link decodeResult}.
829
+ * For input already typed as the schema's `Encoded` type use
830
+ * {@link decodeResult}.
813
831
  * Options may be provided either when creating the decoder or when applying it;
814
832
  * application options override creation options.
815
833
  *
834
+ * @see {@link SchemaParser.decodeUnknownResult} for the adapter that fails with `SchemaIssue.Issue` directly
835
+ *
816
836
  * @category decoding
817
837
  * @since 4.0.0
818
838
  */
819
- export const decodeUnknownResult = Parser.decodeUnknownResult;
839
+ export function decodeUnknownResult(schema, options) {
840
+ const parser = SchemaParser.decodeUnknownResult(schema, options);
841
+ return (input, options) => {
842
+ return Result_.mapError(parser(input, options), issue => new SchemaError(issue));
843
+ };
844
+ }
820
845
  /**
821
846
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
822
847
  * returning a `Result` that succeeds with the decoded value or fails with a
823
- * schema issue.
848
+ * {@link SchemaError}.
824
849
  *
825
850
  * **When to use**
826
851
  *
827
- * Use when typed input should be decoded into a `Result` with structured issue
828
- * data.
852
+ * Use when you already have input typed as the schema's `Encoded` type and
853
+ * want decoding to return a `Result` with `SchemaError` failure data.
829
854
  *
830
855
  * **Details**
831
856
  *
@@ -833,36 +858,49 @@ export const decodeUnknownResult = Parser.decodeUnknownResult;
833
858
  * Options may be provided either when creating the decoder or when applying it;
834
859
  * application options override creation options.
835
860
  *
861
+ * @see {@link SchemaParser.decodeResult} for the adapter that fails with `SchemaIssue.Issue` directly
862
+ *
836
863
  * @category decoding
837
864
  * @since 4.0.0
838
865
  */
839
- export const decodeResult = Parser.decodeResult;
866
+ export const decodeResult = decodeUnknownResult;
840
867
  /**
841
868
  * Decodes an `unknown` input against a schema, returning a `Promise` that
842
- * resolves with the decoded value or rejects with a schema issue.
869
+ * resolves with the decoded value or rejects with a {@link SchemaError}.
843
870
  *
844
871
  * **When to use**
845
872
  *
846
- * Use when integrating unknown input validation with Promise-based APIs.
873
+ * Use when you need decoding of unknown input to return a JavaScript `Promise`
874
+ * that rejects with `SchemaError`.
847
875
  *
848
876
  * **Details**
849
877
  *
850
- * For typed input use {@link decodePromise}.
878
+ * For input already typed as the schema's `Encoded` type use
879
+ * {@link decodePromise}.
851
880
  * Options may be provided either when creating the decoder or when applying it;
852
881
  * application options override creation options.
853
882
  *
883
+ * @see {@link SchemaParser.decodeUnknownPromise} for the adapter that rejects with `SchemaIssue.Issue` directly
884
+ *
854
885
  * @category decoding
855
886
  * @since 3.10.0
856
887
  */
857
- export const decodeUnknownPromise = Parser.decodeUnknownPromise;
888
+ export function decodeUnknownPromise(schema, options) {
889
+ const parser = decodeUnknownEffect(schema, options);
890
+ return (input, options) => {
891
+ return Effect.runPromise(parser(input, options));
892
+ };
893
+ }
858
894
  /**
859
895
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
860
896
  * returning a `Promise` that resolves with the decoded value or rejects with a
861
- * schema issue.
897
+ * {@link SchemaError}.
862
898
  *
863
899
  * **When to use**
864
900
  *
865
- * Use when integrating typed input decoding with Promise-based APIs.
901
+ * Use when you already have input typed as the schema's `Encoded` type and
902
+ * need decoding to return a JavaScript `Promise` that rejects with
903
+ * `SchemaError`.
866
904
  *
867
905
  * **Details**
868
906
  *
@@ -870,22 +908,24 @@ export const decodeUnknownPromise = Parser.decodeUnknownPromise;
870
908
  * Options may be provided either when creating the decoder or when applying it;
871
909
  * application options override creation options.
872
910
  *
911
+ * @see {@link SchemaParser.decodePromise} for the adapter that rejects with `SchemaIssue.Issue` directly
912
+ *
873
913
  * @category decoding
874
914
  * @since 3.10.0
875
915
  */
876
- export const decodePromise = Parser.decodePromise;
916
+ export const decodePromise = decodeUnknownPromise;
877
917
  /**
878
918
  * Decodes an `unknown` input against a schema synchronously, returning the
879
- * decoded value or throwing an `Error` whose cause contains the schema issue.
919
+ * decoded value or throwing a {@link SchemaError}.
880
920
  *
881
921
  * **When to use**
882
922
  *
883
- * Use when validating unknown data at a boundary and treating schema mismatches
884
- * as exceptions.
923
+ * Use when you need to validate unknown data at a synchronous boundary and want
924
+ * schema mismatches to throw `SchemaError`.
885
925
  *
886
926
  * **Details**
887
927
  *
888
- * For typed input use `decodeSync`.
928
+ * For input already typed as the schema's `Encoded` type use `decodeSync`.
889
929
  * Only service-free schemas can be decoded synchronously. For non-throwing
890
930
  * alternatives see `decodeUnknownOption`, `decodeUnknownExit`, or
891
931
  * `decodeUnknownEffect`. Options may be provided either when creating the
@@ -908,19 +948,25 @@ export const decodePromise = Parser.decodePromise;
908
948
  * // └─ Expected a numeric string, actual "not a number"
909
949
  * ```
910
950
  *
951
+ * @see {@link SchemaParser.decodeUnknownSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
952
+ *
911
953
  * @category decoding
912
954
  * @since 4.0.0
913
955
  */
914
- export const decodeUnknownSync = Parser.decodeUnknownSync;
956
+ export function decodeUnknownSync(schema, options) {
957
+ const parser = decodeUnknownEffect(schema, options);
958
+ return (input, options) => {
959
+ return Effect.runSync(parser(input, options));
960
+ };
961
+ }
915
962
  /**
916
963
  * Decodes a typed input (the schema's `Encoded` type) against a schema
917
- * synchronously, returning the decoded value or throwing an `Error` whose cause
918
- * contains the schema issue.
964
+ * synchronously, returning the decoded value or throwing a {@link SchemaError}.
919
965
  *
920
966
  * **When to use**
921
967
  *
922
- * Use when typed input should be decoded synchronously and schema mismatches
923
- * should throw.
968
+ * Use when you already have input typed as the schema's `Encoded` type and
969
+ * want schema mismatches to throw `SchemaError` synchronously.
924
970
  *
925
971
  * **Details**
926
972
  *
@@ -929,21 +975,24 @@ export const decodeUnknownSync = Parser.decodeUnknownSync;
929
975
  * provided either when creating the decoder or when applying it; application
930
976
  * options override creation options.
931
977
  *
978
+ * @see {@link SchemaParser.decodeSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
979
+ *
932
980
  * @category decoding
933
981
  * @since 4.0.0
934
982
  */
935
- export const decodeSync = Parser.decodeSync;
983
+ export const decodeSync = decodeUnknownSync;
936
984
  /**
937
985
  * Encodes an `unknown` input against a schema, returning an `Effect` that
938
986
  * succeeds with the encoded value or fails with a {@link SchemaError}.
939
987
  *
940
988
  * **When to use**
941
989
  *
942
- * Use when encoding input whose type is not statically known.
990
+ * Use when you need to encode unknown input in an `Effect` whose failure
991
+ * channel is `SchemaError`.
943
992
  *
944
993
  * **Details**
945
994
  *
946
- * Prefer {@link encodeEffect} when the input is already typed as the schema's
995
+ * Prefer {@link encodeEffect} when the value is already typed as the schema's
947
996
  * `Type`.
948
997
  * Options may be provided either when creating the encoder or when applying it;
949
998
  * application options override creation options.
@@ -959,11 +1008,13 @@ export const decodeSync = Parser.decodeSync;
959
1008
  * // Output: "42"
960
1009
  * ```
961
1010
  *
1011
+ * @see {@link SchemaParser.encodeUnknownEffect} for the adapter that fails with `SchemaIssue.Issue` directly
1012
+ *
962
1013
  * @category encoding
963
1014
  * @since 4.0.0
964
1015
  */
965
1016
  export function encodeUnknownEffect(schema, options) {
966
- const parser = Parser.encodeUnknownEffect(schema, options);
1017
+ const parser = SchemaParser.encodeUnknownEffect(schema, options);
967
1018
  return (input, options) => {
968
1019
  return Effect.mapErrorEager(parser(input, options), issue => new SchemaError(issue));
969
1020
  };
@@ -975,7 +1026,8 @@ export function encodeUnknownEffect(schema, options) {
975
1026
  *
976
1027
  * **When to use**
977
1028
  *
978
- * Use when the input is already typed as the schema's `Type`.
1029
+ * Use when you need to encode input already typed as the schema's `Type` in
1030
+ * an `Effect` whose failure channel is `SchemaError`.
979
1031
  *
980
1032
  * **Details**
981
1033
  *
@@ -983,6 +1035,8 @@ export function encodeUnknownEffect(schema, options) {
983
1035
  * Options may be provided either when creating the encoder or when applying it;
984
1036
  * application options override creation options.
985
1037
  *
1038
+ * @see {@link SchemaParser.encodeEffect} for the adapter that fails with `SchemaIssue.Issue` directly
1039
+ *
986
1040
  * @category encoding
987
1041
  * @since 4.0.0
988
1042
  */
@@ -994,21 +1048,23 @@ export const encodeEffect = encodeUnknownEffect;
994
1048
  *
995
1049
  * **When to use**
996
1050
  *
997
- * Use when the input type is not statically known and encoding should return an
998
- * `Exit` instead of failing or throwing.
1051
+ * Use when you need to encode unknown input into an `Exit` whose failure
1052
+ * contains `SchemaError`.
999
1053
  *
1000
1054
  * **Details**
1001
1055
  *
1002
1056
  * Only usable with schemas that have no `EncodingServices` requirement. Prefer
1003
- * {@link encodeExit} when the input is already typed as the schema's `Type`.
1057
+ * {@link encodeExit} when the value is already typed as the schema's `Type`.
1004
1058
  * Options may be provided either when creating the encoder or when applying it;
1005
1059
  * application options override creation options.
1006
1060
  *
1061
+ * @see {@link SchemaParser.encodeUnknownExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
1062
+ *
1007
1063
  * @category encoding
1008
1064
  * @since 4.0.0
1009
1065
  */
1010
1066
  export function encodeUnknownExit(schema, options) {
1011
- const parser = Parser.encodeUnknownExit(schema, options);
1067
+ const parser = SchemaParser.encodeUnknownExit(schema, options);
1012
1068
  return (input, options) => {
1013
1069
  return Exit_.mapError(parser(input, options), issue => new SchemaError(issue));
1014
1070
  };
@@ -1020,8 +1076,8 @@ export function encodeUnknownExit(schema, options) {
1020
1076
  *
1021
1077
  * **When to use**
1022
1078
  *
1023
- * Use when typed input should be encoded into an `Exit` instead of failing or
1024
- * throwing.
1079
+ * Use when you need to encode already typed schema values into an `Exit` whose
1080
+ * failure contains `SchemaError`.
1025
1081
  *
1026
1082
  * **Details**
1027
1083
  *
@@ -1030,6 +1086,8 @@ export function encodeUnknownExit(schema, options) {
1030
1086
  * Options may be provided either when creating the encoder or when applying it;
1031
1087
  * application options override creation options.
1032
1088
  *
1089
+ * @see {@link SchemaParser.encodeExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
1090
+ *
1033
1091
  * @category encoding
1034
1092
  * @since 4.0.0
1035
1093
  */
@@ -1040,20 +1098,21 @@ export const encodeExit = encodeUnknownExit;
1040
1098
  *
1041
1099
  * **When to use**
1042
1100
  *
1043
- * Use when the input type is not statically known and you only need to know
1101
+ * Use when you do not know the input type statically and only need to know
1044
1102
  * whether encoding succeeded.
1045
1103
  *
1046
1104
  * **Details**
1047
1105
  *
1048
1106
  * Prefer this over {@link encodeUnknownExit} or {@link encodeUnknownEffect}
1049
- * when you don't need error details. For typed input use {@link encodeOption}.
1107
+ * when you don't need error details. For values already typed as the schema's
1108
+ * `Type` use {@link encodeOption}.
1050
1109
  * Options may be provided either when creating the encoder or when applying it;
1051
1110
  * application options override creation options.
1052
1111
  *
1053
1112
  * @category encoding
1054
1113
  * @since 3.10.0
1055
1114
  */
1056
- export const encodeUnknownOption = Parser.encodeUnknownOption;
1115
+ export const encodeUnknownOption = SchemaParser.encodeUnknownOption;
1057
1116
  /**
1058
1117
  * Encodes a typed input (the schema's `Type`) against a schema, returning an
1059
1118
  * `Option` that is `Some` with the encoded value on success or `None` on
@@ -1061,7 +1120,8 @@ export const encodeUnknownOption = Parser.encodeUnknownOption;
1061
1120
  *
1062
1121
  * **When to use**
1063
1122
  *
1064
- * Use when typed input should be encoded and only success or failure matters.
1123
+ * Use when you already have a value typed as the schema's `Type` and only need
1124
+ * to know whether encoding succeeded.
1065
1125
  *
1066
1126
  * **Details**
1067
1127
  *
@@ -1072,34 +1132,42 @@ export const encodeUnknownOption = Parser.encodeUnknownOption;
1072
1132
  * @category encoding
1073
1133
  * @since 3.10.0
1074
1134
  */
1075
- export const encodeOption = Parser.encodeOption;
1135
+ export const encodeOption = encodeUnknownOption;
1076
1136
  /**
1077
1137
  * Encodes an `unknown` input against a schema, returning a `Result` that
1078
- * succeeds with the encoded value or fails with a schema issue.
1138
+ * succeeds with the encoded value or fails with a {@link SchemaError}.
1079
1139
  *
1080
1140
  * **When to use**
1081
1141
  *
1082
- * Use when the input type is not statically known and encoding should return a
1083
- * `Result` with structured issue data.
1142
+ * Use when you do not know the input type statically and want encoding to
1143
+ * return a `Result` with `SchemaError` failure data.
1084
1144
  *
1085
1145
  * **Details**
1086
1146
  *
1087
- * For typed input use {@link encodeResult}.
1147
+ * For values already typed as the schema's `Type` use {@link encodeResult}.
1088
1148
  * Options may be provided either when creating the encoder or when applying it;
1089
1149
  * application options override creation options.
1090
1150
  *
1151
+ * @see {@link SchemaParser.encodeUnknownResult} for the adapter that fails with `SchemaIssue.Issue` directly
1152
+ *
1091
1153
  * @category encoding
1092
1154
  * @since 4.0.0
1093
1155
  */
1094
- export const encodeUnknownResult = Parser.encodeUnknownResult;
1156
+ export function encodeUnknownResult(schema, options) {
1157
+ const parser = SchemaParser.encodeUnknownResult(schema, options);
1158
+ return (input, options) => {
1159
+ return Result_.mapError(parser(input, options), issue => new SchemaError(issue));
1160
+ };
1161
+ }
1095
1162
  /**
1096
1163
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
1097
- * `Result` that succeeds with the encoded value or fails with a schema issue.
1164
+ * `Result` that succeeds with the encoded value or fails with a
1165
+ * {@link SchemaError}.
1098
1166
  *
1099
1167
  * **When to use**
1100
1168
  *
1101
- * Use when typed input should be encoded into a `Result` with structured issue
1102
- * data.
1169
+ * Use when you already have a value typed as the schema's `Type` and want
1170
+ * encoding to return a `Result` with `SchemaError` failure data.
1103
1171
  *
1104
1172
  * **Details**
1105
1173
  *
@@ -1107,28 +1175,38 @@ export const encodeUnknownResult = Parser.encodeUnknownResult;
1107
1175
  * Options may be provided either when creating the encoder or when applying it;
1108
1176
  * application options override creation options.
1109
1177
  *
1178
+ * @see {@link SchemaParser.encodeResult} for the adapter that fails with `SchemaIssue.Issue` directly
1179
+ *
1110
1180
  * @category encoding
1111
1181
  * @since 4.0.0
1112
1182
  */
1113
- export const encodeResult = Parser.encodeResult;
1183
+ export const encodeResult = encodeUnknownResult;
1114
1184
  /**
1115
1185
  * Encodes an `unknown` input against a schema, returning a `Promise` that
1116
- * resolves with the encoded value or rejects with a schema issue.
1186
+ * resolves with the encoded value or rejects with a {@link SchemaError}.
1117
1187
  *
1118
1188
  * **When to use**
1119
1189
  *
1120
- * Use when integrating unknown input serialization with Promise-based APIs.
1190
+ * Use when you need encoding of unknown input to return a JavaScript `Promise`
1191
+ * that rejects with `SchemaError`.
1121
1192
  *
1122
1193
  * **Details**
1123
1194
  *
1124
- * For typed input use {@link encodePromise}.
1195
+ * For values already typed as the schema's `Type` use {@link encodePromise}.
1125
1196
  * Options may be provided either when creating the encoder or when applying it;
1126
1197
  * application options override creation options.
1127
1198
  *
1199
+ * @see {@link SchemaParser.encodeUnknownPromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1200
+ *
1128
1201
  * @category encoding
1129
1202
  * @since 3.10.0
1130
1203
  */
1131
- export const encodeUnknownPromise = Parser.encodeUnknownPromise;
1204
+ export function encodeUnknownPromise(schema, options) {
1205
+ const parser = encodeUnknownEffect(schema, options);
1206
+ return (input, options) => {
1207
+ return Effect.runPromise(parser(input, options));
1208
+ };
1209
+ }
1132
1210
  /**
1133
1211
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
1134
1212
  * `Promise` that resolves with the encoded value or rejects with a
@@ -1136,7 +1214,8 @@ export const encodeUnknownPromise = Parser.encodeUnknownPromise;
1136
1214
  *
1137
1215
  * **When to use**
1138
1216
  *
1139
- * Use when integrating typed input serialization with Promise-based APIs.
1217
+ * Use when you already have a value typed as the schema's `Type` and need
1218
+ * encoding to return a JavaScript `Promise` that rejects with `SchemaError`.
1140
1219
  *
1141
1220
  * **Details**
1142
1221
  *
@@ -1144,39 +1223,48 @@ export const encodeUnknownPromise = Parser.encodeUnknownPromise;
1144
1223
  * Options may be provided either when creating the encoder or when applying it;
1145
1224
  * application options override creation options.
1146
1225
  *
1226
+ * @see {@link SchemaParser.encodePromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1227
+ *
1147
1228
  * @category encoding
1148
1229
  * @since 3.10.0
1149
1230
  */
1150
- export const encodePromise = Parser.encodePromise;
1231
+ export const encodePromise = encodeUnknownPromise;
1151
1232
  /**
1152
1233
  * Encodes an `unknown` input against a schema synchronously, throwing a
1153
1234
  * {@link SchemaError} on failure.
1154
1235
  *
1155
1236
  * **When to use**
1156
1237
  *
1157
- * Use when serializing unknown data at a boundary and treating schema
1158
- * mismatches as unrecoverable errors.
1238
+ * Use when you need to serialize unknown data at a synchronous boundary and
1239
+ * want schema mismatches to throw `SchemaError`.
1159
1240
  *
1160
1241
  * **Details**
1161
1242
  *
1162
1243
  * For non-throwing alternatives see {@link encodeUnknownOption},
1163
- * {@link encodeUnknownExit}, or {@link encodeUnknownEffect}. For typed input
1164
- * use {@link encodeSync}.
1244
+ * {@link encodeUnknownExit}, or {@link encodeUnknownEffect}. For values
1245
+ * already typed as the schema's `Type` use {@link encodeSync}.
1165
1246
  * Options may be provided either when creating the encoder or when applying it;
1166
1247
  * application options override creation options.
1167
1248
  *
1249
+ * @see {@link SchemaParser.encodeUnknownSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
1250
+ *
1168
1251
  * @category encoding
1169
1252
  * @since 4.0.0
1170
1253
  */
1171
- export const encodeUnknownSync = Parser.encodeUnknownSync;
1254
+ export function encodeUnknownSync(schema, options) {
1255
+ const parser = encodeUnknownEffect(schema, options);
1256
+ return (input, options) => {
1257
+ return Effect.runSync(parser(input, options));
1258
+ };
1259
+ }
1172
1260
  /**
1173
1261
  * Encodes a typed input (the schema's `Type`) against a schema synchronously,
1174
1262
  * throwing a {@link SchemaError} on failure.
1175
1263
  *
1176
1264
  * **When to use**
1177
1265
  *
1178
- * Use when typed input should be encoded synchronously and schema mismatches
1179
- * should throw.
1266
+ * Use when you already have a value typed as the schema's `Type` and want
1267
+ * schema mismatches to throw `SchemaError` synchronously.
1180
1268
  *
1181
1269
  * **Details**
1182
1270
  *
@@ -1184,10 +1272,12 @@ export const encodeUnknownSync = Parser.encodeUnknownSync;
1184
1272
  * Options may be provided either when creating the encoder or when applying it;
1185
1273
  * application options override creation options.
1186
1274
  *
1275
+ * @see {@link SchemaParser.encodeSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
1276
+ *
1187
1277
  * @category encoding
1188
1278
  * @since 4.0.0
1189
1279
  */
1190
- export const encodeSync = Parser.encodeSync;
1280
+ export const encodeSync = encodeUnknownSync;
1191
1281
  /**
1192
1282
  * Creates a schema from an AST (Abstract Syntax Tree) node.
1193
1283
  *
@@ -1263,7 +1353,7 @@ export function isSchema(u) {
1263
1353
  * @category combinators
1264
1354
  * @since 4.0.0
1265
1355
  */
1266
- export const optionalKey = /*#__PURE__*/Struct_.lambda(schema => make(AST.optionalKey(schema.ast), {
1356
+ export const optionalKey = /*#__PURE__*/Struct_.lambda(schema => make(SchemaAST.optionalKey(schema.ast), {
1267
1357
  schema
1268
1358
  }));
1269
1359
  /**
@@ -1331,7 +1421,7 @@ export const required = /*#__PURE__*/Struct_.lambda(self => self.schema.members[
1331
1421
  * @category combinators
1332
1422
  * @since 4.0.0
1333
1423
  */
1334
- export const mutableKey = /*#__PURE__*/Struct_.lambda(schema => make(AST.mutableKey(schema.ast), {
1424
+ export const mutableKey = /*#__PURE__*/Struct_.lambda(schema => make(SchemaAST.mutableKey(schema.ast), {
1335
1425
  schema
1336
1426
  }));
1337
1427
  /**
@@ -1353,7 +1443,7 @@ export const readonlyKey = /*#__PURE__*/Struct_.lambda(self => self.schema);
1353
1443
  * @category transforming
1354
1444
  * @since 4.0.0
1355
1445
  */
1356
- export const toType = /*#__PURE__*/Struct_.lambda(schema => make(AST.toType(schema.ast), {
1446
+ export const toType = /*#__PURE__*/Struct_.lambda(schema => make(SchemaAST.toType(schema.ast), {
1357
1447
  schema
1358
1448
  }));
1359
1449
  /**
@@ -1363,7 +1453,7 @@ export const toType = /*#__PURE__*/Struct_.lambda(schema => make(AST.toType(sche
1363
1453
  * @category transforming
1364
1454
  * @since 4.0.0
1365
1455
  */
1366
- export const toEncoded = /*#__PURE__*/Struct_.lambda(schema => make(AST.toEncoded(schema.ast), {
1456
+ export const toEncoded = /*#__PURE__*/Struct_.lambda(schema => make(SchemaAST.toEncoded(schema.ast), {
1367
1457
  schema
1368
1458
  }));
1369
1459
  const FlipTypeId = "~effect/Schema/flip";
@@ -1372,9 +1462,9 @@ function isFlip$(schema) {
1372
1462
  }
1373
1463
  export function flip(schema) {
1374
1464
  if (isFlip$(schema)) {
1375
- return schema.schema.rebuild(AST.flip(schema.ast));
1465
+ return schema.schema.rebuild(SchemaAST.flip(schema.ast));
1376
1466
  }
1377
- return make(AST.flip(schema.ast), {
1467
+ return make(SchemaAST.flip(schema.ast), {
1378
1468
  [FlipTypeId]: FlipTypeId,
1379
1469
  schema
1380
1470
  });
@@ -1398,24 +1488,29 @@ export function flip(schema) {
1398
1488
  * @since 3.10.0
1399
1489
  */
1400
1490
  export function Literal(literal) {
1401
- const out = make(new AST.Literal(literal), {
1491
+ const out = make(new SchemaAST.Literal(literal), {
1402
1492
  literal,
1403
1493
  transform(to) {
1404
1494
  return out.pipe(decodeTo(Literal(to), {
1405
- decode: Getter.transform(() => to),
1406
- encode: Getter.transform(() => literal)
1495
+ decode: SchemaGetter.transform(() => to),
1496
+ encode: SchemaGetter.transform(() => literal)
1407
1497
  }));
1408
1498
  }
1409
1499
  });
1410
1500
  return out;
1411
1501
  }
1412
1502
  function templateLiteralFromParts(parts) {
1413
- return new AST.TemplateLiteral(parts.map(part => isSchema(part) ? part.ast : new AST.Literal(part)));
1503
+ return new SchemaAST.TemplateLiteral(parts.map(part => isSchema(part) ? part.ast : new SchemaAST.Literal(part)));
1414
1504
  }
1415
1505
  /**
1416
1506
  * Creates a schema that validates strings matching a template literal pattern. Each part can be
1417
1507
  * a literal string/number/bigint or a schema whose encoded type is a string, number, or bigint.
1418
1508
  *
1509
+ * **When to use**
1510
+ *
1511
+ * Use when the decoded value should remain the matched string and you do not
1512
+ * need the individual template parts parsed into a tuple.
1513
+ *
1419
1514
  * **Example** (URL path pattern)
1420
1515
  *
1421
1516
  * ```ts
@@ -1486,7 +1581,7 @@ export function TemplateLiteralParser(parts) {
1486
1581
  * @since 4.0.0
1487
1582
  */
1488
1583
  export function Enum(enums) {
1489
- return make(new AST.Enum(Object.keys(enums).filter(key => typeof enums[enums[key]] !== "number").map(key => [key, enums[key]])), {
1584
+ return make(new SchemaAST.Enum(Object.keys(enums).filter(key => typeof enums[enums[key]] !== "number").map(key => [key, enums[key]])), {
1490
1585
  enums
1491
1586
  });
1492
1587
  }
@@ -1496,7 +1591,7 @@ export function Enum(enums) {
1496
1591
  * @category schemas
1497
1592
  * @since 3.10.0
1498
1593
  */
1499
- export const Never = /*#__PURE__*/make(AST.never);
1594
+ export const Never = /*#__PURE__*/make(SchemaAST.never);
1500
1595
  /**
1501
1596
  * Schema for the `any` type. Accepts any value without validation.
1502
1597
  *
@@ -1504,15 +1599,20 @@ export const Never = /*#__PURE__*/make(AST.never);
1504
1599
  * @category schemas
1505
1600
  * @since 3.10.0
1506
1601
  */
1507
- export const Any = /*#__PURE__*/make(AST.any);
1602
+ export const Any = /*#__PURE__*/make(SchemaAST.any);
1508
1603
  /**
1509
1604
  * Schema for the `unknown` type. Accepts any value without validation.
1510
1605
  *
1606
+ * **When to use**
1607
+ *
1608
+ * Use as a top schema when you need to accept any input while preserving
1609
+ * TypeScript's `unknown` safety at use sites.
1610
+ *
1511
1611
  * @see {@link Any} for the `any` variant.
1512
1612
  * @category schemas
1513
1613
  * @since 3.10.0
1514
1614
  */
1515
- export const Unknown = /*#__PURE__*/make(AST.unknown);
1615
+ export const Unknown = /*#__PURE__*/make(SchemaAST.unknown);
1516
1616
  /**
1517
1617
  * Schema for the `null` literal. Validates that the input is strictly `null`.
1518
1618
  *
@@ -1520,7 +1620,7 @@ export const Unknown = /*#__PURE__*/make(AST.unknown);
1520
1620
  * @category schemas
1521
1621
  * @since 3.10.0
1522
1622
  */
1523
- export const Null = /*#__PURE__*/make(AST.null);
1623
+ export const Null = /*#__PURE__*/make(SchemaAST.null);
1524
1624
  /**
1525
1625
  * Schema for the `undefined` literal. Validates that the input is strictly `undefined`.
1526
1626
  *
@@ -1528,14 +1628,14 @@ export const Null = /*#__PURE__*/make(AST.null);
1528
1628
  * @category schemas
1529
1629
  * @since 3.10.0
1530
1630
  */
1531
- export const Undefined = /*#__PURE__*/make(AST.undefined);
1631
+ export const Undefined = /*#__PURE__*/make(SchemaAST.undefined);
1532
1632
  /**
1533
1633
  * Schema for `string` values. Validates that the input is `typeof` `"string"`.
1534
1634
  *
1535
1635
  * @category schemas
1536
1636
  * @since 4.0.0
1537
1637
  */
1538
- export const String = /*#__PURE__*/make(AST.string);
1638
+ export const String = /*#__PURE__*/make(SchemaAST.string);
1539
1639
  /**
1540
1640
  * Schema for `number` values, including `NaN`, `Infinity`, and `-Infinity`.
1541
1641
  *
@@ -1550,7 +1650,7 @@ export const String = /*#__PURE__*/make(AST.string);
1550
1650
  * @category schemas
1551
1651
  * @since 4.0.0
1552
1652
  */
1553
- export const Number = /*#__PURE__*/make(AST.number);
1653
+ export const Number = /*#__PURE__*/make(SchemaAST.number);
1554
1654
  /**
1555
1655
  * Schema for `boolean` values. Validates that the input is `typeof` `"boolean"`.
1556
1656
  *
@@ -1563,7 +1663,7 @@ export const Number = /*#__PURE__*/make(AST.number);
1563
1663
  * @category boolean
1564
1664
  * @since 4.0.0
1565
1665
  */
1566
- export const Boolean = /*#__PURE__*/make(AST.boolean);
1666
+ export const Boolean = /*#__PURE__*/make(SchemaAST.boolean);
1567
1667
  /**
1568
1668
  * Schema for `symbol` values. Validates that the input is `typeof` `"symbol"`.
1569
1669
  *
@@ -1571,7 +1671,7 @@ export const Boolean = /*#__PURE__*/make(AST.boolean);
1571
1671
  * @category schemas
1572
1672
  * @since 4.0.0
1573
1673
  */
1574
- export const Symbol = /*#__PURE__*/make(AST.symbol);
1674
+ export const Symbol = /*#__PURE__*/make(SchemaAST.symbol);
1575
1675
  /**
1576
1676
  * Schema for `bigint` values. Validates that the input is `typeof` `"bigint"`.
1577
1677
  *
@@ -1585,14 +1685,14 @@ export const Symbol = /*#__PURE__*/make(AST.symbol);
1585
1685
  * @category schemas
1586
1686
  * @since 4.0.0
1587
1687
  */
1588
- export const BigInt = /*#__PURE__*/make(AST.bigInt);
1688
+ export const BigInt = /*#__PURE__*/make(SchemaAST.bigInt);
1589
1689
  /**
1590
1690
  * Schema for the `void` type. Accepts `undefined` as the encoded value.
1591
1691
  *
1592
1692
  * @category schemas
1593
1693
  * @since 3.10.0
1594
1694
  */
1595
- export const Void = /*#__PURE__*/make(AST.void);
1695
+ export const Void = /*#__PURE__*/make(SchemaAST.void);
1596
1696
  /**
1597
1697
  * Schema for the `object` type. Validates that the input is a non-null object or function
1598
1698
  * (i.e. `typeof value === "object" && value !== null || typeof value === "function"`).
@@ -1600,7 +1700,7 @@ export const Void = /*#__PURE__*/make(AST.void);
1600
1700
  * @category schemas
1601
1701
  * @since 4.0.0
1602
1702
  */
1603
- export const ObjectKeyword = /*#__PURE__*/make(AST.objectKeyword);
1703
+ export const ObjectKeyword = /*#__PURE__*/make(SchemaAST.objectKeyword);
1604
1704
  /**
1605
1705
  * Creates a schema for a specific symbol. Only that exact symbol satisfies the schema.
1606
1706
  *
@@ -1618,14 +1718,14 @@ export const ObjectKeyword = /*#__PURE__*/make(AST.objectKeyword);
1618
1718
  * @since 4.0.0
1619
1719
  */
1620
1720
  export function UniqueSymbol(symbol) {
1621
- return make(new AST.UniqueSymbol(symbol));
1721
+ return make(new SchemaAST.UniqueSymbol(symbol));
1622
1722
  }
1623
1723
  function makeStruct(ast, fields) {
1624
1724
  return make(ast, {
1625
1725
  fields,
1626
1726
  mapFields(f, options) {
1627
1727
  const fields = f(this.fields);
1628
- return makeStruct(AST.struct(fields, options?.unsafePreserveChecks ? this.ast.checks : undefined), fields);
1728
+ return makeStruct(SchemaAST.struct(fields, options?.unsafePreserveChecks ? this.ast.checks : undefined), fields);
1629
1729
  }
1630
1730
  });
1631
1731
  }
@@ -1663,15 +1763,15 @@ function makeStruct(ast, fields) {
1663
1763
  * @since 3.10.0
1664
1764
  */
1665
1765
  export function Struct(fields) {
1666
- return makeStruct(AST.struct(fields, undefined), fields);
1766
+ return makeStruct(SchemaAST.struct(fields, undefined), fields);
1667
1767
  }
1668
1768
  /**
1669
1769
  * Adds fields to a struct schema through a struct-mapping lambda.
1670
1770
  *
1671
1771
  * **When to use**
1672
1772
  *
1673
- * Use to add the same fields to an existing struct or to every struct member of
1674
- * a union.
1773
+ * Use to add the same fields to an existing struct or every struct member of a
1774
+ * union.
1675
1775
  *
1676
1776
  * **Details**
1677
1777
  *
@@ -1734,7 +1834,7 @@ export function encodeKeys(mapping) {
1734
1834
  fields[k] = encoded;
1735
1835
  }
1736
1836
  }
1737
- return Struct(fields).pipe(decodeTo(self, Transformation.transform({
1837
+ return Struct(fields).pipe(decodeTo(self, SchemaTransformation.transform({
1738
1838
  decode: Struct_.renameKeys(reverseMapping),
1739
1839
  encode: Struct_.renameKeys(mapping)
1740
1840
  })));
@@ -1780,7 +1880,7 @@ derive) {
1780
1880
  ...f,
1781
1881
  ...fields
1782
1882
  });
1783
- return self.pipe(decodeTo(to, Transformation.transform({
1883
+ return self.pipe(decodeTo(to, SchemaTransformation.transform({
1784
1884
  decode: input => {
1785
1885
  const out = {
1786
1886
  ...input
@@ -1828,8 +1928,8 @@ derive) {
1828
1928
  * @since 3.10.0
1829
1929
  */
1830
1930
  export function Record(key, value, options) {
1831
- const keyValueCombiner = options?.keyValueCombiner?.decode || options?.keyValueCombiner?.encode ? new AST.KeyValueCombiner(options.keyValueCombiner.decode, options.keyValueCombiner.encode) : undefined;
1832
- return make(AST.record(key.ast, value.ast, keyValueCombiner), {
1931
+ const keyValueCombiner = options?.keyValueCombiner?.decode || options?.keyValueCombiner?.encode ? new SchemaAST.KeyValueCombiner(options.keyValueCombiner.decode, options.keyValueCombiner.encode) : undefined;
1932
+ return make(SchemaAST.record(key.ast, value.ast, keyValueCombiner), {
1833
1933
  key,
1834
1934
  value
1835
1935
  });
@@ -1845,10 +1945,10 @@ export function Record(key, value, options) {
1845
1945
  *
1846
1946
  * const schema = Schema.StructWithRest(
1847
1947
  * Schema.Struct({ id: Schema.Number }),
1848
- * [Schema.Record(Schema.String, Schema.String)]
1948
+ * [Schema.Record(Schema.String, Schema.Number)]
1849
1949
  * )
1850
1950
  *
1851
- * // { readonly id: number } & { readonly [x: string]: string }
1951
+ * // { readonly id: number, readonly [x: string]: number }
1852
1952
  * type T = typeof schema.Type
1853
1953
  * ```
1854
1954
  *
@@ -1856,7 +1956,7 @@ export function Record(key, value, options) {
1856
1956
  * @since 4.0.0
1857
1957
  */
1858
1958
  export function StructWithRest(schema, records) {
1859
- return make(AST.structWithRest(schema.ast, records.map(AST.getAST)), {
1959
+ return make(SchemaAST.structWithRest(schema.ast, records.map(SchemaAST.getAST)), {
1860
1960
  schema,
1861
1961
  records
1862
1962
  });
@@ -1866,7 +1966,7 @@ function makeTuple(ast, elements) {
1866
1966
  elements,
1867
1967
  mapElements(f, options) {
1868
1968
  const elements = f(this.elements);
1869
- return makeTuple(AST.tuple(elements, options?.unsafePreserveChecks ? this.ast.checks : undefined), elements);
1969
+ return makeTuple(SchemaAST.tuple(elements, options?.unsafePreserveChecks ? this.ast.checks : undefined), elements);
1870
1970
  }
1871
1971
  });
1872
1972
  }
@@ -1889,7 +1989,7 @@ function makeTuple(ast, elements) {
1889
1989
  * @since 3.10.0
1890
1990
  */
1891
1991
  export function Tuple(elements) {
1892
- return makeTuple(AST.tuple(elements), elements);
1992
+ return makeTuple(SchemaAST.tuple(elements), elements);
1893
1993
  }
1894
1994
  /**
1895
1995
  * Extends a fixed-length tuple schema with a variadic rest segment.
@@ -1922,7 +2022,7 @@ export function Tuple(elements) {
1922
2022
  * @since 4.0.0
1923
2023
  */
1924
2024
  export function TupleWithRest(schema, rest) {
1925
- return make(AST.tupleWithRest(schema.ast, rest.map(AST.getAST)), {
2025
+ return make(SchemaAST.tupleWithRest(schema.ast, rest.map(SchemaAST.getAST)), {
1926
2026
  schema,
1927
2027
  rest
1928
2028
  });
@@ -1931,7 +2031,7 @@ export function TupleWithRest(schema, rest) {
1931
2031
  * @category constructors
1932
2032
  * @since 4.0.0
1933
2033
  */
1934
- const ArraySchema = /*#__PURE__*/Struct_.lambda(schema => make(new AST.Arrays(false, [], [schema.ast]), {
2034
+ const ArraySchema = /*#__PURE__*/Struct_.lambda(schema => make(new SchemaAST.Arrays(false, [], [schema.ast]), {
1935
2035
  value: schema
1936
2036
  }));
1937
2037
  export {
@@ -1972,7 +2072,7 @@ ArraySchema as Array };
1972
2072
  * @category constructors
1973
2073
  * @since 3.10.0
1974
2074
  */
1975
- export const NonEmptyArray = /*#__PURE__*/Struct_.lambda(schema => make(new AST.Arrays(false, [schema.ast], [schema.ast]), {
2075
+ export const NonEmptyArray = /*#__PURE__*/Struct_.lambda(schema => make(new SchemaAST.Arrays(false, [schema.ast], [schema.ast]), {
1976
2076
  value: schema
1977
2077
  }));
1978
2078
  /**
@@ -2002,7 +2102,7 @@ export const NonEmptyArray = /*#__PURE__*/Struct_.lambda(schema => make(new AST.
2002
2102
  * @since 3.10.0
2003
2103
  */
2004
2104
  export function ArrayEnsure(schema) {
2005
- return Union([schema, ArraySchema(schema)]).pipe(decodeTo(ArraySchema(toType(schema)), Transformation.transform({
2105
+ return Union([schema, ArraySchema(schema)]).pipe(decodeTo(ArraySchema(toType(schema)), SchemaTransformation.transform({
2006
2106
  decode: Arr.ensure,
2007
2107
  encode: array => array.length === 1 ? array[0] : array
2008
2108
  })));
@@ -2039,7 +2139,7 @@ export function UniqueArray(item) {
2039
2139
  * @since 3.10.0
2040
2140
  */
2041
2141
  export const mutable = /*#__PURE__*/Struct_.lambda(schema => {
2042
- return make(new AST.Arrays(true, schema.ast.elements, schema.ast.rest), {
2142
+ return make(new SchemaAST.Arrays(true, schema.ast.elements, schema.ast.rest), {
2043
2143
  schema
2044
2144
  });
2045
2145
  });
@@ -2048,7 +2148,7 @@ function makeUnion(ast, members) {
2048
2148
  members,
2049
2149
  mapMembers(f, options) {
2050
2150
  const members = f(this.members);
2051
- return makeUnion(AST.union(members, this.ast.mode, options?.unsafePreserveChecks ? this.ast.checks : undefined), members);
2151
+ return makeUnion(SchemaAST.union(members, this.ast.mode, options?.unsafePreserveChecks ? this.ast.checks : undefined), members);
2052
2152
  }
2053
2153
  });
2054
2154
  }
@@ -2077,7 +2177,7 @@ function makeUnion(ast, members) {
2077
2177
  * @since 3.10.0
2078
2178
  */
2079
2179
  export function Union(members, options) {
2080
- return makeUnion(AST.union(members, options?.mode ?? "anyOf", undefined), members);
2180
+ return makeUnion(SchemaAST.union(members, options?.mode ?? "anyOf", undefined), members);
2081
2181
  }
2082
2182
  /**
2083
2183
  * Creates a union schema from an array of literal values.
@@ -2097,7 +2197,7 @@ export function Union(members, options) {
2097
2197
  */
2098
2198
  export function Literals(literals) {
2099
2199
  const members = literals.map(Literal);
2100
- return make(AST.union(members, "anyOf", undefined), {
2200
+ return make(SchemaAST.union(members, "anyOf", undefined), {
2101
2201
  literals,
2102
2202
  members,
2103
2203
  mapMembers(f) {
@@ -2157,7 +2257,7 @@ export const NullishOr = /*#__PURE__*/Struct_.lambda(self => Union([self, Null,
2157
2257
  * @since 3.10.0
2158
2258
  */
2159
2259
  export function suspend(f) {
2160
- return make(new AST.Suspend(() => f().ast));
2260
+ return make(new SchemaAST.Suspend(() => f().ast));
2161
2261
  }
2162
2262
  /**
2163
2263
  * Attaches one or more filter checks to a schema without changing the
@@ -2195,7 +2295,7 @@ export function check(...checks) {
2195
2295
  * @since 3.10.0
2196
2296
  */
2197
2297
  export function refine(refinement, annotations) {
2198
- return schema => make(AST.appendChecks(schema.ast, [AST.makeFilterByGuard(refinement, annotations)]), {
2298
+ return schema => make(SchemaAST.appendChecks(schema.ast, [SchemaAST.makeFilterByGuard(refinement, annotations)]), {
2199
2299
  schema
2200
2300
  });
2201
2301
  }
@@ -2219,7 +2319,7 @@ export function refine(refinement, annotations) {
2219
2319
  * @since 3.10.0
2220
2320
  */
2221
2321
  export function brand(identifier) {
2222
- return schema => make(AST.brand(schema.ast, identifier), {
2322
+ return schema => make(SchemaAST.brand(schema.ast, identifier), {
2223
2323
  schema,
2224
2324
  identifier
2225
2325
  });
@@ -2262,7 +2362,7 @@ export function fromBrand(identifier, ctor) {
2262
2362
  * @since 4.0.0
2263
2363
  */
2264
2364
  export function middlewareDecoding(decode) {
2265
- return schema => make(AST.middlewareDecoding(schema.ast, new Transformation.Middleware(decode, identity)), {
2365
+ return schema => make(SchemaAST.middlewareDecoding(schema.ast, new SchemaTransformation.Middleware(decode, identity)), {
2266
2366
  schema
2267
2367
  });
2268
2368
  }
@@ -2292,7 +2392,7 @@ export function middlewareDecoding(decode) {
2292
2392
  * @since 4.0.0
2293
2393
  */
2294
2394
  export function middlewareEncoding(encode) {
2295
- return schema => make(AST.middlewareEncoding(schema.ast, new Transformation.Middleware(identity, encode)), {
2395
+ return schema => make(SchemaAST.middlewareEncoding(schema.ast, new SchemaTransformation.Middleware(identity, encode)), {
2296
2396
  schema
2297
2397
  });
2298
2398
  }
@@ -2326,7 +2426,8 @@ export function catchDecoding(f) {
2326
2426
  *
2327
2427
  * **When to use**
2328
2428
  *
2329
- * Use when decoding fallback logic needs services from the Effect context.
2429
+ * Use when you need decoding fallback logic to require services from the Effect
2430
+ * context.
2330
2431
  *
2331
2432
  * **Details**
2332
2433
  *
@@ -2363,7 +2464,8 @@ export function catchEncoding(f) {
2363
2464
  *
2364
2465
  * **When to use**
2365
2466
  *
2366
- * Use when encoding fallback logic needs services from the Effect context.
2467
+ * Use when you need encoding fallback logic to require services from the Effect
2468
+ * context.
2367
2469
  *
2368
2470
  * **Details**
2369
2471
  *
@@ -2382,7 +2484,7 @@ export function catchEncodingWithContext(f) {
2382
2484
  }
2383
2485
  export function decodeTo(to, transformation) {
2384
2486
  return from => {
2385
- return make(AST.decodeTo(from.ast, to.ast, transformation ? Transformation.make(transformation) : Transformation.passthrough()), {
2487
+ return make(SchemaAST.decodeTo(from.ast, to.ast, transformation ? SchemaTransformation.make(transformation) : SchemaTransformation.passthrough()), {
2386
2488
  from,
2387
2489
  to
2388
2490
  });
@@ -2391,23 +2493,26 @@ export function decodeTo(to, transformation) {
2391
2493
  /**
2392
2494
  * Applies a transformation to a schema, creating a new schema with the same type but transformed encoding/decoding.
2393
2495
  *
2496
+ * **When to use**
2497
+ *
2498
+ * Use when the decoded type stays the same and the transformation only
2499
+ * normalizes values during encoding and decoding.
2500
+ *
2394
2501
  * **Details**
2395
2502
  *
2396
- * This is a curried function: call it with a transformation object, then call the returned function with a schema.
2397
- * The resulting schema has `Type = S["Type"]` and `Encoded = S["Encoded"]`, with the transformation applied during
2398
- * encoding and decoding operations.
2503
+ * Call it with a transformation object and then pipe a schema into the returned
2504
+ * function. The resulting schema keeps the same `Type` and `Encoded` types as
2505
+ * the source schema, while applying the transformation during both decoding and
2506
+ * encoding.
2507
+ *
2508
+ * Internally this uses `toType(self)` as the target schema and combines service
2509
+ * requirements from the source schema and the transformation.
2399
2510
  *
2400
- * Key guarantees:
2401
- * - Resulting schema has `Type = S["Type"]` and `Encoded = S["Encoded"]`
2402
- * - Uses `toType(self)` as the target schema internally (creates a schema where both Type and Encoded are `S["Type"]`)
2403
- * - Combines decoding/encoding services from the source schema and transformation
2404
- * - Transformation `decode` maps `S["Type"]` → `S["Type"]` (used during encoding)
2405
- * - Transformation `encode` maps `S["Type"]` → `S["Type"]` (used during decoding)
2511
+ * **Gotchas**
2406
2512
  *
2407
- * Common mistakes:
2408
- * - **Currying**: This is curried - must use pipe: `schema.pipe(Schema.decode(transformation))`
2409
- * - **Transformation direction**: `decode` and `encode` both operate on `S["Type"]` (same type, different values)
2410
- * - **Service dependencies**: Resulting schema requires services from the source schema and transformation; use `Schema.provideService` if needed
2513
+ * Use {@link decodeTo} instead when the transformation should change the
2514
+ * decoded type. For this helper, both transformation getters operate on
2515
+ * `S["Type"]` values.
2411
2516
  *
2412
2517
  * **Example** (Trimming string values during encoding/decoding)
2413
2518
  *
@@ -2499,7 +2604,7 @@ export function withConstructorDefault(
2499
2604
  // `S["~type.make.in"]` instead of `S["Type"]` is intentional here because
2500
2605
  // it makes easier to define the default value if there are nested defaults
2501
2606
  defaultValue) {
2502
- return schema => make(AST.withConstructorDefault(schema.ast, Effect.mapErrorEager(defaultValue, e => e.issue)), {
2607
+ return schema => make(SchemaAST.withConstructorDefault(schema.ast, Effect.mapErrorEager(defaultValue, e => e.issue)), {
2503
2608
  schema
2504
2609
  });
2505
2610
  }
@@ -2538,10 +2643,10 @@ defaultValue) {
2538
2643
  * @since 4.0.0
2539
2644
  */
2540
2645
  export function withDecodingDefaultKey(defaultValue, options) {
2541
- const encode = options?.encodingStrategy === "omit" ? Getter.omit() : Getter.passthrough();
2646
+ const encode = options?.encodingStrategy === "omit" ? SchemaGetter.omit() : SchemaGetter.passthrough();
2542
2647
  return self => {
2543
2648
  return optionalKey(toEncoded(self)).pipe(decodeTo(self, {
2544
- decode: Getter.withDefault(Effect.mapErrorEager(defaultValue, e => e.issue)),
2649
+ decode: SchemaGetter.withDefault(Effect.mapErrorEager(defaultValue, e => e.issue)),
2545
2650
  encode
2546
2651
  }));
2547
2652
  };
@@ -2578,6 +2683,11 @@ export function withDecodingDefaultTypeKey(defaultValue, options) {
2578
2683
  * and provides a default `Encoded` value when the field is missing or
2579
2684
  * `undefined` during decoding.
2580
2685
  *
2686
+ * **When to use**
2687
+ *
2688
+ * Use when the default is expressed in the encoded representation, before the
2689
+ * field's decoding transformation runs.
2690
+ *
2581
2691
  * **Details**
2582
2692
  *
2583
2693
  * The default value is specified in terms of the `Encoded` type (before any
@@ -2608,10 +2718,10 @@ export function withDecodingDefaultTypeKey(defaultValue, options) {
2608
2718
  * @since 3.10.0
2609
2719
  */
2610
2720
  export function withDecodingDefault(defaultValue, options) {
2611
- const encode = options?.encodingStrategy === "omit" ? Getter.omit() : Getter.passthrough();
2721
+ const encode = options?.encodingStrategy === "omit" ? SchemaGetter.omit() : SchemaGetter.passthrough();
2612
2722
  return self => {
2613
2723
  return optional(toEncoded(self)).pipe(decodeTo(self, {
2614
- decode: Getter.withDefault(Effect.mapErrorEager(defaultValue, e => e.issue)),
2724
+ decode: SchemaGetter.withDefault(Effect.mapErrorEager(defaultValue, e => e.issue)),
2615
2725
  encode
2616
2726
  }));
2617
2727
  };
@@ -2621,6 +2731,11 @@ export function withDecodingDefault(defaultValue, options) {
2621
2731
  * and provides a default `Type` value when the field is missing or
2622
2732
  * `undefined` during decoding.
2623
2733
  *
2734
+ * **When to use**
2735
+ *
2736
+ * Use when the default is already in the decoded representation and should not
2737
+ * pass through the field's decoding transformation.
2738
+ *
2624
2739
  * **Details**
2625
2740
  *
2626
2741
  * Unlike {@link withDecodingDefault}, the default value is specified in terms
@@ -2795,10 +2910,10 @@ export function toTaggedUnion(tag) {
2795
2910
  });
2796
2911
  function walk(schema) {
2797
2912
  const ast = schema.ast;
2798
- if (AST.isUnion(ast) && "members" in schema && globalThis.Array.isArray(schema.members) && schema.members.every(isSchema)) {
2913
+ if (SchemaAST.isUnion(ast) && "members" in schema && globalThis.Array.isArray(schema.members) && schema.members.every(isSchema)) {
2799
2914
  return schema.members.forEach(walk);
2800
2915
  }
2801
- const sentinels = AST.collectSentinels(ast);
2916
+ const sentinels = SchemaAST.collectSentinels(ast);
2802
2917
  if (sentinels.length > 0) {
2803
2918
  const literal = sentinels.find(s => s.key === tag)?.literal;
2804
2919
  if (Predicate.isPropertyKey(literal)) {
@@ -2920,7 +3035,7 @@ export function instanceOf(constructor, annotations) {
2920
3035
  return declare(u => u instanceof constructor, annotations);
2921
3036
  }
2922
3037
  /**
2923
- * Constructs an `AST.Link` that describes how a value of type `T` encodes to and decodes from a `To` schema.
3038
+ * Constructs an `SchemaAST.Link` that describes how a value of type `T` encodes to and decodes from a `To` schema.
2924
3039
  * Used when building low-level AST transformations that bridge two schema types.
2925
3040
  *
2926
3041
  * @category transforming
@@ -2928,7 +3043,7 @@ export function instanceOf(constructor, annotations) {
2928
3043
  */
2929
3044
  export function link() {
2930
3045
  return (encodeTo, transformation) => {
2931
- return new AST.Link(encodeTo.ast, Transformation.make(transformation));
3046
+ return new SchemaAST.Link(encodeTo.ast, SchemaTransformation.make(transformation));
2932
3047
  };
2933
3048
  }
2934
3049
  // -----------------------------------------------------------------------------
@@ -2992,16 +3107,16 @@ export function link() {
2992
3107
  * @category constructors
2993
3108
  * @since 4.0.0
2994
3109
  */
2995
- export const makeFilter = AST.makeFilter;
3110
+ export const makeFilter = SchemaAST.makeFilter;
2996
3111
  /**
2997
- * Groups multiple checks into a single {@link AST.FilterGroup}, applying
3112
+ * Groups multiple checks into a single {@link SchemaAST.FilterGroup}, applying
2998
3113
  * optional shared annotations to the group as a whole.
2999
3114
  *
3000
3115
  * @category constructors
3001
3116
  * @since 4.0.0
3002
3117
  */
3003
3118
  export function makeFilterGroup(checks, annotations = undefined) {
3004
- return new AST.FilterGroup(checks, annotations);
3119
+ return new SchemaAST.FilterGroup(checks, annotations);
3005
3120
  }
3006
3121
  const TRIMMED_PATTERN = "^\\S[\\s\\S]*\\S$|^\\S$|^$";
3007
3122
  /**
@@ -3054,7 +3169,7 @@ export function isTrimmed(annotations) {
3054
3169
  * @category String checks
3055
3170
  * @since 4.0.0
3056
3171
  */
3057
- export const isPattern = AST.isPattern;
3172
+ export const isPattern = SchemaAST.isPattern;
3058
3173
  /**
3059
3174
  * Validates that a string represents a finite number.
3060
3175
  *
@@ -3073,7 +3188,7 @@ export const isPattern = AST.isPattern;
3073
3188
  * @category String checks
3074
3189
  * @since 4.0.0
3075
3190
  */
3076
- export const isStringFinite = AST.isStringFinite;
3191
+ export const isStringFinite = SchemaAST.isStringFinite;
3077
3192
  /**
3078
3193
  * Validates that a string is a signed base-10 integer literal for Effect's
3079
3194
  * BigInt string encoding.
@@ -3091,7 +3206,7 @@ export const isStringFinite = AST.isStringFinite;
3091
3206
  * @category String checks
3092
3207
  * @since 4.0.0
3093
3208
  */
3094
- export const isStringBigInt = AST.isStringBigInt;
3209
+ export const isStringBigInt = SchemaAST.isStringBigInt;
3095
3210
  /**
3096
3211
  * Validates that a string has the `Symbol(description)` format used by Effect's
3097
3212
  * symbol string encoding.
@@ -3104,9 +3219,9 @@ export const isStringBigInt = AST.isStringBigInt;
3104
3219
  * @category String checks
3105
3220
  * @since 4.0.0
3106
3221
  */
3107
- export const isStringSymbol = AST.isStringSymbol;
3222
+ export const isStringSymbol = SchemaAST.isStringSymbol;
3108
3223
  /**
3109
- * Returns a RegExp for validating an RFC 4122 UUID.
3224
+ * Returns a RegExp for validating an RFC 9562 / RFC 4122 UUID.
3110
3225
  *
3111
3226
  * Optionally specify a version 1-8. If no version is specified (`undefined`), all versions are supported.
3112
3227
  */
@@ -3114,15 +3229,24 @@ const getUUIDRegExp = version => {
3114
3229
  if (version) {
3115
3230
  return new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
3116
3231
  }
3117
- return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;
3232
+ return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;
3118
3233
  };
3119
3234
  /**
3120
- * Validates that a string is a valid Universally Unique Identifier (UUID).
3121
- * Optionally specify a version (1-8) to validate against a specific UUID version.
3122
- * If no version is specified (`undefined`), all versions are supported.
3235
+ * Validates that a string is a strict Universally Unique Identifier (UUID).
3236
+ *
3237
+ * **When to use**
3238
+ *
3239
+ * Use when you need UUID semantics, including version and RFC variant bits,
3240
+ * rather than only the dashed hexadecimal shape.
3123
3241
  *
3124
3242
  * **Details**
3125
3243
  *
3244
+ * Without a version argument, this accepts UUID versions 1 through 8, the nil
3245
+ * UUID (`00000000-0000-0000-0000-000000000000`), and the max UUID
3246
+ * (`ffffffff-ffff-ffff-ffff-ffffffffffff`). With a version argument, this
3247
+ * accepts only UUIDs with that version and RFC variant bits; nil and max UUIDs
3248
+ * are not versioned UUIDs and do not match version-specific checks.
3249
+ *
3126
3250
  * JSON Schema:
3127
3251
  *
3128
3252
  * This check corresponds to a `pattern` constraint in JSON Schema that matches
@@ -3133,6 +3257,7 @@ const getUUIDRegExp = version => {
3133
3257
  * When generating test data with fast-check, this applies a `patterns`
3134
3258
  * constraint to ensure generated strings match the UUID pattern.
3135
3259
  *
3260
+ * @see {@link isGUID} for shape-only GUID validation.
3136
3261
  * @category String checks
3137
3262
  * @since 4.0.0
3138
3263
  */
@@ -3148,6 +3273,41 @@ export function isUUID(version, annotations) {
3148
3273
  ...annotations
3149
3274
  });
3150
3275
  }
3276
+ const GUID_REGEXP = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
3277
+ /**
3278
+ * Validates that a string has the GUID / UUID textual shape.
3279
+ *
3280
+ * **When to use**
3281
+ *
3282
+ * Use when you need to accept dashed hexadecimal identifiers without enforcing
3283
+ * UUID version or variant bits.
3284
+ *
3285
+ * **Details**
3286
+ *
3287
+ * This check accepts strings in the `8-4-4-4-12` hexadecimal form. JSON Schema
3288
+ * output includes the corresponding `pattern` constraint and intentionally does
3289
+ * not include `format: "uuid"` because GUID validation is looser than UUID
3290
+ * validation.
3291
+ *
3292
+ * Arbitrary:
3293
+ *
3294
+ * When generating test data with fast-check, this applies a `patterns`
3295
+ * constraint to ensure generated strings match the GUID pattern.
3296
+ *
3297
+ * @see {@link isUUID} for strict UUID validation.
3298
+ * @category String checks
3299
+ * @since 4.0.0
3300
+ */
3301
+ export function isGUID(annotations) {
3302
+ return isPattern(GUID_REGEXP, {
3303
+ expected: "a GUID",
3304
+ meta: {
3305
+ _tag: "isGUID",
3306
+ regExp: GUID_REGEXP
3307
+ },
3308
+ ...annotations
3309
+ });
3310
+ }
3151
3311
  /**
3152
3312
  * Validates that a string is a valid ULID (Universally Unique Lexicographically
3153
3313
  * Sortable Identifier).
@@ -3836,7 +3996,7 @@ export function isInt(annotations) {
3836
3996
  * @since 4.0.0
3837
3997
  */
3838
3998
  export function isInt32(annotations) {
3839
- return new AST.FilterGroup([isInt(annotations), isBetween({
3999
+ return new SchemaAST.FilterGroup([isInt(annotations), isBetween({
3840
4000
  minimum: -2147483648,
3841
4001
  maximum: 2147483647
3842
4002
  })], {
@@ -3864,7 +4024,7 @@ export function isInt32(annotations) {
3864
4024
  * @since 4.0.0
3865
4025
  */
3866
4026
  export function isUint32(annotations) {
3867
- return new AST.FilterGroup([isInt(), isBetween({
4027
+ return new SchemaAST.FilterGroup([isInt(), isBetween({
3868
4028
  minimum: 0,
3869
4029
  maximum: 4294967295
3870
4030
  })], {
@@ -4306,7 +4466,7 @@ export function isMinLength(minLength, annotations) {
4306
4466
  _tag: "isMinLength",
4307
4467
  minLength
4308
4468
  },
4309
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4469
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4310
4470
  toArbitraryConstraint: {
4311
4471
  string: {
4312
4472
  minLength
@@ -4368,7 +4528,7 @@ export function isMaxLength(maxLength, annotations) {
4368
4528
  _tag: "isMaxLength",
4369
4529
  maxLength
4370
4530
  },
4371
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4531
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4372
4532
  toArbitraryConstraint: {
4373
4533
  string: {
4374
4534
  maxLength
@@ -4410,7 +4570,7 @@ export function isLengthBetween(minimum, maximum, annotations) {
4410
4570
  minimum,
4411
4571
  maximum
4412
4572
  },
4413
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4573
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4414
4574
  toArbitraryConstraint: {
4415
4575
  string: {
4416
4576
  minLength: minimum,
@@ -4452,7 +4612,7 @@ export function isMinSize(minSize, annotations) {
4452
4612
  _tag: "isMinSize",
4453
4613
  minSize
4454
4614
  },
4455
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4615
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4456
4616
  toArbitraryConstraint: {
4457
4617
  array: {
4458
4618
  minLength: minSize
@@ -4489,7 +4649,7 @@ export function isMaxSize(maxSize, annotations) {
4489
4649
  _tag: "isMaxSize",
4490
4650
  maxSize
4491
4651
  },
4492
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4652
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4493
4653
  toArbitraryConstraint: {
4494
4654
  array: {
4495
4655
  maxLength: maxSize
@@ -4528,7 +4688,7 @@ export function isSizeBetween(minimum, maximum, annotations) {
4528
4688
  minimum,
4529
4689
  maximum
4530
4690
  },
4531
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4691
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4532
4692
  toArbitraryConstraint: {
4533
4693
  array: {
4534
4694
  minLength: minimum,
@@ -4567,7 +4727,7 @@ export function isMinProperties(minProperties, annotations) {
4567
4727
  _tag: "isMinProperties",
4568
4728
  minProperties
4569
4729
  },
4570
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4730
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4571
4731
  toArbitraryConstraint: {
4572
4732
  array: {
4573
4733
  minLength: minProperties
@@ -4604,7 +4764,7 @@ export function isMaxProperties(maxProperties, annotations) {
4604
4764
  _tag: "isMaxProperties",
4605
4765
  maxProperties
4606
4766
  },
4607
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4767
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4608
4768
  toArbitraryConstraint: {
4609
4769
  array: {
4610
4770
  maxLength: maxProperties
@@ -4643,7 +4803,7 @@ export function isPropertiesLengthBetween(minimum, maximum, annotations) {
4643
4803
  minimum,
4644
4804
  maximum
4645
4805
  },
4646
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4806
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4647
4807
  toArbitraryConstraint: {
4648
4808
  array: {
4649
4809
  minLength: minimum,
@@ -4671,19 +4831,19 @@ export function isPropertiesLengthBetween(minimum, maximum, annotations) {
4671
4831
  */
4672
4832
  export function isPropertyNames(keySchema, annotations) {
4673
4833
  const propertyNames = toEncoded(keySchema);
4674
- const parser = Parser._issue(propertyNames.ast);
4834
+ const parser = SchemaParser._issue(propertyNames.ast);
4675
4835
  return makeFilter((input, ast, options) => {
4676
4836
  const keys = Reflect.ownKeys(input);
4677
4837
  const issues = [];
4678
4838
  for (const key of keys) {
4679
4839
  const issue = parser(key, options);
4680
4840
  if (issue !== undefined) {
4681
- issues.push(new Issue.Pointer([key], issue));
4841
+ issues.push(new SchemaIssue.Pointer([key], issue));
4682
4842
  if (options.errors === "first") break;
4683
4843
  }
4684
4844
  }
4685
4845
  if (Arr.isArrayNonEmpty(issues)) {
4686
- return new Issue.Composite(ast, Option_.some(input), issues);
4846
+ return new SchemaIssue.Composite(ast, Option_.some(input), issues);
4687
4847
  }
4688
4848
  return true;
4689
4849
  }, {
@@ -4692,7 +4852,7 @@ export function isPropertyNames(keySchema, annotations) {
4692
4852
  _tag: "isPropertyNames",
4693
4853
  propertyNames: propertyNames.ast
4694
4854
  },
4695
- [AST.STRUCTURAL_ANNOTATION_KEY]: true,
4855
+ [SchemaAST.STRUCTURAL_ANNOTATION_KEY]: true,
4696
4856
  ...annotations
4697
4857
  });
4698
4858
  }
@@ -4766,12 +4926,12 @@ export function Option(value) {
4766
4926
  if (Option_.isNone(input)) {
4767
4927
  return Effect.succeedNone;
4768
4928
  }
4769
- return Effect.mapBothEager(Parser.decodeUnknownEffect(value)(input.value, options), {
4929
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(input.value, options), {
4770
4930
  onSuccess: Option_.some,
4771
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["value"], issue)])
4931
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["value"], issue)])
4772
4932
  });
4773
4933
  }
4774
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
4934
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
4775
4935
  }, {
4776
4936
  typeConstructor: {
4777
4937
  _tag: "effect/Option"
@@ -4787,7 +4947,7 @@ export function Option(value) {
4787
4947
  value
4788
4948
  }), Struct({
4789
4949
  _tag: Literal("None")
4790
- })]), Transformation.transform({
4950
+ })]), SchemaTransformation.transform({
4791
4951
  decode: e => e._tag === "None" ? Option_.none() : Option_.some(e.value),
4792
4952
  encode: o => Option_.isSome(o) ? {
4793
4953
  _tag: "Some",
@@ -4817,97 +4977,75 @@ export function Option(value) {
4817
4977
  *
4818
4978
  * **Details**
4819
4979
  *
4820
- * Decoding:
4821
- * - `null` is decoded as `None`
4822
- * - other values are decoded as `Some`
4823
- *
4824
- * Encoding:
4825
- * - `None` is encoded as `null`
4826
- * - `Some` is encoded as the value
4980
+ * Decoding maps `null` to `None` and all other values to `Some`. Encoding maps
4981
+ * `None` to `null` and maps `Some` to its value.
4827
4982
  *
4828
4983
  * @category Option
4829
4984
  * @since 3.10.0
4830
4985
  */
4831
4986
  export function OptionFromNullOr(schema) {
4832
- return NullOr(schema).pipe(decodeTo(Option(toType(schema)), Transformation.optionFromNullOr()));
4987
+ return NullOr(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromNullOr()));
4833
4988
  }
4834
4989
  /**
4835
- * Decodes an undefined-or value `T` to a required `Option<T>` value.
4990
+ * Decodes a required value that may be `undefined` to a required `Option<T>`
4991
+ * value.
4836
4992
  *
4837
4993
  * **Details**
4838
4994
  *
4839
- * Decoding:
4840
- * - `undefined` is decoded as `None`
4841
- * - other values are decoded as `Some`
4842
- *
4843
- * Encoding:
4844
- * - `None` is encoded as `undefined`
4845
- * - `Some` is encoded as the value
4995
+ * Decoding maps `undefined` to `None` and all other values to `Some`. Encoding
4996
+ * maps `None` to `undefined` and maps `Some` to its value.
4846
4997
  *
4847
4998
  * @category Option
4848
4999
  * @since 3.10.0
4849
5000
  */
4850
5001
  export function OptionFromUndefinedOr(schema) {
4851
- return UndefinedOr(schema).pipe(decodeTo(Option(toType(schema)), Transformation.optionFromUndefinedOr()));
5002
+ return UndefinedOr(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromUndefinedOr()));
4852
5003
  }
4853
5004
  /**
4854
5005
  * Decodes a nullish value `T` to a required `Option<T>` value.
4855
5006
  *
4856
5007
  * **Details**
4857
5008
  *
4858
- * Decoding:
4859
- * - `null` and `undefined` are decoded as `None`
4860
- * - other values are decoded as `Some`
4861
- *
4862
- * Encoding:
4863
- * - `None` is encoded as `null` or `undefined` depending on the provided `options.onNoneEncoding` (defaults to `undefined`)
4864
- * - `Some` is encoded as the value
5009
+ * Decoding maps `null` and `undefined` to `None` and all other values to
5010
+ * `Some`. Encoding maps `None` to `null` or `undefined` depending on
5011
+ * `options.onNoneEncoding`, which defaults to `undefined`, and maps `Some` to
5012
+ * its value.
4865
5013
  *
4866
5014
  * @category Option
4867
5015
  * @since 3.10.0
4868
5016
  */
4869
5017
  export function OptionFromNullishOr(schema, options) {
4870
- return NullishOr(schema).pipe(decodeTo(Option(toType(schema)), Transformation.optionFromNullishOr(options)));
5018
+ return NullishOr(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromNullishOr(options)));
4871
5019
  }
4872
5020
  /**
4873
5021
  * Decodes an optional value `A` to a required `Option<A>` value.
4874
5022
  *
4875
5023
  * **Details**
4876
5024
  *
4877
- * Decoding:
4878
- * - a missing key is decoded as `None`
4879
- * - a present value is decoded as `Some`
4880
- *
4881
- * Encoding:
4882
- * - `None` is encoded as missing key
4883
- * - `Some` is encoded as the value
5025
+ * Decoding maps a missing key to `None` and a present value to `Some`.
5026
+ * Encoding maps `None` to a missing key and maps `Some` to its value.
4884
5027
  *
4885
5028
  * @category Option
4886
5029
  * @since 4.0.0
4887
5030
  */
4888
5031
  export function OptionFromOptionalKey(schema) {
4889
- return optionalKey(schema).pipe(decodeTo(Option(toType(schema)), Transformation.optionFromOptionalKey()));
5032
+ return optionalKey(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromOptionalKey()));
4890
5033
  }
4891
5034
  /**
4892
- * Decodes an optional or `undefined` value `A` to an required `Option<A>`
5035
+ * Decodes an optional or `undefined` value `A` to a required `Option<A>`
4893
5036
  * value.
4894
5037
  *
4895
5038
  * **Details**
4896
5039
  *
4897
- * Decoding:
4898
- * - a missing key is decoded as `None`
4899
- * - a present key with an `undefined` value is decoded as `None`
4900
- * - all other values are decoded as `Some`
4901
- *
4902
- * Encoding:
4903
- * - `None` is encoded as missing key
4904
- * - `Some` is encoded as the value
5040
+ * Decoding maps a missing key or a present `undefined` value to `None`, and
5041
+ * maps all other values to `Some`. Encoding maps `None` to a missing key and
5042
+ * maps `Some` to its value.
4905
5043
  *
4906
5044
  * @category Option
4907
5045
  * @since 4.0.0
4908
5046
  */
4909
5047
  export function OptionFromOptional(schema) {
4910
- return optional(schema).pipe(decodeTo(Option(toType(schema)), Transformation.optionFromOptional()));
5048
+ return optional(schema).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.optionFromOptional()));
4911
5049
  }
4912
5050
  /**
4913
5051
  * Decodes an optional or `null` or `undefined` value `A` to a required `Option<A>`
@@ -4915,17 +5053,10 @@ export function OptionFromOptional(schema) {
4915
5053
  *
4916
5054
  * **Details**
4917
5055
  *
4918
- * Decoding:
4919
- * - a missing key is decoded as `None`
4920
- * - a present key with an `undefined` value is decoded as `None`
4921
- * - a present key with a `null` value is decoded as `None`
4922
- * - all other values are decoded as `Some`
4923
- *
4924
- * Encoding (controlled by `options.onNoneEncoding`):
4925
- * - `"omit"` (default): `None` is encoded as a missing key
4926
- * - `null`: `None` is encoded as `null`
4927
- * - `undefined`: `None` is encoded as `undefined`
4928
- * - `Some` is always encoded as the value
5056
+ * Decoding maps a missing key, `undefined`, or `null` to `None`, and maps all
5057
+ * other values to `Some`. Encoding maps `Some` to its value. `None` is encoded
5058
+ * according to `options.onNoneEncoding`: `"omit"` encodes a missing key,
5059
+ * `null` encodes `null`, and `undefined` encodes `undefined`.
4929
5060
  *
4930
5061
  * @category Option
4931
5062
  * @since 4.0.0
@@ -4933,7 +5064,7 @@ export function OptionFromOptional(schema) {
4933
5064
  export function OptionFromOptionalNullOr(schema, options) {
4934
5065
  const onNoneEncoding = options === undefined ? "omit" : options.onNoneEncoding;
4935
5066
  const noneValue = onNoneEncoding === null ? null : undefined;
4936
- return optional(NullOr(schema)).pipe(decodeTo(Option(toType(schema)), Transformation.transformOptional({
5067
+ return optional(NullOr(schema)).pipe(decodeTo(Option(toType(schema)), SchemaTransformation.transformOptional({
4937
5068
  decode: oe => oe.pipe(Option_.filter(Predicate.isNotNullish), Option_.some),
4938
5069
  encode: onNoneEncoding === "omit" ? Option_.flatten : ot => Option_.some(Option_.getOrElse(Option_.flatten(ot), () => noneValue))
4939
5070
  })));
@@ -4947,18 +5078,18 @@ export function OptionFromOptionalNullOr(schema, options) {
4947
5078
  export function Result(success, failure) {
4948
5079
  const schema = declareConstructor()([success, failure], ([success, failure]) => (input, ast, options) => {
4949
5080
  if (!Result_.isResult(input)) {
4950
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5081
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
4951
5082
  }
4952
5083
  switch (input._tag) {
4953
5084
  case "Success":
4954
- return Effect.mapBothEager(Parser.decodeEffect(success)(input.success, options), {
5085
+ return Effect.mapBothEager(SchemaParser.decodeEffect(success)(input.success, options), {
4955
5086
  onSuccess: Result_.succeed,
4956
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["success"], issue)])
5087
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["success"], issue)])
4957
5088
  });
4958
5089
  case "Failure":
4959
- return Effect.mapBothEager(Parser.decodeEffect(failure)(input.failure, options), {
5090
+ return Effect.mapBothEager(SchemaParser.decodeEffect(failure)(input.failure, options), {
4960
5091
  onSuccess: Result_.fail,
4961
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["failure"], issue)])
5092
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["failure"], issue)])
4962
5093
  });
4963
5094
  }
4964
5095
  }, {
@@ -4977,7 +5108,7 @@ export function Result(success, failure) {
4977
5108
  }), Struct({
4978
5109
  _tag: Literal("Failure"),
4979
5110
  failure
4980
- })]), Transformation.transform({
5111
+ })]), SchemaTransformation.transform({
4981
5112
  decode: e => e._tag === "Success" ? Result_.succeed(e.success) : Result_.fail(e.failure),
4982
5113
  encode: r => Result_.isSuccess(r) ? {
4983
5114
  _tag: "Success",
@@ -5028,35 +5159,36 @@ export function Result(success, failure) {
5028
5159
  * @since 3.10.0
5029
5160
  */
5030
5161
  export function Redacted(value, options) {
5031
- const decodeLabel = typeof options?.label === "string" ? Parser.decodeUnknownEffect(Literal(options.label)) : undefined;
5162
+ const decodeLabel = typeof options?.label === "string" ? SchemaParser.decodeUnknownEffect(Literal(options.label)) : undefined;
5032
5163
  const schema = declareConstructor()([value], ([value]) => (input, ast, poptions) => {
5033
5164
  if (Redacted_.isRedacted(input)) {
5034
- const label = decodeLabel !== undefined ? Effect.mapErrorEager(decodeLabel(input.label, poptions), issue => new Issue.Pointer(["label"], issue)) : Effect.void;
5035
- return Effect.flatMapEager(label, () => Effect.mapBothEager(Parser.decodeUnknownEffect(value)(Redacted_.value(input), poptions), {
5165
+ const label = decodeLabel !== undefined ? Effect.mapErrorEager(decodeLabel(input.label, poptions), issue => new SchemaIssue.Pointer(["label"], issue)) : Effect.void;
5166
+ return Effect.flatMapEager(label, () => Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(Redacted_.value(input), poptions), {
5036
5167
  onSuccess: () => input,
5037
5168
  onFailure: (/** ignore the actual issue because of security reasons */
5038
5169
  ) => {
5039
5170
  const oinput = Option_.some(input);
5040
- return new Issue.Composite(ast, oinput, [new Issue.Pointer(["value"], new Issue.InvalidValue(oinput))]);
5171
+ return new SchemaIssue.Composite(ast, oinput, [new SchemaIssue.Pointer(["value"], new SchemaIssue.InvalidValue(oinput))]);
5041
5172
  }
5042
5173
  }));
5043
5174
  }
5044
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5175
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
5045
5176
  }, {
5046
5177
  typeConstructor: {
5047
- _tag: "effect/Redacted"
5178
+ _tag: "effect/Redacted",
5179
+ options
5048
5180
  },
5049
5181
  generation: {
5050
- runtime: `Schema.Redacted(?)`,
5182
+ runtime: options !== undefined ? `Schema.Redacted(?, ${format(options)})` : `Schema.Redacted(?)`,
5051
5183
  Type: `Redacted.Redacted<?>`,
5052
5184
  importDeclaration: `import * as Redacted from "effect/Redacted"`
5053
5185
  },
5054
5186
  expected: "Redacted",
5055
5187
  toCodecJson: ([value]) => link()(redact(value), {
5056
- decode: Getter.transform(e => Redacted_.make(e, {
5188
+ decode: SchemaGetter.transform(e => Redacted_.make(e, {
5057
5189
  label: options?.label
5058
5190
  })),
5059
- encode: options?.disallowJsonEncode ? Getter.forbidden(oe => "Cannot serialize Redacted" + (Option_.isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : Getter.transform(Redacted_.value)
5191
+ encode: options?.disallowJsonEncode ? SchemaGetter.forbidden(oe => "Cannot serialize Redacted" + (Option_.isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : SchemaGetter.transform(Redacted_.value)
5060
5192
  }),
5061
5193
  toArbitrary: ([value]) => () => value.map(a => Redacted_.make(a, {
5062
5194
  label: options?.label
@@ -5076,7 +5208,7 @@ export function Redacted(value, options) {
5076
5208
  * @since 4.0.0
5077
5209
  */
5078
5210
  export function redact(schema) {
5079
- return schema.pipe(middlewareDecoding(Effect.mapErrorEager(Issue.redact)));
5211
+ return schema.pipe(middlewareDecoding(Effect.mapErrorEager(SchemaIssue.redact)));
5080
5212
  }
5081
5213
  /**
5082
5214
  * Decodes a value and wraps it in `Redacted<A>`. Unlike {@link Redacted} which
@@ -5091,10 +5223,10 @@ export function RedactedFromValue(value, options) {
5091
5223
  label: options?.label,
5092
5224
  disallowJsonEncode: options?.disallowEncode
5093
5225
  }), {
5094
- decode: Getter.transform(t => Redacted_.make(t, {
5226
+ decode: SchemaGetter.transform(t => Redacted_.make(t, {
5095
5227
  label: options?.label
5096
5228
  })),
5097
- encode: options?.disallowEncode ? Getter.forbidden(oe => "Cannot encode Redacted" + (Option_.isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : Getter.transform(Redacted_.value)
5229
+ encode: options?.disallowEncode ? SchemaGetter.forbidden(oe => "Cannot encode Redacted" + (Option_.isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : SchemaGetter.transform(Redacted_.value)
5098
5230
  }));
5099
5231
  }
5100
5232
  /**
@@ -5103,8 +5235,8 @@ export function RedactedFromValue(value, options) {
5103
5235
  *
5104
5236
  * **When to use**
5105
5237
  *
5106
- * Use to validate, transform, or serialize individual `Cause.Reason` values
5107
- * when typed failures and unexpected defects need separate schemas.
5238
+ * Use when serializing or decoding individual cause reasons separately from a
5239
+ * full failure cause, with distinct schemas for typed errors and defects.
5108
5240
  *
5109
5241
  * **Details**
5110
5242
  *
@@ -5120,18 +5252,18 @@ export function RedactedFromValue(value, options) {
5120
5252
  export function CauseReason(error, defect) {
5121
5253
  const schema = declareConstructor()([error, defect], ([error, defect]) => (input, ast, options) => {
5122
5254
  if (!Cause_.isReason(input)) {
5123
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5255
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
5124
5256
  }
5125
5257
  switch (input._tag) {
5126
5258
  case "Fail":
5127
- return Effect.mapBothEager(Parser.decodeUnknownEffect(error)(input.error, options), {
5259
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(error)(input.error, options), {
5128
5260
  onSuccess: Cause_.makeFailReason,
5129
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["error"], issue)])
5261
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["error"], issue)])
5130
5262
  });
5131
5263
  case "Die":
5132
- return Effect.mapBothEager(Parser.decodeUnknownEffect(defect)(input.defect, options), {
5264
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(defect)(input.defect, options), {
5133
5265
  onSuccess: Cause_.makeDieReason,
5134
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["defect"], issue)])
5266
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["defect"], issue)])
5135
5267
  });
5136
5268
  case "Interrupt":
5137
5269
  return Effect.succeed(input);
@@ -5155,7 +5287,7 @@ export function CauseReason(error, defect) {
5155
5287
  }), Struct({
5156
5288
  _tag: Literal("Interrupt"),
5157
5289
  fiberId: UndefinedOr(Finite)
5158
- })]), Transformation.transform({
5290
+ })]), SchemaTransformation.transform({
5159
5291
  decode: e => {
5160
5292
  switch (e._tag) {
5161
5293
  case "Fail":
@@ -5238,11 +5370,11 @@ export function Cause(error, defect) {
5238
5370
  const failures = ArraySchema(CauseReason(error, defect));
5239
5371
  return (input, ast, options) => {
5240
5372
  if (!Cause_.isCause(input)) {
5241
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5373
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
5242
5374
  }
5243
- return Effect.mapBothEager(Parser.decodeUnknownEffect(failures)(input.reasons, options), {
5375
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(failures)(input.reasons, options), {
5244
5376
  onSuccess: Cause_.fromReasons,
5245
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["failures"], issue)])
5377
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["failures"], issue)])
5246
5378
  });
5247
5379
  };
5248
5380
  }, {
@@ -5255,7 +5387,7 @@ export function Cause(error, defect) {
5255
5387
  importDeclaration: `import * as Cause from "effect/Cause"`
5256
5388
  },
5257
5389
  expected: "Cause",
5258
- toCodec: ([error, defect]) => link()(ArraySchema(CauseReason(error, defect)), Transformation.transform({
5390
+ toCodec: ([error, defect]) => link()(ArraySchema(CauseReason(error, defect)), SchemaTransformation.transform({
5259
5391
  decode: Cause_.fromReasons,
5260
5392
  encode: ({
5261
5393
  reasons: failures
@@ -5283,103 +5415,128 @@ function causeToFormatter(error, defect) {
5283
5415
  const causeReason = causeReasonToFormatter(error, defect);
5284
5416
  return t => `Cause([${t.reasons.map(causeReason).join(", ")}])`;
5285
5417
  }
5286
- const ErrorJsonEncoded = /*#__PURE__*/Struct({
5287
- message: String,
5288
- name: /*#__PURE__*/optionalKey(String),
5289
- stack: /*#__PURE__*/optionalKey(String)
5290
- });
5418
+ const getErrorOptionsKey = options => (options?.includeStack === true ? 1 : 0) | (options?.excludeCause === true ? 2 : 0);
5419
+ const getErrorOptions = key => {
5420
+ switch (key) {
5421
+ case 0:
5422
+ return undefined;
5423
+ case 1:
5424
+ return {
5425
+ includeStack: true
5426
+ };
5427
+ case 2:
5428
+ return {
5429
+ excludeCause: true
5430
+ };
5431
+ case 3:
5432
+ return {
5433
+ includeStack: true,
5434
+ excludeCause: true
5435
+ };
5436
+ }
5437
+ };
5438
+ const errorSchemaCache = [];
5291
5439
  /**
5292
5440
  * Schema for JavaScript `Error` objects.
5293
5441
  *
5294
5442
  * **Details**
5295
5443
  *
5296
5444
  * Default JSON serializer:
5297
- * Encodes an `Error` as an object with `message` and optional `name` properties,
5298
- * and decodes that object back into an `Error`. The stack trace is omitted from
5299
- * the encoded form for security.
5300
5445
  *
5301
- * @category schemas
5446
+ * Encodes an `Error` as an object with `message`, optional `name`, and optional
5447
+ * `cause` properties, and decodes that object back into an `Error`. Stack
5448
+ * traces are omitted by default for security. Pass `{ includeStack: true }` to
5449
+ * include stack traces, or `{ excludeCause: true }` to omit causes.
5450
+ *
5451
+ * @category constructors
5302
5452
  * @since 4.0.0
5303
5453
  */
5304
- export const Error = /*#__PURE__*/instanceOf(globalThis.Error, {
5305
- typeConstructor: {
5306
- _tag: "Error"
5307
- },
5308
- generation: {
5309
- runtime: `Schema.Error`,
5310
- Type: `globalThis.Error`
5311
- },
5312
- expected: "Error",
5313
- toCodecJson: () => link()(ErrorJsonEncoded, Transformation.errorFromErrorJsonEncoded()),
5314
- toArbitrary: () => fc => fc.string().map(message => new globalThis.Error(message))
5315
- });
5454
+ export function Error(options) {
5455
+ const key = getErrorOptionsKey(options);
5456
+ const cached = errorSchemaCache[key];
5457
+ if (cached !== undefined) {
5458
+ return cached;
5459
+ }
5460
+ const normalizedOptions = getErrorOptions(key);
5461
+ const schema = instanceOf(globalThis.Error, {
5462
+ typeConstructor: {
5463
+ _tag: "Error",
5464
+ ...(normalizedOptions === undefined ? {} : {
5465
+ options: normalizedOptions
5466
+ })
5467
+ },
5468
+ generation: {
5469
+ runtime: normalizedOptions !== undefined ? `Schema.Error(${format(normalizedOptions)})` : `Schema.Error()`,
5470
+ Type: `globalThis.Error`
5471
+ },
5472
+ expected: "Error",
5473
+ toCodecJson: () => link()(JsonError, SchemaTransformation.errorFromJsonError(normalizedOptions)),
5474
+ toArbitrary: () => fc => fc.string().map(message => new globalThis.Error(message))
5475
+ });
5476
+ errorSchemaCache[key] = schema;
5477
+ return schema;
5478
+ }
5479
+ const defectSchemaCache = [];
5316
5480
  /**
5317
- * Schema for JavaScript `Error` objects that preserves stack traces in the JSON
5481
+ * Schema for unexpected defect values represented as `unknown` with a JSON
5318
5482
  * encoded form.
5319
5483
  *
5484
+ * **When to use**
5485
+ *
5486
+ * Use when you need a schema for `Cause` defects or other unexpected failures
5487
+ * whose runtime value may be any value.
5488
+ *
5320
5489
  * **Details**
5321
5490
  *
5322
- * Default JSON serializer:
5323
- * Encodes an `Error` as an object with `message`, optional `name`, and optional
5324
- * `stack` properties, and decodes that object back into an `Error`.
5491
+ * The encoded side is {@link Json}. During decoding, JSON objects with a string
5492
+ * `message` property are decoded into JavaScript `Error` values, preserving a
5493
+ * non-default `name` and any string `stack`. Other JSON values decode
5494
+ * unchanged.
5325
5495
  *
5326
- * @category schemas
5327
- * @since 4.0.0
5328
- */
5329
- export const ErrorWithStack = /*#__PURE__*/instanceOf(globalThis.Error, {
5330
- typeConstructor: {
5331
- _tag: "ErrorWithStack"
5332
- },
5333
- generation: {
5334
- runtime: `Schema.ErrorWithStack`,
5335
- Type: `globalThis.Error`
5336
- },
5337
- expected: "Error",
5338
- toCodecJson: () => link()(ErrorJsonEncoded, Transformation.errorFromErrorJsonEncoded({
5339
- includeStack: true
5340
- })),
5341
- toArbitrary: () => fc => fc.string().map(message => new globalThis.Error(message))
5342
- });
5343
- const defectTransformation = /*#__PURE__*/new Transformation.Transformation(/*#__PURE__*/Getter.passthrough(), /*#__PURE__*/Getter.transform(u => {
5344
- try {
5345
- return JSON.parse(JSON.stringify(u));
5346
- } catch {
5347
- return format(u);
5348
- }
5349
- }));
5350
- /**
5351
- * Schema for defect values, accepting either JavaScript `Error` values encoded
5352
- * with `message` and optional `name`, or arbitrary unknown defect values.
5496
+ * During encoding, JavaScript `Error` values encode to JSON objects with
5497
+ * `name`, `message`, and optional `cause` properties. Pass
5498
+ * `{ includeStack: true }` to include string stack traces in encoded `Error`
5499
+ * defects, or `{ excludeCause: true }` to omit causes. Other values are
5500
+ * serialized through Effect's JSON formatter and then parsed back into JSON
5501
+ * when possible.
5353
5502
  *
5354
- * **Details**
5503
+ * **Gotchas**
5355
5504
  *
5356
- * Default JSON serializer:
5357
- * Unknown defects are serialized with `JSON.stringify` when possible and fall
5358
- * back to Effect's formatted representation when JSON serialization fails.
5505
+ * This schema is for carrying defects across JSON boundaries, not for
5506
+ * preserving every JavaScript value exactly. Some values cannot round-trip
5507
+ * unchanged:
5359
5508
  *
5360
- * @category constructors
5361
- * @since 3.10.0
5362
- */
5363
- export const Defect = /*#__PURE__*/Union([/*#__PURE__*/ErrorJsonEncoded.pipe(/*#__PURE__*/decodeTo(Error, /*#__PURE__*/Transformation.errorFromErrorJsonEncoded())), /*#__PURE__*/Any.pipe(/*#__PURE__*/decodeTo(/*#__PURE__*/Unknown.annotate({
5364
- toCodecJson: () => link()(Any, defectTransformation),
5365
- toArbitrary: () => fc => fc.json()
5366
- }), defectTransformation))]);
5367
- /**
5368
- * Schema for defects that also includes stack traces in the encoded form.
5509
+ * - A non-`Error` object such as `{ message: "boom" }` encodes as an
5510
+ * error-shaped JSON object and decodes back as an `Error`.
5511
+ * - JSON serialization normalizes unsupported values. For example,
5512
+ * `undefined` array elements encode as `null`, unsupported object properties
5513
+ * are omitted, and circular references are dropped.
5514
+ * - Values that cannot be represented as JSON fall back to Effect's formatted
5515
+ * string representation.
5369
5516
  *
5370
- * @category Defect
5517
+ * @see {@link Error} for a schema that only accepts JavaScript `Error` values.
5518
+ * @category constructors
5371
5519
  * @since 4.0.0
5372
5520
  */
5373
- export const DefectWithStack = /*#__PURE__*/Union([/*#__PURE__*/ErrorJsonEncoded.pipe(/*#__PURE__*/decodeTo(ErrorWithStack, /*#__PURE__*/Transformation.errorFromErrorJsonEncoded({
5374
- includeStack: true
5375
- }))), /*#__PURE__*/Any.pipe(/*#__PURE__*/decodeTo(/*#__PURE__*/Unknown.annotate({
5376
- toCodecJson: () => link()(Any, defectTransformation),
5377
- toArbitrary: () => fc => fc.json()
5378
- }), defectTransformation))]);
5521
+ export function Defect(options) {
5522
+ const key = getErrorOptionsKey(options);
5523
+ const cached = defectSchemaCache[key];
5524
+ if (cached !== undefined) {
5525
+ return cached;
5526
+ }
5527
+ const schema = Json.pipe(decodeTo(Unknown, SchemaTransformation.defectFromJson(getErrorOptions(key))));
5528
+ defectSchemaCache[key] = schema;
5529
+ return schema;
5530
+ }
5379
5531
  /**
5380
5532
  * Creates a schema for `Exit` values using schemas for the success value, typed
5381
5533
  * failure, and unexpected defect channels.
5382
5534
  *
5535
+ * **When to use**
5536
+ *
5537
+ * Use when serializing or validating an effect outcome where success, typed
5538
+ * failure, and defects each need their own schema.
5539
+ *
5383
5540
  * @category Exit
5384
5541
  * @since 3.10.0
5385
5542
  */
@@ -5388,18 +5545,18 @@ export function Exit(value, error, defect) {
5388
5545
  const cause = Cause(error, defect);
5389
5546
  return (input, ast, options) => {
5390
5547
  if (!Exit_.isExit(input)) {
5391
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5548
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
5392
5549
  }
5393
5550
  switch (input._tag) {
5394
5551
  case "Success":
5395
- return Effect.mapBothEager(Parser.decodeUnknownEffect(value)(input.value, options), {
5552
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(input.value, options), {
5396
5553
  onSuccess: Exit_.succeed,
5397
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["value"], issue)])
5554
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["value"], issue)])
5398
5555
  });
5399
5556
  case "Failure":
5400
- return Effect.mapBothEager(Parser.decodeUnknownEffect(cause)(input.cause, options), {
5557
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(cause)(input.cause, options), {
5401
5558
  onSuccess: Exit_.failCause,
5402
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["cause"], issue)])
5559
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["cause"], issue)])
5403
5560
  });
5404
5561
  }
5405
5562
  };
@@ -5419,7 +5576,7 @@ export function Exit(value, error, defect) {
5419
5576
  }), Struct({
5420
5577
  _tag: Literal("Failure"),
5421
5578
  cause: Cause(error, defect)
5422
- })]), Transformation.transform({
5579
+ })]), SchemaTransformation.transform({
5423
5580
  decode: e => e._tag === "Success" ? Exit_.succeed(e.value) : Exit_.failCause(e.cause),
5424
5581
  encode: exit => Exit_.isSuccess(exit) ? {
5425
5582
  _tag: "Success",
@@ -5475,12 +5632,12 @@ export function ReadonlyMap(key, value) {
5475
5632
  const array = ArraySchema(Tuple([key, value]));
5476
5633
  return (input, ast, options) => {
5477
5634
  if (input instanceof globalThis.Map) {
5478
- return Effect.mapBothEager(Parser.decodeUnknownEffect(array)([...input], options), {
5635
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(array)([...input], options), {
5479
5636
  onSuccess: array => new globalThis.Map(array),
5480
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["entries"], issue)])
5637
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["entries"], issue)])
5481
5638
  });
5482
5639
  }
5483
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5640
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
5484
5641
  };
5485
5642
  }, {
5486
5643
  typeConstructor: {
@@ -5491,7 +5648,7 @@ export function ReadonlyMap(key, value) {
5491
5648
  Type: `globalThis.ReadonlyMap<?, ?>`
5492
5649
  },
5493
5650
  expected: "ReadonlyMap",
5494
- toCodec: ([key, value]) => link()(ArraySchema(Tuple([key, value])), Transformation.transform({
5651
+ toCodec: ([key, value]) => link()(ArraySchema(Tuple([key, value])), SchemaTransformation.transform({
5495
5652
  decode: e => new globalThis.Map(e),
5496
5653
  encode: map => [...map.entries()]
5497
5654
  })),
@@ -5527,12 +5684,12 @@ export function HashMap(key, value) {
5527
5684
  const entries = ArraySchema(Tuple([key, value]));
5528
5685
  return (input, ast, options) => {
5529
5686
  if (HashMap_.isHashMap(input)) {
5530
- return Effect.mapBothEager(Parser.decodeUnknownEffect(entries)(HashMap_.toEntries(input), options), {
5687
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(entries)(HashMap_.toEntries(input), options), {
5531
5688
  onSuccess: HashMap_.fromIterable,
5532
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["entries"], issue)])
5689
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["entries"], issue)])
5533
5690
  });
5534
5691
  }
5535
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5692
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
5536
5693
  };
5537
5694
  }, {
5538
5695
  typeConstructor: {
@@ -5544,7 +5701,7 @@ export function HashMap(key, value) {
5544
5701
  importDeclaration: `import * as HashMap from "effect/HashMap"`
5545
5702
  },
5546
5703
  expected: "HashMap",
5547
- toCodec: ([key, value]) => link()(ArraySchema(Tuple([key, value])), Transformation.transform({
5704
+ toCodec: ([key, value]) => link()(ArraySchema(Tuple([key, value])), SchemaTransformation.transform({
5548
5705
  decode: HashMap_.fromIterable,
5549
5706
  encode: HashMap_.toEntries
5550
5707
  })),
@@ -5580,12 +5737,12 @@ export function ReadonlySet(value) {
5580
5737
  const array = ArraySchema(value);
5581
5738
  return (input, ast, options) => {
5582
5739
  if (input instanceof globalThis.Set) {
5583
- return Effect.mapBothEager(Parser.decodeUnknownEffect(array)([...input], options), {
5740
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(array)([...input], options), {
5584
5741
  onSuccess: array => new globalThis.Set(array),
5585
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["values"], issue)])
5742
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["values"], issue)])
5586
5743
  });
5587
5744
  }
5588
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5745
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
5589
5746
  };
5590
5747
  }, {
5591
5748
  typeConstructor: {
@@ -5596,7 +5753,7 @@ export function ReadonlySet(value) {
5596
5753
  Type: `globalThis.ReadonlySet<?>`
5597
5754
  },
5598
5755
  expected: "ReadonlySet",
5599
- toCodec: ([value]) => link()(ArraySchema(value), Transformation.transform({
5756
+ toCodec: ([value]) => link()(ArraySchema(value), SchemaTransformation.transform({
5600
5757
  decode: e => new globalThis.Set(e),
5601
5758
  encode: set => [...set.values()]
5602
5759
  })),
@@ -5631,12 +5788,12 @@ export function HashSet(value) {
5631
5788
  const values = ArraySchema(value);
5632
5789
  return (input, ast, options) => {
5633
5790
  if (HashSet_.isHashSet(input)) {
5634
- return Effect.mapBothEager(Parser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {
5791
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {
5635
5792
  onSuccess: HashSet_.fromIterable,
5636
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["values"], issue)])
5793
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["values"], issue)])
5637
5794
  });
5638
5795
  }
5639
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5796
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
5640
5797
  };
5641
5798
  }, {
5642
5799
  typeConstructor: {
@@ -5647,7 +5804,7 @@ export function HashSet(value) {
5647
5804
  Type: `HashSet.HashSet<?>`
5648
5805
  },
5649
5806
  expected: "HashSet",
5650
- toCodec: ([value]) => link()(ArraySchema(value), Transformation.transform({
5807
+ toCodec: ([value]) => link()(ArraySchema(value), SchemaTransformation.transform({
5651
5808
  decode: HashSet_.fromIterable,
5652
5809
  encode: Arr.fromIterable
5653
5810
  })),
@@ -5682,12 +5839,12 @@ export function Chunk(value) {
5682
5839
  const values = ArraySchema(value);
5683
5840
  return (input, ast, options) => {
5684
5841
  if (Chunk_.isChunk(input)) {
5685
- return Effect.mapBothEager(Parser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {
5842
+ return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {
5686
5843
  onSuccess: Chunk_.fromIterable,
5687
- onFailure: issue => new Issue.Composite(ast, Option_.some(input), [new Issue.Pointer(["values"], issue)])
5844
+ onFailure: issue => new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["values"], issue)])
5688
5845
  });
5689
5846
  }
5690
- return Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
5847
+ return Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
5691
5848
  };
5692
5849
  }, {
5693
5850
  typeConstructor: {
@@ -5698,7 +5855,7 @@ export function Chunk(value) {
5698
5855
  Type: `Chunk.Chunk<?>`
5699
5856
  },
5700
5857
  expected: "Chunk",
5701
- toCodec: ([value]) => link()(ArraySchema(value), Transformation.transform({
5858
+ toCodec: ([value]) => link()(ArraySchema(value), SchemaTransformation.transform({
5702
5859
  decode: Chunk_.fromIterable,
5703
5860
  encode: Arr.fromIterable
5704
5861
  })),
@@ -5744,10 +5901,10 @@ export const RegExp = /*#__PURE__*/instanceOf(globalThis.RegExp, {
5744
5901
  toCodecJson: () => link()(Struct({
5745
5902
  source: String,
5746
5903
  flags: String
5747
- }), Transformation.transformOrFail({
5904
+ }), SchemaTransformation.transformOrFail({
5748
5905
  decode: e => Effect.try({
5749
5906
  try: () => new globalThis.RegExp(e.source, e.flags),
5750
- catch: e => new Issue.InvalidValue(Option_.some(e), {
5907
+ catch: e => new SchemaIssue.InvalidValue(Option_.some(e), {
5751
5908
  message: globalThis.String(e)
5752
5909
  })
5753
5910
  }),
@@ -5787,7 +5944,7 @@ export const URL = /*#__PURE__*/instanceOf(globalThis.URL, {
5787
5944
  Type: `globalThis.URL`
5788
5945
  },
5789
5946
  expected: "URL",
5790
- toCodecJson: () => link()(URLString, Transformation.urlFromString),
5947
+ toCodecJson: () => link()(URLString, SchemaTransformation.urlFromString),
5791
5948
  toArbitrary: () => fc => fc.webUrl().map(s => new globalThis.URL(s)),
5792
5949
  toEquivalence: () => (a, b) => a.toString() === b.toString()
5793
5950
  });
@@ -5805,7 +5962,7 @@ export const URL = /*#__PURE__*/instanceOf(globalThis.URL, {
5805
5962
  * @category URL
5806
5963
  * @since 4.0.0
5807
5964
  */
5808
- export const URLFromString = /*#__PURE__*/URLString.pipe(/*#__PURE__*/decodeTo(URL, Transformation.urlFromString));
5965
+ export const URLFromString = /*#__PURE__*/URLString.pipe(/*#__PURE__*/decodeTo(URL, SchemaTransformation.urlFromString));
5809
5966
  const DateString = /*#__PURE__*/String.annotate({
5810
5967
  expected: "a string in ISO 8601 format that will be decoded as a Date"
5811
5968
  });
@@ -5814,8 +5971,8 @@ const DateString = /*#__PURE__*/String.annotate({
5814
5971
  *
5815
5972
  * **When to use**
5816
5973
  *
5817
- * Use to validate in-memory values that must already be JavaScript `Date`
5818
- * instances.
5974
+ * Use to validate in-memory values that must already be JavaScript date
5975
+ * objects.
5819
5976
  *
5820
5977
  * **Details**
5821
5978
  *
@@ -5846,7 +6003,7 @@ export const Date = /*#__PURE__*/instanceOf(globalThis.Date, {
5846
6003
  Type: `globalThis.Date`
5847
6004
  },
5848
6005
  expected: "Date",
5849
- toCodecJson: () => link()(DateString, Transformation.dateFromString),
6006
+ toCodecJson: () => link()(DateString, SchemaTransformation.dateFromString),
5850
6007
  toArbitrary: () => (fc, ctx) => fc.date(ctx?.constraints?.date)
5851
6008
  });
5852
6009
  /**
@@ -5876,7 +6033,7 @@ export const Date = /*#__PURE__*/instanceOf(globalThis.Date, {
5876
6033
  * @category Date
5877
6034
  * @since 3.10.0
5878
6035
  */
5879
- export const DateFromString = /*#__PURE__*/DateString.pipe(/*#__PURE__*/decodeTo(Date, Transformation.dateFromString));
6036
+ export const DateFromString = /*#__PURE__*/DateString.pipe(/*#__PURE__*/decodeTo(Date, SchemaTransformation.dateFromString));
5880
6037
  /**
5881
6038
  * Schema for **valid** JavaScript `Date` objects.
5882
6039
  *
@@ -5930,7 +6087,7 @@ export const Duration = /*#__PURE__*/declare(Duration_.isDuration, {
5930
6087
  }), Struct({
5931
6088
  _tag: Literal("Millis"),
5932
6089
  value: Int
5933
- })]), Transformation.transform({
6090
+ })]), SchemaTransformation.transform({
5934
6091
  decode: e => {
5935
6092
  switch (e._tag) {
5936
6093
  case "Infinity":
@@ -5988,7 +6145,7 @@ const DurationString = /*#__PURE__*/String.annotate({
5988
6145
  * @category Duration
5989
6146
  * @since 4.0.0
5990
6147
  */
5991
- export const DurationFromString = /*#__PURE__*/DurationString.pipe(/*#__PURE__*/decodeTo(Duration, Transformation.durationFromString));
6148
+ export const DurationFromString = /*#__PURE__*/DurationString.pipe(/*#__PURE__*/decodeTo(Duration, SchemaTransformation.durationFromString));
5992
6149
  const bigint0 = /*#__PURE__*/globalThis.BigInt(0);
5993
6150
  /**
5994
6151
  * Schema that decodes a non-negative `bigint` into a
@@ -6007,7 +6164,7 @@ const bigint0 = /*#__PURE__*/globalThis.BigInt(0);
6007
6164
  * @category Duration
6008
6165
  * @since 3.10.0
6009
6166
  */
6010
- export const DurationFromNanos = /*#__PURE__*/BigInt.check(isGreaterThanOrEqualToBigInt(bigint0)).pipe(/*#__PURE__*/decodeTo(Duration, Transformation.durationFromNanos));
6167
+ export const DurationFromNanos = /*#__PURE__*/BigInt.check(isGreaterThanOrEqualToBigInt(bigint0)).pipe(/*#__PURE__*/decodeTo(Duration, SchemaTransformation.durationFromNanos));
6011
6168
  /**
6012
6169
  * Schema that decodes a non-negative (possibly infinite)
6013
6170
  * integer into a `Duration`, treating the integer value as the duration in
@@ -6026,7 +6183,7 @@ export const DurationFromNanos = /*#__PURE__*/BigInt.check(isGreaterThanOrEqualT
6026
6183
  * @category Duration
6027
6184
  * @since 3.10.0
6028
6185
  */
6029
- export const DurationFromMillis = /*#__PURE__*/Number.check(isGreaterThanOrEqualTo(0)).pipe(/*#__PURE__*/decodeTo(Duration, Transformation.durationFromMillis));
6186
+ export const DurationFromMillis = /*#__PURE__*/Number.check(isGreaterThanOrEqualTo(0)).pipe(/*#__PURE__*/decodeTo(Duration, SchemaTransformation.durationFromMillis));
6030
6187
  const BigDecimalString = /*#__PURE__*/String.annotate({
6031
6188
  expected: "a string that will be decoded as a BigDecimal"
6032
6189
  });
@@ -6035,7 +6192,7 @@ const BigDecimalString = /*#__PURE__*/String.annotate({
6035
6192
  *
6036
6193
  * **When to use**
6037
6194
  *
6038
- * Use when values are already Effect decimal instances and need schema
6195
+ * Use when you already have Effect decimal instances and need schema
6039
6196
  * validation, formatting, equivalence, and JSON string serialization.
6040
6197
  *
6041
6198
  * **Details**
@@ -6059,7 +6216,7 @@ export const BigDecimal = /*#__PURE__*/declare(BigDecimal_.isBigDecimal, {
6059
6216
  importDeclaration: `import * as BigDecimal from "effect/BigDecimal"`
6060
6217
  },
6061
6218
  expected: "BigDecimal",
6062
- toCodecJson: () => link()(BigDecimalString, Transformation.bigDecimalFromString),
6219
+ toCodecJson: () => link()(BigDecimalString, SchemaTransformation.bigDecimalFromString),
6063
6220
  toArbitrary: () => fc => fc.tuple(fc.bigInt(), fc.integer({
6064
6221
  min: 0,
6065
6222
  max: 20
@@ -6094,7 +6251,7 @@ export const BigDecimal = /*#__PURE__*/declare(BigDecimal_.isBigDecimal, {
6094
6251
  * @category BigDecimal
6095
6252
  * @since 4.0.0
6096
6253
  */
6097
- export const BigDecimalFromString = /*#__PURE__*/BigDecimalString.pipe(/*#__PURE__*/decodeTo(BigDecimal, Transformation.bigDecimalFromString));
6254
+ export const BigDecimalFromString = /*#__PURE__*/BigDecimalString.pipe(/*#__PURE__*/decodeTo(BigDecimal, SchemaTransformation.bigDecimalFromString));
6098
6255
  /**
6099
6256
  * Schema that decodes a JSON-encoded string into an `unknown` value.
6100
6257
  *
@@ -6191,8 +6348,8 @@ export function fromJsonString(schema) {
6191
6348
  return String.annotate({
6192
6349
  expected: "a string that will be decoded as JSON",
6193
6350
  contentMediaType: "application/json",
6194
- contentSchema: AST.toEncoded(schema.ast)
6195
- }).pipe(decodeTo(schema, Transformation.fromJsonString));
6351
+ contentSchema: SchemaAST.toEncoded(schema.ast)
6352
+ }).pipe(decodeTo(schema, SchemaTransformation.fromJsonString));
6196
6353
  }
6197
6354
  /**
6198
6355
  * Schema for JavaScript `File` objects.
@@ -6219,9 +6376,9 @@ export const File = /*#__PURE__*/instanceOf(globalThis.File, {
6219
6376
  type: String,
6220
6377
  name: String,
6221
6378
  lastModified: Number
6222
- }), Transformation.transformOrFail({
6379
+ }), SchemaTransformation.transformOrFail({
6223
6380
  decode: e => Result_.match(Encoding.decodeBase64(e.data), {
6224
- onFailure: error => Effect.fail(new Issue.InvalidValue(Option_.some(e.data), {
6381
+ onFailure: error => Effect.fail(new SchemaIssue.InvalidValue(Option_.some(e.data), {
6225
6382
  message: error.message
6226
6383
  })),
6227
6384
  onSuccess: bytes => {
@@ -6242,7 +6399,7 @@ export const File = /*#__PURE__*/instanceOf(globalThis.File, {
6242
6399
  lastModified: file.lastModified
6243
6400
  };
6244
6401
  },
6245
- catch: e => new Issue.InvalidValue(Option_.some(file), {
6402
+ catch: e => new SchemaIssue.InvalidValue(Option_.some(file), {
6246
6403
  message: globalThis.String(e)
6247
6404
  })
6248
6405
  })
@@ -6274,7 +6431,7 @@ export const FormData = /*#__PURE__*/instanceOf(globalThis.FormData, {
6274
6431
  }), Struct({
6275
6432
  _tag: tag("File"),
6276
6433
  value: File
6277
- })])])), Transformation.transformOrFail({
6434
+ })])])), SchemaTransformation.transformOrFail({
6278
6435
  decode: e => {
6279
6436
  const out = new globalThis.FormData();
6280
6437
  for (const [key, entry] of e) {
@@ -6388,7 +6545,7 @@ export const FormData = /*#__PURE__*/instanceOf(globalThis.FormData, {
6388
6545
  * @since 4.0.0
6389
6546
  */
6390
6547
  export function fromFormData(schema) {
6391
- return FormData.pipe(decodeTo(schema, Transformation.fromFormData));
6548
+ return FormData.pipe(decodeTo(schema, SchemaTransformation.fromFormData));
6392
6549
  }
6393
6550
  /**
6394
6551
  * Schema for JavaScript `URLSearchParams` objects.
@@ -6411,7 +6568,7 @@ export const URLSearchParams = /*#__PURE__*/instanceOf(globalThis.URLSearchParam
6411
6568
  expected: "URLSearchParams",
6412
6569
  toCodecJson: () => link()(String.annotate({
6413
6570
  expected: "a query string that will be decoded as URLSearchParams"
6414
- }), Transformation.transform({
6571
+ }), SchemaTransformation.transform({
6415
6572
  decode: e => new globalThis.URLSearchParams(e),
6416
6573
  encode: params => params.toString()
6417
6574
  }))
@@ -6497,7 +6654,7 @@ export const URLSearchParams = /*#__PURE__*/instanceOf(globalThis.URLSearchParam
6497
6654
  * @since 4.0.0
6498
6655
  */
6499
6656
  export function fromURLSearchParams(schema) {
6500
- return URLSearchParams.pipe(decodeTo(schema, Transformation.fromURLSearchParams));
6657
+ return URLSearchParams.pipe(decodeTo(schema, SchemaTransformation.fromURLSearchParams));
6501
6658
  }
6502
6659
  /**
6503
6660
  * Schema for finite numbers, rejecting `NaN`, `Infinity`, and `-Infinity`.
@@ -6532,7 +6689,7 @@ export const Int = /*#__PURE__*/Number.check(/*#__PURE__*/isInt());
6532
6689
  */
6533
6690
  export const NumberFromString = /*#__PURE__*/String.annotate({
6534
6691
  expected: "a string that will be decoded as a number"
6535
- }).pipe(/*#__PURE__*/decodeTo(Number, Transformation.numberFromString));
6692
+ }).pipe(/*#__PURE__*/decodeTo(Number, SchemaTransformation.numberFromString));
6536
6693
  /**
6537
6694
  * Schema that parses a string into a finite number.
6538
6695
  *
@@ -6550,7 +6707,7 @@ export const NumberFromString = /*#__PURE__*/String.annotate({
6550
6707
  */
6551
6708
  export const FiniteFromString = /*#__PURE__*/String.annotate({
6552
6709
  expected: "a string that will be decoded as a finite number"
6553
- }).pipe(/*#__PURE__*/decodeTo(Finite, Transformation.numberFromString));
6710
+ }).pipe(/*#__PURE__*/decodeTo(Finite, SchemaTransformation.numberFromString));
6554
6711
  /**
6555
6712
  * Schema that parses a string into a `bigint`.
6556
6713
  *
@@ -6579,7 +6736,7 @@ export const FiniteFromString = /*#__PURE__*/String.annotate({
6579
6736
  * @category BigInt
6580
6737
  * @since 4.0.0
6581
6738
  */
6582
- export const BigIntFromString = /*#__PURE__*/make(AST.bigIntString).pipe(/*#__PURE__*/decodeTo(BigInt, Transformation.bigintFromString));
6739
+ export const BigIntFromString = /*#__PURE__*/make(SchemaAST.bigIntString).pipe(/*#__PURE__*/decodeTo(BigInt, SchemaTransformation.bigintFromString));
6583
6740
  /**
6584
6741
  * Schema for strings that contains no leading or trailing whitespaces.
6585
6742
  *
@@ -6603,7 +6760,7 @@ export const Trimmed = /*#__PURE__*/String.check(/*#__PURE__*/isTrimmed());
6603
6760
  */
6604
6761
  export const Trim = /*#__PURE__*/String.annotate({
6605
6762
  expected: "a string that will be decoded as a trimmed string"
6606
- }).pipe(/*#__PURE__*/decodeTo(Trimmed, /*#__PURE__*/Transformation.trim()));
6763
+ }).pipe(/*#__PURE__*/decodeTo(Trimmed, /*#__PURE__*/SchemaTransformation.trim()));
6607
6764
  /**
6608
6765
  * Decodes a base64 (RFC4648) encoded string into a UTF-8 string.
6609
6766
  *
@@ -6620,7 +6777,7 @@ export const Trim = /*#__PURE__*/String.annotate({
6620
6777
  */
6621
6778
  export const StringFromBase64 = /*#__PURE__*/String.annotate({
6622
6779
  expected: "a base64 encoded string that will be decoded as a UTF-8 string"
6623
- }).pipe(/*#__PURE__*/decodeTo(String, Transformation.stringFromBase64String));
6780
+ }).pipe(/*#__PURE__*/decodeTo(String, SchemaTransformation.stringFromBase64String));
6624
6781
  /**
6625
6782
  * Decodes a base64 (URL) encoded string into a UTF-8 string.
6626
6783
  *
@@ -6637,7 +6794,7 @@ export const StringFromBase64 = /*#__PURE__*/String.annotate({
6637
6794
  */
6638
6795
  export const StringFromBase64Url = /*#__PURE__*/String.annotate({
6639
6796
  expected: "a base64 (URL) encoded string that will be decoded as a UTF-8 string"
6640
- }).pipe(/*#__PURE__*/decodeTo(String, Transformation.stringFromBase64UrlString));
6797
+ }).pipe(/*#__PURE__*/decodeTo(String, SchemaTransformation.stringFromBase64UrlString));
6641
6798
  /**
6642
6799
  * Decodes a hex encoded string into a UTF-8 string.
6643
6800
  *
@@ -6654,7 +6811,7 @@ export const StringFromBase64Url = /*#__PURE__*/String.annotate({
6654
6811
  */
6655
6812
  export const StringFromHex = /*#__PURE__*/String.annotate({
6656
6813
  expected: "a hex encoded string that will be decoded as a UTF-8 string"
6657
- }).pipe(/*#__PURE__*/decodeTo(String, Transformation.stringFromHexString));
6814
+ }).pipe(/*#__PURE__*/decodeTo(String, SchemaTransformation.stringFromHexString));
6658
6815
  /**
6659
6816
  * Decodes a URI component encoded string into a UTF-8 string.
6660
6817
  * Can be used to store data in a URL.
@@ -6690,7 +6847,7 @@ export const StringFromHex = /*#__PURE__*/String.annotate({
6690
6847
  */
6691
6848
  export const StringFromUriComponent = /*#__PURE__*/String.annotate({
6692
6849
  expected: "a URI component encoded string that will be decoded as a UTF-8 string"
6693
- }).pipe(/*#__PURE__*/decodeTo(String, Transformation.stringFromUriComponent));
6850
+ }).pipe(/*#__PURE__*/decodeTo(String, SchemaTransformation.stringFromUriComponent));
6694
6851
  /**
6695
6852
  * Schema for property keys accepted by Effect schemas: finite `number`,
6696
6853
  * `symbol`, or `string`.
@@ -6737,7 +6894,7 @@ export const StandardSchemaV1FailureResult = /*#__PURE__*/Struct({
6737
6894
  * @category boolean
6738
6895
  * @since 4.0.0
6739
6896
  */
6740
- export const BooleanFromBit = /*#__PURE__*/Literals([0, 1]).pipe(/*#__PURE__*/decodeTo(Boolean, /*#__PURE__*/Transformation.transform({
6897
+ export const BooleanFromBit = /*#__PURE__*/Literals([0, 1]).pipe(/*#__PURE__*/decodeTo(Boolean, /*#__PURE__*/SchemaTransformation.transform({
6741
6898
  decode: bit => bit === 1,
6742
6899
  encode: bool => bool ? 1 : 0
6743
6900
  })));
@@ -6767,7 +6924,7 @@ export const Uint8Array = /*#__PURE__*/instanceOf(globalThis.Uint8Array, {
6767
6924
  Type: `globalThis.Uint8Array`
6768
6925
  },
6769
6926
  expected: "Uint8Array",
6770
- toCodecJson: () => link()(Base64String, Transformation.uint8ArrayFromBase64String),
6927
+ toCodecJson: () => link()(Base64String, SchemaTransformation.uint8ArrayFromBase64String),
6771
6928
  toArbitrary: () => fc => fc.uint8Array()
6772
6929
  });
6773
6930
  /**
@@ -6785,7 +6942,7 @@ export const Uint8Array = /*#__PURE__*/instanceOf(globalThis.Uint8Array, {
6785
6942
  * @category Uint8Array
6786
6943
  * @since 3.10.0
6787
6944
  */
6788
- export const Uint8ArrayFromBase64 = /*#__PURE__*/Base64String.pipe(/*#__PURE__*/decodeTo(Uint8Array, Transformation.uint8ArrayFromBase64String));
6945
+ export const Uint8ArrayFromBase64 = /*#__PURE__*/Base64String.pipe(/*#__PURE__*/decodeTo(Uint8Array, SchemaTransformation.uint8ArrayFromBase64String));
6789
6946
  /**
6790
6947
  * Schema that decodes a base64 (URL) encoded string into a
6791
6948
  * `Uint8Array`.
@@ -6804,8 +6961,8 @@ export const Uint8ArrayFromBase64 = /*#__PURE__*/Base64String.pipe(/*#__PURE__*/
6804
6961
  export const Uint8ArrayFromBase64Url = /*#__PURE__*/String.annotate({
6805
6962
  expected: "a base64 (URL) encoded string that will be decoded as a Uint8Array"
6806
6963
  }).pipe(/*#__PURE__*/decodeTo(Uint8Array, {
6807
- decode: /*#__PURE__*/Getter.decodeBase64Url(),
6808
- encode: /*#__PURE__*/Getter.encodeBase64Url()
6964
+ decode: /*#__PURE__*/SchemaGetter.decodeBase64Url(),
6965
+ encode: /*#__PURE__*/SchemaGetter.encodeBase64Url()
6809
6966
  }));
6810
6967
  /**
6811
6968
  * Schema that decodes a hex encoded string into a
@@ -6825,8 +6982,8 @@ export const Uint8ArrayFromBase64Url = /*#__PURE__*/String.annotate({
6825
6982
  export const Uint8ArrayFromHex = /*#__PURE__*/String.annotate({
6826
6983
  expected: "a hex encoded string that will be decoded as a Uint8Array"
6827
6984
  }).pipe(/*#__PURE__*/decodeTo(Uint8Array, {
6828
- decode: /*#__PURE__*/Getter.decodeHex(),
6829
- encode: /*#__PURE__*/Getter.encodeHex()
6985
+ decode: /*#__PURE__*/SchemaGetter.decodeHex(),
6986
+ encode: /*#__PURE__*/SchemaGetter.encodeHex()
6830
6987
  }));
6831
6988
  /**
6832
6989
  * Schema for `DateTime.Utc` values.
@@ -6859,7 +7016,7 @@ export const DateTimeUtc = /*#__PURE__*/declare(u => DateTime.isDateTime(u) && D
6859
7016
  importDeclaration: `import * as DateTime from "effect/DateTime"`
6860
7017
  },
6861
7018
  expected: "DateTime.Utc",
6862
- toCodecJson: () => link()(String, Transformation.dateTimeUtcFromString),
7019
+ toCodecJson: () => link()(String, SchemaTransformation.dateTimeUtcFromString),
6863
7020
  toArbitrary: () => (fc, ctx) => fc.date({
6864
7021
  noInvalidDate: true,
6865
7022
  ...ctx?.constraints?.date
@@ -6872,8 +7029,8 @@ export const DateTimeUtc = /*#__PURE__*/declare(u => DateTime.isDateTime(u) && D
6872
7029
  *
6873
7030
  * **When to use**
6874
7031
  *
6875
- * Use when a boundary provides valid JavaScript `Date` objects but the decoded
6876
- * model should use `DateTime.Utc`.
7032
+ * Use when you need to decode valid JavaScript `Date` objects into
7033
+ * `DateTime.Utc` values.
6877
7034
  *
6878
7035
  * **Details**
6879
7036
  *
@@ -6892,8 +7049,8 @@ export const DateTimeUtc = /*#__PURE__*/declare(u => DateTime.isDateTime(u) && D
6892
7049
  * @since 3.12.0
6893
7050
  */
6894
7051
  export const DateTimeUtcFromDate = /*#__PURE__*/DateValid.pipe(/*#__PURE__*/decodeTo(DateTimeUtc, {
6895
- decode: /*#__PURE__*/Getter.dateTimeUtcFromInput(),
6896
- encode: /*#__PURE__*/Getter.transform(DateTime.toDateUtc)
7052
+ decode: /*#__PURE__*/SchemaGetter.dateTimeUtcFromInput(),
7053
+ encode: /*#__PURE__*/SchemaGetter.transform(DateTime.toDateUtc)
6897
7054
  }));
6898
7055
  /**
6899
7056
  * Schema that decodes a date-time string into a `DateTime.Utc`.
@@ -6914,7 +7071,7 @@ export const DateTimeUtcFromDate = /*#__PURE__*/DateValid.pipe(/*#__PURE__*/deco
6914
7071
  */
6915
7072
  export const DateTimeUtcFromString = /*#__PURE__*/String.annotate({
6916
7073
  expected: "a string that will be decoded as a DateTime.Utc"
6917
- }).pipe(/*#__PURE__*/decodeTo(DateTimeUtc, Transformation.dateTimeUtcFromString));
7074
+ }).pipe(/*#__PURE__*/decodeTo(DateTimeUtc, SchemaTransformation.dateTimeUtcFromString));
6918
7075
  /**
6919
7076
  * Schema that decodes a number into a `DateTime.Utc`.
6920
7077
  *
@@ -6930,8 +7087,8 @@ export const DateTimeUtcFromString = /*#__PURE__*/String.annotate({
6930
7087
  * @since 4.0.0
6931
7088
  */
6932
7089
  export const DateTimeUtcFromMillis = /*#__PURE__*/Number.pipe(/*#__PURE__*/decodeTo(DateTimeUtc, {
6933
- decode: /*#__PURE__*/Getter.dateTimeUtcFromInput(),
6934
- encode: /*#__PURE__*/Getter.transform(DateTime.toEpochMillis)
7090
+ decode: /*#__PURE__*/SchemaGetter.dateTimeUtcFromInput(),
7091
+ encode: /*#__PURE__*/SchemaGetter.transform(DateTime.toEpochMillis)
6935
7092
  }));
6936
7093
  /**
6937
7094
  * Schema for `DateTime.TimeZone.Offset` values.
@@ -6955,7 +7112,7 @@ export const TimeZoneOffset = /*#__PURE__*/declare(DateTime.isTimeZoneOffset, {
6955
7112
  importDeclaration: `import * as DateTime from "effect/DateTime"`
6956
7113
  },
6957
7114
  expected: "DateTime.TimeZone.Offset",
6958
- toCodecJson: () => link()(Number, Transformation.timeZoneOffsetFromNumber),
7115
+ toCodecJson: () => link()(Number, SchemaTransformation.timeZoneOffsetFromNumber),
6959
7116
  toArbitrary: () => fc => fc.integer({
6960
7117
  min: -12 * 60 * 60 * 1000,
6961
7118
  max: 14 * 60 * 60 * 1000
@@ -6988,7 +7145,7 @@ export const TimeZoneNamed = /*#__PURE__*/declare(DateTime.isTimeZoneNamed, {
6988
7145
  importDeclaration: `import * as DateTime from "effect/DateTime"`
6989
7146
  },
6990
7147
  expected: "DateTime.TimeZone.Named",
6991
- toCodecJson: () => link()(TimeZoneNamedString, Transformation.timeZoneNamedFromString),
7148
+ toCodecJson: () => link()(TimeZoneNamedString, SchemaTransformation.timeZoneNamedFromString),
6992
7149
  toArbitrary: () => fc => fc.constantFrom(...["UTC", "Europe/London", "America/New_York", "Asia/Tokyo", "Australia/Sydney"].map(DateTime.zoneMakeNamedUnsafe)),
6993
7150
  toFormatter: () => tz => DateTime.zoneToString(tz),
6994
7151
  toEquivalence: () => (a, b) => a.id === b.id
@@ -7007,7 +7164,7 @@ export const TimeZoneNamed = /*#__PURE__*/declare(DateTime.isTimeZoneNamed, {
7007
7164
  * @category DateTime
7008
7165
  * @since 4.0.0
7009
7166
  */
7010
- export const TimeZoneNamedFromString = /*#__PURE__*/TimeZoneNamedString.pipe(/*#__PURE__*/decodeTo(TimeZoneNamed, Transformation.timeZoneNamedFromString));
7167
+ export const TimeZoneNamedFromString = /*#__PURE__*/TimeZoneNamedString.pipe(/*#__PURE__*/decodeTo(TimeZoneNamed, SchemaTransformation.timeZoneNamedFromString));
7011
7168
  const TimeZoneString = /*#__PURE__*/String.annotate({
7012
7169
  expected: "a time zone string (IANA identifier or offset like +03:00)"
7013
7170
  });
@@ -7034,7 +7191,7 @@ export const TimeZone = /*#__PURE__*/declare(DateTime.isTimeZone, {
7034
7191
  importDeclaration: `import * as DateTime from "effect/DateTime"`
7035
7192
  },
7036
7193
  expected: "DateTime.TimeZone",
7037
- toCodecJson: () => link()(TimeZoneString, Transformation.timeZoneFromString),
7194
+ toCodecJson: () => link()(TimeZoneString, SchemaTransformation.timeZoneFromString),
7038
7195
  toArbitrary: () => fc => fc.oneof(fc.integer({
7039
7196
  min: -12 * 60 * 60 * 1000,
7040
7197
  max: 14 * 60 * 60 * 1000
@@ -7056,7 +7213,7 @@ export const TimeZone = /*#__PURE__*/declare(DateTime.isTimeZone, {
7056
7213
  * @category DateTime
7057
7214
  * @since 4.0.0
7058
7215
  */
7059
- export const TimeZoneFromString = /*#__PURE__*/TimeZoneString.pipe(/*#__PURE__*/decodeTo(TimeZone, Transformation.timeZoneFromString));
7216
+ export const TimeZoneFromString = /*#__PURE__*/TimeZoneString.pipe(/*#__PURE__*/decodeTo(TimeZone, SchemaTransformation.timeZoneFromString));
7060
7217
  const DateTimeZonedString = /*#__PURE__*/String.annotate({
7061
7218
  expected: "a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"
7062
7219
  });
@@ -7085,7 +7242,7 @@ export const DateTimeZoned = /*#__PURE__*/declare(u => DateTime.isDateTime(u) &&
7085
7242
  importDeclaration: `import * as DateTime from "effect/DateTime"`
7086
7243
  },
7087
7244
  expected: "DateTime.Zoned",
7088
- toCodecJson: () => link()(DateTimeZonedString, Transformation.dateTimeZonedFromString),
7245
+ toCodecJson: () => link()(DateTimeZonedString, SchemaTransformation.dateTimeZonedFromString),
7089
7246
  toArbitrary: () => (fc, ctx) => fc.tuple(fc.date({
7090
7247
  noInvalidDate: true,
7091
7248
  min: new globalThis.Date(-8640000000000000 + 14 * 60 * 60 * 1000),
@@ -7111,7 +7268,7 @@ export const DateTimeZoned = /*#__PURE__*/declare(u => DateTime.isDateTime(u) &&
7111
7268
  * @category DateTime
7112
7269
  * @since 4.0.0
7113
7270
  */
7114
- export const DateTimeZonedFromString = /*#__PURE__*/DateTimeZonedString.pipe(/*#__PURE__*/decodeTo(DateTimeZoned, Transformation.dateTimeZonedFromString));
7271
+ export const DateTimeZonedFromString = /*#__PURE__*/DateTimeZonedString.pipe(/*#__PURE__*/decodeTo(DateTimeZoned, SchemaTransformation.dateTimeZonedFromString));
7115
7272
  const immerable = /*#__PURE__*/globalThis.Symbol.for("immer-draftable");
7116
7273
  function makeClass(Inherited, identifier, struct, annotations, proto) {
7117
7274
  const getClassSchema = getClassSchemaFactory(struct, identifier, annotations);
@@ -7148,19 +7305,19 @@ function makeClass(Inherited, identifier, struct, annotations, proto) {
7148
7305
  return new this(input, options);
7149
7306
  }
7150
7307
  static makeOption(input, options) {
7151
- return Parser.makeOption(getClassSchema(this))(input ?? {}, options);
7308
+ return SchemaParser.makeOption(getClassSchema(this))(input ?? {}, options);
7152
7309
  }
7153
7310
  static makeEffect(input, options) {
7154
7311
  return getClassSchema(this).makeEffect(input ?? {}, options);
7155
7312
  }
7156
7313
  static annotate(annotations) {
7157
- return this.rebuild(AST.annotate(this.ast, annotations));
7314
+ return this.rebuild(SchemaAST.annotate(this.ast, annotations));
7158
7315
  }
7159
7316
  static annotateKey(annotations) {
7160
- return this.rebuild(AST.annotateKey(this.ast, annotations));
7317
+ return this.rebuild(SchemaAST.annotateKey(this.ast, annotations));
7161
7318
  }
7162
7319
  static check(...checks) {
7163
- return this.rebuild(AST.appendChecks(this.ast, checks));
7320
+ return this.rebuild(SchemaAST.appendChecks(this.ast, checks));
7164
7321
  }
7165
7322
  static extend(identifier) {
7166
7323
  return (newFields, annotations) => {
@@ -7168,7 +7325,7 @@ function makeClass(Inherited, identifier, struct, annotations, proto) {
7168
7325
  ...struct.fields,
7169
7326
  ...newFields
7170
7327
  };
7171
- return makeClass(this, identifier, makeStruct(AST.struct(fields, struct.ast.checks, {
7328
+ return makeClass(this, identifier, makeStruct(SchemaAST.struct(fields, struct.ast.checks, {
7172
7329
  identifier
7173
7330
  }), fields), annotations, proto);
7174
7331
  };
@@ -7183,7 +7340,7 @@ function makeClass(Inherited, identifier, struct, annotations, proto) {
7183
7340
  return out;
7184
7341
  }
7185
7342
  function getClassTransformation(self) {
7186
- return new Transformation.Transformation(Getter.transform(input => new self(input)), Getter.passthrough());
7343
+ return new SchemaTransformation.Transformation(SchemaGetter.transform(input => new self(input)), SchemaGetter.passthrough());
7187
7344
  }
7188
7345
  function getClassTypeId(identifier) {
7189
7346
  return `~effect/Schema/Class/${identifier}`;
@@ -7193,15 +7350,15 @@ function getClassSchemaFactory(from, identifier, annotations) {
7193
7350
  return self => {
7194
7351
  if (memo === undefined) {
7195
7352
  const transformation = getClassTransformation(self);
7196
- const to = make(new AST.Declaration([from.ast], () => (input, ast) => {
7197
- return input instanceof self || Predicate.hasProperty(input, getClassTypeId(identifier)) ? Effect.succeed(input) : Effect.fail(new Issue.InvalidType(ast, Option_.some(input)));
7353
+ const to = make(new SchemaAST.Declaration([from.ast], () => (input, ast) => {
7354
+ return input instanceof self || Predicate.hasProperty(input, getClassTypeId(identifier)) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast, Option_.some(input)));
7198
7355
  }, {
7199
7356
  identifier,
7200
- [AST.ClassTypeId]: ([from]) => new AST.Link(from, transformation),
7201
- toCodec: ([from]) => new AST.Link(from.ast, transformation),
7357
+ [SchemaAST.ClassTypeId]: ([from]) => new SchemaAST.Link(from, transformation),
7358
+ toCodec: ([from]) => new SchemaAST.Link(from.ast, transformation),
7202
7359
  toArbitrary: ([from]) => () => from.map(args => new self(args)),
7203
7360
  toFormatter: ([from]) => t => `${self.identifier}(${from(t)})`,
7204
- "~sentinels": AST.collectSentinels(from.ast),
7361
+ "~sentinels": SchemaAST.collectSentinels(from.ast),
7205
7362
  ...annotations
7206
7363
  }));
7207
7364
  memo = from.pipe(decodeTo(to, transformation));
@@ -7219,9 +7376,8 @@ function isStruct(schema) {
7219
7376
  *
7220
7377
  * **When to use**
7221
7378
  *
7222
- * Use to define a schema-backed data class when you want validated
7223
- * construction, schema-derived decoding/encoding, and class-style methods or
7224
- * inheritance.
7379
+ * Use when you need a schema-backed data class with validated construction,
7380
+ * schema-derived decoding/encoding, and class-style methods or inheritance.
7225
7381
  *
7226
7382
  * **Details**
7227
7383
  *
@@ -7473,7 +7629,7 @@ export function toFormatter(schema, options) {
7473
7629
  // ---------------------------------------------
7474
7630
  const annotation = InternalAnnotations.resolve(ast)?.["toFormatter"];
7475
7631
  if (typeof annotation === "function") {
7476
- return annotation(AST.isDeclaration(ast) ? ast.typeParameters.map(recur) : []);
7632
+ return annotation(SchemaAST.isDeclaration(ast) ? ast.typeParameters.map(recur) : []);
7477
7633
  }
7478
7634
  // ---------------------------------------------
7479
7635
  // handle onBefore
@@ -7509,7 +7665,7 @@ export function toFormatter(schema, options) {
7509
7665
  // ---------------------------------------------
7510
7666
  for (; i < elements.length; i++) {
7511
7667
  if (t.length < i + 1) {
7512
- if (AST.isOptional(ast.elements[i])) {
7668
+ if (SchemaAST.isOptional(ast.elements[i])) {
7513
7669
  continue;
7514
7670
  }
7515
7671
  } else {
@@ -7552,7 +7708,7 @@ export function toFormatter(schema, options) {
7552
7708
  const ps = ast.propertySignatures[i];
7553
7709
  const name = ps.name;
7554
7710
  visited.add(name);
7555
- if (AST.isOptional(ps.type) && !Object.hasOwn(t, name)) {
7711
+ if (SchemaAST.isOptional(ps.type) && !Object.hasOwn(t, name)) {
7556
7712
  continue;
7557
7713
  }
7558
7714
  out.push(`${formatPropertyKey(name)}: ${propertySignatures[i](t[name])}`);
@@ -7561,7 +7717,7 @@ export function toFormatter(schema, options) {
7561
7717
  // handle index signatures
7562
7718
  // ---------------------------------------------
7563
7719
  for (let i = 0; i < indexSignatures.length; i++) {
7564
- const keys = AST.getIndexSignatureKeys(t, ast.indexSignatures[i].parameter);
7720
+ const keys = SchemaAST.getIndexSignatureKeys(t, ast.indexSignatures[i].parameter);
7565
7721
  for (const key of keys) {
7566
7722
  if (visited.has(key)) {
7567
7723
  continue;
@@ -7575,10 +7731,10 @@ export function toFormatter(schema, options) {
7575
7731
  }
7576
7732
  case "Union":
7577
7733
  {
7578
- const getCandidates = t => AST.getCandidates(t, ast.types);
7734
+ const getCandidates = t => SchemaAST.getCandidates(t, ast.types);
7579
7735
  return t => {
7580
7736
  const candidates = getCandidates(t);
7581
- const refinements = candidates.map(Parser._is);
7737
+ const refinements = candidates.map(SchemaParser._is);
7582
7738
  for (let i = 0; i < candidates.length; i++) {
7583
7739
  const is = refinements[i];
7584
7740
  if (is(t)) {
@@ -7590,7 +7746,7 @@ export function toFormatter(schema, options) {
7590
7746
  }
7591
7747
  case "Suspend":
7592
7748
  {
7593
- const get = AST.memoizeThunk(() => recur(ast.thunk()));
7749
+ const get = SchemaAST.memoizeThunk(() => recur(ast.thunk()));
7594
7750
  return t => get()(t);
7595
7751
  }
7596
7752
  }
@@ -7605,8 +7761,8 @@ export function toFormatter(schema, options) {
7605
7761
  *
7606
7762
  * **When to use**
7607
7763
  *
7608
- * Use when the default structural equivalence derived by {@link toEquivalence}
7609
- * is not appropriate for a type.
7764
+ * Use when you need a custom equivalence instead of the default structural
7765
+ * equivalence derived by {@link toEquivalence}.
7610
7766
  *
7611
7767
  * @category instances
7612
7768
  * @since 4.0.0
@@ -7686,9 +7842,9 @@ export function toJsonSchemaDocument(schema, options) {
7686
7842
  export function toCodecJson(schema) {
7687
7843
  return make(toCodecJsonTop(schema.ast));
7688
7844
  }
7689
- const toCodecJsonTop = /*#__PURE__*/AST.toCodec(ast => {
7845
+ const toCodecJsonTop = /*#__PURE__*/SchemaAST.toCodec(ast => {
7690
7846
  const out = toCodecJsonBase(ast, toCodecJsonTop);
7691
- return out !== ast && AST.isOptional(ast) ? AST.optionalKeyLastLink(out) : out;
7847
+ return out !== ast && SchemaAST.isOptional(ast) ? SchemaAST.optionalKeyLastLink(out) : out;
7692
7848
  });
7693
7849
  function toCodecJsonBase(ast, recur) {
7694
7850
  switch (ast._tag) {
@@ -7696,16 +7852,16 @@ function toCodecJsonBase(ast, recur) {
7696
7852
  {
7697
7853
  const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
7698
7854
  if (Predicate.isFunction(getLink)) {
7699
- const tps = AST.isDeclaration(ast) ? ast.typeParameters.map(tp => InternalSchema.make(AST.toEncoded(tp))) : [];
7855
+ const tps = SchemaAST.isDeclaration(ast) ? ast.typeParameters.map(tp => InternalSchema.make(SchemaAST.toEncoded(tp))) : [];
7700
7856
  const link = getLink(tps);
7701
7857
  const to = recur(link.to);
7702
- return AST.replaceEncoding(ast, to === link.to ? [link] : [new AST.Link(to, link.transformation)]);
7858
+ return SchemaAST.replaceEncoding(ast, to === link.to ? [link] : [new SchemaAST.Link(to, link.transformation)]);
7703
7859
  }
7704
- return AST.replaceEncoding(ast, [AST.unknownToNull]);
7860
+ return SchemaAST.replaceEncoding(ast, [SchemaAST.unknownToNull]);
7705
7861
  }
7706
7862
  case "Unknown":
7707
7863
  case "ObjectKeyword":
7708
- return AST.replaceEncoding(ast, [AST.unknownToJson]);
7864
+ return SchemaAST.replaceEncoding(ast, [SchemaAST.unknownToJson]);
7709
7865
  case "Undefined":
7710
7866
  case "Void":
7711
7867
  case "Literal":
@@ -7728,7 +7884,7 @@ function toCodecJsonBase(ast, recur) {
7728
7884
  {
7729
7885
  const sortedTypes = InternalSchema.jsonReorder(ast.types);
7730
7886
  if (sortedTypes !== ast.types) {
7731
- return new AST.Union(sortedTypes, ast.mode, ast.annotations, ast.checks, ast.encoding, ast.context).recur(recur);
7887
+ return new SchemaAST.Union(sortedTypes, ast.mode, ast.annotations, ast.checks, ast.encoding, ast.context).recur(recur);
7732
7888
  }
7733
7889
  return ast.recur(recur);
7734
7890
  }
@@ -7747,11 +7903,11 @@ function toCodecJsonBase(ast, recur) {
7747
7903
  * @since 4.0.0
7748
7904
  */
7749
7905
  export function toCodecIso(schema) {
7750
- return make(toCodecIsoTop(AST.toType(schema.ast)));
7906
+ return make(toCodecIsoTop(SchemaAST.toType(schema.ast)));
7751
7907
  }
7752
7908
  const toCodecIsoTop = /*#__PURE__*/memoize(ast => {
7753
7909
  const out = toCodecIsoBase(ast, toCodecIsoTop);
7754
- return out !== ast && AST.isOptional(ast) ? AST.optionalKeyLastLink(out) : out;
7910
+ return out !== ast && SchemaAST.isOptional(ast) ? SchemaAST.optionalKeyLastLink(out) : out;
7755
7911
  });
7756
7912
  function toCodecIsoBase(ast, recur) {
7757
7913
  switch (ast._tag) {
@@ -7761,7 +7917,7 @@ function toCodecIsoBase(ast, recur) {
7761
7917
  if (Predicate.isFunction(getLink)) {
7762
7918
  const link = getLink(ast.typeParameters.map(tp => InternalSchema.make(tp)));
7763
7919
  const to = recur(link.to);
7764
- return AST.replaceEncoding(ast, to === link.to ? [link] : [new AST.Link(to, link.transformation)]);
7920
+ return SchemaAST.replaceEncoding(ast, to === link.to ? [link] : [new SchemaAST.Link(to, link.transformation)]);
7765
7921
  }
7766
7922
  return ast;
7767
7923
  }
@@ -7905,20 +8061,20 @@ function serializerTree(ast, recur, onMissingAnnotation) {
7905
8061
  {
7906
8062
  const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
7907
8063
  if (Predicate.isFunction(getLink)) {
7908
- const tps = AST.isDeclaration(ast) ? ast.typeParameters.map(tp => make(recur(AST.toEncoded(tp)))) : [];
8064
+ const tps = SchemaAST.isDeclaration(ast) ? ast.typeParameters.map(tp => make(recur(SchemaAST.toEncoded(tp)))) : [];
7909
8065
  const link = getLink(tps);
7910
8066
  const to = recur(link.to);
7911
- return AST.replaceEncoding(ast, to === link.to ? [link] : [new AST.Link(to, link.transformation)]);
8067
+ return SchemaAST.replaceEncoding(ast, to === link.to ? [link] : [new SchemaAST.Link(to, link.transformation)]);
7912
8068
  }
7913
8069
  return onMissingAnnotation(ast);
7914
8070
  }
7915
8071
  case "Null":
7916
- return AST.replaceEncoding(ast, [nullToString]);
8072
+ return SchemaAST.replaceEncoding(ast, [nullToString]);
7917
8073
  case "Boolean":
7918
- return AST.replaceEncoding(ast, [booleanToString]);
8074
+ return SchemaAST.replaceEncoding(ast, [booleanToString]);
7919
8075
  case "Unknown":
7920
8076
  case "ObjectKeyword":
7921
- return AST.replaceEncoding(ast, [AST.unknownToStringTree]);
8077
+ return SchemaAST.replaceEncoding(ast, [SchemaAST.unknownToStringTree]);
7922
8078
  case "Enum":
7923
8079
  case "Number":
7924
8080
  case "Literal":
@@ -7939,7 +8095,7 @@ function serializerTree(ast, recur, onMissingAnnotation) {
7939
8095
  {
7940
8096
  const sortedTypes = treeReorder(ast.types);
7941
8097
  if (sortedTypes !== ast.types) {
7942
- return new AST.Union(sortedTypes, ast.mode, ast.annotations, ast.checks, ast.encoding, ast.context).recur(recur);
8098
+ return new SchemaAST.Union(sortedTypes, ast.mode, ast.annotations, ast.checks, ast.encoding, ast.context).recur(recur);
7943
8099
  }
7944
8100
  return ast.recur(recur);
7945
8101
  }
@@ -7950,34 +8106,34 @@ function serializerTree(ast, recur, onMissingAnnotation) {
7950
8106
  // `Schema.Any` is used as an escape hatch
7951
8107
  return ast;
7952
8108
  }
7953
- const nullToString = /*#__PURE__*/new AST.Link(/*#__PURE__*/new AST.Literal("null"), /*#__PURE__*/new Transformation.Transformation(/*#__PURE__*/Getter.transform(() => null), /*#__PURE__*/Getter.transform(() => "null")));
7954
- const booleanToString = /*#__PURE__*/new AST.Link(/*#__PURE__*/new AST.Union([/*#__PURE__*/new AST.Literal("true"), /*#__PURE__*/new AST.Literal("false")], "anyOf"), /*#__PURE__*/new Transformation.Transformation(/*#__PURE__*/Getter.transform(s => s === "true"), /*#__PURE__*/Getter.String()));
7955
- const serializerStringTree = /*#__PURE__*/AST.toCodec(ast => {
7956
- const out = serializerTree(ast, serializerStringTree, ast => AST.replaceEncoding(ast, [unknownToUndefined]));
7957
- if (out !== ast && AST.isOptional(ast)) {
7958
- return AST.optionalKeyLastLink(out);
8109
+ const nullToString = /*#__PURE__*/new SchemaAST.Link(/*#__PURE__*/new SchemaAST.Literal("null"), /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(() => null), /*#__PURE__*/SchemaGetter.transform(() => "null")));
8110
+ const booleanToString = /*#__PURE__*/new SchemaAST.Link(/*#__PURE__*/new SchemaAST.Union([/*#__PURE__*/new SchemaAST.Literal("true"), /*#__PURE__*/new SchemaAST.Literal("false")], "anyOf"), /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(s => s === "true"), /*#__PURE__*/SchemaGetter.String()));
8111
+ const serializerStringTree = /*#__PURE__*/SchemaAST.toCodec(ast => {
8112
+ const out = serializerTree(ast, serializerStringTree, ast => SchemaAST.replaceEncoding(ast, [unknownToUndefined]));
8113
+ if (out !== ast && SchemaAST.isOptional(ast)) {
8114
+ return SchemaAST.optionalKeyLastLink(out);
7959
8115
  }
7960
8116
  return out;
7961
8117
  });
7962
- const unknownToUndefined = /*#__PURE__*/new AST.Link(AST.undefined, /*#__PURE__*/new Transformation.Transformation(/*#__PURE__*/Getter.passthrough(), /*#__PURE__*/Getter.transform(() => undefined)));
7963
- const serializerStringTreeKeepDeclarations = /*#__PURE__*/AST.toCodec(ast => {
8118
+ const unknownToUndefined = /*#__PURE__*/new SchemaAST.Link(SchemaAST.undefined, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.passthrough(), /*#__PURE__*/SchemaGetter.transform(() => undefined)));
8119
+ const serializerStringTreeKeepDeclarations = /*#__PURE__*/SchemaAST.toCodec(ast => {
7964
8120
  const out = serializerTree(ast, serializerStringTreeKeepDeclarations, identity);
7965
- if (out !== ast && AST.isOptional(ast)) {
7966
- return AST.optionalKeyLastLink(out);
8121
+ if (out !== ast && SchemaAST.isOptional(ast)) {
8122
+ return SchemaAST.optionalKeyLastLink(out);
7967
8123
  }
7968
8124
  return out;
7969
8125
  });
7970
8126
  const SERIALIZER_ENSURE_ARRAY = "~effect/Schema/SERIALIZER_ENSURE_ARRAY";
7971
- const toCodecEnsureArray = /*#__PURE__*/AST.toCodec(ast => {
7972
- if (AST.isUnion(ast) && ast.annotations?.[SERIALIZER_ENSURE_ARRAY]) {
8127
+ const toCodecEnsureArray = /*#__PURE__*/SchemaAST.toCodec(ast => {
8128
+ if (SchemaAST.isUnion(ast) && ast.annotations?.[SERIALIZER_ENSURE_ARRAY]) {
7973
8129
  return ast;
7974
8130
  }
7975
8131
  const out = onSerializerEnsureArray(ast);
7976
- if (AST.isArrays(out)) {
7977
- const ensure = new AST.Union([out, AST.decodeTo(AST.string, out, new Transformation.Transformation(Getter.split(), Getter.passthrough()))], "anyOf", {
8132
+ if (SchemaAST.isArrays(out)) {
8133
+ const ensure = new SchemaAST.Union([out, SchemaAST.decodeTo(SchemaAST.string, out, new SchemaTransformation.Transformation(SchemaGetter.split(), SchemaGetter.passthrough()))], "anyOf", {
7978
8134
  [SERIALIZER_ENSURE_ARRAY]: true
7979
8135
  });
7980
- return AST.isOptional(ast) ? AST.optionalKey(ensure) : ensure;
8136
+ return SchemaAST.isOptional(ast) ? SchemaAST.optionalKey(ensure) : ensure;
7981
8137
  }
7982
8138
  return out;
7983
8139
  });
@@ -8005,7 +8161,7 @@ function onSerializerEnsureArray(ast) {
8005
8161
  */
8006
8162
  export function toIso(schema) {
8007
8163
  const serializer = toCodecIso(schema);
8008
- return Optic_.makeIso(Parser.encodeSync(serializer), Parser.decodeSync(serializer));
8164
+ return Optic_.makeIso(SchemaParser.encodeSync(serializer), SchemaParser.decodeSync(serializer));
8009
8165
  }
8010
8166
  /**
8011
8167
  * Returns an identity `Iso` over the schema's source (`Type`) side.
@@ -8044,8 +8200,8 @@ export function toIsoFocus(_) {
8044
8200
  */
8045
8201
  export function overrideToCodecIso(to, transformation) {
8046
8202
  return schema => {
8047
- return make(AST.annotate(schema.ast, {
8048
- toCodecIso: () => new AST.Link(to.ast, Transformation.make(transformation))
8203
+ return make(SchemaAST.annotate(schema.ast, {
8204
+ toCodecIso: () => new SchemaAST.Link(to.ast, SchemaTransformation.make(transformation))
8049
8205
  }), {
8050
8206
  schema
8051
8207
  });
@@ -8064,8 +8220,8 @@ export function overrideToCodecIso(to, transformation) {
8064
8220
  */
8065
8221
  export function toDifferJsonPatch(schema) {
8066
8222
  const serializer = toCodecJson(schema);
8067
- const get = Parser.encodeSync(serializer);
8068
- const set = Parser.decodeSync(serializer);
8223
+ const get = SchemaParser.encodeSync(serializer);
8224
+ const set = SchemaParser.decodeSync(serializer);
8069
8225
  return {
8070
8226
  empty: [],
8071
8227
  diff: (oldValue, newValue) => JsonPatch.get(get(oldValue), get(newValue)),
@@ -8105,7 +8261,13 @@ export function Tree(node) {
8105
8261
  * @category schemas
8106
8262
  * @since 4.0.0
8107
8263
  */
8108
- export const Json = /*#__PURE__*/make(AST.Json);
8264
+ export const Json = /*#__PURE__*/make(SchemaAST.Json);
8265
+ const JsonError = /*#__PURE__*/Struct({
8266
+ message: String,
8267
+ name: /*#__PURE__*/optionalKey(String),
8268
+ stack: /*#__PURE__*/optionalKey(String),
8269
+ cause: /*#__PURE__*/optionalKey(Json)
8270
+ });
8109
8271
  /**
8110
8272
  * Schema that accepts any mutable JSON-compatible value. See {@link Json} for
8111
8273
  * the immutable variant.
@@ -8113,7 +8275,7 @@ export const Json = /*#__PURE__*/make(AST.Json);
8113
8275
  * @category schemas
8114
8276
  * @since 4.0.0
8115
8277
  */
8116
- export const MutableJson = /*#__PURE__*/make(AST.MutableJson);
8278
+ export const MutableJson = /*#__PURE__*/make(SchemaAST.MutableJson);
8117
8279
  // -----------------------------------------------------------------------------
8118
8280
  // Annotations
8119
8281
  // -----------------------------------------------------------------------------