@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/retry.d.ts
CHANGED
|
@@ -1,11 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry Policy System
|
|
3
|
+
*
|
|
4
|
+
* Provides configurable retry policies for API operations.
|
|
5
|
+
* Each SDK creates its own `Retry` Context.Service tag (via
|
|
6
|
+
* `makeRetryService`) and threads it into `makeAPI({ retry: <SDK>.Retry })`
|
|
7
|
+
* so that callers can install a blanket retry policy at the layer level
|
|
8
|
+
* for that SDK without wrapping every call with `Effect.retry`.
|
|
9
|
+
*/
|
|
1
10
|
import * as Context from "effect/Context";
|
|
2
11
|
import * as Duration from "effect/Duration";
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
3
13
|
import * as Layer from "effect/Layer";
|
|
4
14
|
import * as Ref from "effect/Ref";
|
|
5
15
|
import * as Schedule from "effect/Schedule";
|
|
6
16
|
/**
|
|
7
17
|
* Retry policy options that match the Effect.retry contract.
|
|
8
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* Capped exponential backoff, as plain data: the built-in policies use this
|
|
21
|
+
* instead of an Effect `Schedule`, so bundles do not carry the Schedule
|
|
22
|
+
* machinery unless a caller supplies a schedule of their own.
|
|
23
|
+
*
|
|
24
|
+
* Delay before retry `n` (0-based), `t`:
|
|
25
|
+
*
|
|
26
|
+
* - with `fullJitter`: `random(0, 1) × min(capMs, base × factor^n)`, where
|
|
27
|
+
* `base` is `throttlingBaseMs` for throttling errors and `baseMs` otherwise;
|
|
28
|
+
* - without it: `min(baseMs × factor^n, capMs)`, at least `minThrottleMs` for
|
|
29
|
+
* throttling errors, plus up to `jitterMs` of random jitter.
|
|
30
|
+
*
|
|
31
|
+
* With `serverHint`, the server can lengthen `t`:
|
|
32
|
+
*
|
|
33
|
+
* - a bounded hint (`x-amz-retry-after` or `x-distilled-retry-after`, in
|
|
34
|
+
* milliseconds) is clamped to `[t, t + 5s]` and used as is;
|
|
35
|
+
* - otherwise `error.retryAfter` (`Retry-After` / `RateLimit`) is a minimum,
|
|
36
|
+
* as RFC 9110 defines it; a hint over the cap ({@link ServerRetryHintCapMs})
|
|
37
|
+
* stops retrying, because retrying earlier than the server asked fails again.
|
|
38
|
+
*
|
|
39
|
+
* With a `budget`, each retry withdraws from it and stops when it is empty.
|
|
40
|
+
*/
|
|
41
|
+
export interface Backoff {
|
|
42
|
+
readonly baseMs: number;
|
|
43
|
+
readonly factor: number;
|
|
44
|
+
readonly capMs: number;
|
|
45
|
+
/** Stop after this many retries; unlimited when absent. */
|
|
46
|
+
readonly maxRetries?: number;
|
|
47
|
+
readonly jitterMs?: number;
|
|
48
|
+
readonly minThrottleMs?: number;
|
|
49
|
+
readonly serverHint?: boolean;
|
|
50
|
+
/** Base delay for throttling errors under `fullJitter`; `baseMs` when absent. */
|
|
51
|
+
readonly throttlingBaseMs?: number;
|
|
52
|
+
readonly fullJitter?: boolean;
|
|
53
|
+
readonly budget?: Budget;
|
|
54
|
+
/**
|
|
55
|
+
* When the budget cannot pay for a retry, wait the delay before failing
|
|
56
|
+
* anyway, so a polling loop around the call cannot spin (AWS Retry
|
|
57
|
+
* Behavior 2.1 for long-polling operations such as SQS `ReceiveMessage`).
|
|
58
|
+
*/
|
|
59
|
+
readonly longPoll?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** How far a bounded server hint may lengthen the computed delay. */
|
|
62
|
+
export declare const BOUNDED_HINT_MAX_EXTRA_MS = 5000;
|
|
63
|
+
/**
|
|
64
|
+
* A retry budget: one token bucket per key (the request's host). A retry
|
|
65
|
+
* withdraws its cost; a successful response from that host adds one token,
|
|
66
|
+
* up to `max`; a retry that succeeds gets its cost back. When a bucket
|
|
67
|
+
* cannot pay, the call fails instead of retrying, so a failing dependency
|
|
68
|
+
* sees about `1 / cost` extra load instead of `maxRetries` times its load.
|
|
69
|
+
*
|
|
70
|
+
* The bucket lives as long as the budget value. A policy defined at module
|
|
71
|
+
* scope shares one budget across calls (and across Lambda invocations); a
|
|
72
|
+
* policy built per call starts a fresh one each time.
|
|
73
|
+
*/
|
|
74
|
+
export interface Budget {
|
|
75
|
+
/** Withdraw a retry's cost from `key`'s bucket; the cost, or `undefined` when it cannot pay. */
|
|
76
|
+
readonly withdraw: (key: string, throttling: boolean) => number | undefined;
|
|
77
|
+
/** Give back what a retry that succeeded withdrew. */
|
|
78
|
+
readonly refund: (key: string, cost: number) => void;
|
|
79
|
+
/** Tokens left in `key`'s bucket. */
|
|
80
|
+
readonly tokens: (key: string) => number;
|
|
81
|
+
/** Return every bucket to its initial tokens. */
|
|
82
|
+
readonly reset: () => void;
|
|
83
|
+
}
|
|
84
|
+
export interface BudgetOptions {
|
|
85
|
+
/** Tokens a new bucket starts with. Default 100: 7 transient or 20 throttling retries. */
|
|
86
|
+
readonly initial?: number;
|
|
87
|
+
/** Most tokens a bucket holds. Default 500. */
|
|
88
|
+
readonly max?: number;
|
|
89
|
+
/** Cost of retrying a non-throttling error. Default 14. */
|
|
90
|
+
readonly transientCost?: number;
|
|
91
|
+
/** Cost of retrying a throttling error. Default 5. */
|
|
92
|
+
readonly throttlingCost?: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The AWS SDKs' retry quota (Retry Behavior 2.1: 500 tokens, a transient
|
|
96
|
+
* retry costs 14, a throttling retry 5, a success adds 1), except that a
|
|
97
|
+
* bucket starts with 100 tokens instead of full: many short-lived clients,
|
|
98
|
+
* each starting full, would together retry a failing service at nearly
|
|
99
|
+
* `maxRetries` times its load.
|
|
100
|
+
*/
|
|
101
|
+
export declare const makeBudget: (options?: BudgetOptions) => Budget;
|
|
102
|
+
/**
|
|
103
|
+
* The budget of the default policy, shared by every SDK in this process.
|
|
104
|
+
* Its buckets are keyed by host, so one failing service does not use up the
|
|
105
|
+
* retries of another.
|
|
106
|
+
*/
|
|
107
|
+
export declare const defaultBudget: Budget;
|
|
9
108
|
export interface Options {
|
|
10
109
|
/**
|
|
11
110
|
* Predicate to determine if an error should trigger a retry.
|
|
@@ -15,6 +114,8 @@ export interface Options {
|
|
|
15
114
|
* The schedule to use for retrying.
|
|
16
115
|
*/
|
|
17
116
|
readonly schedule?: Schedule.Schedule<unknown>;
|
|
117
|
+
/** Used when no `schedule` is given. */
|
|
118
|
+
readonly backoff?: Backoff;
|
|
18
119
|
}
|
|
19
120
|
/**
|
|
20
121
|
* A factory function that creates retry policy options with access to the last error ref.
|
|
@@ -74,59 +175,57 @@ export declare const serverRetryHintCapLayer: (capMs: number) => Layer.Layer<num
|
|
|
74
175
|
* Effective cap when neither {@link ServerRetryHintCapMs} nor
|
|
75
176
|
* `DISTILLED_SERVER_RETRY_HINT_CAP_MS` is set: {@link DEFAULT_SERVER_RETRY_HINT_CAP_MS}.
|
|
76
177
|
*
|
|
77
|
-
* Reads the `DISTILLED_SERVER_RETRY_HINT_CAP_MS` environment variable
|
|
78
|
-
*
|
|
79
|
-
*
|
|
178
|
+
* Reads the `DISTILLED_SERVER_RETRY_HINT_CAP_MS` environment variable (must
|
|
179
|
+
* be a non-negative finite number; invalid values fall back to the default).
|
|
180
|
+
* It reads `process.env` directly: Effect's `Config` would add about 5 KB
|
|
181
|
+
* gzip to every bundle for this one optional knob. Use
|
|
182
|
+
* {@link ServerRetryHintCapMs} to set the cap from code.
|
|
80
183
|
*/
|
|
81
184
|
export declare const readServerRetryHintCapMsFromEnv: () => number;
|
|
185
|
+
export declare const resolveServerRetryHintCapMs: () => Effect.Effect<number, never, never>;
|
|
82
186
|
/**
|
|
83
|
-
*
|
|
187
|
+
* Extract a server-provided retry hint (in milliseconds) from an error's
|
|
188
|
+
* optional `retryAfter` field, capped by the effective server-hint cap
|
|
189
|
+
* (see {@link ServerRetryHintCapMs} and {@link readServerRetryHintCapMsFromEnv}).
|
|
84
190
|
*
|
|
85
|
-
*
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* -
|
|
93
|
-
* -
|
|
94
|
-
* -
|
|
191
|
+
* Returns `undefined` when the error doesn't carry a hint.
|
|
192
|
+
*/
|
|
193
|
+
export declare const serverHintMillis: (error: unknown, capMs: number) => number | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* The policy used when the context provides none, tuned for calls at
|
|
196
|
+
* runtime (a request handler, a Lambda) after AWS's Retry Behavior 2.1:
|
|
197
|
+
*
|
|
198
|
+
* - retries only errors marked retryable (see `isTransientError`);
|
|
199
|
+
* - at most 2 retries (3 attempts);
|
|
200
|
+
* - full jitter: `random(0, 1) × min(20s, base × 2^n)`, base 50ms, or 1s
|
|
201
|
+
* for throttling errors;
|
|
202
|
+
* - honors server hints (see {@link Backoff});
|
|
203
|
+
* - draws from {@link defaultBudget}.
|
|
95
204
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* high request concurrency routinely outlast a short 5-attempt/3s policy
|
|
99
|
-
* while a genuinely broken credential still fails within seconds.
|
|
205
|
+
* Deploy tools that should wait out longer outages install their own
|
|
206
|
+
* policy, for example {@link transientFactory}.
|
|
100
207
|
*/
|
|
208
|
+
export declare const defaultOptions: Options;
|
|
101
209
|
export declare const makeDefault: Factory;
|
|
102
210
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
211
|
+
* A model's `distilled.retry#policy` trait: numbers that replace the default
|
|
212
|
+
* policy's for a service or an operation. What retries still comes from the
|
|
213
|
+
* error's marks.
|
|
105
214
|
*/
|
|
215
|
+
export interface RetryOverride {
|
|
216
|
+
/** Attempts in total, the first included. */
|
|
217
|
+
readonly maxAttempts?: number;
|
|
218
|
+
readonly baseMs?: number;
|
|
219
|
+
readonly throttlingBaseMs?: number;
|
|
220
|
+
readonly capMs?: number;
|
|
221
|
+
/** Multiplier between delays (2 by default). */
|
|
222
|
+
readonly factor?: number;
|
|
223
|
+
readonly longPoll?: boolean;
|
|
224
|
+
}
|
|
225
|
+
/** {@link defaultOptions} with `override`'s numbers, memoized per override object. */
|
|
226
|
+
export declare const defaultWith: (override: RetryOverride) => Options;
|
|
106
227
|
export declare const throttlingFactory: Factory;
|
|
107
|
-
/**
|
|
108
|
-
* Retry options that retries all throttling errors indefinitely.
|
|
109
|
-
*
|
|
110
|
-
* Note: prefer {@link throttlingFactory} when you want server-hint honoring.
|
|
111
|
-
* This static `Options` form does not have access to `lastError` and so
|
|
112
|
-
* cannot read `error.retryAfter`.
|
|
113
|
-
*/
|
|
114
228
|
export declare const throttlingOptions: Options;
|
|
115
|
-
/**
|
|
116
|
-
* Factory for the transient retry policy. Honors server hints when present
|
|
117
|
-
* so callers using `<SDK>.Retry.transient` get correct backoff.
|
|
118
|
-
*/
|
|
119
229
|
export declare const transientFactory: Factory;
|
|
120
|
-
/**
|
|
121
|
-
* Retry options that retries all transient errors indefinitely.
|
|
122
|
-
*
|
|
123
|
-
* This includes:
|
|
124
|
-
* 1. Throttling errors
|
|
125
|
-
* 2. Server errors
|
|
126
|
-
* 3. Network errors
|
|
127
|
-
* 4. Locked errors (423)
|
|
128
|
-
*
|
|
129
|
-
* Note: prefer {@link transientFactory} when you want server-hint honoring.
|
|
130
|
-
*/
|
|
131
230
|
export declare const transientOptions: Options;
|
|
132
231
|
//# sourceMappingURL=retry.d.ts.map
|
package/lib/retry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAQ5C;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE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;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAID,sFAAsF;AACtF,eAAO,MAAM,WAAW,aAAc,aAAa,KAAG,OAoBrD,CAAC;AAWF,eAAO,MAAM,iBAAiB,EAAE,OAAwC,CAAC;AAMzE,eAAO,MAAM,iBAAiB,EAAE,OAG/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAAuC,CAAC;AAGvE,eAAO,MAAM,gBAAgB,EAAE,OAAiE,CAAC"}
|
package/lib/retry.js
CHANGED
|
@@ -1,210 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Retry Policy System
|
|
3
|
-
*
|
|
4
|
-
* Provides configurable retry policies for API operations.
|
|
5
|
-
* Each SDK creates its own `Retry` Context.Service tag (via
|
|
6
|
-
* `makeRetryService`) and threads it into `makeAPI({ retry: <SDK>.Retry })`
|
|
7
|
-
* so that callers can install a blanket retry policy at the layer level
|
|
8
|
-
* for that SDK without wrapping every call with `Effect.retry`.
|
|
9
|
-
*/
|
|
10
|
-
import * as Config from "effect/Config";
|
|
11
|
-
import * as Context from "effect/Context";
|
|
12
|
-
import * as Duration from "effect/Duration";
|
|
13
|
-
import * as Effect from "effect/Effect";
|
|
14
|
-
import { pipe } from "effect/Function";
|
|
15
|
-
import * as Layer from "effect/Layer";
|
|
16
|
-
import * as Option from "effect/Option";
|
|
17
|
-
import * as Ref from "effect/Ref";
|
|
18
|
-
import * as Schedule from "effect/Schedule";
|
|
19
|
-
import { isThrottling, isTransientError } from "./category.js";
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// Retry Service Factory
|
|
22
|
-
// ============================================================================
|
|
23
|
-
/**
|
|
24
|
-
* Create a typed Retry service class for an SDK.
|
|
25
|
-
* Each SDK creates its own Retry service using this factory; the SDK's
|
|
26
|
-
* client wraps `makeAPI` with `retry: <SDK>.Retry` so the policy applies
|
|
27
|
-
* to every API call below it.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* // packages/<sdk>/src/retry.ts
|
|
32
|
-
* export class Retry extends makeRetryService("PlanetScaleRetry") {}
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export const makeRetryService = (name) => Context.Service()(name);
|
|
36
|
-
// ============================================================================
|
|
37
|
-
// Retry Schedule Utilities
|
|
38
|
-
// ============================================================================
|
|
39
|
-
/**
|
|
40
|
-
* Custom jittered schedule helper.
|
|
41
|
-
* Adds random jitter between 0-50ms to avoid thundering herd.
|
|
42
|
-
*/
|
|
43
|
-
export const jittered = Schedule.addDelay(() => Effect.succeed(Duration.millis(Math.random() * 50)));
|
|
44
|
-
/**
|
|
45
|
-
* Cap delay at a maximum duration.
|
|
46
|
-
*/
|
|
47
|
-
export const capped = (max) => Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.isGreaterThan(duration, max) ? max : duration));
|
|
48
|
-
// ============================================================================
|
|
49
|
-
// Server Hint Helpers
|
|
50
|
-
// ============================================================================
|
|
51
|
-
/**
|
|
52
|
-
* Default cap (milliseconds) on how long we'll honor a server-provided
|
|
53
|
-
* `Retry-After` / `RateLimit` hint. A misbehaving server can otherwise park
|
|
54
|
-
* us forever.
|
|
55
|
-
*/
|
|
56
|
-
export const DEFAULT_SERVER_RETRY_HINT_CAP_MS = 60_000;
|
|
57
|
-
const ENV_SERVER_RETRY_HINT_CAP_MS = "DISTILLED_SERVER_RETRY_HINT_CAP_MS";
|
|
58
|
-
/**
|
|
59
|
-
* Optional override for the server-hint cap, in milliseconds. When provided
|
|
60
|
-
* via `Layer.succeed(ServerRetryHintCapMs, n)`, that value wins over the
|
|
61
|
-
* environment.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```ts
|
|
65
|
-
* Effect.retry(op, policy).pipe(
|
|
66
|
-
* Effect.provide(serverRetryHintCapLayer(120_000)),
|
|
67
|
-
* )
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
export const ServerRetryHintCapMs = Context.Service("@distilled.cloud/core/ServerRetryHintCapMs");
|
|
71
|
-
/**
|
|
72
|
-
* Layer that pins the server `retryAfter` cap to a fixed value (milliseconds).
|
|
73
|
-
*/
|
|
74
|
-
export const serverRetryHintCapLayer = (capMs) => Layer.succeed(ServerRetryHintCapMs, capMs);
|
|
75
|
-
const serverRetryHintCapMsConfig = Config.string(ENV_SERVER_RETRY_HINT_CAP_MS).pipe(Config.map((raw) => {
|
|
76
|
-
if (raw === "")
|
|
77
|
-
return DEFAULT_SERVER_RETRY_HINT_CAP_MS;
|
|
78
|
-
const n = Number(raw);
|
|
79
|
-
if (!Number.isFinite(n) || n < 0)
|
|
80
|
-
return DEFAULT_SERVER_RETRY_HINT_CAP_MS;
|
|
81
|
-
return Math.trunc(n);
|
|
82
|
-
}), Config.withDefault(DEFAULT_SERVER_RETRY_HINT_CAP_MS));
|
|
83
|
-
/**
|
|
84
|
-
* Effective cap when neither {@link ServerRetryHintCapMs} nor
|
|
85
|
-
* `DISTILLED_SERVER_RETRY_HINT_CAP_MS` is set: {@link DEFAULT_SERVER_RETRY_HINT_CAP_MS}.
|
|
86
|
-
*
|
|
87
|
-
* Reads the `DISTILLED_SERVER_RETRY_HINT_CAP_MS` environment variable via
|
|
88
|
-
* Effect's {@link Config} (must be a non-negative finite number; invalid
|
|
89
|
-
* values fall back to the default).
|
|
90
|
-
*/
|
|
91
|
-
export const readServerRetryHintCapMsFromEnv = () => Effect.runSync(serverRetryHintCapMsConfig.pipe(Effect.orElseSucceed(() => DEFAULT_SERVER_RETRY_HINT_CAP_MS)));
|
|
92
|
-
const resolveServerRetryHintCapMs = () => Effect.gen(function* () {
|
|
93
|
-
const fromLayer = yield* Effect.serviceOption(ServerRetryHintCapMs);
|
|
94
|
-
if (Option.isSome(fromLayer)) {
|
|
95
|
-
const n = fromLayer.value;
|
|
96
|
-
if (Number.isFinite(n) && n >= 0)
|
|
97
|
-
return Math.trunc(n);
|
|
98
|
-
}
|
|
99
|
-
return yield* serverRetryHintCapMsConfig.pipe(Effect.orElseSucceed(() => DEFAULT_SERVER_RETRY_HINT_CAP_MS));
|
|
100
|
-
});
|
|
101
|
-
/**
|
|
102
|
-
* Extract a server-provided retry hint (in milliseconds) from an error's
|
|
103
|
-
* optional `retryAfter` field, capped by the effective server-hint cap
|
|
104
|
-
* (see {@link ServerRetryHintCapMs} and {@link readServerRetryHintCapMsFromEnv}).
|
|
105
|
-
*
|
|
106
|
-
* Returns `undefined` when the error doesn't carry a hint.
|
|
107
|
-
*/
|
|
108
|
-
const serverHintMillis = (error, capMs) => {
|
|
109
|
-
const hint = error
|
|
110
|
-
?.retryAfter;
|
|
111
|
-
if (!Duration.isDuration(hint))
|
|
112
|
-
return undefined;
|
|
113
|
-
return Math.min(Duration.toMillis(hint), capMs);
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Schedule modifier that honors `error.retryAfter` (set by the SDK's
|
|
117
|
-
* `matchError` from `Retry-After` / `RateLimit` headers) with precedence
|
|
118
|
-
* over the input delay. Falls back to the original delay when no hint is
|
|
119
|
-
* present.
|
|
120
|
-
*/
|
|
121
|
-
const honorServerHint = (lastError, baseline) => Schedule.modifyDelay(Effect.fnUntraced(function* ({ duration }) {
|
|
122
|
-
const capMs = yield* resolveServerRetryHintCapMs();
|
|
123
|
-
const error = yield* Ref.get(lastError);
|
|
124
|
-
const hint = serverHintMillis(error, capMs);
|
|
125
|
-
if (hint !== undefined)
|
|
126
|
-
return hint;
|
|
127
|
-
const adjusted = baseline ? baseline(duration, error) : duration;
|
|
128
|
-
return Duration.toMillis(adjusted);
|
|
129
|
-
}));
|
|
130
|
-
// ============================================================================
|
|
131
|
-
// Default Retry Policies
|
|
132
|
-
// ============================================================================
|
|
133
|
-
/**
|
|
134
|
-
* Creates the default retry policy.
|
|
135
|
-
*
|
|
136
|
-
* This policy:
|
|
137
|
-
* - Retries transient errors (throttling, server, network, locked errors)
|
|
138
|
-
* - Honors `error.retryAfter` (server-provided hint) with precedence, capped
|
|
139
|
-
* by {@link DEFAULT_SERVER_RETRY_HINT_CAP_MS} by default; override with
|
|
140
|
-
* `DISTILLED_SERVER_RETRY_HINT_CAP_MS` or {@link ServerRetryHintCapMs}
|
|
141
|
-
* - Otherwise uses exponential backoff starting at 250ms with a factor of 2,
|
|
142
|
-
* capped at 5s per delay
|
|
143
|
-
* - Ensures at least 500ms delay for throttling errors
|
|
144
|
-
* - Limits to 8 retry attempts
|
|
145
|
-
* - Applies jitter to avoid thundering herd
|
|
146
|
-
*
|
|
147
|
-
* The 250ms/5s-cap/8-attempt shape (~20s of total patience) comes from
|
|
148
|
-
* alchemy's Cloudflare provider suite, where transient auth blips under
|
|
149
|
-
* high request concurrency routinely outlast a short 5-attempt/3s policy
|
|
150
|
-
* while a genuinely broken credential still fails within seconds.
|
|
151
|
-
*/
|
|
152
|
-
export const makeDefault = (lastError) => ({
|
|
153
|
-
while: (error) => isTransientError(error),
|
|
154
|
-
// The 5s cap applies to the exponential backoff BEFORE the server hint is
|
|
155
|
-
// considered, so a server-provided retryAfter longer than 5s is honored in
|
|
156
|
-
// full (bounded only by the 60s hint cap inside honorServerHint). Capping
|
|
157
|
-
// after the hint would silently clamp e.g. a Retry-After: 30 to 5s.
|
|
158
|
-
schedule: Schedule.max([
|
|
159
|
-
pipe(Schedule.exponential(250, 2), capped(Duration.seconds(5)), honorServerHint(lastError, (duration, error) => {
|
|
160
|
-
if (isThrottling(error) && Duration.toMillis(duration) < 500) {
|
|
161
|
-
return Duration.millis(500);
|
|
162
|
-
}
|
|
163
|
-
return duration;
|
|
164
|
-
}), jittered),
|
|
165
|
-
Schedule.recurs(8),
|
|
166
|
-
]),
|
|
167
|
-
});
|
|
168
|
-
/**
|
|
169
|
-
* Factory for the throttling-only retry policy. Honors server hints when
|
|
170
|
-
* present so callers using `<SDK>.Retry.throttling` get correct backoff.
|
|
171
|
-
*/
|
|
172
|
-
export const throttlingFactory = (lastError) => ({
|
|
173
|
-
while: (error) => isThrottling(error),
|
|
174
|
-
schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), honorServerHint(lastError), jittered),
|
|
175
|
-
});
|
|
176
|
-
/**
|
|
177
|
-
* Retry options that retries all throttling errors indefinitely.
|
|
178
|
-
*
|
|
179
|
-
* Note: prefer {@link throttlingFactory} when you want server-hint honoring.
|
|
180
|
-
* This static `Options` form does not have access to `lastError` and so
|
|
181
|
-
* cannot read `error.retryAfter`.
|
|
182
|
-
*/
|
|
183
|
-
export const throttlingOptions = {
|
|
184
|
-
while: (error) => isThrottling(error),
|
|
185
|
-
schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), jittered),
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Factory for the transient retry policy. Honors server hints when present
|
|
189
|
-
* so callers using `<SDK>.Retry.transient` get correct backoff.
|
|
190
|
-
*/
|
|
191
|
-
export const transientFactory = (lastError) => ({
|
|
192
|
-
while: isTransientError,
|
|
193
|
-
schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), honorServerHint(lastError), jittered),
|
|
194
|
-
});
|
|
195
|
-
/**
|
|
196
|
-
* Retry options that retries all transient errors indefinitely.
|
|
197
|
-
*
|
|
198
|
-
* This includes:
|
|
199
|
-
* 1. Throttling errors
|
|
200
|
-
* 2. Server errors
|
|
201
|
-
* 3. Network errors
|
|
202
|
-
* 4. Locked errors (423)
|
|
203
|
-
*
|
|
204
|
-
* Note: prefer {@link transientFactory} when you want server-hint honoring.
|
|
205
|
-
*/
|
|
206
|
-
export const transientOptions = {
|
|
207
|
-
while: isTransientError,
|
|
208
|
-
schedule: pipe(Schedule.exponential(1000, 2), capped(Duration.seconds(5)), jittered),
|
|
209
|
-
};
|
|
210
|
-
//# sourceMappingURL=retry.js.map
|
|
1
|
+
export { retry$BOUNDED_HINT_MAX_EXTRA_MS as BOUNDED_HINT_MAX_EXTRA_MS, retry$DEFAULT_SERVER_RETRY_HINT_CAP_MS as DEFAULT_SERVER_RETRY_HINT_CAP_MS, retry$ServerRetryHintCapMs as ServerRetryHintCapMs, retry$capped as capped, retry$defaultBudget as defaultBudget, retry$defaultOptions as defaultOptions, retry$defaultWith as defaultWith, retry$jittered as jittered, retry$makeBudget as makeBudget, retry$makeDefault as makeDefault, retry$makeRetryService as makeRetryService, retry$readServerRetryHintCapMsFromEnv as readServerRetryHintCapMsFromEnv, retry$resolveServerRetryHintCapMs as resolveServerRetryHintCapMs, retry$serverHintMillis as serverHintMillis, retry$serverRetryHintCapLayer as serverRetryHintCapLayer, retry$throttlingFactory as throttlingFactory, retry$throttlingOptions as throttlingOptions, retry$transientFactory as transientFactory, retry$transientOptions as transientOptions } from "./_bundle/base.js";
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal schemas for generated SDK code: plain objects shaped like Effect
|
|
3
|
+
* Schema ASTs (`_tag`, `annotations`, `propertySignatures`, `types`,
|
|
4
|
+
* `thunk`, `encoding`), without Effect Schema's parser, issue and
|
|
5
|
+
* transformation machinery.
|
|
6
|
+
*
|
|
7
|
+
* Request encoding and lenient response decoding only walk the AST: they
|
|
8
|
+
* read wire names, HTTP bindings and the shape of the value. Importing
|
|
9
|
+
* `effect/Schema` to build those ASTs put about 37 KB gzip of decode
|
|
10
|
+
* machinery into every bundle that never decodes. These nodes carry the
|
|
11
|
+
* same fields protocol code reads, so it runs unchanged.
|
|
12
|
+
*
|
|
13
|
+
* When a caller asks for real validation (`ResponseValidation.strict` or
|
|
14
|
+
* `additionalProperties`), {@link toEffect} rebuilds the equivalent Effect
|
|
15
|
+
* schema from a lite node, loading `effect/Schema` only then.
|
|
16
|
+
*
|
|
17
|
+
* Every value here has the members generated code uses on schemas: `.ast`,
|
|
18
|
+
* `.pipe(...)`, `.annotate(...)`, `.fields` (structs) and `.key`/`.value`
|
|
19
|
+
* (records).
|
|
20
|
+
*/
|
|
21
|
+
import type * as Cause from "effect/Cause";
|
|
22
|
+
import { type Pipeable } from "effect/Pipeable";
|
|
23
|
+
import type * as EffectSchema from "effect/Schema";
|
|
24
|
+
export type Annotations = Record<string | symbol, unknown>;
|
|
25
|
+
/** A lite AST node. Field names match Effect's SchemaAST where protocols read them. */
|
|
26
|
+
export interface Node {
|
|
27
|
+
readonly _tag: string;
|
|
28
|
+
readonly annotations?: Annotations;
|
|
29
|
+
/**
|
|
30
|
+
* The wire-side node, for nodes whose value changes on the wire (AWS
|
|
31
|
+
* timestamps, blobs, sensitive values). Same shape as Effect's encoding
|
|
32
|
+
* chain, so code that follows `encoding[0].to` reads the wire type.
|
|
33
|
+
*/
|
|
34
|
+
readonly encoding?: ReadonlyArray<{
|
|
35
|
+
readonly to: Node;
|
|
36
|
+
}>;
|
|
37
|
+
/** Declaration: the type guard strict validation applies (Unknown without one). */
|
|
38
|
+
readonly check?: (u: unknown) => boolean;
|
|
39
|
+
readonly context?: {
|
|
40
|
+
readonly isOptional: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** Objects */
|
|
43
|
+
readonly propertySignatures?: ReadonlyArray<PropertySignature>;
|
|
44
|
+
readonly indexSignatures?: ReadonlyArray<{
|
|
45
|
+
readonly parameter: Node;
|
|
46
|
+
readonly type: Node;
|
|
47
|
+
}>;
|
|
48
|
+
/** Union */
|
|
49
|
+
readonly types?: ReadonlyArray<Node>;
|
|
50
|
+
/** Arrays */
|
|
51
|
+
readonly elements?: ReadonlyArray<Node>;
|
|
52
|
+
readonly rest?: ReadonlyArray<Node>;
|
|
53
|
+
/** Suspend */
|
|
54
|
+
readonly thunk?: () => Node;
|
|
55
|
+
/** Literal */
|
|
56
|
+
readonly literal?: unknown;
|
|
57
|
+
/** Declaration */
|
|
58
|
+
readonly typeParameters?: ReadonlyArray<Node>;
|
|
59
|
+
}
|
|
60
|
+
export interface PropertySignature {
|
|
61
|
+
readonly name: PropertyKey;
|
|
62
|
+
readonly type: Node;
|
|
63
|
+
}
|
|
64
|
+
/** A lite schema value: what generated code holds and passes around. */
|
|
65
|
+
export interface Lite {
|
|
66
|
+
readonly ast: Node;
|
|
67
|
+
readonly "~lite": true;
|
|
68
|
+
pipe(...fns: ReadonlyArray<(s: any) => any>): any;
|
|
69
|
+
annotate(annotations: Annotations): Lite;
|
|
70
|
+
}
|
|
71
|
+
/** Marks lite nodes so strict validation knows to convert them. */
|
|
72
|
+
export declare const liteKey = "~lite";
|
|
73
|
+
/** A lite schema for a hand-built node (SDK-specific declarations). */
|
|
74
|
+
export declare const fromNode: (n: Node) => Lite;
|
|
75
|
+
export declare const isLite: (u: unknown) => u is Lite;
|
|
76
|
+
export declare const String: Lite;
|
|
77
|
+
export declare const Number: Lite;
|
|
78
|
+
export declare const Boolean: Lite;
|
|
79
|
+
export declare const Unknown: Lite;
|
|
80
|
+
export declare const Any: Lite;
|
|
81
|
+
export declare const Null: Lite;
|
|
82
|
+
export declare const Void: Lite;
|
|
83
|
+
export declare const Undefined: Lite;
|
|
84
|
+
export declare const Literal: (value: unknown) => Lite;
|
|
85
|
+
export declare const Literals: (values: ReadonlyArray<unknown>) => Lite;
|
|
86
|
+
export declare const optional: (s: Lite) => Lite;
|
|
87
|
+
export declare const NullOr: (s: Lite) => Lite;
|
|
88
|
+
export declare const Union: (members: ReadonlyArray<Lite>) => Lite;
|
|
89
|
+
export declare const Array: (item: Lite) => Lite;
|
|
90
|
+
export declare const Tuple: (elements: ReadonlyArray<Lite>) => Lite;
|
|
91
|
+
export declare const Record: (key: Lite, value: Lite) => Lite;
|
|
92
|
+
export declare const Struct: (fields: Readonly<Record<string, Lite>>) => Lite;
|
|
93
|
+
/**
|
|
94
|
+
* A struct that also allows keys it does not declare (OpenAPI
|
|
95
|
+
* `additionalProperties` next to `properties`): the struct's property
|
|
96
|
+
* signatures plus each record's index signature, as Effect's
|
|
97
|
+
* `StructWithRest` builds them.
|
|
98
|
+
*/
|
|
99
|
+
export declare const StructWithRest: (struct: Lite, records: ReadonlyArray<Lite>) => Lite;
|
|
100
|
+
/**
|
|
101
|
+
* `struct`'s members, then the members of `base` (a struct, possibly
|
|
102
|
+
* suspended) that `struct` does not declare. An operation input that inlines
|
|
103
|
+
* its request body is the body struct extended with the path and query
|
|
104
|
+
* members, without a second copy of every body field. Resolves `base`, so
|
|
105
|
+
* call it inside the input's `suspend`.
|
|
106
|
+
*/
|
|
107
|
+
export declare const Extend: (base: Lite, struct: Lite) => Lite;
|
|
108
|
+
/** A lazily resolved schema; `.ast` is a Suspend node whose thunk resolves the target. */
|
|
109
|
+
export declare const suspend: (f: () => Lite) => Lite;
|
|
110
|
+
/** Rename struct keys on the wire: `{ typeKey: "wire_key" }`. */
|
|
111
|
+
export declare const encodeKeys: (mapping: Readonly<Record<string, string>>) => (s: Lite) => Lite;
|
|
112
|
+
export declare const encodeKeysKey = "@distilled.cloud/core/schema-lite/encodeKeys";
|
|
113
|
+
/**
|
|
114
|
+
* Effect Schema's `representation` annotation for its built-in declaration
|
|
115
|
+
* `id` (`effect/schema/Date`, ...). A lite declaration of the same type
|
|
116
|
+
* carries it, so {@link toEffect} rebuilds Effect's own schema for it (and
|
|
117
|
+
* `effect/Arbitrary` can generate values for the result).
|
|
118
|
+
*/
|
|
119
|
+
export declare const representation: (id: string) => {
|
|
120
|
+
id: string;
|
|
121
|
+
payload: null;
|
|
122
|
+
};
|
|
123
|
+
export declare const Date: Lite;
|
|
124
|
+
export declare const Duration: Lite;
|
|
125
|
+
export declare const Redacted: (value: Lite) => Lite;
|
|
126
|
+
export declare const instanceOf: (cls: Function, annotations?: Annotations) => Lite;
|
|
127
|
+
export declare const declare: (_is: (u: unknown) => boolean, annotations?: Annotations) => Lite;
|
|
128
|
+
/**
|
|
129
|
+
* The type of a lite tagged error class: what the class really has. It is
|
|
130
|
+
* not an Effect Schema, so `Schema.is(E)`, `Schema.decode(E)` and friends do
|
|
131
|
+
* not compile against it -- at runtime they would fail on the lite `.ast`.
|
|
132
|
+
* Match errors with `_tag` (`Effect.catchTag`) or `instanceof`.
|
|
133
|
+
*/
|
|
134
|
+
export interface TaggedErrorClass<Tag extends string, Fields extends EffectSchema.Struct.Fields> extends Pipeable {
|
|
135
|
+
new (...args: {} extends EffectSchema.Struct.MakeIn<Fields> ? [props?: EffectSchema.Struct.MakeIn<Fields>] : [props: EffectSchema.Struct.MakeIn<Fields>]): Cause.YieldableError & {
|
|
136
|
+
readonly _tag: Tag;
|
|
137
|
+
} & EffectSchema.Struct.Type<Fields>;
|
|
138
|
+
/** `new this(props)`. */
|
|
139
|
+
make<C extends abstract new (...args: any) => any>(this: C, ...args: ConstructorParameters<C>): InstanceType<C>;
|
|
140
|
+
/**
|
|
141
|
+
* Whether `u` is an error of this class, by `_tag`, so it holds across
|
|
142
|
+
* duplicate copies of a package (`instanceof` does not). Errors of another
|
|
143
|
+
* service with the same tag also match.
|
|
144
|
+
*/
|
|
145
|
+
is<C extends abstract new (...args: any) => any>(this: C, u: unknown): u is InstanceType<C>;
|
|
146
|
+
readonly fields: Fields;
|
|
147
|
+
readonly identifier: Tag;
|
|
148
|
+
/** The lite struct node (not an Effect Schema AST). */
|
|
149
|
+
readonly ast: Node;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* `TaggedError<Self>()(tag, fields)`, typed by the field schemas. `Self` is
|
|
153
|
+
* accepted for source compatibility with `Schema.TaggedError` and unused.
|
|
154
|
+
*/
|
|
155
|
+
export type TaggedErrorFactory = <_Self = never>(identifier?: string) => <Tag extends string, const Fields extends EffectSchema.Struct.Fields = {}>(tag: Tag, fields?: Fields, annotations?: object) => TaggedErrorClass<Tag, Fields>;
|
|
156
|
+
/**
|
|
157
|
+
* A tagged error class without Effect Schema. It does not validate on
|
|
158
|
+
* construction. Carries `.fields` and `.identifier`, and a static `.pipe`
|
|
159
|
+
* for category decorators.
|
|
160
|
+
*/
|
|
161
|
+
export declare const TaggedError: (_identifier?: string) => (tag: string, fields?: Readonly<Record<string, Lite>>, annotations?: object) => any;
|
|
162
|
+
/**
|
|
163
|
+
* Schema `j` of builder `build`, made on first use (the lite `chunks.at`).
|
|
164
|
+
* Its `.ast` is the built schema's own node, not a Suspend around it, so
|
|
165
|
+
* protocol code sees the same node shapes as with eager schemas.
|
|
166
|
+
*/
|
|
167
|
+
export declare const at: (build: (j: number) => unknown, j: number) => any;
|
|
168
|
+
/**
|
|
169
|
+
* The Effect schema equivalent to a lite node: the reference for strict
|
|
170
|
+
* decoding, and what `effect/Arbitrary` generates values from
|
|
171
|
+
* (`Arbitrary.schema(toEffect(Schema, op.input.ast))`). Loaded on demand so
|
|
172
|
+
* `effect/Schema` is only bundled/imported by callers that use it.
|
|
173
|
+
*/
|
|
174
|
+
/** The Effect Schema functions the bridge uses (passed in, so callers import only these). */
|
|
175
|
+
export type EffectSchemaApi = Pick<typeof import("effect/Schema"), "Any" | "Array" | "Boolean" | "Literal" | "Null" | "Number" | "Record" | "String" | "Struct" | "StructWithRest" | "Tuple" | "Undefined" | "Union" | "Unknown" | "Void" | "declare" | "make" | "optional" | "suspend"> &
|
|
176
|
+
/** Built-in declarations; without one, a lite node of that type becomes a plain check. */
|
|
177
|
+
Partial<Pick<typeof import("effect/Schema"), "Date" | "Duration" | "Redacted" | "Uint8Array">>;
|
|
178
|
+
export declare const toEffect: (S: EffectSchemaApi, ast: Node) => unknown;
|
|
179
|
+
//# sourceMappingURL=schema-lite-impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-lite-impl.d.ts","sources":["../src/schema-lite-impl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAA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KAChB,CAAC,GAAG,SAAS,MAAM,EAAE,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,EAC5E,GAAG,EAAE,GAAG,EACR,MAAM,CAAC,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,KACjB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,WAAW,iBACP,MAAM,WACf,MAAM,WAAU,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,gBAAqB,MAAM,KAAG,GASjF,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,EAAE,UAAW,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,KAAK,MAAM,KAAG,GAK7D,CAAC;AAoCF;;;;;GAKG;AACH,6FAA6F;AAC7F,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,cAAc,eAAe,CAAC,EAC5B,KAAK,GACL,OAAO,GACP,SAAS,GACT,SAAS,GACT,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,gBAAgB,GAChB,OAAO,GACP,WAAW,GACX,OAAO,GACP,SAAS,GACT,MAAM,GACN,SAAS,GACT,MAAM,GACN,UAAU,GACV,SAAS,CACZ;AACC,0FAA0F;AAC1F,OAAO,CAAC,IAAI,CAAC,cAAc,eAAe,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC;AAEjG,eAAO,MAAM,QAAQ,MAAO,eAAe,OAAO,IAAI,KAAG,OAuHxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { schema_lite_impl$Any as Any, schema_lite_impl$Array as Array, schema_lite_impl$Boolean as Boolean, schema_lite_impl$Date as Date, schema_lite_impl$Duration as Duration, schema_lite_impl$Extend as Extend, schema_lite_impl$Literal as Literal, schema_lite_impl$Literals as Literals, schema_lite_impl$Null as Null, schema_lite_impl$NullOr as NullOr, schema_lite_impl$Number as Number, schema_lite_impl$Record as Record, schema_lite_impl$Redacted as Redacted, schema_lite_impl$String as String, schema_lite_impl$Struct as Struct, schema_lite_impl$StructWithRest as StructWithRest, schema_lite_impl$TaggedError as TaggedError, schema_lite_impl$Tuple as Tuple, schema_lite_impl$Undefined as Undefined, schema_lite_impl$Union as Union, schema_lite_impl$Unknown as Unknown, schema_lite_impl$Void as Void, schema_lite_impl$at as at, schema_lite_impl$declare as declare, schema_lite_impl$encodeKeys as encodeKeys, schema_lite_impl$encodeKeysKey as encodeKeysKey, schema_lite_impl$fromNode as fromNode, schema_lite_impl$instanceOf as instanceOf, schema_lite_impl$isLite as isLite, schema_lite_impl$liteKey as liteKey, schema_lite_impl$optional as optional, schema_lite_impl$representation as representation, schema_lite_impl$suspend as suspend, schema_lite_impl$toEffect as toEffect } from "./_bundle/base.js";
|