effect 4.0.0-beta.103 → 4.0.0-beta.105

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 (667) hide show
  1. package/AGENTS.md +381 -0
  2. package/CLAUDE.md +381 -0
  3. package/ai-docs/README.md +44 -0
  4. package/ai-docs/package.json +36 -0
  5. package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
  6. package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +39 -0
  7. package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
  8. package/ai-docs/src/01_effect/01_basics/index.md +5 -0
  9. package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
  10. package/ai-docs/src/01_effect/02_schema/index.md +7 -0
  11. package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
  12. package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
  13. package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
  14. package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
  15. package/ai-docs/src/01_effect/03_services/index.md +5 -0
  16. package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
  17. package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
  18. package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
  19. package/ai-docs/src/01_effect/04_errors/index.md +1 -0
  20. package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
  21. package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
  22. package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
  23. package/ai-docs/src/01_effect/05_resources/index.md +3 -0
  24. package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
  25. package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
  26. package/ai-docs/src/01_effect/06_running/index.md +1 -0
  27. package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
  28. package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
  29. package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
  30. package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
  31. package/ai-docs/src/03_stream/30_encoding.ts +165 -0
  32. package/ai-docs/src/03_stream/index.md +4 -0
  33. package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
  34. package/ai-docs/src/04_integration/index.md +5 -0
  35. package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
  36. package/ai-docs/src/05_batching/index.md +3 -0
  37. package/ai-docs/src/06_schedule/10_schedules.ts +110 -0
  38. package/ai-docs/src/06_schedule/index.md +3 -0
  39. package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
  40. package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
  41. package/ai-docs/src/07_datetime/index.md +5 -0
  42. package/ai-docs/src/08_observability/10_logging.ts +66 -0
  43. package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
  44. package/ai-docs/src/08_observability/index.md +7 -0
  45. package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
  46. package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
  47. package/ai-docs/src/09_testing/index.md +1 -0
  48. package/ai-docs/src/10_predicate/01_basics.ts +14 -0
  49. package/ai-docs/src/10_predicate/index.md +9 -0
  50. package/ai-docs/src/50_http-client/10_basics.ts +102 -0
  51. package/ai-docs/src/50_http-client/index.md +3 -0
  52. package/ai-docs/src/51_http-server/10_basics.ts +116 -0
  53. package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
  54. package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
  55. package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
  56. package/ai-docs/src/51_http-server/fixtures/api/Users.ts +91 -0
  57. package/ai-docs/src/51_http-server/fixtures/domain/User.ts +12 -0
  58. package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
  59. package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +36 -0
  60. package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +71 -0
  61. package/ai-docs/src/51_http-server/fixtures/server/Users.ts +62 -0
  62. package/ai-docs/src/51_http-server/index.md +3 -0
  63. package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
  64. package/ai-docs/src/60_child-process/index.md +3 -0
  65. package/ai-docs/src/70_cli/10_basics.ts +136 -0
  66. package/ai-docs/src/70_cli/index.md +5 -0
  67. package/ai-docs/src/71_ai/10_language-model.ts +156 -0
  68. package/ai-docs/src/71_ai/20_tools.ts +226 -0
  69. package/ai-docs/src/71_ai/30_chat.ts +158 -0
  70. package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
  71. package/ai-docs/src/71_ai/index.md +5 -0
  72. package/ai-docs/src/80_cluster/10_entities.ts +97 -0
  73. package/ai-docs/src/80_cluster/index.md +4 -0
  74. package/ai-docs/src/index.md +10 -0
  75. package/ai-docs/tsconfig.json +24 -0
  76. package/dist/Brand.d.ts +3 -3
  77. package/dist/Brand.d.ts.map +1 -1
  78. package/dist/Brand.js +4 -3
  79. package/dist/Brand.js.map +1 -1
  80. package/dist/Cache.js +1 -1
  81. package/dist/Cache.js.map +1 -1
  82. package/dist/Channel.d.ts +1 -1
  83. package/dist/Channel.d.ts.map +1 -1
  84. package/dist/Channel.js.map +1 -1
  85. package/dist/Config.d.ts.map +1 -1
  86. package/dist/Config.js +30 -8
  87. package/dist/Config.js.map +1 -1
  88. package/dist/ConfigProvider.d.ts.map +1 -1
  89. package/dist/ConfigProvider.js +2 -1
  90. package/dist/ConfigProvider.js.map +1 -1
  91. package/dist/Context.d.ts +2 -3
  92. package/dist/Context.d.ts.map +1 -1
  93. package/dist/Context.js +1 -22
  94. package/dist/Context.js.map +1 -1
  95. package/dist/Cron.d.ts +31 -0
  96. package/dist/Cron.d.ts.map +1 -1
  97. package/dist/Cron.js +58 -2
  98. package/dist/Cron.js.map +1 -1
  99. package/dist/Crypto.d.ts.map +1 -1
  100. package/dist/Crypto.js +13 -5
  101. package/dist/Crypto.js.map +1 -1
  102. package/dist/Duration.d.ts.map +1 -1
  103. package/dist/Duration.js +12 -1
  104. package/dist/Duration.js.map +1 -1
  105. package/dist/Effect.d.ts +132 -14
  106. package/dist/Effect.d.ts.map +1 -1
  107. package/dist/Effect.js +38 -0
  108. package/dist/Effect.js.map +1 -1
  109. package/dist/Equal.d.ts.map +1 -1
  110. package/dist/Equal.js +10 -2
  111. package/dist/Equal.js.map +1 -1
  112. package/dist/ExecutionPlan.d.ts +73 -0
  113. package/dist/ExecutionPlan.d.ts.map +1 -1
  114. package/dist/ExecutionPlan.js +1 -1
  115. package/dist/ExecutionPlan.js.map +1 -1
  116. package/dist/FiberSet.js +1 -1
  117. package/dist/FileSystem.d.ts +2 -2
  118. package/dist/Function.d.ts +4 -3
  119. package/dist/Function.d.ts.map +1 -1
  120. package/dist/Function.js +5 -5
  121. package/dist/Function.js.map +1 -1
  122. package/dist/Iterable.d.ts.map +1 -1
  123. package/dist/Iterable.js +11 -10
  124. package/dist/Iterable.js.map +1 -1
  125. package/dist/Layer.d.ts.map +1 -1
  126. package/dist/Layer.js +7 -5
  127. package/dist/Layer.js.map +1 -1
  128. package/dist/Optic.d.ts +35 -21
  129. package/dist/Optic.d.ts.map +1 -1
  130. package/dist/Optic.js +33 -34
  131. package/dist/Optic.js.map +1 -1
  132. package/dist/Schedule.d.ts +8 -8
  133. package/dist/Schedule.d.ts.map +1 -1
  134. package/dist/Schedule.js +4 -4
  135. package/dist/Schedule.js.map +1 -1
  136. package/dist/Schema.d.ts +105 -57
  137. package/dist/Schema.d.ts.map +1 -1
  138. package/dist/Schema.js +105 -67
  139. package/dist/Schema.js.map +1 -1
  140. package/dist/SchemaAST.d.ts +33 -3
  141. package/dist/SchemaAST.d.ts.map +1 -1
  142. package/dist/SchemaAST.js +87 -63
  143. package/dist/SchemaAST.js.map +1 -1
  144. package/dist/SchemaError.d.ts +8 -8
  145. package/dist/SchemaError.d.ts.map +1 -1
  146. package/dist/SchemaError.js +7 -6
  147. package/dist/SchemaError.js.map +1 -1
  148. package/dist/SchemaGetter.d.ts +8 -5
  149. package/dist/SchemaGetter.d.ts.map +1 -1
  150. package/dist/SchemaGetter.js +41 -37
  151. package/dist/SchemaGetter.js.map +1 -1
  152. package/dist/SchemaIssue.d.ts +195 -38
  153. package/dist/SchemaIssue.d.ts.map +1 -1
  154. package/dist/SchemaIssue.js +243 -68
  155. package/dist/SchemaIssue.js.map +1 -1
  156. package/dist/SchemaParser.d.ts +30 -0
  157. package/dist/SchemaParser.d.ts.map +1 -1
  158. package/dist/SchemaParser.js +74 -62
  159. package/dist/SchemaParser.js.map +1 -1
  160. package/dist/SchemaTransformation.d.ts +2 -2
  161. package/dist/SchemaTransformation.d.ts.map +1 -1
  162. package/dist/SchemaTransformation.js +26 -26
  163. package/dist/SchemaTransformation.js.map +1 -1
  164. package/dist/ScopedCache.js +1 -1
  165. package/dist/ScopedCache.js.map +1 -1
  166. package/dist/Sink.d.ts +1 -1
  167. package/dist/Sink.d.ts.map +1 -1
  168. package/dist/Stdio.d.ts +17 -4
  169. package/dist/Stdio.d.ts.map +1 -1
  170. package/dist/Stdio.js +6 -3
  171. package/dist/Stdio.js.map +1 -1
  172. package/dist/Stream.d.ts +27 -4
  173. package/dist/Stream.d.ts.map +1 -1
  174. package/dist/Stream.js +27 -2
  175. package/dist/Stream.js.map +1 -1
  176. package/dist/SynchronizedRef.js +1 -1
  177. package/dist/SynchronizedRef.js.map +1 -1
  178. package/dist/Terminal.js +1 -1
  179. package/dist/Terminal.js.map +1 -1
  180. package/dist/Tuple.d.ts +6 -4
  181. package/dist/Tuple.d.ts.map +1 -1
  182. package/dist/Tuple.js.map +1 -1
  183. package/dist/TxReentrantLock.d.ts +0 -56
  184. package/dist/TxReentrantLock.d.ts.map +1 -1
  185. package/dist/TxReentrantLock.js +8 -8
  186. package/dist/TxReentrantLock.js.map +1 -1
  187. package/dist/internal/dateTime.js +1 -1
  188. package/dist/internal/dateTime.js.map +1 -1
  189. package/dist/internal/executionPlan.js +51 -3
  190. package/dist/internal/executionPlan.js.map +1 -1
  191. package/dist/internal/hashMap.js +12 -8
  192. package/dist/internal/hashMap.js.map +1 -1
  193. package/dist/internal/matcher.js +1 -1
  194. package/dist/internal/matcher.js.map +1 -1
  195. package/dist/internal/schedule.js.map +1 -1
  196. package/dist/internal/schema/annotations.js +2 -0
  197. package/dist/internal/schema/annotations.js.map +1 -1
  198. package/dist/internal/schema/schema.js +1 -9
  199. package/dist/internal/schema/schema.js.map +1 -1
  200. package/dist/internal/schema/toArbitrary.js +1 -1
  201. package/dist/internal/schema/toArbitrary.js.map +1 -1
  202. package/dist/internal/trie.js +13 -3
  203. package/dist/internal/trie.js.map +1 -1
  204. package/dist/testing/TestClock.d.ts.map +1 -1
  205. package/dist/testing/TestClock.js +11 -1
  206. package/dist/testing/TestClock.js.map +1 -1
  207. package/dist/testing/TestSchema.d.ts +2 -2
  208. package/dist/testing/TestSchema.d.ts.map +1 -1
  209. package/dist/testing/TestSchema.js +8 -7
  210. package/dist/testing/TestSchema.js.map +1 -1
  211. package/dist/unstable/ai/AiError.js +19 -19
  212. package/dist/unstable/ai/AiError.js.map +1 -1
  213. package/dist/unstable/ai/Chat.js +1 -1
  214. package/dist/unstable/ai/Chat.js.map +1 -1
  215. package/dist/unstable/ai/LanguageModel.js +4 -2
  216. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  217. package/dist/unstable/ai/McpSchema.d.ts +132 -132
  218. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  219. package/dist/unstable/ai/McpSchema.js +8 -8
  220. package/dist/unstable/ai/McpSchema.js.map +1 -1
  221. package/dist/unstable/ai/McpServer.js +1 -1
  222. package/dist/unstable/ai/McpServer.js.map +1 -1
  223. package/dist/unstable/ai/Prompt.d.ts +15 -3
  224. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  225. package/dist/unstable/ai/Prompt.js +10 -7
  226. package/dist/unstable/ai/Prompt.js.map +1 -1
  227. package/dist/unstable/cli/CliError.d.ts +3 -3
  228. package/dist/unstable/cli/CliError.js +11 -11
  229. package/dist/unstable/cli/CliError.js.map +1 -1
  230. package/dist/unstable/cli/Command.d.ts +9 -9
  231. package/dist/unstable/cli/Command.d.ts.map +1 -1
  232. package/dist/unstable/cli/Command.js +8 -6
  233. package/dist/unstable/cli/Command.js.map +1 -1
  234. package/dist/unstable/cli/Param.d.ts +7 -5
  235. package/dist/unstable/cli/Param.d.ts.map +1 -1
  236. package/dist/unstable/cli/Param.js +15 -11
  237. package/dist/unstable/cli/Param.js.map +1 -1
  238. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  239. package/dist/unstable/cli/Primitive.js +31 -24
  240. package/dist/unstable/cli/Primitive.js.map +1 -1
  241. package/dist/unstable/cli/Prompt.d.ts.map +1 -1
  242. package/dist/unstable/cli/Prompt.js +31 -17
  243. package/dist/unstable/cli/Prompt.js.map +1 -1
  244. package/dist/unstable/cli/internal/ansi.js +2 -2
  245. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  246. package/dist/unstable/cli/internal/command.d.ts +2 -2
  247. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  248. package/dist/unstable/cli/internal/command.js +10 -9
  249. package/dist/unstable/cli/internal/command.js.map +1 -1
  250. package/dist/unstable/cli/internal/completions/bash.js +69 -9
  251. package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
  252. package/dist/unstable/cli/internal/completions/descriptor.js +24 -18
  253. package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
  254. package/dist/unstable/cli/internal/completions/fish.js +5 -5
  255. package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
  256. package/dist/unstable/cli/internal/help.d.ts.map +1 -1
  257. package/dist/unstable/cli/internal/help.js +4 -2
  258. package/dist/unstable/cli/internal/help.js.map +1 -1
  259. package/dist/unstable/cli/internal/parser.js +3 -3
  260. package/dist/unstable/cli/internal/parser.js.map +1 -1
  261. package/dist/unstable/cli/internal/wizard.js +2 -2
  262. package/dist/unstable/cli/internal/wizard.js.map +1 -1
  263. package/dist/unstable/cluster/ClusterError.js +7 -7
  264. package/dist/unstable/cluster/ClusterError.js.map +1 -1
  265. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  266. package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
  267. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  268. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  269. package/dist/unstable/cluster/MessageStorage.js +8 -1
  270. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  271. package/dist/unstable/cluster/Reply.d.ts +8 -0
  272. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  273. package/dist/unstable/cluster/Reply.js +16 -4
  274. package/dist/unstable/cluster/Reply.js.map +1 -1
  275. package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
  276. package/dist/unstable/cluster/RunnerServer.js +4 -2
  277. package/dist/unstable/cluster/RunnerServer.js.map +1 -1
  278. package/dist/unstable/cluster/RunnerStorage.d.ts +1 -2
  279. package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
  280. package/dist/unstable/cluster/RunnerStorage.js +7 -6
  281. package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
  282. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  283. package/dist/unstable/cluster/Sharding.js +22 -4
  284. package/dist/unstable/cluster/Sharding.js.map +1 -1
  285. package/dist/unstable/cluster/internal/entityManager.js +1 -1
  286. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  287. package/dist/unstable/cluster/internal/resourceMap.js +2 -2
  288. package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
  289. package/dist/unstable/cluster/internal/resourceRef.js +17 -0
  290. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  291. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  292. package/dist/unstable/devtools/DevToolsClient.js +7 -2
  293. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  294. package/dist/unstable/encoding/Ini.d.ts +20 -0
  295. package/dist/unstable/encoding/Ini.d.ts.map +1 -0
  296. package/dist/unstable/encoding/Ini.js +153 -0
  297. package/dist/unstable/encoding/Ini.js.map +1 -0
  298. package/dist/unstable/encoding/Msgpack.d.ts +2 -1
  299. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  300. package/dist/unstable/encoding/Msgpack.js +27 -13
  301. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  302. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  303. package/dist/unstable/encoding/Ndjson.js +7 -1
  304. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  305. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  306. package/dist/unstable/encoding/Sse.js +14 -23
  307. package/dist/unstable/encoding/Sse.js.map +1 -1
  308. package/dist/unstable/encoding/Toml.d.ts +19 -0
  309. package/dist/unstable/encoding/Toml.d.ts.map +1 -0
  310. package/dist/unstable/encoding/Toml.js +434 -0
  311. package/dist/unstable/encoding/Toml.js.map +1 -0
  312. package/dist/unstable/encoding/Yaml.d.ts +19 -0
  313. package/dist/unstable/encoding/Yaml.d.ts.map +1 -0
  314. package/dist/unstable/encoding/Yaml.js +461 -0
  315. package/dist/unstable/encoding/Yaml.js.map +1 -0
  316. package/dist/unstable/encoding/index.d.ts +12 -0
  317. package/dist/unstable/encoding/index.d.ts.map +1 -1
  318. package/dist/unstable/encoding/index.js +12 -0
  319. package/dist/unstable/encoding/index.js.map +1 -1
  320. package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
  321. package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
  322. package/dist/unstable/eventlog/EventJournal.js +13 -5
  323. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  324. package/dist/unstable/eventlog/EventLogMessage.js +1 -1
  325. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  326. package/dist/unstable/eventlog/EventLogServerUnencrypted.js +1 -1
  327. package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
  328. package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
  329. package/dist/unstable/eventlog/SqlEventJournal.js +1 -4
  330. package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
  331. package/dist/unstable/http/FindMyWay/internal/queryString.d.ts +11 -0
  332. package/dist/unstable/http/FindMyWay/internal/queryString.d.ts.map +1 -0
  333. package/dist/unstable/http/FindMyWay/internal/queryString.js +259 -0
  334. package/dist/unstable/http/FindMyWay/internal/queryString.js.map +1 -0
  335. package/dist/unstable/http/FindMyWay/internal/router.d.ts +2 -0
  336. package/dist/unstable/http/FindMyWay/internal/router.d.ts.map +1 -0
  337. package/dist/unstable/http/FindMyWay/internal/router.js +665 -0
  338. package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -0
  339. package/dist/unstable/http/FindMyWay.d.ts +33 -8
  340. package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
  341. package/dist/unstable/http/FindMyWay.js +4 -7
  342. package/dist/unstable/http/FindMyWay.js.map +1 -1
  343. package/dist/unstable/http/HttpClient.d.ts +59 -3
  344. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  345. package/dist/unstable/http/HttpClient.js +33 -19
  346. package/dist/unstable/http/HttpClient.js.map +1 -1
  347. package/dist/unstable/http/HttpClientError.js +1 -1
  348. package/dist/unstable/http/HttpClientError.js.map +1 -1
  349. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  350. package/dist/unstable/http/HttpClientRequest.js +2 -14
  351. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  352. package/dist/unstable/http/HttpClientResponse.js +1 -16
  353. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  354. package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
  355. package/dist/unstable/http/HttpPlatform.js +21 -3
  356. package/dist/unstable/http/HttpPlatform.js.map +1 -1
  357. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  358. package/dist/unstable/http/HttpServerRequest.js +7 -6
  359. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  360. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  361. package/dist/unstable/http/HttpServerResponse.js +8 -6
  362. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  363. package/dist/unstable/http/Multipart.d.ts +1 -1
  364. package/dist/unstable/http/Multipart.d.ts.map +1 -1
  365. package/dist/unstable/http/Multipart.js +9 -2
  366. package/dist/unstable/http/Multipart.js.map +1 -1
  367. package/dist/unstable/http/MultipartParser/HeadersParser.d.ts +53 -0
  368. package/dist/unstable/http/MultipartParser/HeadersParser.d.ts.map +1 -0
  369. package/dist/unstable/http/MultipartParser/HeadersParser.js +14 -0
  370. package/dist/unstable/http/MultipartParser/HeadersParser.js.map +1 -0
  371. package/dist/unstable/http/MultipartParser/Search.d.ts +11 -0
  372. package/dist/unstable/http/MultipartParser/Search.d.ts.map +1 -0
  373. package/dist/unstable/http/MultipartParser/Search.js +14 -0
  374. package/dist/unstable/http/MultipartParser/Search.js.map +1 -0
  375. package/dist/unstable/http/MultipartParser/internal/contentType.d.ts +5 -0
  376. package/dist/unstable/http/MultipartParser/internal/contentType.d.ts.map +1 -0
  377. package/dist/unstable/http/MultipartParser/internal/contentType.js +82 -0
  378. package/dist/unstable/http/MultipartParser/internal/contentType.js.map +1 -0
  379. package/dist/unstable/http/MultipartParser/internal/headers.d.ts +3 -0
  380. package/dist/unstable/http/MultipartParser/internal/headers.d.ts.map +1 -0
  381. package/dist/unstable/http/MultipartParser/internal/headers.js +194 -0
  382. package/dist/unstable/http/MultipartParser/internal/headers.js.map +1 -0
  383. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +8 -0
  384. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -0
  385. package/dist/unstable/http/MultipartParser/internal/multipart.js +226 -0
  386. package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -0
  387. package/dist/unstable/http/MultipartParser/internal/search.d.ts +5 -0
  388. package/dist/unstable/http/MultipartParser/internal/search.d.ts.map +1 -0
  389. package/dist/unstable/http/MultipartParser/internal/search.js +120 -0
  390. package/dist/unstable/http/MultipartParser/internal/search.js.map +1 -0
  391. package/dist/unstable/http/MultipartParser.d.ts +98 -0
  392. package/dist/unstable/http/MultipartParser.d.ts.map +1 -0
  393. package/dist/unstable/http/MultipartParser.js +23 -0
  394. package/dist/unstable/http/MultipartParser.js.map +1 -0
  395. package/dist/unstable/http/Template.d.ts.map +1 -1
  396. package/dist/unstable/http/Template.js +2 -2
  397. package/dist/unstable/http/Template.js.map +1 -1
  398. package/dist/unstable/http/index.d.ts +1 -1
  399. package/dist/unstable/http/index.d.ts.map +1 -1
  400. package/dist/unstable/http/index.js +1 -1
  401. package/dist/unstable/http/index.js.map +1 -1
  402. package/dist/unstable/http/internal/httpBody.d.ts +2 -0
  403. package/dist/unstable/http/internal/httpBody.d.ts.map +1 -0
  404. package/dist/unstable/http/internal/httpBody.js +10 -0
  405. package/dist/unstable/http/internal/httpBody.js.map +1 -0
  406. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  407. package/dist/unstable/httpapi/HttpApi.js +5 -5
  408. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  409. package/dist/unstable/httpapi/HttpApiBuilder.js +73 -20
  410. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  411. package/dist/unstable/httpapi/HttpApiClient.d.ts +1 -1
  412. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  413. package/dist/unstable/httpapi/HttpApiClient.js +74 -34
  414. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  415. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +6 -4
  416. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  417. package/dist/unstable/httpapi/HttpApiEndpoint.js +73 -16
  418. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  419. package/dist/unstable/httpapi/HttpApiError.d.ts +5 -5
  420. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  421. package/dist/unstable/httpapi/HttpApiError.js +17 -17
  422. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  423. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +1 -1
  424. package/dist/unstable/httpapi/HttpApiMiddleware.js +1 -1
  425. package/dist/unstable/httpapi/HttpApiSchema.d.ts +219 -0
  426. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  427. package/dist/unstable/httpapi/HttpApiSchema.js +170 -0
  428. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  429. package/dist/unstable/httpapi/OpenApi.d.ts +8 -0
  430. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  431. package/dist/unstable/httpapi/OpenApi.js +45 -18
  432. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  433. package/dist/unstable/observability/OtlpExporter.d.ts +1 -1
  434. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  435. package/dist/unstable/observability/OtlpExporter.js +2 -1
  436. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  437. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  438. package/dist/unstable/observability/OtlpLogger.js +2 -2
  439. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  440. package/dist/unstable/observability/OtlpMetrics.d.ts +2 -2
  441. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  442. package/dist/unstable/observability/OtlpMetrics.js +28 -15
  443. package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
  444. package/dist/unstable/observability/OtlpTracer.js +1 -1
  445. package/dist/unstable/observability/OtlpTracer.js.map +1 -1
  446. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  447. package/dist/unstable/persistence/PersistedQueue.js +9 -9
  448. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  449. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  450. package/dist/unstable/persistence/Persistence.js +17 -7
  451. package/dist/unstable/persistence/Persistence.js.map +1 -1
  452. package/dist/unstable/persistence/RateLimiter.d.ts +22 -12
  453. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  454. package/dist/unstable/persistence/RateLimiter.js +15 -42
  455. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  456. package/dist/unstable/persistence/Redis.js +1 -1
  457. package/dist/unstable/persistence/Redis.js.map +1 -1
  458. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  459. package/dist/unstable/reactivity/AsyncResult.js +4 -4
  460. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  461. package/dist/unstable/reactivity/Atom.d.ts +26 -11
  462. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  463. package/dist/unstable/reactivity/Atom.js +9 -22
  464. package/dist/unstable/reactivity/Atom.js.map +1 -1
  465. package/dist/unstable/rpc/RpcClient.d.ts +14 -0
  466. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  467. package/dist/unstable/rpc/RpcClient.js +21 -10
  468. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  469. package/dist/unstable/rpc/RpcClientError.js +2 -2
  470. package/dist/unstable/rpc/RpcClientError.js.map +1 -1
  471. package/dist/unstable/rpc/RpcSerialization.js +3 -1
  472. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  473. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  474. package/dist/unstable/rpc/RpcServer.js +3 -2
  475. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  476. package/dist/unstable/schema/Model.d.ts +1 -1
  477. package/dist/unstable/schema/Model.d.ts.map +1 -1
  478. package/dist/unstable/schema/VariantSchema.d.ts +5 -5
  479. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  480. package/dist/unstable/schema/VariantSchema.js +17 -9
  481. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  482. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  483. package/dist/unstable/socket/Socket.js +28 -12
  484. package/dist/unstable/socket/Socket.js.map +1 -1
  485. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  486. package/dist/unstable/sql/SqlClient.js +7 -3
  487. package/dist/unstable/sql/SqlClient.js.map +1 -1
  488. package/dist/unstable/sql/SqlError.js +13 -13
  489. package/dist/unstable/sql/SqlError.js.map +1 -1
  490. package/dist/unstable/sql/SqlResolver.js +8 -6
  491. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  492. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  493. package/dist/unstable/sql/Statement.js +8 -6
  494. package/dist/unstable/sql/Statement.js.map +1 -1
  495. package/dist/unstable/workers/WorkerError.js +5 -5
  496. package/dist/unstable/workers/WorkerError.js.map +1 -1
  497. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  498. package/dist/unstable/workflow/Workflow.js +2 -2
  499. package/dist/unstable/workflow/Workflow.js.map +1 -1
  500. package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
  501. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  502. package/dist/unstable/workflow/WorkflowEngine.js +3 -3
  503. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  504. package/package.json +6 -9
  505. package/src/Brand.ts +4 -4
  506. package/src/Cache.ts +1 -1
  507. package/src/Channel.ts +1 -1
  508. package/src/Config.ts +31 -8
  509. package/src/ConfigProvider.ts +4 -1
  510. package/src/Context.ts +6 -28
  511. package/src/Cron.ts +65 -2
  512. package/src/Crypto.ts +17 -8
  513. package/src/Duration.ts +16 -2
  514. package/src/Effect.ts +141 -17
  515. package/src/Equal.ts +10 -2
  516. package/src/ExecutionPlan.ts +78 -1
  517. package/src/FiberSet.ts +1 -1
  518. package/src/FileSystem.ts +2 -2
  519. package/src/Function.ts +6 -6
  520. package/src/Iterable.ts +11 -10
  521. package/src/Layer.ts +7 -5
  522. package/src/Optic.ts +59 -58
  523. package/src/Schedule.ts +13 -13
  524. package/src/Schema.ts +195 -112
  525. package/src/SchemaAST.ts +154 -85
  526. package/src/SchemaError.ts +9 -9
  527. package/src/SchemaGetter.ts +89 -30
  528. package/src/SchemaIssue.ts +285 -80
  529. package/src/SchemaParser.ts +126 -86
  530. package/src/SchemaTransformation.ts +66 -18
  531. package/src/ScopedCache.ts +1 -1
  532. package/src/Sink.ts +1 -1
  533. package/src/Stdio.ts +23 -4
  534. package/src/Stream.ts +77 -10
  535. package/src/SynchronizedRef.ts +1 -1
  536. package/src/Terminal.ts +1 -1
  537. package/src/Tuple.ts +7 -4
  538. package/src/TxReentrantLock.ts +39 -35
  539. package/src/internal/dateTime.ts +1 -1
  540. package/src/internal/executionPlan.ts +105 -10
  541. package/src/internal/hashMap.ts +20 -14
  542. package/src/internal/matcher.ts +2 -2
  543. package/src/internal/schedule.ts +4 -4
  544. package/src/internal/schema/annotations.ts +3 -0
  545. package/src/internal/schema/schema.ts +1 -17
  546. package/src/internal/schema/toArbitrary.ts +3 -1
  547. package/src/internal/trie.ts +12 -2
  548. package/src/testing/TestClock.ts +13 -1
  549. package/src/testing/TestSchema.ts +9 -9
  550. package/src/unstable/ai/AiError.ts +19 -19
  551. package/src/unstable/ai/Chat.ts +1 -1
  552. package/src/unstable/ai/LanguageModel.ts +4 -2
  553. package/src/unstable/ai/McpSchema.ts +17 -16
  554. package/src/unstable/ai/McpServer.ts +1 -1
  555. package/src/unstable/ai/Prompt.ts +35 -10
  556. package/src/unstable/cli/CliError.ts +12 -12
  557. package/src/unstable/cli/Command.ts +12 -10
  558. package/src/unstable/cli/Param.ts +41 -19
  559. package/src/unstable/cli/Primitive.ts +11 -5
  560. package/src/unstable/cli/Prompt.ts +36 -20
  561. package/src/unstable/cli/internal/ansi.ts +2 -2
  562. package/src/unstable/cli/internal/command.ts +15 -10
  563. package/src/unstable/cli/internal/completions/bash.ts +59 -9
  564. package/src/unstable/cli/internal/completions/descriptor.ts +14 -20
  565. package/src/unstable/cli/internal/completions/fish.ts +5 -7
  566. package/src/unstable/cli/internal/help.ts +4 -2
  567. package/src/unstable/cli/internal/parser.ts +3 -3
  568. package/src/unstable/cli/internal/wizard.ts +2 -2
  569. package/src/unstable/cluster/ClusterError.ts +7 -7
  570. package/src/unstable/cluster/ClusterWorkflowEngine.ts +4 -1
  571. package/src/unstable/cluster/MessageStorage.ts +9 -5
  572. package/src/unstable/cluster/Reply.ts +25 -4
  573. package/src/unstable/cluster/RunnerServer.ts +4 -10
  574. package/src/unstable/cluster/RunnerStorage.ts +9 -7
  575. package/src/unstable/cluster/Sharding.ts +35 -7
  576. package/src/unstable/cluster/internal/entityManager.ts +1 -1
  577. package/src/unstable/cluster/internal/resourceMap.ts +5 -2
  578. package/src/unstable/cluster/internal/resourceRef.ts +27 -5
  579. package/src/unstable/devtools/DevToolsClient.ts +3 -2
  580. package/src/unstable/encoding/Ini.ts +174 -0
  581. package/src/unstable/encoding/Msgpack.ts +59 -36
  582. package/src/unstable/encoding/Ndjson.ts +9 -1
  583. package/src/unstable/encoding/Sse.ts +11 -21
  584. package/src/unstable/encoding/Toml.ts +504 -0
  585. package/src/unstable/encoding/Yaml.ts +541 -0
  586. package/src/unstable/encoding/index.ts +15 -0
  587. package/src/unstable/eventlog/EventJournal.ts +14 -6
  588. package/src/unstable/eventlog/EventLogMessage.ts +1 -1
  589. package/src/unstable/eventlog/EventLogServerUnencrypted.ts +1 -1
  590. package/src/unstable/eventlog/SqlEventJournal.ts +6 -4
  591. package/src/unstable/http/FindMyWay/internal/queryString.ts +420 -0
  592. package/src/unstable/http/FindMyWay/internal/router.ts +950 -0
  593. package/src/unstable/http/FindMyWay.ts +65 -6
  594. package/src/unstable/http/HttpClient.ts +132 -23
  595. package/src/unstable/http/HttpClientError.ts +1 -1
  596. package/src/unstable/http/HttpClientRequest.ts +2 -14
  597. package/src/unstable/http/HttpClientResponse.ts +1 -17
  598. package/src/unstable/http/HttpPlatform.ts +34 -6
  599. package/src/unstable/http/HttpServerRequest.ts +14 -6
  600. package/src/unstable/http/HttpServerResponse.ts +9 -7
  601. package/src/unstable/http/Multipart.ts +9 -2
  602. package/src/unstable/http/MultipartParser/HeadersParser.ts +68 -0
  603. package/src/unstable/http/MultipartParser/Search.ts +17 -0
  604. package/src/unstable/http/MultipartParser/internal/contentType.ts +103 -0
  605. package/src/unstable/http/MultipartParser/internal/headers.ts +615 -0
  606. package/src/unstable/http/MultipartParser/internal/multipart.ts +262 -0
  607. package/src/unstable/http/MultipartParser/internal/search.ts +167 -0
  608. package/src/unstable/http/MultipartParser.ts +115 -0
  609. package/src/unstable/http/Template.ts +6 -5
  610. package/src/unstable/http/index.ts +1 -1
  611. package/src/unstable/http/internal/httpBody.ts +15 -0
  612. package/src/unstable/httpapi/HttpApi.ts +6 -7
  613. package/src/unstable/httpapi/HttpApiBuilder.ts +142 -25
  614. package/src/unstable/httpapi/HttpApiClient.ts +130 -49
  615. package/src/unstable/httpapi/HttpApiEndpoint.ts +117 -29
  616. package/src/unstable/httpapi/HttpApiError.ts +33 -39
  617. package/src/unstable/httpapi/HttpApiMiddleware.ts +1 -1
  618. package/src/unstable/httpapi/HttpApiSchema.ts +353 -0
  619. package/src/unstable/httpapi/OpenApi.ts +70 -20
  620. package/src/unstable/observability/OtlpExporter.ts +4 -2
  621. package/src/unstable/observability/OtlpLogger.ts +3 -1
  622. package/src/unstable/observability/OtlpMetrics.ts +32 -18
  623. package/src/unstable/observability/OtlpTracer.ts +1 -1
  624. package/src/unstable/persistence/PersistedQueue.ts +12 -9
  625. package/src/unstable/persistence/Persistence.ts +27 -7
  626. package/src/unstable/persistence/RateLimiter.ts +54 -31
  627. package/src/unstable/persistence/Redis.ts +1 -1
  628. package/src/unstable/reactivity/AsyncResult.ts +11 -6
  629. package/src/unstable/reactivity/Atom.ts +44 -25
  630. package/src/unstable/rpc/RpcClient.ts +42 -13
  631. package/src/unstable/rpc/RpcClientError.ts +2 -2
  632. package/src/unstable/rpc/RpcSerialization.ts +1 -1
  633. package/src/unstable/rpc/RpcServer.ts +4 -2
  634. package/src/unstable/schema/VariantSchema.ts +36 -18
  635. package/src/unstable/socket/Socket.ts +24 -14
  636. package/src/unstable/sql/SqlClient.ts +65 -56
  637. package/src/unstable/sql/SqlError.ts +13 -13
  638. package/src/unstable/sql/SqlResolver.ts +8 -6
  639. package/src/unstable/sql/Statement.ts +13 -8
  640. package/src/unstable/workers/WorkerError.ts +5 -5
  641. package/src/unstable/workflow/Workflow.ts +2 -5
  642. package/src/unstable/workflow/WorkflowEngine.ts +8 -3
  643. package/dist/unstable/http/Multipasta/HeadersParser.d.ts +0 -14
  644. package/dist/unstable/http/Multipasta/HeadersParser.d.ts.map +0 -1
  645. package/dist/unstable/http/Multipasta/HeadersParser.js +0 -14
  646. package/dist/unstable/http/Multipasta/HeadersParser.js.map +0 -1
  647. package/dist/unstable/http/Multipasta/Node.d.ts +0 -14
  648. package/dist/unstable/http/Multipasta/Node.d.ts.map +0 -1
  649. package/dist/unstable/http/Multipasta/Node.js +0 -14
  650. package/dist/unstable/http/Multipasta/Node.js.map +0 -1
  651. package/dist/unstable/http/Multipasta/Search.d.ts +0 -14
  652. package/dist/unstable/http/Multipasta/Search.d.ts.map +0 -1
  653. package/dist/unstable/http/Multipasta/Search.js +0 -14
  654. package/dist/unstable/http/Multipasta/Search.js.map +0 -1
  655. package/dist/unstable/http/Multipasta/Web.d.ts +0 -14
  656. package/dist/unstable/http/Multipasta/Web.d.ts.map +0 -1
  657. package/dist/unstable/http/Multipasta/Web.js +0 -14
  658. package/dist/unstable/http/Multipasta/Web.js.map +0 -1
  659. package/dist/unstable/http/Multipasta.d.ts +0 -15
  660. package/dist/unstable/http/Multipasta.d.ts.map +0 -1
  661. package/dist/unstable/http/Multipasta.js +0 -15
  662. package/dist/unstable/http/Multipasta.js.map +0 -1
  663. package/src/unstable/http/Multipasta/HeadersParser.ts +0 -14
  664. package/src/unstable/http/Multipasta/Node.ts +0 -14
  665. package/src/unstable/http/Multipasta/Search.ts +0 -14
  666. package/src/unstable/http/Multipasta/Web.ts +0 -14
  667. package/src/unstable/http/Multipasta.ts +0 -15
