@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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `schema-lite` with Effect Schema's types, for hand-written modules.
|
|
3
|
+
*
|
|
4
|
+
* Generated services import `schema-lite`, whose builders are typed `any`
|
|
5
|
+
* because every generated schema is cast to its declared interface. Hand-
|
|
6
|
+
* written error classes have no such cast: built from untyped builders,
|
|
7
|
+
* their fields declare as `any` (`ValidationError.message: any`), which
|
|
8
|
+
* erases the field types for every consumer. This module exposes the same
|
|
9
|
+
* lite runtime values with the Effect Schema types, so `S.TaggedError` field
|
|
10
|
+
* types infer as they did with Effect Schema.
|
|
11
|
+
*/
|
|
12
|
+
import type * as S from "effect/Schema";
|
|
13
|
+
import * as L from "./schema-lite-impl.ts";
|
|
14
|
+
export type * from "effect/Schema";
|
|
15
|
+
export declare const optional: typeof S.optional;
|
|
16
|
+
export declare const Struct: typeof S.Struct;
|
|
17
|
+
export declare const StructWithRest: typeof S.StructWithRest;
|
|
18
|
+
export declare const suspend: typeof S.suspend;
|
|
19
|
+
export declare const Array: typeof S.Array;
|
|
20
|
+
export declare const Record: typeof S.Record;
|
|
21
|
+
export declare const Union: typeof S.Union;
|
|
22
|
+
export declare const Literal: typeof S.Literal;
|
|
23
|
+
export declare const Literals: typeof S.Literals;
|
|
24
|
+
export declare const NullOr: typeof S.NullOr;
|
|
25
|
+
export declare const Tuple: typeof S.Tuple;
|
|
26
|
+
export declare const declare: typeof S.declare;
|
|
27
|
+
export declare const instanceOf: typeof S.instanceOf;
|
|
28
|
+
export declare const Redacted: typeof S.Redacted;
|
|
29
|
+
export declare const String: typeof S.String;
|
|
30
|
+
export declare const Number: typeof S.Number;
|
|
31
|
+
export declare const Int: typeof S.Int;
|
|
32
|
+
export declare const Boolean: typeof S.Boolean;
|
|
33
|
+
export declare const Date: typeof S.Date;
|
|
34
|
+
export declare const Duration: typeof S.Duration;
|
|
35
|
+
export declare const Unknown: typeof S.Unknown;
|
|
36
|
+
export declare const Null: typeof S.Null;
|
|
37
|
+
export declare const Void: typeof S.Void;
|
|
38
|
+
export declare const Any: typeof S.Any;
|
|
39
|
+
export declare const TaggedError: L.TaggedErrorFactory;
|
|
40
|
+
export type { TaggedErrorClass, TaggedErrorFactory } from "./schema-lite-impl.ts";
|
|
41
|
+
//# sourceMappingURL=schema-lite-typed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-lite-typed.d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C,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { schema_lite_typed$Any as Any, schema_lite_typed$Array as Array, schema_lite_typed$Boolean as Boolean, schema_lite_typed$Date as Date, schema_lite_typed$Duration as Duration, schema_lite_typed$Int as Int, schema_lite_typed$Literal as Literal, schema_lite_typed$Literals as Literals, schema_lite_typed$Null as Null, schema_lite_typed$NullOr as NullOr, schema_lite_typed$Number as Number, schema_lite_typed$Record as Record, schema_lite_typed$Redacted as Redacted, schema_lite_typed$String as String, schema_lite_typed$Struct as Struct, schema_lite_typed$StructWithRest as StructWithRest, schema_lite_typed$TaggedError as TaggedError, schema_lite_typed$Tuple as Tuple, schema_lite_typed$Union as Union, schema_lite_typed$Unknown as Unknown, schema_lite_typed$Void as Void, schema_lite_typed$declare as declare, schema_lite_typed$instanceOf as instanceOf, schema_lite_typed$optional as optional, schema_lite_typed$suspend as suspend } from "./_bundle/base.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Effect Schema's API surface for generated code, backed by lite schemas
|
|
3
|
+
* (see `schema-lite-impl.ts`): the same names and types as
|
|
4
|
+
* `@distilled.cloud/core/schema`, without importing Effect Schema at runtime.
|
|
5
|
+
*/
|
|
6
|
+
import type * as S from "effect/Schema";
|
|
7
|
+
import * as L from "./schema-lite-impl.ts";
|
|
8
|
+
export type * from "effect/Schema";
|
|
9
|
+
export type AnyFn = (...args: any[]) => any;
|
|
10
|
+
export declare const optional: AnyFn;
|
|
11
|
+
export declare const Struct: AnyFn;
|
|
12
|
+
export declare const StructWithRest: AnyFn;
|
|
13
|
+
export declare const Extend: AnyFn;
|
|
14
|
+
export declare const suspend: AnyFn;
|
|
15
|
+
export declare const Array: AnyFn;
|
|
16
|
+
export declare const Record: AnyFn;
|
|
17
|
+
export declare const Union: AnyFn;
|
|
18
|
+
export declare const Literal: AnyFn;
|
|
19
|
+
export declare const Literals: AnyFn;
|
|
20
|
+
export declare const NullOr: AnyFn;
|
|
21
|
+
export declare const Tuple: AnyFn;
|
|
22
|
+
export declare const encodeKeys: AnyFn;
|
|
23
|
+
export declare const declare: typeof S.declare;
|
|
24
|
+
export declare const instanceOf: AnyFn;
|
|
25
|
+
export declare const Redacted: AnyFn;
|
|
26
|
+
export declare const String: any;
|
|
27
|
+
export declare const Number: any;
|
|
28
|
+
export declare const Int: any;
|
|
29
|
+
export declare const Boolean: any;
|
|
30
|
+
export declare const Date: any;
|
|
31
|
+
export declare const Duration: any;
|
|
32
|
+
export declare const Unknown: any;
|
|
33
|
+
export declare const Null: any;
|
|
34
|
+
export declare const Void: any;
|
|
35
|
+
export declare const Any: any;
|
|
36
|
+
export declare const TaggedError: L.TaggedErrorFactory;
|
|
37
|
+
export type { TaggedErrorClass, TaggedErrorFactory } from "./schema-lite-impl.ts";
|
|
38
|
+
/** Lite `chunks.at`: generated services name this module `__L`. */
|
|
39
|
+
export declare const at: typeof L.at;
|
|
40
|
+
export { liteKey, toEffect } from "./schema-lite-impl.ts";
|
|
41
|
+
//# sourceMappingURL=schema-lite.d.ts.map
|
|
@@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AC;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"}
|
|
@@ -0,0 +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$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
CHANGED
|
@@ -5,24 +5,28 @@
|
|
|
5
5
|
* provider package via `@distilled.cloud/core/schema`. Do not copy it into
|
|
6
6
|
* individual packages.
|
|
7
7
|
*
|
|
8
|
-
* Every real TYPE (`Schema`, `Codec`, `Top`,
|
|
8
|
+
* Every real TYPE (`Schema`, `Codec`, `Top`, ...) is re-exported untouched, so
|
|
9
9
|
* the `Schema.Schema<Foo>` annotations on generated consts (and the public
|
|
10
10
|
* `.d.ts`) stay precise. The schema *construction surface* (`Struct`,
|
|
11
|
-
* `optional`, `suspend`,
|
|
11
|
+
* `optional`, `suspend`, ...) and the leaf scalar schemas are retyped to `any`,
|
|
12
12
|
* so the compiler instantiates none of the heavy Schema generics while
|
|
13
|
-
* building a service file
|
|
13
|
+
* building a service file -- the explicit annotations carry the real types.
|
|
14
14
|
*
|
|
15
15
|
* Overriding a *value* export never affects the same-named *type* export (they
|
|
16
16
|
* live in separate namespaces and continue to flow through `export *`), so
|
|
17
17
|
* `Schema.Literal<"x">`-style type usages remain precise.
|
|
18
18
|
*
|
|
19
|
-
* Runtime behaviour is identical
|
|
20
|
-
* runtime value from `effect/Schema
|
|
19
|
+
* Runtime behaviour is identical. Every override aliases the exact same
|
|
20
|
+
* runtime value from `effect/Schema`, except `suspend`, `Array` and
|
|
21
|
+
* `Record`, which build the same schema lazily (see "Lazy schemas").
|
|
21
22
|
*/
|
|
22
|
-
export * from "effect/Schema";
|
|
23
|
-
|
|
23
|
+
export type * from "effect/Schema";
|
|
24
|
+
export { declare, Duration, instanceOf, Redacted } from "effect/Schema";
|
|
25
|
+
import * as S from "effect/Schema";
|
|
26
|
+
export type AnyFn = (...args: any[]) => any;
|
|
24
27
|
export declare const optional: AnyFn;
|
|
25
28
|
export declare const Struct: AnyFn;
|
|
29
|
+
export declare const StructWithRest: AnyFn;
|
|
26
30
|
export declare const suspend: AnyFn;
|
|
27
31
|
export declare const Array: AnyFn;
|
|
28
32
|
export declare const Record: AnyFn;
|
|
@@ -40,4 +44,14 @@ export declare const Unknown: any;
|
|
|
40
44
|
export declare const Null: any;
|
|
41
45
|
export declare const Void: any;
|
|
42
46
|
export declare const Any: any;
|
|
47
|
+
/**
|
|
48
|
+
* How a lazy schema builds itself: a closure, or a shared builder plus data
|
|
49
|
+
* stored on the schema object (no closure per schema; see packed.ts).
|
|
50
|
+
*/
|
|
51
|
+
export interface LazyBuilder {
|
|
52
|
+
readonly build: (data: unknown) => S.Top;
|
|
53
|
+
}
|
|
54
|
+
/** A schema built on first use by `builder.build(data)`. */
|
|
55
|
+
export declare const lazyFrom: (builder: LazyBuilder, data: unknown) => S.Top;
|
|
56
|
+
export declare const TaggedError: typeof S.TaggedError;
|
|
43
57
|
//# sourceMappingURL=schema.d.ts.map
|
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/schema.js
CHANGED
|
@@ -1,48 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* `any`-collapsing re-export of `effect/Schema` for generated service files.
|
|
3
|
-
*
|
|
4
|
-
* This is the single, shared definition consumed by every code-generated
|
|
5
|
-
* provider package via `@distilled.cloud/core/schema`. Do not copy it into
|
|
6
|
-
* individual packages.
|
|
7
|
-
*
|
|
8
|
-
* Every real TYPE (`Schema`, `Codec`, `Top`, …) is re-exported untouched, so
|
|
9
|
-
* the `Schema.Schema<Foo>` annotations on generated consts (and the public
|
|
10
|
-
* `.d.ts`) stay precise. The schema *construction surface* (`Struct`,
|
|
11
|
-
* `optional`, `suspend`, …) and the leaf scalar schemas are retyped to `any`,
|
|
12
|
-
* so the compiler instantiates none of the heavy Schema generics while
|
|
13
|
-
* building a service file — the explicit annotations carry the real types.
|
|
14
|
-
*
|
|
15
|
-
* Overriding a *value* export never affects the same-named *type* export (they
|
|
16
|
-
* live in separate namespaces and continue to flow through `export *`), so
|
|
17
|
-
* `Schema.Literal<"x">`-style type usages remain precise.
|
|
18
|
-
*
|
|
19
|
-
* Runtime behaviour is identical — every override aliases the exact same
|
|
20
|
-
* runtime value from `effect/Schema`.
|
|
21
|
-
*/
|
|
22
|
-
export * from "effect/Schema";
|
|
23
|
-
import * as S from "effect/Schema";
|
|
24
|
-
// Construction surface — collapse to `any` so generics are never instantiated.
|
|
25
|
-
export const optional = S.optional;
|
|
26
|
-
export const Struct = S.Struct;
|
|
27
|
-
export const suspend = S.suspend;
|
|
28
|
-
export const Array = S.Array;
|
|
29
|
-
export const Record = S.Record;
|
|
30
|
-
export const Union = S.Union;
|
|
31
|
-
export const Literal = S.Literal;
|
|
32
|
-
export const Literals = S.Literals;
|
|
33
|
-
export const NullOr = S.NullOr;
|
|
34
|
-
export const Tuple = S.Tuple;
|
|
35
|
-
export const encodeKeys = S.encodeKeys;
|
|
36
|
-
// Leaf schemas — collapse to `any` so `.pipe(...)` on them is free.
|
|
37
|
-
export const String = S.String;
|
|
38
|
-
export const Number = S.Number;
|
|
39
|
-
export const Boolean = S.Boolean;
|
|
40
|
-
export const Date = S.Date;
|
|
41
|
-
export const Unknown = S.Unknown;
|
|
42
|
-
export const Null = S.Null;
|
|
43
|
-
export const Void = S.Void;
|
|
44
|
-
export const Any = S.Any;
|
|
45
|
-
// NOTE: `Schema` / `Codec` (types) and `TaggedErrorClass` are intentionally NOT
|
|
46
|
-
// overridden — they flow through `export *` with real types so cast targets and
|
|
47
|
-
// typed error classes stay precise.
|
|
48
|
-
//# sourceMappingURL=schema.js.map
|
|
1
|
+
export { schema$Any as Any, schema$Array as Array, schema$Boolean as Boolean, schema$Date as Date, schema$Duration as Duration, schema$Literal as Literal, schema$Literals as Literals, schema$Null as Null, schema$NullOr as NullOr, schema$Number as Number, schema$Record as Record, schema$Redacted as Redacted, schema$String as String, schema$Struct as Struct, schema$StructWithRest as StructWithRest, schema$TaggedError as TaggedError, schema$Tuple as Tuple, schema$Union as Union, schema$Unknown as Unknown, schema$Void as Void, schema$declare as declare, schema$encodeKeys as encodeKeys, schema$instanceOf as instanceOf, schema$lazyFrom as lazyFrom, schema$optional as optional, schema$suspend as suspend } from "./_bundle/aws.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The error an operation fails with when the SDK itself cannot make the
|
|
3
|
+
* call: its generated config or a core module is broken (a paginated
|
|
4
|
+
* operation without the fields its strategy reads, a gRPC operation
|
|
5
|
+
* without a descriptor, ...), or one of its own modules fails to load. No
|
|
6
|
+
* input or response causes it; the generator refuses the configs that
|
|
7
|
+
* would. It is typed, so it fails the call instead of crashing the fiber,
|
|
8
|
+
* and it is never retried.
|
|
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
|
+
*
|
|
14
|
+
* Defined on its own, in core's `base` bundle group, so pagination and
|
|
15
|
+
* the protocols fail with it without importing the REST modules.
|
|
16
|
+
*/
|
|
17
|
+
import * as Effect from "effect/Effect";
|
|
18
|
+
import * as Schema from "./schema-lite-typed.ts";
|
|
19
|
+
declare const SdkError_base: Schema.TaggedErrorClass<"SdkError", {
|
|
20
|
+
readonly message: import("effect/Schema").String;
|
|
21
|
+
}>;
|
|
22
|
+
export declare class SdkError extends /*@__PURE__*/ SdkError_base {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Load one of the SDK's own modules on first use (`() => import("./x.ts")`).
|
|
26
|
+
* A rejected import -- a chunk missing from a bundle, a browser chunk that
|
|
27
|
+
* fails to download -- fails with {@link SdkError}.
|
|
28
|
+
*/
|
|
29
|
+
export declare const loadModule: <A>(load: () => PromiseLike<A>) => Effect.Effect<A, SdkError>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=sdk-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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/sdk-error.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { sdk_error$SdkError as SdkError, sdk_error$loadModule as loadModule } from "./_bundle/base.js";
|
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,OA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,OAAOf,EAAO,QAAQe,CAAQ,CAChC,CAAC,CACH,CAAC,EACH,MAAMH,EAAO,gBAAgBC,CAAO,EACpC,MAAMoB,EAAO,IAAIf,EAAS,CAAC,EAC3B,OAAON,IAAS,IAAA,GAAYqB,EAAOjC,EAAO,eAAeiC,EAAM/B,EAAgB,YAAaU,CAAI,CAClG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type * as AST from "effect/SchemaAST";
|
|
2
|
+
export declare const sensitiveValueSymbol: unique symbol;
|
|
3
|
+
/** What the plain form of a value that can hold a secret is shown as. */
|
|
4
|
+
export declare const REDACTED = "[REDACTED]";
|
|
5
|
+
/** Whether `ast` is marked sensitive (through optional, Suspend and encoding wrappers). */
|
|
6
|
+
export declare const isSensitive: (ast: AST.AST) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Whether a value of the type `ast` can hold a sensitive value, at any depth:
|
|
9
|
+
* the type itself, members, map values, list elements and union arms.
|
|
10
|
+
*/
|
|
11
|
+
export declare const holdsSensitive: (ast: AST.AST) => boolean;
|
|
12
|
+
/** `plain`, the plain form of a value of the type `ast`: {@link REDACTED} when it can hold a secret. */
|
|
13
|
+
export declare const redactPlain: <A>(ast: AST.AST, plain: A) => A | typeof REDACTED;
|
|
14
|
+
/**
|
|
15
|
+
* `value`, a parsed value of the type `ast`, as a log shows it: every
|
|
16
|
+
* sensitive value `Redacted` whole, whatever its type, and the rest as is.
|
|
17
|
+
*/
|
|
18
|
+
export declare const redactParsed: (ast: AST.AST, value: unknown) => unknown;
|
|
19
|
+
/**
|
|
20
|
+
* Walk a decoded (TS-named) value alongside its schema AST, wrapping values
|
|
21
|
+
* marked sensitive (members, map values, list elements) in `Redacted`: a
|
|
22
|
+
* string, or any non-null value of an untyped (`S.Unknown`) schema. A typed
|
|
23
|
+
* struct is walked so its own sensitive members are wrapped and its type
|
|
24
|
+
* stays accurate. Keys the schema doesn't model pass through. A union
|
|
25
|
+
* applies every arm in turn; a map arm skips keys a sibling arm names.
|
|
26
|
+
*/
|
|
27
|
+
export declare const wrapSensitive: (ast: AST.AST, value: unknown, siblingNames?: ReadonlySet<string>) => unknown;
|
|
28
|
+
//# sourceMappingURL=sensitive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/lib/sensitive.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getAnn as e,getProps as t,resolveNode as n}from"./annotations.js";import{isOpaqueValue as r}from"./plain-values.js";import*as i from"effect/Redacted";const a=/*@__PURE__*/ Symbol.for(`@distilled.cloud/core/sensitive-value`);const o=`[REDACTED]`;const isSensitive=t=>e(t,a)!==void 0;const s=/*@__PURE__*/ new WeakMap;const holdsSensitive=e=>{const t=s.get(e);if(t!==void 0)return t;const r=/* @__PURE__ */ new Set;const visit=e=>{if(isSensitive(e))return true;const t=n(e);if(r.has(t))return false;r.add(t);switch(t._tag){case`Union`:return t.types.some(visit);case`Arrays`:return[...t.elements??[],...t.rest??[]].some(visit);case`Objects`:return[...t.propertySignatures??[],...t.indexSignatures??[]].some(e=>visit(e.type));default:return false}};const i=visit(e);s.set(e,i);return i};const redactPlain=(e,t)=>holdsSensitive(e)?o:t;const redactParsed=(e,t)=>holdsSensitive(e)?wrap(e,t,true):t;const wrapSensitive=(e,t,n)=>wrap(e,t,false,n);const isSecretValue=(e,t,r)=>r?t!==null&&t!==void 0:typeof t===`string`||t!==null&&n(e)._tag===`Unknown`;const c=/*@__PURE__*/ new WeakMap;const l=/*@__PURE__*/ new WeakMap;const byNameOf=(e,t)=>{const n=new Map(t.map(e=>[String(e.name),e]));l.set(e,n);return n};const wrapHolding=(e,t,n,r)=>holdsSensitive(e)?wrap(e,t,n,r):t;const wrap=(e,a,o,s)=>{if(i.isRedacted(a))return a;if(isSensitive(e)&&isSecretValue(e,a,o))return i.make(a);if(a===null||typeof a!==`object`||r(a))return a;const u=n(e);if(u._tag===`Union`){let e=c.get(u);if(e===void 0){e=new Set(u.types.flatMap(e=>{const r=n(e);return r._tag===`Objects`?t(r).map(e=>String(e.name)):[]}));c.set(u,e)}return u.types.reduce((t,n)=>wrapHolding(n,t,o,e),a)}if(u._tag===`Arrays`){if(!Array.isArray(a))return a;const e=u.rest?.[0];if(!e)return a;const t=isSensitive(e);return a.map(n=>t&&isSecretValue(e,n,o)&&!i.isRedacted(n)?i.make(n):wrapHolding(e,n,o))}if(u._tag===`Objects`&&!Array.isArray(a)){const e=t(u);const n=u.indexSignatures?.[0]?.type;if(e.length===0&&n===void 0)return a;const r=l.get(u)??byNameOf(u,e);return Object.fromEntries(Object.entries(a).flatMap(([e,t])=>{if(t===void 0)return[];const a=r.get(e)?.type??(s?.has(e)?void 0:n);if(a===void 0)return[[e,t]];if(isSensitive(a)&&isSecretValue(a,t,o))return[[e,i.isRedacted(t)?t:i.make(t)]];return[[e,wrapHolding(a,t,o)]]}))}return a};export{o as REDACTED,holdsSensitive,isSensitive,redactParsed,redactPlain,a as sensitiveValueSymbol,wrapSensitive};
|
|
2
|
+
//# sourceMappingURL=sensitive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensitive.js","names":["Redacted","sensitiveValueSymbol","REDACTED","getAnn","ast","holds","cached","seen","n","node","resolveNode","m","result","plain","value","siblingNames","whole","v","type","armNames","membersByName","byName","props","p","isOpaqueValue","named","armNode","arm","getProps","redacted","elem","sensitive","mapValue","k"],"sources":["../src/sensitive.ts"],"mappings":"6JAqBA,MAAaC,EAAqC,qBAAO,IACvD,uCACF,EAGA,MAAaC,EAAW,aAGxB,MAAa,YAAe,GAC1BC,EAAOC,EAAKH,CAAoB,IAAM,IAAA,GAExC,MAAMI,gBAAsB,IAAI,QAMhC,MAAa,eAAkB,GAA0B,CACvD,MAAMC,EAASD,EAAM,IAAID,CAAG,EAC5B,GAAIE,IAAW,IAAA,GAAW,OAAOA,EACjC,MAAMC,kBAAO,IAAI,IACjB,MAAM,MAAS,GAAwB,CACrC,GAAI,YAAYC,CAAC,EAAG,MAAO,MAC3B,MAAMC,EAAOC,EAAYF,CAAC,EAC1B,GAAID,EAAK,IAAIE,CAAI,EAAG,MAAO,OAC3BF,EAAK,IAAIE,CAAI,EACb,OAAQA,EAAK,KAAb,CACE,IAAK,QACH,OAAOA,EAAK,MAAM,KAAK,KAAK,EAC9B,IAAK,SACH,MAAO,CAAC,GAAIA,EAAK,UAAY,CAAC,EAAI,GAAIA,EAAK,MAAQ,CAAC,CAAE,CAAC,CAAC,KAAK,KAAK,EACpE,IAAK,UACH,MAAO,CAAC,GAAIA,EAAK,oBAAsB,CAAC,EAAI,GAAIA,EAAK,iBAAmB,CAAC,CAAE,CAAC,CAAC,KAAM,GACjF,MAAME,EAAE,IAAI,CACd,EACF,QACE,MAAO,MACX,CACF,EACA,MAAMC,EAAS,MAAMR,CAAG,EACxBC,EAAM,IAAID,EAAKQ,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,CAAC,CAACiB,EAAGjC,EAAS,WAAWiB,CAAC,EAAIA,EAAIjB,EAAS,KAAKiB,CAAC,CAAC,CAAC,EAE5D,MAAO,CAAC,CAACgB,EAAG,YAAYf,EAAMD,EAAGD,CAAK,CAAC,CAAC,CAC1C,CAAC,CACH,CACF,CACA,OAAOF,CACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-debug.d.ts","sources":["../src/telemetry-debug.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AA+HtC,eAAO,MAAM,cAAc;IACzB,2FAA2F;aAC3F,KAAK,EAOC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Debug as e,OperationSpan as t,tagOf as n}from"./telemetry.js";import{redactParsed as r}from"./sensitive.js";import*as i from"effect/Cause";import*as a from"effect/Effect";import*as o from"effect/Exit";import*as s from"effect/Stream";import*as c from"effect/Layer";import*as l from"effect/Tracer";const call=(e,t,s,c)=>{const l=e.attributes[`url.template`];const u=s===void 0?a.logDebug(`call ${e.name}`):a.logDebug(`call ${e.name}`,r(s.input,t));const d=a.flatMap(u,()=>a.onExit(c,t=>o.isSuccess(t)?s===void 0?a.logDebug(`ok ${e.name}`):a.logDebug(`ok ${e.name}`,r(s.output,t.value)):i.hasInterruptsOnly(t.cause)?a.logDebug(`interrupted ${e.name}`):a.logDebug(`failed ${e.name}: ${n(i.squash(t.cause))}`)));return a.annotateLogs(a.withLogSpan(d,`distilled.operation`),{"distilled.operation":e.name,...typeof l===`string`?{"url.template":l}:{}})};const hostOf=e=>{try{return new URL(e).host}catch{return``}};const http=(e,t)=>a.flatMap(a.logDebug(`-> ${e.method} ${hostOf(e.url)}`),()=>a.tap(t,e=>a.logDebug(`<- ${e.status}`)));const phase=(e,t,n)=>a.withSpan(t,e,{level:`Debug`,attributes:n,captureStackTrace:false});const attempt=(e,r)=>a.withFiber(i=>{const o=i.getRef(t);if(o===void 0)return e;return a.useSpan(`Attempt`,{parent:o.span,attributes:{"distilled.attempt":r,"http.request.resend_count":r-1}},t=>{o.attempt=t;const r=a.tapError(e,e=>a.sync(()=>t.attribute(`error.type`,n(e))));return a.provideService(r,l.ParentSpan,t)})});const readStream=(e,t,r)=>s.unwrap(a.map(a.makeSpan(`distilled.read_stream`,{parent:t,level:`Debug`,attributes:{"distilled.stream.member":r}}),t=>{let r=0;let c=0;const l=s.map(e,e=>{r++;if(e instanceof Uint8Array)c+=e.byteLength;return e});return s.onExit(l,e=>a.clockWith(s=>a.sync(()=>{t.attribute(`distilled.stream.items`,r);if(c>0)t.attribute(`distilled.stream.bytes`,c);if(o.isFailure(e)&&!i.hasInterruptsOnly(e.cause))t.attribute(`error.type`,n(i.squash(e.cause)));t.end(s.currentTimeNanosUnsafe(),e)})))}));const u=/\(?((?:file:\/\/)?[^\s()]+):(\d+):(\d+)\)?$/;const callSite=e=>{const t=e?.();const n=t?u.exec(t):null;if(!n)return void 0;const r=/^at (\S+) \(/.exec(t)?.[1];return{"code.file.path":n[1],"code.line.number":Number(n[2]),"code.column.number":Number(n[3]),...r?{"code.function.name":r}:{}}};const d={layer:/*@__PURE__*/ c.succeed(e,{phase,attempt,readStream,callSite,call,http})};export{d as TelemetryDebug};
|
|
2
|
+
//# sourceMappingURL=telemetry-debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-debug.js","names":["Cause","Effect","Exit","Stream","Layer","Tracer","template","info","start","schemas","redactParsed","input","logged","effect","exit","tagOf","url","request","sent","response","name","call","fiber","OperationSpan","base","n","span","run","error","member","items","bytes","counted","stream","item","clock","LOCATION","line","site","match","fn","TelemetryDebug","Debug"],"sources":["../src/telemetry-debug.ts"],"mappings":"+SAqDA,MAAM,MAA4B,EAAM,EAAO,EAAS,IAAW,CACjE,MAAMM,EAAWC,EAAK,WAAW,gBACjC,MAAMC,EACJC,IAAY,I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MC,EAAK,eAAe,KAAKH,CAAK,CAAC,GAAG,GACxC,MAAO,CACL,iBAAkBE,EAAM,GACxB,mBAAoB,OAAOA,EAAM,EAAE,EACnC,qBAAsB,OAAOA,EAAM,EAAE,EACrC,GAAIC,EAAK,CAAE,qBAAsBA,CAAG,EAAI,CAAC,CAC3C,CACF,EAEA,MAAaC,EAAiB,CAE5B,MAAqB,gBAAM,QAAQC,EAAO,CACxC,MACA,QACA,WACA,SACA,KACA,IACF,CAAC,CACH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App callbacks on each recorded operation span, for attributes distilled
|
|
3
|
+
* does not record (an app's own ids, a custom request field):
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { TelemetryHooks } from "@distilled.cloud/core/telemetry-hooks";
|
|
7
|
+
*
|
|
8
|
+
* program.pipe(
|
|
9
|
+
* Effect.provide(
|
|
10
|
+
* TelemetryHooks.layer({
|
|
11
|
+
* onStart: (span, { method, input }) => {
|
|
12
|
+
* if (method === "S3/PutObject") span.attribute("app.tenant", tenantOf(input));
|
|
13
|
+
* },
|
|
14
|
+
* onEnd: (span, exit) => {},
|
|
15
|
+
* }),
|
|
16
|
+
* ),
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* `onStart` runs when the span starts, before the request is built, with
|
|
21
|
+
* the operation's span name, its `rpc.method` and the caller's input.
|
|
22
|
+
* `onEnd` runs when the call ends, after every retry. Both run only when a
|
|
23
|
+
* span is recorded (an exporter is installed). A program that never
|
|
24
|
+
* imports this module never bundles it.
|
|
25
|
+
*/
|
|
26
|
+
import * as Layer from "effect/Layer";
|
|
27
|
+
import { type SpanHooks } from "./telemetry.ts";
|
|
28
|
+
export type { SpanHooks };
|
|
29
|
+
export declare const TelemetryHooks: {
|
|
30
|
+
readonly layer: (hooks: SpanHooks) => Layer.Layer<never>;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=telemetry-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-hooks.d.ts","sources":["../src/telemetry-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,eAAO,MAAM,cAAc;aACzB,KAAK,UAAU,SAAS,KAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;CACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-hooks.js","names":["Layer","TelemetryHooks","Hooks","hooks"],"sources":["../src/telemetry-hooks.ts"],"mappings":"sEA8BA,MAAaC,EAAiB,CAC5B,MAAQ,GAAyCD,EAAM,QAAQE,EAAOC,CAAK,CAC7E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `com.distilled.telemetry#service` trait's `hosts`: facts for requests
|
|
3
|
+
* to S3-compatible hosts such as Cloudflare R2. Generated code imports this
|
|
4
|
+
* only where a trait has one (S3). See
|
|
5
|
+
* `packages/dev/src/codegen/telemetry-traits.md`.
|
|
6
|
+
*/
|
|
7
|
+
import type { RequestHook } from "./telemetry.ts";
|
|
8
|
+
/** Facts for requests to a host ending in `suffix`. */
|
|
9
|
+
export interface HostRule {
|
|
10
|
+
/** Host suffix, with its leading dot (`.r2.cloudflarestorage.com`). */
|
|
11
|
+
readonly suffix: string;
|
|
12
|
+
readonly attributes?: Readonly<Record<string, string | number | boolean>>;
|
|
13
|
+
/** Attribute that gets the host label just before the suffix (the account id). */
|
|
14
|
+
readonly hostLabel?: string;
|
|
15
|
+
/** Attribute values copied under a second name: `{ "aws.s3.bucket": "cloudflare.r2.bucket" }`. */
|
|
16
|
+
readonly copy?: Readonly<Record<string, string>>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Facts recorded when a request goes to a matching host: an S3-compatible
|
|
20
|
+
* service such as Cloudflare R2 reached through the S3 SDK.
|
|
21
|
+
*/
|
|
22
|
+
export declare const hostRules: (rules: ReadonlyArray<HostRule>) => RequestHook;
|
|
23
|
+
//# sourceMappingURL=telemetry-host-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-host-rules.d.ts","sources":["../src/telemetry-host-rules.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,uDAAuD;AACvD,MAAM,WAAW,QAAQ;IACvB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAC1E,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,kGAAkG;IAClG,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAClD;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,UACZ,aAAa,CAAC,QAAQ,CAAC,KAAG,WAcjC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const hostRules=e=>(t,n,r)=>{for(const i of e){if(!t.endsWith(i.suffix))continue;for(const e in i.attributes)r(e,i.attributes[e]);if(i.hostLabel!==void 0){const e=t.slice(0,t.length-i.suffix.length);if(e.length>0)r(i.hostLabel,e.slice(e.lastIndexOf(`.`)+1))}for(const e in i.copy){const t=n.attributes.get(e);if(t!==void 0)r(i.copy[e],t)}}};export{hostRules};
|
|
2
|
+
//# sourceMappingURL=telemetry-host-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-host-rules.js","names":["rule","rules","host","key","set","prefix","from","value","span"],"sources":["../src/telemetry-host-rules.ts"],"mappings":"AAuBA,MAAa,UACV,IACA,EAAM,EAAM,IAAQ,CACnB,IAAK,MAAMA,KAAQC,EAAO,CACxB,GAAI,CAACC,EAAK,SAASF,EAAK,MAAM,EAAG,SACjC,IAAK,MAAMG,KAAOH,EAAK,WAAYI,EAAID,EAAKH,EAAK,WAAWG,EAAI,EAChE,GAAIH,EAAK,YAAc,IAAA,GAAW,CAChC,MAAMK,EAASH,EAAK,MAAM,EAAGA,EAAK,OAASF,EAAK,OAAO,MAAM,EAC7D,GAAIK,EAAO,OAAS,EAAGD,EAAIJ,EAAK,UAAWK,EAAO,MAAMA,EAAO,YAAY,GAAG,EAAI,CAAC,CAAC,CACtF,CACA,IAAK,MAAMC,KAAQN,EAAK,KAAM,CAC5B,MAAMO,EAAQC,EAAK,WAAW,IAAIF,CAAI,EACtC,GAAIC,IAAU,IAAA,GAAWH,EAAIJ,EAAK,KAAKM,GAAQC,CAAK,CACtD,CACF,CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W3C trace context in a Lambda `Invoke`'s `ClientContext` (base64 JSON),
|
|
3
|
+
* under `custom.traceparent`, as `@opentelemetry/instrumentation-aws-sdk`
|
|
4
|
+
* writes it; the invoked function reads it from `context.clientContext`.
|
|
5
|
+
* Generated code imports this only where an operation's `inject` has format
|
|
6
|
+
* `lambdaClientContext`. See `packages/dev/src/codegen/telemetry-traits.md`.
|
|
7
|
+
*/
|
|
8
|
+
import type * as Tracer from "effect/Tracer";
|
|
9
|
+
/**
|
|
10
|
+
* Add `custom.traceparent` to the input's `member` (a base64 JSON client
|
|
11
|
+
* context). Kept as it was: a `traceparent` already there, a value that is
|
|
12
|
+
* not base64 JSON, and a result over Lambda's size cap.
|
|
13
|
+
*/
|
|
14
|
+
export declare const injectLambdaClientContext: (place: {
|
|
15
|
+
readonly member: string;
|
|
16
|
+
}) => (span: Tracer.Span, input: unknown) => unknown;
|
|
17
|
+
//# sourceMappingURL=telemetry-lambda-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-lambda-context.d.ts","sources":["../src/telemetry-lambda-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAe7C;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,UAC5B;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,YAC5B,MAAM,CAAC,IAAI,SAAS,OAAO,KAAG,OAgBpC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{traceparent as e}from"./telemetry-message-context.js";const t=3583;const toBase64=e=>{let t=``;for(const n of new TextEncoder().encode(e))t+=String.fromCharCode(n);return btoa(t)};const fromBase64=e=>new TextDecoder().decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)));const injectLambdaClientContext=n=>(r,i)=>{if(i===null||typeof i!==`object`)return i;const a=i;const o=a[n.member];try{const s=typeof o===`string`&&o.length>0?JSON.parse(fromBase64(o)):{};if(s===null||typeof s!==`object`)return i;if(s.custom?.traceparent!==void 0)return i;const c=toBase64(JSON.stringify({...s,custom:{...s.custom,traceparent:e(r)}}));return c.length>t?i:{...a,[n.member]:c}}catch{return i}};export{injectLambdaClientContext};
|
|
2
|
+
//# sourceMappingURL=telemetry-lambda-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-lambda-context.js","names":["MAX_CLIENT_CONTEXT","binary","byte","text","c","input","record","current","place","parsed","encoded","traceparent","span"],"sources":["../src/telemetry-lambda-context.ts"],"mappings":"6DAWA,MAAMA,EAAqB,KAE3B,MAAM,SAAY,GAAyB,CACzC,IAAIC,EAAS,GACb,IAAK,MAAMC,KAAQ,IAAI,YAAY,CAAC,CAAC,OAAOC,CAAI,EAAG,GAAU,OAAO,aAAaD,CAAI,EACrF,OAAO,KAAKD,CAAM,CACpB,EAEA,MAAM,WAAc,GAClB,IAAI,YAAY,CAAC,CAAC,OAAO,WAAW,KAAK,KAAKE,CAAI,EAAI,GAAMC,EAAE,WAAW,CAAC,CAAC,CAAC,EAO9E,MAAa,0BACV,IACA,EAAmB,IAA4B,CAC9C,GAAIC,IAAU,MAAQ,OAAOA,IAAU,SAAU,OAAOA,EACxD,MAAMC,EAASD,EACf,MAAME,EAAUD,EAAOE,EAAM,QAC7B,GAAI,CACF,MAAMC,EACJ,OAAOF,IAAY,UAAYA,EAAQ,OAAS,EAAI,KAAK,MAAM,WAAWA,CAAO,CAAC,EAAI,CAAC,EACzF,GAAIE,IAAW,MAAQ,OAAOA,IAAW,SAAU,OAAOJ,EAC1D,GAAII,EAAO,QAAQ,cAAgB,IAAA,GAAW,OAAOJ,EACrD,MAAMK,EAAU,SACd,KAAK,UAAU,CAAE,GAAGD,EAAQ,OAAQ,CAAE,GAAGA,EAAO,OAAQ,YAAaE,EAAYC,CAAI,CAAE,CAAE,CAAC,CAC5F,EACA,OAAOF,EAAQ,OAASV,EAAqBK,EAAQ,CAAE,GAAGC,GAASE,EAAM,QAASE,CAAQ,CAC5F,MAAQ,CACN,OAAOL,CACT,CACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `com.distilled.telemetry#operation` trait's `inject` and `extract`
|
|
3
|
+
* (format `awsMessageAttributes`): W3C trace context in SQS and SNS
|
|
4
|
+
* message attributes. Generated code imports this only where a trait has
|
|
5
|
+
* one. See `packages/dev/src/codegen/telemetry-traits.md`.
|
|
6
|
+
*/
|
|
7
|
+
import * as Tracer from "effect/Tracer";
|
|
8
|
+
import type { MessageExtract } from "./telemetry.ts";
|
|
9
|
+
/** W3C `traceparent` of a span. */
|
|
10
|
+
export declare const traceparent: (span: Tracer.AnySpan) => string;
|
|
11
|
+
/** The span a W3C `traceparent` names, if it is well formed. */
|
|
12
|
+
export declare const parseTraceparent: (value: unknown) => Tracer.ExternalSpan | undefined;
|
|
13
|
+
/** Where messages sit: `member` of the value, or of every element of its `list` member. */
|
|
14
|
+
export interface MessagePlace {
|
|
15
|
+
readonly member: string;
|
|
16
|
+
readonly list?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Write the span's `traceparent` into each message's attributes (a map of
|
|
20
|
+
* `{ DataType, StringValue }`, the SQS and SNS shape). Kept: a
|
|
21
|
+
* `traceparent` already there, and a message with 10 attributes. The
|
|
22
|
+
* caller's input object is not changed.
|
|
23
|
+
*/
|
|
24
|
+
export declare const injectAwsMessageAttributes: (place: MessagePlace) => (span: Tracer.Span, input: unknown) => unknown;
|
|
25
|
+
/**
|
|
26
|
+
* Where else a received message can carry trace context, by generated
|
|
27
|
+
* property name (SQS `ReceiveMessage`):
|
|
28
|
+
*
|
|
29
|
+
* envelope the body member; an SNS notification delivered without
|
|
30
|
+
* raw message delivery is JSON whose `MessageAttributes`
|
|
31
|
+
* carry the publisher's `traceparent`
|
|
32
|
+
* system the system-attributes member, whose `AWSTraceHeader` is
|
|
33
|
+
* an X-Ray trace header (set by X-Ray-instrumented
|
|
34
|
+
* producers); `systemRequest` is the input member listing
|
|
35
|
+
* system attributes to return
|
|
36
|
+
*/
|
|
37
|
+
export interface MessageExtractPlace extends MessagePlace {
|
|
38
|
+
readonly request?: string;
|
|
39
|
+
/** The message's id member: each link carries it as `messaging.message.id`. */
|
|
40
|
+
readonly messageId?: string;
|
|
41
|
+
readonly envelope?: string;
|
|
42
|
+
readonly system?: string;
|
|
43
|
+
readonly systemRequest?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Ask for `traceparent` (and `AWSTraceHeader`) back, unless the input asks
|
|
47
|
+
* for `All` or `.*`, and link the span to every well-formed trace context
|
|
48
|
+
* each message carries: its `traceparent` attribute, else the SNS
|
|
49
|
+
* envelope's, plus its X-Ray `AWSTraceHeader` when that names another span.
|
|
50
|
+
*/
|
|
51
|
+
export declare const extractAwsMessageAttributes: (place: MessageExtractPlace) => MessageExtract;
|
|
52
|
+
//# sourceMappingURL=telemetry-message-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-message-context.d.ts","sources":["../src/telemetry-message-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,mCAAmC;AACnC,eAAO,MAAM,WAAW,SAAU,MAAM,CAAC,OAAO,KAAG,MACgB,CAAC;AAIpE,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,UAAW,OAAO,KAAG,MAAM,CAAC,YAAY,GAAG,SAQvE,CAAC;AAEF,2FAA2F;AAC3F,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAcD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,UAC7B,YAAY,YACb,MAAM,CAAC,IAAI,SAAS,OAAO,KAAG,OAuBpC,CAAC;AAEJ;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAyBD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,UAAW,mBAAmB,KAAG,cAyCvE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{parseTraceHeader as e}from"./telemetry-xray.js";import*as t from"effect/Tracer";const traceparent=e=>`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`;const n=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;const parseTraceparent=e=>{const r=typeof e===`string`?n.exec(e):null;if(r===null)return void 0;return t.externalSpan({traceId:r[1],spanId:r[2],sampled:(Number.parseInt(r[3],16)&1)===1})};const r=10;const withTraceparent=(e,t)=>{const n=e!==null&&typeof e===`object`?e:{};if(`traceparent`in n||Object.keys(n).length>=r)return e;return{...n,traceparent:{DataType:`String`,StringValue:t}}};const injectAwsMessageAttributes=e=>(t,n)=>{if(n===null||typeof n!==`object`)return n;const r=n;const i=traceparent(t);if(e.list===void 0)return{...r,[e.member]:withTraceparent(r[e.member],i)};const a=r[e.list];if(!Array.isArray(a))return n;return{...r,[e.list]:a.map(t=>t!==null&&typeof t===`object`?{...t,[e.member]:withTraceparent(t[e.member],i)}:t)}};const asksFor=(e,t)=>Array.isArray(e)&&e.some(e=>e===`All`||e===`.*`||e===t);const askFor=(e,t,n)=>{if(t===void 0||asksFor(e[t],n))return e;const r=e[t];return{...e,[t]:[...Array.isArray(r)?r:[],n]}};const envelopeTraceparent=e=>{if(typeof e!==`string`||!e.includes(`"traceparent"`))return void 0;try{const t=JSON.parse(e);return t?.Type===`Notification`?t.MessageAttributes?.traceparent?.Value:void 0}catch{return}};const extractAwsMessageAttributes=t=>({request:e=>{if(e===null||typeof e!==`object`)return e;let n=askFor(e,t.request,`traceparent`);if(t.system!==void 0)n=askFor(n,t.systemRequest,`AWSTraceHeader`);return n},links:n=>{if(n===null||typeof n!==`object`)return[];const r=n;const i=t.list===void 0?[r]:Array.isArray(r[t.list])?r[t.list]:[];const a=[];for(const n of i){if(n===null||typeof n!==`object`)continue;const r=n;const i=t.messageId===void 0?void 0:r[t.messageId];const o=typeof i===`string`?{"messaging.message.id":i}:{};const s=r[t.member];const c=parseTraceparent(s?.traceparent?.StringValue)??(t.envelope!==void 0?parseTraceparent(envelopeTraceparent(r[t.envelope])):void 0);if(c!==void 0)a.push({span:c,attributes:o});if(t.system!==void 0){const n=r[t.system];const i=e(n?.AWSTraceHeader);if(i!==void 0&&i.spanId!==c?.spanId)a.push({span:i,attributes:o})}}return a}});export{extractAwsMessageAttributes,injectAwsMessageAttributes,parseTraceparent,traceparent};
|
|
2
|
+
//# sourceMappingURL=telemetry-message-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-message-context.js","names":["Tracer","span","TRACEPARENT","match","value","MAX_MESSAGE_ATTRIBUTES","map","attributes","input","record","place","entries","entry","names","n","name","member","body","parsed","output","holders","links","holder","message","id","linkAttributes","system","xray","parseTraceHeader"],"sources":["../src/telemetry-message-context.ts"],"mappings":"uFAWA,MAAa,YAAe,GAC1B,MAAMC,EAAK,QAAQ,GAAGA,EAAK,OAAO,GAAGA,EAAK,QAAU,KAAO,OAE7D,MAAMC,EAAc,mDAGpB,MAAa,iBAAoB,GAAoD,CACnF,MAAMC,EAAQ,OAAOC,IAAU,SAAWF,EAAY,KAAKE,CAAK,EAAI,KACpE,GAAID,IAAU,KAAM,OAAO,IAAA,GAC3B,OAAOH,EAAO,aAAa,CACzB,QAASG,EAAM,GACf,OAAQA,EAAM,GACd,SAAU,OAAO,SAASA,EAAM,GAAK,EAAE,EAAI,KAAO,CACpD,CAAC,CACH,EASA,MAAME,EAAyB,GAE/B,MAAM,iBAAmB,EAAqB,IAA2B,CACvE,MAAMC,EACJC,IAAe,MAAQ,OAAOA,IAAe,SACxCA,EACD,CAAC,EACP,GAAI,gBAAiBD,GAAO,OAAO,KAAKA,CAAG,CAAC,CAAC,QAAUD,EAAwB,OAAOE,EACtF,MAAO,CAAE,GAAGD,EAAK,YAAa,CAAE,SAAU,SAAU,YAAaF,CAAM,CAAE,CAC3E,EAQA,MAAa,2BACV,IACA,EAAmB,IAA4B,CAC9C,GAAII,IAAU,MAAQ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KAAK,MAAM,cAAc,CAAC;AA+CtC,eAAO,MAAM,gBAAgB;IAC3B,qFAAqF;aACrF,KAAK,EAAmD,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;CAClE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Metrics as e,tagOf as t}from"./telemetry.js";import*as n from"effect/Cause";import*as r from"effect/Effect";import*as i from"effect/Exit";import*as a from"effect/Layer";import*as o from"effect/Metric";const s=/*@__PURE__*/ o.histogram(`rpc.client.call.duration`,{description:`Duration of outbound RPC calls.`,boundaries:[.005,.01,.025,.05,.075,.1,.25,.5,.75,1,2.5,5,7.5,10]});const c=/* @__PURE__ */ new WeakMap;const metricOf=(e,t)=>{let n=c.get(e);if(n===void 0)c.set(e,n=/* @__PURE__ */ new Map);const r=t??``;let i=n.get(r);if(i===void 0){const a={};for(const t of[`rpc.system.name`,`rpc.method`]){const n=e.attributes[t];if(typeof n===`string`)a[t]=n}if(t!==void 0)a[`error.type`]=t;i=o.withAttributes(s,a);n.set(r,i)}return i};const errorTypeOf=e=>i.isSuccess(e)?void 0:t(n.squash(e.cause));const measure=(e,t)=>r.clockWith(n=>{const i=n.currentTimeNanosUnsafe();return r.onExit(t,t=>o.update(metricOf(e,errorTypeOf(t)),Number(n.currentTimeNanosUnsafe()-i)/1e9))});const l={layer:/*@__PURE__*/ a.succeed(e,measure)};export{l as TelemetryMetrics};
|
|
2
|
+
//# sourceMappingURL=telemetry-metrics.js.map
|