effect 4.0.0-beta.104 → 4.0.0-beta.106

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 (300) 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/Config.d.ts.map +1 -1
  81. package/dist/Config.js +5 -4
  82. package/dist/Config.js.map +1 -1
  83. package/dist/ConfigProvider.d.ts +35 -3
  84. package/dist/ConfigProvider.d.ts.map +1 -1
  85. package/dist/ConfigProvider.js +41 -8
  86. package/dist/ConfigProvider.js.map +1 -1
  87. package/dist/Context.d.ts +0 -1
  88. package/dist/Context.d.ts.map +1 -1
  89. package/dist/Context.js +1 -22
  90. package/dist/Context.js.map +1 -1
  91. package/dist/Cron.d.ts +31 -0
  92. package/dist/Cron.d.ts.map +1 -1
  93. package/dist/Cron.js +58 -2
  94. package/dist/Cron.js.map +1 -1
  95. package/dist/Fiber.d.ts +1 -1
  96. package/dist/Fiber.d.ts.map +1 -1
  97. package/dist/Function.d.ts +26 -0
  98. package/dist/Function.d.ts.map +1 -1
  99. package/dist/Function.js +36 -0
  100. package/dist/Function.js.map +1 -1
  101. package/dist/JsonSchema.d.ts.map +1 -1
  102. package/dist/JsonSchema.js +34 -17
  103. package/dist/JsonSchema.js.map +1 -1
  104. package/dist/Optic.d.ts +35 -21
  105. package/dist/Optic.d.ts.map +1 -1
  106. package/dist/Optic.js +33 -34
  107. package/dist/Optic.js.map +1 -1
  108. package/dist/Schema.d.ts +105 -109
  109. package/dist/Schema.d.ts.map +1 -1
  110. package/dist/Schema.js +141 -104
  111. package/dist/Schema.js.map +1 -1
  112. package/dist/SchemaAST.d.ts +32 -17
  113. package/dist/SchemaAST.d.ts.map +1 -1
  114. package/dist/SchemaAST.js +79 -60
  115. package/dist/SchemaAST.js.map +1 -1
  116. package/dist/SchemaError.d.ts +8 -8
  117. package/dist/SchemaError.d.ts.map +1 -1
  118. package/dist/SchemaError.js +7 -6
  119. package/dist/SchemaError.js.map +1 -1
  120. package/dist/SchemaGetter.d.ts +8 -5
  121. package/dist/SchemaGetter.d.ts.map +1 -1
  122. package/dist/SchemaGetter.js +41 -37
  123. package/dist/SchemaGetter.js.map +1 -1
  124. package/dist/SchemaIssue.d.ts +195 -38
  125. package/dist/SchemaIssue.d.ts.map +1 -1
  126. package/dist/SchemaIssue.js +243 -68
  127. package/dist/SchemaIssue.js.map +1 -1
  128. package/dist/SchemaParser.d.ts +30 -0
  129. package/dist/SchemaParser.d.ts.map +1 -1
  130. package/dist/SchemaParser.js +39 -9
  131. package/dist/SchemaParser.js.map +1 -1
  132. package/dist/SchemaRepresentation.d.ts +15 -3
  133. package/dist/SchemaRepresentation.d.ts.map +1 -1
  134. package/dist/SchemaRepresentation.js +8 -2
  135. package/dist/SchemaRepresentation.js.map +1 -1
  136. package/dist/SchemaTransformation.d.ts +2 -2
  137. package/dist/SchemaTransformation.d.ts.map +1 -1
  138. package/dist/SchemaTransformation.js +26 -26
  139. package/dist/SchemaTransformation.js.map +1 -1
  140. package/dist/ScopedRef.d.ts.map +1 -1
  141. package/dist/ScopedRef.js +1 -1
  142. package/dist/ScopedRef.js.map +1 -1
  143. package/dist/Stdio.d.ts +17 -4
  144. package/dist/Stdio.d.ts.map +1 -1
  145. package/dist/Stdio.js +6 -3
  146. package/dist/Stdio.js.map +1 -1
  147. package/dist/TxQueue.js +1 -1
  148. package/dist/TxQueue.js.map +1 -1
  149. package/dist/internal/effect.js +2 -4
  150. package/dist/internal/effect.js.map +1 -1
  151. package/dist/internal/executionPlan.js +3 -2
  152. package/dist/internal/executionPlan.js.map +1 -1
  153. package/dist/internal/rcRef.js +18 -13
  154. package/dist/internal/rcRef.js.map +1 -1
  155. package/dist/internal/schema/fromJsonSchemaDocument.js +10 -6
  156. package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
  157. package/dist/internal/schema/schema.js +1 -9
  158. package/dist/internal/schema/schema.js.map +1 -1
  159. package/dist/internal/schema/toArbitrary.d.ts +1 -4
  160. package/dist/internal/schema/toArbitrary.d.ts.map +1 -1
  161. package/dist/internal/schema/toArbitrary.js +0 -74
  162. package/dist/internal/schema/toArbitrary.js.map +1 -1
  163. package/dist/internal/schema/toJsonSchemaDocument.js +18 -4
  164. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  165. package/dist/internal/schema/toRepresentation.js +45 -43
  166. package/dist/internal/schema/toRepresentation.js.map +1 -1
  167. package/dist/testing/TestSchema.d.ts +1 -1
  168. package/dist/testing/TestSchema.d.ts.map +1 -1
  169. package/dist/testing/TestSchema.js +10 -9
  170. package/dist/testing/TestSchema.js.map +1 -1
  171. package/dist/unstable/ai/McpSchema.d.ts +110 -110
  172. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  173. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  174. package/dist/unstable/ai/McpServer.js +23 -11
  175. package/dist/unstable/ai/McpServer.js.map +1 -1
  176. package/dist/unstable/ai/Prompt.d.ts +4 -3
  177. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  178. package/dist/unstable/ai/Prompt.js +42 -17
  179. package/dist/unstable/ai/Prompt.js.map +1 -1
  180. package/dist/unstable/cluster/Entity.d.ts +2 -2
  181. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  182. package/dist/unstable/cluster/Entity.js.map +1 -1
  183. package/dist/unstable/cluster/EntityProxy.d.ts +3 -3
  184. package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
  185. package/dist/unstable/cluster/EntityProxy.js +4 -3
  186. package/dist/unstable/cluster/EntityProxy.js.map +1 -1
  187. package/dist/unstable/cluster/Reply.js +4 -4
  188. package/dist/unstable/cluster/Reply.js.map +1 -1
  189. package/dist/unstable/cluster/Sharding.d.ts +2 -2
  190. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  191. package/dist/unstable/cluster/Sharding.js +14 -5
  192. package/dist/unstable/cluster/Sharding.js.map +1 -1
  193. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  194. package/dist/unstable/encoding/Msgpack.js +6 -6
  195. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  196. package/dist/unstable/eventlog/EventLogEncryption.d.ts +6 -5
  197. package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
  198. package/dist/unstable/eventlog/EventLogEncryption.js +14 -12
  199. package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
  200. package/dist/unstable/eventlog/EventLogMessage.d.ts +3 -3
  201. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  202. package/dist/unstable/eventlog/EventLogMessage.js +2 -3
  203. package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
  204. package/dist/unstable/eventlog/EventLogRemote.js +4 -4
  205. package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
  206. package/dist/unstable/eventlog/EventLogServerEncrypted.js +3 -2
  207. package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
  208. package/dist/unstable/http/HttpClient.d.ts +59 -3
  209. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  210. package/dist/unstable/http/HttpClient.js +33 -19
  211. package/dist/unstable/http/HttpClient.js.map +1 -1
  212. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  213. package/dist/unstable/http/HttpServerRequest.js +7 -1
  214. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  215. package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -1
  216. package/dist/unstable/http/MultipartParser/internal/multipart.js +18 -6
  217. package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -1
  218. package/dist/unstable/httpapi/HttpApiBuilder.js +10 -10
  219. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  220. package/dist/unstable/httpapi/HttpApiClient.js +9 -9
  221. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  222. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  223. package/dist/unstable/httpapi/OpenApi.js +1 -1
  224. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  225. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  226. package/dist/unstable/reactivity/AsyncResult.js +4 -4
  227. package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
  228. package/dist/unstable/reactivity/Atom.d.ts +26 -11
  229. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  230. package/dist/unstable/reactivity/Atom.js +9 -22
  231. package/dist/unstable/reactivity/Atom.js.map +1 -1
  232. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  233. package/dist/unstable/rpc/RpcClient.js +8 -1
  234. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  235. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  236. package/dist/unstable/rpc/RpcServer.js +3 -2
  237. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  238. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  239. package/dist/unstable/sql/SqlResolver.js +20 -16
  240. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  241. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  242. package/dist/unstable/workers/Worker.js +11 -12
  243. package/dist/unstable/workers/Worker.js.map +1 -1
  244. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  245. package/dist/unstable/workflow/Workflow.js +2 -2
  246. package/dist/unstable/workflow/Workflow.js.map +1 -1
  247. package/package.json +5 -2
  248. package/src/Brand.ts +4 -4
  249. package/src/Config.ts +6 -4
  250. package/src/ConfigProvider.ts +43 -8
  251. package/src/Context.ts +1 -23
  252. package/src/Cron.ts +65 -2
  253. package/src/Fiber.ts +1 -1
  254. package/src/Function.ts +37 -0
  255. package/src/JsonSchema.ts +43 -42
  256. package/src/Optic.ts +59 -58
  257. package/src/Schema.ts +213 -217
  258. package/src/SchemaAST.ts +135 -78
  259. package/src/SchemaError.ts +9 -9
  260. package/src/SchemaGetter.ts +89 -30
  261. package/src/SchemaIssue.ts +285 -80
  262. package/src/SchemaParser.ts +51 -17
  263. package/src/SchemaRepresentation.ts +15 -3
  264. package/src/SchemaTransformation.ts +66 -18
  265. package/src/ScopedRef.ts +3 -1
  266. package/src/Stdio.ts +23 -4
  267. package/src/TxQueue.ts +1 -1
  268. package/src/internal/effect.ts +3 -6
  269. package/src/internal/executionPlan.ts +3 -2
  270. package/src/internal/rcRef.ts +24 -16
  271. package/src/internal/schema/fromJsonSchemaDocument.ts +19 -14
  272. package/src/internal/schema/schema.ts +1 -17
  273. package/src/internal/schema/toArbitrary.ts +0 -72
  274. package/src/internal/schema/toJsonSchemaDocument.ts +24 -4
  275. package/src/internal/schema/toRepresentation.ts +66 -48
  276. package/src/testing/TestSchema.ts +10 -10
  277. package/src/unstable/ai/McpServer.ts +23 -11
  278. package/src/unstable/ai/Prompt.ts +51 -19
  279. package/src/unstable/cluster/Entity.ts +7 -2
  280. package/src/unstable/cluster/EntityProxy.ts +12 -5
  281. package/src/unstable/cluster/Reply.ts +4 -4
  282. package/src/unstable/cluster/Sharding.ts +29 -17
  283. package/src/unstable/encoding/Msgpack.ts +12 -8
  284. package/src/unstable/eventlog/EventLogEncryption.ts +15 -16
  285. package/src/unstable/eventlog/EventLogMessage.ts +2 -3
  286. package/src/unstable/eventlog/EventLogRemote.ts +4 -4
  287. package/src/unstable/eventlog/EventLogServerEncrypted.ts +2 -2
  288. package/src/unstable/http/HttpClient.ts +132 -23
  289. package/src/unstable/http/HttpServerRequest.ts +8 -3
  290. package/src/unstable/http/MultipartParser/internal/multipart.ts +19 -6
  291. package/src/unstable/httpapi/HttpApiBuilder.ts +32 -13
  292. package/src/unstable/httpapi/HttpApiClient.ts +26 -8
  293. package/src/unstable/httpapi/OpenApi.ts +4 -1
  294. package/src/unstable/reactivity/AsyncResult.ts +11 -6
  295. package/src/unstable/reactivity/Atom.ts +44 -25
  296. package/src/unstable/rpc/RpcClient.ts +9 -1
  297. package/src/unstable/rpc/RpcServer.ts +4 -2
  298. package/src/unstable/sql/SqlResolver.ts +28 -20
  299. package/src/unstable/workers/Worker.ts +13 -14
  300. package/src/unstable/workflow/Workflow.ts +2 -5
