viell-effect-schema-http 0.4.0 → 0.6.0
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/README.md +7 -5
- package/dist/http/Request.d.ts +37 -15
- package/dist/http/Request.d.ts.map +1 -1
- package/dist/http/Request.js +147 -103
- package/dist/http/Request.js.map +1 -1
- package/dist/http/internal/group.d.ts +10 -0
- package/dist/http/internal/group.d.ts.map +1 -0
- package/dist/http/internal/group.js +38 -0
- package/dist/http/internal/group.js.map +1 -0
- package/dist/http/internal/input.d.ts +16 -4
- package/dist/http/internal/input.d.ts.map +1 -1
- package/dist/http/internal/input.js +41 -41
- package/dist/http/internal/input.js.map +1 -1
- package/dist/http/internal/shape.d.ts +8 -2
- package/dist/http/internal/shape.d.ts.map +1 -1
- package/dist/http/internal/shape.js +48 -18
- package/dist/http/internal/shape.js.map +1 -1
- package/package.json +1 -1
- package/src/http/Request.ts +90 -34
- package/src/http/internal/group.ts +60 -0
- package/src/http/internal/input.ts +62 -78
- package/src/http/internal/shape.ts +76 -19
package/README.md
CHANGED
|
@@ -54,11 +54,11 @@ In an existing Node.js 24 or 26 ESM project with Effect `^4.0.7`, add the librar
|
|
|
54
54
|
npm install viell-effect-schema-http
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
`0.
|
|
58
|
-
tarball](https://github.com/viell-dev/slop-effect-schema-http/releases/tag/0.
|
|
57
|
+
`0.6.0` is the current release. The same package is available as a checksummed [GitHub release
|
|
58
|
+
tarball](https://github.com/viell-dev/slop-effect-schema-http/releases/tag/0.6.0). It changes
|
|
59
59
|
existing behavior, so read [What's in
|
|
60
|
-
0.
|
|
61
|
-
`0.
|
|
60
|
+
0.6](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.6) before you update from
|
|
61
|
+
`0.5`.
|
|
62
62
|
|
|
63
63
|
TypeScript declarations and editor documentation are included. The supported environments are Node
|
|
64
64
|
24 or 26 on Windows/Linux and browser Fetch in Chromium. See [compatibility and
|
|
@@ -77,8 +77,10 @@ versions and provider boundaries.
|
|
|
77
77
|
Operation, Policy, Interaction, UrlEncoding and Transport, from basic use to advanced behavior.
|
|
78
78
|
- [Limits and recovery](https://viell-dev.github.io/slop-effect-schema-http/limits): compatibility,
|
|
79
79
|
where the library's promise stops, failure stages and bug reporting.
|
|
80
|
-
- [What's in 0.
|
|
80
|
+
- [What's in 0.6](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.6) introduces
|
|
81
81
|
the release and how to update, and [What's in
|
|
82
|
+
0.5](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.5), [What's in
|
|
83
|
+
0.4](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.4), [What's in
|
|
82
84
|
0.3](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.3), [What's in
|
|
83
85
|
0.2](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.2) and [What's in
|
|
84
86
|
0.1](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.1) the earlier ones;
|
package/dist/http/Request.d.ts
CHANGED
|
@@ -162,7 +162,9 @@ export type Shape = Shapes.Shape;
|
|
|
162
162
|
* @remarks
|
|
163
163
|
* This is a low-level extension type. A field a union would lose is not lost if another schema in
|
|
164
164
|
* the group took it, and `settled` is never an answer to that: a schema can allow a name it did not
|
|
165
|
-
* take.
|
|
165
|
+
* take. Optional `certificates` records actual claims per applied binding, allowing a union to
|
|
166
|
+
* replace its claim without removing another binding's evidence. Custom drafts with only `fields`
|
|
167
|
+
* and `settled` keep the earlier behavior and skip union recovery.
|
|
166
168
|
*/
|
|
167
169
|
export type Taken = Shapes.Taken;
|
|
168
170
|
/** A part of a request that a binding can supply, and that {@link unbind} can clear. */
|
|
@@ -367,7 +369,7 @@ type Edit = <I, E, R>(self: Request<I, E, R>) => Request<I, E, R>;
|
|
|
367
369
|
* With a {@link headers} schema bound, in either order, the name has to be one a schema allows, and
|
|
368
370
|
* the value is a default that goes through the schema. Setting a name the schema always writes,
|
|
369
371
|
* after that schema, is an {@link InvalidRequest}, because the value could never reach the client.
|
|
370
|
-
* A direct struct's
|
|
372
|
+
* A direct struct's schema-supplied optional field is also refused when this preparation
|
|
371
373
|
* supplies and encodes it after the caller leaves it out, as {@link headers} describes.
|
|
372
374
|
*
|
|
373
375
|
* In the object form each key replaces its name as above, in key order, and other names stay. A key
|
|
@@ -394,7 +396,7 @@ export declare const appendHeader: (name: string, value: FieldValue) => Edit;
|
|
|
394
396
|
* Names compare without case. Value functions are never evaluated to compare with `value`. Removing
|
|
395
397
|
* a name a {@link headers} schema always writes, after that schema, is an {@link InvalidRequest},
|
|
396
398
|
* because the schema puts the value back. Removing an optional field clears its default.
|
|
397
|
-
* A
|
|
399
|
+
* A schema-supplied optional field can also put it back and be refused, as {@link headers}
|
|
398
400
|
* describes.
|
|
399
401
|
*
|
|
400
402
|
* Without a value, this also stops the library's automatic value for that name: an operation's
|
|
@@ -425,7 +427,7 @@ export declare const removeHeader: (name: string, value?: string) => Edit;
|
|
|
425
427
|
* With a {@link query} schema bound, in either order, the name has to be one a schema allows, and
|
|
426
428
|
* the value is a default that goes through the schema. Setting a name the schema always writes,
|
|
427
429
|
* after that schema, is an {@link InvalidRequest}, because the value could never reach the client.
|
|
428
|
-
* A direct struct's
|
|
430
|
+
* A direct struct's schema-supplied optional field is also refused when this preparation
|
|
429
431
|
* supplies and encodes it after the caller leaves it out, as {@link query} describes.
|
|
430
432
|
*
|
|
431
433
|
* The object form takes {@link QueryFields}. Each key replaces its name as above, in key order, and
|
|
@@ -451,7 +453,7 @@ export declare const appendQuery: (name: string, value: FieldValue<string | null
|
|
|
451
453
|
* functions are not evaluated for comparison. Removing a name a {@link query} schema always writes,
|
|
452
454
|
* after that schema, is an {@link InvalidRequest}, because the schema puts the value back. Removing
|
|
453
455
|
* an optional field clears its default.
|
|
454
|
-
* A
|
|
456
|
+
* A schema-supplied optional field can also put it back and be refused, as {@link query}
|
|
455
457
|
* describes.
|
|
456
458
|
*/
|
|
457
459
|
export declare const removeQuery: (name: string, value?: string | null) => Edit;
|
|
@@ -472,11 +474,14 @@ type GroupInput<K extends "query" | "headers", A> = Record<never, never> extends
|
|
|
472
474
|
* `undefined` still has to fit `Input`. Stacked schemas allow omission only when each one does;
|
|
473
475
|
* a raw default does not make a required group optional. The invocation object is still required.
|
|
474
476
|
*
|
|
475
|
-
* In a direct struct,
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
*
|
|
477
|
+
* In a direct struct, schema preparation can supply an omitted optional field. A raw edit after
|
|
478
|
+
* that binding is an {@link InvalidRequest} when successful preparation writes an own enumerable
|
|
479
|
+
* data property with a non-`undefined` value under that name in a non-iterable record. This reads
|
|
480
|
+
* the preparation's result without repeating schema work. A transformed group also qualifies when
|
|
481
|
+
* its decoded and encoded endpoints are closed structs and the ordinary or null-prototype caller
|
|
482
|
+
* object has no own keys of any kind and none of either endpoint's names exists on its prototype
|
|
483
|
+
* chain. Only an edited, declared encoded string name is checked. Nonempty transformed groups,
|
|
484
|
+
* classes, unions and iterable output remain outside this proof.
|
|
480
485
|
*
|
|
481
486
|
* The input is an {@link Input} of the schema. Encoding produces ordered header lines. The schema
|
|
482
487
|
* states the shape of the group, whatever the order of the calls: once any schema is bound, every
|
|
@@ -495,6 +500,13 @@ type GroupInput<K extends "query" | "headers", A> = Record<never, never> extends
|
|
|
495
500
|
* one of them takes stays with it, whatever a union beside it leaves out. Use {@link unbind} to
|
|
496
501
|
* start again.
|
|
497
502
|
*
|
|
503
|
+
* If a bare anyOf union would otherwise refuse uncovered root fields, it can retry the whole union
|
|
504
|
+
* with each member first, using the complete original input. Recovery needs actual other-binding
|
|
505
|
+
* claims for remaining losses and preserves every previously certified name. Parent metadata,
|
|
506
|
+
* transformed, open or iterable members, nested losses and joint backtracking are excluded. Existing
|
|
507
|
+
* successful reads do not retry. Recovery adds at most one whole-union read per other member; those
|
|
508
|
+
* attempts can repeat schema effects and can fail.
|
|
509
|
+
*
|
|
498
510
|
* A field the schema produces wins over an automatic `Accept`, `Content-Type` or `Content-Length`,
|
|
499
511
|
* whether the schema is bound before or after the body, and so does a default. An optional field
|
|
500
512
|
* left out with no default declares nothing, so the automatic value still applies.
|
|
@@ -524,11 +536,14 @@ export declare const headers: <S extends Schema.Top & Schema.ConstraintCodec<unk
|
|
|
524
536
|
* `undefined` still has to fit `Input`. Stacked schemas allow omission only when each one does;
|
|
525
537
|
* a raw default does not make a required group optional. The invocation object is still required.
|
|
526
538
|
*
|
|
527
|
-
* In a direct struct,
|
|
528
|
-
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
539
|
+
* In a direct struct, schema preparation can supply an omitted optional field. A raw edit after
|
|
540
|
+
* that binding is an {@link InvalidRequest} when successful preparation writes an own enumerable
|
|
541
|
+
* data property with a non-`undefined` value under that name in a non-iterable record. This reads
|
|
542
|
+
* the preparation's result without repeating schema work. A transformed group also qualifies when
|
|
543
|
+
* its decoded and encoded endpoints are closed structs and the ordinary or null-prototype caller
|
|
544
|
+
* object has no own keys of any kind and none of either endpoint's names exists on its prototype
|
|
545
|
+
* chain. Only an edited, declared encoded string name is checked. Nonempty transformed groups,
|
|
546
|
+
* classes, unions and iterable output remain outside this proof.
|
|
532
547
|
*
|
|
533
548
|
* The input is an {@link Input} of the schema. The schema encodes to `UrlEncoding.QueryInput` and
|
|
534
549
|
* states the shape of the group, whatever the order of the calls: once any schema is bound, every
|
|
@@ -552,6 +567,13 @@ export declare const headers: <S extends Schema.Top & Schema.ConstraintCodec<unk
|
|
|
552
567
|
* Query schemas stack: a second one adds its fields, and together they state the shape. A field one
|
|
553
568
|
* of them takes stays with it, whatever a union beside it leaves out. Use {@link unbind} to start
|
|
554
569
|
* again, and {@link mapInput} to supply a required field's value.
|
|
570
|
+
*
|
|
571
|
+
* If a bare anyOf union would otherwise refuse uncovered root fields, it can retry the whole union
|
|
572
|
+
* with each member first, using the complete original input. Recovery needs actual other-binding
|
|
573
|
+
* claims for remaining losses and preserves every previously certified name. Parent metadata,
|
|
574
|
+
* transformed, open or iterable members, nested losses and joint backtracking are excluded. Existing
|
|
575
|
+
* successful reads do not retry. Recovery adds at most one whole-union read per other member; those
|
|
576
|
+
* attempts can repeat schema effects and can fail.
|
|
555
577
|
*/
|
|
556
578
|
export declare const query: <S extends Schema.Top & Schema.ConstraintCodec<unknown, UrlEncoding.QueryInput, unknown, unknown>>(contract: S) => <I, E, R>(self: Request<I, E, R>) => Request<I & GroupInput<"query", Input<S>>, E | Schema.SchemaError | InvalidRequest, R | S["EncodingServices"] | S["DecodingServices"]>;
|
|
557
579
|
/** What a {@link PathValue}'s schema may encode to: one value with an obvious URL text. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/http/Request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAU,QAAQ,EAAY,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1E,OAAO,EAEL,iBAAiB,EAEjB,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;;;;AAEhD;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,oBAAmC;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;CAAG;AAEL;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErD;;;;;;G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CAAC,KACzC,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAQ1B,CAAC;AAEN;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAAC;IACtD,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,KAAK,CAAC;IACtC,0FAA0F;IAC1F,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C;AAoJD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,OAAO,GAAgC,CAAC,EAAE,CAAC,EAAE,CAAC,qFA4BzD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EACjC,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACtB,OAAO,CAAC,KACP,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC,CACT,CAAC"}
|
package/dist/http/Request.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Data, Effect, Option, Pipeable, Redacted, Schema } from "effect";
|
|
|
2
2
|
import { Headers, HttpClientRequest, UrlParams, } from "effect/http";
|
|
3
3
|
import * as Fields from "./internal/fields.js";
|
|
4
4
|
import * as Inputs from "./internal/input.js";
|
|
5
|
+
import * as Groups from "./internal/group.js";
|
|
5
6
|
import * as Shapes from "./internal/shape.js";
|
|
6
7
|
import * as Transport from "./Transport.js";
|
|
7
8
|
import * as UrlEncoding from "./UrlEncoding.js";
|
|
@@ -238,7 +239,7 @@ const editQuery = (names, edit) => (self) => construct({
|
|
|
238
239
|
* With a {@link headers} schema bound, in either order, the name has to be one a schema allows, and
|
|
239
240
|
* the value is a default that goes through the schema. Setting a name the schema always writes,
|
|
240
241
|
* after that schema, is an {@link InvalidRequest}, because the value could never reach the client.
|
|
241
|
-
* A direct struct's
|
|
242
|
+
* A direct struct's schema-supplied optional field is also refused when this preparation
|
|
242
243
|
* supplies and encodes it after the caller leaves it out, as {@link headers} describes.
|
|
243
244
|
*
|
|
244
245
|
* In the object form each key replaces its name as above, in key order, and other names stay. A key
|
|
@@ -267,7 +268,7 @@ export const appendHeader = (name, value) => editHeaders([name], (fields) => Fie
|
|
|
267
268
|
* Names compare without case. Value functions are never evaluated to compare with `value`. Removing
|
|
268
269
|
* a name a {@link headers} schema always writes, after that schema, is an {@link InvalidRequest},
|
|
269
270
|
* because the schema puts the value back. Removing an optional field clears its default.
|
|
270
|
-
* A
|
|
271
|
+
* A schema-supplied optional field can also put it back and be refused, as {@link headers}
|
|
271
272
|
* describes.
|
|
272
273
|
*
|
|
273
274
|
* Without a value, this also stops the library's automatic value for that name: an operation's
|
|
@@ -298,7 +299,7 @@ export const removeHeader = (name, value) => editHeaders([name], (fields) => Fie
|
|
|
298
299
|
* With a {@link query} schema bound, in either order, the name has to be one a schema allows, and
|
|
299
300
|
* the value is a default that goes through the schema. Setting a name the schema always writes,
|
|
300
301
|
* after that schema, is an {@link InvalidRequest}, because the value could never reach the client.
|
|
301
|
-
* A direct struct's
|
|
302
|
+
* A direct struct's schema-supplied optional field is also refused when this preparation
|
|
302
303
|
* supplies and encodes it after the caller leaves it out, as {@link query} describes.
|
|
303
304
|
*
|
|
304
305
|
* The object form takes {@link QueryFields}. Each key replaces its name as above, in key order, and
|
|
@@ -326,7 +327,7 @@ export const appendQuery = (name, value) => editQuery([name], (fields) => Fields
|
|
|
326
327
|
* functions are not evaluated for comparison. Removing a name a {@link query} schema always writes,
|
|
327
328
|
* after that schema, is an {@link InvalidRequest}, because the schema puts the value back. Removing
|
|
328
329
|
* an optional field clears its default.
|
|
329
|
-
* A
|
|
330
|
+
* A schema-supplied optional field can also put it back and be refused, as {@link query}
|
|
330
331
|
* describes.
|
|
331
332
|
*/
|
|
332
333
|
export const removeQuery = (name, value) => editQuery([name], (fields) => Fields.remove(fields, name, value));
|
|
@@ -373,9 +374,9 @@ const misfit = (group, defaults) => new InvalidRequest({
|
|
|
373
374
|
const lostFields = (group, names) => new InvalidRequest({
|
|
374
375
|
message: `The ${group} group cannot be built against its schema: with the rest of the group, these fields would be lost: ${listNames(names)}.`,
|
|
375
376
|
});
|
|
376
|
-
/** Names only: the caller's omitted fields
|
|
377
|
-
const
|
|
378
|
-
message: `
|
|
377
|
+
/** Names only: schema preparation supplied the caller's omitted fields and wrote them. */
|
|
378
|
+
const preparationConflict = (group, names) => new InvalidRequest({
|
|
379
|
+
message: `Schema preparation supplied and wrote these omitted ${group} fields, so a later raw edit would be lost: ${listNames(names)}. Supply the value as input, set it with Request.mapInput, or use Request.unbind("${group}") first.`,
|
|
379
380
|
});
|
|
380
381
|
/** Fields a body's encoder supplies unless the request says otherwise. */
|
|
381
382
|
const bodyFields = ["content-type", "content-length"];
|
|
@@ -403,11 +404,14 @@ const applyDeclaredBodyFields = (encoded, prepared) => {
|
|
|
403
404
|
* `undefined` still has to fit `Input`. Stacked schemas allow omission only when each one does;
|
|
404
405
|
* a raw default does not make a required group optional. The invocation object is still required.
|
|
405
406
|
*
|
|
406
|
-
* In a direct struct,
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
407
|
+
* In a direct struct, schema preparation can supply an omitted optional field. A raw edit after
|
|
408
|
+
* that binding is an {@link InvalidRequest} when successful preparation writes an own enumerable
|
|
409
|
+
* data property with a non-`undefined` value under that name in a non-iterable record. This reads
|
|
410
|
+
* the preparation's result without repeating schema work. A transformed group also qualifies when
|
|
411
|
+
* its decoded and encoded endpoints are closed structs and the ordinary or null-prototype caller
|
|
412
|
+
* object has no own keys of any kind and none of either endpoint's names exists on its prototype
|
|
413
|
+
* chain. Only an edited, declared encoded string name is checked. Nonempty transformed groups,
|
|
414
|
+
* classes, unions and iterable output remain outside this proof.
|
|
411
415
|
*
|
|
412
416
|
* The input is an {@link Input} of the schema. Encoding produces ordered header lines. The schema
|
|
413
417
|
* states the shape of the group, whatever the order of the calls: once any schema is bound, every
|
|
@@ -426,6 +430,13 @@ const applyDeclaredBodyFields = (encoded, prepared) => {
|
|
|
426
430
|
* one of them takes stays with it, whatever a union beside it leaves out. Use {@link unbind} to
|
|
427
431
|
* start again.
|
|
428
432
|
*
|
|
433
|
+
* If a bare anyOf union would otherwise refuse uncovered root fields, it can retry the whole union
|
|
434
|
+
* with each member first, using the complete original input. Recovery needs actual other-binding
|
|
435
|
+
* claims for remaining losses and preserves every previously certified name. Parent metadata,
|
|
436
|
+
* transformed, open or iterable members, nested losses and joint backtracking are excluded. Existing
|
|
437
|
+
* successful reads do not retry. Recovery adds at most one whole-union read per other member; those
|
|
438
|
+
* attempts can repeat schema effects and can fail.
|
|
439
|
+
*
|
|
429
440
|
* A field the schema produces wins over an automatic `Accept`, `Content-Type` or `Content-Length`,
|
|
430
441
|
* whether the schema is bound before or after the body, and so does a default. An optional field
|
|
431
442
|
* left out with no default declares nothing, so the automatic value still applies.
|
|
@@ -435,56 +446,67 @@ const applyDeclaredBodyFields = (encoded, prepared) => {
|
|
|
435
446
|
*/
|
|
436
447
|
export const headers = (contract) => {
|
|
437
448
|
const read = Inputs.reader(contract, Schema.encodeEffect(contract));
|
|
449
|
+
const recover = Groups.recovery(contract);
|
|
438
450
|
const { shape, settle, taken, candidates, filled } = Shapes.bind(contract, foldHeader);
|
|
439
|
-
return (self) =>
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
.
|
|
477
|
-
.
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
451
|
+
return (self) => {
|
|
452
|
+
const token = {};
|
|
453
|
+
return construct({
|
|
454
|
+
...self.declaration,
|
|
455
|
+
headerShapes: [...self.declaration.headerShapes, shape],
|
|
456
|
+
}, Effect.fnUntraced(function* (input, draft) {
|
|
457
|
+
if (draft.unbound.has("headers"))
|
|
458
|
+
return yield* self.prepare(input, draft);
|
|
459
|
+
const value = (input.headers === undefined ? {} : input.headers);
|
|
460
|
+
const edited = candidates(value, draft.editedFields.get(shape));
|
|
461
|
+
let { output, lost: lostFromInput } = yield* read(value);
|
|
462
|
+
let conflicts = filled(edited, output);
|
|
463
|
+
const own = draft.takenHeaders && taken(value, output, lostFromInput);
|
|
464
|
+
let prepared = yield* self.prepare(input, own === undefined
|
|
465
|
+
? draft
|
|
466
|
+
: {
|
|
467
|
+
...draft,
|
|
468
|
+
takenHeaders: Shapes.taking(draft.takenHeaders, own, token),
|
|
469
|
+
});
|
|
470
|
+
if (lostFromInput.length > 0) {
|
|
471
|
+
const recovered = yield* recover(value, { output, lost: lostFromInput }, prepared.takenHeaders, token, taken);
|
|
472
|
+
if (recovered !== undefined) {
|
|
473
|
+
({ output, lost: lostFromInput } = recovered.reading);
|
|
474
|
+
conflicts = filled(edited, output);
|
|
475
|
+
prepared = { ...prepared, takenHeaders: recovered.taken };
|
|
476
|
+
}
|
|
477
|
+
yield* Inputs.refuseLost(contract, lostFromInput, prepared.takenHeaders?.fields);
|
|
478
|
+
}
|
|
479
|
+
if (conflicts.length > 0)
|
|
480
|
+
return yield* preparationConflict("headers", conflicts);
|
|
481
|
+
const names = Shapes.written(output, foldHeader);
|
|
482
|
+
const elsewhere = Shapes.others(shape, prepared.takenHeaders, foldHeader);
|
|
483
|
+
const defaults = prepared.headerLines.filter(([name]) => !names.has(foldHeader(name)) &&
|
|
484
|
+
!elsewhere.has(foldHeader(name)) &&
|
|
485
|
+
Shapes.allows(shape, foldHeader(name)));
|
|
486
|
+
const settled = yield* Effect.mapError(settle(output, defaults), () => misfit("header", defaults));
|
|
487
|
+
// A field the schema does not write back would be lost, as a union member can lose one.
|
|
488
|
+
const lost = Shapes.lost(output, defaults, settled, foldHeader);
|
|
489
|
+
if (lost.length > 0)
|
|
490
|
+
return yield* lostFields("header", lost);
|
|
491
|
+
const lines = Transport.entries(settled);
|
|
492
|
+
const replaced = new Set([
|
|
493
|
+
...names,
|
|
494
|
+
...defaults.map(([name]) => foldHeader(name)),
|
|
495
|
+
]);
|
|
496
|
+
const cleared = HttpClientRequest.updateHeaders(prepared.request, (fields) => prepared.headerLines
|
|
497
|
+
.map(([name]) => foldHeader(name))
|
|
498
|
+
.filter((name) => replaced.has(name))
|
|
499
|
+
.reduce((result, name) => Headers.remove(result, name), fields));
|
|
500
|
+
return {
|
|
501
|
+
...prepared,
|
|
502
|
+
request: HttpClientRequest.setHeaders(cleared, Transport.toHeaders(lines)),
|
|
503
|
+
headerLines: [
|
|
504
|
+
...prepared.headerLines.filter(([name]) => !replaced.has(foldHeader(name))),
|
|
505
|
+
...lines,
|
|
506
|
+
],
|
|
507
|
+
};
|
|
508
|
+
}));
|
|
509
|
+
};
|
|
488
510
|
};
|
|
489
511
|
/**
|
|
490
512
|
* Bind a schema to the call's `{ query }` input.
|
|
@@ -507,11 +529,14 @@ export const headers = (contract) => {
|
|
|
507
529
|
* `undefined` still has to fit `Input`. Stacked schemas allow omission only when each one does;
|
|
508
530
|
* a raw default does not make a required group optional. The invocation object is still required.
|
|
509
531
|
*
|
|
510
|
-
* In a direct struct,
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
532
|
+
* In a direct struct, schema preparation can supply an omitted optional field. A raw edit after
|
|
533
|
+
* that binding is an {@link InvalidRequest} when successful preparation writes an own enumerable
|
|
534
|
+
* data property with a non-`undefined` value under that name in a non-iterable record. This reads
|
|
535
|
+
* the preparation's result without repeating schema work. A transformed group also qualifies when
|
|
536
|
+
* its decoded and encoded endpoints are closed structs and the ordinary or null-prototype caller
|
|
537
|
+
* object has no own keys of any kind and none of either endpoint's names exists on its prototype
|
|
538
|
+
* chain. Only an edited, declared encoded string name is checked. Nonempty transformed groups,
|
|
539
|
+
* classes, unions and iterable output remain outside this proof.
|
|
515
540
|
*
|
|
516
541
|
* The input is an {@link Input} of the schema. The schema encodes to `UrlEncoding.QueryInput` and
|
|
517
542
|
* states the shape of the group, whatever the order of the calls: once any schema is bound, every
|
|
@@ -535,47 +560,65 @@ export const headers = (contract) => {
|
|
|
535
560
|
* Query schemas stack: a second one adds its fields, and together they state the shape. A field one
|
|
536
561
|
* of them takes stays with it, whatever a union beside it leaves out. Use {@link unbind} to start
|
|
537
562
|
* again, and {@link mapInput} to supply a required field's value.
|
|
563
|
+
*
|
|
564
|
+
* If a bare anyOf union would otherwise refuse uncovered root fields, it can retry the whole union
|
|
565
|
+
* with each member first, using the complete original input. Recovery needs actual other-binding
|
|
566
|
+
* claims for remaining losses and preserves every previously certified name. Parent metadata,
|
|
567
|
+
* transformed, open or iterable members, nested losses and joint backtracking are excluded. Existing
|
|
568
|
+
* successful reads do not retry. Recovery adds at most one whole-union read per other member; those
|
|
569
|
+
* attempts can repeat schema effects and can fail.
|
|
538
570
|
*/
|
|
539
571
|
export const query = (contract) => {
|
|
540
572
|
const read = Inputs.reader(contract, Schema.encodeEffect(contract));
|
|
573
|
+
const recover = Groups.recovery(contract);
|
|
541
574
|
const { shape, settle, taken, candidates, filled } = Shapes.bind(contract, foldQuery);
|
|
542
|
-
return (self) =>
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
575
|
+
return (self) => {
|
|
576
|
+
const token = {};
|
|
577
|
+
return construct({
|
|
578
|
+
...self.declaration,
|
|
579
|
+
queryShapes: [...self.declaration.queryShapes, shape],
|
|
580
|
+
}, Effect.fnUntraced(function* (input, draft) {
|
|
581
|
+
if (draft.unbound.has("query"))
|
|
582
|
+
return yield* self.prepare(input, draft);
|
|
583
|
+
const value = (input.query === undefined ? {} : input.query);
|
|
584
|
+
const edited = candidates(value, draft.editedFields.get(shape));
|
|
585
|
+
let { output, lost: lostFromInput } = yield* read(value);
|
|
586
|
+
let conflicts = filled(edited, output);
|
|
587
|
+
const own = draft.takenQuery && taken(value, output, lostFromInput);
|
|
588
|
+
let prepared = yield* self.prepare(input, own === undefined
|
|
589
|
+
? draft
|
|
590
|
+
: {
|
|
591
|
+
...draft,
|
|
592
|
+
takenQuery: Shapes.taking(draft.takenQuery, own, token),
|
|
593
|
+
});
|
|
594
|
+
if (lostFromInput.length > 0) {
|
|
595
|
+
const recovered = yield* recover(value, { output, lost: lostFromInput }, prepared.takenQuery, token, taken);
|
|
596
|
+
if (recovered !== undefined) {
|
|
597
|
+
({ output, lost: lostFromInput } = recovered.reading);
|
|
598
|
+
conflicts = filled(edited, output);
|
|
599
|
+
prepared = { ...prepared, takenQuery: recovered.taken };
|
|
600
|
+
}
|
|
601
|
+
yield* Inputs.refuseLost(contract, lostFromInput, prepared.takenQuery?.fields);
|
|
602
|
+
}
|
|
603
|
+
if (conflicts.length > 0)
|
|
604
|
+
return yield* preparationConflict("query", conflicts);
|
|
605
|
+
const names = Shapes.written(output, foldQuery);
|
|
606
|
+
const elsewhere = Shapes.others(shape, prepared.takenQuery, foldQuery);
|
|
607
|
+
const defaults = prepared.request.urlParams.params
|
|
608
|
+
.filter((param) => prepared.declaredQuery.has(param) &&
|
|
609
|
+
!isEmptySegment(prepared, param) &&
|
|
610
|
+
!names.has(param[0]) &&
|
|
611
|
+
!elsewhere.has(param[0]) &&
|
|
612
|
+
Shapes.allows(shape, param[0]))
|
|
613
|
+
.map((param) => [param[0], queryValue(prepared, param)]);
|
|
614
|
+
const settled = yield* Effect.mapError(settle(output, defaults), () => misfit("query", defaults));
|
|
615
|
+
// A field the schema does not write back would be lost, as a union member can lose one.
|
|
616
|
+
const lost = Shapes.lost(output, defaults, settled, foldQuery);
|
|
617
|
+
if (lost.length > 0)
|
|
618
|
+
return yield* lostFields("query", lost);
|
|
619
|
+
return replaceQuery(prepared, UrlEncoding.queryEntries(settled), new Set([...names, ...defaults.map(([name]) => name)]));
|
|
620
|
+
}));
|
|
621
|
+
};
|
|
579
622
|
};
|
|
580
623
|
/** Put text after the path so far, exactly as written. */
|
|
581
624
|
const extendPath = (draft, text) => ({
|
|
@@ -819,6 +862,7 @@ export const mapEffect = (f) => (self) => construct(self.declaration, (input, dr
|
|
|
819
862
|
const takenRecord = (shapes) => shapes.length > 1 && shapes.some(({ chooses }) => chooses)
|
|
820
863
|
? {
|
|
821
864
|
fields: new Set(),
|
|
865
|
+
certificates: new Map(),
|
|
822
866
|
settled: new Set(shapes.flatMap(({ chooses, names }) => chooses ? [] : Array.from(names))),
|
|
823
867
|
}
|
|
824
868
|
: undefined;
|