@distilled.cloud/core 1.0.0-rc.14 → 1.0.0-rc.16
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/lib/api.d.ts +118 -13
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +755 -147
- package/lib/api.js.map +1 -1
- package/lib/category.d.ts.map +1 -1
- package/lib/category.js +146 -146
- package/lib/category.js.map +1 -1
- package/lib/chunks.d.ts +3 -0
- package/lib/chunks.d.ts.map +1 -0
- package/lib/chunks.js +11 -0
- package/lib/chunks.js.map +1 -0
- package/lib/codegen/boolean-string-enums.js +36 -36
- package/lib/codegen/chunk.d.ts +7 -0
- package/lib/codegen/chunk.d.ts.map +1 -0
- package/lib/codegen/chunk.js +139 -0
- package/lib/codegen/chunk.js.map +1 -0
- package/lib/codegen/cli.d.ts.map +1 -1
- package/lib/codegen/cli.js +28 -14
- package/lib/codegen/cli.js.map +1 -1
- package/lib/codegen/datafy.d.ts +14 -0
- package/lib/codegen/datafy.d.ts.map +1 -0
- package/lib/codegen/datafy.js +853 -0
- package/lib/codegen/datafy.js.map +1 -0
- package/lib/codegen/dedupe.d.ts +5 -0
- package/lib/codegen/dedupe.d.ts.map +1 -0
- package/lib/codegen/dedupe.js +153 -0
- package/lib/codegen/dedupe.js.map +1 -0
- package/lib/codegen/emit.js +56 -56
- package/lib/codegen/format.js +18 -18
- package/lib/codegen/generated-at.js +29 -29
- package/lib/codegen/generator.d.ts.map +1 -1
- package/lib/codegen/generator.js +92 -84
- package/lib/codegen/generator.js.map +1 -1
- package/lib/codegen/graph.js +36 -36
- package/lib/codegen/graphql-client.d.ts +2 -0
- package/lib/codegen/graphql-client.d.ts.map +1 -1
- package/lib/codegen/graphql-client.js +55 -26
- package/lib/codegen/graphql-client.js.map +1 -1
- package/lib/codegen/graphql.js +113 -113
- package/lib/codegen/latin1.d.ts +3 -0
- package/lib/codegen/latin1.d.ts.map +1 -0
- package/lib/codegen/latin1.js +126 -0
- package/lib/codegen/latin1.js.map +1 -0
- package/lib/codegen/members.d.ts +7 -0
- package/lib/codegen/members.d.ts.map +1 -1
- package/lib/codegen/members.js +26 -19
- package/lib/codegen/members.js.map +1 -1
- package/lib/codegen/model-diff.js +6 -6
- package/lib/codegen/naming.js +19 -19
- package/lib/codegen/openapi-cli.js +15 -15
- package/lib/codegen/openapi.d.ts +17 -0
- package/lib/codegen/openapi.d.ts.map +1 -1
- package/lib/codegen/openapi.js +323 -169
- package/lib/codegen/openapi.js.map +1 -1
- package/lib/codegen/operations.js +14 -14
- package/lib/codegen/pagination.js +11 -11
- package/lib/codegen/patch-audit.js +57 -57
- package/lib/codegen/patches.js +79 -79
- package/lib/codegen/prelude.js +19 -19
- package/lib/codegen/privatize.d.ts +21 -0
- package/lib/codegen/privatize.d.ts.map +1 -0
- package/lib/codegen/privatize.js +176 -0
- package/lib/codegen/privatize.js.map +1 -0
- package/lib/codegen/proto.js +25 -25
- package/lib/codegen/pure.d.ts +6 -0
- package/lib/codegen/pure.d.ts.map +1 -0
- package/lib/codegen/pure.js +91 -0
- package/lib/codegen/pure.js.map +1 -0
- package/lib/codegen/rewrite-operation-ids.js +108 -108
- package/lib/codegen/spec-path.js +57 -57
- package/lib/codegen/table.d.ts +5 -0
- package/lib/codegen/table.d.ts.map +1 -0
- package/lib/codegen/table.js +249 -0
- package/lib/codegen/table.js.map +1 -0
- package/lib/config.d.ts +27 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +161 -0
- package/lib/config.js.map +1 -0
- package/lib/crypto.d.ts +76 -0
- package/lib/crypto.d.ts.map +1 -0
- package/lib/crypto.js +130 -0
- package/lib/crypto.js.map +1 -0
- package/lib/debug.d.ts +2 -0
- package/lib/debug.d.ts.map +1 -0
- package/lib/debug.js +8 -0
- package/lib/debug.js.map +1 -0
- package/lib/error-category.d.ts +1 -1
- package/lib/error-category.d.ts.map +1 -1
- package/lib/error-category.js +7 -6
- package/lib/error-category.js.map +1 -1
- package/lib/errors.d.ts +62 -62
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +117 -114
- package/lib/errors.js.map +1 -1
- package/lib/graphql.d.ts +31 -20
- package/lib/graphql.d.ts.map +1 -1
- package/lib/graphql.js +150 -119
- package/lib/graphql.js.map +1 -1
- package/lib/graphql.types.js +4 -3
- package/lib/graphql.types.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +15 -14
- package/lib/index.js.map +1 -1
- package/lib/json-patch.d.ts +2 -2
- package/lib/json-patch.js +28 -28
- package/lib/pagination.d.ts +9 -25
- package/lib/pagination.d.ts.map +1 -1
- package/lib/pagination.js +95 -90
- package/lib/pagination.js.map +1 -1
- package/lib/plain-values.d.ts +10 -0
- package/lib/plain-values.d.ts.map +1 -0
- package/lib/plain-values.js +40 -0
- package/lib/plain-values.js.map +1 -0
- package/lib/protocol-http.d.ts +50 -14
- package/lib/protocol-http.d.ts.map +1 -1
- package/lib/protocol-http.js +351 -178
- package/lib/protocol-http.js.map +1 -1
- package/lib/protocol-rest.d.ts +38 -25
- package/lib/protocol-rest.d.ts.map +1 -1
- package/lib/protocol-rest.js +238 -130
- package/lib/protocol-rest.js.map +1 -1
- package/lib/query.js +16 -16
- package/lib/response-validation-strict.d.ts +48 -0
- package/lib/response-validation-strict.d.ts.map +1 -0
- package/lib/response-validation-strict.js +284 -0
- package/lib/response-validation-strict.js.map +1 -0
- package/lib/response-validation.d.ts +43 -25
- package/lib/response-validation.d.ts.map +1 -1
- package/lib/response-validation.js +112 -70
- package/lib/response-validation.js.map +1 -1
- package/lib/retry-after.d.ts +3 -3
- package/lib/retry-after.js +49 -49
- package/lib/retry.d.ts +48 -29
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +142 -154
- package/lib/retry.js.map +1 -1
- package/lib/schema-lite-impl.d.ts +158 -0
- package/lib/schema-lite-impl.d.ts.map +1 -0
- package/lib/schema-lite-impl.js +341 -0
- package/lib/schema-lite-impl.js.map +1 -0
- package/lib/schema-lite-typed.d.ts +41 -0
- package/lib/schema-lite-typed.d.ts.map +1 -0
- package/lib/schema-lite-typed.js +27 -0
- package/lib/schema-lite-typed.js.map +1 -0
- package/lib/schema-lite.d.ts +40 -0
- package/lib/schema-lite.d.ts.map +1 -0
- package/lib/schema-lite.js +31 -0
- package/lib/schema-lite.js.map +1 -0
- package/lib/schema.d.ts +20 -6
- package/lib/schema.d.ts.map +1 -1
- package/lib/schema.js +202 -30
- package/lib/schema.js.map +1 -1
- package/lib/testing.d.ts +3 -2
- package/lib/testing.d.ts.map +1 -1
- package/lib/testing.js +22 -21
- package/lib/testing.js.map +1 -1
- package/lib/trait.d.ts +13 -13
- package/lib/trait.d.ts.map +1 -1
- package/lib/trait.js +80 -80
- package/lib/trait.js.map +1 -1
- package/lib/xml.d.ts +1 -1
- package/lib/xml.d.ts.map +1 -1
- package/lib/xml.js +38 -26
- package/lib/xml.js.map +1 -1
- package/package.json +9 -7
- package/src/api.ts +1079 -180
- package/src/category.ts +33 -33
- package/src/chunks.ts +30 -0
- package/src/codegen/chunk.ts +147 -0
- package/src/codegen/cli.ts +27 -1
- package/src/codegen/datafy.ts +874 -0
- package/src/codegen/dedupe.ts +173 -0
- package/src/codegen/generator.ts +10 -3
- package/src/codegen/graphql-client.ts +49 -15
- package/src/codegen/latin1.ts +131 -0
- package/src/codegen/members.ts +8 -0
- package/src/codegen/openapi.ts +194 -3
- package/src/codegen/privatize.ts +200 -0
- package/src/codegen/pure.ts +94 -0
- package/src/codegen/table.ts +254 -0
- package/src/config.ts +216 -0
- package/src/crypto.ts +202 -0
- package/src/debug.ts +8 -0
- package/src/error-category.ts +2 -1
- package/src/errors.ts +65 -56
- package/src/graphql.ts +109 -62
- package/src/graphql.types.ts +9 -7
- package/src/index.ts +3 -2
- package/src/json-patch.ts +2 -2
- package/src/pagination.ts +37 -18
- package/src/plain-values.ts +41 -0
- package/src/protocol-http.ts +378 -145
- package/src/protocol-rest.ts +337 -169
- package/src/response-validation-strict.ts +327 -0
- package/src/response-validation.ts +101 -50
- package/src/retry-after.ts +3 -3
- package/src/retry.ts +94 -93
- package/src/schema-lite-impl.ts +550 -0
- package/src/schema-lite-typed.ts +44 -0
- package/src/schema-lite.ts +44 -0
- package/src/schema.ts +258 -14
- package/src/testing.ts +4 -2
- package/src/trait.ts +36 -28
- package/src/xml.ts +31 -17
- package/lib/codegen/boolean-string-enums.test.d.ts +0 -2
- package/lib/codegen/boolean-string-enums.test.d.ts.map +0 -1
- package/lib/codegen/boolean-string-enums.test.js +0 -275
- package/lib/codegen/boolean-string-enums.test.js.map +0 -1
- package/lib/codegen/defer-naming.test.d.ts +0 -2
- package/lib/codegen/defer-naming.test.d.ts.map +0 -1
- package/lib/codegen/defer-naming.test.js +0 -105
- package/lib/codegen/defer-naming.test.js.map +0 -1
- package/lib/codegen/generated-at.test.d.ts +0 -2
- package/lib/codegen/generated-at.test.d.ts.map +0 -1
- package/lib/codegen/generated-at.test.js +0 -81
- package/lib/codegen/generated-at.test.js.map +0 -1
- package/lib/codegen/generator.test.d.ts +0 -2
- package/lib/codegen/generator.test.d.ts.map +0 -1
- package/lib/codegen/generator.test.js +0 -121
- package/lib/codegen/generator.test.js.map +0 -1
- package/lib/codegen/graphql-client.test.d.ts +0 -2
- package/lib/codegen/graphql-client.test.d.ts.map +0 -1
- package/lib/codegen/graphql-client.test.js +0 -171
- package/lib/codegen/graphql-client.test.js.map +0 -1
- package/lib/codegen/openapi-binary.test.d.ts +0 -2
- package/lib/codegen/openapi-binary.test.d.ts.map +0 -1
- package/lib/codegen/openapi-binary.test.js +0 -67
- package/lib/codegen/openapi-binary.test.js.map +0 -1
- package/lib/codegen/patch-audit.test.d.ts +0 -2
- package/lib/codegen/patch-audit.test.d.ts.map +0 -1
- package/lib/codegen/patch-audit.test.js +0 -141
- package/lib/codegen/patch-audit.test.js.map +0 -1
- package/lib/codegen/patches.test.d.ts +0 -2
- package/lib/codegen/patches.test.d.ts.map +0 -1
- package/lib/codegen/patches.test.js +0 -155
- package/lib/codegen/patches.test.js.map +0 -1
- package/lib/codegen/protocol-imports.test.d.ts +0 -2
- package/lib/codegen/protocol-imports.test.d.ts.map +0 -1
- package/lib/codegen/protocol-imports.test.js +0 -36
- package/lib/codegen/protocol-imports.test.js.map +0 -1
- package/lib/codegen/rewrite-operation-ids.test.d.ts +0 -2
- package/lib/codegen/rewrite-operation-ids.test.d.ts.map +0 -1
- package/lib/codegen/rewrite-operation-ids.test.js +0 -451
- package/lib/codegen/rewrite-operation-ids.test.js.map +0 -1
- package/lib/codegen/untagged-unions.test.d.ts +0 -2
- package/lib/codegen/untagged-unions.test.d.ts.map +0 -1
- package/lib/codegen/untagged-unions.test.js +0 -80
- package/lib/codegen/untagged-unions.test.js.map +0 -1
- package/lib/fixtures/xml/upstream-validator.json +0 -397
- package/lib/graphql.test.d.ts +0 -2
- package/lib/graphql.test.d.ts.map +0 -1
- package/lib/graphql.test.js +0 -151
- package/lib/graphql.test.js.map +0 -1
- package/lib/json-patch.test.d.ts +0 -2
- package/lib/json-patch.test.d.ts.map +0 -1
- package/lib/json-patch.test.js +0 -65
- package/lib/json-patch.test.js.map +0 -1
- package/lib/pagination.test.d.ts +0 -2
- package/lib/pagination.test.d.ts.map +0 -1
- package/lib/pagination.test.js +0 -131
- package/lib/pagination.test.js.map +0 -1
- package/lib/protocol-http.test.d.ts +0 -2
- package/lib/protocol-http.test.d.ts.map +0 -1
- package/lib/protocol-http.test.js +0 -228
- package/lib/protocol-http.test.js.map +0 -1
- package/lib/protocol-rest.test.d.ts +0 -2
- package/lib/protocol-rest.test.d.ts.map +0 -1
- package/lib/protocol-rest.test.js +0 -498
- package/lib/protocol-rest.test.js.map +0 -1
- package/lib/response-validation.test.d.ts +0 -2
- package/lib/response-validation.test.d.ts.map +0 -1
- package/lib/response-validation.test.js +0 -72
- package/lib/response-validation.test.js.map +0 -1
- package/lib/retry-after.test.d.ts +0 -2
- package/lib/retry-after.test.d.ts.map +0 -1
- package/lib/retry-after.test.js +0 -204
- package/lib/retry-after.test.js.map +0 -1
- package/lib/retry.test.d.ts +0 -2
- package/lib/retry.test.d.ts.map +0 -1
- package/lib/retry.test.js +0 -407
- package/lib/retry.test.js.map +0 -1
- package/lib/sdks.test.d.ts +0 -2
- package/lib/sdks.test.d.ts.map +0 -1
- package/lib/sdks.test.js +0 -76
- package/lib/sdks.test.js.map +0 -1
- package/lib/xml.test.d.ts +0 -2
- package/lib/xml.test.d.ts.map +0 -1
- package/lib/xml.test.js +0 -210
- package/lib/xml.test.js.map +0 -1
- package/src/codegen/boolean-string-enums.test.ts +0 -299
- package/src/codegen/defer-naming.test.ts +0 -113
- package/src/codegen/generated-at.test.ts +0 -89
- package/src/codegen/generator.test.ts +0 -137
- package/src/codegen/graphql-client.test.ts +0 -189
- package/src/codegen/openapi-binary.test.ts +0 -91
- package/src/codegen/patch-audit.test.ts +0 -160
- package/src/codegen/patches.test.ts +0 -188
- package/src/codegen/protocol-imports.test.ts +0 -39
- package/src/codegen/rewrite-operation-ids.test.ts +0 -472
- package/src/codegen/untagged-unions.test.ts +0 -85
- package/src/fixtures/xml/upstream-validator.json +0 -397
- package/src/graphql.test.ts +0 -198
- package/src/json-patch.test.ts +0 -77
- package/src/pagination.test.ts +0 -169
- package/src/protocol-http.test.ts +0 -276
- package/src/protocol-rest.test.ts +0 -703
- package/src/response-validation.test.ts +0 -89
- package/src/retry-after.test.ts +0 -267
- package/src/retry.test.ts +0 -566
- package/src/sdks.test.ts +0 -87
- package/src/xml.test.ts +0 -251
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as L from "./schema-lite-impl.js";
|
|
2
|
+
export const optional = L.optional;
|
|
3
|
+
export const Struct = L.Struct;
|
|
4
|
+
export const StructWithRest = L.StructWithRest;
|
|
5
|
+
export const suspend = L.suspend;
|
|
6
|
+
export const Array = L.Array;
|
|
7
|
+
export const Record = L.Record;
|
|
8
|
+
export const Union = L.Union;
|
|
9
|
+
export const Literal = L.Literal;
|
|
10
|
+
export const Literals = L.Literals;
|
|
11
|
+
export const NullOr = L.NullOr;
|
|
12
|
+
export const Tuple = L.Tuple;
|
|
13
|
+
export const encodeKeys = L.encodeKeys;
|
|
14
|
+
export const declare = L.declare;
|
|
15
|
+
export const instanceOf = L.instanceOf;
|
|
16
|
+
export const Redacted = L.Redacted;
|
|
17
|
+
export const String = L.String;
|
|
18
|
+
export const Number = L.Number;
|
|
19
|
+
export const Int = L.Number;
|
|
20
|
+
export const Boolean = L.Boolean;
|
|
21
|
+
export const Date = L.Date;
|
|
22
|
+
export const Duration = L.Duration;
|
|
23
|
+
export const Unknown = L.Unknown;
|
|
24
|
+
export const Null = L.Null;
|
|
25
|
+
export const Void = L.Void;
|
|
26
|
+
export const Any = L.Any;
|
|
27
|
+
export const TaggedError = L.TaggedError;
|
|
28
|
+
|
|
29
|
+
export const at = L.at;
|
|
30
|
+
export { liteKey, toEffect } from "./schema-lite-impl.js";
|
|
31
|
+
//# sourceMappingURL=schema-lite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-lite.js","sourceRoot":"","sources":["../src/schema-lite.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAK3C,MAAM,CAAC,MAAM,QAAQ,GAAU,CAAC,CAAC,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,MAAM,GAAU,CAAC,CAAC,MAAM,CAAC;AACtC,MAAM,CAAC,MAAM,cAAc,GAAU,CAAC,CAAC,cAAc,CAAC;AACtD,MAAM,CAAC,MAAM,OAAO,GAAU,CAAC,CAAC,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,KAAK,GAAU,CAAC,CAAC,KAAK,CAAC;AACpC,MAAM,CAAC,MAAM,MAAM,GAAU,CAAC,CAAC,MAAM,CAAC;AACtC,MAAM,CAAC,MAAM,KAAK,GAAU,CAAC,CAAC,KAAK,CAAC;AACpC,MAAM,CAAC,MAAM,OAAO,GAAU,CAAC,CAA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QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
|
package/lib/schema.d.ts
CHANGED
|
@@ -5,24 +5,28 @@
|
|
|
5
5
|
* provider package via `@distilled.cloud/core/schema`. Do not copy it into
|
|
6
6
|
* individual packages.
|
|
7
7
|
*
|
|
8
|
-
* Every real TYPE (`Schema`, `Codec`, `Top`,
|
|
8
|
+
* Every real TYPE (`Schema`, `Codec`, `Top`, ...) is re-exported untouched, so
|
|
9
9
|
* the `Schema.Schema<Foo>` annotations on generated consts (and the public
|
|
10
10
|
* `.d.ts`) stay precise. The schema *construction surface* (`Struct`,
|
|
11
|
-
* `optional`, `suspend`,
|
|
11
|
+
* `optional`, `suspend`, ...) and the leaf scalar schemas are retyped to `any`,
|
|
12
12
|
* so the compiler instantiates none of the heavy Schema generics while
|
|
13
|
-
* building a service file
|
|
13
|
+
* building a service file -- the explicit annotations carry the real types.
|
|
14
14
|
*
|
|
15
15
|
* Overriding a *value* export never affects the same-named *type* export (they
|
|
16
16
|
* live in separate namespaces and continue to flow through `export *`), so
|
|
17
17
|
* `Schema.Literal<"x">`-style type usages remain precise.
|
|
18
18
|
*
|
|
19
|
-
* Runtime behaviour is identical
|
|
20
|
-
* runtime value from `effect/Schema
|
|
19
|
+
* Runtime behaviour is identical. Every override aliases the exact same
|
|
20
|
+
* runtime value from `effect/Schema`, except `suspend`, `Array` and
|
|
21
|
+
* `Record`, which build the same schema lazily (see "Lazy schemas").
|
|
21
22
|
*/
|
|
22
|
-
export * from "effect/Schema";
|
|
23
|
+
export type * from "effect/Schema";
|
|
24
|
+
export { declare, Duration, instanceOf, Redacted } from "effect/Schema";
|
|
25
|
+
import * as S from "effect/Schema";
|
|
23
26
|
export type AnyFn = (...args: any[]) => any;
|
|
24
27
|
export declare const optional: AnyFn;
|
|
25
28
|
export declare const Struct: AnyFn;
|
|
29
|
+
export declare const StructWithRest: AnyFn;
|
|
26
30
|
export declare const suspend: AnyFn;
|
|
27
31
|
export declare const Array: AnyFn;
|
|
28
32
|
export declare const Record: AnyFn;
|
|
@@ -40,4 +44,14 @@ export declare const Unknown: any;
|
|
|
40
44
|
export declare const Null: any;
|
|
41
45
|
export declare const Void: any;
|
|
42
46
|
export declare const Any: any;
|
|
47
|
+
/**
|
|
48
|
+
* How a lazy schema builds itself: a closure, or a shared builder plus data
|
|
49
|
+
* stored on the schema object (no closure per schema; see packed.ts).
|
|
50
|
+
*/
|
|
51
|
+
export interface LazyBuilder {
|
|
52
|
+
readonly build: (data: unknown) => S.Top;
|
|
53
|
+
}
|
|
54
|
+
/** A schema built on first use by `builder.build(data)`. */
|
|
55
|
+
export declare const lazyFrom: (builder: LazyBuilder, data: unknown) => S.Top;
|
|
56
|
+
export declare const TaggedError: typeof S.TaggedError;
|
|
43
57
|
//# sourceMappingURL=schema.d.ts.map
|
package/lib/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,mBAAmB,eAAe,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGxE,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AAEnC,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAG5C,eAAO,MAAM,QAAQ,EAAE,KAA2B,CAAC;AACnD,eAAO,MAAM,MAAM,EAAE,KAAyB,CAAC;AAC/C,eAAO,MAAM,cAAc,EAAE,KAAiC,CAAC;AAC/D,eAAO,MAAM,OAAO,EAAE,KAA0C,CAAC;AACjE,eAAO,MAAM,KAAK,EAAE,KAAwC,CAAC;AAC7D,eAAO,MAAM,MAAM,EAAE,KAA4D,CAAC;AAClF,eAAO,MAAM,KAAK,EAAE,KAAwB,CAAC;AAC7C,eAAO,MAAM,OAAO,EAAE,KAA0B,CAAC;AACjD,eAAO,MAAM,QAAQ,EAAE,KAA2B,CAAC;AACnD,eAAO,MAAM,MAAM,EAAE,KAAyB,CAAC;AAC/C,eAAO,MAAM,KAAK,EAAE,KAAwB,CAAC;AAC7C,eAAO,MAAM,UAAU,EAAE,KAA6B,CAAC;AAGvD,eAAO,MAAM,MAAM,EAAE,GAAc,CAAC;AACpC,eAAO,MAAM,MAAM,EAAE,GAAc,CAAC;AACpC,eAAO,MAAM,OAAO,EAAE,GAAe,CAAC;AACtC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,OAAO,EAAE,GAAe,CAAC;AACtC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,GAAG,EAAE,GAAW,CAAC;AAmC9B;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,GAAG,CAAC;CAC1C;AAqED,4DAA4D;AAC5D,eAAO,MAAM,QAAQ,YAAa,WAAW,QAAQ,OAAO,KAAG,CAAC,CAAC,GACjC,CAAC;AA+HjC,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,CAAC,WAAqD,CAAC"}
|
package/lib/schema.js
CHANGED
|
@@ -1,39 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This is the single, shared definition consumed by every code-generated
|
|
5
|
-
* provider package via `@distilled.cloud/core/schema`. Do not copy it into
|
|
6
|
-
* individual packages.
|
|
7
|
-
*
|
|
8
|
-
* Every real TYPE (`Schema`, `Codec`, `Top`, …) is re-exported untouched, so
|
|
9
|
-
* the `Schema.Schema<Foo>` annotations on generated consts (and the public
|
|
10
|
-
* `.d.ts`) stay precise. The schema *construction surface* (`Struct`,
|
|
11
|
-
* `optional`, `suspend`, …) and the leaf scalar schemas are retyped to `any`,
|
|
12
|
-
* so the compiler instantiates none of the heavy Schema generics while
|
|
13
|
-
* building a service file — the explicit annotations carry the real types.
|
|
14
|
-
*
|
|
15
|
-
* Overriding a *value* export never affects the same-named *type* export (they
|
|
16
|
-
* live in separate namespaces and continue to flow through `export *`), so
|
|
17
|
-
* `Schema.Literal<"x">`-style type usages remain precise.
|
|
18
|
-
*
|
|
19
|
-
* Runtime behaviour is identical — every override aliases the exact same
|
|
20
|
-
* runtime value from `effect/Schema`.
|
|
21
|
-
*/
|
|
22
|
-
export * from "effect/Schema";
|
|
1
|
+
export { declare, Duration, instanceOf, Redacted } from "effect/Schema";
|
|
2
|
+
import { pipeArguments } from "effect/Pipeable";
|
|
23
3
|
import * as S from "effect/Schema";
|
|
24
|
-
// Construction surface
|
|
4
|
+
// Construction surface -- collapse to `any` so generics are never instantiated.
|
|
25
5
|
export const optional = S.optional;
|
|
26
6
|
export const Struct = S.Struct;
|
|
27
|
-
export const
|
|
28
|
-
export const
|
|
29
|
-
export const
|
|
7
|
+
export const StructWithRest = S.StructWithRest;
|
|
8
|
+
export const suspend = (f) => lazySuspend(f);
|
|
9
|
+
export const Array = (item) => lazyArray(item);
|
|
10
|
+
export const Record = (key, value) => lazyRecord(key, value);
|
|
30
11
|
export const Union = S.Union;
|
|
31
12
|
export const Literal = S.Literal;
|
|
32
13
|
export const Literals = S.Literals;
|
|
33
14
|
export const NullOr = S.NullOr;
|
|
34
15
|
export const Tuple = S.Tuple;
|
|
35
16
|
export const encodeKeys = S.encodeKeys;
|
|
36
|
-
// Leaf schemas
|
|
17
|
+
// Leaf schemas -- collapse to `any` so `.pipe(...)` on them is free.
|
|
37
18
|
export const String = S.String;
|
|
38
19
|
export const Number = S.Number;
|
|
39
20
|
export const Boolean = S.Boolean;
|
|
@@ -42,7 +23,198 @@ export const Unknown = S.Unknown;
|
|
|
42
23
|
export const Null = S.Null;
|
|
43
24
|
export const Void = S.Void;
|
|
44
25
|
export const Any = S.Any;
|
|
45
|
-
// NOTE: `Schema` / `Codec` (types)
|
|
46
|
-
//
|
|
47
|
-
//
|
|
26
|
+
// NOTE: `Schema` / `Codec` (types) are intentionally NOT overridden -- they
|
|
27
|
+
// flow through `export *` with real types so cast targets stay precise.
|
|
28
|
+
// `TaggedError` is overridden with the same type (see "Lazy error classes").
|
|
29
|
+
//#region Lazy schemas
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
const SchemaProto = /*@__PURE__*/ Object.getPrototypeOf(S.String);
|
|
52
|
+
const buildKey = /*@__PURE__*/ Symbol.for("@distilled.cloud/core/schema/build");
|
|
53
|
+
const annotationsKey = /*@__PURE__*/ Symbol.for("@distilled.cloud/core/schema/annotations");
|
|
54
|
+
const dataKey = /*@__PURE__*/ Symbol.for("@distilled.cloud/core/schema/data");
|
|
55
|
+
|
|
56
|
+
const force = (self) => {
|
|
57
|
+
const build = self[buildKey];
|
|
58
|
+
if (!build)
|
|
59
|
+
return;
|
|
60
|
+
const annotations = self[annotationsKey];
|
|
61
|
+
const built = typeof build === "function" ? build() : build.build(self[dataKey]);
|
|
62
|
+
const real = annotations ? built.annotate(annotations) : built;
|
|
63
|
+
delete self[buildKey];
|
|
64
|
+
delete self[dataKey];
|
|
65
|
+
delete self[annotationsKey];
|
|
66
|
+
Object.defineProperties(self, Object.getOwnPropertyDescriptors(real));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const forwarded = (name) => ({
|
|
70
|
+
configurable: true,
|
|
71
|
+
get() {
|
|
72
|
+
if (!this[buildKey])
|
|
73
|
+
return undefined;
|
|
74
|
+
force(this);
|
|
75
|
+
return this[name];
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
const LazyProto = /*@__PURE__*/ Object.create(SchemaProto, {
|
|
79
|
+
ast: /*@__PURE__*/ forwarded("ast"),
|
|
80
|
+
value: /*@__PURE__*/ forwarded("value"),
|
|
81
|
+
key: /*@__PURE__*/ forwarded("key"),
|
|
82
|
+
annotate: {
|
|
83
|
+
configurable: true,
|
|
84
|
+
writable: true,
|
|
85
|
+
value(annotations) {
|
|
86
|
+
const build = this[buildKey];
|
|
87
|
+
// Once built, annotate like any schema (a rebuilt copy).
|
|
88
|
+
if (!build)
|
|
89
|
+
return SchemaProto.annotate.call(this, annotations);
|
|
90
|
+
const previous = this[annotationsKey];
|
|
91
|
+
return lazy(build, previous ? { ...previous, ...annotations } : annotations, this[dataKey]);
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
// Effect detects schemas by this key on the prototype; if a future Effect
|
|
96
|
+
// moves it, build eagerly.
|
|
97
|
+
const supported = SchemaProto["~effect/Schema/Schema"] !== undefined;
|
|
98
|
+
const lazy = (build, annotations, data) => {
|
|
99
|
+
if (!supported) {
|
|
100
|
+
const built = typeof build === "function" ? build() : build.build(data);
|
|
101
|
+
return annotations ? built.annotate(annotations) : built;
|
|
102
|
+
}
|
|
103
|
+
const self = Object.create(LazyProto);
|
|
104
|
+
self[buildKey] = build;
|
|
105
|
+
if (data !== undefined)
|
|
106
|
+
self[dataKey] = data;
|
|
107
|
+
if (annotations)
|
|
108
|
+
self[annotationsKey] = annotations;
|
|
109
|
+
return self;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const lazyFrom = (builder, data) => lazy(builder, undefined, data);
|
|
113
|
+
const lazySuspend = (f) => lazy(() => S.suspend(f));
|
|
114
|
+
const lazyArray = (item) => lazy(() => S.Array(item));
|
|
115
|
+
const lazyRecord = (key, value) => lazy(() => S.Record(key, value));
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region Lazy error classes
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
const lazyErrorKey = /*@__PURE__*/ Symbol.for("@distilled.cloud/core/schema/lazyError");
|
|
137
|
+
const SchemaTypeId = "~effect/Schema/Schema";
|
|
138
|
+
// The base every Effect error class extends (`core.Error`, a yieldable
|
|
139
|
+
// Error). Found on first use, so bundles without error classes do not keep
|
|
140
|
+
// Effect's class machinery.
|
|
141
|
+
let errorBase;
|
|
142
|
+
const ErrorBase = () => (errorBase ??= Object.getPrototypeOf(S.TaggedError()("Probe", {})));
|
|
143
|
+
const realErrorClass = (cls) => {
|
|
144
|
+
const state = cls[lazyErrorKey];
|
|
145
|
+
if (!state.real) {
|
|
146
|
+
const real = S.TaggedError(state.identifier)(...state.args);
|
|
147
|
+
state.real = real;
|
|
148
|
+
Object.setPrototypeOf(state.lazy.prototype, real.prototype);
|
|
149
|
+
}
|
|
150
|
+
return state.real;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const FORWARDED_STATICS = [
|
|
154
|
+
"ast",
|
|
155
|
+
"fields",
|
|
156
|
+
"make",
|
|
157
|
+
"makeOption",
|
|
158
|
+
"makeEffect",
|
|
159
|
+
"annotate",
|
|
160
|
+
"annotateKey",
|
|
161
|
+
"check",
|
|
162
|
+
"rebuild",
|
|
163
|
+
"extend",
|
|
164
|
+
"mapFields",
|
|
165
|
+
];
|
|
166
|
+
let lazyErrorStatics;
|
|
167
|
+
const LazyErrorStatics = () => (lazyErrorStatics ??= Object.create(ErrorBase(), {
|
|
168
|
+
[SchemaTypeId]: { value: SchemaTypeId, configurable: true },
|
|
169
|
+
identifier: {
|
|
170
|
+
configurable: true,
|
|
171
|
+
get() {
|
|
172
|
+
const state = this[lazyErrorKey];
|
|
173
|
+
return state.identifier ?? state.args[0];
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
pipe: {
|
|
177
|
+
configurable: true,
|
|
178
|
+
writable: true,
|
|
179
|
+
value() {
|
|
180
|
+
return pipeArguments(this, arguments);
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
...Object.fromEntries(FORWARDED_STATICS.map((name) => [
|
|
184
|
+
name,
|
|
185
|
+
{
|
|
186
|
+
configurable: true,
|
|
187
|
+
get() {
|
|
188
|
+
let owner = realErrorClass(this);
|
|
189
|
+
let descriptor;
|
|
190
|
+
while (owner && !(descriptor = Object.getOwnPropertyDescriptor(owner, name))) {
|
|
191
|
+
owner = Object.getPrototypeOf(owner);
|
|
192
|
+
}
|
|
193
|
+
if (!descriptor)
|
|
194
|
+
return undefined;
|
|
195
|
+
if (descriptor.get)
|
|
196
|
+
return descriptor.get.call(this);
|
|
197
|
+
return typeof descriptor.value === "function"
|
|
198
|
+
? descriptor.value.bind(this)
|
|
199
|
+
: descriptor.value;
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
])),
|
|
203
|
+
}));
|
|
204
|
+
const lazyTaggedError = (identifier) => (...args) => {
|
|
205
|
+
function LazyTaggedError(input, options) {
|
|
206
|
+
if (!new.target)
|
|
207
|
+
throw new TypeError("Class constructor cannot be invoked without 'new'");
|
|
208
|
+
return Reflect.construct(realErrorClass(new.target), [input, options], new.target);
|
|
209
|
+
}
|
|
210
|
+
Object.setPrototypeOf(LazyTaggedError, LazyErrorStatics());
|
|
211
|
+
LazyTaggedError.prototype = Object.create(ErrorBase().prototype, {
|
|
212
|
+
constructor: { value: LazyTaggedError, writable: true, configurable: true },
|
|
213
|
+
});
|
|
214
|
+
const state = { identifier, args, lazy: LazyTaggedError };
|
|
215
|
+
Object.defineProperty(LazyTaggedError, lazyErrorKey, { value: state });
|
|
216
|
+
return LazyTaggedError;
|
|
217
|
+
};
|
|
218
|
+
export const TaggedError = lazyTaggedError;
|
|
219
|
+
//#endregion
|
|
48
220
|
//# sourceMappingURL=schema.js.map
|
package/lib/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AAInC,gFAAgF;AAChF,MAAM,CAAC,MAAM,QAAQ,GAAU,CAAC,CAAC,QAAiB,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAU,CAAC,CAAC,MAAe,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAU,CAAC,CAAC,cAAuB,CAAC;AAC/D,MAAM,CAAC,MAAM,OAAO,GAAU,CAAC,CAAc,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,KAAK,GAAU,CAAC,IAAW,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,MAAM,GAAU,CAAC,GAAU,EAAE,KAAY,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,KAAK,GAAU,CAAC,CAAC,KAAc,CAAC;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAU,CAAC,CAAC,OAAgB,CAAC;AACjD,MAAM,CAAC,MAAM,QAAQ,GAAU,CAAC,CAAC,QAAiB,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAU,CAAC,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E,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,WAAW,GAAyB,eAAuC,CAAC;AAEzF,YAAY"}
|
package/lib/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Test helpers for SDK packages: a canned-response `HttpClient` and a runner
|
|
3
|
-
* that executes one operation under
|
|
3
|
+
* that executes one operation under every response-validation mode.
|
|
4
4
|
*
|
|
5
5
|
* ```ts
|
|
6
6
|
* const { lenient, strict } = await runValidationModes(
|
|
@@ -30,10 +30,11 @@ export interface MockResponse {
|
|
|
30
30
|
export declare const mockHttpClient: (response: MockResponse | ((request: HttpClientRequest.HttpClientRequest) => MockResponse)) => Layer.Layer<HttpClient.HttpClient>;
|
|
31
31
|
/**
|
|
32
32
|
* Run `effect` against `mockHttpClient(response)` once in lenient mode and
|
|
33
|
-
* once in
|
|
33
|
+
* once in each validating mode (`additionalProperties`, `strict`).
|
|
34
34
|
*/
|
|
35
35
|
export declare const runValidationModes: <A, E>(effect: Effect.Effect<A, E, HttpClient.HttpClient>, response: Parameters<typeof mockHttpClient>[0]) => Promise<{
|
|
36
36
|
readonly lenient: Result.Result<A, E>;
|
|
37
|
+
readonly additionalProperties: Result.Result<A, E>;
|
|
37
38
|
readonly strict: Result.Result<A, E>;
|
|
38
39
|
}>;
|
|
39
40
|
//# sourceMappingURL=testing.d.ts.map
|
package/lib/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,KAAK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
|
+
|
|
14
14
|
import * as Effect from "effect/Effect";
|
|
15
15
|
import * as HttpClient from "effect/http/HttpClient";
|
|
16
16
|
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
17
17
|
import * as Layer from "effect/Layer";
|
|
18
18
|
import * as ResponseValidation from "./response-validation.js";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
23
|
export const mockHttpClient = (response) => Layer.succeed(HttpClient.HttpClient, HttpClient.make((request) => Effect.sync(() => {
|
|
24
24
|
const r = typeof response === "function" ? response(request) : response;
|
|
25
25
|
return HttpClientResponse.fromWeb(request, new Response(r.body, {
|
|
@@ -27,14 +27,15 @@ export const mockHttpClient = (response) => Layer.succeed(HttpClient.HttpClient,
|
|
|
27
27
|
headers: r.headers ?? { "content-type": "application/json" },
|
|
28
28
|
}));
|
|
29
29
|
})));
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
34
|
export const runValidationModes = (effect, response) => {
|
|
35
35
|
const run = (mode) => effect.pipe(Effect.provide(mockHttpClient(response)), Effect.provide(mode), Effect.result);
|
|
36
36
|
return Effect.runPromise(Effect.all({
|
|
37
37
|
lenient: run(ResponseValidation.lenient),
|
|
38
|
+
additionalProperties: run(ResponseValidation.additionalProperties),
|
|
38
39
|
strict: run(ResponseValidation.strict),
|
|
39
40
|
}));
|
|
40
41
|
};
|
package/lib/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAA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U,EACrB,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;IACf,MAAM,CAAC,GAAG,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxE,OAAO,kBAAkB,CAAC,OAAO,CAC/B,OAAO,EACP,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE;QACnB,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,GAAG;QACvB,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAC7D,CAAC,CACH,CAAC;AACJ,CAAC,CAAC,CACH,CACF,CAAC;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAkD,EAClD,QAA8C,EAK7C,EAAE;IACH,MAAM,GAAG,GAAG,CAAC,IAAwB,EAAE,EAAE,CACvC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7F,OAAO,MAAM,CAAC,UAAU,CACtB,MAAM,CAAC,GAAG,CAAC;QACT,OAAO,EAAE,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC;QACxC,oBAAoB,EAAE,GAAG,CAAC,kBAAkB,CAAC,oBAAoB,CAAC;QAClE,MAAM,EAAE,GAAG,CAAC,kBAAkB,CAAC,MAAM,CAAC;KACvC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/trait.d.ts
CHANGED
|
@@ -15,12 +15,12 @@ export interface Annotation {
|
|
|
15
15
|
* Build a pipeable schema annotation carrying `value` under `sym`. Exported
|
|
16
16
|
* so SDK packages can define their own protocol traits (e.g. cloudflare's
|
|
17
17
|
* envelope traits, aws's smithy traits) with the same mechanics as the
|
|
18
|
-
* generic ones here. Keys may be symbols or plain strings
|
|
18
|
+
* generic ones here. Keys may be symbols or plain strings -- effect Schema
|
|
19
19
|
* annotation dictionaries accept both.
|
|
20
20
|
*/
|
|
21
21
|
export declare function makeAnnotation<T>(sym: symbol | string, value: T): Annotation;
|
|
22
22
|
/**
|
|
23
|
-
* Combine several annotations into one
|
|
23
|
+
* Combine several annotations into one -- needed where only a single
|
|
24
24
|
* annotations object can be supplied (e.g. the second argument of
|
|
25
25
|
* `S.Class`).
|
|
26
26
|
*/
|
|
@@ -33,7 +33,7 @@ export interface HttpTrait {
|
|
|
33
33
|
readonly code?: number;
|
|
34
34
|
/**
|
|
35
35
|
* Request body encoding. Default is JSON; `"multipart"` sends
|
|
36
|
-
* multipart/form-data
|
|
36
|
+
* multipart/form-data -- body members become form parts (objects
|
|
37
37
|
* JSON-encoded) and members marked `FormDataFile()` append their files.
|
|
38
38
|
* `"form-urlencoded"` sends application/x-www-form-urlencoded with
|
|
39
39
|
* Stripe-style bracket notation for nested objects and arrays (see
|
|
@@ -50,7 +50,7 @@ export interface HttpTrait {
|
|
|
50
50
|
/**
|
|
51
51
|
* Explicit `Accept` for the operation, when the API serves more than one
|
|
52
52
|
* response media type. Atlas pins an API version this way (e.g.
|
|
53
|
-
* `application/vnd.atlas.2024-05-30+json`
|
|
53
|
+
* `application/vnd.atlas.2024-05-30+json` -- `application/json` alone is a
|
|
54
54
|
* 406). Protocols that don't read it fall back to their own default.
|
|
55
55
|
*/
|
|
56
56
|
readonly accept?: string;
|
|
@@ -82,7 +82,7 @@ export declare const deepQuerySymbol: unique symbol;
|
|
|
82
82
|
/**
|
|
83
83
|
* Binds a struct-valued input member to a family of DOTTED query parameters:
|
|
84
84
|
* `{ account: { id, name } }` with `DeepQuery("account")` serializes as
|
|
85
|
-
* `?account.id
|
|
85
|
+
* `?account.id=...&account.name=...` (null/undefined entries skipped). This is
|
|
86
86
|
* how several list endpoints model their filters on the wire (e.g.
|
|
87
87
|
* Cloudflare zones list `account.id` / `account.name`) while the TS surface
|
|
88
88
|
* keeps the nested-object shape (v0 parity).
|
|
@@ -91,14 +91,14 @@ export declare const DeepQuery: (name?: string) => Annotation;
|
|
|
91
91
|
export declare const httpBodySymbol: unique symbol;
|
|
92
92
|
/**
|
|
93
93
|
* Marks the input member whose value IS the entire request body (raw arrays/
|
|
94
|
-
* scalars
|
|
94
|
+
* scalars -- e.g. endpoints that POST a bare JSON array). Mirrors
|
|
95
95
|
* `smithy.api#httpPayload`.
|
|
96
96
|
*/
|
|
97
97
|
export declare const HttpBody: () => Annotation;
|
|
98
98
|
export declare const stringEncodedSymbol: unique symbol;
|
|
99
99
|
/**
|
|
100
|
-
* Marks a member the API only accepts as the STRING spelling of its value
|
|
101
|
-
* `true` travels as `"true"`, `3` as `"3"`
|
|
100
|
+
* Marks a member the API only accepts as the STRING spelling of its value --
|
|
101
|
+
* `true` travels as `"true"`, `3` as `"3"` -- while the TS surface keeps the
|
|
102
102
|
* natural type (e.g. Cloudflare's multipart `validation_enabled`, which the
|
|
103
103
|
* docs model as the enum `"true" | "false"`). The protocol stringifies body
|
|
104
104
|
* members on encode, element-wise for lists; `null` is left alone. Query and
|
|
@@ -115,7 +115,7 @@ export declare const formDataFileSymbol: unique symbol;
|
|
|
115
115
|
export declare const FormDataFile: () => Annotation;
|
|
116
116
|
export declare const keyDictionarySymbol: unique symbol;
|
|
117
117
|
/**
|
|
118
|
-
* Deep TS-name
|
|
118
|
+
* Deep TS-name->wire-name key dictionary for members whose full structure is
|
|
119
119
|
* not modeled (opaque `Document` content). The protocol renames any matching
|
|
120
120
|
* key at any depth on encode (and the reverse on decode); keys not in the
|
|
121
121
|
* dictionary pass through verbatim.
|
|
@@ -130,7 +130,7 @@ export type KeyDictionaryEntries = Record<string, string | ReadonlyArray<string>
|
|
|
130
130
|
export declare const KeyDictionary: (dict: KeyDictionaryEntries) => Annotation;
|
|
131
131
|
export declare const unionCasesSymbol: unique symbol;
|
|
132
132
|
/**
|
|
133
|
-
* The literal member every case of a union fixes to its own value
|
|
133
|
+
* The literal member every case of a union fixes to its own value -- what the
|
|
134
134
|
* docs call the resource `type` or the action `id`. `values[i]` is the value
|
|
135
135
|
* case `i` carries.
|
|
136
136
|
*/
|
|
@@ -145,8 +145,8 @@ export interface UnionDiscriminator {
|
|
|
145
145
|
* sets to pick the active case and drop the others, so consumers' `"key" in
|
|
146
146
|
* value` discrimination works.
|
|
147
147
|
*
|
|
148
|
-
* Key sets alone cannot tell apart cases that share them
|
|
149
|
-
* kinds of `resource_tagging`, the 34 page-rule actions
|
|
148
|
+
* Key sets alone cannot tell apart cases that share them -- the 41 resource
|
|
149
|
+
* kinds of `resource_tagging`, the 34 page-rule actions -- so when the union
|
|
150
150
|
* has a discriminator the protocol reads the case off it and only falls back
|
|
151
151
|
* to key-set scoring for a value whose tag is missing or unknown.
|
|
152
152
|
*/
|
|
@@ -186,7 +186,7 @@ export interface ErrorMatcher {
|
|
|
186
186
|
* Stamp wire-matching rules onto a generated error class. Protocols consult
|
|
187
187
|
* these to decide which of an operation's declared error classes a failed
|
|
188
188
|
* response should surface as (most specific matcher wins; ties break by
|
|
189
|
-
* declaration order
|
|
189
|
+
* declaration order -- see `matchTypedError` in `core/protocol-http`).
|
|
190
190
|
*/
|
|
191
191
|
export declare const applyErrorMatchers: <C>(cls: C, matchers: ReadonlyArray<ErrorMatcher>) => C;
|
|
192
192
|
/** Read the matchers stamped on an error class, if any. */
|
package/lib/trait.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trait.d.ts","sourceRoot":"","sources":["../src/trait.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"trait.d.ts","sourceRoot":"","sources":["../src/trait.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,eAEhC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAC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