package/dist/Schema.d.ts CHANGED
@@ -42,7 +42,7 @@ import * as SchemaParser from "./SchemaParser.ts";
42
42
  import type * as SchemaRepresentation from "./SchemaRepresentation.ts";
43
43
  import type { Assign, Lambda, Mutable, Simplify } from "./Struct.ts";
44
44
  import * as Struct_ from "./Struct.ts";
45
- import * as FastCheck from "./testing/FastCheck.ts";
45
+ import type * as FastCheck from "./testing/FastCheck.ts";
46
46
  import type { RequiredKeys, UnionToIntersection } from "./Types.ts";
47
47
  import type { Unify } from "./Unify.ts";
48
48
  declare const TypeId = "~effect/Schema/Schema";
@@ -149,7 +149,9 @@ export interface BottomWithoutNew<out T, out E, out RD, out RE, out Ast extends
149
149
  * **Gotchas**
150
150
  *
151
151
  * Throws an `Error` with the schema issue in its `cause` when validation
152
- * fails.
152
+ * fails. Schema validation failures use the generic message
153
+ * `"Schema validation failed"`; format the `cause` explicitly with
154
+ * `SchemaIssue.makeFormatterDefault()` when human-readable details are needed.
153
155
  * Causes that contain defects, interruptions, or other non-schema reasons
