@distilled.cloud/core 1.0.0-rc.2 → 1.0.0-rc.21
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/LICENSE +201 -0
- package/README.md +33 -0
- 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/grpc.js +3 -0
- package/lib/_bundle/grpc.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/annotations.d.ts +17 -0
- package/lib/annotations.d.ts.map +1 -0
- package/lib/annotations.js +2 -0
- package/lib/annotations.js.map +1 -0
- package/lib/api.d.ts +220 -51
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +1 -178
- package/lib/category.d.ts +19 -16
- package/lib/category.d.ts.map +1 -1
- package/lib/category.js +1 -280
- package/lib/chunks.d.ts +3 -0
- package/lib/chunks.d.ts.map +1 -0
- package/lib/chunks.js +1 -0
- package/lib/config.d.ts +81 -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/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 +99 -74
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -186
- package/lib/graphql.d.ts +420 -0
- package/lib/graphql.d.ts.map +1 -0
- package/lib/graphql.js +1 -0
- package/lib/graphql.types.d.ts +11 -0
- package/lib/graphql.types.d.ts.map +1 -0
- package/lib/graphql.types.js +1 -0
- package/lib/grpc-transport-cloudflare-http2.d.ts +7 -0
- package/lib/grpc-transport-cloudflare-http2.d.ts.map +1 -0
- package/lib/grpc-transport-cloudflare-http2.js +6 -0
- package/lib/grpc-transport-cloudflare-http2.js.map +1 -0
- package/lib/grpc-transport-cloudflare-sockets.d.ts +7 -0
- package/lib/grpc-transport-cloudflare-sockets.d.ts.map +1 -0
- package/lib/grpc-transport-cloudflare-sockets.js +5 -0
- package/lib/grpc-transport-cloudflare-sockets.js.map +1 -0
- package/lib/grpc-transport-node-http2.d.ts +19 -0
- package/lib/grpc-transport-node-http2.d.ts.map +1 -0
- package/lib/grpc-transport-node-http2.js +2 -0
- package/lib/grpc-transport-node-http2.js.map +1 -0
- package/lib/grpc-transport.d.ts +111 -0
- package/lib/grpc-transport.d.ts.map +1 -0
- package/lib/grpc-transport.js +1 -0
- package/lib/hpack.d.ts +34 -0
- package/lib/hpack.d.ts.map +1 -0
- package/lib/hpack.js +2 -0
- package/lib/hpack.js.map +1 -0
- package/lib/index.d.ts +32 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +17 -0
- package/lib/max-message-bytes.d.ts +42 -0
- package/lib/max-message-bytes.d.ts.map +1 -0
- package/lib/max-message-bytes.js +2 -0
- package/lib/max-message-bytes.js.map +1 -0
- package/lib/ndjson.d.ts +3 -0
- package/lib/ndjson.d.ts.map +1 -0
- package/lib/ndjson.js +2 -0
- package/lib/ndjson.js.map +1 -0
- package/lib/pagination.d.ts +105 -25
- package/lib/pagination.d.ts.map +1 -1
- package/lib/pagination.js +1 -182
- package/lib/plain-values.d.ts +21 -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/protobuf.d.ts +85 -0
- package/lib/protobuf.d.ts.map +1 -0
- package/lib/protobuf.js +1 -0
- package/lib/protocol-grpc.d.ts +123 -0
- package/lib/protocol-grpc.d.ts.map +1 -0
- package/lib/protocol-grpc.js +1 -0
- package/lib/protocol-http.d.ts +206 -25
- package/lib/protocol-http.d.ts.map +1 -1
- package/lib/protocol-http.js +1 -554
- package/lib/protocol-rest.d.ts +258 -64
- package/lib/protocol-rest.d.ts.map +1 -1
- package/lib/protocol-rest.js +1 -242
- package/lib/protocol.d.ts +113 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +0 -0
- package/lib/query.d.ts +29 -0
- package/lib/query.d.ts.map +1 -0
- package/lib/query.js +1 -0
- 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 +86 -0
- package/lib/response-validation.d.ts.map +1 -0
- package/lib/response-validation.js +1 -0
- package/lib/retry-after.d.ts +4 -4
- package/lib/retry-after.d.ts.map +1 -1
- package/lib/retry-after.js +1 -112
- package/lib/retry-state.d.ts +26 -0
- package/lib/retry-state.d.ts.map +1 -0
- package/lib/retry-state.js +2 -0
- package/lib/retry-state.js.map +1 -0
- package/lib/retry.d.ts +141 -42
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +1 -210
- package/lib/schema-lite-impl.d.ts +179 -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 +1 -0
- package/lib/schema-lite.d.ts +41 -0
- package/lib/schema-lite.d.ts.map +1 -0
- package/lib/schema-lite.js +1 -0
- package/lib/schema.d.ts +21 -7
- package/lib/schema.d.ts.map +1 -1
- package/lib/schema.js +1 -48
- package/lib/sdk-error.d.ts +31 -0
- package/lib/sdk-error.d.ts.map +1 -0
- package/lib/sdk-error.js +1 -0
- package/lib/send.d.ts +37 -0
- package/lib/send.d.ts.map +1 -0
- package/lib/send.js +2 -0
- package/lib/send.js.map +1 -0
- package/lib/sensitive.d.ts +28 -0
- package/lib/sensitive.d.ts.map +1 -0
- package/lib/sensitive.js +2 -0
- package/lib/sensitive.js.map +1 -0
- package/lib/telemetry-debug.d.ts +6 -0
- package/lib/telemetry-debug.d.ts.map +1 -0
- package/lib/telemetry-debug.js +2 -0
- package/lib/telemetry-debug.js.map +1 -0
- package/lib/telemetry-hooks.d.ts +32 -0
- package/lib/telemetry-hooks.d.ts.map +1 -0
- package/lib/telemetry-hooks.js +2 -0
- package/lib/telemetry-hooks.js.map +1 -0
- package/lib/telemetry-host-rules.d.ts +23 -0
- package/lib/telemetry-host-rules.d.ts.map +1 -0
- package/lib/telemetry-host-rules.js +2 -0
- package/lib/telemetry-host-rules.js.map +1 -0
- package/lib/telemetry-lambda-context.d.ts +17 -0
- package/lib/telemetry-lambda-context.d.ts.map +1 -0
- package/lib/telemetry-lambda-context.js +2 -0
- package/lib/telemetry-lambda-context.js.map +1 -0
- package/lib/telemetry-message-context.d.ts +52 -0
- package/lib/telemetry-message-context.d.ts.map +1 -0
- package/lib/telemetry-message-context.js +2 -0
- package/lib/telemetry-message-context.js.map +1 -0
- package/lib/telemetry-metrics.d.ts +6 -0
- package/lib/telemetry-metrics.d.ts.map +1 -0
- package/lib/telemetry-metrics.js +2 -0
- package/lib/telemetry-metrics.js.map +1 -0
- package/lib/telemetry-name-template.d.ts +13 -0
- package/lib/telemetry-name-template.d.ts.map +1 -0
- package/lib/telemetry-name-template.js +2 -0
- package/lib/telemetry-name-template.js.map +1 -0
- package/lib/telemetry-stream.d.ts +11 -0
- package/lib/telemetry-stream.d.ts.map +1 -0
- package/lib/telemetry-stream.js +2 -0
- package/lib/telemetry-stream.js.map +1 -0
- package/lib/telemetry-xray.d.ts +28 -0
- package/lib/telemetry-xray.d.ts.map +1 -0
- package/lib/telemetry-xray.js +2 -0
- package/lib/telemetry-xray.js.map +1 -0
- package/lib/telemetry.d.ts +317 -0
- package/lib/telemetry.d.ts.map +1 -0
- package/lib/telemetry.js +3 -0
- package/lib/telemetry.js.map +1 -0
- package/lib/token-cache.d.ts +31 -0
- package/lib/token-cache.d.ts.map +1 -0
- package/lib/token-cache.js +2 -0
- package/lib/token-cache.js.map +1 -0
- package/lib/trait.d.ts +94 -20
- package/lib/trait.d.ts.map +1 -1
- package/lib/trait.js +1 -107
- package/lib/unknown-error.d.ts +18 -0
- package/lib/unknown-error.d.ts.map +1 -0
- package/lib/unknown-error.js +1 -0
- package/lib/xml.d.ts +44 -0
- package/lib/xml.d.ts.map +1 -0
- package/lib/xml.js +1 -0
- package/package.json +13 -13
- package/src/annotations.ts +53 -0
- package/src/api.ts +1597 -234
- package/src/category.ts +97 -134
- package/src/chunks.ts +30 -0
- package/src/config.ts +261 -0
- package/src/crypto.ts +202 -0
- package/src/error-category.ts +16 -29
- package/src/errors.ts +99 -77
- package/src/graphql.ts +1817 -0
- package/src/graphql.types.ts +120 -0
- package/src/grpc-transport-cloudflare-http2.ts +569 -0
- package/src/grpc-transport-cloudflare-sockets.ts +368 -0
- package/src/grpc-transport-node-http2.ts +307 -0
- package/src/grpc-transport.ts +287 -0
- package/src/hpack.ts +331 -0
- package/src/index.ts +31 -0
- package/src/max-message-bytes.ts +58 -0
- package/src/ndjson.ts +55 -0
- package/src/pagination.ts +379 -94
- package/src/plain-values.ts +70 -0
- package/src/protobuf.ts +1367 -0
- package/src/protocol-grpc.ts +811 -0
- package/src/protocol-http.ts +1045 -371
- package/src/protocol-rest.ts +908 -255
- package/src/protocol.ts +150 -0
- package/src/query.ts +39 -0
- package/src/response-validation-strict.ts +333 -0
- package/src/response-validation.ts +161 -0
- package/src/retry-after.ts +8 -14
- package/src/retry-state.ts +105 -0
- package/src/retry.ts +260 -145
- package/src/schema-lite-impl.ts +621 -0
- package/src/schema-lite-typed.ts +44 -0
- package/src/schema-lite.ts +45 -0
- package/src/schema.ts +259 -15
- package/src/sdk-error.ts +37 -0
- package/src/send.ts +156 -0
- package/src/sensitive.ts +188 -0
- package/src/telemetry-debug.ts +179 -0
- package/src/telemetry-hooks.ts +33 -0
- package/src/telemetry-host-rules.ts +39 -0
- package/src/telemetry-lambda-context.ts +46 -0
- package/src/telemetry-message-context.ts +170 -0
- package/src/telemetry-metrics.ts +69 -0
- package/src/telemetry-name-template.ts +26 -0
- package/src/telemetry-stream.ts +100 -0
- package/src/telemetry-xray.ts +66 -0
- package/src/telemetry.ts +800 -0
- package/src/token-cache.ts +117 -0
- package/src/trait.ts +139 -67
- package/src/unknown-error.ts +38 -0
- package/src/xml.ts +346 -0
- package/lib/api.js.map +0 -1
- package/lib/category.js.map +0 -1
- package/lib/codegen/cli.d.ts +0 -29
- package/lib/codegen/cli.d.ts.map +0 -1
- package/lib/codegen/cli.js +0 -165
- package/lib/codegen/cli.js.map +0 -1
- package/lib/codegen/emit.d.ts +0 -129
- package/lib/codegen/emit.d.ts.map +0 -1
- package/lib/codegen/emit.js +0 -105
- package/lib/codegen/emit.js.map +0 -1
- package/lib/codegen/format.d.ts +0 -23
- package/lib/codegen/format.d.ts.map +0 -1
- package/lib/codegen/format.js +0 -28
- package/lib/codegen/format.js.map +0 -1
- package/lib/codegen/generator.d.ts +0 -334
- package/lib/codegen/generator.d.ts.map +0 -1
- package/lib/codegen/generator.js +0 -691
- package/lib/codegen/generator.js.map +0 -1
- package/lib/codegen/graph.d.ts +0 -36
- package/lib/codegen/graph.d.ts.map +0 -1
- package/lib/codegen/graph.js +0 -136
- package/lib/codegen/graph.js.map +0 -1
- package/lib/codegen/members.d.ts +0 -25
- package/lib/codegen/members.d.ts.map +0 -1
- package/lib/codegen/members.js +0 -55
- package/lib/codegen/members.js.map +0 -1
- package/lib/codegen/naming.d.ts +0 -29
- package/lib/codegen/naming.d.ts.map +0 -1
- package/lib/codegen/naming.js +0 -74
- package/lib/codegen/naming.js.map +0 -1
- package/lib/codegen/openapi-cli.d.ts +0 -38
- package/lib/codegen/openapi-cli.d.ts.map +0 -1
- package/lib/codegen/openapi-cli.js +0 -107
- package/lib/codegen/openapi-cli.js.map +0 -1
- package/lib/codegen/openapi.d.ts +0 -115
- package/lib/codegen/openapi.d.ts.map +0 -1
- package/lib/codegen/openapi.js +0 -1220
- package/lib/codegen/openapi.js.map +0 -1
- package/lib/codegen/operations.d.ts +0 -24
- package/lib/codegen/operations.d.ts.map +0 -1
- package/lib/codegen/operations.js +0 -56
- package/lib/codegen/operations.js.map +0 -1
- package/lib/codegen/pagination.d.ts +0 -39
- package/lib/codegen/pagination.d.ts.map +0 -1
- package/lib/codegen/pagination.js +0 -33
- package/lib/codegen/pagination.js.map +0 -1
- package/lib/codegen/prelude.d.ts +0 -15
- package/lib/codegen/prelude.d.ts.map +0 -1
- package/lib/codegen/prelude.js +0 -60
- package/lib/codegen/prelude.js.map +0 -1
- package/lib/error-category.js.map +0 -1
- package/lib/errors.js.map +0 -1
- package/lib/json-patch.d.ts +0 -44
- package/lib/json-patch.d.ts.map +0 -1
- package/lib/json-patch.js +0 -174
- package/lib/json-patch.js.map +0 -1
- package/lib/pagination.js.map +0 -1
- package/lib/protocol-http.js.map +0 -1
- package/lib/protocol-rest.js.map +0 -1
- package/lib/retry-after.js.map +0 -1
- package/lib/retry.js.map +0 -1
- package/lib/schema.js.map +0 -1
- package/lib/trait.js.map +0 -1
- package/src/codegen/cli.ts +0 -268
- package/src/codegen/emit.ts +0 -207
- package/src/codegen/format.ts +0 -47
- package/src/codegen/generator.ts +0 -1153
- package/src/codegen/graph.ts +0 -151
- package/src/codegen/members.ts +0 -71
- package/src/codegen/naming.ts +0 -86
- package/src/codegen/openapi-cli.ts +0 -166
- package/src/codegen/openapi.ts +0 -1450
- package/src/codegen/operations.ts +0 -76
- package/src/codegen/pagination.ts +0 -71
- package/src/codegen/prelude.ts +0 -70
- package/src/json-patch.ts +0 -222
package/lib/errors.d.ts
CHANGED
|
@@ -6,21 +6,32 @@
|
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
export declare const DurationSchema: import("effect/Schema").declare<Duration.Duration, Duration.Duration>;
|
|
21
|
+
/**
|
|
22
|
+
* Fields every error built from an HTTP response declares: the parsed body
|
|
23
|
+
* (the raw text when it wasn't JSON) and the response headers, for whatever
|
|
24
|
+
* the SDK does not type -- a request ID, nested details.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ResponseErrorFields: {
|
|
27
|
+
body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
28
|
+
headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
29
|
+
};
|
|
30
|
+
declare const Unauthorized_base: Schema.TaggedErrorClass<"Unauthorized", {
|
|
31
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
32
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
33
|
+
readonly message: import("effect/Schema").String;
|
|
34
|
+
}> & (new (...args: any[]) => {
|
|
24
35
|
"@distilled.cloud/error/categories": {
|
|
25
36
|
AuthError: true;
|
|
26
37
|
};
|
|
@@ -28,11 +39,13 @@ declare const Unauthorized_base: Schema.Class<Unauthorized, Schema.TaggedStruct<
|
|
|
28
39
|
/**
|
|
29
40
|
* Unauthorized - Authentication failure (401).
|
|
30
41
|
*/
|
|
31
|
-
export declare class Unauthorized extends Unauthorized_base {
|
|
42
|
+
export declare class Unauthorized extends /*@__PURE__*/ Unauthorized_base {
|
|
32
43
|
}
|
|
33
|
-
declare const Forbidden_base: Schema.
|
|
34
|
-
readonly
|
|
35
|
-
|
|
44
|
+
declare const Forbidden_base: Schema.TaggedErrorClass<"Forbidden", {
|
|
45
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
46
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
47
|
+
readonly message: import("effect/Schema").String;
|
|
48
|
+
}> & (new (...args: any[]) => {
|
|
36
49
|
"@distilled.cloud/error/categories": {
|
|
37
50
|
AuthError: true;
|
|
38
51
|
};
|
|
@@ -40,11 +53,13 @@ declare const Forbidden_base: Schema.Class<Forbidden, Schema.TaggedStruct<"Forbi
|
|
|
40
53
|
/**
|
|
41
54
|
* Forbidden - Access denied (403).
|
|
42
55
|
*/
|
|
43
|
-
export declare class Forbidden extends Forbidden_base {
|
|
56
|
+
export declare class Forbidden extends /*@__PURE__*/ Forbidden_base {
|
|
44
57
|
}
|
|
45
|
-
declare const NotFound_base: Schema.
|
|
46
|
-
readonly
|
|
47
|
-
|
|
58
|
+
declare const NotFound_base: Schema.TaggedErrorClass<"NotFound", {
|
|
59
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
60
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
61
|
+
readonly message: import("effect/Schema").String;
|
|
62
|
+
}> & (new (...args: any[]) => {
|
|
48
63
|
"@distilled.cloud/error/categories": {
|
|
49
64
|
NotFoundError: true;
|
|
50
65
|
};
|
|
@@ -52,11 +67,13 @@ declare const NotFound_base: Schema.Class<NotFound, Schema.TaggedStruct<"NotFoun
|
|
|
52
67
|
/**
|
|
53
68
|
* NotFound - Resource not found (404).
|
|
54
69
|
*/
|
|
55
|
-
export declare class NotFound extends NotFound_base {
|
|
70
|
+
export declare class NotFound extends /*@__PURE__*/ NotFound_base {
|
|
56
71
|
}
|
|
57
|
-
declare const BadRequest_base: Schema.
|
|
58
|
-
readonly
|
|
59
|
-
|
|
72
|
+
declare const BadRequest_base: Schema.TaggedErrorClass<"BadRequest", {
|
|
73
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
74
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
75
|
+
readonly message: import("effect/Schema").String;
|
|
76
|
+
}> & (new (...args: any[]) => {
|
|
60
77
|
"@distilled.cloud/error/categories": {
|
|
61
78
|
BadRequestError: true;
|
|
62
79
|
};
|
|
@@ -64,11 +81,13 @@ declare const BadRequest_base: Schema.Class<BadRequest, Schema.TaggedStruct<"Bad
|
|
|
64
81
|
/**
|
|
65
82
|
* BadRequest - Invalid request (400).
|
|
66
83
|
*/
|
|
67
|
-
export declare class BadRequest extends BadRequest_base {
|
|
84
|
+
export declare class BadRequest extends /*@__PURE__*/ BadRequest_base {
|
|
68
85
|
}
|
|
69
|
-
declare const Conflict_base: Schema.
|
|
70
|
-
readonly
|
|
71
|
-
|
|
86
|
+
declare const Conflict_base: Schema.TaggedErrorClass<"Conflict", {
|
|
87
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
88
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
89
|
+
readonly message: import("effect/Schema").String;
|
|
90
|
+
}> & (new (...args: any[]) => {
|
|
72
91
|
"@distilled.cloud/error/categories": {
|
|
73
92
|
ConflictError: true;
|
|
74
93
|
};
|
|
@@ -76,11 +95,13 @@ declare const Conflict_base: Schema.Class<Conflict, Schema.TaggedStruct<"Conflic
|
|
|
76
95
|
/**
|
|
77
96
|
* Conflict - Resource conflict (409).
|
|
78
97
|
*/
|
|
79
|
-
export declare class Conflict extends Conflict_base {
|
|
98
|
+
export declare class Conflict extends /*@__PURE__*/ Conflict_base {
|
|
80
99
|
}
|
|
81
|
-
declare const UnprocessableEntity_base: Schema.
|
|
82
|
-
readonly
|
|
83
|
-
|
|
100
|
+
declare const UnprocessableEntity_base: Schema.TaggedErrorClass<"UnprocessableEntity", {
|
|
101
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
102
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
103
|
+
readonly message: import("effect/Schema").String;
|
|
104
|
+
}> & (new (...args: any[]) => {
|
|
84
105
|
"@distilled.cloud/error/categories": {
|
|
85
106
|
BadRequestError: true;
|
|
86
107
|
};
|
|
@@ -88,12 +109,14 @@ declare const UnprocessableEntity_base: Schema.Class<UnprocessableEntity, Schema
|
|
|
88
109
|
/**
|
|
89
110
|
* UnprocessableEntity - Validation error (422).
|
|
90
111
|
*/
|
|
91
|
-
export declare class UnprocessableEntity extends UnprocessableEntity_base {
|
|
112
|
+
export declare class UnprocessableEntity extends /*@__PURE__*/ UnprocessableEntity_base {
|
|
92
113
|
}
|
|
93
|
-
declare const TooManyRequests_base: Schema.
|
|
94
|
-
readonly
|
|
95
|
-
readonly
|
|
96
|
-
|
|
114
|
+
declare const TooManyRequests_base: Schema.TaggedErrorClass<"TooManyRequests", {
|
|
115
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
116
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
117
|
+
readonly message: import("effect/Schema").String;
|
|
118
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
119
|
+
}> & (new (...args: any[]) => {
|
|
97
120
|
"@distilled.cloud/error/categories": {
|
|
98
121
|
ThrottlingError: true;
|
|
99
122
|
};
|
|
@@ -103,12 +126,14 @@ declare const TooManyRequests_base: Schema.Class<TooManyRequests, Schema.TaggedS
|
|
|
103
126
|
/**
|
|
104
127
|
* TooManyRequests - Rate limited (429).
|
|
105
128
|
*/
|
|
106
|
-
export declare class TooManyRequests extends TooManyRequests_base {
|
|
129
|
+
export declare class TooManyRequests extends /*@__PURE__*/ TooManyRequests_base {
|
|
107
130
|
}
|
|
108
|
-
declare const Locked_base: Schema.
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
111
|
-
|
|
131
|
+
declare const Locked_base: Schema.TaggedErrorClass<"Locked", {
|
|
132
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
133
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
134
|
+
readonly message: import("effect/Schema").String;
|
|
135
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
136
|
+
}> & (new (...args: any[]) => {
|
|
112
137
|
"@distilled.cloud/error/categories": {
|
|
113
138
|
LockedError: true;
|
|
114
139
|
};
|
|
@@ -118,13 +143,15 @@ declare const Locked_base: Schema.Class<Locked, Schema.TaggedStruct<"Locked", {
|
|
|
118
143
|
/**
|
|
119
144
|
* Locked - Resource locked (423).
|
|
120
145
|
*/
|
|
121
|
-
export declare class Locked extends Locked_base {
|
|
146
|
+
export declare class Locked extends /*@__PURE__*/ Locked_base {
|
|
122
147
|
}
|
|
123
|
-
declare const InternalServerError_base: Schema.
|
|
124
|
-
readonly
|
|
125
|
-
readonly
|
|
126
|
-
readonly
|
|
127
|
-
|
|
148
|
+
declare const InternalServerError_base: Schema.TaggedErrorClass<"InternalServerError", {
|
|
149
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
150
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
151
|
+
readonly message: import("effect/Schema").String;
|
|
152
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").Number>;
|
|
153
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
154
|
+
}> & (new (...args: any[]) => {
|
|
128
155
|
"@distilled.cloud/error/categories": {
|
|
129
156
|
ServerError: true;
|
|
130
157
|
};
|
|
@@ -139,12 +166,14 @@ declare const InternalServerError_base: Schema.Class<InternalServerError, Schema
|
|
|
139
166
|
* 200 envelope carrying `{ code: 10002, message: "An unknown error has
|
|
140
167
|
* occurred" }` for transient backend failures on some endpoints).
|
|
141
168
|
*/
|
|
142
|
-
export declare class InternalServerError extends InternalServerError_base {
|
|
169
|
+
export declare class InternalServerError extends /*@__PURE__*/ InternalServerError_base {
|
|
143
170
|
}
|
|
144
|
-
declare const BadGateway_base: Schema.
|
|
145
|
-
readonly
|
|
146
|
-
readonly
|
|
147
|
-
|
|
171
|
+
declare const BadGateway_base: Schema.TaggedErrorClass<"BadGateway", {
|
|
172
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
173
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
174
|
+
readonly message: import("effect/Schema").String;
|
|
175
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
176
|
+
}> & (new (...args: any[]) => {
|
|
148
177
|
"@distilled.cloud/error/categories": {
|
|
149
178
|
ServerError: true;
|
|
150
179
|
};
|
|
@@ -154,12 +183,14 @@ declare const BadGateway_base: Schema.Class<BadGateway, Schema.TaggedStruct<"Bad
|
|
|
154
183
|
/**
|
|
155
184
|
* BadGateway - Bad gateway (502).
|
|
156
185
|
*/
|
|
157
|
-
export declare class BadGateway extends BadGateway_base {
|
|
186
|
+
export declare class BadGateway extends /*@__PURE__*/ BadGateway_base {
|
|
158
187
|
}
|
|
159
|
-
declare const ServiceUnavailable_base: Schema.
|
|
160
|
-
readonly
|
|
161
|
-
readonly
|
|
162
|
-
|
|
188
|
+
declare const ServiceUnavailable_base: Schema.TaggedErrorClass<"ServiceUnavailable", {
|
|
189
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
190
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
191
|
+
readonly message: import("effect/Schema").String;
|
|
192
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
193
|
+
}> & (new (...args: any[]) => {
|
|
163
194
|
"@distilled.cloud/error/categories": {
|
|
164
195
|
ServerError: true;
|
|
165
196
|
};
|
|
@@ -169,12 +200,14 @@ declare const ServiceUnavailable_base: Schema.Class<ServiceUnavailable, Schema.T
|
|
|
169
200
|
/**
|
|
170
201
|
* ServiceUnavailable - Service unavailable (503).
|
|
171
202
|
*/
|
|
172
|
-
export declare class ServiceUnavailable extends ServiceUnavailable_base {
|
|
203
|
+
export declare class ServiceUnavailable extends /*@__PURE__*/ ServiceUnavailable_base {
|
|
173
204
|
}
|
|
174
|
-
declare const GatewayTimeout_base: Schema.
|
|
175
|
-
readonly
|
|
176
|
-
readonly
|
|
177
|
-
|
|
205
|
+
declare const GatewayTimeout_base: Schema.TaggedErrorClass<"GatewayTimeout", {
|
|
206
|
+
readonly body: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
207
|
+
readonly headers: import("effect/Schema").optional<Schema.$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
208
|
+
readonly message: import("effect/Schema").String;
|
|
209
|
+
readonly retryAfter: import("effect/Schema").optional<import("effect/Schema").declare<Duration.Duration, Duration.Duration>>;
|
|
210
|
+
}> & (new (...args: any[]) => {
|
|
178
211
|
"@distilled.cloud/error/categories": {
|
|
179
212
|
ServerError: true;
|
|
180
213
|
};
|
|
@@ -182,22 +215,14 @@ declare const GatewayTimeout_base: Schema.Class<GatewayTimeout, Schema.TaggedStr
|
|
|
182
215
|
"@distilled.cloud/error/retryable": Category.RetryableInfo;
|
|
183
216
|
});
|
|
184
217
|
/**
|
|
185
|
-
* GatewayTimeout -
|
|
186
|
-
*/
|
|
187
|
-
export declare class GatewayTimeout extends GatewayTimeout_base {
|
|
188
|
-
}
|
|
189
|
-
declare const ConfigError_base: Schema.Class<ConfigError, Schema.TaggedStruct<"ConfigError", {
|
|
190
|
-
readonly message: Schema.String;
|
|
191
|
-
}>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
|
|
192
|
-
"@distilled.cloud/error/categories": {
|
|
193
|
-
ConfigurationError: true;
|
|
194
|
-
};
|
|
195
|
-
});
|
|
196
|
-
/**
|
|
197
|
-
* Configuration error - missing or invalid configuration.
|
|
218
|
+
* GatewayTimeout - HTTP request or gateway timeout (408, 504).
|
|
198
219
|
*/
|
|
199
|
-
export declare class
|
|
220
|
+
export declare class GatewayTimeout extends /*@__PURE__*/ GatewayTimeout_base {
|
|
200
221
|
}
|
|
222
|
+
export { ConfigError } from "./config.ts";
|
|
223
|
+
export { InvalidInput } from "./protocol-http.ts";
|
|
224
|
+
export { SdkError } from "./sdk-error.ts";
|
|
225
|
+
export { UnknownErrorFields, type UnknownErrorProps } from "./unknown-error.ts";
|
|
201
226
|
/**
|
|
202
227
|
* Mapping from HTTP status codes to common error classes.
|
|
203
228
|
*/
|
|
@@ -206,6 +231,7 @@ export declare const HTTP_STATUS_MAP: {
|
|
|
206
231
|
readonly 401: typeof Unauthorized;
|
|
207
232
|
readonly 403: typeof Forbidden;
|
|
208
233
|
readonly 404: typeof NotFound;
|
|
234
|
+
readonly 408: typeof GatewayTimeout;
|
|
209
235
|
readonly 409: typeof Conflict;
|
|
210
236
|
readonly 422: typeof UnprocessableEntity;
|
|
211
237
|
readonly 423: typeof Locked;
|
|
@@ -222,8 +248,8 @@ export declare const HTTP_STATUS_MAP: {
|
|
|
222
248
|
export declare const DEFAULT_ERROR_STATUSES: Set<number>;
|
|
223
249
|
/**
|
|
224
250
|
* HTTP status codes whose corresponding error class in {@link HTTP_STATUS_MAP}
|
|
225
|
-
* declares a `retryAfter` field. The retry policy
|
|
226
|
-
*
|
|
251
|
+
* declares a `retryAfter` field. The retry policy waits at least
|
|
252
|
+
* `error.retryAfter` for these.
|
|
227
253
|
*
|
|
228
254
|
* `matchError` implementations should only pass `retryAfter` into the
|
|
229
255
|
* constructor when the status is in this set; passing it on non-retryable
|
|
@@ -242,5 +268,4 @@ export declare const API_ERRORS: readonly [typeof Unauthorized, typeof Forbidden
|
|
|
242
268
|
export declare const DEFAULT_ERRORS: readonly [typeof Unauthorized, typeof TooManyRequests, typeof InternalServerError, typeof BadGateway, typeof ServiceUnavailable, typeof GatewayTimeout];
|
|
243
269
|
export type DefaultErrors = InstanceType<(typeof DEFAULT_ERRORS)[number]>;
|
|
244
270
|
export declare const RETRYABLE: "@distilled/errors/retryable";
|
|
245
|
-
export {};
|
|
246
271
|
//# sourceMappingURL=errors.d.ts.map
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","
|
|
1
|
+
{"version":3,"file":"errors.d.ts","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;AAEnG;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC9B,IAAI;IACJ,OAAO;CACR,CAAC;;;;;;;;;;AAMF;;GAEG;AACH,qBAAa,YACX,SAAQ,aAAa,CAAC,iBAGS;CAAG;;;;;;;;;;AAEpC;;GAEG;AACH,qBAAa,SACX,SAAQ,aAAa,CAAC,cAGS;CAAG;;;;;;;;;;AAEpC;;GAEG;AACH,qBAAa,QACX,SAAQ,aAAa,CAAC,aAGa;CAAG;;;;;;;;;;AAExC;;GAEG;AACH,qBAAa,UACX,SAAQ,aAAa,CAAC,eAGe;CAAG;;;;;;;;;;AAE1C;;GAEG;AACH,qBAAa,QACX,SAAQ,aAAa,CAAC,aAGa;CAAG;;;;;;;;;;AAExC;;GAEG;AACH,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAGe;CAAG;;;;;;;;;;;;;AAE1C;;GAEG;AACH,qBAAa,eACX,SAAQ,aAAa,CAAC,oBAOrB;CAAG;;;;;;;;;;;;;AAEN;;GAEG;AACH,qBAAa,MACX,SAAQ,aAAa,CAAC,WAImD;CAAG;;;;;;;;;;;;;;AAE9E;;;;;;;GAOG;AACH,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAKmD;CAAG;;;;;;;;;;;;;AAE9E;;GAEG;AACH,qBAAa,UACX,SAAQ,aAAa,CAAC,eAImD;CAAG;;;;;;;;;;;;;AAE9E;;GAEG;AACH,qBAAa,kBACX,SAAQ,aAAa,CAAC,uBAImD;CAAG;;;;;;;;;;;;;AAE9E;;GAEG;AACH,qBAAa,cACX,SAAQ,aAAa,CAAC,mBAImD;CAAG;AAI9E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,OAAO,EAAE,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAMhF;;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,186 +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.TaggedErrorClass()("Unauthorized", { message: Schema.String }).pipe(Category.withAuthError) {
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Forbidden - Access denied (403).
|
|
34
|
-
*/
|
|
35
|
-
export class Forbidden extends Schema.TaggedErrorClass()("Forbidden", { message: Schema.String }).pipe(Category.withAuthError) {
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* NotFound - Resource not found (404).
|
|
39
|
-
*/
|
|
40
|
-
export class NotFound extends Schema.TaggedErrorClass()("NotFound", {
|
|
41
|
-
message: Schema.String,
|
|
42
|
-
}).pipe(Category.withNotFoundError) {
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* BadRequest - Invalid request (400).
|
|
46
|
-
*/
|
|
47
|
-
export class BadRequest extends Schema.TaggedErrorClass()("BadRequest", { message: Schema.String }).pipe(Category.withBadRequestError) {
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Conflict - Resource conflict (409).
|
|
51
|
-
*/
|
|
52
|
-
export class Conflict extends Schema.TaggedErrorClass()("Conflict", {
|
|
53
|
-
message: Schema.String,
|
|
54
|
-
}).pipe(Category.withConflictError) {
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* UnprocessableEntity - Validation error (422).
|
|
58
|
-
*/
|
|
59
|
-
export class UnprocessableEntity extends Schema.TaggedErrorClass()("UnprocessableEntity", { message: Schema.String }).pipe(Category.withBadRequestError) {
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* TooManyRequests - Rate limited (429).
|
|
63
|
-
*/
|
|
64
|
-
export class TooManyRequests extends Schema.TaggedErrorClass()("TooManyRequests", {
|
|
65
|
-
message: Schema.String,
|
|
66
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
67
|
-
}).pipe(Category.withThrottlingError, Category.withRetryable({ throttling: true })) {
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Locked - Resource locked (423).
|
|
71
|
-
*/
|
|
72
|
-
export class Locked extends Schema.TaggedErrorClass()("Locked", {
|
|
73
|
-
message: Schema.String,
|
|
74
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
75
|
-
}).pipe(Category.withLockedError, Category.withRetryable()) {
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* InternalServerError - Server error.
|
|
79
|
-
*
|
|
80
|
-
* Mapped from HTTP 500 by default. Per-service patches may also pin it to a
|
|
81
|
-
* specific in-band error code/message combination (e.g. Cloudflare returns a
|
|
82
|
-
* 200 envelope carrying `{ code: 10002, message: "An unknown error has
|
|
83
|
-
* occurred" }` for transient backend failures on some endpoints).
|
|
84
|
-
*/
|
|
85
|
-
export class InternalServerError extends Schema.TaggedErrorClass()("InternalServerError", {
|
|
86
|
-
message: Schema.String,
|
|
87
|
-
code: Schema.optional(Schema.Number),
|
|
88
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
89
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* BadGateway - Bad gateway (502).
|
|
93
|
-
*/
|
|
94
|
-
export class BadGateway extends Schema.TaggedErrorClass()("BadGateway", {
|
|
95
|
-
message: Schema.String,
|
|
96
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
97
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* ServiceUnavailable - Service unavailable (503).
|
|
101
|
-
*/
|
|
102
|
-
export class ServiceUnavailable extends Schema.TaggedErrorClass()("ServiceUnavailable", {
|
|
103
|
-
message: Schema.String,
|
|
104
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
105
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* GatewayTimeout - Gateway timeout (504).
|
|
109
|
-
*/
|
|
110
|
-
export class GatewayTimeout extends Schema.TaggedErrorClass()("GatewayTimeout", {
|
|
111
|
-
message: Schema.String,
|
|
112
|
-
retryAfter: Schema.optional(DurationSchema),
|
|
113
|
-
}).pipe(Category.withServerError, Category.withRetryable()) {
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Configuration error - missing or invalid configuration.
|
|
117
|
-
*/
|
|
118
|
-
export class ConfigError extends Schema.TaggedErrorClass()("ConfigError", { message: Schema.String }).pipe(Category.withConfigurationError) {
|
|
119
|
-
}
|
|
120
|
-
// ============================================================================
|
|
121
|
-
// Error Maps
|
|
122
|
-
// ============================================================================
|
|
123
|
-
/**
|
|
124
|
-
* Mapping from HTTP status codes to common error classes.
|
|
125
|
-
*/
|
|
126
|
-
export const HTTP_STATUS_MAP = {
|
|
127
|
-
400: BadRequest,
|
|
128
|
-
401: Unauthorized,
|
|
129
|
-
403: Forbidden,
|
|
130
|
-
404: NotFound,
|
|
131
|
-
409: Conflict,
|
|
132
|
-
422: UnprocessableEntity,
|
|
133
|
-
423: Locked,
|
|
134
|
-
429: TooManyRequests,
|
|
135
|
-
500: InternalServerError,
|
|
136
|
-
502: BadGateway,
|
|
137
|
-
503: ServiceUnavailable,
|
|
138
|
-
504: GatewayTimeout,
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* HTTP status codes that are considered "default" errors (always present).
|
|
142
|
-
* These are excluded from per-operation error types since they're handled globally.
|
|
143
|
-
*/
|
|
144
|
-
export const DEFAULT_ERROR_STATUSES = new Set([401, 429, 500, 502, 503, 504]);
|
|
145
|
-
/**
|
|
146
|
-
* HTTP status codes whose corresponding error class in {@link HTTP_STATUS_MAP}
|
|
147
|
-
* declares a `retryAfter` field. The retry policy honors `error.retryAfter`
|
|
148
|
-
* with precedence over the default backoff for these.
|
|
149
|
-
*
|
|
150
|
-
* `matchError` implementations should only pass `retryAfter` into the
|
|
151
|
-
* constructor when the status is in this set; passing it on non-retryable
|
|
152
|
-
* classes (BadRequest/Unauthorized/etc.) would silently retain it as a
|
|
153
|
-
* stale field on the instance and pollute serialized output.
|
|
154
|
-
*/
|
|
155
|
-
export const RETRYABLE_HTTP_STATUSES = new Set([423, 429, 500, 502, 503, 504]);
|
|
156
|
-
/**
|
|
157
|
-
* All common API error classes.
|
|
158
|
-
*/
|
|
159
|
-
export const API_ERRORS = [
|
|
160
|
-
Unauthorized,
|
|
161
|
-
Forbidden,
|
|
162
|
-
NotFound,
|
|
163
|
-
BadRequest,
|
|
164
|
-
Conflict,
|
|
165
|
-
UnprocessableEntity,
|
|
166
|
-
TooManyRequests,
|
|
167
|
-
Locked,
|
|
168
|
-
InternalServerError,
|
|
169
|
-
BadGateway,
|
|
170
|
-
ServiceUnavailable,
|
|
171
|
-
GatewayTimeout,
|
|
172
|
-
];
|
|
173
|
-
/**
|
|
174
|
-
* Default errors that apply to ALL operations.
|
|
175
|
-
* These are infrastructure-level errors that can occur regardless of the operation.
|
|
176
|
-
*/
|
|
177
|
-
export const DEFAULT_ERRORS = [
|
|
178
|
-
Unauthorized,
|
|
179
|
-
TooManyRequests,
|
|
180
|
-
InternalServerError,
|
|
181
|
-
BadGateway,
|
|
182
|
-
ServiceUnavailable,
|
|
183
|
-
GatewayTimeout,
|
|
184
|
-
];
|
|
185
|
-
export const RETRYABLE = "@distilled/errors/retryable";
|
|
186
|
-
//# 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$InvalidInput as InvalidInput, errors$Locked as Locked, errors$NotFound as NotFound, errors$RETRYABLE as RETRYABLE, errors$RETRYABLE_HTTP_STATUSES as RETRYABLE_HTTP_STATUSES, errors$ResponseErrorFields as ResponseErrorFields, errors$SdkError as SdkError, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownErrorFields as UnknownErrorFields, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/rest.js";
|