package/dist/Schema.js CHANGED
@@ -81,7 +81,7 @@ const TypeId = InternalSchema.TypeId;
81
81
  * **Example** (Schema for a parametric `Box<A>` type)
82
82
  *
83
83
  * ```ts import.meta.vitest
84
- * import { Effect, Schema, SchemaIssue as Issue, SchemaParser } from "effect"
84
+ * import { Effect, Schema, SchemaIssue, SchemaParser } from "effect"
85
85
  *
86
86
  * interface Box<A> {
87
87
  * readonly value: A
@@ -96,7 +96,7 @@ const TypeId = InternalSchema.TypeId;
96
96
  * ([itemCodec]) =>
97
97
  * (u, ast, options) => {
98
98
  * if (!isBox(u)) {
99
- * return Effect.fail(new SchemaIssue.InvalidType(ast))
99
+ * return Effect.fail(new SchemaIssue.InvalidType(ast, u, options))
100
100
  * }
101
101
  * return Effect.map(
102
102
  * SchemaParser.decodeUnknownEffect(itemCodec)(u.value, options),
@@ -150,7 +150,7 @@ export function declareConstructor() {
150
150
  * @since 3.10.0
151
151
  */
152
152
  export function declare(is, annotations) {
153
- return declareConstructor()([], () => (input, ast) => is(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast)), annotations);
153
+ return declareConstructor()([], () => (input, ast, options) => is(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast, input, options)), annotations);
154
154
  }
155
155
  /**
156
156
  * Returns a schema widened to the fully-parameterized {@link Bottom} interface,
@@ -338,10 +338,12 @@ isSchemaError,
338
338
  *
339
339
  * The `issue` field contains a structured {@link SchemaIssue.Issue} tree describing
340
340
  * every validation failure, including the path to the problematic value and
341
- * the expected type or constraint. Built-in issues have no `actual` field,
342
- * and built-in messages do not include the rejected value. Other Issue fields
343
- * and custom annotations or messages are not sanitized. `message` renders the
344
- * issue tree as a human-readable string.
341
+ * the expected type or constraint. Parsing with `reportInput: true` adds an
342
+ * enumerable `input` field to value-bearing issues created by the parser.
343
+ * Built-in messages may include reported input. Other issue fields and
344
+ * custom annotations or messages are not sanitized.
345
+ * `message` renders the issue tree as a human-readable string and can disclose
346
+ * retained input.
345
347
  *
346
348
  * Use {@link isSchemaError} to narrow an unknown value to `SchemaError`.
347
349
  *
@@ -584,6 +586,9 @@ export const is = SchemaParser.is;
584
586
  *
585
587
  * The input is narrowed if the assertion succeeds. If schema validation fails,
586
588
  * the assertion throws an `Error` whose cause is `SchemaIssue.Issue`.
589
+ * Schema validation failures use the generic message `"Schema validation failed"`.
590
+ * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when
591
+ * human-readable details are needed.
587
592
  *
588
593
  * **Gotchas**
589
594
  *
@@ -641,9 +646,12 @@ export const asserts = SchemaParser.asserts;
641
646
  export function decodeUnknownEffect(schema, options) {
642
647
  const parser = SchemaParser.decodeUnknownEffect(schema, options);
643
648
  return (input, options) => {
644
- return InternalSchema.fromIssueEffect(parser(input, options));
649
+ return fromIssueEffect(parser(input, options));
645
650
  };
646
651
  }
652
+ function fromIssueEffect(self) {
653
+ return Effect.catchCause(self, cause => Effect.failCauseSync(() => Cause_.map(cause, issue => new SchemaError(issue))));
654
+ }
647
655
  /**
648
656
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
649
657
  * returning an `Effect` that succeeds with the decoded value or fails with a
@@ -1050,7 +1058,7 @@ export const decodeSync = decodeUnknownSync;
1050
1058
  export function encodeUnknownEffect(schema, options) {
1051
1059
  const parser = SchemaParser.encodeUnknownEffect(schema, options);
1052
1060
  return (input, options) => {
1053
- return InternalSchema.fromIssueEffect(parser(input, options));
1061
+ return fromIssueEffect(parser(input, options));
1054
1062
  };
1055
1063
  }
1056
1064
  /**
@@ -2706,7 +2714,7 @@ export function encode(transformation) {
2706
2714
  * **Details**
2707
2715
  *
2708
2716
  * Constructor defaults are applied only during `make*`, not during decoding or
2709
- * encoding.
2717
+ * encoding. Failures are represented directly as `SchemaIssue.Issue` values.
2710
2718
  *
2711
2719
  * **Example** (Defining an optional field with a static default)
2712
2720
  *
@@ -2730,7 +2738,7 @@ export function withConstructorDefault(
2730
2738
  // `S["~type.make.in"]` instead of `S["Type"]` is intentional here because
2731
2739
  // it makes easier to define the default value if there are nested defaults
2732
2740
  defaultValue) {
2733
- return schema => make(SchemaAST.withConstructorDefault(schema.ast, toIssueEffect(defaultValue)), {
2741
+ return schema => make(SchemaAST.withConstructorDefault(schema.ast, defaultValue), {
2734
2742
  schema
2735
2743
  });
2736
2744
  }
@@ -5903,7 +5911,7 @@ export function isPropertyNames(keySchema, annotations) {
5903
5911
  }
5904
5912
  }
5905
5913
  if (Arr.isArrayNonEmpty(issues)) {
5906
- return new SchemaIssue.Composite(ast, issues);
5914
+ return new SchemaIssue.Composite(ast, issues, input, options);
5907
5915
  }
5908
5916
  return true;
5909
5917
  }, {
@@ -6037,10 +6045,10 @@ export function Option(value) {
6037
6045
  }
6038
6046
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(input.value, options), {
6039
6047
  onSuccess: Option_.some,
6040
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["value"], issue)])
6048
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "value", issue, input, options)
6041
6049
  });
6042
6050
  }
6043
- return Effect.fail(new SchemaIssue.InvalidType(ast));
6051
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
6044
6052
  }, {
6045
6053
  representation: {
6046
6054
  id: "effect/schema/Option",
@@ -6208,18 +6216,18 @@ export function OptionFromOptionalNullOr(schema, options) {
6208
6216
  export function Result(success, failure) {
6209
6217
  const schema = declareConstructor()([success, failure], ([success, failure]) => (input, ast, options) => {
6210
6218
  if (!Result_.isResult(input)) {
6211
- return Effect.fail(new SchemaIssue.InvalidType(ast));
6219
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
6212
6220
  }
6213
6221
  switch (input._tag) {
6214
6222
  case "Success":
6215
6223
  return Effect.mapBothEager(SchemaParser.decodeEffect(success)(input.success, options), {
6216
6224
  onSuccess: Result_.succeed,
6217
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["success"], issue)])
6225
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "success", issue, input, options)
6218
6226
  });
6219
6227
  case "Failure":
6220
6228
  return Effect.mapBothEager(SchemaParser.decodeEffect(failure)(input.failure, options), {
6221
6229
  onSuccess: Result_.fail,
6222
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["failure"], issue)])
6230
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "failure", issue, input, options)
6223
6231
  });
6224
6232
  }
6225
6233
  }, {
@@ -6340,11 +6348,11 @@ export function Redacted(value, options) {
6340
6348
  onSuccess: () => input,
6341
6349
  onFailure: (/** ignore the issue because of security reasons */
6342
6350
  ) => {
6343
- return new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["value"], new SchemaIssue.InvalidValue())]);
6351
+ return new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["value"], new SchemaIssue.InvalidValue(undefined, input, poptions))], input, poptions);
6344
6352
  }
6345
6353
  }));
6346
6354
  }
6347
- return Effect.fail(new SchemaIssue.InvalidType(ast));
6355
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, poptions));
6348
6356
  }, {
6349
6357
  representation: {
6350
6358
  id: "effect/schema/Redacted",
@@ -6442,18 +6450,18 @@ export function RedactedFromValue(value, options) {
6442
6450
  export function CauseReason(error, defect) {
6443
6451
  const schema = declareConstructor()([error, defect], ([error, defect]) => (input, ast, options) => {
6444
6452
  if (!Cause_.isReason(input)) {
6445
- return Effect.fail(new SchemaIssue.InvalidType(ast));
6453
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
6446
6454
  }
6447
6455
  switch (input._tag) {
6448
6456
  case "Fail":
6449
6457
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(error)(input.error, options), {
6450
6458
  onSuccess: Cause_.makeFailReason,
6451
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["error"], issue)])
6459
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "error", issue, input, options)
6452
6460
  });
6453
6461
  case "Die":
6454
6462
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(defect)(input.defect, options), {
6455
6463
  onSuccess: Cause_.makeDieReason,
6456
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["defect"], issue)])
6464
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "defect", issue, input, options)
6457
6465
  });
6458
6466
  case "Interrupt":
6459
6467
  return Effect.succeed(input);
@@ -6581,11 +6589,11 @@ export function Cause(error, defect) {
6581
6589
  const failures = ArraySchema(CauseReason(error, defect));
6582
6590
  return (input, ast, options) => {
6583
6591
  if (!Cause_.isCause(input)) {
6584
- return Effect.fail(new SchemaIssue.InvalidType(ast));
6592
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
6585
6593
  }
6586
6594
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(failures)(input.reasons, options), {
6587
6595
  onSuccess: Cause_.fromReasons,
6588
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["failures"], issue)])
6596
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "failures", issue, input, options)
6589
6597
  });
6590
6598
  };
6591
6599
  }, {
@@ -6695,7 +6703,7 @@ const errorSchemaCache = [];
6695
6703
  * @category schemas
6696
6704
  * @since 4.0.0
6697
6705
  */
6698
- export function Error(options) {
6706
+ export function ErrorInstance(options) {
6699
6707
  const key = getErrorOptionsKey(options);
6700
6708
  const cached = errorSchemaCache[key];
6701
6709
  if (cached !== undefined) {
@@ -6708,7 +6716,7 @@ export function Error(options) {
6708
6716
  payload: normalizedOptions ?? null
6709
6717
  },
6710
6718
  toCode: () => ({
6711
- runtime: normalizedOptions !== undefined ? `Schema.Error(${format(normalizedOptions)})` : `Schema.Error()`,
6719
+ runtime: normalizedOptions !== undefined ? `Schema.ErrorInstance(${format(normalizedOptions)})` : `Schema.ErrorInstance()`,
6712
6720
  Type: `globalThis.Error`
6713
6721
  }),
6714
6722
  expected: "Error",
@@ -6719,22 +6727,22 @@ export function Error(options) {
6719
6727
  return schema;
6720
6728
  }
6721
6729
  /**
6722
- * Reviver for persisted {@link Error} declarations.
6730
+ * Reviver for persisted {@link ErrorInstance} declarations.
6723
6731
  *
6724
6732
  * **When to use**
6725
6733
  *
6726
- * Use when reconstructing documents that may contain schemas created by {@link Error}.
6734
+ * Use when reconstructing documents that may contain schemas created by {@link ErrorInstance}.
6727
6735
  *
6728
- * @see {@link Error} for creating the corresponding schema
6736
+ * @see {@link ErrorInstance} for creating the corresponding schema
6729
6737
  *
6730
6738
  * @category schemas
6731
6739
  * @since 4.0.0
6732
6740
  */
6733
- export const ErrorReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/Error", ErrorRepresentationPayload, ({
6741
+ export const ErrorInstanceReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/Error", ErrorRepresentationPayload, ({
6734
6742
  annotations,
6735
6743
  payload
6736
6744
  }) => {
6737
- const schema = Error(payload ?? undefined);
6745
+ const schema = ErrorInstance(payload ?? undefined);
6738
6746
  return annotations === undefined ? schema : schema.annotate(annotations);
6739
6747
  });
6740
6748
  const defectSchemaCache = [];
@@ -6775,7 +6783,7 @@ const defectSchemaCache = [];
6775
6783
  * - Values that cannot be represented as JSON fall back to Effect's formatted
6776
6784
  * string representation.
6777
6785
  *
6778
- * @see {@link Error} for a schema that only accepts JavaScript `Error` values.
6786
+ * @see {@link ErrorInstance} for a schema that only accepts JavaScript `Error` values.
6779
6787
  * @category schemas
6780
6788
  * @since 4.0.0
6781
6789
  */
@@ -6806,18 +6814,18 @@ export function Exit(value, error, defect) {
6806
6814
  const cause = Cause(error, defect);
6807
6815
  return (input, ast, options) => {
6808
6816
  if (!Exit_.isExit(input)) {
6809
- return Effect.fail(new SchemaIssue.InvalidType(ast));
6817
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
6810
6818
  }
6811
6819
  switch (input._tag) {
6812
6820
  case "Success":
6813
6821
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(input.value, options), {
6814
6822
  onSuccess: Exit_.succeed,
6815
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["value"], issue)])
6823
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "value", issue, input, options)
6816
6824
  });
6817
6825
  case "Failure":
6818
6826
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(cause)(input.cause, options), {
6819
6827
  onSuccess: Exit_.failCause,
6820
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["cause"], issue)])
6828
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "cause", issue, input, options)
6821
6829
  });
6822
6830
  }
6823
6831
  };
@@ -6961,10 +6969,10 @@ export function ReadonlyMap(key, value) {
6961
6969
  if (input instanceof globalThis.Map) {
6962
6970
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(array)([...input], options), {
6963
6971
  onSuccess: array => new globalThis.Map(array),
6964
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["entries"], issue)])
6972
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "entries", issue, input, options)
6965
6973
  });
6966
6974
  }
6967
- return Effect.fail(new SchemaIssue.InvalidType(ast));
6975
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
6968
6976
  };
6969
6977
  }, {
6970
6978
  representation: {
@@ -7030,10 +7038,10 @@ export function HashMap(key, value) {
7030
7038
  if (HashMap_.isHashMap(input)) {
7031
7039
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(entries)(HashMap_.toEntries(input), options), {
7032
7040
  onSuccess: HashMap_.fromIterable,
7033
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["entries"], issue)])
7041
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "entries", issue, input, options)
7034
7042
  });
7035
7043
  }
7036
- return Effect.fail(new SchemaIssue.InvalidType(ast));
7044
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
7037
7045
  };
7038
7046
  }, {
7039
7047
  representation: {
@@ -7100,10 +7108,10 @@ export function ReadonlySet(value) {
7100
7108
  if (input instanceof globalThis.Set) {
7101
7109
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(array)([...input], options), {
7102
7110
  onSuccess: array => new globalThis.Set(array),
7103
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["values"], issue)])
7111
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "values", issue, input, options)
7104
7112
  });
7105
7113
  }
7106
- return Effect.fail(new SchemaIssue.InvalidType(ast));
7114
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
7107
7115
  };
7108
7116
  }, {
7109
7117
  representation: {
@@ -7168,10 +7176,10 @@ export function HashSet(value) {
7168
7176
  if (HashSet_.isHashSet(input)) {
7169
7177
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {
7170
7178
  onSuccess: HashSet_.fromIterable,
7171
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["values"], issue)])
7179
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "values", issue, input, options)
7172
7180
  });
7173
7181
  }
7174
- return Effect.fail(new SchemaIssue.InvalidType(ast));
7182
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
7175
7183
  };
7176
7184
  }, {
7177
7185
  representation: {
@@ -7236,10 +7244,10 @@ export function Chunk(value) {
7236
7244
  if (Chunk_.isChunk(input)) {
7237
7245
  return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {
7238
7246
  onSuccess: Chunk_.fromIterable,
7239
- onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["values"], issue)])
7247
+ onFailure: issue => SchemaIssue.makeCompositeAtKey(ast, "values", issue, input, options)
7240
7248
  });
7241
7249
  }
7242
- return Effect.fail(new SchemaIssue.InvalidType(ast));
7250
+ return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
7243
7251
  };
7244
7252
  }, {
7245
7253
  representation: {
@@ -7315,11 +7323,11 @@ export const RegExp = /*#__PURE__*/instanceOf(globalThis.RegExp, {
7315
7323
  source: String,
7316
7324
  flags: String
7317
7325
  }), SchemaTransformation.transformOrFail({
7318
- decode: e => Effect.try({
7326
+ decode: (e, options) => Effect.try({
7319
7327
  try: () => new globalThis.RegExp(e.source, e.flags),
7320
7328
  catch: () => new SchemaIssue.InvalidValue({
7321
- message: "Expected valid RegExp source and flags"
7322
- })
7329
+ expected: "valid RegExp source and flags"
7330
+ }, e, options)
7323
7331
  }),
7324
7332
  encode: regExp => Effect.succeed({
7325
7333
  source: regExp.source,
@@ -7894,10 +7902,10 @@ export const File = /*#__PURE__*/instanceOf(globalThis.File, {
7894
7902
  name: String,
7895
7903
  lastModified: Int
7896
7904
  }), SchemaTransformation.transformOrFail({
7897
- decode: e => Result_.match(Encoding.decodeBase64(e.data), {
7905
+ decode: (e, options) => Result_.match(Encoding.decodeBase64(e.data), {
7898
7906
  onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({
7899
- message: "Expected a valid Base64 string"
7900
- })),
7907
+ expected: "a valid Base64 string"
7908
+ }, e.data, options)),
7901
7909
  onSuccess: bytes => {
7902
7910
  const buffer = new globalThis.Uint8Array(bytes);
7903
7911
  return Effect.succeed(new globalThis.File([buffer], e.name, {
@@ -7906,7 +7914,7 @@ export const File = /*#__PURE__*/instanceOf(globalThis.File, {
7906
7914
  }));
7907
7915
  }
7908
7916
  }),
7909
- encode: file => Effect.tryPromise({
7917
+ encode: (file, options) => Effect.tryPromise({
7910
7918
  try: async () => {
7911
7919
  const bytes = new globalThis.Uint8Array(await file.arrayBuffer());
7912
7920
  return {
@@ -7917,8 +7925,8 @@ export const File = /*#__PURE__*/instanceOf(globalThis.File, {
7917
7925
  };
7918
7926
  },
7919
7927
  catch: () => new SchemaIssue.InvalidValue({
7920
- message: "Expected File to be readable"
7921
- })
7928
+ expected: "a readable File"
7929
+ }, file, options)
7922
7930
  })
7923
7931
  }))
7924
7932
  });
@@ -8985,12 +8993,17 @@ function getClassSchemaFactory(from, identifier, annotations) {
8985
8993
  if (memo !== undefined) {
8986
8994
  return memo;
8987
8995
  }
8996
+ const ClassTypeId = getClassTypeId(identifier);
8997
+ const isClassValue = input => input instanceof self || Predicate.hasProperty(input, ClassTypeId);
8988
8998
  const transformation = getClassTransformation(self);
8989
- const to = make(new SchemaAST.Declaration([from.ast], () => (input, ast) => {
8990
- return input instanceof self || Predicate.hasProperty(input, getClassTypeId(identifier)) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast));
8999
+ const to = make(new SchemaAST.Declaration([from.ast], () => (input, ast, options) => {
9000
+ return isClassValue(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
8991
9001
  }, {
8992
9002
  identifier,
8993
- [SchemaAST.ClassTypeId]: ([from]) => new SchemaAST.Link(from, transformation),
9003
+ [InternalAnnotations.CONSTRUCTOR_ANNOTATION_KEY]: ([from]) => ({
9004
+ isConstructed: isClassValue,
9005
+ link: new SchemaAST.Link(from, transformation)
9006
+ }),
8994
9007
  toCodec: ([from]) => new SchemaAST.Link(from.ast, transformation),
8995
9008
  toArbitrary: ([from]) => () => ({
8996
9009
  arbitrary: from.arbitrary.map(args => new self(args)),
@@ -9008,8 +9021,8 @@ function isStruct(schema) {
9008
9021
  }
9009
9022
  /**
9010
9023
  * Creates a schema-backed class whose constructor validates input against a
9011
- * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
9012
- * input.
9024
+ * {@link Struct} schema. Construction throws an `Error` with a
9025
+ * `SchemaIssue.Issue` in its `cause` on invalid input.
9013
9026
  *
9014
9027
  * **When to use**
9015
9028
  *
@@ -9069,8 +9082,8 @@ function isStruct(schema) {
9069
9082
  * ```
