@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/protocol-rest.d.ts
CHANGED
|
@@ -1,36 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
* Generic REST protocol factory for simple bearer/header-auth JSON APIs
|
|
3
|
-
* (Neon, Fly.io, PlanetScale, Supabase, Turso, …).
|
|
4
|
-
*
|
|
5
|
-
* `makeRestProtocol(options)` builds a core {@link API.Protocol} layer:
|
|
6
|
-
*
|
|
7
|
-
* request: credentials resolved from the CALLING fiber's context on every
|
|
8
|
-
* request (the layer itself is memoized per process — see
|
|
9
|
-
* `core/api`), auth headers + base URL from the provider's
|
|
10
|
-
* options, request built by `buildRequest` from
|
|
11
|
-
* `core/protocol-http` (deep-unwrapping any `Redacted` input
|
|
12
|
-
* values first)
|
|
13
|
-
*
|
|
14
|
-
* response: 2xx JSON → optional `transformResponse` → recursive wire→TS
|
|
15
|
-
* key mapping (`mapKeys`) → `Redacted` wrapping of members
|
|
16
|
-
* marked with {@link SensitiveValue}; non-2xx → typed error:
|
|
17
|
-
* per-op matcher classes (`matchTypedError`), then the status
|
|
18
|
-
* map (default `HTTP_STATUS_MAP`), then an `InternalServerError`
|
|
19
|
-
* for unmapped 5xx, then the provider's `unknownError` fallback
|
|
20
|
-
* — with `retryAfter` durations stamped from the standard hint
|
|
21
|
-
* headers on retryable statuses.
|
|
22
|
-
*
|
|
23
|
-
* Anything provider-specific (envelope quirks, bespoke error codes) belongs
|
|
24
|
-
* in the provider package — via these options or a hand-written protocol.
|
|
25
|
-
*/
|
|
1
|
+
import * as Context from "effect/Context";
|
|
26
2
|
import * as Effect from "effect/Effect";
|
|
27
|
-
import * as
|
|
3
|
+
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
4
|
+
import type * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
5
|
+
import type * as Schema from "effect/Schema";
|
|
28
6
|
import type * as AST from "effect/SchemaAST";
|
|
29
|
-
import * as
|
|
30
|
-
|
|
7
|
+
import type * as Stream from "effect/Stream";
|
|
8
|
+
import { rawResponseRootSymbol } from "./annotations.ts";
|
|
9
|
+
import { InternalServerError } from "./errors.ts";
|
|
10
|
+
import { unwrapRedactedDeep } from "./plain-values.ts";
|
|
11
|
+
import { type InvalidInput } from "./protocol-http.ts";
|
|
12
|
+
import type { DeclaredErrorClass, Protocol } from "./protocol.ts";
|
|
13
|
+
import { SdkError } from "./sdk-error.ts";
|
|
14
|
+
import { sensitiveValueSymbol, wrapSensitive } from "./sensitive.ts";
|
|
15
|
+
import type { UnknownErrorProps } from "./unknown-error.ts";
|
|
16
|
+
export { sensitiveValueSymbol };
|
|
31
17
|
/**
|
|
32
|
-
* Marks a string member as sensitive (mirrors
|
|
33
|
-
* The REST protocol wraps decoded values in
|
|
18
|
+
* Marks a string member, map value or list element as sensitive (mirrors
|
|
19
|
+
* `smithy.api#sensitive`). The REST protocol wraps decoded values in
|
|
20
|
+
* `Redacted` on the way out (an untyped `S.Unknown` value whole) and
|
|
34
21
|
* accepts `string | Redacted<string>` on the way in (unwrapped before
|
|
35
22
|
* serialization). Takes an ignored argument so generators can inline the
|
|
36
23
|
* smithy trait value (`T.SensitiveValue({})`).
|
|
@@ -42,27 +29,51 @@ export declare const rawResponseSymbol: unique symbol;
|
|
|
42
29
|
* body (mirrors `com.distilled.openapi#rawResponse`).
|
|
43
30
|
*/
|
|
44
31
|
export declare const RawResponse: (_value?: unknown) => import("./trait.ts").Annotation;
|
|
45
|
-
export declare const rawResponseRootSymbol: unique symbol;
|
|
46
32
|
/**
|
|
47
33
|
* Marks a response schema whose ENTIRE value is the response body (the
|
|
48
34
|
* generator's `rootPipe` for synthesized bare-payload wrappers): the emitted
|
|
49
35
|
* response type IS the payload type and the protocol returns the mapped body
|
|
50
36
|
* directly.
|
|
51
37
|
*/
|
|
38
|
+
export { rawResponseRootSymbol };
|
|
52
39
|
export declare const RawResponseRoot: () => import("./trait.ts").Annotation;
|
|
40
|
+
export declare const binaryResponseSymbol: unique symbol;
|
|
41
|
+
/**
|
|
42
|
+
* Decode a successful raw binary response as a {@link BinaryStream} of the
|
|
43
|
+
* body, never read as text or into one buffer. On a whole output, the
|
|
44
|
+
* output is the stream. On the `RawResponse()` member of a structure
|
|
45
|
+
* output, that member gets the stream and the structure's `Header` members
|
|
46
|
+
* get their response headers (a download's `Content-Type`).
|
|
47
|
+
*/
|
|
48
|
+
export declare const BinaryResponse: () => import("./trait.ts").Annotation;
|
|
53
49
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* the raw string.
|
|
50
|
+
* A binary download's body, read as it arrives. It fails with the
|
|
51
|
+
* `HttpClientError` of a read that breaks off (a connection reset).
|
|
52
|
+
* `Stream.mkUint8Array` collects it into one buffer.
|
|
58
53
|
*/
|
|
59
|
-
export
|
|
54
|
+
export type BinaryStream = Stream.Stream<Uint8Array, HttpClientError.HttpClientError>;
|
|
55
|
+
/** The schema of a {@link BinaryStream}, for a binary download's body member. */
|
|
56
|
+
export declare const BinaryStream: Schema.Schema<BinaryStream>;
|
|
60
57
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
58
|
+
* A binary upload's body from a stream: a `T.HttpBody()` member may take
|
|
59
|
+
* one, and the protocol sends it as it is pulled, without buffering it.
|
|
60
|
+
* A stream can be sent once, so a call with one is never retried. With no
|
|
61
|
+
* modeled `Content-Length` member set, the body goes out chunked.
|
|
64
62
|
*/
|
|
65
|
-
export
|
|
63
|
+
export type UploadStream = Stream.Stream<Uint8Array, unknown>;
|
|
64
|
+
/** A raw request body (`T.HttpBody()` on a binary member): what `buildRequest` sends verbatim. */
|
|
65
|
+
export type RawBody = string | Uint8Array | ArrayBuffer | Blob | UploadStream;
|
|
66
|
+
/** The schema of a {@link RawBody}, for a binary upload's body member. */
|
|
67
|
+
export declare const RawBody: Schema.Schema<RawBody>;
|
|
68
|
+
export { unwrapRedactedDeep };
|
|
69
|
+
export { wrapSensitive };
|
|
70
|
+
/**
|
|
71
|
+
* Whether any member, map value or list element reachable from `ast` is
|
|
72
|
+
* marked {@link SensitiveValue}. Such an output is decoded through
|
|
73
|
+
* {@link wrapSensitive}, and its parse errors withhold the response body (see
|
|
74
|
+
* {@link checkSuccess}, which every REST-style protocol's success path uses).
|
|
75
|
+
*/
|
|
76
|
+
export declare const hasSensitiveMember: (ast: AST.AST) => boolean;
|
|
66
77
|
/** What the wire said about a failure, for the `unknownError` fallback. */
|
|
67
78
|
export interface RestErrorInfo {
|
|
68
79
|
readonly status: number;
|
|
@@ -73,26 +84,69 @@ export interface RestErrorInfo {
|
|
|
73
84
|
readonly body: unknown;
|
|
74
85
|
readonly headers: Record<string, string | undefined>;
|
|
75
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* The core {@link UnknownErrorProps} of a failure, for an SDK's
|
|
89
|
+
* `unknownError`: `new UnknownNeonError(unknownErrorProps(info))`. A number
|
|
90
|
+
* code becomes its string.
|
|
91
|
+
*/
|
|
92
|
+
export declare const unknownErrorProps: (info: RestErrorInfo) => UnknownErrorProps;
|
|
93
|
+
/**
|
|
94
|
+
* A 2xx body that failed strict validation, or a non-JSON 2xx body for an
|
|
95
|
+
* output with sensitive members, for the `parseError` option.
|
|
96
|
+
*/
|
|
97
|
+
export interface RestParseErrorInfo {
|
|
98
|
+
/** `"[REDACTED]"` when the output has sensitive members. */
|
|
99
|
+
readonly body: unknown;
|
|
100
|
+
readonly cause: unknown;
|
|
101
|
+
}
|
|
76
102
|
export interface RestErrorEnvelope {
|
|
77
103
|
readonly code?: string | number;
|
|
78
104
|
readonly message?: string;
|
|
79
105
|
}
|
|
80
|
-
|
|
106
|
+
/**
|
|
107
|
+
* What this module's own code fails with, whatever the options: the errors
|
|
108
|
+
* every REST protocol declares. A label that would address another resource
|
|
109
|
+
* (`InvalidInput`), a request it can't build or an operation it can't
|
|
110
|
+
* stream (`SdkError`), the transport or a body read (`HttpClientError`), and
|
|
111
|
+
* a 5xx response that neither the operation nor its service declares
|
|
112
|
+
* (`InternalServerError`, which the retry policy retries).
|
|
113
|
+
*/
|
|
114
|
+
export type RestProtocolError = InvalidInput | SdkError | HttpClientError.HttpClientError | InternalServerError;
|
|
115
|
+
/**
|
|
116
|
+
* Options of {@link restProtocol}. The type parameters after `Credentials`
|
|
117
|
+
* are what each option fails with or reads; `restProtocol` infers them from
|
|
118
|
+
* the options, and they are the errors its protocol declares.
|
|
119
|
+
*/
|
|
120
|
+
export interface RestProtocolOptions<Credentials, CredentialsError, CredentialsRequirements, RouteError, ClassifiedError, UnknownError, ParseError> {
|
|
121
|
+
/**
|
|
122
|
+
* Resolve credentials ON THE CALLING FIBER -- evaluated per request, so
|
|
123
|
+
* context-provided credentials and token refreshes are picked up. Either
|
|
124
|
+
* an effect, or -- for the distilled credentials-service convention --
|
|
125
|
+
* the `Credentials` service key whose value is that effect (read from the calling fiber's context; an
|
|
126
|
+
* already-resolved `Effect.succeed` value costs no extra fiber step). What
|
|
127
|
+
* it fails with (declared on the credentials) reaches every operation
|
|
128
|
+
* through the protocol, and what it reads is the protocol's requirement.
|
|
129
|
+
*/
|
|
130
|
+
readonly credentials: Effect.Effect<Credentials, CredentialsError, CredentialsRequirements> | Context.Key<CredentialsRequirements, Effect.Effect<Credentials, CredentialsError>>;
|
|
81
131
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
132
|
+
* API base URL from the resolved credentials. Receives the operation's
|
|
133
|
+
* route so APIs with more than one endpoint (e.g. S2's account vs
|
|
134
|
+
* per-basin hosts, chosen by path) can route per request; single-endpoint
|
|
135
|
+
* providers ignore the argument. `server` is the operation's host name
|
|
136
|
+
* (`T.Http({ server })`) for APIs that serve some operations from another
|
|
137
|
+
* host; map it to a base URL from the credentials. To refuse a route (e.g.
|
|
138
|
+
* a required scope missing from the credentials), return `Effect.fail` of
|
|
139
|
+
* the error the call fails with. A THROWN error fails the call with
|
|
140
|
+
* `SdkError`, as anything thrown under a call does (the defect boundary,
|
|
141
|
+
* `./api.ts`).
|
|
90
142
|
*/
|
|
91
|
-
readonly credentials:
|
|
92
|
-
|
|
93
|
-
|
|
143
|
+
readonly baseUrl: (credentials: Credentials, target: {
|
|
144
|
+
readonly uri: string;
|
|
145
|
+
readonly method: string;
|
|
146
|
+
readonly server?: string | undefined;
|
|
147
|
+
}) => string | Effect.Effect<never, RouteError>;
|
|
94
148
|
/** Auth (and any fixed) headers from the resolved credentials. */
|
|
95
|
-
readonly headers: (credentials:
|
|
149
|
+
readonly headers: (credentials: Credentials) => Record<string, string>;
|
|
96
150
|
/**
|
|
97
151
|
* Extract `{ code?, message? }` from a parsed non-2xx JSON body. Default:
|
|
98
152
|
* lenient `{ code?, message? | error? }` (covers the common REST error
|
|
@@ -100,25 +154,165 @@ export interface RestProtocolOptions<C> {
|
|
|
100
154
|
*/
|
|
101
155
|
readonly errorEnvelope?: (body: unknown) => RestErrorEnvelope | undefined;
|
|
102
156
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
157
|
+
* JSON pointer to the object that holds a failure's fields when the
|
|
158
|
+
* provider nests them, e.g. `"/error"` for `{ error: { status, details } }`.
|
|
159
|
+
* A typed error's declared fields are read there first, then at the top
|
|
160
|
+
* level of the body.
|
|
107
161
|
*/
|
|
108
|
-
readonly
|
|
109
|
-
/**
|
|
110
|
-
|
|
162
|
+
readonly errorFieldsAt?: string;
|
|
163
|
+
/**
|
|
164
|
+
* The provider's own reading of a failure, consulted before the classes
|
|
165
|
+
* the operation and its service declare: return the error to fail with, or
|
|
166
|
+
* `undefined` to decode the failure as usual. For rules a status alone
|
|
167
|
+
* can't express, e.g. a 403 that is a rate limit because of its headers.
|
|
168
|
+
*/
|
|
169
|
+
readonly classifyError?: (info: RestErrorInfo) => ClassifiedError | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* Fallback error for failures nothing else matched: the SDK's
|
|
172
|
+
* `Unknown<Sdk>Error`, built from {@link unknownErrorProps}. Only non-5xx
|
|
173
|
+
* statuses reach it (an undeclared 5xx is `InternalServerError`), so the
|
|
174
|
+
* class carries no retryable category.
|
|
175
|
+
*/
|
|
176
|
+
readonly unknownError: (info: RestErrorInfo) => UnknownError;
|
|
177
|
+
/**
|
|
178
|
+
* The SDK's `<Sdk>ParseError`, raised when a 2xx body does not match the
|
|
179
|
+
* operation's output schema in strict mode (see
|
|
180
|
+
* `core/response-validation`), and in every mode when a 2xx body for an
|
|
181
|
+
* output with sensitive members is not JSON. `body` is the parsed JSON, or
|
|
182
|
+
* the raw text when the body wasn't JSON, and `"[REDACTED]"` for an output
|
|
183
|
+
* with sensitive members; `cause` is the schema error, or `"Invalid JSON
|
|
184
|
+
* response"`.
|
|
185
|
+
*/
|
|
186
|
+
readonly parseError: (info: RestParseErrorInfo) => ParseError;
|
|
111
187
|
/** Transform the parsed 2xx JSON before decoding (e.g. stripNulls). */
|
|
112
188
|
readonly transformResponse?: (body: unknown) => unknown;
|
|
113
189
|
/** Passed through to `buildRequest` (member-header transforms). */
|
|
114
190
|
readonly mapMemberHeader?: (name: string, value: string) => string;
|
|
115
191
|
/** Passed through to `buildRequest` (wire names for unmodeled input keys). */
|
|
116
192
|
readonly unknownKeyToWire?: (key: string) => string;
|
|
193
|
+
/** Passed through to `buildRequest`: send `{}` when a bodied call has no body members. */
|
|
194
|
+
readonly emptyJsonBody?: boolean;
|
|
117
195
|
}
|
|
118
196
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
|
|
197
|
+
* The body of a streamed 2xx response, for {@link StreamFraming.stream}.
|
|
198
|
+
* `Failure` is what the call fails with.
|
|
199
|
+
*/
|
|
200
|
+
export interface FramedBody<Failure> {
|
|
201
|
+
readonly body: Stream.Stream<Uint8Array, Failure>;
|
|
202
|
+
/**
|
|
203
|
+
* Decode one parsed frame as one element of the output's `items`, as a
|
|
204
|
+
* 2xx body decodes (key mapping, strict validation, `Redacted`).
|
|
205
|
+
*/
|
|
206
|
+
readonly item: (json: unknown, text: string) => Effect.Effect<unknown, Failure>;
|
|
207
|
+
/** The SDK's parse error for a frame that is not JSON. */
|
|
208
|
+
readonly invalid: (text: string) => Failure;
|
|
209
|
+
}
|
|
210
|
+
/** A plain call's framed body, read whole: the output JSON, or not JSON. */
|
|
211
|
+
export interface CollectedBody {
|
|
212
|
+
readonly json: unknown;
|
|
213
|
+
readonly nonJson: boolean;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* How a server-streaming operation's body is framed (`API.makeStreaming`,
|
|
217
|
+
* output `{ items }`): its `framing` config, e.g. `ndjson` from
|
|
218
|
+
* core/ndjson. An operation without one can't stream (`.stream()` fails
|
|
219
|
+
* with `SdkError`, see `API.cannotStream`).
|
|
220
|
+
*/
|
|
221
|
+
export interface StreamFraming {
|
|
222
|
+
/**
|
|
223
|
+
* A plain call's whole body as `{ items }`, or `undefined` when the
|
|
224
|
+
* response's `Content-Type` is not this framing (decoded as usual).
|
|
225
|
+
*/
|
|
226
|
+
readonly collect: (text: string, contentType: string | undefined) => CollectedBody | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* Each frame as it arrives, through `item`. `open` sends the request and
|
|
229
|
+
* fails with the operation's typed error on a failed status.
|
|
230
|
+
*/
|
|
231
|
+
readonly stream: <Failure, Requirements>(open: Effect.Effect<FramedBody<Failure>, Failure, Requirements>) => Stream.Stream<unknown, Failure, Requirements>;
|
|
232
|
+
}
|
|
233
|
+
/** A 2xx body a protocol read, for {@link checkSuccess}. */
|
|
234
|
+
export interface SuccessBody {
|
|
235
|
+
/** The value to check and return: the body mapped onto the output's TS names. */
|
|
236
|
+
readonly value: unknown;
|
|
237
|
+
/** What a parse error reports as `body` for an output without sensitive members. */
|
|
238
|
+
readonly body: unknown;
|
|
239
|
+
/** Whether the body was not JSON. */
|
|
240
|
+
readonly nonJson: boolean;
|
|
241
|
+
}
|
|
242
|
+
/** The outcome of {@link checkSuccess}: the value, or the parse error's fields. */
|
|
243
|
+
export type SuccessCheck = {
|
|
244
|
+
readonly ok: true;
|
|
245
|
+
readonly value: unknown;
|
|
246
|
+
} | {
|
|
247
|
+
readonly ok: false;
|
|
248
|
+
readonly error: RestParseErrorInfo;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Check a 2xx body against the operation's output schema and deliver its
|
|
252
|
+
* sensitive values as `Redacted`. Every REST-style protocol ends its success
|
|
253
|
+
* path here, so all of them treat a body that can hold a secret alike:
|
|
254
|
+
*
|
|
255
|
+
* - The checked value comes back through {@link wrapSensitive}.
|
|
256
|
+
* - A mismatch (validating modes, see `core/response-validation`) reports
|
|
257
|
+
* `read.body` and the schema error.
|
|
258
|
+
* - For an output with sensitive members ({@link hasSensitiveMember}), a
|
|
259
|
+
* non-JSON body fails in every mode with `"Invalid JSON response"`, and a
|
|
260
|
+
* mismatch reports `body: "[REDACTED]"` and the schema error without the
|
|
261
|
+
* value it found (`withholdActual`).
|
|
262
|
+
*
|
|
263
|
+
* Synchronous, for protocols that already hold the calling fiber's context;
|
|
264
|
+
* {@link validateSuccess} is the `Effect` form.
|
|
265
|
+
*/
|
|
266
|
+
export declare const checkSuccess: (context: Context.Context<any>, outputAst: AST.AST, read: SuccessBody) => SuccessCheck;
|
|
267
|
+
/**
|
|
268
|
+
* {@link checkSuccess} on the calling fiber, failing with `parseError` (the
|
|
269
|
+
* SDK's `<Sdk>ParseError`) built from the withheld-or-not fields.
|
|
270
|
+
*/
|
|
271
|
+
export declare const validateSuccess: <E>(outputAst: AST.AST, read: SuccessBody, parseError: (info: RestParseErrorInfo) => E) => Effect.Effect<unknown, E>;
|
|
272
|
+
/**
|
|
273
|
+
* Read a 2xx response of a binary output ({@link BinaryResponse}) as a
|
|
274
|
+
* {@link BinaryStream}: the stream itself for a binary whole output, or the
|
|
275
|
+
* structure with the stream in its body member and its header members
|
|
276
|
+
* filled. `undefined` when the output is not binary. The call returns once
|
|
277
|
+
* the headers arrive; a body read that fails later (reset or abort
|
|
278
|
+
* mid-body) fails the stream with its `HttpClientError`. For hand-written
|
|
279
|
+
* protocols too, so every SDK decodes a download the same way.
|
|
280
|
+
*/
|
|
281
|
+
export declare const readBinaryResponse: (response: HttpClientResponse.HttpClientResponse, outputAst: AST.AST) => Effect.Effect<unknown> | undefined;
|
|
282
|
+
/**
|
|
283
|
+
* The class core has for `status`, when the operation or its service
|
|
284
|
+
* declares it: a list of declared errors can hold core's status classes
|
|
285
|
+
* (`Unauthorized`, `TooManyRequests`, ...), which are matched by status.
|
|
286
|
+
* For a protocol that reads failed responses itself.
|
|
287
|
+
*/
|
|
288
|
+
export declare const declaredStatusClass: (status: number, declared: ReadonlyArray<DeclaredErrorClass>) => DeclaredErrorClass | undefined;
|
|
289
|
+
/**
|
|
290
|
+
* The methods of {@link restProtocol}, for either form of `credentials`.
|
|
291
|
+
* For the protocols core builds on them (core/protocol-grpc).
|
|
292
|
+
*/
|
|
293
|
+
export declare const restProtocolMethods: <Credentials, CredentialsError = never, CredentialsRequirements = never, RouteError = never, ClassifiedError = never, UnknownError = never, ParseError = never>(options: RestProtocolOptions<Credentials, CredentialsError, CredentialsRequirements, RouteError, ClassifiedError, UnknownError, ParseError>) => Protocol<CredentialsError | RouteError | ClassifiedError | UnknownError | ParseError | RestProtocolError, CredentialsRequirements>;
|
|
294
|
+
/**
|
|
295
|
+
* {@link restProtocol}'s options for one form of `credentials`. The service
|
|
296
|
+
* key and the effect are separate signatures: a key is also an effect (of
|
|
297
|
+
* the service), so one signature for both could not tell which it is given.
|
|
298
|
+
*/
|
|
299
|
+
type TypedRestOptions<CredentialsSource, Credentials, RouteError, ClassifiedError, UnknownError, ParseError> = Omit<RestProtocolOptions<Credentials, never, never, RouteError, ClassifiedError, UnknownError, ParseError>, "credentials"> & {
|
|
300
|
+
/** See {@link RestProtocolOptions.credentials}. */
|
|
301
|
+
readonly credentials: CredentialsSource;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* The protocol for a simple REST JSON API (core/protocol). Assign the
|
|
305
|
+
* result to a module-level const in the provider's `protocol.ts`:
|
|
306
|
+
*
|
|
307
|
+
* export const NeonProtocol = restProtocol({ ... });
|
|
308
|
+
*
|
|
309
|
+
* A failed response becomes, in this order: what `classifyError` returns, a
|
|
310
|
+
* class the operation or its service declares (by its matchers, or by status
|
|
311
|
+
* for one of core's status classes), `InternalServerError` for any other
|
|
312
|
+
* 5xx, and `unknownError` for the rest. The protocol declares what the
|
|
313
|
+
* options and {@link RestProtocolError} fail with: the result's type lists
|
|
314
|
+
* them, so no SDK writes that list by hand.
|
|
122
315
|
*/
|
|
123
|
-
export declare
|
|
316
|
+
export declare function restProtocol<Credentials, CredentialsError = never, CredentialsRequirements = never, RouteError = never, ClassifiedError = never, UnknownError = never, ParseError = never>(options: TypedRestOptions<Context.Key<CredentialsRequirements, Effect.Effect<Credentials, CredentialsError>>, Credentials, RouteError, ClassifiedError, UnknownError, ParseError>): Protocol<CredentialsError | RouteError | ClassifiedError | UnknownError | ParseError | RestProtocolError, CredentialsRequirements>;
|
|
317
|
+
export declare function restProtocol<Credentials, CredentialsError = never, CredentialsRequirements = never, RouteError = never, ClassifiedError = never, UnknownError = never, ParseError = never>(options: TypedRestOptions<Effect.Effect<Credentials, CredentialsError, CredentialsRequirements>, Credentials, RouteError, ClassifiedError, UnknownError, ParseError>): Protocol<CredentialsError | RouteError | ClassifiedError | UnknownError | ParseError | RestProtocolError, CredentialsRequirements>;
|
|
124
318
|
//# sourceMappingURL=protocol-rest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-rest.d.ts","
|
|
1
|
+
{"version":3,"file":"protocol-rest.d.ts","sources":["../src/protocol-rest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAEpE,OAAO,KAAK,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAe,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAmB,mBAAmB,EAAE,MAAM,aA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B,CAAC,EACrE,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,UAAU,CACX,GACA,QAAQ,CACT,gBAAgB,GAAG,UAAU,GAAG,eAAe,GAAG,YAAY,GAAG,UAAU,GAAG,iBAAiB,EAC/F,uBAAuB,CACxB,CAAC"}
|
package/lib/protocol-rest.js
CHANGED
|
@@ -1,242 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Generic REST protocol factory for simple bearer/header-auth JSON APIs
|
|
3
|
-
* (Neon, Fly.io, PlanetScale, Supabase, Turso, …).
|
|
4
|
-
*
|
|
5
|
-
* `makeRestProtocol(options)` builds a core {@link API.Protocol} layer:
|
|
6
|
-
*
|
|
7
|
-
* request: credentials resolved from the CALLING fiber's context on every
|
|
8
|
-
* request (the layer itself is memoized per process — see
|
|
9
|
-
* `core/api`), auth headers + base URL from the provider's
|
|
10
|
-
* options, request built by `buildRequest` from
|
|
11
|
-
* `core/protocol-http` (deep-unwrapping any `Redacted` input
|
|
12
|
-
* values first)
|
|
13
|
-
*
|
|
14
|
-
* response: 2xx JSON → optional `transformResponse` → recursive wire→TS
|
|
15
|
-
* key mapping (`mapKeys`) → `Redacted` wrapping of members
|
|
16
|
-
* marked with {@link SensitiveValue}; non-2xx → typed error:
|
|
17
|
-
* per-op matcher classes (`matchTypedError`), then the status
|
|
18
|
-
* map (default `HTTP_STATUS_MAP`), then an `InternalServerError`
|
|
19
|
-
* for unmapped 5xx, then the provider's `unknownError` fallback
|
|
20
|
-
* — with `retryAfter` durations stamped from the standard hint
|
|
21
|
-
* headers on retryable statuses.
|
|
22
|
-
*
|
|
23
|
-
* Anything provider-specific (envelope quirks, bespoke error codes) belongs
|
|
24
|
-
* in the provider package — via these options or a hand-written protocol.
|
|
25
|
-
*/
|
|
26
|
-
import * as Effect from "effect/Effect";
|
|
27
|
-
import * as Layer from "effect/Layer";
|
|
28
|
-
import * as Redacted from "effect/Redacted";
|
|
29
|
-
import * as API from "./api.js";
|
|
30
|
-
import { makeAnnotation } from "./trait.js";
|
|
31
|
-
import { buildRequest, getPropAnn, getProps, isOpaqueValue, mapKeys, matchTypedError, resolveNode, } from "./protocol-http.js";
|
|
32
|
-
import { HTTP_STATUS_MAP, InternalServerError } from "./errors.js";
|
|
33
|
-
import { parseRetryAfterForStatus } from "./retry-after.js";
|
|
34
|
-
// =============================================================================
|
|
35
|
-
// Traits
|
|
36
|
-
// =============================================================================
|
|
37
|
-
export const sensitiveValueSymbol = Symbol.for("@distilled.cloud/core/sensitive-value");
|
|
38
|
-
/**
|
|
39
|
-
* Marks a string member as sensitive (mirrors `smithy.api#sensitive`).
|
|
40
|
-
* The REST protocol wraps decoded values in `Redacted` on the way out and
|
|
41
|
-
* accepts `string | Redacted<string>` on the way in (unwrapped before
|
|
42
|
-
* serialization). Takes an ignored argument so generators can inline the
|
|
43
|
-
* smithy trait value (`T.SensitiveValue({})`).
|
|
44
|
-
*/
|
|
45
|
-
export const SensitiveValue = (_value) => makeAnnotation(sensitiveValueSymbol, true);
|
|
46
|
-
export const rawResponseSymbol = Symbol.for("@distilled.cloud/core/raw-response");
|
|
47
|
-
/**
|
|
48
|
-
* Marks the sole output member that carries a bare (array/scalar) response
|
|
49
|
-
* body (mirrors `com.distilled.openapi#rawResponse`).
|
|
50
|
-
*/
|
|
51
|
-
export const RawResponse = (_value) => makeAnnotation(rawResponseSymbol, true);
|
|
52
|
-
export const rawResponseRootSymbol = Symbol.for("@distilled.cloud/core/raw-response-root");
|
|
53
|
-
/**
|
|
54
|
-
* Marks a response schema whose ENTIRE value is the response body (the
|
|
55
|
-
* generator's `rootPipe` for synthesized bare-payload wrappers): the emitted
|
|
56
|
-
* response type IS the payload type and the protocol returns the mapped body
|
|
57
|
-
* directly.
|
|
58
|
-
*/
|
|
59
|
-
export const RawResponseRoot = () => makeAnnotation(rawResponseRootSymbol, true);
|
|
60
|
-
// =============================================================================
|
|
61
|
-
// Value helpers
|
|
62
|
-
// =============================================================================
|
|
63
|
-
const isPlainObject = (v) => v !== null &&
|
|
64
|
-
typeof v === "object" &&
|
|
65
|
-
!Array.isArray(v) &&
|
|
66
|
-
!isOpaqueValue(v) &&
|
|
67
|
-
(Object.getPrototypeOf(v) === Object.prototype ||
|
|
68
|
-
Object.getPrototypeOf(v) === null);
|
|
69
|
-
/**
|
|
70
|
-
* Deep-unwrap `Redacted` values in an input (plain objects/arrays only —
|
|
71
|
-
* class instances, files, and binary payloads pass through untouched).
|
|
72
|
-
* Sensitive input members accept `string | Redacted<string>`; the wire wants
|
|
73
|
-
* the raw string.
|
|
74
|
-
*/
|
|
75
|
-
export const unwrapRedactedDeep = (value) => {
|
|
76
|
-
if (Redacted.isRedacted(value))
|
|
77
|
-
return Redacted.value(value);
|
|
78
|
-
if (Array.isArray(value))
|
|
79
|
-
return value.map(unwrapRedactedDeep);
|
|
80
|
-
if (isPlainObject(value)) {
|
|
81
|
-
const out = {};
|
|
82
|
-
for (const [k, v] of Object.entries(value)) {
|
|
83
|
-
if (v === undefined)
|
|
84
|
-
continue;
|
|
85
|
-
out[k] = unwrapRedactedDeep(v);
|
|
86
|
-
}
|
|
87
|
-
return out;
|
|
88
|
-
}
|
|
89
|
-
return value;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Walk a decoded (TS-named) value alongside its schema AST, wrapping members
|
|
93
|
-
* marked {@link SensitiveValue} in `Redacted`. Keys the schema doesn't model
|
|
94
|
-
* pass through verbatim.
|
|
95
|
-
*/
|
|
96
|
-
export const wrapSensitive = (ast, value) => {
|
|
97
|
-
if (value === null || typeof value !== "object" || isOpaqueValue(value)) {
|
|
98
|
-
return value;
|
|
99
|
-
}
|
|
100
|
-
const node = resolveNode(ast);
|
|
101
|
-
if (node._tag === "Arrays") {
|
|
102
|
-
if (!Array.isArray(value))
|
|
103
|
-
return value;
|
|
104
|
-
const elem = node.rest?.[0];
|
|
105
|
-
return elem ? value.map((v) => wrapSensitive(elem, v)) : value;
|
|
106
|
-
}
|
|
107
|
-
if (node._tag === "Objects" && !Array.isArray(value)) {
|
|
108
|
-
const props = getProps(node);
|
|
109
|
-
if (props.length === 0)
|
|
110
|
-
return value;
|
|
111
|
-
const byName = new Map(props.map((p) => [String(p.name), p]));
|
|
112
|
-
const out = {};
|
|
113
|
-
for (const [k, v] of Object.entries(value)) {
|
|
114
|
-
if (v === undefined)
|
|
115
|
-
continue;
|
|
116
|
-
const prop = byName.get(k);
|
|
117
|
-
if (!prop) {
|
|
118
|
-
out[k] = v;
|
|
119
|
-
}
|
|
120
|
-
else if (getPropAnn(prop, sensitiveValueSymbol) !== undefined &&
|
|
121
|
-
typeof v === "string") {
|
|
122
|
-
out[k] = Redacted.make(v);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
out[k] = wrapSensitive(prop.type, v);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return out;
|
|
129
|
-
}
|
|
130
|
-
return value;
|
|
131
|
-
};
|
|
132
|
-
const defaultErrorEnvelope = (body) => {
|
|
133
|
-
if (body === null || typeof body !== "object")
|
|
134
|
-
return undefined;
|
|
135
|
-
const b = body;
|
|
136
|
-
const code = typeof b.code === "string" || typeof b.code === "number"
|
|
137
|
-
? b.code
|
|
138
|
-
: undefined;
|
|
139
|
-
const message = typeof b.message === "string"
|
|
140
|
-
? b.message
|
|
141
|
-
: typeof b.error === "string"
|
|
142
|
-
? b.error
|
|
143
|
-
: undefined;
|
|
144
|
-
return { code, message };
|
|
145
|
-
};
|
|
146
|
-
// Bridge: Protocol.decode is typed as Effect<unknown> (no error channel),
|
|
147
|
-
// but REST failures are real typed errors that operations re-surface via
|
|
148
|
-
// their `errors: [...]` lists. Fail with the instance and erase the type
|
|
149
|
-
// here; the generated operation annotations reintroduce it for callers.
|
|
150
|
-
const fail = (e) => Effect.fail(e);
|
|
151
|
-
/**
|
|
152
|
-
* Build a `Layer<Protocol>` for a simple REST JSON API. Assign the result to
|
|
153
|
-
* a module-level const in the provider's `protocol.ts` — `API.make` memoizes
|
|
154
|
-
* protocol layers by value identity.
|
|
155
|
-
*/
|
|
156
|
-
export const makeRestProtocol = (options) => {
|
|
157
|
-
const errorEnvelope = options.errorEnvelope ?? defaultErrorEnvelope;
|
|
158
|
-
const statusMap = options.statusMap ?? HTTP_STATUS_MAP;
|
|
159
|
-
const encode = ({ input, inputAst, }) => Effect.gen(function* () {
|
|
160
|
-
const creds = yield* options.credentials;
|
|
161
|
-
return buildRequest({
|
|
162
|
-
input: unwrapRedactedDeep(input),
|
|
163
|
-
inputAst,
|
|
164
|
-
baseUrl: options.baseUrl(creds),
|
|
165
|
-
headers: options.headers(creds),
|
|
166
|
-
mapMemberHeader: options.mapMemberHeader,
|
|
167
|
-
unknownKeyToWire: options.unknownKeyToWire,
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
const decode = ({ response, outputAst, errors: errorClasses, }) => Effect.gen(function* () {
|
|
171
|
-
// Read as text and parse tolerantly — error pages are often non-JSON.
|
|
172
|
-
const text = (yield* response.text.pipe(Effect.orDie)) ?? "";
|
|
173
|
-
if (process.env.DISTILLED_DEBUG_HTTP) {
|
|
174
|
-
console.error(`[distilled] <- ${response.status} ${text.slice(0, 400)}`);
|
|
175
|
-
}
|
|
176
|
-
let json;
|
|
177
|
-
let nonJson = false;
|
|
178
|
-
if (text.trim().length > 0) {
|
|
179
|
-
try {
|
|
180
|
-
json = JSON.parse(text);
|
|
181
|
-
}
|
|
182
|
-
catch {
|
|
183
|
-
nonJson = true;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
const status = response.status;
|
|
187
|
-
const headers = response.headers;
|
|
188
|
-
if (status >= 400) {
|
|
189
|
-
const env = (nonJson ? undefined : errorEnvelope(json)) ?? {};
|
|
190
|
-
const message = env.message ??
|
|
191
|
-
(nonJson && text.trim() ? text.trim() : `HTTP ${status}`);
|
|
192
|
-
// 1. Per-operation typed error (matcher metadata on the class).
|
|
193
|
-
const typed = matchTypedError(errorClasses, status, [
|
|
194
|
-
{
|
|
195
|
-
code: typeof env.code === "number" ? env.code : undefined,
|
|
196
|
-
message,
|
|
197
|
-
},
|
|
198
|
-
]);
|
|
199
|
-
if (typed !== undefined)
|
|
200
|
-
return yield* fail(typed);
|
|
201
|
-
// 2. Status-mapped class (retryAfter only stamps on retryable
|
|
202
|
-
// statuses — parseRetryAfterForStatus gates on that).
|
|
203
|
-
const StatusErrorClass = statusMap[status];
|
|
204
|
-
if (StatusErrorClass) {
|
|
205
|
-
return yield* fail(new StatusErrorClass({
|
|
206
|
-
message,
|
|
207
|
-
retryAfter: parseRetryAfterForStatus(status, headers),
|
|
208
|
-
}));
|
|
209
|
-
}
|
|
210
|
-
// 3. Unmapped 5xx (e.g. proxy-specific statuses) → retryable server
|
|
211
|
-
// error rather than the unknown fallback.
|
|
212
|
-
if (status >= 500) {
|
|
213
|
-
return yield* fail(new InternalServerError({
|
|
214
|
-
message,
|
|
215
|
-
retryAfter: parseRetryAfterForStatus(status, headers),
|
|
216
|
-
}));
|
|
217
|
-
}
|
|
218
|
-
// 4. Provider fallback.
|
|
219
|
-
return yield* fail(options.unknownError({
|
|
220
|
-
status,
|
|
221
|
-
code: env.code,
|
|
222
|
-
message,
|
|
223
|
-
body: nonJson ? text : json,
|
|
224
|
-
headers,
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
|
-
// 2xx: the response body IS the payload (no envelope). Wire→TS key
|
|
228
|
-
// mapping is schema-driven; `RawResponseRoot` responses are the body
|
|
229
|
-
// verbatim (mapKeys handles arrays/scalars structurally either way).
|
|
230
|
-
let body = nonJson ? text : (json ?? {});
|
|
231
|
-
if (options.transformResponse)
|
|
232
|
-
body = options.transformResponse(body);
|
|
233
|
-
return wrapSensitive(outputAst, mapKeys(outputAst, body, "decode"));
|
|
234
|
-
});
|
|
235
|
-
return Layer.succeed(API.Protocol, API.Protocol.of({
|
|
236
|
-
// Erase encode's credentials requirement (resolved on the calling
|
|
237
|
-
// fiber; see RestProtocolOptions.credentials).
|
|
238
|
-
encode: (args) => encode(args),
|
|
239
|
-
decode,
|
|
240
|
-
}));
|
|
241
|
-
};
|
|
242
|
-
//# sourceMappingURL=protocol-rest.js.map
|
|
1
|
+
export { protocol_rest$BinaryResponse as BinaryResponse, protocol_rest$BinaryStream as BinaryStream, protocol_rest$RawBody as RawBody, protocol_rest$RawResponse as RawResponse, protocol_rest$RawResponseRoot as RawResponseRoot, protocol_rest$SensitiveValue as SensitiveValue, protocol_rest$binaryResponseSymbol as binaryResponseSymbol, protocol_rest$checkSuccess as checkSuccess, protocol_rest$declaredStatusClass as declaredStatusClass, protocol_rest$hasSensitiveMember as hasSensitiveMember, protocol_rest$rawResponseRootSymbol as rawResponseRootSymbol, protocol_rest$rawResponseSymbol as rawResponseSymbol, protocol_rest$readBinaryResponse as readBinaryResponse, protocol_rest$restProtocol as restProtocol, protocol_rest$restProtocolMethods as restProtocolMethods, protocol_rest$sensitiveValueSymbol as sensitiveValueSymbol, protocol_rest$unknownErrorProps as unknownErrorProps, protocol_rest$unwrapRedactedDeep as unwrapRedactedDeep, protocol_rest$validateSuccess as validateSuccess, protocol_rest$wrapSensitive as wrapSensitive } from "./_bundle/rest.js";
|