effect 4.0.0-beta.83 → 4.0.0-beta.84
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.
- package/dist/Array.d.ts +64 -64
- package/dist/Array.js +26 -26
- package/dist/Cache.d.ts +1 -1
- package/dist/Cache.js +1 -1
- package/dist/Cause.d.ts +68 -68
- package/dist/Cause.js +47 -47
- package/dist/Channel.d.ts +5 -5
- package/dist/Channel.js +3 -3
- package/dist/Clock.d.ts +1 -1
- package/dist/Clock.js +1 -1
- package/dist/Combiner.d.ts +9 -9
- package/dist/Combiner.js +8 -8
- package/dist/Config.d.ts +15 -94
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +22 -70
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +58 -74
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +66 -41
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +1 -1
- package/dist/Console.js +1 -1
- package/dist/Data.d.ts +15 -15
- package/dist/Data.js +3 -3
- package/dist/DateTime.d.ts +6 -6
- package/dist/DateTime.js +2 -2
- package/dist/Duration.d.ts +3 -3
- package/dist/Duration.js +3 -3
- package/dist/Effect.d.ts +84 -45
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +72 -33
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +7 -7
- package/dist/Equal.js +5 -5
- package/dist/Equivalence.d.ts +17 -17
- package/dist/Equivalence.js +13 -13
- package/dist/Exit.d.ts +3 -3
- package/dist/Exit.js +3 -3
- package/dist/Formatter.d.ts +5 -5
- package/dist/Formatter.js +4 -4
- package/dist/Function.d.ts +10 -10
- package/dist/Function.js +3 -3
- package/dist/HashMap.d.ts +3 -3
- package/dist/HashMap.js +1 -1
- package/dist/Iterable.d.ts +6 -6
- package/dist/Iterable.js +2 -2
- package/dist/JsonPatch.d.ts +2 -2
- package/dist/Layer.d.ts +1 -1
- package/dist/Layer.js +1 -1
- package/dist/Logger.d.ts +1 -1
- package/dist/Logger.js +1 -1
- package/dist/Match.d.ts +8 -8
- package/dist/Match.js +8 -8
- package/dist/Metric.d.ts +3 -3
- package/dist/Metric.js +3 -3
- package/dist/Optic.d.ts +30 -30
- package/dist/Optic.js +12 -12
- package/dist/Option.d.ts +7 -7
- package/dist/Option.js +7 -7
- package/dist/Order.d.ts +23 -23
- package/dist/Order.js +20 -20
- package/dist/Pool.d.ts +1 -1
- package/dist/Pool.js +1 -1
- package/dist/Predicate.d.ts +88 -88
- package/dist/Predicate.js +47 -47
- package/dist/PubSub.d.ts +3 -3
- package/dist/PubSub.js +3 -3
- package/dist/Reducer.d.ts +1 -1
- package/dist/Reducer.js +1 -1
- package/dist/Result.d.ts +18 -18
- package/dist/Result.js +8 -8
- package/dist/Runtime.d.ts +1 -1
- package/dist/Runtime.js +1 -1
- package/dist/Schema.d.ts +265 -120
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +285 -116
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +13 -9
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +48 -48
- package/dist/SchemaGetter.js +44 -44
- package/dist/SchemaIssue.d.ts +3 -3
- package/dist/SchemaIssue.js +3 -3
- package/dist/SchemaParser.d.ts +122 -22
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +186 -50
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +1 -1
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +96 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +20 -20
- package/dist/SchemaTransformation.js +18 -18
- package/dist/Stream.d.ts +3 -3
- package/dist/Stream.js +2 -2
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +1 -1
- package/dist/String.js +1 -1
- package/dist/Struct.d.ts +1 -1
- package/dist/Struct.js +1 -1
- package/dist/Types.d.ts +13 -13
- package/dist/internal/effect.js +23 -10
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/schema/cause.d.ts +2 -0
- package/dist/internal/schema/cause.d.ts.map +1 -0
- package/dist/internal/schema/cause.js +24 -0
- package/dist/internal/schema/cause.js.map +1 -0
- package/dist/internal/schema/schema.d.ts +8 -4
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +21 -8
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +3 -3
- package/dist/testing/TestSchema.js +1 -1
- package/dist/unstable/ai/AiError.d.ts +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.js +1 -1
- package/dist/unstable/cli/Prompt.js +2 -2
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
- package/dist/unstable/rpc/Rpc.d.ts +1 -1
- package/dist/unstable/rpc/Rpc.js +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -4
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +15 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +1 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +1 -0
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +65 -65
- package/src/Cache.ts +1 -1
- package/src/Cause.ts +68 -68
- package/src/Channel.ts +5 -5
- package/src/Clock.ts +1 -1
- package/src/Combiner.ts +9 -9
- package/src/Config.ts +40 -108
- package/src/ConfigProvider.ts +139 -100
- package/src/Console.ts +1 -1
- package/src/Data.ts +15 -15
- package/src/DateTime.ts +6 -6
- package/src/Duration.ts +3 -3
- package/src/Effect.ts +89 -45
- package/src/Equal.ts +7 -7
- package/src/Equivalence.ts +17 -17
- package/src/Exit.ts +3 -3
- package/src/Formatter.ts +5 -5
- package/src/Function.ts +10 -10
- package/src/HashMap.ts +3 -3
- package/src/Iterable.ts +6 -6
- package/src/JsonPatch.ts +2 -2
- package/src/Layer.ts +1 -1
- package/src/Logger.ts +1 -1
- package/src/Match.ts +8 -8
- package/src/Metric.ts +3 -3
- package/src/Optic.ts +30 -30
- package/src/Option.ts +7 -7
- package/src/Order.ts +23 -23
- package/src/Pool.ts +1 -1
- package/src/Predicate.ts +88 -88
- package/src/PubSub.ts +3 -3
- package/src/Reducer.ts +1 -1
- package/src/Result.ts +20 -20
- package/src/Runtime.ts +1 -1
- package/src/Schema.ts +314 -131
- package/src/SchemaAST.ts +20 -11
- package/src/SchemaGetter.ts +48 -48
- package/src/SchemaIssue.ts +3 -3
- package/src/SchemaParser.ts +197 -58
- package/src/SchemaRepresentation.ts +73 -3
- package/src/SchemaTransformation.ts +20 -20
- package/src/Stream.ts +4 -4
- package/src/String.ts +1 -1
- package/src/Struct.ts +1 -1
- package/src/Types.ts +13 -13
- package/src/internal/effect.ts +29 -10
- package/src/internal/schema/cause.ts +26 -0
- package/src/internal/schema/schema.ts +36 -10
- package/src/testing/TestSchema.ts +3 -3
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/cli/Prompt.ts +1 -1
- package/src/unstable/httpapi/HttpApiScalar.ts +2 -2
- package/src/unstable/rpc/Rpc.ts +1 -1
- package/src/unstable/rpc/RpcGroup.ts +3 -4
- package/src/unstable/sql/SqlResolver.ts +15 -2
- package/src/unstable/workflow/Activity.ts +2 -0
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
package/dist/SchemaParser.d.ts
CHANGED
|
@@ -25,13 +25,19 @@ import * as SchemaIssue from "./SchemaIssue.ts";
|
|
|
25
25
|
export declare function makeEffect<S extends Schema.Top>(schema: S): (input: S["~type.make.in"], options?: Schema.MakeOptions) => Effect.Effect<S["Type"], SchemaIssue.Issue>;
|
|
26
26
|
/**
|
|
27
27
|
* Creates a synchronous maker that returns `Option.some` with the constructed
|
|
28
|
-
* value on success, or `Option.none` when construction fails.
|
|
28
|
+
* value on success, or `Option.none` when construction fails with schema issues.
|
|
29
29
|
*
|
|
30
30
|
* **When to use**
|
|
31
31
|
*
|
|
32
32
|
* Use when you need to validate schema constructor input and only care whether
|
|
33
33
|
* construction succeeds, without exposing `SchemaIssue.Issue` details.
|
|
34
34
|
*
|
|
35
|
+
* **Gotchas**
|
|
36
|
+
*
|
|
37
|
+
* Only causes made entirely of schema issues are converted to `Option.none`.
|
|
38
|
+
* Causes that contain defects, interruptions, or asynchronous work at this
|
|
39
|
+
* synchronous boundary throw an `Error` whose cause is the underlying `Cause`.
|
|
40
|
+
*
|
|
35
41
|
* @category constructors
|
|
36
42
|
* @since 4.0.0
|
|
37
43
|
*/
|
|
@@ -49,6 +55,12 @@ export declare function makeOption<S extends Schema.Top>(schema: S): (input: S["
|
|
|
49
55
|
* The returned function constructs a value from constructor input and throws an
|
|
50
56
|
* `Error` with the `SchemaIssue.Issue` in its `cause` when construction fails.
|
|
51
57
|
*
|
|
58
|
+
* **Gotchas**
|
|
59
|
+
*
|
|
60
|
+
* Causes that contain defects, interruptions, or asynchronous work at this
|
|
61
|
+
* synchronous boundary throw an `Error` whose cause is the underlying `Cause`,
|
|
62
|
+
* instead of being converted to a schema validation error.
|
|
63
|
+
*
|
|
52
64
|
* @category constructors
|
|
53
65
|
* @since 4.0.0
|
|
54
66
|
*/
|
|
@@ -64,8 +76,14 @@ export declare function make<S extends Schema.Top>(schema: S): (input: S["~type.
|
|
|
64
76
|
*
|
|
65
77
|
* **Details**
|
|
66
78
|
*
|
|
67
|
-
* The guard returns `true` on successful validation and `false`
|
|
68
|
-
* exposing issue details.
|
|
79
|
+
* The guard returns `true` on successful validation and `false` when validation
|
|
80
|
+
* fails only with schema issues, without exposing issue details.
|
|
81
|
+
*
|
|
82
|
+
* **Gotchas**
|
|
83
|
+
*
|
|
84
|
+
* Only causes made entirely of schema issues are converted to `false`. Causes
|
|
85
|
+
* that contain defects, interruptions, or asynchronous work at this synchronous
|
|
86
|
+
* boundary throw an `Error` whose cause is the underlying `Cause`.
|
|
69
87
|
*
|
|
70
88
|
* @category Asserting
|
|
71
89
|
* @since 3.10.0
|
|
@@ -76,13 +94,20 @@ export declare function is<T>(schema: Schema.Schema<T>): <I>(input: I) => input
|
|
|
76
94
|
*
|
|
77
95
|
* **When to use**
|
|
78
96
|
*
|
|
79
|
-
* Use to assert that an input satisfies the decoded side of a schema
|
|
80
|
-
* an `Error` whose cause is `SchemaIssue.Issue
|
|
97
|
+
* Use to assert that an input satisfies the decoded side of a schema when schema
|
|
98
|
+
* validation failures should throw an `Error` whose cause is `SchemaIssue.Issue`.
|
|
81
99
|
*
|
|
82
100
|
* **Details**
|
|
83
101
|
*
|
|
84
|
-
* The assertion returns normally when validation succeeds
|
|
85
|
-
*
|
|
102
|
+
* The assertion returns normally when validation succeeds. When the input does
|
|
103
|
+
* not satisfy the schema with a schema-only failure, it throws an `Error` with
|
|
104
|
+
* the `SchemaIssue.Issue` in its `cause`.
|
|
105
|
+
*
|
|
106
|
+
* **Gotchas**
|
|
107
|
+
*
|
|
108
|
+
* Causes that contain defects, interruptions, or asynchronous work at this
|
|
109
|
+
* synchronous boundary throw an `Error` whose cause is the underlying `Cause`,
|
|
110
|
+
* instead of being converted to a schema validation error.
|
|
86
111
|
*
|
|
87
112
|
* @category Asserting
|
|
88
113
|
* @since 4.0.0
|
|
@@ -139,12 +164,17 @@ export declare const decodeEffect: <S extends Schema.Top>(schema: S, options?: S
|
|
|
139
164
|
* **When to use**
|
|
140
165
|
*
|
|
141
166
|
* Use when you need to decode untyped input with a service-free schema and
|
|
142
|
-
* return a JavaScript `Promise
|
|
167
|
+
* return a JavaScript `Promise`.
|
|
143
168
|
*
|
|
144
169
|
* **Details**
|
|
145
170
|
*
|
|
146
171
|
* The returned function resolves with the decoded `Type` on success and rejects
|
|
147
|
-
* with a `SchemaIssue.Issue` on decoding failure.
|
|
172
|
+
* with an `Error` whose cause is a `SchemaIssue.Issue` on decoding failure.
|
|
173
|
+
*
|
|
174
|
+
* **Gotchas**
|
|
175
|
+
*
|
|
176
|
+
* Causes that contain defects, interruptions, or other non-schema reasons reject
|
|
177
|
+
* with an `Error` whose cause is the underlying `Cause`.
|
|
148
178
|
*
|
|
149
179
|
* @see {@link decodePromise} for input already typed as the schema's `Encoded` type
|
|
150
180
|
* @see {@link decodeUnknownEffect} for schemas that require decoding services or when failures should remain in `Effect`
|
|
@@ -160,12 +190,17 @@ export declare function decodeUnknownPromise<S extends Schema.Decoder<unknown>>(
|
|
|
160
190
|
* **When to use**
|
|
161
191
|
*
|
|
162
192
|
* Use when you already have input typed as the schema's `Encoded` type and need
|
|
163
|
-
* decoding to return a JavaScript `Promise
|
|
193
|
+
* decoding to return a JavaScript `Promise`.
|
|
164
194
|
*
|
|
165
195
|
* **Details**
|
|
166
196
|
*
|
|
167
197
|
* The returned function resolves with the decoded `Type` on success and rejects
|
|
168
|
-
* with a `SchemaIssue.Issue` on decoding failure.
|
|
198
|
+
* with an `Error` whose cause is a `SchemaIssue.Issue` on decoding failure.
|
|
199
|
+
*
|
|
200
|
+
* **Gotchas**
|
|
201
|
+
*
|
|
202
|
+
* Causes that contain defects, interruptions, or other non-schema reasons reject
|
|
203
|
+
* with an `Error` whose cause is the underlying `Cause`.
|
|
169
204
|
*
|
|
170
205
|
* @see {@link decodeUnknownPromise} for untyped input returning a JavaScript `Promise`
|
|
171
206
|
* @see {@link decodeEffect} for preserving decoding services and failures in `Effect`
|
|
@@ -192,7 +227,8 @@ export declare function decodePromise<S extends Schema.Decoder<unknown>>(schema:
|
|
|
192
227
|
* **Gotchas**
|
|
193
228
|
*
|
|
194
229
|
* Because this adapter runs synchronously, async decoding work can produce an
|
|
195
|
-
* `Exit.Failure` with a defect cause.
|
|
230
|
+
* `Exit.Failure` with a defect cause. When the cause contains both schema
|
|
231
|
+
* issues and non-schema reasons, all reasons remain in the returned `Cause`.
|
|
196
232
|
*
|
|
197
233
|
* @see {@link decodeExit} for input already typed as the schema's `Encoded` type
|
|
198
234
|
* @see {@link decodeUnknownEffect} for preserving decoding services and failures in `Effect`
|
|
@@ -217,6 +253,12 @@ export declare function decodeUnknownExit<S extends Schema.Decoder<unknown>>(sch
|
|
|
217
253
|
* The returned function produces `Exit.Success` with the decoded `Type` or
|
|
218
254
|
* `Exit.Failure` with a `SchemaIssue.Issue`.
|
|
219
255
|
*
|
|
256
|
+
* **Gotchas**
|
|
257
|
+
*
|
|
258
|
+
* Because this adapter runs synchronously, async decoding work can produce an
|
|
259
|
+
* `Exit.Failure` with a defect cause. When the cause contains both schema
|
|
260
|
+
* issues and non-schema reasons, all reasons remain in the returned `Cause`.
|
|
261
|
+
*
|
|
220
262
|
* @see {@link decodeUnknownExit} for untyped input with the same `Exit` result shape
|
|
221
263
|
* @see {@link decodeEffect} for preserving decoding services and failures in `Effect`
|
|
222
264
|
*
|
|
@@ -240,8 +282,9 @@ export declare const decodeExit: <S extends Schema.Decoder<unknown>>(schema: S,
|
|
|
240
282
|
*
|
|
241
283
|
* **Gotchas**
|
|
242
284
|
*
|
|
243
|
-
* This adapter runs synchronously.
|
|
244
|
-
*
|
|
285
|
+
* This adapter runs synchronously. Causes made entirely of schema issues become
|
|
286
|
+
* `Result.fail`, but causes that contain defects, interruptions, or asynchronous
|
|
287
|
+
* work at this synchronous boundary throw instead.
|
|
245
288
|
*
|
|
246
289
|
* @see {@link decodeResult} for input already typed as the schema's `Encoded` type
|
|
247
290
|
* @see {@link decodeUnknownEffect} for effectful or service-requiring decoding
|
|
@@ -266,8 +309,9 @@ export declare function decodeUnknownResult<S extends Schema.Decoder<unknown>>(s
|
|
|
266
309
|
*
|
|
267
310
|
* **Gotchas**
|
|
268
311
|
*
|
|
269
|
-
* This synchronous adapter returns `Result.fail` for
|
|
270
|
-
*
|
|
312
|
+
* This synchronous adapter returns `Result.fail` for causes made entirely of
|
|
313
|
+
* schema issues, but causes that contain defects, interruptions, or other
|
|
314
|
+
* non-schema reasons throw instead.
|
|
271
315
|
*
|
|
272
316
|
* @see {@link decodeUnknownResult} for untyped input with the same `Result` shape
|
|
273
317
|
* @see {@link decodeEffect} for effectful or service-requiring decoding
|
|
@@ -289,6 +333,12 @@ export declare const decodeResult: <S extends Schema.Decoder<unknown>>(schema: S
|
|
|
289
333
|
* The returned function returns the decoded `Type` on success and throws an
|
|
290
334
|
* `Error` with the `SchemaIssue.Issue` in its `cause` on decoding failure.
|
|
291
335
|
*
|
|
336
|
+
* **Gotchas**
|
|
337
|
+
*
|
|
338
|
+
* Causes that contain defects, interruptions, or asynchronous work at this
|
|
339
|
+
* synchronous boundary throw an `Error` whose cause is the underlying `Cause`,
|
|
340
|
+
* instead of being converted to a schema validation error.
|
|
341
|
+
*
|
|
292
342
|
* @see {@link decodeSync} for input already typed as the schema's `Encoded` type
|
|
293
343
|
* @see {@link decodeUnknownEffect} for preserving decoding failures in `Effect`
|
|
294
344
|
* @see {@link decodeUnknownResult} for returning schema issues as data
|
|
@@ -311,6 +361,12 @@ export declare function decodeUnknownSync<S extends Schema.Decoder<unknown>>(sch
|
|
|
311
361
|
* The returned function returns the decoded `Type` on success and throws an
|
|
312
362
|
* `Error` with the `SchemaIssue.Issue` in its `cause` on decoding failure.
|
|
313
363
|
*
|
|
364
|
+
* **Gotchas**
|
|
365
|
+
*
|
|
366
|
+
* Causes that contain defects, interruptions, or asynchronous work at this
|
|
367
|
+
* synchronous boundary throw an `Error` whose cause is the underlying `Cause`,
|
|
368
|
+
* instead of being converted to a schema validation error.
|
|
369
|
+
*
|
|
314
370
|
* @see {@link decodeUnknownSync} for untrusted or dynamically typed input
|
|
315
371
|
* @see {@link decodeResult} for returning schema issues as data
|
|
316
372
|
* @see {@link decodeEffect} for preserving decoding failures in `Effect`
|
|
@@ -369,13 +425,17 @@ export declare const encodeEffect: <S extends Schema.Top>(schema: S, options?: S
|
|
|
369
425
|
* **When to use**
|
|
370
426
|
*
|
|
371
427
|
* Use when you need to encode untrusted or dynamically typed values with a
|
|
372
|
-
* service-free schema and return a JavaScript `Promise
|
|
373
|
-
* `SchemaIssue.Issue`.
|
|
428
|
+
* service-free schema and return a JavaScript `Promise`.
|
|
374
429
|
*
|
|
375
430
|
* **Details**
|
|
376
431
|
*
|
|
377
432
|
* The returned function resolves with the schema's `Encoded` value on success and
|
|
378
|
-
* rejects with a `SchemaIssue.Issue` on encoding failure.
|
|
433
|
+
* rejects with an `Error` whose cause is a `SchemaIssue.Issue` on encoding failure.
|
|
434
|
+
*
|
|
435
|
+
* **Gotchas**
|
|
436
|
+
*
|
|
437
|
+
* Causes that contain defects, interruptions, or other non-schema reasons reject
|
|
438
|
+
* with an `Error` whose cause is the underlying `Cause`.
|
|
379
439
|
*
|
|
380
440
|
* @see {@link encodePromise} for input already typed as the schema's decoded `Type`
|
|
381
441
|
* @see {@link encodeUnknownEffect} for schemas that require encoding services or when failures should remain in `Effect`
|
|
@@ -391,13 +451,17 @@ export declare const encodeUnknownPromise: <S extends Schema.Encoder<unknown>>(s
|
|
|
391
451
|
* **When to use**
|
|
392
452
|
*
|
|
393
453
|
* Use when you already have values typed as the schema's decoded `Type` and
|
|
394
|
-
* need encoding to return a JavaScript `Promise
|
|
395
|
-
* `SchemaIssue.Issue`.
|
|
454
|
+
* need encoding to return a JavaScript `Promise`.
|
|
396
455
|
*
|
|
397
456
|
* **Details**
|
|
398
457
|
*
|
|
399
458
|
* The returned function resolves with the schema's `Encoded` value on success and
|
|
400
|
-
* rejects with a `SchemaIssue.Issue` on encoding failure.
|
|
459
|
+
* rejects with an `Error` whose cause is a `SchemaIssue.Issue` on encoding failure.
|
|
460
|
+
*
|
|
461
|
+
* **Gotchas**
|
|
462
|
+
*
|
|
463
|
+
* Causes that contain defects, interruptions, or other non-schema reasons reject
|
|
464
|
+
* with an `Error` whose cause is the underlying `Cause`.
|
|
401
465
|
*
|
|
402
466
|
* @see {@link encodeUnknownPromise} for encoding untyped input
|
|
403
467
|
* @see {@link encodeEffect} for effectful encoding or schemas with encoding service requirements
|
|
@@ -420,6 +484,12 @@ export declare const encodePromise: <S extends Schema.Encoder<unknown>>(schema:
|
|
|
420
484
|
* The returned function produces `Exit.Success` with the schema's `Encoded` value
|
|
421
485
|
* or `Exit.Failure` with a `SchemaIssue.Issue`.
|
|
422
486
|
*
|
|
487
|
+
* **Gotchas**
|
|
488
|
+
*
|
|
489
|
+
* Because this adapter runs synchronously, async encoding work can produce an
|
|
490
|
+
* `Exit.Failure` with a defect cause. When the cause contains both schema
|
|
491
|
+
* issues and non-schema reasons, all reasons remain in the returned `Cause`.
|
|
492
|
+
*
|
|
423
493
|
* @see {@link encodeExit} for input already typed as the schema's decoded `Type`
|
|
424
494
|
* @see {@link encodeUnknownEffect} for effectful encoding that preserves service requirements
|
|
425
495
|
*
|
|
@@ -441,6 +511,12 @@ export declare function encodeUnknownExit<S extends Schema.Encoder<unknown>>(sch
|
|
|
441
511
|
* The returned function produces `Exit.Success` with the schema's `Encoded` value
|
|
442
512
|
* or `Exit.Failure` with a `SchemaIssue.Issue`.
|
|
443
513
|
*
|
|
514
|
+
* **Gotchas**
|
|
515
|
+
*
|
|
516
|
+
* Because this adapter runs synchronously, async encoding work can produce an
|
|
517
|
+
* `Exit.Failure` with a defect cause. When the cause contains both schema
|
|
518
|
+
* issues and non-schema reasons, all reasons remain in the returned `Cause`.
|
|
519
|
+
*
|
|
444
520
|
* @see {@link encodeUnknownExit} for unknown input with the same `Exit` result shape
|
|
445
521
|
* @see {@link encodeEffect} for effectful encoding that preserves service requirements
|
|
446
522
|
*
|
|
@@ -464,6 +540,12 @@ export declare const encodeExit: <S extends Schema.Encoder<unknown>>(schema: S,
|
|
|
464
540
|
* value on success or `Result.fail` with a `SchemaIssue.Issue` on encoding
|
|
465
541
|
* failure.
|
|
466
542
|
*
|
|
543
|
+
* **Gotchas**
|
|
544
|
+
*
|
|
545
|
+
* This adapter runs synchronously. Causes made entirely of schema issues become
|
|
546
|
+
* `Result.fail`, but causes that contain defects, interruptions, or asynchronous
|
|
547
|
+
* work at this synchronous boundary throw instead.
|
|
548
|
+
*
|
|
467
549
|
* @see {@link encodeResult} for input already typed as the schema's decoded `Type`
|
|
468
550
|
* @see {@link encodeUnknownEffect} for effectful encoding, including schemas with encoding service requirements
|
|
469
551
|
*
|
|
@@ -486,6 +568,12 @@ export declare function encodeUnknownResult<S extends Schema.Encoder<unknown>>(s
|
|
|
486
568
|
* value on success or `Result.fail` with a `SchemaIssue.Issue` on encoding
|
|
487
569
|
* failure.
|
|
488
570
|
*
|
|
571
|
+
* **Gotchas**
|
|
572
|
+
*
|
|
573
|
+
* This synchronous adapter returns `Result.fail` for causes made entirely of
|
|
574
|
+
* schema issues, but causes that contain defects, interruptions, or other
|
|
575
|
+
* non-schema reasons throw instead.
|
|
576
|
+
*
|
|
489
577
|
* @see {@link encodeUnknownResult} for the same `Result` shape when the input is not already typed
|
|
490
578
|
*
|
|
491
579
|
* @category encoding
|
|
@@ -505,6 +593,12 @@ export declare const encodeResult: <S extends Schema.Encoder<unknown>>(schema: S
|
|
|
505
593
|
* The returned function returns the schema's `Encoded` value on success and throws
|
|
506
594
|
* an `Error` with the `SchemaIssue.Issue` in its `cause` on encoding failure.
|
|
507
595
|
*
|
|
596
|
+
* **Gotchas**
|
|
597
|
+
*
|
|
598
|
+
* Causes that contain defects, interruptions, or asynchronous work at this
|
|
599
|
+
* synchronous boundary throw an `Error` whose cause is the underlying `Cause`,
|
|
600
|
+
* instead of being converted to a schema validation error.
|
|
601
|
+
*
|
|
508
602
|
* @see {@link encodeSync} for input already typed as the schema's decoded `Type`
|
|
509
603
|
* @see {@link encodeUnknownEffect} for effectful encoding that preserves service requirements
|
|
510
604
|
*
|
|
@@ -526,6 +620,12 @@ export declare function encodeUnknownSync<S extends Schema.Encoder<unknown>>(sch
|
|
|
526
620
|
* The returned function returns the schema's `Encoded` value on success and throws
|
|
527
621
|
* an `Error` with the `SchemaIssue.Issue` in its `cause` on encoding failure.
|
|
528
622
|
*
|
|
623
|
+
* **Gotchas**
|
|
624
|
+
*
|
|
625
|
+
* Causes that contain defects, interruptions, or asynchronous work at this
|
|
626
|
+
* synchronous boundary throw an `Error` whose cause is the underlying `Cause`,
|
|
627
|
+
* instead of being converted to a schema validation error.
|
|
628
|
+
*
|
|
529
629
|
* @see {@link encodeUnknownSync} for unknown input with the same throwing boundary
|
|
530
630
|
* @see {@link encodeResult} for returning schema issues as data
|
|
531
631
|
* @see {@link encodeEffect} for effectful encoding that preserves service requirements
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaParser.d.ts","sourceRoot":"","sources":["../src/SchemaParser.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"SchemaParser.d.ts","sourceRoot":"","sources":["../src/SchemaParser.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAGjC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AA6B/C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAA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