9070
9083
  *
9071
9084
  * @see {@link TaggedClass} for adding a `_tag` literal field to the class schema
9072
- * @see {@link ErrorClass} for defining schema-backed error classes
9073
- * @see {@link TaggedErrorClass} for defining tagged schema-backed error classes
9085
+ * @see {@link Error} for defining schema-backed error classes
9086
+ * @see {@link TaggedError} for defining tagged schema-backed error classes
9074
9087
  *
9075
9088
  * @category constructors
9076
9089
  * @since 3.10.0
@@ -9137,7 +9150,7 @@ export const TaggedClass = identifier => {
9137
9150
  * ```ts import.meta.vitest
9138
9151
  * import { Effect, Schema } from "effect"
9139
9152
  *
9140
- * class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
9153
+ * class NotFound extends Schema.Error<NotFound>("NotFound")({
9141
9154
  * id: Schema.Number
9142
9155
  * }) {}
9143
9156
  *
@@ -9151,7 +9164,7 @@ export const TaggedClass = identifier => {
9151
9164
  * @category constructors
9152
9165
  * @since 4.0.0
9153
9166
  */
9154
- export const ErrorClass = identifier => (schema, annotations) => {
9167
+ export const Error = identifier => (schema, annotations) => {
9155
9168
  const struct = isStruct(schema) ? schema : Struct(schema);
9156
9169
  const self = makeClass(core.Error, identifier, struct, annotations, identifier => ({
9157
9170
  name: identifier
@@ -9172,7 +9185,7 @@ export const ErrorClass = identifier => (schema, annotations) => {
9172
9185
  * ```ts import.meta.vitest
9173
9186
  * import { Effect, Schema } from "effect"
9174
9187
  *
9175
- * class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
9188
+ * class NotFound extends Schema.TaggedError<NotFound>()("NotFound", {
9176
9189
  * id: Schema.Number
9177
9190
  * }) {}
9178
9191
  *
@@ -9187,7 +9200,7 @@ export const ErrorClass = identifier => (schema, annotations) => {
9187
9200
  * @category constructors
9188
9201
  * @since 3.10.0
9189
9202
  */
9190
- export const TaggedErrorClass = identifier => {
9203
+ export const TaggedError = identifier => {
9191
9204
  return (tagValue, schema, annotations) => {
9192
9205
  const struct = isStruct(schema) ? schema.mapFields(fields => ({
9193
9206
  _tag: tag(tagValue),
@@ -9195,7 +9208,7 @@ export const TaggedErrorClass = identifier => {
9195
9208
  }), {
9196
9209
  unsafePreserveChecks: true
9197
9210
  }) : TaggedStruct(tagValue, schema);
9198
- return ErrorClass(identifier ?? tagValue)(struct, annotations);
9211
+ return Error(identifier ?? tagValue)(struct, annotations);
9199
9212
  };
9200
9213
  };
9201
9214
  /**
@@ -9507,7 +9520,7 @@ const toCodecJsonASTBase = /*#__PURE__*/SchemaAST.applyToSelfOrLastLinkEncoding(
9507
9520
  /** @internal */
9508
9521
  export const toCodecJsonAST = /*#__PURE__*/memoize(toCodecJsonASTBase);
9509
9522
  function withoutConstructorDefault(context) {
9510
- return context.defaultValue === undefined ? context : new SchemaAST.Context(context.isOptional, context.isMutable, undefined, context.annotations);
9523
+ return context.constructorDefault === undefined ? context : new SchemaAST.Context(context.isOptional, context.isMutable, undefined, context.annotations);
9511
9524
  }
9512
9525
  function validateCanonicalObjectPropertyNames(ast) {
9513
9526
  if (ast.propertySignatures.some(ps => typeof ps.name !== "string")) {
@@ -10068,6 +10081,18 @@ export const isBetweenBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterRevi
10068
10081
  * Derives an `Iso` optic from a schema that isomorphically converts between
10069
10082
  * the schema's `Type` and its `Iso` (intermediate / serialized form).
10070
10083
  *
10084
+ * **Details**
10085
+ *
10086
+ * Reading through the `Iso` encodes the schema value, while replacing through
10087
+ * it decodes the new focus.
10088
+ *
10089
+ * **Gotchas**
10090
+ *
10091
+ * Either direction can throw an `Error` with the generic message
10092
+ * `"Schema validation failed"` and a `SchemaIssue.Issue` in its `cause`. Format
10093
+ * the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when
10094
+ * human-readable details are needed.
10095
+ *
10071
10096
  * @category converting
10072
10097
  * @since 4.0.0
10073
10098
  */
@@ -10127,6 +10152,19 @@ export function overrideToCodecIso(to, transformation) {
10127
10152
  * {@link toCodecJson}), computes RFC 6902 JSON Patch operations between old
10128
10153
  * and new values, and can apply patches back to the typed value.
10129
10154
  *
10155
+ * **Details**
10156
+ *
10157
+ * `diff` encodes both values before computing the patch. `patch` encodes the old
10158
+ * value, applies the patch to its JSON representation, and decodes the result.
10159
+ *
10160
+ * **Gotchas**
10161
+ *
10162
+ * Schema encoding or decoding failures throw an `Error` with the generic message
10163
+ * `"Schema validation failed"` and a `SchemaIssue.Issue` in its `cause`. Format
10164
+ * the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when
10165
+ * human-readable details are needed. Errors produced by {@link JsonPatch.apply}
10166
+ * for invalid patch operations are separate from schema validation failures.
10167
+ *
10130
10168
  * @category converting
10131
10169
  * @since 4.0.0
10132
10170
  */