@distilled.cloud/core 1.0.0-rc.15 → 1.0.0-rc.17
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/_bundle/aws.js +2 -0
- package/lib/_bundle/aws.js.map +1 -0
- package/lib/_bundle/base.js +5 -0
- package/lib/_bundle/base.js.map +1 -0
- package/lib/_bundle/graphql.js +3 -0
- package/lib/_bundle/graphql.js.map +1 -0
- package/lib/_bundle/rest.js +2 -0
- package/lib/_bundle/rest.js.map +1 -0
- package/lib/_bundle/xml.js +4 -0
- package/lib/_bundle/xml.js.map +1 -0
- package/lib/api.d.ts +118 -13
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +1 -188
- package/lib/category.d.ts.map +1 -1
- package/lib/category.js +1 -278
- package/lib/chunks.d.ts +3 -0
- package/lib/chunks.d.ts.map +1 -0
- package/lib/chunks.js +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 +1 -0
- package/lib/crypto.d.ts +76 -0
- package/lib/crypto.d.ts.map +1 -0
- package/lib/crypto.js +1 -0
- package/lib/debug.d.ts +2 -0
- package/lib/debug.d.ts.map +1 -0
- package/lib/debug.js +1 -0
- package/lib/error-category.d.ts +1 -1
- package/lib/error-category.d.ts.map +1 -1
- package/lib/error-category.js +1 -46
- package/lib/errors.d.ts +62 -62
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -195
- package/lib/graphql.d.ts +31 -20
- package/lib/graphql.d.ts.map +1 -1
- package/lib/graphql.js +1 -1027
- package/lib/graphql.types.js +1 -5
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -15
- package/lib/json-patch.d.ts +2 -2
- package/lib/json-patch.js +1 -226
- package/lib/json-patch.js.map +1 -1
- package/lib/pagination.d.ts +9 -25
- package/lib/pagination.d.ts.map +1 -1
- package/lib/pagination.js +1 -266
- package/lib/plain-values.d.ts +10 -0
- package/lib/plain-values.d.ts.map +1 -0
- package/lib/plain-values.js +2 -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 +1 -639
- package/lib/protocol-rest.d.ts +38 -25
- package/lib/protocol-rest.d.ts.map +1 -1
- package/lib/protocol-rest.js +1 -267
- package/lib/query.js +1 -27
- 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 +1 -0
- package/lib/response-validation.d.ts +43 -25
- package/lib/response-validation.d.ts.map +1 -1
- package/lib/response-validation.js +1 -76
- package/lib/retry-after.d.ts +3 -3
- package/lib/retry-after.js +1 -112
- package/lib/retry.d.ts +48 -29
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +1 -209
- 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 +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 +2 -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 +1 -0
- package/lib/schema.d.ts +20 -6
- package/lib/schema.d.ts.map +1 -1
- package/lib/schema.js +1 -48
- package/lib/testing.d.ts +3 -2
- package/lib/testing.d.ts.map +1 -1
- package/lib/testing.js +1 -40
- 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 +1 -131
- package/lib/xml.d.ts +1 -1
- package/lib/xml.d.ts.map +1 -1
- package/lib/xml.js +1 -311
- package/package.json +9 -7
- package/src/api.ts +1080 -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/api.js.map +0 -1
- package/lib/category.js.map +0 -1
- 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/error-category.js.map +0 -1
- package/lib/errors.js.map +0 -1
- package/lib/fixtures/xml/upstream-validator.json +0 -397
- package/lib/graphql.js.map +0 -1
- 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/graphql.types.js.map +0 -1
- package/lib/index.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.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.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.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/query.js.map +0 -1
- package/lib/response-validation.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.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.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/schema.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/trait.js.map +0 -1
- package/lib/xml.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,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal schemas for generated SDK code: plain objects shaped like Effect
|
|
3
|
+
* Schema ASTs (`_tag`, `annotations`, `propertySignatures`, `types`,
|
|
4
|
+
* `thunk`, `encoding`), without Effect Schema's parser, issue and
|
|
5
|
+
* transformation machinery.
|
|
6
|
+
*
|
|
7
|
+
* Request encoding and lenient response decoding only walk the AST: they
|
|
8
|
+
* read wire names, HTTP bindings and the shape of the value. Importing
|
|
9
|
+
* `effect/Schema` to build those ASTs put about 37 KB gzip of decode
|
|
10
|
+
* machinery into every bundle that never decodes. These nodes carry the
|
|
11
|
+
* same fields protocol code reads, so it runs unchanged.
|
|
12
|
+
*
|
|
13
|
+
* When a caller asks for real validation (`ResponseValidation.strict` or
|
|
14
|
+
* `additionalProperties`), {@link toEffect} rebuilds the equivalent Effect
|
|
15
|
+
* schema from a lite node, loading `effect/Schema` only then.
|
|
16
|
+
*
|
|
17
|
+
* Every value here has the members generated code uses on schemas: `.ast`,
|
|
18
|
+
* `.pipe(...)`, `.annotate(...)`, `.fields` (structs) and `.key`/`.value`
|
|
19
|
+
* (records).
|
|
20
|
+
*/
|
|
21
|
+
import type * as Cause from "effect/Cause";
|
|
22
|
+
import { type Pipeable } from "effect/Pipeable";
|
|
23
|
+
import type * as EffectSchema from "effect/Schema";
|
|
24
|
+
export type Annotations = Record<string | symbol, unknown>;
|
|
25
|
+
/** A lite AST node. Field names match Effect's SchemaAST where protocols read them. */
|
|
26
|
+
export interface Node {
|
|
27
|
+
readonly _tag: string;
|
|
28
|
+
readonly annotations?: Annotations;
|
|
29
|
+
/**
|
|
30
|
+
* The wire-side node, for nodes whose value changes on the wire (AWS
|
|
31
|
+
* timestamps, blobs, sensitive values). Same shape as Effect's encoding
|
|
32
|
+
* chain, so code that follows `encoding[0].to` reads the wire type.
|
|
33
|
+
*/
|
|
34
|
+
readonly encoding?: ReadonlyArray<{
|
|
35
|
+
readonly to: Node;
|
|
36
|
+
}>;
|
|
37
|
+
/** Declaration: the type guard strict validation applies (Unknown without one). */
|
|
38
|
+
readonly check?: (u: unknown) => boolean;
|
|
39
|
+
readonly context?: {
|
|
40
|
+
readonly isOptional: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** Objects */
|
|
43
|
+
readonly propertySignatures?: ReadonlyArray<PropertySignature>;
|
|
44
|
+
readonly indexSignatures?: ReadonlyArray<{
|
|
45
|
+
readonly parameter: Node;
|
|
46
|
+
readonly type: Node;
|
|
47
|
+
}>;
|
|
48
|
+
/** Union */
|
|
49
|
+
readonly types?: ReadonlyArray<Node>;
|
|
50
|
+
/** Arrays */
|
|
51
|
+
readonly elements?: ReadonlyArray<Node>;
|
|
52
|
+
readonly rest?: ReadonlyArray<Node>;
|
|
53
|
+
/** Suspend */
|
|
54
|
+
readonly thunk?: () => Node;
|
|
55
|
+
/** Literal */
|
|
56
|
+
readonly literal?: unknown;
|
|
57
|
+
/** Declaration */
|
|
58
|
+
readonly typeParameters?: ReadonlyArray<Node>;
|
|
59
|
+
}
|
|
60
|
+
export interface PropertySignature {
|
|
61
|
+
readonly name: PropertyKey;
|
|
62
|
+
readonly type: Node;
|
|
63
|
+
}
|
|
64
|
+
/** A lite schema value: what generated code holds and passes around. */
|
|
65
|
+
export interface Lite {
|
|
66
|
+
readonly ast: Node;
|
|
67
|
+
readonly "~lite": true;
|
|
68
|
+
pipe(...fns: ReadonlyArray<(s: any) => any>): any;
|
|
69
|
+
annotate(annotations: Annotations): Lite;
|
|
70
|
+
}
|
|
71
|
+
/** Marks lite nodes so strict validation knows to convert them. */
|
|
72
|
+
export declare const liteKey = "~lite";
|
|
73
|
+
/** A lite schema for a hand-built node (SDK-specific declarations). */
|
|
74
|
+
export declare const fromNode: (n: Node) => Lite;
|
|
75
|
+
export declare const isLite: (u: unknown) => u is Lite;
|
|
76
|
+
export declare const String: Lite;
|
|
77
|
+
export declare const Number: Lite;
|
|
78
|
+
export declare const Boolean: Lite;
|
|
79
|
+
export declare const Unknown: Lite;
|
|
80
|
+
export declare const Any: Lite;
|
|
81
|
+
export declare const Null: Lite;
|
|
82
|
+
export declare const Void: Lite;
|
|
83
|
+
export declare const Undefined: Lite;
|
|
84
|
+
export declare const Literal: (value: unknown) => Lite;
|
|
85
|
+
export declare const Literals: (values: ReadonlyArray<unknown>) => Lite;
|
|
86
|
+
export declare const optional: (s: Lite) => Lite;
|
|
87
|
+
export declare const NullOr: (s: Lite) => Lite;
|
|
88
|
+
export declare const Union: (members: ReadonlyArray<Lite>) => Lite;
|
|
89
|
+
export declare const Array: (item: Lite) => Lite;
|
|
90
|
+
export declare const Tuple: (elements: ReadonlyArray<Lite>) => Lite;
|
|
91
|
+
export declare const Record: (key: Lite, value: Lite) => Lite;
|
|
92
|
+
export declare const Struct: (fields: Readonly<Record<string, Lite>>) => Lite;
|
|
93
|
+
/**
|
|
94
|
+
* A struct that also allows keys it does not declare (OpenAPI
|
|
95
|
+
* `additionalProperties` next to `properties`): the struct's property
|
|
96
|
+
* signatures plus each record's index signature, as Effect's
|
|
97
|
+
* `StructWithRest` builds them.
|
|
98
|
+
*/
|
|
99
|
+
export declare const StructWithRest: (struct: Lite, records: ReadonlyArray<Lite>) => Lite;
|
|
100
|
+
/** A lazily resolved schema; `.ast` is a Suspend node whose thunk resolves the target. */
|
|
101
|
+
export declare const suspend: (f: () => Lite) => Lite;
|
|
102
|
+
/** Rename struct keys on the wire: `{ typeKey: "wire_key" }`. */
|
|
103
|
+
export declare const encodeKeys: (mapping: Readonly<Record<string, string>>) => (s: Lite) => Lite;
|
|
104
|
+
export declare const encodeKeysKey = "@distilled.cloud/core/schema-lite/encodeKeys";
|
|
105
|
+
export declare const Date: Lite;
|
|
106
|
+
export declare const Duration: Lite;
|
|
107
|
+
export declare const Redacted: (value: Lite) => Lite;
|
|
108
|
+
export declare const instanceOf: (cls: Function, annotations?: Annotations) => Lite;
|
|
109
|
+
export declare const declare: (_is: (u: unknown) => boolean, annotations?: Annotations) => Lite;
|
|
110
|
+
/**
|
|
111
|
+
* The type of a lite tagged error class: what the class really has. It is
|
|
112
|
+
* not an Effect Schema, so `Schema.is(E)`, `Schema.decode(E)` and friends do
|
|
113
|
+
* not compile against it -- at runtime they would fail on the lite `.ast`.
|
|
114
|
+
* Match errors with `_tag` (`Effect.catchTag`) or `instanceof`.
|
|
115
|
+
*/
|
|
116
|
+
export interface TaggedErrorClass<Tag extends string, Fields extends EffectSchema.Struct.Fields> extends Pipeable {
|
|
117
|
+
new (...args: {} extends EffectSchema.Struct.MakeIn<Fields> ? [props?: EffectSchema.Struct.MakeIn<Fields>] : [props: EffectSchema.Struct.MakeIn<Fields>]): Cause.YieldableError & {
|
|
118
|
+
readonly _tag: Tag;
|
|
119
|
+
} & EffectSchema.Struct.Type<Fields>;
|
|
120
|
+
/** `new this(props)`. */
|
|
121
|
+
make<C extends abstract new (...args: any) => any>(this: C, ...args: ConstructorParameters<C>): InstanceType<C>;
|
|
122
|
+
/**
|
|
123
|
+
* Whether `u` is an error of this class, by `_tag`, so it holds across
|
|
124
|
+
* duplicate copies of a package (`instanceof` does not). Errors of another
|
|
125
|
+
* service with the same tag also match.
|
|
126
|
+
*/
|
|
127
|
+
is<C extends abstract new (...args: any) => any>(this: C, u: unknown): u is InstanceType<C>;
|
|
128
|
+
readonly fields: Fields;
|
|
129
|
+
readonly identifier: Tag;
|
|
130
|
+
/** The lite struct node (not an Effect Schema AST). */
|
|
131
|
+
readonly ast: Node;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* `TaggedError<Self>()(tag, fields)`, typed by the field schemas. `Self` is
|
|
135
|
+
* accepted for source compatibility with `Schema.TaggedError` and unused.
|
|
136
|
+
*/
|
|
137
|
+
export type TaggedErrorFactory = <_Self = never>(identifier?: string) => <Tag extends string, const Fields extends EffectSchema.Struct.Fields = {}>(tag: Tag, fields?: Fields, annotations?: object) => TaggedErrorClass<Tag, Fields>;
|
|
138
|
+
/**
|
|
139
|
+
* A tagged error class without Effect Schema. It does not validate on
|
|
140
|
+
* construction. Carries `.fields` and `.identifier`, and a static `.pipe`
|
|
141
|
+
* for category decorators.
|
|
142
|
+
*/
|
|
143
|
+
export declare const TaggedError: (_identifier?: string) => (tag: string, fields?: Readonly<Record<string, Lite>>, annotations?: object) => any;
|
|
144
|
+
/**
|
|
145
|
+
* Schema `j` of builder `build`, made on first use (the lite `chunks.at`).
|
|
146
|
+
* Its `.ast` is the built schema's own node, not a Suspend around it, so
|
|
147
|
+
* protocol code sees the same node shapes as with eager schemas.
|
|
148
|
+
*/
|
|
149
|
+
export declare const at: (build: (j: number) => unknown, j: number) => any;
|
|
150
|
+
/**
|
|
151
|
+
* The Effect schema equivalent to a lite node, for strict decoding. Loaded
|
|
152
|
+
* on demand so `effect/Schema` is only bundled/imported by callers that
|
|
153
|
+
* validate.
|
|
154
|
+
*/
|
|
155
|
+
/** The Effect Schema functions the bridge uses (passed in, so callers import only these). */
|
|
156
|
+
export type EffectSchemaApi = Pick<typeof import("effect/Schema"), "Any" | "Array" | "Boolean" | "Literal" | "Null" | "Number" | "Record" | "String" | "Struct" | "StructWithRest" | "Tuple" | "Undefined" | "Union" | "Unknown" | "Void" | "declare" | "make" | "optional" | "suspend">;
|
|
157
|
+
export declare const toEffect: (S: EffectSchemaApi, ast: Node) => unknown;
|
|
158
|
+
//# sourceMappingURL=schema-lite-impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-lite-impl.d.ts","sourceRoot":"","sources":["../src/schema-lite-impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,KAAK,YAAY,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3D,uFAAuF;AACvF,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,WAA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F;;;;GAIG;AACH,6FAA6F;AAC7F,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,cAAc,eAAe,CAAC,EAC5B,KAAK,GACL,OAAO,GACP,SAAS,GACT,SAAS,GACT,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,gBAAgB,GAChB,OAAO,GACP,WAAW,GACX,OAAO,GACP,SAAS,GACT,MAAM,GACN,SAAS,GACT,MAAM,GACN,UAAU,GACV,SAAS,CACZ,CAAC;AAEF,eAAO,MAAM,QAAQ,MAAO,eAAe,OAAO,IAAI,KAAG,OAiGxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { schema_lite_impl$Any as Any, schema_lite_impl$Array as Array, schema_lite_impl$Boolean as Boolean, schema_lite_impl$Date as Date, schema_lite_impl$Duration as Duration, schema_lite_impl$Literal as Literal, schema_lite_impl$Literals as Literals, schema_lite_impl$Null as Null, schema_lite_impl$NullOr as NullOr, schema_lite_impl$Number as Number, schema_lite_impl$Record as Record, schema_lite_impl$Redacted as Redacted, schema_lite_impl$String as String, schema_lite_impl$Struct as Struct, schema_lite_impl$StructWithRest as StructWithRest, schema_lite_impl$TaggedError as TaggedError, schema_lite_impl$Tuple as Tuple, schema_lite_impl$Undefined as Undefined, schema_lite_impl$Union as Union, schema_lite_impl$Unknown as Unknown, schema_lite_impl$Void as Void, schema_lite_impl$at as at, schema_lite_impl$declare as declare, schema_lite_impl$encodeKeys as encodeKeys, schema_lite_impl$encodeKeysKey as encodeKeysKey, schema_lite_impl$fromNode as fromNode, schema_lite_impl$instanceOf as instanceOf, schema_lite_impl$isLite as isLite, schema_lite_impl$liteKey as liteKey, schema_lite_impl$optional as optional, schema_lite_impl$suspend as suspend, schema_lite_impl$toEffect as toEffect } from "./_bundle/base.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `schema-lite` with Effect Schema's types, for hand-written modules.
|
|
3
|
+
*
|
|
4
|
+
* Generated services import `schema-lite`, whose builders are typed `any`
|
|
5
|
+
* because every generated schema is cast to its declared interface. Hand-
|
|
6
|
+
* written error classes have no such cast: built from untyped builders,
|
|
7
|
+
* their fields declare as `any` (`ValidationError.message: any`), which
|
|
8
|
+
* erases the field types for every consumer. This module exposes the same
|
|
9
|
+
* lite runtime values with the Effect Schema types, so `S.TaggedError` field
|
|
10
|
+
* types infer as they did with Effect Schema.
|
|
11
|
+
*/
|
|
12
|
+
import type * as S from "effect/Schema";
|
|
13
|
+
import * as L from "./schema-lite-impl.ts";
|
|
14
|
+
export type * from "effect/Schema";
|
|
15
|
+
export declare const optional: typeof S.optional;
|
|
16
|
+
export declare const Struct: typeof S.Struct;
|
|
17
|
+
export declare const StructWithRest: typeof S.StructWithRest;
|
|
18
|
+
export declare const suspend: typeof S.suspend;
|
|
19
|
+
export declare const Array: typeof S.Array;
|
|
20
|
+
export declare const Record: typeof S.Record;
|
|
21
|
+
export declare const Union: typeof S.Union;
|
|
22
|
+
export declare const Literal: typeof S.Literal;
|
|
23
|
+
export declare const Literals: typeof S.Literals;
|
|
24
|
+
export declare const NullOr: typeof S.NullOr;
|
|
25
|
+
export declare const Tuple: typeof S.Tuple;
|
|
26
|
+
export declare const declare: typeof S.declare;
|
|
27
|
+
export declare const instanceOf: typeof S.instanceOf;
|
|
28
|
+
export declare const Redacted: typeof S.Redacted;
|
|
29
|
+
export declare const String: typeof S.String;
|
|
30
|
+
export declare const Number: typeof S.Number;
|
|
31
|
+
export declare const Int: typeof S.Int;
|
|
32
|
+
export declare const Boolean: typeof S.Boolean;
|
|
33
|
+
export declare const Date: typeof S.Date;
|
|
34
|
+
export declare const Duration: typeof S.Duration;
|
|
35
|
+
export declare const Unknown: typeof S.Unknown;
|
|
36
|
+
export declare const Null: typeof S.Null;
|
|
37
|
+
export declare const Void: typeof S.Void;
|
|
38
|
+
export declare const Any: typeof S.Any;
|
|
39
|
+
export declare const TaggedError: L.TaggedErrorFactory;
|
|
40
|
+
export type { TaggedErrorClass, TaggedErrorFactory } from "./schema-lite-impl.ts";
|
|
41
|
+
//# sourceMappingURL=schema-lite-typed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-lite-typed.d.ts","sourceRoot":"","sources":["../src/schema-lite-typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,CAAC,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAE3C,mBAAmB,eAAe,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAA4B,OAAO,CAAC,CAAC,QAAQ,CAAC;AACnE,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,cAAc,EAAkC,OAAO,CAAC,CAAC,cAAc,CAAC;AACrF,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,KAAK,EAAyB,OAAO,CAAC,CAAC,KAAK,CAAC;AAC1D,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,KAAK,EAAyB,OAAO,CAAC,CAAC,KAAK,CAAC;AAC1D,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,QAAQ,EAA4B,OAAO,CAAC,CAAC,QAAQ,CAAC;AACnE,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,KAAK,EAAyB,OAAO,CAAC,CAAC,KAAK,CAAC;AAC1D,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,UAAU,EAA8B,OAAO,CAAC,CAAC,UAAU,CAAC;AACzE,eAAO,MAAM,QAAQ,EAA4B,OAAO,CAAC,CAAC,QAAQ,CAAC;AAEnE,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,GAAG,EAA0B,OAAO,CAAC,CAAC,GAAG,CAAC;AACvD,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,IAAI,EAAwB,OAAO,CAAC,CAAC,IAAI,CAAC;AACvD,eAAO,MAAM,QAAQ,EAA4B,OAAO,CAAC,CAAC,QAAQ,CAAC;AACnE,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,IAAI,EAAwB,OAAO,CAAC,CAAC,IAAI,CAAC;AACvD,eAAO,MAAM,IAAI,EAAwB,OAAO,CAAC,CAAC,IAAI,CAAC;AACvD,eAAO,MAAM,GAAG,EAAuB,OAAO,CAAC,CAAC,GAAG,CAAC;AAEpD,eAAO,MAAM,WAAW,EAA+B,CAAC,CAAC,kBAAkB,CAAC;AAC5E,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{schema_lite_impl$Any as e,schema_lite_impl$Array as t,schema_lite_impl$Boolean as n,schema_lite_impl$Date as r,schema_lite_impl$Duration as i,schema_lite_impl$Literal as a,schema_lite_impl$Literals as o,schema_lite_impl$Null as s,schema_lite_impl$NullOr as c,schema_lite_impl$Number as l,schema_lite_impl$Record as u,schema_lite_impl$Redacted as d,schema_lite_impl$String as f,schema_lite_impl$Struct as p,schema_lite_impl$StructWithRest as m,schema_lite_impl$TaggedError as h,schema_lite_impl$Tuple as g,schema_lite_impl$Union as _,schema_lite_impl$Unknown as v,schema_lite_impl$Void as y,schema_lite_impl$declare as b,schema_lite_impl$instanceOf as x,schema_lite_impl$optional as S,schema_lite_impl$suspend as C}from"./_bundle/base.js";const w=S;const T=p;const E=m;const D=C;const O=t;const k=u;const A=_;const j=a;const M=o;const N=c;const P=g;const F=b;const I=x;const L=d;const R=f;const z=l;const B=l;const V=n;const H=r;const U=i;const W=v;const G=s;const K=y;const q=e;const J=h;export{q as Any,O as Array,V as Boolean,H as Date,U as Duration,B as Int,j as Literal,M as Literals,G as Null,N as NullOr,z as Number,k as Record,L as Redacted,R as String,T as Struct,E as StructWithRest,J as TaggedError,P as Tuple,A as Union,W as Unknown,K as Void,F as declare,I as instanceOf,w as optional,D as suspend};
|
|
2
|
+
//# sourceMappingURL=schema-lite-typed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-lite-typed.js","names":["L.optional","L.Struct","L.StructWithRest","L.suspend","L.Array","L.Record","L.Union","L.Literal","L.Literals","L.NullOr","L.Tuple","L.declare","L.instanceOf","L.Redacted","L.String","L.Number","L.Boolean","L.Date","L.Duration","L.Unknown","L.Null","L.Void","L.Any","L.TaggedError","Any$1","Array$1","Boolean$1","Date$1","Duration$1","Literal$1","Literals$1","Null$1","NullOr$1","Number$1","Record$1","Redacted$1","String$1","Struct$1","StructWithRest$1","TaggedError$1","Tuple$1","Union$1","Unknown$1","Void$1","declare$1","instanceOf$1","optional$1","suspend$1","optional","Struct","StructWithRest","suspend","Array","Record","Union","Literal","Literals","NullOr","Tuple","declare","instanceOf","Redacted","String","Number","Int","Boolean","Date","Duration","Unknown","Null","Void","Any","TaggedError"],"sources":["../src/schema-lite-typed.ts"],"mappings":"yuBAgBA,MAAagD,EAAWhD,EACxB,MAAaiD,EAAShD,EACtB,MAAaiD,EAAiBhD,EAC9B,MAAaiD,EAAUhD,EACvB,MAAaiD,EAAQhD,EACrB,MAAaiD,EAAShD,EACtB,MAAaiD,EAAQhD,EACrB,MAAaiD,EAAUhD,EACvB,MAAaiD,EAAWhD,EACxB,MAAaiD,EAAShD,EACtB,MAAaiD,EAAQhD,EACrB,MAAaiD,EAAUhD,EACvB,MAAaiD,EAAahD,EAC1B,MAAaiD,EAAWhD,EAExB,MAAaiD,EAAShD,EACtB,MAAaiD,EAAShD,EACtB,MAAaiD,EAAMjD,EACnB,MAAakD,EAAUjD,EACvB,MAAakD,EAAOjD,EACpB,MAAakD,EAAWjD,EACxB,MAAakD,EAAUjD,EACvB,MAAakD,EAAOjD,EACpB,MAAakD,EAAOjD,EACpB,MAAakD,EAAMjD,EAEnB,MAAakD,EAAcjD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Effect Schema's API surface for generated code, backed by lite schemas
|
|
3
|
+
* (see `schema-lite-impl.ts`): the same names and types as
|
|
4
|
+
* `@distilled.cloud/core/schema`, without importing Effect Schema at runtime.
|
|
5
|
+
*/
|
|
6
|
+
import type * as S from "effect/Schema";
|
|
7
|
+
import * as L from "./schema-lite-impl.ts";
|
|
8
|
+
export type * from "effect/Schema";
|
|
9
|
+
export type AnyFn = (...args: any[]) => any;
|
|
10
|
+
export declare const optional: AnyFn;
|
|
11
|
+
export declare const Struct: AnyFn;
|
|
12
|
+
export declare const StructWithRest: AnyFn;
|
|
13
|
+
export declare const suspend: AnyFn;
|
|
14
|
+
export declare const Array: AnyFn;
|
|
15
|
+
export declare const Record: AnyFn;
|
|
16
|
+
export declare const Union: AnyFn;
|
|
17
|
+
export declare const Literal: AnyFn;
|
|
18
|
+
export declare const Literals: AnyFn;
|
|
19
|
+
export declare const NullOr: AnyFn;
|
|
20
|
+
export declare const Tuple: AnyFn;
|
|
21
|
+
export declare const encodeKeys: AnyFn;
|
|
22
|
+
export declare const declare: typeof S.declare;
|
|
23
|
+
export declare const instanceOf: AnyFn;
|
|
24
|
+
export declare const Redacted: AnyFn;
|
|
25
|
+
export declare const String: any;
|
|
26
|
+
export declare const Number: any;
|
|
27
|
+
export declare const Int: any;
|
|
28
|
+
export declare const Boolean: any;
|
|
29
|
+
export declare const Date: any;
|
|
30
|
+
export declare const Duration: any;
|
|
31
|
+
export declare const Unknown: any;
|
|
32
|
+
export declare const Null: any;
|
|
33
|
+
export declare const Void: any;
|
|
34
|
+
export declare const Any: any;
|
|
35
|
+
export declare const TaggedError: L.TaggedErrorFactory;
|
|
36
|
+
export type { TaggedErrorClass, TaggedErrorFactory } from "./schema-lite-impl.ts";
|
|
37
|
+
/** Lite `chunks.at`: generated services name this module `__L`. */
|
|
38
|
+
export declare const at: typeof L.at;
|
|
39
|
+
export { liteKey, toEffect } from "./schema-lite-impl.ts";
|
|
40
|
+
//# sourceMappingURL=schema-lite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-lite.d.ts","sourceRoot":"","sources":["../src/schema-lite.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,KAAK,CAAC,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAE3C,mBAAmB,eAAe,CAAC;AACnC,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAE5C,eAAO,MAAM,QAAQ,EAAE,KAAkB,CAAC;AAC1C,eAAO,MAAM,MAAM,EAAE,KAAgB,CAAC;AACtC,eAAO,MAAM,cAAc,EAAE,KAAwB,CAAC;AACtD,eAAO,MAAM,OAAO,EAAE,KAAiB,CAAC;AACxC,eAAO,MAAM,KAAK,EAAE,KAAe,CAAC;AACpC,eAAO,MAAM,MAAM,EAAE,KAAgB,CAAC;AACtC,eAAO,MAAM,KAAK,EAAE,KAAe,CAAC;AACpC,eAAO,MAAM,OAAO,EAAE,KAAiB,CAAC;AACxC,eAAO,MAAM,QAAQ,EAAE,KAAkB,CAAC;AAC1C,eAAO,MAAM,MAAM,EAAE,KAAgB,CAAC;AACtC,eAAO,MAAM,KAAK,EAAE,KAAe,CAAC;AACpC,eAAO,MAAM,UAAU,EAAE,KAAoB,CAAC;AAC9C,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,CAAC,OAAkD,CAAC;AAClF,eAAO,MAAM,UAAU,EAAE,KAAoB,CAAC;AAC9C,eAAO,MAAM,QAAQ,EAAE,KAAkB,CAAC;AAE1C,eAAO,MAAM,MAAM,EAAE,GAAc,CAAC;AACpC,eAAO,MAAM,MAAM,EAAE,GAAc,CAAC;AACpC,eAAO,MAAM,GAAG,EAAE,GAAc,CAAC;AACjC,eAAO,MAAM,OAAO,EAAE,GAAe,CAAC;AACtC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,QAAQ,EAAE,GAAgB,CAAC;AACxC,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;AAE9B,eAAO,MAAM,WAAW,EAA+B,CAAC,CAAC,kBAAkB,CAAC;AAC5E,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAElF,mEAAmE;AACnE,eAAO,MAAM,EAAE,aAAO,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { schema_lite$Any as Any, schema_lite$Array as Array, schema_lite$Boolean as Boolean, schema_lite$Date as Date, schema_lite$Duration as Duration, schema_lite$Int as Int, schema_lite$Literal as Literal, schema_lite$Literals as Literals, schema_lite$Null as Null, schema_lite$NullOr as NullOr, schema_lite$Number as Number, schema_lite$Record as Record, schema_lite$Redacted as Redacted, schema_lite$String as String, schema_lite$Struct as Struct, schema_lite$StructWithRest as StructWithRest, schema_lite$TaggedError as TaggedError, schema_lite$Tuple as Tuple, schema_lite$Union as Union, schema_lite$Unknown as Unknown, schema_lite$Void as Void, schema_lite$at as at, schema_lite$declare as declare, schema_lite$encodeKeys as encodeKeys, schema_lite$instanceOf as instanceOf, schema_lite$liteKey as liteKey, schema_lite$optional as optional, schema_lite$suspend as suspend, schema_lite$toEffect as toEffect } from "./_bundle/rest.js";
|
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,48 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* `any`-collapsing re-export of `effect/Schema` for generated service files.
|
|
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";
|
|
23
|
-
import * as S from "effect/Schema";
|
|
24
|
-
// Construction surface — collapse to `any` so generics are never instantiated.
|
|
25
|
-
export const optional = S.optional;
|
|
26
|
-
export const Struct = S.Struct;
|
|
27
|
-
export const suspend = S.suspend;
|
|
28
|
-
export const Array = S.Array;
|
|
29
|
-
export const Record = S.Record;
|
|
30
|
-
export const Union = S.Union;
|
|
31
|
-
export const Literal = S.Literal;
|
|
32
|
-
export const Literals = S.Literals;
|
|
33
|
-
export const NullOr = S.NullOr;
|
|
34
|
-
export const Tuple = S.Tuple;
|
|
35
|
-
export const encodeKeys = S.encodeKeys;
|
|
36
|
-
// Leaf schemas — collapse to `any` so `.pipe(...)` on them is free.
|
|
37
|
-
export const String = S.String;
|
|
38
|
-
export const Number = S.Number;
|
|
39
|
-
export const Boolean = S.Boolean;
|
|
40
|
-
export const Date = S.Date;
|
|
41
|
-
export const Unknown = S.Unknown;
|
|
42
|
-
export const Null = S.Null;
|
|
43
|
-
export const Void = S.Void;
|
|
44
|
-
export const Any = S.Any;
|
|
45
|
-
// NOTE: `Schema` / `Codec` (types) and `TaggedError` are intentionally NOT
|
|
46
|
-
// overridden — they flow through `export *` with real types so cast targets and
|
|
47
|
-
// typed error classes stay precise.
|
|
48
|
-
//# sourceMappingURL=schema.js.map
|
|
1
|
+
export { schema$Any as Any, schema$Array as Array, schema$Boolean as Boolean, schema$Date as Date, schema$Duration as Duration, schema$Literal as Literal, schema$Literals as Literals, schema$Null as Null, schema$NullOr as NullOr, schema$Number as Number, schema$Record as Record, schema$Redacted as Redacted, schema$String as String, schema$Struct as Struct, schema$StructWithRest as StructWithRest, schema$TaggedError as TaggedError, schema$Tuple as Tuple, schema$Union as Union, schema$Unknown as Unknown, schema$Void as Void, schema$declare as declare, schema$encodeKeys as encodeKeys, schema$instanceOf as instanceOf, schema$lazyFrom as lazyFrom, schema$optional as optional, schema$suspend as suspend } from "./_bundle/aws.js";
|
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,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAG7C,MAAM,WAAW,YAAY;IAC3B,mBAAmB;IACnB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,aACf,YAAY,GAAG,CAAC,CAAC,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,KAAK,YAAY,CAAC,KACxF,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAejC,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,UAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,YACxC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,KAC7C,OAAO,CAAC;IACT,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACtC,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"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|
|
2
|
-
* Test helpers for SDK packages: a canned-response `HttpClient` and a runner
|
|
3
|
-
* that executes one operation under both response-validation modes.
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* const { lenient, strict } = await runValidationModes(
|
|
7
|
-
* Pkg.getThing({ id: "a" }).pipe(Retry.none, Effect.provide(TestCredentials)),
|
|
8
|
-
* { body: "{}" },
|
|
9
|
-
* );
|
|
10
|
-
* expect(lenient).toMatchObject({ _tag: "Success", success: {} });
|
|
11
|
-
* expect(strict).toMatchObject({ _tag: "Failure" });
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
import * as Effect from "effect/Effect";
|
|
15
|
-
import * as HttpClient from "effect/http/HttpClient";
|
|
16
|
-
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
17
|
-
import * as Layer from "effect/Layer";
|
|
18
|
-
import * as ResponseValidation from "./response-validation.js";
|
|
19
|
-
/**
|
|
20
|
-
* An `HttpClient` that answers every request with `response` (or with what
|
|
21
|
-
* `response(request)` returns, for protocols that make more than one call).
|
|
22
|
-
*/
|
|
23
|
-
export const mockHttpClient = (response) => Layer.succeed(HttpClient.HttpClient, HttpClient.make((request) => Effect.sync(() => {
|
|
24
|
-
const r = typeof response === "function" ? response(request) : response;
|
|
25
|
-
return HttpClientResponse.fromWeb(request, new Response(r.body, {
|
|
26
|
-
status: r.status ?? 200,
|
|
27
|
-
headers: r.headers ?? { "content-type": "application/json" },
|
|
28
|
-
}));
|
|
29
|
-
})));
|
|
30
|
-
/**
|
|
31
|
-
* Run `effect` against `mockHttpClient(response)` once in lenient mode and
|
|
32
|
-
* once in strict mode.
|
|
33
|
-
*/
|
|
34
|
-
export const runValidationModes = (effect, response) => {
|
|
35
|
-
const run = (mode) => effect.pipe(Effect.provide(mockHttpClient(response)), Effect.provide(mode), Effect.result);
|
|
36
|
-
return Effect.runPromise(Effect.all({
|
|
37
|
-
lenient: run(ResponseValidation.lenient),
|
|
38
|
-
strict: run(ResponseValidation.strict),
|
|
39
|
-
}));
|
|
40
|
-
};
|
|
1
|
+
import{response_validation$additionalProperties as e,response_validation$lenient as t,response_validation$strict as n}from"./_bundle/base.js";import*as r from"effect/Effect";import*as i from"effect/http/HttpClient";import*as a from"effect/Layer";import*as o from"effect/http/HttpClientResponse";const mockHttpClient=e=>a.succeed(i.HttpClient,i.make(t=>r.sync(()=>{const n=typeof e===`function`?e(t):e;return o.fromWeb(t,new Response(n.body,{status:n.status??200,headers:n.headers??{"content-type":`application/json`}}))})));const runValidationModes=(i,a)=>{const run=e=>i.pipe(r.provide(mockHttpClient(a)),r.provide(e),r.result);return r.runPromise(r.all({lenient:run(t),additionalProperties:run(e),strict:run(n)}))};export{mockHttpClient,runValidationModes};
|
|
41
2
|
//# sourceMappingURL=testing.js.map
|
package/lib/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","
|
|
1
|
+
{"version":3,"file":"testing.js","names":["ResponseValidation.lenient","ResponseValidation.additionalProperties","ResponseValidation.strict","additionalProperties","lenient","strict","Effect","HttpClient","Layer","HttpClientResponse","r","response","request","effect","mode"],"sources":["../src/testing.ts"],"mappings":"uSAiCA,MAAa,eACX,GAEAQ,EAAM,QACJD,EAAW,WACXA,EAAW,KAAM,GACfD,EAAO,SAAW,CAChB,MAAMI,EAAI,OAAOC,IAAa,WAAaA,EAASC,CAAO,EAAID,EAC/D,OAAOF,EAAmB,QACxBG,EACA,IAAI,SAASF,EAAE,KAAM,CACnB,OAAQA,EAAE,QAAU,IACpB,QAASA,EAAE,SAAW,CAAE,eAAgB,kBAAmB,CAC7D,CAAC,CACH,CACF,CAAC,CACH,CACF,EAMF,MAAa,oBACX,EACA,IAKI,CACJ,MAAM,IAAO,GACXG,EAAO,KAAKP,EAAO,QAAQ,eAAeK,CAAQ,CAAC,EAAGL,EAAO,QAAQQ,CAAI,EAAGR,EAAO,MAAM,EAC3F,OAAOA,EAAO,WACZA,EAAO,IAAI,CACT,QAAS,IAAIN,CAA0B,EACvC,qBAAsB,IAAIC,CAAuC,EACjE,OAAQ,IAAIC,CAAyB,CACvC,CAAC,CACH,CACF"}
|
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;IACxB,QAAQ,CAAC,WAAW,EAAE,GAAG,GAAG,WAAW,CAAC;CACzC,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;IACtC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC;QACrC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC,CAAC;IACH,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU,CAK5E;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,GAAG,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAe5D;AAOD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;IAClF,wFAAwF;IACxF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,8FAA8F;IAC9F,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAA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