154
156
  * throw with the underlying `Cause` attached instead.
155
157
  *
@@ -190,10 +192,15 @@ export interface BottomWithoutNew<out T, out E, out RD, out RE, out Ast extends
190
192
  * Use when constructor input may fail validation and you want to
191
193
  * compose that failure with other `Effect` operations instead of throwing.
192
194
  *
195
+ * **Details**
196
+ *
197
+ * Validation failures are returned directly as `SchemaIssue.Issue` values
198
+ * and are not wrapped in `SchemaError`.
199
+ *
193
200
  * @see {@link BottomWithoutNew.make} — construct synchronously when validation failure should throw
194
201
  * @see {@link BottomWithoutNew.makeOption} — construct synchronously and discard validation details
195
202
  */
196
- makeEffect(input: this["~type.make.in"], options?: MakeOptions): Effect.Effect<this["Type"], SchemaError>;
203
+ makeEffect(input: this["~type.make.in"], options?: MakeOptions): Effect.Effect<this["Type"], SchemaIssue.Issue>;
197
204
  }
198
205
  /**
199
206
  * Fully-parameterized base interface for schemas that can be extended directly
@@ -299,7 +306,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<C
299
306
  * **Example** (Schema for a parametric `Box<A>` type)
300
307
  *
301
308
  * ```ts import.meta.vitest
302
- * import { Effect, Schema, SchemaIssue as Issue, SchemaParser } from "effect"
309
+ * import { Effect, Schema, SchemaIssue, SchemaParser } from "effect"
303
310
  *
304
311
  * interface Box<A> {
305
312
  * readonly value: A
@@ -314,7 +321,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<C
314
321
  * ([itemCodec]) =>
315
322
  * (u, ast, options) => {
316
323
  * if (!isBox(u)) {
317
- * return Effect.fail(new SchemaIssue.InvalidType(ast))
324
+ * return Effect.fail(new SchemaIssue.InvalidType(ast, u, options))
318
325
  * }
319
326
  * return Effect.map(
320
327
  * SchemaParser.decodeUnknownEffect(itemCodec)(u.value, options),
@@ -915,10 +922,12 @@ isSchemaError,
915
922
  *
916
923
  * The `issue` field contains a structured {@link SchemaIssue.Issue} tree describing
917
924
  * every validation failure, including the path to the problematic value and
918
- * the expected type or constraint. Built-in issues have no `actual` field,
919
- * and built-in messages do not include the rejected value. Other Issue fields
920
- * and custom annotations or messages are not sanitized. `message` renders the
921
- * issue tree as a human-readable string.
925
+ * the expected type or constraint. Parsing with `reportInput: true` adds an
926
+ * enumerable `input` field to value-bearing issues created by the parser.
927
+ * Built-in messages may include reported input. Other issue fields and
928
+ * custom annotations or messages are not sanitized.
929
+ * `message` renders the issue tree as a human-readable string and can disclose
930
+ * retained input.
922
931
  *
923
932
  * Use {@link isSchemaError} to narrow an unknown value to `SchemaError`.
924
933
  *
@@ -1071,6 +1080,9 @@ export declare const is: typeof SchemaParser.is;
1071
1080
  *
1072
1081
  * The input is narrowed if the assertion succeeds. If schema validation fails,
1073
1082
  * the assertion throws an `Error` whose cause is `SchemaIssue.Issue`.
1083
+ * Schema validation failures use the generic message `"Schema validation failed"`.
1084
+ * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when
1085
+ * human-readable details are needed.
1074
1086
  *
1075
1087
  * **Gotchas**
1076
1088
  *
@@ -4368,7 +4380,7 @@ export declare function decodeTo<To extends Constraint, From extends Constraint,
4368
4380
  * ```
4369
4381
  *
4370
4382
  * @category transforming
4371
- * @since 3.10.0
4383
+ * @since 4.0.0
4372
4384
  */
