@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
package/lib/errors.d.ts
CHANGED
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
* that are used across all SDKs.
|
|
7
7
|
*/
|
|
8
8
|
import * as Duration from "effect/Duration";
|
|
9
|
-
import * as Schema from "effect/Schema";
|
|
10
9
|
import * as Category from "./category.ts";
|
|
10
|
+
import * as Schema from "./schema-lite-typed.ts";
|
|
11
11
|
/**
|
|
12
12
|
* Opaque schema for an Effect `Duration.Duration` value.
|
|
13
13
|
*
|
|
14
14
|
* Used on retryable errors to carry a server-provided wait hint (e.g. parsed
|
|
15
15
|
* from `Retry-After` or the IETF `Ratelimit` header). Core does not encode/decode
|
|
16
|
-
* this field over the wire
|
|
16
|
+
* this field over the wire -- it is constructed at runtime by `matchError` from
|
|
17
17
|
* whatever the service actually returns (delay-seconds, HTTP-date, epoch, etc.)
|
|
18
18
|
* and consumed at runtime by the retry policy.
|
|
19
19
|
*/
|
|
20
|
-
export declare const DurationSchema: Schema.declare<Duration.Duration, Duration.Duration>;
|
|
21
|
-
declare const Unauthorized_base: Schema.
|
|
22
|
-
readonly message: Schema.String;
|
|
23
|
-
}
|
|
20
|
+
export declare const DurationSchema: import("effect/Schema").declare<Duration.Duration, Duration.Duration>;
|
|
21
|
+
declare const Unauthorized_base: Schema.TaggedErrorClass<"Unauthorized", {
|
|
22
|
+
readonly message: import("effect/Schema").String;
|
|
23
|
+
}> & (new (...args: any[]) => {
|
|
24
24
|
"@distilled.cloud/error/categories": {
|
|
25
25
|
AuthError: true;
|
|
26
26
|
};
|
|
@@ -28,11 +28,11 @@ declare const Unauthorized_base: Schema.Class<Unauthorized, Schema.TaggedStruct<
|
|
|
28
28
|
/**
|
|
29
29
|
* Unauthorized - Authentication failure (401).
|
|
30
30
|
*/
|
|
31
|
-
export declare class Unauthorized extends Unauthorized_base {
|
|
31
|
+
export declare class Unauthorized extends /*@__PURE__*/ Unauthorized_base {
|
|
32
32
|
}
|
|
33
|
-
declare const Forbidden_base: Schema.
|
|
34
|
-
readonly message: Schema.String;
|
|
35
|
-
}
|
|
33
|
+
declare const Forbidden_base: Schema.TaggedErrorClass<"Forbidden", {
|
|
34
|
+
readonly message: import("effect/Schema").String;
|
|
35
|
+
}> & (new (...args: any[]) => {
|
|
36
36
|
"@distilled.cloud/error/categories": {
|
|
37
37
|
AuthError: true;
|
|
38
38
|
};
|
|
@@ -40,11 +40,11 @@ declare const Forbidden_base: Schema.Class<Forbidden, Schema.TaggedStruct<"Forbi
|
|
|
40
40
|
/**
|
|
41
41
|
* Forbidden - Access denied (403).
|
|
42
42
|
*/
|
|
43
|
-
export declare class Forbidden extends Forbidden_base {
|
|
43
|
+
export declare class Forbidden extends /*@__PURE__*/ Forbidden_base {
|
|
44
44
|
}
|
|
45
|
-
declare const NotFound_base: Schema.
|
|
46
|
-
readonly message: Schema.String;
|
|
47
|
-
}
|
|
45
|
+
declare const NotFound_base: Schema.TaggedErrorClass<"NotFound", {
|
|
46
|
+
readonly message: import("effect/Schema").String;
|
|
47
|
+
}> & (new (...args: any[]) => {
|
|
48
48
|
"@distilled.cloud/error/categories": {
|
|
49
49
|
NotFoundError: true;
|
|
50
50
|
};
|
|
@@ -52,11 +52,11 @@ declare const NotFound_base: Schema.Class<NotFound, Schema.TaggedStruct<"NotFoun
|
|
|
52
52
|
/**
|
|
53
53
|
* NotFound - Resource not found (404).
|
|
54
54
|
*/
|
|
55
|
-
export declare class NotFound extends NotFound_base {
|
|
55
|
+
export declare class NotFound extends /*@__PURE__*/ NotFound_base {
|
|
56
56
|
}
|
|
57
|
-
declare const BadRequest_base: Schema.
|
|
58
|
-
readonly message: Schema.String;
|
|
59
|
-
}
|
|
57
|
+
declare const BadRequest_base: Schema.TaggedErrorClass<"BadRequest", {
|
|
58
|
+
readonly message: import("effect/Schema").String;
|
|
59
|
+
}> & (new (...args: any[]) => {
|
|
60
60
|
"@distilled.cloud/error/categories": {
|
|
61
61
|
BadRequestError: true;
|
|
62
62
|
};
|
|
@@ -64,11 +64,11 @@ declare const BadRequest_base: Schema.Class<BadRequest, Schema.TaggedStruct<"Bad
|
|
|
64
64
|
/**
|
|
65
65
|
* BadRequest - Invalid request (400).
|
|
66
66
|
*/
|
|
67
|
-
export declare class BadRequest extends BadRequest_base {
|
|
67
|
+
export declare class BadRequest extends /*@__PURE__*/ BadRequest_base {
|
|
68
68
|
}
|
|
69
|
-
declare const Conflict_base: Schema.
|
|
70
|
-
readonly message: Schema.String;
|
|
71
|
-
}
|
|
69
|
+
declare const Conflict_base: Schema.TaggedErrorClass<"Conflict", {
|
|
70
|
+
readonly message: import("effect/Schema").String;
|
|
71
|
+
}> & (new (...args: any[]) => {
|
|
72
72
|
"@distilled.cloud/error/categories": {
|
|
73
73
|
ConflictError: true;
|
|
74
74
|
};
|
|
@@ -76,11 +76,11 @@ declare const Conflict_base: Schema.Class<Conflict, Schema.TaggedStruct<"Conflic
|
|
|
76
76
|
/**
|
|
77
77
|
* Conflict - Resource conflict (409).
|
|
78
78
|
*/
|
|
79
|
-
export declare class Conflict extends Conflict_base {
|
|
79
|
+
export declare class Conflict extends /*@__PURE__*/ Conflict_base {
|
|
80
80
|
}
|
|
81
|
-
declare const UnprocessableEntity_base: Schema.
|
|
82
|
-
readonly message: Schema.String;
|
|
83
|
-
}
|
|
81
|
+
declare const UnprocessableEntity_base: Schema.TaggedErrorClass<"UnprocessableEntity", {
|
|
82
|
+
readonly message: import("effect/Schema").String;
|
|
83
|
+
}> & (new (...args: any[]) => {
|
|
84
84
|
"@distilled.cloud/error/categories": {
|
|
85
85
|
BadRequestError: true;
|
|
86
86
|
};
|
|
@@ -88,12 +88,12 @@ declare const UnprocessableEntity_base: Schema.Class<UnprocessableEntity, Schema
|
|
|
88
88
|
/**
|
|
89
89
|
* UnprocessableEntity - Validation error (422).
|
|
90
90
|
*/
|
|
91
|
-
export declare class UnprocessableEntity extends UnprocessableEntity_base {
|
|
91
|
+
export declare class UnprocessableEntity extends /*@__PURE__*/ UnprocessableEntity_base {
|
|
92
92
|
}
|
|
93
|
-
declare const TooManyRequests_base: Schema.
|
|
94
|
-
readonly message: Schema.String;
|
|
95
|
-
readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
|
|
96
|
-
}
|
|
93
|
+
declare const TooManyRequests_base: Schema.TaggedErrorClass<"TooManyRequests", {
|
|
94
|
+
readonly message: import("effect/Schema").String;
|
|
95
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
96
|
+
}> & (new (...args: any[]) => {
|
|
97
97
|
"@distilled.cloud/error/categories": {
|
|
98
98
|
ThrottlingError: true;
|
|
99
99
|
};
|
|
@@ -103,12 +103,12 @@ declare const TooManyRequests_base: Schema.Class<TooManyRequests, Schema.TaggedS
|
|
|
103
103
|
/**
|
|
104
104
|
* TooManyRequests - Rate limited (429).
|
|
105
105
|
*/
|
|
106
|
-
export declare class TooManyRequests extends TooManyRequests_base {
|
|
106
|
+
export declare class TooManyRequests extends /*@__PURE__*/ TooManyRequests_base {
|
|
107
107
|
}
|
|
108
|
-
declare const Locked_base: Schema.
|
|
109
|
-
readonly message: Schema.String;
|
|
110
|
-
readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
|
|
111
|
-
}
|
|
108
|
+
declare const Locked_base: Schema.TaggedErrorClass<"Locked", {
|
|
109
|
+
readonly message: import("effect/Schema").String;
|
|
110
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
111
|
+
}> & (new (...args: any[]) => {
|
|
112
112
|
"@distilled.cloud/error/categories": {
|
|
113
113
|
LockedError: true;
|
|
114
114
|
};
|
|
@@ -118,13 +118,13 @@ declare const Locked_base: Schema.Class<Locked, Schema.TaggedStruct<"Locked", {
|
|
|
118
118
|
/**
|
|
119
119
|
* Locked - Resource locked (423).
|
|
120
120
|
*/
|
|
121
|
-
export declare class Locked extends Locked_base {
|
|
121
|
+
export declare class Locked extends /*@__PURE__*/ Locked_base {
|
|
122
122
|
}
|
|
123
|
-
declare const InternalServerError_base: Schema.
|
|
124
|
-
readonly message: Schema.String;
|
|
125
|
-
readonly code: Schema.optional<Schema.Number>;
|
|
126
|
-
readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
|
|
127
|
-
}
|
|
123
|
+
declare const InternalServerError_base: Schema.TaggedErrorClass<"InternalServerError", {
|
|
124
|
+
readonly message: import("effect/Schema").String;
|
|
125
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").Number>;
|
|
126
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
127
|
+
}> & (new (...args: any[]) => {
|
|
128
128
|
"@distilled.cloud/error/categories": {
|
|
129
129
|
ServerError: true;
|
|
130
130
|
};
|
|
@@ -139,12 +139,12 @@ declare const InternalServerError_base: Schema.Class<InternalServerError, Schema
|
|
|
139
139
|
* 200 envelope carrying `{ code: 10002, message: "An unknown error has
|
|
140
140
|
* occurred" }` for transient backend failures on some endpoints).
|
|
141
141
|
*/
|
|
142
|
-
export declare class InternalServerError extends InternalServerError_base {
|
|
142
|
+
export declare class InternalServerError extends /*@__PURE__*/ InternalServerError_base {
|
|
143
143
|
}
|
|
144
|
-
declare const BadGateway_base: Schema.
|
|
145
|
-
readonly message: Schema.String;
|
|
146
|
-
readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
|
|
147
|
-
}
|
|
144
|
+
declare const BadGateway_base: Schema.TaggedErrorClass<"BadGateway", {
|
|
145
|
+
readonly message: import("effect/Schema").String;
|
|
146
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
147
|
+
}> & (new (...args: any[]) => {
|
|
148
148
|
"@distilled.cloud/error/categories": {
|
|
149
149
|
ServerError: true;
|
|
150
150
|
};
|
|
@@ -154,12 +154,12 @@ declare const BadGateway_base: Schema.Class<BadGateway, Schema.TaggedStruct<"Bad
|
|
|
154
154
|
/**
|
|
155
155
|
* BadGateway - Bad gateway (502).
|
|
156
156
|
*/
|
|
157
|
-
export declare class BadGateway extends BadGateway_base {
|
|
157
|
+
export declare class BadGateway extends /*@__PURE__*/ BadGateway_base {
|
|
158
158
|
}
|
|
159
|
-
declare const ServiceUnavailable_base: Schema.
|
|
160
|
-
readonly message: Schema.String;
|
|
161
|
-
readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
|
|
162
|
-
}
|
|
159
|
+
declare const ServiceUnavailable_base: Schema.TaggedErrorClass<"ServiceUnavailable", {
|
|
160
|
+
readonly message: import("effect/Schema").String;
|
|
161
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
162
|
+
}> & (new (...args: any[]) => {
|
|
163
163
|
"@distilled.cloud/error/categories": {
|
|
164
164
|
ServerError: true;
|
|
165
165
|
};
|
|
@@ -169,12 +169,12 @@ declare const ServiceUnavailable_base: Schema.Class<ServiceUnavailable, Schema.T
|
|
|
169
169
|
/**
|
|
170
170
|
* ServiceUnavailable - Service unavailable (503).
|
|
171
171
|
*/
|
|
172
|
-
export declare class ServiceUnavailable extends ServiceUnavailable_base {
|
|
172
|
+
export declare class ServiceUnavailable extends /*@__PURE__*/ ServiceUnavailable_base {
|
|
173
173
|
}
|
|
174
|
-
declare const GatewayTimeout_base: Schema.
|
|
175
|
-
readonly message: Schema.String;
|
|
176
|
-
readonly retryAfter: Schema.optional<Schema.declare<Duration.Duration, Duration.Duration>>;
|
|
177
|
-
}
|
|
174
|
+
declare const GatewayTimeout_base: Schema.TaggedErrorClass<"GatewayTimeout", {
|
|
175
|
+
readonly message: import("effect/Schema").String;
|
|
176
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
177
|
+
}> & (new (...args: any[]) => {
|
|
178
178
|
"@distilled.cloud/error/categories": {
|
|
179
179
|
ServerError: true;
|
|
180
180
|
};
|
|
@@ -184,11 +184,11 @@ declare const GatewayTimeout_base: Schema.Class<GatewayTimeout, Schema.TaggedStr
|
|
|
184
184
|
/**
|
|
185
185
|
* GatewayTimeout - HTTP request or gateway timeout (408, 504).
|
|
186
186
|
*/
|
|
187
|
-
export declare class GatewayTimeout extends GatewayTimeout_base {
|
|
187
|
+
export declare class GatewayTimeout extends /*@__PURE__*/ GatewayTimeout_base {
|
|
188
188
|
}
|
|
189
|
-
declare const ConfigError_base: Schema.
|
|
190
|
-
readonly message: Schema.String;
|
|
191
|
-
}
|
|
189
|
+
declare const ConfigError_base: Schema.TaggedErrorClass<"ConfigError", {
|
|
190
|
+
readonly message: import("effect/Schema").String;
|
|
191
|
+
}> & (new (...args: any[]) => {
|
|
192
192
|
"@distilled.cloud/error/categories": {
|
|
193
193
|
ConfigurationError: true;
|
|
194
194
|
};
|
|
@@ -196,7 +196,7 @@ declare const ConfigError_base: Schema.Class<ConfigError, Schema.TaggedStruct<"C
|
|
|
196
196
|
/**
|
|
197
197
|
* Configuration error - missing or invalid configuration.
|
|
198
198
|
*/
|
|
199
|
-
export declare class ConfigError extends ConfigError_base {
|
|
199
|
+
export declare class ConfigError extends /*@__PURE__*/ ConfigError_base {
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* Mapping from HTTP status codes to common error classes.
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAMjD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,uEAAuE,CAAC;;;;;;;;AAMnG;;GAEG;AACH,qBAAa,YACX,SAAQ,aAAa,CAAC,iBAES;CAAG;;;;;;;;AAEpC;;GAEG;AACH,qBAAa,SACX,SAAQ,aAAa,CAAC,cAES;CAAG;;;;;;;;AAEpC;;GAEG;AACH,qBAAa,QACX,SAAQ,aAAa,CAAC,aAEa;CAAG;;;;;;;;AAExC;;GAEG;AACH,qBAAa,UACX,SAAQ,aAAa,CAAC,eAEe;CAAG;;;;;;;;AAE1C;;GAEG;AACH,qBAAa,QACX,SAAQ,aAAa,CAAC,aAEa;CAAG;;;;;;;;AAExC;;GAEG;AACH,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAEe;CAAG;;;;;;;;;;;AAE1C;;GAEG;AACH,qBAAa,eACX,SAAQ,aAAa,CAAC,oBAMrB;CAAG;;;;;;;;;;;AAEN;;GAEG;AACH,qBAAa,MACX,SAAQ,aAAa,CAAC,WAGmD;CAAG;;;;;;;;;;;;AAE9E;;;;;;;GAOG;AACH,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAImD;CAAG;;;;;;;;;;;AAE9E;;GAEG;AACH,qBAAa,UACX,SAAQ,aAAa,CAAC,eAGmD;CAAG;;;;;;;;;;;AAE9E;;GAEG;AACH,qBAAa,kBACX,SAAQ,aAAa,CAAC,uBAGmD;CAAG;;;;;;;;;;;AAE9E;;GAEG;AACH,qBAAa,cACX,SAAQ,aAAa,CAAC,mBAGmD;CAAG;;;;;;;;AAE9E;;GAEG;AACH,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAEkB;CAAG;AAM7C;;GAEG;AACH,eAAO,MAAM,eAAe;aAC1B,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;CACK,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,sBAAsB,aAAwD,CAAC;AAE5F;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,aAA6D,CAAC;AAElG;;GAEG;AACH,eAAO,MAAM,UAAU,2QAab,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,cAAc,yJAOjB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE1E,eAAO,MAAM,SAAS,EAAG,6BAAsC,CAAC"}
|
package/lib/errors.js
CHANGED
|
@@ -1,195 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Common error types shared across SDKs.
|
|
3
|
-
*
|
|
4
|
-
* Each SDK defines its own provider-specific errors (e.g., Unauthorized, NotFound)
|
|
5
|
-
* using the category system. This module provides base error types and utilities
|
|
6
|
-
* that are used across all SDKs.
|
|
7
|
-
*/
|
|
8
|
-
import * as Duration from "effect/Duration";
|
|
9
|
-
import * as Schema from "effect/Schema";
|
|
10
|
-
import * as Category from "./category.js";
|
|
11
|
-
// ============================================================================
|
|
12
|
-
// Shared Schema Helpers
|
|
13
|
-
// ============================================================================
|
|
14
|
-
/**
|
|
15
|
-
* Opaque schema for an Effect `Duration.Duration` value.
|
|
16
|
-
*
|
|
17
|
-
* Used on retryable errors to carry a server-provided wait hint (e.g. parsed
|
|
18
|
-
* from `Retry-After` or the IETF `Ratelimit` header). Core does not encode/decode
|
|
19
|
-
* this field over the wire — it is constructed at runtime by `matchError` from
|
|
20
|
-
* whatever the service actually returns (delay-seconds, HTTP-date, epoch, etc.)
|
|
21
|
-
* and consumed at runtime by the retry policy.
|
|
22
|
-
*/
|
|
23
|
-
export const DurationSchema = Schema.declare(Duration.isDuration);
|
|
24
|
-
// ============================================================================
|
|
25
|
-
// Common HTTP Status Error Classes
|
|
26
|
-
// ============================================================================
|
|
27
|
-
/**
|
|
28
|
-
* Unauthorized - Authentication failure (401).
|
|
29
|
-
*/
|
|
30
|
-
export class Unauthorized extends Schema.TaggedError()("Unauthorized", {
|
|
31
|
-
message: Schema.String,
|
|
32
|
-
}).pipe(Category.withAuthError) {
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Forbidden - Access denied (403).
|
|
36
|
-
*/
|
|
37
|
-
export class Forbidden extends Schema.TaggedError()("Forbidden", {
|
|
38
|
-
message: Schema.String,
|
|
39
|
-
}).pipe(Category.withAuthError) {
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* NotFound - Resource not found (404).
|
|
43
|
-
*/
|
|
44
|
-
export class NotFound extends Schema.TaggedError()("NotFound", {
|
|
45
|
-
message: Schema.String,
|
|
46
|
-
}).pipe(Category.withNotFoundError) {
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* BadRequest - Invalid request (400).
|
|
50
|
-
*/
|
|
51
|
-
export class BadRequest extends Schema.TaggedError()("BadRequest", {
|
|
52
|
-
message: Schema.String,
|
|
53
|
-
}).pipe(Category.withBadRequestError) {
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Conflict - Resource conflict (409).
|
|
57
|
-
*/
|
|
58
|
-
export class Conflict extends Schema.TaggedError()("Conflict", {
|
|
59
|
-
message: Schema.String,
|
|
60
|
-
}).pipe(Category.withConflictError) {
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* UnprocessableEntity - Validation error (422).
|
|
64
|
-
*/
|
|
65
|
-
export class UnprocessableEntity extends Schema.TaggedError()("UnprocessableEntity", { message: Schema.String }).pipe(Category.withBadRequestError) {
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* TooManyRequests - Rate limited (429).
|
|
69
|
-
*/
|
|
70
|
-
export class TooManyRequests extends Schema.TaggedError()("TooManyRequests", {
|
|
71
|
-
message: Schema.String,
|
|
72
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
73
|
-
}).pipe(Category.withThrottlingError, Category.withRetryable({ throttling: true })) {
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Locked - Resource locked (423).
|
|
77
|
-
*/
|
|
78
|
-
export class Locked extends Schema.TaggedError()("Locked", {
|
|
79
|
-
message: Schema.String,
|
|
80
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
81
|
-
}).pipe(Category.withLockedError, Category.withRetryable()) {
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* InternalServerError - Server error.
|
|
85
|
-
*
|
|
86
|
-
* Mapped from HTTP 500 by default. Per-service patches may also pin it to a
|
|
87
|
-
* specific in-band error code/message combination (e.g. Cloudflare returns a
|
|
88
|
-
* 200 envelope carrying `{ code: 10002, message: "An unknown error has
|
|
89
|
-
* occurred" }` for transient backend failures on some endpoints).
|
|
90
|
-
*/
|
|
91
|
-
export class InternalServerError extends Schema.TaggedError()("InternalServerError", {
|
|
92
|
-
message: Schema.String,
|
|
93
|
-
code: Schema.optional(Schema.Number),
|
|
94
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
95
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* BadGateway - Bad gateway (502).
|
|
99
|
-
*/
|
|
100
|
-
export class BadGateway extends Schema.TaggedError()("BadGateway", {
|
|
101
|
-
message: Schema.String,
|
|
102
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
103
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* ServiceUnavailable - Service unavailable (503).
|
|
107
|
-
*/
|
|
108
|
-
export class ServiceUnavailable extends Schema.TaggedError()("ServiceUnavailable", {
|
|
109
|
-
message: Schema.String,
|
|
110
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
111
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* GatewayTimeout - HTTP request or gateway timeout (408, 504).
|
|
115
|
-
*/
|
|
116
|
-
export class GatewayTimeout extends Schema.TaggedError()("GatewayTimeout", {
|
|
117
|
-
message: Schema.String,
|
|
118
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
119
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Configuration error - missing or invalid configuration.
|
|
123
|
-
*/
|
|
124
|
-
export class ConfigError extends Schema.TaggedError()("ConfigError", {
|
|
125
|
-
message: Schema.String,
|
|
126
|
-
}).pipe(Category.withConfigurationError) {
|
|
127
|
-
}
|
|
128
|
-
// ============================================================================
|
|
129
|
-
// Error Maps
|
|
130
|
-
// ============================================================================
|
|
131
|
-
/**
|
|
132
|
-
* Mapping from HTTP status codes to common error classes.
|
|
133
|
-
*/
|
|
134
|
-
export const HTTP_STATUS_MAP = {
|
|
135
|
-
400: BadRequest,
|
|
136
|
-
401: Unauthorized,
|
|
137
|
-
403: Forbidden,
|
|
138
|
-
404: NotFound,
|
|
139
|
-
408: GatewayTimeout,
|
|
140
|
-
409: Conflict,
|
|
141
|
-
422: UnprocessableEntity,
|
|
142
|
-
423: Locked,
|
|
143
|
-
429: TooManyRequests,
|
|
144
|
-
500: InternalServerError,
|
|
145
|
-
502: BadGateway,
|
|
146
|
-
503: ServiceUnavailable,
|
|
147
|
-
504: GatewayTimeout,
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* HTTP status codes that are considered "default" errors (always present).
|
|
151
|
-
* These are excluded from per-operation error types since they're handled globally.
|
|
152
|
-
*/
|
|
153
|
-
export const DEFAULT_ERROR_STATUSES = new Set([401, 429, 500, 502, 503, 504]);
|
|
154
|
-
/**
|
|
155
|
-
* HTTP status codes whose corresponding error class in {@link HTTP_STATUS_MAP}
|
|
156
|
-
* declares a `retryAfter` field. The retry policy honors `error.retryAfter`
|
|
157
|
-
* with precedence over the default backoff for these.
|
|
158
|
-
*
|
|
159
|
-
* `matchError` implementations should only pass `retryAfter` into the
|
|
160
|
-
* constructor when the status is in this set; passing it on non-retryable
|
|
161
|
-
* classes (BadRequest/Unauthorized/etc.) would silently retain it as a
|
|
162
|
-
* stale field on the instance and pollute serialized output.
|
|
163
|
-
*/
|
|
164
|
-
export const RETRYABLE_HTTP_STATUSES = new Set([408, 423, 429, 500, 502, 503, 504]);
|
|
165
|
-
/**
|
|
166
|
-
* All common API error classes.
|
|
167
|
-
*/
|
|
168
|
-
export const API_ERRORS = [
|
|
169
|
-
Unauthorized,
|
|
170
|
-
Forbidden,
|
|
171
|
-
NotFound,
|
|
172
|
-
BadRequest,
|
|
173
|
-
Conflict,
|
|
174
|
-
UnprocessableEntity,
|
|
175
|
-
TooManyRequests,
|
|
176
|
-
Locked,
|
|
177
|
-
InternalServerError,
|
|
178
|
-
BadGateway,
|
|
179
|
-
ServiceUnavailable,
|
|
180
|
-
GatewayTimeout,
|
|
181
|
-
];
|
|
182
|
-
/**
|
|
183
|
-
* Default errors that apply to ALL operations.
|
|
184
|
-
* These are infrastructure-level errors that can occur regardless of the operation.
|
|
185
|
-
*/
|
|
186
|
-
export const DEFAULT_ERRORS = [
|
|
187
|
-
Unauthorized,
|
|
188
|
-
TooManyRequests,
|
|
189
|
-
InternalServerError,
|
|
190
|
-
BadGateway,
|
|
191
|
-
ServiceUnavailable,
|
|
192
|
-
GatewayTimeout,
|
|
193
|
-
];
|
|
194
|
-
export const RETRYABLE = "@distilled/errors/retryable";
|
|
195
|
-
//# sourceMappingURL=errors.js.map
|
|
1
|
+
export { errors$API_ERRORS as API_ERRORS, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$DEFAULT_ERROR_STATUSES as DEFAULT_ERROR_STATUSES, errors$DurationSchema as DurationSchema, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$Locked as Locked, errors$NotFound as NotFound, errors$RETRYABLE as RETRYABLE, errors$RETRYABLE_HTTP_STATUSES as RETRYABLE_HTTP_STATUSES, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/rest.js";
|
package/lib/graphql.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* GraphQL Query algebra
|
|
2
|
+
* GraphQL Query algebra -- the runtime generated GraphQL SDKs target.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* U+2500U+2500 Why this exists U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500
|
|
5
5
|
* A GraphQL document is a *selection*, not an RPC. Distilled used to bake a
|
|
6
6
|
* max-depth selection into every operation (`Railway.me({})` downloaded the
|
|
7
7
|
* world). This module instead treats every field as a lazy `Query<Value>`:
|
|
8
8
|
* reading `user.email` records that field, and nothing is posted until
|
|
9
9
|
* `Query.fn` evaluates the plan you returned.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* U+2500U+2500 The two phases U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500
|
|
12
12
|
* 1. Build (your function). `Railway.me()` / `user.email` / `Query.map` do
|
|
13
13
|
* not talk to the network. They construct an expression tree:
|
|
14
14
|
* Of | Map | Filter | FlatMap | Prop | Root
|
|
@@ -21,26 +21,26 @@
|
|
|
21
21
|
* against the JSON. Effects reached via FlatMap (e.g.
|
|
22
22
|
* `usernameIsAvailable(name)`) run *after* the POST, with real values.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
* - `Query.of(x)`
|
|
26
|
-
* - `Query.map` on a list
|
|
24
|
+
* U+2500U+2500 Combinators U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500
|
|
25
|
+
* - `Query.of(x)` -- a literal; never selected.
|
|
26
|
+
* - `Query.map` on a list -- callback receives `Query<Item>` so `p.name` is
|
|
27
27
|
* still a Query (selected). On a scalar, callback receives the value
|
|
28
28
|
* after extract (`stars => stars > 5`). Relay connections (`edges { node }`)
|
|
29
29
|
* are lists of the node type, so `projects({ first: 20 }).pipe(Query.map)`
|
|
30
30
|
* maps projects, not edges.
|
|
31
|
-
* - `Query.filter`
|
|
31
|
+
* - `Query.filter` -- predicate is `Query<Item> => Query<boolean>`; the
|
|
32
32
|
* boolean Query is walked for fields, then run per row after the POST.
|
|
33
|
-
* - `Query.flatMap`
|
|
34
|
-
* - `Query.pages` / `Query.items`
|
|
33
|
+
* - `Query.flatMap` -- after extract, run `(value) => Effect | Query`.
|
|
34
|
+
* - `Query.pages` / `Query.items` -- a Stream over every page / node of a
|
|
35
35
|
* Relay connection, one POST per page (see "Pagination").
|
|
36
36
|
*
|
|
37
|
-
*
|
|
37
|
+
* U+2500U+2500 Types U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500
|
|
38
38
|
* `Query<Value>` is `QueryNode<Value>` plus the GraphQL fields of `Value`,
|
|
39
39
|
* so `user.name` type-checks. That copy is a circular type alias
|
|
40
40
|
* (`Query<User>` contains `Query<Project[]>` which contains `Query<User>`
|
|
41
41
|
* again). TypeScript leaves the cycle lazy; there is no depth cap.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
43
|
+
* U+2500U+2500 Transport U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500U+2500
|
|
44
44
|
* {@link GqlTransport.execute} posts `{ query, variables, operationName }`.
|
|
45
45
|
* The Effect it returns may require Credentials / HttpClient; those leak
|
|
46
46
|
* into `Query.fn`'s requirements. It returns the parsed `data` and raw
|
|
@@ -109,14 +109,15 @@ declare const UnknownGraphQLError_base: S.Class<UnknownGraphQLError, S.TaggedStr
|
|
|
109
109
|
readonly coordinate: S.optional<S.String>;
|
|
110
110
|
}>, import("effect/Cause").YieldableError>;
|
|
111
111
|
/** A GraphQL error no declared matcher recognizes. */
|
|
112
|
-
export declare class UnknownGraphQLError extends UnknownGraphQLError_base {
|
|
112
|
+
export declare class UnknownGraphQLError extends /*@__PURE__*/ UnknownGraphQLError_base {
|
|
113
113
|
}
|
|
114
114
|
declare const GraphQLFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
115
115
|
readonly _tag: "GraphQLFailure";
|
|
116
116
|
} & Readonly<A>;
|
|
117
117
|
/** One response carried errors with different tags; none is hidden. */
|
|
118
|
-
export declare class GraphQLFailure<E extends GraphQLIssue = GraphQLIssue> extends GraphQLFailure_base<{
|
|
118
|
+
export declare class GraphQLFailure<E extends GraphQLIssue = GraphQLIssue> extends /*@__PURE__*/ GraphQLFailure_base<{
|
|
119
119
|
readonly errors: readonly [E, ...E[]];
|
|
120
|
+
/** The partial response data, with sensitive fields wrapped in `Redacted`. */
|
|
120
121
|
readonly data: unknown;
|
|
121
122
|
readonly status?: number;
|
|
122
123
|
}> {
|
|
@@ -126,7 +127,7 @@ declare const GraphQLTransportError_base: new <A extends Record<string, any> = {
|
|
|
126
127
|
readonly _tag: "GraphQLTransportError";
|
|
127
128
|
} & Readonly<A>;
|
|
128
129
|
/** The request never produced a GraphQL response (network, HTTP, non-JSON). */
|
|
129
|
-
export declare class GraphQLTransportError extends GraphQLTransportError_base<{
|
|
130
|
+
export declare class GraphQLTransportError extends /*@__PURE__*/ GraphQLTransportError_base<{
|
|
130
131
|
readonly message: string;
|
|
131
132
|
readonly status?: number;
|
|
132
133
|
/** Server retry hint in seconds. */
|
|
@@ -138,7 +139,7 @@ declare const GraphQLPaginationError_base: new <A extends Record<string, any> =
|
|
|
138
139
|
readonly _tag: "GraphQLPaginationError";
|
|
139
140
|
} & Readonly<A>;
|
|
140
141
|
/** A paginated connection reported more pages without a new cursor. */
|
|
141
|
-
export declare class GraphQLPaginationError extends GraphQLPaginationError_base<{
|
|
142
|
+
export declare class GraphQLPaginationError extends /*@__PURE__*/ GraphQLPaginationError_base<{
|
|
142
143
|
readonly message: string;
|
|
143
144
|
readonly cursor: string | null;
|
|
144
145
|
}> {
|
|
@@ -187,12 +188,16 @@ export type FieldMeta = {
|
|
|
187
188
|
readonly kind: "scalar" | "object" | "list" | "connection";
|
|
188
189
|
readonly of?: TypeMeta;
|
|
189
190
|
readonly argTypes?: ArgMeta;
|
|
191
|
+
/** The value is a secret: extracted strings are wrapped in `Redacted`. */
|
|
192
|
+
readonly sensitive?: boolean;
|
|
190
193
|
};
|
|
191
194
|
export type TypeMeta = {
|
|
192
195
|
readonly name: string;
|
|
193
196
|
readonly fields: Record<string, FieldMeta>;
|
|
194
197
|
};
|
|
195
|
-
export declare const scalarField: (name: string
|
|
198
|
+
export declare const scalarField: (name: string, options?: {
|
|
199
|
+
readonly sensitive?: boolean;
|
|
200
|
+
}) => FieldMeta;
|
|
196
201
|
export declare const objectField: (name: string, objectType: TypeMeta) => FieldMeta;
|
|
197
202
|
export declare const listField: (name: string, itemType: TypeMeta, argTypes?: ArgMeta) => FieldMeta;
|
|
198
203
|
/** Relay connection: GraphQL `edges { node }` presented as `Query<Item[]>`. */
|
|
@@ -213,6 +218,8 @@ export interface SelNode {
|
|
|
213
218
|
children: Map<string, SelNode>;
|
|
214
219
|
isScalar: boolean;
|
|
215
220
|
isList: boolean;
|
|
221
|
+
/** The value is a secret: its strings are wrapped in `Redacted`. */
|
|
222
|
+
sensitive?: boolean;
|
|
216
223
|
}
|
|
217
224
|
export interface CompiledOperation {
|
|
218
225
|
readonly document: string;
|
|
@@ -224,12 +231,12 @@ export interface CompiledOperation {
|
|
|
224
231
|
declare const GqlTransport_base: Context.ServiceClass<GqlTransport, "@distilled.cloud/graphql/Transport", {
|
|
225
232
|
readonly execute: (req: CompiledOperation) => Effect.Effect<GraphQLResponse, GraphQLTransportError, any>;
|
|
226
233
|
}>;
|
|
227
|
-
export declare class GqlTransport extends GqlTransport_base {
|
|
234
|
+
export declare class GqlTransport extends /*@__PURE__*/ GqlTransport_base {
|
|
228
235
|
}
|
|
229
236
|
/**
|
|
230
237
|
* GraphQL fields copied onto a Query so `user.name` type-checks.
|
|
231
238
|
* `Query<User>` contains `projects: Query<Project[]>`, which contains
|
|
232
|
-
* `owner: Query<User>` again
|
|
239
|
+
* `owner: Query<User>` again -- TypeScript leaves the cycle lazy. Fields
|
|
233
240
|
* inherit the errors of the root they were read from.
|
|
234
241
|
*/
|
|
235
242
|
type QueryFields<Value, Error> = [NonNullable<Value>] extends [ReadonlyArray<infer Item>] ? {
|
|
@@ -268,6 +275,8 @@ type RootExpr = {
|
|
|
268
275
|
readonly connection?: boolean;
|
|
269
276
|
/** Errors this root field can return, including global errors. */
|
|
270
277
|
readonly errors: ReadonlyArray<ErrorSpec>;
|
|
278
|
+
/** Leaf root whose value is a secret: extracted strings are wrapped in `Redacted`. */
|
|
279
|
+
readonly sensitive?: boolean;
|
|
271
280
|
};
|
|
272
281
|
type PropExpr = {
|
|
273
282
|
readonly _tag: "Prop";
|
|
@@ -336,7 +345,9 @@ export declare const rootList: <Item, Error = never>(op: "query" | "mutation", f
|
|
|
336
345
|
/** Root Relay connection: typed as `Query<Item[]>`, document uses `edges { node }`. */
|
|
337
346
|
export declare const rootConnection: <Item, Error = never>(op: "query" | "mutation", field: string, meta: TypeMeta, args?: Record<string, unknown>, argTypes?: ArgMeta, errors?: ReadonlyArray<ErrorSpec>) => Query<ReadonlyArray<Item>, Error>;
|
|
338
347
|
/** Root field whose GraphQL type is a scalar, enum, or list of those. */
|
|
339
|
-
export declare const rootLeaf: <Value, Error = never>(op: "query" | "mutation", field: string, list: boolean, args?: Record<string, unknown>, argTypes?: ArgMeta, errors?: ReadonlyArray<ErrorSpec
|
|
348
|
+
export declare const rootLeaf: <Value, Error = never>(op: "query" | "mutation", field: string, list: boolean, args?: Record<string, unknown>, argTypes?: ArgMeta, errors?: ReadonlyArray<ErrorSpec>, options?: {
|
|
349
|
+
readonly sensitive?: boolean;
|
|
350
|
+
}) => Query<Value, Error>;
|
|
340
351
|
/** `Query.of` / pure. */
|
|
341
352
|
export declare const ofQuery: <Value>(value: Value) => Query<Value>;
|
|
342
353
|
export declare function filterQuery<Item, Error = never>(predicate: (item: Query<Item>) => QueryNode<boolean, any>): (source: QueryNode<readonly Item[] | null, Error>) => Query<readonly Item[], Error>;
|
|
@@ -353,7 +364,7 @@ export declare function mapQuery<Value, Mapped, Error = never>(source: QueryNode
|
|
|
353
364
|
export declare function flatMapQuery<Value, Result, Error, Requirements, SourceError = never>(flatMapFn: (value: Value) => Effect.Effect<Result, Error, Requirements> | QueryNode<Result, Error>): (source: QueryNode<Value, SourceError>) => Query<Result, SourceError | Error>;
|
|
354
365
|
export declare function flatMapQuery<Value, Result, Error, Requirements, SourceError = never>(source: QueryNode<Value, SourceError>, flatMapFn: (value: Value) => Effect.Effect<Result, Error, Requirements> | QueryNode<Result, Error>): Query<Result, SourceError | Error>;
|
|
355
366
|
/**
|
|
356
|
-
* Builder
|
|
367
|
+
* Builder -> Effect. The inner function is *not* a generator; it returns a
|
|
357
368
|
* plan of Query/Effect values. Query.fn visits the plan, POSTs one document,
|
|
358
369
|
* then interprets Map/Filter/FlatMap/Of.
|
|
359
370
|
*/
|