@distilled.cloud/core 1.0.0-rc.20 → 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/README.md +33 -0
- package/lib/_bundle/aws.js +1 -1
- package/lib/_bundle/aws.js.map +1 -1
- package/lib/_bundle/base.js +2 -2
- package/lib/_bundle/base.js.map +1 -1
- package/lib/_bundle/graphql.js +2 -2
- package/lib/_bundle/graphql.js.map +1 -1
- package/lib/_bundle/grpc.js +2 -1
- package/lib/_bundle/grpc.js.map +1 -1
- package/lib/_bundle/rest.js +1 -1
- package/lib/_bundle/rest.js.map +1 -1
- package/lib/annotations.d.ts.map +1 -1
- package/lib/api.d.ts +71 -58
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +1 -1
- package/lib/category.d.ts +15 -12
- package/lib/category.d.ts.map +1 -1
- package/lib/chunks.d.ts.map +1 -1
- package/lib/config.d.ts +13 -0
- package/lib/config.d.ts.map +1 -1
- package/lib/crypto.d.ts.map +1 -1
- package/lib/error-category.d.ts.map +1 -1
- package/lib/errors.d.ts +35 -2
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -1
- package/lib/graphql.d.ts +21 -4
- package/lib/graphql.d.ts.map +1 -1
- package/lib/graphql.types.d.ts +0 -1
- package/lib/graphql.types.d.ts.map +1 -1
- package/lib/grpc-transport-cloudflare-http2.d.ts.map +1 -1
- package/lib/grpc-transport-cloudflare-http2.js +2 -2
- package/lib/grpc-transport-cloudflare-http2.js.map +1 -1
- package/lib/grpc-transport-cloudflare-sockets.d.ts.map +1 -1
- package/lib/grpc-transport-cloudflare-sockets.js +4 -4
- package/lib/grpc-transport-cloudflare-sockets.js.map +1 -1
- package/lib/grpc-transport-node-http2.d.ts.map +1 -1
- package/lib/grpc-transport-node-http2.js +1 -1
- package/lib/grpc-transport-node-http2.js.map +1 -1
- package/lib/grpc-transport.d.ts +53 -18
- package/lib/grpc-transport.d.ts.map +1 -1
- package/lib/grpc-transport.js +1 -1
- package/lib/hpack.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- 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 +4 -1
- package/lib/pagination.d.ts.map +1 -1
- package/lib/plain-values.d.ts +11 -0
- package/lib/plain-values.d.ts.map +1 -1
- package/lib/plain-values.js +1 -1
- package/lib/plain-values.js.map +1 -1
- package/lib/protobuf.d.ts +12 -19
- package/lib/protobuf.d.ts.map +1 -1
- package/lib/protobuf.js +1 -1
- package/lib/protocol-grpc.d.ts +47 -10
- package/lib/protocol-grpc.d.ts.map +1 -1
- package/lib/protocol-grpc.js +1 -1
- package/lib/protocol-http.d.ts +110 -8
- package/lib/protocol-http.d.ts.map +1 -1
- package/lib/protocol-http.js +1 -1
- package/lib/protocol-rest.d.ts +161 -37
- package/lib/protocol-rest.d.ts.map +1 -1
- package/lib/protocol-rest.js +1 -1
- 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.map +1 -1
- package/lib/response-validation-strict.d.ts.map +1 -1
- package/lib/response-validation.d.ts.map +1 -1
- package/lib/retry-after.d.ts +1 -1
- package/lib/retry-after.d.ts.map +1 -1
- 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 +100 -20
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +1 -1
- package/lib/schema-lite-impl.d.ts +25 -4
- package/lib/schema-lite-impl.d.ts.map +1 -1
- package/lib/schema-lite-impl.js +1 -1
- package/lib/schema-lite-typed.d.ts.map +1 -1
- package/lib/schema-lite.d.ts +1 -0
- package/lib/schema-lite.d.ts.map +1 -1
- package/lib/schema-lite.js +1 -1
- package/lib/schema.d.ts.map +1 -1
- package/lib/sdk-error.d.ts +4 -0
- package/lib/sdk-error.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/sensitive.js +1 -1
- package/lib/sensitive.js.map +1 -1
- package/lib/telemetry-debug.d.ts.map +1 -1
- package/lib/telemetry-debug.js +1 -1
- package/lib/telemetry-debug.js.map +1 -1
- package/lib/telemetry-hooks.d.ts.map +1 -1
- package/lib/telemetry-host-rules.d.ts.map +1 -1
- package/lib/telemetry-lambda-context.d.ts.map +1 -1
- package/lib/telemetry-message-context.d.ts.map +1 -1
- package/lib/telemetry-metrics.d.ts.map +1 -1
- package/lib/telemetry-metrics.js +1 -1
- package/lib/telemetry-metrics.js.map +1 -1
- package/lib/telemetry-name-template.d.ts.map +1 -1
- package/lib/telemetry-stream.d.ts.map +1 -1
- package/lib/telemetry-stream.js +1 -1
- package/lib/telemetry-stream.js.map +1 -1
- package/lib/telemetry-xray.d.ts.map +1 -1
- package/lib/telemetry.d.ts +29 -0
- package/lib/telemetry.d.ts.map +1 -1
- package/lib/telemetry.js +2 -2
- package/lib/telemetry.js.map +1 -1
- 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 +24 -1
- package/lib/trait.d.ts.map +1 -1
- package/lib/trait.js +1 -1
- package/lib/unknown-error.d.ts.map +1 -1
- package/lib/xml.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/api.ts +402 -209
- package/src/category.ts +21 -28
- package/src/config.ts +17 -1
- package/src/errors.ts +24 -2
- package/src/graphql.ts +65 -26
- package/src/graphql.types.ts +15 -0
- package/src/grpc-transport-cloudflare-http2.ts +374 -299
- package/src/grpc-transport-cloudflare-sockets.ts +150 -81
- package/src/grpc-transport-node-http2.ts +119 -46
- package/src/grpc-transport.ts +211 -42
- package/src/max-message-bytes.ts +58 -0
- package/src/ndjson.ts +55 -0
- package/src/pagination.ts +26 -15
- package/src/plain-values.ts +30 -1
- package/src/protobuf.ts +40 -5
- package/src/protocol-grpc.ts +518 -348
- package/src/protocol-http.ts +474 -100
- package/src/protocol-rest.ts +580 -140
- package/src/protocol.ts +150 -0
- package/src/response-validation-strict.ts +9 -3
- package/src/retry-after.ts +1 -1
- package/src/retry-state.ts +105 -0
- package/src/retry.ts +176 -47
- package/src/schema-lite-impl.ts +81 -10
- package/src/schema-lite.ts +1 -0
- package/src/sdk-error.ts +4 -0
- package/src/send.ts +156 -0
- package/src/sensitive.ts +49 -15
- package/src/telemetry.ts +2 -34
- package/src/token-cache.ts +117 -0
- package/src/trait.ts +34 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a protocol is, typed by the errors it declares.
|
|
3
|
+
*
|
|
4
|
+
* An operation fails with three groups of errors, each named for where it
|
|
5
|
+
* is declared:
|
|
6
|
+
*
|
|
7
|
+
* 1. on the operation its `errors` list
|
|
8
|
+
* 2. on the service its `serviceErrors` list, the same for every
|
|
9
|
+
* operation of the service
|
|
10
|
+
* 3. on the protocol the {@link Protocol}'s own error type: what the
|
|
11
|
+
* code that builds requests and reads responses
|
|
12
|
+
* fails with (a response it can't parse, mostly)
|
|
13
|
+
*
|
|
14
|
+
* `API.make` adds the three together. A protocol never names an error of
|
|
15
|
+
* groups 1 and 2: it receives their classes, matches a failed response
|
|
16
|
+
* against them, and fails with the instance as a {@link DeclaredError}.
|
|
17
|
+
* Everything else it fails with is in its own type, and passes through to
|
|
18
|
+
* every operation that names the protocol. Nobody writes that list: the
|
|
19
|
+
* compiler reads it from the protocol's code ({@link ErrorOf}, and
|
|
20
|
+
* {@link ProtocolOf} for a protocol written by hand).
|
|
21
|
+
*
|
|
22
|
+
* export const NeonProtocol = restProtocol({ ... });
|
|
23
|
+
* export type NeonOpError = NeonServiceError | ErrorOf<typeof NeonProtocol>;
|
|
24
|
+
*
|
|
25
|
+
* Types only: this module has no runtime code.
|
|
26
|
+
*/
|
|
27
|
+
import type * as Effect from "effect/Effect";
|
|
28
|
+
import type * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
29
|
+
import type * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
30
|
+
import type * as AST from "effect/SchemaAST";
|
|
31
|
+
import type * as Stream from "effect/Stream";
|
|
32
|
+
import type { PreparedOperation, ProtocolOperationConfig } from "./api.ts";
|
|
33
|
+
declare const declaredError: unique symbol;
|
|
34
|
+
/**
|
|
35
|
+
* An error of group 1 or 2 as a protocol sees it: an instance of a class
|
|
36
|
+
* that the operation or its service declares. A protocol can construct one
|
|
37
|
+
* from a {@link DeclaredErrorClass} and fail with it; `API.make` puts the
|
|
38
|
+
* real classes in the operation's error type.
|
|
39
|
+
*/
|
|
40
|
+
export interface DeclaredError {
|
|
41
|
+
readonly [declaredError]: true;
|
|
42
|
+
}
|
|
43
|
+
/** A class that the operation or its service declares, as a protocol receives it. */
|
|
44
|
+
export type DeclaredErrorClass = new (props: any) => DeclaredError;
|
|
45
|
+
/** What {@link Protocol.encode} receives. */
|
|
46
|
+
export interface EncodeArgs {
|
|
47
|
+
readonly input: unknown;
|
|
48
|
+
readonly inputAst: AST.AST;
|
|
49
|
+
/** The operation's config (the same object on every call of the operation). */
|
|
50
|
+
readonly config: ProtocolOperationConfig;
|
|
51
|
+
}
|
|
52
|
+
/** What {@link Protocol.decode} receives. */
|
|
53
|
+
export interface DecodeArgs {
|
|
54
|
+
readonly response: HttpClientResponse.HttpClientResponse;
|
|
55
|
+
readonly outputAst: AST.AST;
|
|
56
|
+
/** The operation's declared classes, then its service's. */
|
|
57
|
+
readonly errors: ReadonlyArray<DeclaredErrorClass>;
|
|
58
|
+
/** The operation's config (the same object on every call of the operation). */
|
|
59
|
+
readonly config: ProtocolOperationConfig;
|
|
60
|
+
}
|
|
61
|
+
/** One operation as {@link Protocol.call} and {@link Protocol.stream} see it. */
|
|
62
|
+
export interface Operation extends Omit<PreparedOperation, "errors"> {
|
|
63
|
+
/** The operation's declared classes, then its service's. */
|
|
64
|
+
readonly errors: ReadonlyArray<DeclaredErrorClass>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* How an SDK turns an input into an HTTP request and a response into an
|
|
68
|
+
* output. `ProtocolError` is what the protocol declares (group 3), and
|
|
69
|
+
* `Requirements` is what its methods read from the calling fiber
|
|
70
|
+
* (credentials, a region).
|
|
71
|
+
*
|
|
72
|
+
* A request that was not sent has no response to match, so `encode` fails
|
|
73
|
+
* with the protocol's errors only.
|
|
74
|
+
*/
|
|
75
|
+
export interface Protocol<ProtocolError, Requirements = never> {
|
|
76
|
+
readonly encode: (args: EncodeArgs) => Effect.Effect<HttpClientRequest.HttpClientRequest, ProtocolError, Requirements>;
|
|
77
|
+
readonly decode: (args: DecodeArgs) => Effect.Effect<unknown, DeclaredError | ProtocolError, Requirements>;
|
|
78
|
+
/**
|
|
79
|
+
* Optional whole call. When present, `API.make` runs a call as
|
|
80
|
+
* `call(operation, input)` in place of encode, send, decode. It reads the
|
|
81
|
+
* `HttpClient` from the calling fiber and produces the same request,
|
|
82
|
+
* result and errors as `encode` and `decode`.
|
|
83
|
+
*/
|
|
84
|
+
readonly call?: (operation: Operation, input: unknown) => Effect.Effect<unknown, DeclaredError | ProtocolError, Requirements>;
|
|
85
|
+
/**
|
|
86
|
+
* Server streaming (see `API.makeStreaming`): each response message as it
|
|
87
|
+
* arrives, decoded as one element of the output's `items`. Ending the
|
|
88
|
+
* stream early cancels the call. A protocol that can't stream leaves it
|
|
89
|
+
* out; one that streams only some operations fails the others with
|
|
90
|
+
* `API.cannotStream`.
|
|
91
|
+
*/
|
|
92
|
+
readonly stream?: (operation: Operation, input: unknown) => Stream.Stream<unknown, DeclaredError | ProtocolError, Requirements>;
|
|
93
|
+
}
|
|
94
|
+
/** What the methods of `P` return: its effects and its stream. */
|
|
95
|
+
type Outcome<P> = P[Extract<keyof P, keyof Protocol<unknown>>] extends infer Method ? Method extends (...args: any) => infer Result ? Result : never : never;
|
|
96
|
+
/**
|
|
97
|
+
* The errors a protocol declares (group 3), read from what its methods fail
|
|
98
|
+
* with. An SDK uses it to name what every operation fails with besides its
|
|
99
|
+
* own errors: `<Sdk>ServiceError | ErrorOf<typeof <Sdk>Protocol>`.
|
|
100
|
+
*/
|
|
101
|
+
export type ErrorOf<P> = Outcome<P> extends infer Result ? Result extends Effect.Effect<any, infer Failure, any> ? Exclude<Failure, DeclaredError> : Result extends Stream.Stream<any, infer Failure, any> ? Exclude<Failure, DeclaredError> : never : never;
|
|
102
|
+
/** What a protocol's methods read from the calling fiber. */
|
|
103
|
+
export type RequirementsOf<P> = Outcome<P> extends infer Result ? Result extends Effect.Effect<any, any, infer Requirements> ? Requirements : Result extends Stream.Stream<any, any, infer Requirements> ? Requirements : never : never;
|
|
104
|
+
/**
|
|
105
|
+
* The type of a protocol written by hand, read from its methods, so that
|
|
106
|
+
* nobody lists its errors:
|
|
107
|
+
*
|
|
108
|
+
* const methods = { encode, decode } satisfies Protocol<unknown, unknown>;
|
|
109
|
+
* export const GcpProtocol: ProtocolOf<typeof methods> = methods;
|
|
110
|
+
*/
|
|
111
|
+
export type ProtocolOf<Methods> = Protocol<ErrorOf<Methods>, RequirementsOf<Methods>>;
|
|
112
|
+
export {};
|
|
113
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACx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nD,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,GAC/B,KAAK,GACT,KAAK,CAAC;AAEZ,6DAA6D;AAC7D,MAAM,MAAM,cAAc,CAAC,CAAC,IAC1B,OAAO,CAAC,CAAC,CAAC,SAAS,MAAM,MAAM,GAC3B,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC,GACxD,YAAY,GACZ,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC,GACxD,YAAY,GACZ,KAAK,GACT,KAAK,CAAC;AAEZ;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
package/lib/protocol.js
ADDED
|
File without changes
|
package/lib/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","
|
|
1
|
+
{"version":3,"file":"query.d.ts","sources":["../src/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,OAAO,EACP,UAAU,EACV,OAAO,EACP,KAAK,KAAK,IAAI,SAAS,EACxB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAClE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtE,eAAO,MAAM,KAAK;IAChB,EAAE;IACF,MAAM;IACN,GAAG;IACH,OAAO;IACP,EAAE;IACF,KAAK;IACL,KAAK;CACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation-strict.d.ts","
|
|
1
|
+
{"version":3,"file":"response-validation-strict.d.ts","sources":["../src/response-validation-strict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAG7C,oGAAoG;AACpG,qBAAa,cAAe,SAAQ,KAAK;IACvC,SAAkB,IAAI,iBAAiB;IACvC,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAC1C,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,YAAY,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAO9E;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,aAAc,cAAc,KAAG,cACU,CAAC;AAErE;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,cAAc,GAAG,SAAS,CAAC;AAiQpE;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAAS,GAAG,CAAC,GAAG,sBAAkB,MAgBxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation.d.ts","
|
|
1
|
+
{"version":3,"file":"response-validation.d.ts","sources":["../src/response-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,MAAM,EAAc,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAE1F,OAAO,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`Duration` to retryable errors via the optional `retryAfter` field, where
|
|
11
|
-
* the retry policy
|
|
11
|
+
* the retry policy waits at least that long (RFC 9110).
|
|
12
12
|
*
|
|
13
13
|
* Services that use bespoke headers or body fields are expected to do their
|
|
14
14
|
* own parsing in the SDK's `matchError`, optionally falling back to these
|
package/lib/retry-after.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-after.d.ts","
|
|
1
|
+
{"version":3,"file":"retry-after.d.ts","sources":["../src/retry-after.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,YAAa,OAAO,KAAG,QAAQ,CAAC,QAAQ,GAAG,SA2BtE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,YAAa,OAAO,KAAG,QAAQ,CAAC,QAAQ,GAAG,SAuBrE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,YAAa,OAAO,KAAG,QAAQ,CAAC,QAAQ,GAAG,SACvB,CAAC;AAEtD;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,WAC3B,MAAM,WACL,OAAO,KACf,QAAQ,CAAC,QAAQ,GAAG,SAGtB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** The host of `url` (no port); `""` when it has none. */
|
|
2
|
+
export declare const hostOf: (url: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* The bounded server hint of a response: `x-amz-retry-after` or
|
|
5
|
+
* `x-distilled-retry-after` in milliseconds, the larger when both are set.
|
|
6
|
+
*/
|
|
7
|
+
export declare const boundedHintOf: (headers: Readonly<Record<string, string | undefined>>) => number | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Record that the current fiber is sending a request to `url`; `oneShot`
|
|
10
|
+
* when its body can be read only once.
|
|
11
|
+
*/
|
|
12
|
+
export declare const recordRequest: (url: string, oneShot?: boolean) => void;
|
|
13
|
+
/** Record the response to the current fiber's last request. */
|
|
14
|
+
export declare const recordResponse: (status: number, headers: Readonly<Record<string, string | undefined>>) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The current fiber's last request, removed so that a later failure that
|
|
17
|
+
* sent nothing cannot reuse its hint.
|
|
18
|
+
*/
|
|
19
|
+
export declare const takeLastRequest: () => {
|
|
20
|
+
readonly host: string;
|
|
21
|
+
readonly oneShot: boolean;
|
|
22
|
+
readonly hintMs?: number;
|
|
23
|
+
};
|
|
24
|
+
/** Successful responses from `host` so far in this process. */
|
|
25
|
+
export declare const successesOf: (host: string) => number;
|
|
26
|
+
//# sourceMappingURL=retry-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-state.d.ts","sources":["../src/retry-state.ts"],"names":[],"mappings":"AA2BA,0DAA0D;AAC1D,eAAO,MAAM,MAAM,QAAS,MAAM,KAAG,MASpC,CAAC;AAWF;;;GAGG;AACH,eAAO,MAAM,aAAa,YACf,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,KACpD,MAAM,GAAG,SAKX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM,wBAAoB,IAK5D,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,cAAc,WACjB,MAAM,WACL,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,KACpD,IASF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAO1B,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,MAAwC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as e from"effect/Fiber";const t=/*@__PURE__*/ new WeakMap;const n=/*@__PURE__*/ new Map;const hostOf=e=>{const t=e.indexOf(`://`);if(t===-1)return``;const n=t+3;let r=n;while(r<e.length&&!`/?#`.includes(e[r]))r++;const i=e.slice(e.lastIndexOf(`@`,r)+1||n,r);const a=i.lastIndexOf(`:`);return a!==-1&&!i.endsWith(`]`)?i.slice(0,a):i};const parseMs=e=>{if(e===void 0)return void 0;const t=e.trim();if(!/^\d+$/.test(t))return void 0;const n=Number(t);return Number.isSafeInteger(n)?n:void 0};const boundedHintOf=e=>{const t=parseMs(e[`x-amz-retry-after`]);const n=parseMs(e[`x-distilled-retry-after`]);if(t===void 0)return n;return n===void 0?t:Math.max(t,n)};const recordRequest=(n,r=false)=>{const i=e.getCurrent();if(i!==void 0)t.set(i,{host:hostOf(n),oneShot:r,hintMs:void 0})};const recordResponse=(r,i)=>{const a=e.getCurrent();const o=a===void 0?void 0:t.get(a);if(o===void 0)return;if(r<300)n.set(o.host,(n.get(o.host)??0)+1);else o.hintMs=boundedHintOf(i)};const takeLastRequest=()=>{const n=e.getCurrent();const r=n===void 0?void 0:t.get(n);if(r===void 0)return{host:``,oneShot:false};t.delete(n);return r.hintMs===void 0?{host:r.host,oneShot:r.oneShot}:r};const successesOf=e=>n.get(e)??0;export{boundedHintOf,hostOf,recordRequest,recordResponse,successesOf,takeLastRequest};
|
|
2
|
+
//# sourceMappingURL=retry-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-state.js","names":["Fiber","lastByFiber","successesByHost","schemeEnd","url","start","end","authority","colon","value","trimmed","ms","amz","headers","distilled","fiber","last","status","host"],"sources":["../src/retry-state.ts"],"mappings":"+BAwBA,MA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AAU,IAAA,GAAY,IAAA,GAAYd,EAAY,IAAIc,CAAK,EACpE,GAAIC,IAAS,IAAA,GAAW,OACxB,GAAIC,EAAS,IACXf,EAAgB,IAAIc,EAAK,MAAOd,EAAgB,IAAIc,EAAK,IAAI,GAAK,GAAK,CAAC,MAExE,GAAK,OAAS,cAAcH,CAAO,CAEvC,EAMA,MAAa,oBAIR,CACH,MAAME,EAAQf,EAAM,WAAW,EAC/B,MAAMgB,EAAOD,IAAU,IAAA,GAAY,IAAA,GAAYd,EAAY,IAAIc,CAAK,EACpE,GAAIC,IAAS,IAAA,GAAW,MAAO,CAAE,KAAM,GAAI,QAAS,KAAM,EAC1Df,EAAY,OAAOc,CAAM,EACzB,OAAOC,EAAK,SAAW,IAAA,GAAY,CAAE,KAAMA,EAAK,KAAM,QAASA,EAAK,OAAQ,EAAIA,CAClF,EAGA,MAAa,YAAe,GAAyBd,EAAgB,IAAIgB,CAAI,GAAK"}
|
package/lib/retry.d.ts
CHANGED
|
@@ -21,10 +21,22 @@ import * as Schedule from "effect/Schedule";
|
|
|
21
21
|
* instead of an Effect `Schedule`, so bundles do not carry the Schedule
|
|
22
22
|
* machinery unless a caller supplies a schedule of their own.
|
|
23
23
|
*
|
|
24
|
-
* Delay before retry `n` (0-based)
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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.
|
|
28
40
|
*/
|
|
29
41
|
export interface Backoff {
|
|
30
42
|
readonly baseMs: number;
|
|
@@ -35,7 +47,64 @@ export interface Backoff {
|
|
|
35
47
|
readonly jitterMs?: number;
|
|
36
48
|
readonly minThrottleMs?: number;
|
|
37
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;
|
|
38
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;
|
|
39
108
|
export interface Options {
|
|
40
109
|
/**
|
|
41
110
|
* Predicate to determine if an error should trigger a retry.
|
|
@@ -123,27 +192,38 @@ export declare const resolveServerRetryHintCapMs: () => Effect.Effect<number, ne
|
|
|
123
192
|
*/
|
|
124
193
|
export declare const serverHintMillis: (error: unknown, capMs: number) => number | undefined;
|
|
125
194
|
/**
|
|
126
|
-
*
|
|
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:
|
|
127
197
|
*
|
|
128
|
-
*
|
|
129
|
-
* -
|
|
130
|
-
* -
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* -
|
|
134
|
-
* capped at 5s per delay
|
|
135
|
-
* - Ensures at least 500ms delay for throttling errors
|
|
136
|
-
* - Limits to 8 retry attempts
|
|
137
|
-
* - Applies jitter to avoid thundering herd
|
|
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}.
|
|
138
204
|
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* high request concurrency routinely outlast a short 5-attempt/3s policy
|
|
142
|
-
* 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}.
|
|
143
207
|
*/
|
|
144
|
-
/** The policy used when the context provides none. */
|
|
145
208
|
export declare const defaultOptions: Options;
|
|
146
209
|
export declare const makeDefault: Factory;
|
|
210
|
+
/**
|
|
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.
|
|
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;
|
|
147
227
|
export declare const throttlingFactory: Factory;
|
|
148
228
|
export declare const throttlingOptions: Options;
|
|
149
229
|
export declare const transientFactory: Factory;
|
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,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,iFAAiF;IACjF,QAAQ,CAAC,gBAAgB,CAA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Q,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 +1 @@
|
|
|
1
|
-
export { retry$DEFAULT_SERVER_RETRY_HINT_CAP_MS as DEFAULT_SERVER_RETRY_HINT_CAP_MS, retry$ServerRetryHintCapMs as ServerRetryHintCapMs, retry$capped as capped, retry$defaultOptions as defaultOptions, retry$jittered as jittered, 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";
|
|
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";
|
|
@@ -97,11 +97,29 @@ export declare const Struct: (fields: Readonly<Record<string, Lite>>) => Lite;
|
|
|
97
97
|
* `StructWithRest` builds them.
|
|
98
98
|
*/
|
|
99
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;
|
|
100
108
|
/** A lazily resolved schema; `.ast` is a Suspend node whose thunk resolves the target. */
|
|
101
109
|
export declare const suspend: (f: () => Lite) => Lite;
|
|
102
110
|
/** Rename struct keys on the wire: `{ typeKey: "wire_key" }`. */
|
|
103
111
|
export declare const encodeKeys: (mapping: Readonly<Record<string, string>>) => (s: Lite) => Lite;
|
|
104
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
|
+
};
|
|
105
123
|
export declare const Date: Lite;
|
|
106
124
|
export declare const Duration: Lite;
|
|
107
125
|
export declare const Redacted: (value: Lite) => Lite;
|
|
@@ -148,11 +166,14 @@ export declare const TaggedError: (_identifier?: string) => (tag: string, fields
|
|
|
148
166
|
*/
|
|
149
167
|
export declare const at: (build: (j: number) => unknown, j: number) => any;
|
|
150
168
|
/**
|
|
151
|
-
* The Effect schema equivalent to a lite node
|
|
152
|
-
*
|
|
153
|
-
*
|
|
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.
|
|
154
173
|
*/
|
|
155
174
|
/** The Effect Schema functions the bridge uses (passed in, so callers import only these). */
|
|
156
|
-
export type EffectSchemaApi = Pick<typeof import("effect/Schema"), "Any" | "Array" | "Boolean" | "Literal" | "Null" | "Number" | "Record" | "String" | "Struct" | "StructWithRest" | "Tuple" | "Undefined" | "Union" | "Unknown" | "Void" | "declare" | "make" | "optional" | "suspend"
|
|
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">>;
|
|
157
178
|
export declare const toEffect: (S: EffectSchemaApi, ast: Node) => unknown;
|
|
158
179
|
//# sourceMappingURL=schema-lite-impl.d.ts.map
|
|
@@ -1 +1 @@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@@
|
|
|
1
|
-
export { schema_lite_impl$Any as Any, schema_lite_impl$Array as Array, schema_lite_impl$Boolean as Boolean, schema_lite_impl$Date as Date, schema_lite_impl$Duration as Duration, schema_lite_impl$Literal as Literal, schema_lite_impl$Literals as Literals, schema_lite_impl$Null as Null, schema_lite_impl$NullOr as NullOr, schema_lite_impl$Number as Number, schema_lite_impl$Record as Record, schema_lite_impl$Redacted as Redacted, schema_lite_impl$String as String, schema_lite_impl$Struct as Struct, schema_lite_impl$StructWithRest as StructWithRest, schema_lite_impl$TaggedError as TaggedError, schema_lite_impl$Tuple as Tuple, schema_lite_impl$Undefined as Undefined, schema_lite_impl$Union as Union, schema_lite_impl$Unknown as Unknown, schema_lite_impl$Void as Void, schema_lite_impl$at as at, schema_lite_impl$declare as declare, schema_lite_impl$encodeKeys as encodeKeys, schema_lite_impl$encodeKeysKey as encodeKeysKey, schema_lite_impl$fromNode as fromNode, schema_lite_impl$instanceOf as instanceOf, schema_lite_impl$isLite as isLite, schema_lite_impl$liteKey as liteKey, schema_lite_impl$optional as optional, schema_lite_impl$suspend as suspend, schema_lite_impl$toEffect as toEffect } from "./_bundle/base.js";
|
|
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";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-lite-typed.d.ts","
|
|
1
|
+
{"version":3,"file":"schema-lite-typed.d.ts","sources":["../src/schema-lite-typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,CAAC,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAE3C,mBAAmB,eAAe,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAA4B,OAAO,CAAC,CAAC,QAAQ,CAAC;AACnE,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,cAAc,EAAkC,OAAO,CAAC,CAAC,cAAc,CAAC;AACrF,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,KAAK,EAAyB,OAAO,CAAC,CAAC,KAAK,CAAC;AAC1D,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,KAAK,EAAyB,OAAO,CAAC,CAAC,KAAK,CAAC;AAC1D,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,QAAQ,EAA4B,OAAO,CAAC,CAAC,QAAQ,CAAC;AACnE,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,KAAK,EAAyB,OAAO,CAAC,CAAC,KAAK,CAAC;AAC1D,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,UAAU,EAA8B,OAAO,CAAC,CAAC,UAAU,CAAC;AACzE,eAAO,MAAM,QAAQ,EAA4B,OAAO,CAAC,CAAC,QAAQ,CAAC;AAEnE,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,MAAM,EAA0B,OAAO,CAAC,CAAC,MAAM,CAAC;AAC7D,eAAO,MAAM,GAAG,EAA0B,OAAO,CAAC,CAAC,GAAG,CAAC;AACvD,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,IAAI,EAAwB,OAAO,CAAC,CAAC,IAAI,CAAC;AACvD,eAAO,MAAM,QAAQ,EAA4B,OAAO,CAAC,CAAC,QAAQ,CAAC;AACnE,eAAO,MAAM,OAAO,EAA2B,OAAO,CAAC,CAAC,OAAO,CAAC;AAChE,eAAO,MAAM,IAAI,EAAwB,OAAO,CAAC,CAAC,IAAI,CAAC;AACvD,eAAO,MAAM,IAAI,EAAwB,OAAO,CAAC,CAAC,IAAI,CAAC;AACvD,eAAO,MAAM,GAAG,EAAuB,OAAO,CAAC,CAAC,GAAG,CAAC;AAEpD,eAAO,MAAM,WAAW,EAA+B,CAAC,CAAC,kBAAkB,CAAC;AAC5E,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/lib/schema-lite.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export type AnyFn = (...args: any[]) => any;
|
|
|
10
10
|
export declare const optional: AnyFn;
|
|
11
11
|
export declare const Struct: AnyFn;
|
|
12
12
|
export declare const StructWithRest: AnyFn;
|
|
13
|
+
export declare const Extend: AnyFn;
|
|
13
14
|
export declare const suspend: AnyFn;
|
|
14
15
|
export declare const Array: AnyFn;
|
|
15
16
|
export declare const Record: AnyFn;
|
package/lib/schema-lite.d.ts.map
CHANGED
|
@@ -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,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,QAAQ,EAAE,GAAgB,CAAC;AACxC,eAAO,MAAM,OAAO,EAAE,GAAe,CAAC;AACtC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,GAAG,EAAE,GAAW,CAAC;AAE9B,eAAO,MAAM,WAAW,EAA+B,CAAC,CAAC,kBAAkB,CAAC;AAC5E,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAElF,mEAAmE;AACnE,eAAO,MAAM,EAAE,aAAO,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
|
package/lib/schema-lite.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { schema_lite$Any as Any, schema_lite$Array as Array, schema_lite$Boolean as Boolean, schema_lite$Date as Date, schema_lite$Duration as Duration, schema_lite$Int as Int, schema_lite$Literal as Literal, schema_lite$Literals as Literals, schema_lite$Null as Null, schema_lite$NullOr as NullOr, schema_lite$Number as Number, schema_lite$Record as Record, schema_lite$Redacted as Redacted, schema_lite$String as String, schema_lite$Struct as Struct, schema_lite$StructWithRest as StructWithRest, schema_lite$TaggedError as TaggedError, schema_lite$Tuple as Tuple, schema_lite$Union as Union, schema_lite$Unknown as Unknown, schema_lite$Void as Void, schema_lite$at as at, schema_lite$declare as declare, schema_lite$encodeKeys as encodeKeys, schema_lite$instanceOf as instanceOf, schema_lite$liteKey as liteKey, schema_lite$optional as optional, schema_lite$suspend as suspend, schema_lite$toEffect as toEffect } from "./_bundle/rest.js";
|
|
1
|
+
export { schema_lite$Any as Any, schema_lite$Array as Array, schema_lite$Boolean as Boolean, schema_lite$Date as Date, schema_lite$Duration as Duration, schema_lite$Extend as Extend, schema_lite$Int as Int, schema_lite$Literal as Literal, schema_lite$Literals as Literals, schema_lite$Null as Null, schema_lite$NullOr as NullOr, schema_lite$Number as Number, schema_lite$Record as Record, schema_lite$Redacted as Redacted, schema_lite$String as String, schema_lite$Struct as Struct, schema_lite$StructWithRest as StructWithRest, schema_lite$TaggedError as TaggedError, schema_lite$Tuple as Tuple, schema_lite$Union as Union, schema_lite$Unknown as Unknown, schema_lite$Void as Void, schema_lite$at as at, schema_lite$declare as declare, schema_lite$encodeKeys as encodeKeys, schema_lite$instanceOf as instanceOf, schema_lite$liteKey as liteKey, schema_lite$optional as optional, schema_lite$suspend as suspend, schema_lite$toEffect as toEffect } from "./_bundle/rest.js";
|
package/lib/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,mBAAmB,eAAe,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGxE,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AAEnC,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAG5C,eAAO,MAAM,QAAQ,EAAE,KAA2B,CAAC;AACnD,eAAO,MAAM,MAAM,EAAE,KAAyB,CAAC;AAC/C,eAAO,MAAM,cAAc,EAAE,KAAiC,CAAC;AAC/D,eAAO,MAAM,OAAO,EAAE,KAA0C,CAAC;AACjE,eAAO,MAAM,KAAK,EAAE,KAAwC,CAAC;AAC7D,eAAO,MAAM,MAAM,EAAE,KAA4D,CAAC;AAClF,eAAO,MAAM,KAAK,EAAE,KAAwB,CAAC;AAC7C,eAAO,MAAM,OAAO,EAAE,KAA0B,CAAC;AACjD,eAAO,MAAM,QAAQ,EAAE,KAA2B,CAAC;AACnD,eAAO,MAAM,MAAM,EAAE,KAAyB,CAAC;AAC/C,eAAO,MAAM,KAAK,EAAE,KAAwB,CAAC;AAC7C,eAAO,MAAM,UAAU,EAAE,KAA6B,CAAC;AAGvD,eAAO,MAAM,MAAM,EAAE,GAAc,CAAC;AACpC,eAAO,MAAM,MAAM,EAAE,GAAc,CAAC;AACpC,eAAO,MAAM,OAAO,EAAE,GAAe,CAAC;AACtC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,OAAO,EAAE,GAAe,CAAC;AACtC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,IAAI,EAAE,GAAY,CAAC;AAChC,eAAO,MAAM,GAAG,EAAE,GAAW,CAAC;AAmC9B;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,GAAG,CAAC;CAC1C;AAqED,4DAA4D;AAC5D,eAAO,MAAM,QAAQ,YAAa,WAAW,QAAQ,OAAO,KAAG,CAAC,CAAC,GACjC,CAAC;AA+HjC,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,CAAC,WAAqD,CAAC"}
|
package/lib/sdk-error.d.ts
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
* would. It is typed, so it fails the call instead of crashing the fiber,
|
|
8
8
|
* and it is never retried.
|
|
9
9
|
*
|
|
10
|
+
* It is also what a call fails with when something under it threw (the
|
|
11
|
+
* defect boundary, `failed` in `./api.ts`): the message names the operation
|
|
12
|
+
* and what was thrown, and `cause` is the thrown value.
|
|
13
|
+
*
|
|
10
14
|
* Defined on its own, in core's `base` bundle group, so pagination and
|
|
11
15
|
* the protocols fail with it without importing the REST modules.
|
|
12
16
|
*/
|
package/lib/sdk-error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-error.d.ts","
|
|
1
|
+
{"version":3,"file":"sdk-error.d.ts","sources":["../src/sdk-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;;;;AAEjD,qBAAa,QACX,SAAQ,aAAa,CAAC,aAEpB;CAAG;AAEP;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,QAAQ,MAAM,WAAW,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAOhF,CAAC"}
|
package/lib/send.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send one HTTP request for an operation: `Telemetry.execute` (spans, trace
|
|
3
|
+
* headers, debug output), plus the facts the retry layer reads after a
|
|
4
|
+
* failure (see `./retry-state.ts`): which host the request went to, whether
|
|
5
|
+
* it succeeded, and the response's bounded retry hint.
|
|
6
|
+
*
|
|
7
|
+
* Every protocol sends through this, so the retry budget and the
|
|
8
|
+
* `x-amz-retry-after` / `x-distilled-retry-after` headers work for all of
|
|
9
|
+
* them. A protocol that calls `client.execute` directly still retries, on
|
|
10
|
+
* the plain backoff, outside the budget.
|
|
11
|
+
*
|
|
12
|
+
* A body it cannot send twice (the caller's own stream) makes the call
|
|
13
|
+
* `oneShot`: the retry layer then never sends it again. A stream body is
|
|
14
|
+
* one-shot unless the protocol says otherwise (S3 replays a Blob's stream).
|
|
15
|
+
*
|
|
16
|
+
* Redirects are followed here, not by `fetch`. `fetch` removes only
|
|
17
|
+
* `Authorization` and `Cookie` when a redirect goes to another origin, so
|
|
18
|
+
* an API key in `x-api-key`, `DD-API-KEY` or `X-Auth-Token` would reach the
|
|
19
|
+
* new host. A hop to the same origin keeps every header; a hop to another
|
|
20
|
+
* origin keeps only {@link CROSS_ORIGIN_HEADERS}. Every `HttpClient` gets
|
|
21
|
+
* the same rule: the Node clients hand a `3xx` back too.
|
|
22
|
+
*/
|
|
23
|
+
import * as Context from "effect/Context";
|
|
24
|
+
import * as Effect from "effect/Effect";
|
|
25
|
+
import type * as HttpClient from "effect/http/HttpClient";
|
|
26
|
+
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
27
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
28
|
+
import type * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
29
|
+
/** Redirects followed before the last `3xx` is returned as the response. */
|
|
30
|
+
export declare const MAX_REDIRECTS = 5;
|
|
31
|
+
/**
|
|
32
|
+
* The only request headers a redirect to another origin keeps. Credentials,
|
|
33
|
+
* signatures and provider headers are all dropped.
|
|
34
|
+
*/
|
|
35
|
+
export declare const CROSS_ORIGIN_HEADERS: ReadonlySet<string>;
|
|
36
|
+
export declare const send: (context: Context.Context<any>, client: HttpClient.HttpClient, request: HttpClientRequest.HttpClientRequest, oneShot?: boolean) => Effect.Effect<HttpClientResponse.HttpClientResponse, HttpClientError.HttpClientError>;
|
|
37
|
+
//# sourceMappingURL=send.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.d.ts","sources":["../src/send.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AAQ1E,4EAA4E;AAC5E,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAenD,CAAC;AAmEH,eAAO,MAAM,IAAI,YACN,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UACrB,UAAU,CAAC,UAAU,WACpB,iBAAiB,CAAC,iBAAiB,YAClC,OAAO,KAChB,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,eAAe,CAAC,eAAe,CAuBtF,CAAC"}
|
package/lib/send.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{recordRequest as e,recordResponse as t}from"./retry-state.js";import{execute as n}from"./telemetry.js";import*as r from"effect/Context";import*as i from"effect/Effect";import*as a from"effect/Option";import*as o from"effect/http/FetchHttpClient";import*as s from"effect/http/Headers";import*as c from"effect/http/HttpBody";import*as l from"effect/http/HttpClientRequest";import*as u from"effect/http/Url";import*as d from"effect/http/UrlParams";import*as f from"effect/Result";const p=5;const m=/* @__PURE__ */ new Set([`accept`,`accept-encoding`,`accept-language`,`cache-control`,`content-language`,`content-length`,`content-type`,`if-match`,`if-modified-since`,`if-none-match`,`if-range`,`if-unmodified-since`,`range`,`user-agent`]);const h=typeof globalThis.document!==`undefined`||typeof globalThis.importScripts===`function`;const manualRedirects=e=>{if(h)return void 0;const t=r.getOrUndefined(e,o.RequestInit);return t?.redirect!==void 0?void 0:{...t,redirect:`manual`}};const nextHop=(e,t,n)=>{const r=t.status;const i=t.headers.location;if(r<300||r>=400||r===304||i===void 0)return void 0;const o=u.fromString(i,e.url);if(f.isFailure(o))return void 0;const p=o.success;p.hash=``;let h=e.method;let g=e.body;let _=e.headers;if((r===301||r===302)&&h===`POST`||r===303&&h!==`GET`&&h!==`HEAD`){h=`GET`;g=c.empty;_=s.remove(_,`content-type`);_=s.remove(_,`content-length`);_=s.remove(_,`content-encoding`)}else if(g._tag!==`Empty`&&!n)return;if(p.origin!==new URL(e.url).origin)_=s.fromInput(Object.entries(_).filter(([e])=>m.has(e)));return l.makeWith(h,p.href,d.empty,a.none(),_,g)};const send=(r,a,s,c)=>{const l=c??s.body._tag===`Stream`;const hop=(o,s)=>i.suspend(()=>{e(o.url,l);return i.flatMap(n(r,a,o),e=>{const n=s<5?nextHop(o,e,!l):void 0;if(n!==void 0)return hop(n,s+1);t(e.status,e.headers);return i.succeed(e)})});const u=manualRedirects(r);const d=hop(s,0);return u===void 0?d:i.provideService(d,o.RequestInit,u)};export{m as CROSS_ORIGIN_HEADERS,p as MAX_REDIRECTS,send};
|
|
2
|
+
//# sourceMappingURL=send.js.map
|
package/lib/send.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.js","names":["Telemetry.execute","Context","Effect","Option","FetchHttpClient","Headers","HttpBody","HttpClientRequest","Url","UrlParams","Result","MAX_REDIRECTS","CROSS_ORIGIN_HEADERS","isBrowser","init","context","status","response","location","parsed","request","url","method","body","headers","replayable","name","once","oneShot","recordRequest","execute","client","next","redirects","recordResponse","sent"],"sources":["../src/send.ts"],"mappings":"oeAuCA,MAAaW,EAAgB,EAM7B,MAAaC,kBAA4C,IAAI,IAAI,CAC/D,SACA,kBACA,kBACA,gBACA,mBACA,iBACA,eACA,WACA,oBACA,gBACA,WACA,sBACA,QACA,YACF,CAAC,EAID,MAAMC,EACJ,OAAQ,WAAsC,WAAa,aAC3D,OAAQ,WAA2C,gBAAkB,WAMvE,MAAM,gBAAmB,GAAsE,CAC7F,GAAIA,EAAW,OAAO,IAAA,GACtB,MAAMC,EAAOb,EAAQ,eAAec,EAASX,EAAgB,WAAW,EACxE,OAAOU,GAAM,WAAa,IAAA,GAAY,IAAA,GAAY,CAAE,GAAGA,EAAM,SAAU,QAAS,CAClF,EAMA,MAAM,SACJ,EACA,EACA,IACoD,CACpD,MAAME,EAASC,EAAS,OACxB,MAAMC,EAAWD,EAAS,QAAQ,SAClC,GAAID,EAAS,KAAOA,GAAU,KAAOA,IAAW,KAAOE,IAAa,IAAA,GAAW,OAAO,IAAA,GACtF,MAAMC,EAASX,EAAI,WAAWU,EAAUE,EAAQ,GAAG,EACnD,GAAIV,EAAO,UAAUS,CAAM,EAAG,OAAO,IAAA,GACrC,MAAME,EAAMF,EAAO,QACnB,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IAAA,GAAYqB,EAAOjC,EAAO,eAAeiC,EAAM/B,EAAgB,YAAaU,CAAI,CAClG"}
|
package/lib/sensitive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensitive.d.ts","
|
|
1
|
+
{"version":3,"file":"sensitive.d.ts","sources":["../src/sensitive.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAI7C,eAAO,MAAM,oBAAoB,eAEhC,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,2FAA2F;AAC3F,eAAO,MAAM,WAAW,QAAS,GAAG,CAAC,GAAG,KAAG,OACM,CAAC;AAIlD;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAS,GAAG,CAAC,GAAG,KAAG,OAyB7C,CAAC;AAEF,wGAAwG;AACxG,eAAO,MAAM,WAAW,GAAI,CAAC,OAAO,GAAG,CAAC,GAAG,SAAS,CAAC,KAAG,CAAC,GAAG,OAAO,QAC3B,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAS,GAAG,CAAC,GAAG,SAAS,OAAO,KAAG,OACN,CAAC;AAEvD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,QACnB,GAAG,CAAC,GAAG,SACL,OAAO,iBACC,WAAW,CAAC,MAAM,CAAC,KACjC,OAAgD,CAAC"}
|