4373
4385
  export declare function decode<S extends Constraint, RD = never, RE = never>(transformation: {
4374
4386
  readonly decode: SchemaGetter.Getter<S["Type"], S["Type"], RD>;
@@ -4433,7 +4445,7 @@ export declare function encodeTo<To extends Constraint, From extends Constraint,
4433
4445
  * ```
4434
4446
  *
4435
4447
  * @category transforming
4436
- * @since 3.10.0
4448
+ * @since 4.0.0
4437
4449
  */
4438
4450
  export declare function encode<S extends Constraint, RD = never, RE = never>(transformation: {
4439
4451
  readonly decode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RD>;
@@ -4474,7 +4486,7 @@ export interface withConstructorDefault<S extends Constraint & WithoutConstructo
4474
4486
  * **Details**
4475
4487
  *
4476
4488
  * Constructor defaults are applied only during `make*`, not during decoding or
4477
- * encoding.
4489
+ * encoding. Failures are represented directly as `SchemaIssue.Issue` values.
4478
4490
  *
4479
4491
  * **Example** (Defining an optional field with a static default)
4480
4492
  *
@@ -4494,7 +4506,7 @@ export interface withConstructorDefault<S extends Constraint & WithoutConstructo
4494
4506
  * @category constructors
4495
4507
  * @since 3.10.0
4496
4508
  */
4497
- export declare function withConstructorDefault<S extends Constraint & WithoutConstructorDefault>(defaultValue: Effect.Effect<S["~type.make.in"], SchemaError>): (schema: S) => withConstructorDefault<S>;
4509
+ export declare function withConstructorDefault<S extends Constraint & WithoutConstructorDefault>(defaultValue: Effect.Effect<S["~type.make.in"], SchemaIssue.Issue>): (schema: S) => withConstructorDefault<S>;
4498
4510
  /**
4499
4511
  * Type-level representation returned by {@link withDecodingDefaultKey}.
4500
4512
  *
@@ -5092,12 +5104,13 @@ export declare const makeFilter: <T>(filter: (input: T, ast: SchemaAST.AST, opti
5092
5104
  *
5093
5105
  * - `string`: failure with that string as the message. Produces an
5094
5106
  * {@link SchemaIssue.InvalidValue} with the string used as the issue's
5095
- * `message` annotation.
5096
- * - {@link SchemaIssue.Issue}: a fully-formed issue, returned as-is.
5107
+ * `message` annotation and honors `reportInput`.
5108
+ * - {@link SchemaIssue.Issue}: a fully-formed issue, returned as-is. It is not
5109
+ * enriched when `reportInput` is enabled.
5097
5110
  * - `{ path, issue }`: failure attached to a nested path. `issue` is either
5098
- * a `string` (wrapped in an {@link SchemaIssue.InvalidValue}) or a full
5099
- * {@link SchemaIssue.Issue}; the result is wrapped in an {@link SchemaIssue.Pointer}
5100
- * at the given `path`.
5111
+ * a `string` (wrapped in an {@link SchemaIssue.InvalidValue} that honors
5112
+ * `reportInput`) or a full {@link SchemaIssue.Issue} (returned unchanged);
5113
+ * the result is wrapped in an {@link SchemaIssue.Pointer} at the given `path`.
5101
5114
  *
5102
5115
  * @category models
5103
5116
  * @since 3.10.0
@@ -5118,7 +5131,7 @@ export type FilterIssue = string | SchemaIssue.Issue | {
5118
5131
  * - `true`: success. Equivalent to `undefined`, useful when the predicate is
5119
5132
  * a plain boolean expression.
5120
5133
  * - `false`: generic failure. Produces an {@link SchemaIssue.InvalidValue}
5121
- * with no custom message.
5134
+ * with no custom message and honors `reportInput`.
5122
5135
  * - {@link FilterIssue}: a single failure. See {@link FilterIssue} for the
5123
5136
  * shapes (`string`, {@link SchemaIssue.Issue}, or `{ path, issue }`).
5124
5137
  * - `ReadonlyArray<FilterIssue>`: several failures reported together. An
@@ -9201,8 +9214,8 @@ type InheritStaticMembers<C, Static> = C & Pick<Static, Exclude<keyof Static, ke
9201
9214
  type MissingSelfGeneric<Usage extends string> = `Missing \`Self\` generic - use \`class Self extends ${Usage}<Self>(...)\``;
9202
9215
  /**
9203
9216
  * Creates a schema-backed class whose constructor validates input against a
9204
- * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
9205
- * input.
9217
+ * {@link Struct} schema. Construction throws an `Error` with a
9218
+ * `SchemaIssue.Issue` in its `cause` on invalid input.
9206
9219
  *
9207
9220
  * **When to use**
9208
9221
  *
@@ -9271,8 +9284,8 @@ type MissingSelfGeneric<Usage extends string> = `Missing \`Self\` generic - use
9271
9284
  export declare const Class: {
9272
9285
  /**
9273
9286
  * Creates a schema-backed class whose constructor validates input against a
9274
- * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
9275
- * input.
9287
+ * {@link Struct} schema. Construction throws an `Error` with a
9288
+ * `SchemaIssue.Issue` in its `cause` on invalid input.
9276
9289
  *
9277
9290
  * **When to use**
9278
9291
  *
@@ -9341,8 +9354,8 @@ export declare const Class: {
9341
9354
  <Self = never, Brand = {}>(identifier: string): {
9342
9355
  /**
9343
9356
  * Creates a schema-backed class whose constructor validates input against a
9344
- * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
9345
- * input.
9357
+ * {@link Struct} schema. Construction throws an `Error` with a
9358
+ * `SchemaIssue.Issue` in its `cause` on invalid input.
9346
9359
  *
9347
9360
  * **When to use**
9348
9361
  *
@@ -9411,8 +9424,8 @@ export declare const Class: {
9411
9424
  <const Fields extends Struct.Fields>(fields: Fields, annotations?: Annotations.Declaration<Self, readonly [Struct<Fields>]>): [Self] extends [never] ? MissingSelfGeneric<"Schema.Class"> : Class<Self, Struct<Fields>, Brand>;
9412
9425
  /**
9413
9426
  * Creates a schema-backed class whose constructor validates input against a
9414
- * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
9415
- * input.
9427
+ * {@link Struct} schema. Construction throws an `Error` with a
9428
+ * `SchemaIssue.Issue` in its `cause` on invalid input.
9416
9429
  *
9417
9430
  * **When to use**
9418
9431
  *
@@ -9844,39 +9857,31 @@ export declare const TaggedError: {
9844
9857
  };
9845
9858
  };
9846
9859
  /**
9847
- * A thunk that, given the `fast-check` module, returns an `Arbitrary<T>`.
9848
- * Use this type when you need to defer instantiation of the arbitrary, for
9849
- * example to support recursive schemas.
9860
+ * Represents a function that builds a fast-check `Arbitrary<T>` from the
9861
+ * `fast-check` module.
9862
+ *
9863
+ * **When to use**
9864
+ *
9865
+ * Use as the result type of schema arbitrary derivation.
9850
9866
  *
9851
9867
  * @category utility types
9852
9868
  * @since 4.0.0
9853
9869
  */
9854
- export type LazyArbitrary<T> = (fc: typeof FastCheck) => FastCheck.Arbitrary<T>;
9870
+ export type Arbitrary<T> = (fc: typeof FastCheck) => FastCheck.Arbitrary<T>;
9855
9871
  /**
9856
- * Derives a {@link LazyArbitrary} from a schema. The result is memoized so
9857
- * repeated calls with the same schema are cheap.
9872
+ * Returns an {@link Arbitrary} factory derived from a schema. The generated
9873
+ * values satisfy the schema and use its decoded `Type`.
9858
9874
  *
9859
- * **Details**
9860
- *
9861
- * Prefer {@link toArbitrary} when you need the arbitrary directly, or when you
9862
- * want derivation diagnostics via `{ report: true }`. Unsupported schema
9863
- * nodes, impossible constraints, invalid candidates, and recursive schemas
9864
- * without a finite terminal path fail immediately.
9875
+ * **When to use**
9865
9876
  *
9866
- * @category generators
9867
- * @since 4.0.0
9868
- */
9869
- export declare function toArbitraryLazy<S extends Constraint>(schema: S): LazyArbitrary<S["Type"]>;
9870
- /**
9871
- * Derives a `fast-check` `Arbitrary` from a schema for property-based
9872
- * testing. The derived arbitrary generates values that satisfy the schema.
9877
+ * Use when you need a fast-check generator for values accepted by a schema.
9873
9878
  *
9874
9879
  * **Details**
9875
9880
  *
9876
9881
  * Constraints refine base generators; candidates add weighted sources while
9877
- * filters still validate every value. `{ report: true }` returns warnings such
9878
- * as `OpaqueFilter`, while derivation errors remain fail-fast. Recursive
9879
- * schemas use terminal branches and fail when no finite terminal path exists.
9882
+ * filters still validate every value. Recursive schemas use terminal branches
9883
+ * and fail when no finite terminal path exists. The result is memoized so
9884
+ * repeated calls with the same schema are cheap.
9880
9885
  *
9881
9886
  * **Example** (Generating arbitrary values)
9882
9887
  *
@@ -9884,21 +9889,18 @@ export declare function toArbitraryLazy<S extends Constraint>(schema: S): LazyAr
9884
9889
  * import { Schema } from "effect"
9885
9890
  * import * as FastCheck from "fast-check"
9886
9891
  *
9887
- * const PersonArb = Schema.toArbitrary(
9892
+ * const makePersonArbitrary = Schema.toArbitrary(
9888
9893
  * Schema.Struct({ name: Schema.String, age: Schema.Number })
9889
9894
  * )
9890
9895
  *
9891
- * // Sample a random value
9892
- * FastCheck.sample(PersonArb, 1)
9896
+ * const PersonArbitrary = makePersonArbitrary(FastCheck)
9897
+ * FastCheck.sample(PersonArbitrary, 1)
9893
9898
  * ```
9894
9899
  *
9895
9900
  * @category generators
9896
9901
  * @since 4.0.0
9897
9902
  */
9898
- export declare function toArbitrary<S extends Constraint>(schema: S): FastCheck.Arbitrary<S["Type"]>;
9899
- export declare function toArbitrary<S extends Constraint>(schema: S, options: {
9900
- readonly report: true;
9901
- }): Annotations.ToArbitrary.WithReport<FastCheck.Arbitrary<S["Type"]>>;
9903
+ export declare function toArbitrary<S extends Constraint>(schema: S): Arbitrary<S["Type"]>;
9902
9904
  /**
9903
9905
  * Attaches a custom formatter used by `toFormatter`.
9904
9906
  *
@@ -10360,6 +10362,18 @@ export declare const isBetweenBigIntReviver: SchemaRepresentation.FilterReviver<
10360
10362
  * Derives an `Iso` optic from a schema that isomorphically converts between
10361
10363
  * the schema's `Type` and its `Iso` (intermediate / serialized form).
10362
10364
  *
10365
+ * **Details**
10366
+ *
10367
+ * Reading through the `Iso` encodes the schema value, while replacing through
10368
+ * it decodes the new focus.
10369
+ *
10370
+ * **Gotchas**
10371
+ *
10372
+ * Either direction can throw an `Error` with the generic message
10373
+ * `"Schema validation failed"` and a `SchemaIssue.Issue` in its `cause`. Format
10374
+ * the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when
10375
+ * human-readable details are needed.
10376
+ *
10363
10377
  * @category converting
10364
10378
  * @since 4.0.0
10365
10379
  */
@@ -10420,6 +10434,19 @@ export declare function overrideToCodecIso<S extends Constraint, Iso>(to: Constr
10420
10434
  * {@link toCodecJson}), computes RFC 6902 JSON Patch operations between old
10421
10435
  * and new values, and can apply patches back to the typed value.
10422
10436
  *
10437
+ * **Details**
10438
+ *
10439
+ * `diff` encodes both values before computing the patch. `patch` encodes the old
10440
+ * value, applies the patch to its JSON representation, and decodes the result.
10441
+ *
10442
+ * **Gotchas**
10443
+ *
10444
+ * Schema encoding or decoding failures throw an `Error` with the generic message
10445
+ * `"Schema validation failed"` and a `SchemaIssue.Issue` in its `cause`. Format
10446
+ * the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when
10447
+ * human-readable details are needed. Errors produced by {@link JsonPatch.apply}
10448
+ * for invalid patch operations are separate from schema validation failures.
10449
+ *
10423
10450
  * @category converting
10424
10451
  * @since 4.0.0
10425
10452
  */
@@ -10797,6 +10824,15 @@ export declare namespace Annotations {
10797
10824
  */
10798
10825
  interface Filter extends Augment {
10799
10826
  readonly representation?: SchemaRepresentation.CheckRepresentationAnnotation<SchemaAST.AST> | undefined;
10827
+ /**
10828
+ * Compiles this filter to a JSON Schema fragment.
10829
+ *
10830
+ * **Gotchas**
10831
+ *
10832
+ * Treat the input schemas as immutable. The returned value must be a valid JSON Schema object graph and must not be
10833
+ * mutated after this function returns. Return a new object graph to produce different output during a later
10834
+ * compilation.
10835
+ */
10800
10836
  readonly toJsonSchema?: SchemaRepresentation.ToJsonSchema.Check | undefined;
10801
10837
  readonly toCode?: SchemaRepresentation.Generation.Check | undefined;
10802
10838
  /**
@@ -10844,8 +10880,7 @@ export declare namespace Annotations {
10844
10880
  }
10845
10881
  /**
10846
10882
  * Types used by arbitrary-derivation annotations to configure `toArbitrary`
10847
- * hooks, filter hints, candidate sources, diagnostics, and merged generation
10848
- * constraints.
10883
+ * hooks, filter hints, candidate sources, and merged generation constraints.
10849
10884
  *
10850
10885
  * @since 4.0.0
10851
10886
  */
@@ -10858,8 +10893,7 @@ export declare namespace Annotations {
10858
10893
  * `constraint` refines the schema node's base generator. `candidate` adds a
10859
10894
  * weighted source before all filters run. If neither hint is provided, the
10860
10895
  * filter does not guide generation; generated values are still checked by
10861
- * the filter predicate. With `{ report: true }`, this is reported as
10862
- * `OpaqueFilter`.
10896
+ * the filter predicate.
10863
10897
  *
10864
10898
  * @category models
10865
10899
  * @since 4.0.0
@@ -11034,54 +11068,6 @@ export declare namespace Annotations {
11034
11068
  readonly [K in keyof TypeParameters]: TypeParameter<TypeParameters[K]["Type"]>;
11035
11069
  }): (fc: typeof FastCheck, context: Context) => Output<T>;
11036
11070
  }
11037
- /**
11038
- * Wraps a derived value together with arbitrary-derivation diagnostics.
11039
- *
11040
- * @category models
11041
- * @since 4.0.0
11042
- */
11043
- interface WithReport<A> {
11044
- readonly value: A;
11045
- readonly report: Report;
11046
- }
11047
- /**
11048
- * Diagnostics collected while deriving an arbitrary.
11049
- *
11050
- * **Details**
11051
- *
11052
- * Reports contain warnings only. Unsupported schema nodes, impossible
11053
- * constraints, invalid candidate weights, and throwing candidate factories
11054
- * fail immediately.
11055
- *
11056
- * @category models
11057
- * @since 4.0.0
11058
- */
11059
- interface Report {
11060
- readonly warnings: ReadonlyArray<Warning>;
11061
- }
11062
- /**
11063
- * Non-fatal arbitrary-derivation warning.
11064
- *
11065
- * @category models
11066
- * @since 4.0.0
11067
- */
11068
- type Warning = OpaqueFilterWarning;
11069
- /**
11070
- * Warning emitted when a filter is handled only by the final `.filter`.
11071
- *
11072
- * **Details**
11073
- *
11074
- * The filter is still enforced. The warning means it did not contribute
11075
- * a constraint or candidate, so generation may rely on fast-check discards.
11076
- *
11077
- * @category models
11078
- * @since 4.0.0
11079
- */
11080
- interface OpaqueFilterWarning {
11081
- readonly _tag: "OpaqueFilter";
11082
- readonly path: ReadonlyArray<PropertyKey>;
11083
- readonly description?: string | undefined;
11084
- }
11085
11071
  }
11086
11072
  /**
11087
11073
  * Types used by formatter annotations to customize formatter derivation for
@@ -11134,12 +11120,22 @@ export declare namespace Annotations {
11134
11120
  *
11135
11121
  * **Details**
11136
11122
  *
11137
- * The optional `message` field overrides the default issue message.
11123
+ * For `InvalidValue` issues, `message` overrides the complete formatted
11124
+ * message. When `message` is absent, `expected` uses the default expected
11125
+ * value policy, including reported input when available. Other issue types
11126
+ * ignore `expected`.
11138
11127
  *
11139
11128
  * @category models
11140
11129
  * @since 4.0.0
11141
11130
  */
11142
11131
  interface Issue extends Annotations {
11132
+ /**
11133
+ * The expected value description for an `InvalidValue` issue.
11134
+ */
11135
+ readonly expected?: string | undefined;
11136
+ /**
11137
+ * The complete formatted message for the issue.
11138
+ */
11143
11139
  readonly message?: string | undefined;
11144
11140
  }
11145
11141
  }