@distilled.cloud/core 1.0.0-rc.17 → 1.0.0-rc.18
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/lib/_bundle/base.js +2 -2
- package/lib/_bundle/base.js.map +1 -1
- package/lib/_bundle/graphql.js +2 -2
- package/lib/_bundle/graphql.js.map +1 -1
- package/lib/_bundle/rest.js +1 -1
- package/lib/_bundle/rest.js.map +1 -1
- package/lib/annotations.d.ts +15 -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 +15 -0
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +1 -1
- package/lib/category.d.ts.map +1 -1
- package/lib/config.d.ts +54 -13
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +1 -1
- package/lib/debug.d.ts.map +1 -1
- package/lib/error-category.d.ts.map +1 -1
- package/lib/errors.d.ts +2 -13
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -1
- package/lib/graphql.d.ts +14 -0
- package/lib/graphql.d.ts.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/pagination.d.ts +34 -2
- package/lib/pagination.d.ts.map +1 -1
- package/lib/pagination.js +1 -1
- package/lib/protocol-http.d.ts +30 -6
- package/lib/protocol-http.d.ts.map +1 -1
- package/lib/protocol-http.js +1 -1
- package/lib/protocol-rest.d.ts +53 -39
- package/lib/protocol-rest.d.ts.map +1 -1
- package/lib/protocol-rest.js +1 -1
- package/lib/response-validation.d.ts +4 -3
- package/lib/response-validation.d.ts.map +1 -1
- package/lib/schema-lite-typed.js +1 -2
- package/lib/telemetry-debug.d.ts +14 -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 +9 -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 +269 -0
- package/lib/telemetry.d.ts.map +1 -0
- package/lib/telemetry.js +3 -0
- package/lib/telemetry.js.map +1 -0
- package/package.json +1 -3
- package/src/annotations.ts +37 -0
- package/src/api.ts +123 -24
- package/src/category.ts +21 -22
- package/src/config.ts +58 -29
- package/src/debug.ts +9 -6
- package/src/error-category.ts +12 -14
- package/src/errors.ts +7 -7
- package/src/graphql.ts +123 -18
- package/src/index.ts +3 -2
- package/src/pagination.ts +119 -6
- package/src/protocol-http.ts +63 -43
- package/src/protocol-rest.ts +201 -140
- package/src/response-validation.ts +4 -3
- package/src/telemetry-debug.ts +135 -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 +91 -0
- package/src/telemetry-xray.ts +66 -0
- package/src/telemetry.ts +768 -0
- package/lib/codegen/boolean-string-enums.d.ts +0 -36
- package/lib/codegen/boolean-string-enums.d.ts.map +0 -1
- package/lib/codegen/boolean-string-enums.js +0 -147
- package/lib/codegen/boolean-string-enums.js.map +0 -1
- package/lib/codegen/chunk.d.ts +0 -7
- package/lib/codegen/chunk.d.ts.map +0 -1
- package/lib/codegen/chunk.js +0 -139
- package/lib/codegen/chunk.js.map +0 -1
- package/lib/codegen/cli.d.ts +0 -80
- package/lib/codegen/cli.d.ts.map +0 -1
- package/lib/codegen/cli.js +0 -166
- package/lib/codegen/cli.js.map +0 -1
- package/lib/codegen/datafy.d.ts +0 -14
- package/lib/codegen/datafy.d.ts.map +0 -1
- package/lib/codegen/datafy.js +0 -853
- package/lib/codegen/datafy.js.map +0 -1
- package/lib/codegen/dedupe.d.ts +0 -5
- package/lib/codegen/dedupe.d.ts.map +0 -1
- package/lib/codegen/dedupe.js +0 -153
- package/lib/codegen/dedupe.js.map +0 -1
- package/lib/codegen/emit.d.ts +0 -125
- package/lib/codegen/emit.d.ts.map +0 -1
- package/lib/codegen/emit.js +0 -99
- package/lib/codegen/emit.js.map +0 -1
- package/lib/codegen/format.d.ts +0 -11
- package/lib/codegen/format.d.ts.map +0 -1
- package/lib/codegen/format.js +0 -32
- package/lib/codegen/format.js.map +0 -1
- package/lib/codegen/generated-at.d.ts +0 -29
- package/lib/codegen/generated-at.d.ts.map +0 -1
- package/lib/codegen/generated-at.js +0 -78
- package/lib/codegen/generated-at.js.map +0 -1
- package/lib/codegen/generator.d.ts +0 -353
- package/lib/codegen/generator.d.ts.map +0 -1
- package/lib/codegen/generator.js +0 -810
- 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/graphql-client.d.ts +0 -70
- package/lib/codegen/graphql-client.d.ts.map +0 -1
- package/lib/codegen/graphql-client.js +0 -439
- package/lib/codegen/graphql-client.js.map +0 -1
- package/lib/codegen/graphql.d.ts +0 -207
- package/lib/codegen/graphql.d.ts.map +0 -1
- package/lib/codegen/graphql.js +0 -786
- package/lib/codegen/graphql.js.map +0 -1
- package/lib/codegen/latin1.d.ts +0 -3
- package/lib/codegen/latin1.d.ts.map +0 -1
- package/lib/codegen/latin1.js +0 -126
- package/lib/codegen/latin1.js.map +0 -1
- package/lib/codegen/members.d.ts +0 -32
- package/lib/codegen/members.d.ts.map +0 -1
- package/lib/codegen/members.js +0 -62
- package/lib/codegen/members.js.map +0 -1
- package/lib/codegen/model-diff.d.ts +0 -10
- package/lib/codegen/model-diff.d.ts.map +0 -1
- package/lib/codegen/model-diff.js +0 -67
- package/lib/codegen/model-diff.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 -52
- package/lib/codegen/openapi-cli.d.ts.map +0 -1
- package/lib/codegen/openapi-cli.js +0 -84
- package/lib/codegen/openapi-cli.js.map +0 -1
- package/lib/codegen/openapi.d.ts +0 -209
- package/lib/codegen/openapi.d.ts.map +0 -1
- package/lib/codegen/openapi.js +0 -1548
- 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 -31
- package/lib/codegen/pagination.js.map +0 -1
- package/lib/codegen/patch-audit.d.ts +0 -84
- package/lib/codegen/patch-audit.d.ts.map +0 -1
- package/lib/codegen/patch-audit.js +0 -366
- package/lib/codegen/patch-audit.js.map +0 -1
- package/lib/codegen/patches.d.ts +0 -129
- package/lib/codegen/patches.d.ts.map +0 -1
- package/lib/codegen/patches.js +0 -472
- package/lib/codegen/patches.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/codegen/privatize.d.ts +0 -21
- package/lib/codegen/privatize.d.ts.map +0 -1
- package/lib/codegen/privatize.js +0 -176
- package/lib/codegen/privatize.js.map +0 -1
- package/lib/codegen/proto.d.ts +0 -121
- package/lib/codegen/proto.d.ts.map +0 -1
- package/lib/codegen/proto.js +0 -960
- package/lib/codegen/proto.js.map +0 -1
- package/lib/codegen/pure.d.ts +0 -6
- package/lib/codegen/pure.d.ts.map +0 -1
- package/lib/codegen/pure.js +0 -91
- package/lib/codegen/pure.js.map +0 -1
- package/lib/codegen/rewrite-operation-ids.d.ts +0 -154
- package/lib/codegen/rewrite-operation-ids.d.ts.map +0 -1
- package/lib/codegen/rewrite-operation-ids.js +0 -1117
- package/lib/codegen/rewrite-operation-ids.js.map +0 -1
- package/lib/codegen/spec-path.d.ts +0 -16
- package/lib/codegen/spec-path.d.ts.map +0 -1
- package/lib/codegen/spec-path.js +0 -101
- package/lib/codegen/spec-path.js.map +0 -1
- package/lib/codegen/table.d.ts +0 -5
- package/lib/codegen/table.d.ts.map +0 -1
- package/lib/codegen/table.js +0 -249
- package/lib/codegen/table.js.map +0 -1
- package/lib/json-patch.d.ts +0 -58
- package/lib/json-patch.d.ts.map +0 -1
- package/lib/json-patch.js +0 -2
- package/lib/json-patch.js.map +0 -1
- package/lib/schema-lite-typed.js.map +0 -1
- package/lib/testing.d.ts +0 -40
- package/lib/testing.d.ts.map +0 -1
- package/lib/testing.js +0 -2
- package/lib/testing.js.map +0 -1
- package/src/codegen/boolean-string-enums.ts +0 -155
- package/src/codegen/chunk.ts +0 -147
- package/src/codegen/cli.ts +0 -293
- package/src/codegen/datafy.ts +0 -874
- package/src/codegen/dedupe.ts +0 -173
- package/src/codegen/emit.ts +0 -200
- package/src/codegen/format.ts +0 -49
- package/src/codegen/generated-at.ts +0 -88
- package/src/codegen/generator.ts +0 -1229
- package/src/codegen/graph.ts +0 -151
- package/src/codegen/graphql-client.ts +0 -545
- package/src/codegen/graphql.ts +0 -1145
- package/src/codegen/latin1.ts +0 -131
- package/src/codegen/members.ts +0 -79
- package/src/codegen/model-diff.ts +0 -67
- package/src/codegen/naming.ts +0 -85
- package/src/codegen/openapi-cli.ts +0 -141
- package/src/codegen/openapi.ts +0 -1845
- package/src/codegen/operations.ts +0 -73
- package/src/codegen/pagination.ts +0 -64
- package/src/codegen/patch-audit.ts +0 -480
- package/src/codegen/patches.ts +0 -581
- package/src/codegen/prelude.ts +0 -70
- package/src/codegen/privatize.ts +0 -200
- package/src/codegen/proto.ts +0 -1092
- package/src/codegen/pure.ts +0 -94
- package/src/codegen/rewrite-operation-ids.ts +0 -1219
- package/src/codegen/spec-path.ts +0 -112
- package/src/codegen/table.ts +0 -254
- package/src/json-patch.ts +0 -273
- package/src/testing.ts +0 -74
package/lib/protocol-rest.d.ts
CHANGED
|
@@ -1,40 +1,15 @@
|
|
|
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`) -> in strict mode, a schema check
|
|
16
|
-
* failing with the provider's `parseError` (see
|
|
17
|
-
* `core/response-validation`) -> `Redacted` wrapping of members
|
|
18
|
-
* marked with {@link SensitiveValue}; non-2xx -> typed error:
|
|
19
|
-
* per-op matcher classes (`matchTypedError`), then the status
|
|
20
|
-
* map (default `HTTP_STATUS_MAP`), then an `InternalServerError`
|
|
21
|
-
* for unmapped 5xx, then the provider's `unknownError` fallback
|
|
22
|
-
* -- with `retryAfter` durations stamped from the standard hint
|
|
23
|
-
* headers on retryable statuses.
|
|
24
|
-
*
|
|
25
|
-
* Anything provider-specific (envelope quirks, bespoke error codes) belongs
|
|
26
|
-
* in the provider package -- via these options or a hand-written protocol.
|
|
27
|
-
*/
|
|
28
1
|
import * as Context from "effect/Context";
|
|
29
2
|
import * as Effect from "effect/Effect";
|
|
30
3
|
import * as Layer from "effect/Layer";
|
|
31
4
|
import type * as AST from "effect/SchemaAST";
|
|
5
|
+
import { rawResponseRootSymbol } from "./annotations.ts";
|
|
32
6
|
import * as API from "./api.ts";
|
|
33
7
|
import { unwrapRedactedDeep } from "./plain-values.ts";
|
|
34
8
|
export declare const sensitiveValueSymbol: unique symbol;
|
|
35
9
|
/**
|
|
36
|
-
* Marks a string member as sensitive (mirrors
|
|
37
|
-
* The REST protocol wraps decoded values in
|
|
10
|
+
* Marks a string member, map value or list element as sensitive (mirrors
|
|
11
|
+
* `smithy.api#sensitive`). The REST protocol wraps decoded values in
|
|
12
|
+
* `Redacted` on the way out (an untyped `S.Unknown` value whole) and
|
|
38
13
|
* accepts `string | Redacted<string>` on the way in (unwrapped before
|
|
39
14
|
* serialization). Takes an ignored argument so generators can inline the
|
|
40
15
|
* smithy trait value (`T.SensitiveValue({})`).
|
|
@@ -46,28 +21,30 @@ export declare const rawResponseSymbol: unique symbol;
|
|
|
46
21
|
* body (mirrors `com.distilled.openapi#rawResponse`).
|
|
47
22
|
*/
|
|
48
23
|
export declare const RawResponse: (_value?: unknown) => import("./trait.ts").Annotation;
|
|
49
|
-
export declare const rawResponseRootSymbol: unique symbol;
|
|
50
24
|
/**
|
|
51
25
|
* Marks a response schema whose ENTIRE value is the response body (the
|
|
52
26
|
* generator's `rootPipe` for synthesized bare-payload wrappers): the emitted
|
|
53
27
|
* response type IS the payload type and the protocol returns the mapped body
|
|
54
28
|
* directly.
|
|
55
29
|
*/
|
|
30
|
+
export { rawResponseRootSymbol };
|
|
56
31
|
export declare const RawResponseRoot: () => import("./trait.ts").Annotation;
|
|
57
32
|
export declare const binaryResponseSymbol: unique symbol;
|
|
58
33
|
/** Decode a successful raw binary response as bytes, without text conversion. */
|
|
59
34
|
export declare const BinaryResponse: () => import("./trait.ts").Annotation;
|
|
60
35
|
export { unwrapRedactedDeep };
|
|
61
36
|
/**
|
|
62
|
-
* Walk a decoded (TS-named) value alongside its schema AST, wrapping
|
|
63
|
-
* marked {@link SensitiveValue}
|
|
64
|
-
* pass through
|
|
37
|
+
* Walk a decoded (TS-named) value alongside its schema AST, wrapping values
|
|
38
|
+
* marked {@link SensitiveValue} (members, map values, list elements) in
|
|
39
|
+
* `Redacted`. Keys the schema doesn't model pass through. A union applies
|
|
40
|
+
* every arm in turn; a map arm skips keys a sibling arm names.
|
|
65
41
|
*/
|
|
66
|
-
export declare const wrapSensitive: (ast: AST.AST, value: unknown) => unknown;
|
|
42
|
+
export declare const wrapSensitive: (ast: AST.AST, value: unknown, siblingNames?: ReadonlySet<string>) => unknown;
|
|
67
43
|
/**
|
|
68
|
-
* Whether any member reachable from `ast` is
|
|
69
|
-
*
|
|
70
|
-
* {@link
|
|
44
|
+
* Whether any member, map value or list element reachable from `ast` is
|
|
45
|
+
* marked {@link SensitiveValue}. Such an output is decoded through
|
|
46
|
+
* {@link wrapSensitive}, and its parse errors withhold the response body (see
|
|
47
|
+
* {@link checkSuccess}, which every REST-style protocol's success path uses).
|
|
71
48
|
*/
|
|
72
49
|
export declare const hasSensitiveMember: (ast: AST.AST) => boolean;
|
|
73
50
|
/** What the wire said about a failure, for the `unknownError` fallback. */
|
|
@@ -153,8 +130,45 @@ export interface RestProtocolOptions<C> {
|
|
|
153
130
|
/** Passed through to `buildRequest` (wire names for unmodeled input keys). */
|
|
154
131
|
readonly unknownKeyToWire?: (key: string) => string;
|
|
155
132
|
}
|
|
156
|
-
/**
|
|
157
|
-
export
|
|
133
|
+
/** A 2xx body a protocol read, for {@link checkSuccess}. */
|
|
134
|
+
export interface SuccessBody {
|
|
135
|
+
/** The value to check and return: the body mapped onto the output's TS names. */
|
|
136
|
+
readonly value: unknown;
|
|
137
|
+
/** What a parse error reports as `body` for an output without sensitive members. */
|
|
138
|
+
readonly body: unknown;
|
|
139
|
+
/** Whether the body was not JSON. */
|
|
140
|
+
readonly nonJson: boolean;
|
|
141
|
+
}
|
|
142
|
+
/** The outcome of {@link checkSuccess}: the value, or the parse error's fields. */
|
|
143
|
+
export type SuccessCheck = {
|
|
144
|
+
readonly ok: true;
|
|
145
|
+
readonly value: unknown;
|
|
146
|
+
} | {
|
|
147
|
+
readonly ok: false;
|
|
148
|
+
readonly error: RestParseErrorInfo;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Check a 2xx body against the operation's output schema and deliver its
|
|
152
|
+
* sensitive values as `Redacted`. Every REST-style protocol ends its success
|
|
153
|
+
* path here, so all of them treat a body that can hold a secret alike:
|
|
154
|
+
*
|
|
155
|
+
* - The checked value comes back through {@link wrapSensitive}.
|
|
156
|
+
* - A mismatch (validating modes, see `core/response-validation`) reports
|
|
157
|
+
* `read.body` and the schema error.
|
|
158
|
+
* - For an output with sensitive members ({@link hasSensitiveMember}), a
|
|
159
|
+
* non-JSON body fails in every mode with `"Invalid JSON response"`, and a
|
|
160
|
+
* mismatch reports `body: "[REDACTED]"` and the schema error without the
|
|
161
|
+
* value it found (`withholdActual`).
|
|
162
|
+
*
|
|
163
|
+
* Synchronous, for protocols that already hold the calling fiber's context;
|
|
164
|
+
* {@link validateSuccess} is the `Effect` form.
|
|
165
|
+
*/
|
|
166
|
+
export declare const checkSuccess: (context: Context.Context<any>, outputAst: AST.AST, read: SuccessBody) => SuccessCheck;
|
|
167
|
+
/**
|
|
168
|
+
* {@link checkSuccess} on the calling fiber, failing with `parseError` (the
|
|
169
|
+
* SDK's `<Sdk>ParseError`) built from the withheld-or-not fields.
|
|
170
|
+
*/
|
|
171
|
+
export declare const validateSuccess: <E>(outputAst: AST.AST, read: SuccessBody, parseError: (info: RestParseErrorInfo) => E) => Effect.Effect<unknown, E>;
|
|
158
172
|
/**
|
|
159
173
|
* Build a `Layer<Protocol>` for a simple REST JSON API. Assign the result to
|
|
160
174
|
* a module-level const in the provider's `protocol.ts` -- `API.make` memoizes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-rest.d.ts","sourceRoot":"","sources":["../src/protocol-rest.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"protocol-rest.d.ts","sourceRoot":"","sources":["../src/protocol-rest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAIhC,OAAO,EAAiB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAiDtE,eAAO,MAAM,oBAAoB,eAEhC,CAAC;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AAE,MAAM,KAAK,MAAM,CAAC;IACnE,8EAA8E;IAC9E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CACrD;AAqBD,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,oFAAoF;IACpF,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,mFAAmF;AACnF,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC9C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,YACd,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,aAClB,GAAG,CAAC,GAAG,QACZ,WAAW,KAChB,YAeF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,aACpB,GAAG,CAAC,GAAG,QACZ,WAAW,cACL,CAAC,IAAI,EAAE,kBAAkB,KAAK,CAAC,KAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAIvB,CAAC;AAgCL;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,WAAW,mBAAmB,CAAC,CAAC,CAAC,KAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CA+M7F,CAAC"}
|
package/lib/protocol-rest.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { protocol_rest$BinaryResponse as BinaryResponse, protocol_rest$RawResponse as RawResponse, protocol_rest$RawResponseRoot as RawResponseRoot, protocol_rest$SensitiveValue as SensitiveValue, protocol_rest$binaryResponseSymbol as binaryResponseSymbol, protocol_rest$
|
|
1
|
+
export { protocol_rest$BinaryResponse as BinaryResponse, 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$hasSensitiveMember as hasSensitiveMember, protocol_rest$makeRestProtocol as makeRestProtocol, protocol_rest$rawResponseRootSymbol as rawResponseRootSymbol, protocol_rest$rawResponseSymbol as rawResponseSymbol, protocol_rest$sensitiveValueSymbol as sensitiveValueSymbol, protocol_rest$unwrapRedactedDeep as unwrapRedactedDeep, protocol_rest$validateSuccess as validateSuccess, protocol_rest$wrapSensitive as wrapSensitive } from "./_bundle/rest.js";
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
* lenient (default): the response is returned as the protocol read it.
|
|
8
8
|
* A body that does not match the declared output type
|
|
9
9
|
* (a missing member, a wrong primitive, a non-JSON
|
|
10
|
-
* body) still succeeds, except that
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* body) still succeeds, except that a non-JSON body for
|
|
11
|
+
* an output with sensitive members fails in every mode
|
|
12
|
+
* (REST-style protocols through core's `checkSuccess`
|
|
13
|
+
* in `protocol-rest`, plus ZeroSSL and AWS).
|
|
13
14
|
* additionalProperties: the response is checked against the output
|
|
14
15
|
* schema, and a mismatch fails the call with the SDK's
|
|
15
16
|
* `<Sdk>ParseError` (AWS: `ParseError`). Keys the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation.d.ts","sourceRoot":"","sources":["../src/response-validation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"response-validation.d.ts","sourceRoot":"","sources":["../src/response-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,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aACrB,GAAG,CAAC,GAAG,SACX,OAAO,WACL,CAAC,KAAK,EAAE,cAAc,KAAK,CAAC,KACpC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAIvB,CAAC"}
|
package/lib/schema-lite-typed.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=schema-lite-typed.js.map
|
|
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,14 @@
|
|
|
1
|
+
import * as Layer from "effect/Layer";
|
|
2
|
+
export interface Options {
|
|
3
|
+
/** Print each request and response to stderr. Default `false`. */
|
|
4
|
+
readonly logRequests?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const layerWith: (options?: Options) => Layer.Layer<never>;
|
|
7
|
+
export declare const TelemetryDebug: {
|
|
8
|
+
/** Turns on debug spans for every distilled call it is provided to. */
|
|
9
|
+
readonly layer: Layer.Layer<never, never, never>;
|
|
10
|
+
/** Debug spans, with options (`logRequests`). */
|
|
11
|
+
readonly layerWith: typeof layerWith;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=telemetry-debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-debug.d.ts","sourceRoot":"","sources":["../src/telemetry-debug.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAkFtC,MAAM,WAAW,OAAO;IACtB,kEAAkE;IAClE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,QAAA,MAAM,SAAS,aAAa,OAAO,KAAQ,KAAK,CAAC,KAAK,CAAC,KAAK,CAOlC,CAAC;AAE3B,eAAO,MAAM,cAAc;IACzB,uEAAuE;;IAEvE,iDAAiD;;CAEzC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Debug as e,OperationSpan as t,tagOf as n}from"./telemetry.js";import*as r from"effect/Effect";import*as i from"effect/Exit";import*as a from"effect/Layer";import*as o from"effect/Stream";import*as s from"effect/Cause";import*as c from"effect/Tracer";const phase=(e,t,n)=>r.withSpan(t,e,{level:`Debug`,attributes:n,captureStackTrace:false});const attempt=(e,i)=>r.withFiber(a=>{const o=a.getRef(t);if(o===void 0)return e;return r.useSpan(`Attempt`,{parent:o.span,attributes:{"distilled.attempt":i,"http.request.resend_count":i-1}},t=>{o.attempt=t;const i=r.tapError(e,e=>r.sync(()=>t.attribute(`error.type`,n(e))));return r.provideService(i,c.ParentSpan,t)})});const readStream=(e,t,a)=>o.unwrap(r.map(r.makeSpan(`distilled.read_stream`,{parent:t,level:`Debug`,attributes:{"distilled.stream.member":a}}),t=>{let a=0;let c=0;const l=o.map(e,e=>{a++;if(e instanceof Uint8Array)c+=e.byteLength;return e});return o.onExit(l,e=>r.clockWith(o=>r.sync(()=>{t.attribute(`distilled.stream.items`,a);if(c>0)t.attribute(`distilled.stream.bytes`,c);if(i.isFailure(e)&&!s.hasInterruptsOnly(e.cause))t.attribute(`error.type`,n(s.squash(e.cause)));t.end(o.currentTimeNanosUnsafe(),e)})))}));const l=/\(?((?:file:\/\/)?[^\s()]+):(\d+):(\d+)\)?$/;const callSite=e=>{const t=e?.();const n=t?l.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 layerWith=(t={})=>a.succeed(e,{phase,attempt,readStream,callSite,logRequests:t.logRequests===true});const u={layer:/*@__PURE__*/ layerWith(),layerWith};export{u as TelemetryDebug};
|
|
2
|
+
//# sourceMappingURL=telemetry-debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-debug.js","names":["Effect","Exit","Layer","Stream","Cause","Tracer","effect","name","call","fiber","OperationSpan","base","n","span","run","tagOf","error","member","items","bytes","counted","stream","item","exit","clock","LOCATION","line","site","match","fn","Debug","options","TelemetryDebug"],"sources":["../src/telemetry-debug.ts"],"mappings":"iQAsCA,MAAM,OAA8B,EAAM,EAAQ,IAChDA,EAAO,SAASM,EAAQC,EAAM,CAAE,MAAO,QAAS,aAAY,kBAAmB,KAAM,CAAC,EAExF,MAAM,SAAkC,EAAM,IAC5CP,EAAO,UAAW,GAAU,CAC1B,MAAMQ,EAAOC,EAAM,OAAOC,CAAa,EACvC,GAAIF,IAAS,IAAA,GAAW,OAAOG,EAC/B,OAAOX,EAAO,QACZ,UACA,CACE,OAAQQ,EAAK,KACb,WAAY,CAAE,oBAAqBI,EAAG,4BAA6BA,EAAI,CAAE,CAC3E,EACC,GAAS,CACR,EAAK,QAAUC,EACf,MAAMC,EAAMd,EAAO,SAASW,EAAO,GACjCX,EAAO,SAAWa,EAAK,UAAU,aAAcE,EAAMC,CAAK,CAAC,CAAC,CAC9D,EACA,OAAOhB,EAAO,eAAec,EAAKT,EAAO,WAAYQ,CAAI,CAC3D,CACF,CACF,CAAC,EAQH,MAAM,YAAwC,EAAQ,EAAQ,IAC5DV,EAAO,OACLH,EAAO,IACLA,EAAO,SAAS,wBAAyB,CACvC,SACA,MAA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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","sourceRoot":"","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","sourceRoot":"","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","sourceRoot":"","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","sourceRoot":"","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,OAAOA,IAAU,SAAU,OAAOA,EACxD,MAAMC,EAASD,EACf,MAAMJ,EAAQ,YAAYH,CAAI,EAC9B,GAAIS,EAAM,OAAS,IAAA,GACjB,MAAO,CAAE,GAAGD,GAASC,EAAM,QAAS,gBAAgBD,EAAOC,EAAM,QAASN,CAAK,CAAE,EAEnF,MAAMO,EAAUF,EAAOC,EAAM,MAC7B,GAAI,CAAC,MAAM,QAAQC,CAAO,EAAG,OAAOH,EACpC,MAAO,CACL,GAAGC,GACFC,EAAM,MA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CAAC,EACT,MAAMW,EAA2B,CAAC,EAClC,IAAK,MAAMC,KAAUF,EAAS,CAC5B,GAAIE,IAAW,MAAQ,OAAOA,IAAW,SAAU,SACnD,MAAMC,EAAUD,EAChB,MAAME,EAAKd,EAAM,YAAc,IAAA,GAAY,IAAA,GAAYa,EAAQb,EAAM,WACrE,MAAMe,EAAiB,OAAOD,IAAO,SAAW,CAAE,uBAAwBA,CAAG,EAAI,CAAC,EAClF,MAAMjB,EAAagB,EAAQb,EAAM,QAGjC,MAAMT,EACJ,iBAAiBM,GAAY,aAAa,WAAW,IACpDG,EAAM,WAAa,IAAA,GAChB,iBAAiB,oBAAoBa,EAAQb,EAAM,SAAS,CAAC,EAC7D,IAAA,IACN,GAAIT,IAAS,IAAA,GAAWoB,EAAM,KAAK,CAAE,OAAM,WAAYI,CAAe,CAAC,EACvE,GAAIf,EAAM,SAAW,IAAA,GAAW,CAC9B,MAAMgB,EAASH,EAAQb,EAAM,QAC7B,MAAMiB,EAAOC,EAAiBF,GAAQ,cAAc,EACpD,GAAIC,IAAS,IAAA,IAAaA,EAAK,SAAW1B,GAAM,OAC9CoB,EAAM,KAAK,CAAE,KAAMM,EAAM,WAAYF,CAAe,CAAC,CAEzD,CACF,CACA,OAAOJ,CACT,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-metrics.d.ts","sourceRoot":"","sources":["../src/telemetry-metrics.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,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/Effect";import*as r from"effect/Exit";import*as i from"effect/Layer";import*as a from"effect/Cause";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=>r.isSuccess(e)?void 0:t(a.squash(e.cause));const measure=(e,t)=>n.clockWith(r=>{const i=r.currentTimeNanosUnsafe();return n.onExit(t,t=>o.update(metricOf(e,errorTypeOf(t)),Number(r.currentTimeNanosUnsafe()-i)/1e9))});const l={layer:/*@__PURE__*/ i.succeed(e,measure)};export{l as TelemetryMetrics};
|
|
2
|
+
//# sourceMappingURL=telemetry-metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-metrics.js","names":["Effect","Exit","Layer","Cause","Metric","duration","byOperation","byOutcome","info","key","errorType","metric","attributes","name","value","exit","tagOf","start","clock","effect","TelemetryMetrics","Metrics"],"sources":["../src/telemetry-metrics.ts"],"mappings":"gNAyBA,MAAMK,EAAyB,gBAAO,UAAU,2BAA4B,CAC1E,YAAa,kCACb,WAAY,CAJM,KAAO,IAAM,KAAO,IAAM,KAAO,GAAK,IAAM,GAAK,IAAM,EAAG,IAAK,EAAG,IAAK,EAIpE,CACvB,CAAC,EAGD,MAAMC,kBAAc,IAAI,QAExB,MAAM,UAAY,EAAqB,IAAkC,CACvE,IAAIC,EAAYD,EAAY,IAAIE,CAAI,EACpC,GAAID,IAAc,IAAA,GAAWD,EAAY,IAAIE,EAAO,kBAAY,IAAI,GAAM,EAC1E,MAAMC,EAAMC,GAAa,GACzB,IAAIC,EAASJ,EAAU,IAAIE,CAAG,EAC9B,GAAIE,IAAW,IAAA,GAAW,CACxB,MAAMC,EAAqC,CAAC,EAC5C,IAAK,MAAMC,IAAQ,CAAC,kBAAmB,YAAY,EAAG,CACpD,MAAMC,EAAQN,EAAK,WAAWK,GAC9B,GAAI,OAAOC,IAAU,SAAU,EAAWD,GAAQC,CACpD,CACA,GAAIJ,IAAc,IAAA,GAAW,EAAW,cAAgBA,EACxD,EAASN,EAAO,eAAeC,EAAUO,CAAU,EACnDL,EAAU,IAAIE,EAAKE,CAAM,CAC3B,CACA,OAAOA,CACT,EAEA,MAAM,YAAe,GACnBV,EAAK,UAAUc,CAAI,EAAI,IAAA,GAAYC,EAAMb,EAAM,OAAOY,EAAK,KAAK,CAAC,EAEnE,MAAM,SAAoB,EAAM,IAC9Bf,EAAO,UAAW,GAAU,CAC1B,MAAMiB,EAAQC,EAAM,uBAAuB,EAC3C,OAAOlB,EAAO,OAAOmB,EAAS,GAC5Bf,EAAO,OACL,SAASI,EAAM,YAAYO,CAAI,CAAC,EAChC,OAAOG,EAAM,uBAAuB,EAAID,CAAK,EAAI,GACnD,CACF,CACF,CAAC,EAEH,MAAaG,EAAmB,CAE9B,MAAqB,gBAAM,QAAQC,EAAS,OAAO,CACrD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `com.distilled.telemetry#operation` trait's `nameTemplate`, as a
|
|
3
|
+
* function: generated code imports this only where a trait has one
|
|
4
|
+
* (messaging operations). See `packages/dev/src/codegen/telemetry-traits.md`.
|
|
5
|
+
*/
|
|
6
|
+
import type { SpanRename } from "./telemetry.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Span name from `{attribute}` placeholders filled from the call's input
|
|
9
|
+
* attributes (`send {messaging.destination.name}`); undefined (the trait's
|
|
10
|
+
* `name`) when one is missing.
|
|
11
|
+
*/
|
|
12
|
+
export declare const nameTemplate: (template: string) => SpanRename;
|
|
13
|
+
//# sourceMappingURL=telemetry-name-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-name-template.d.ts","sourceRoot":"","sources":["../src/telemetry-name-template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD;;;;GAIG;AACH,eAAO,MAAM,YAAY,aACZ,MAAM,KAAG,UAUnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-name-template.js","names":["PLACEHOLDER","complete","name","template","value","attributes","key"],"sources":["../src/telemetry-name-template.ts"],"mappings":"AAOA,MAAMA,EAAc,gBAOpB,MAAa,aACV,GACA,GAAe,CACd,IAAIC,EAAW,KACf,MAAMC,EAAOC,EAAS,QAAQH,GAAc,EAAG,IAAgB,CAC7D,MAAMI,EAAQC,EAAWC,GACzB,GAAI,OAAOF,IAAU,UAAY,OAAOA,IAAU,SAAU,OAAO,OAAOA,CAAK,EAC/E,EAAW,MACX,MAAO,EACT,CAAC,EACD,OAAOH,EAAWC,EAAO,IAAA,EAC3B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SpanHold } from "./telemetry.ts";
|
|
2
|
+
export interface StreamRule {
|
|
3
|
+
/** The output member holding the stream (the generated property name). */
|
|
4
|
+
readonly member: string;
|
|
5
|
+
/** Attribute for the seconds from the span's start to the first item. */
|
|
6
|
+
readonly firstChunk?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const holdForStream: (rule: StreamRule) => SpanHold;
|
|
9
|
+
//# sourceMappingURL=telemetry-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-stream.d.ts","sourceRoot":"","sources":["../src/telemetry-stream.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,SACjB,UAAU,KAAG,QAmDnB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{tagOf as e}from"./telemetry.js";import*as t from"effect/Effect";import*as n from"effect/Exit";import*as r from"effect/Stream";import*as i from"effect/Cause";import*as a from"effect/References";import*as o from"effect/Clock";const holdForStream=s=>(c,l,u,d,f)=>{const p=c.getRef(o.Clock);const m=c.getRef(a.TracerTimingEnabled);const now=()=>m?p.currentTimeNanosUnsafe():0n;return t.uninterruptibleMask(a=>t.flatMap(t.makeSpan(l,u),o=>{const end=e=>{if(o.status._tag!==`Ended`)o.end(now(),e)};let c=false;const l=t.map(f(o),a=>{const l=a;const u=l?.[s.member];if(!r.isStream(u))return a;c=true;let f=false;const p=r.suspend(()=>{let e=d===void 0?u:d.readStream(u,o,s.member);const t=s.firstChunk;if(t!==void 0){let n=true;e=r.map(e,e=>{if(n){n=false;o.attribute(t,Number(now()-o.status.startTime)/1e9)}return e})}return e});const m=r.onExit(p,r=>t.sync(()=>{if(f)return;f=true;if(n.isFailure(r)&&!i.hasInterruptsOnly(r.cause)){o.attribute(`error.type`,e(i.squash(r.cause)));end(r)}else end(n.void)}));return{...l,[s.member]:m}});return t.onExit(a(l),e=>t.sync(()=>{if(!c||n.isFailure(e))end(e)}))}))};export{holdForStream};
|
|
2
|
+
//# sourceMappingURL=telemetry-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-stream.js","names":["Effect","Exit","Stream","Cause","References","Clock","clock","fiber","timing","name","options","span","exit","held","body","inSpan","fields","output","stream","rule","done","read","items","debug","attribute","first","item","wrapped","tagOf","restore"],"sources":["../src/telemetry-stream.ts"],"mappings":"uOAsCA,MAAa,cACV,IACA,EAAO,EAAM,EAAS,EAAO,IAAW,CACvC,MAAMM,EAAQC,EAAM,OAAOF,EAAM,KAAK,EACt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K,QAASQ,CAAQ,CAC7C,CAAC,EACD,OAAO3B,EAAO,OAAO6B,EAAQf,CAAI,EAAI,GACnCd,EAAO,SAAW,CAChB,GAAI,CAACa,GAAQZ,EAAK,UAAUW,CAAI,EAAG,IAAIA,CAAI,CAC7C,CAAC,CACH,CACF,CAAC,CACH,CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS X-Ray trace context, which AWS services read and pass on (the OTel
|
|
3
|
+
* AWS SDK conventions recommend it for AWS calls). Generated code imports
|
|
4
|
+
* this only where the model's `com.distilled.telemetry` traits ask for it:
|
|
5
|
+
* a service's `propagation: "xray"`, an operation's `inject` with format
|
|
6
|
+
* `xrayTraceHeader`. See `packages/dev/src/codegen/telemetry-traits.md`.
|
|
7
|
+
*
|
|
8
|
+
* `Root=1-<8 hex>-<24 hex>;Parent=<16 hex>;Sampled=<0|1>`, from a W3C trace
|
|
9
|
+
* id split after 8 hex digits, as OTel's AWS X-Ray propagator writes it.
|
|
10
|
+
*/
|
|
11
|
+
import * as Tracer from "effect/Tracer";
|
|
12
|
+
export declare const HEADER = "X-Amzn-Trace-Id";
|
|
13
|
+
/** The X-Ray trace header of a span. */
|
|
14
|
+
export declare const traceHeader: (span: Tracer.AnySpan) => string;
|
|
15
|
+
/** The span an X-Ray trace header names, if it has a root and a parent. */
|
|
16
|
+
export declare const parseTraceHeader: (value: unknown) => Tracer.ExternalSpan | undefined;
|
|
17
|
+
/** `propagation: "xray"`: the `X-Amzn-Trace-Id` request header. */
|
|
18
|
+
export declare const propagate: (span: Tracer.AnySpan) => readonly [string, string];
|
|
19
|
+
/**
|
|
20
|
+
* Write the span's X-Ray trace header into a string `member` of the input,
|
|
21
|
+
* or of every element of its `list` member (EventBridge `PutEvents`
|
|
22
|
+
* entries' `TraceHeader`). A value the caller set is kept.
|
|
23
|
+
*/
|
|
24
|
+
export declare const injectTraceHeader: (place: {
|
|
25
|
+
readonly member: string;
|
|
26
|
+
readonly list?: string;
|
|
27
|
+
}) => (span: Tracer.Span, input: unknown) => unknown;
|
|
28
|
+
//# sourceMappingURL=telemetry-xray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-xray.d.ts","sourceRoot":"","sources":["../src/telemetry-xray.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,wCAAwC;AACxC,eAAO,MAAM,WAAW,SAAU,MAAM,CAAC,OAAO,KAAG,MAG/C,CAAC;AAML,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,UAAW,OAAO,KAAG,MAAM,CAAC,YAAY,GAAG,SAUvE,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,SAAS,SAAU,MAAM,CAAC,OAAO,KAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAGxE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UACpB;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,YACpD,MAAM,CAAC,IAAI,SAAS,OAAO,KAAG,OAepC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as e from"effect/Tracer";const t=`X-Amzn-Trace-Id`;const traceHeader=e=>`Root=1-${e.traceId.slice(0,8)}-${e.traceId.slice(8)};Parent=${e.spanId};Sampled=${e.sampled?1:0}`;const n=/(?:^|;)\s*Root=1-([0-9a-f]{8})-([0-9a-f]{24})/;const r=/(?:^|;)\s*Parent=([0-9a-f]{16})/;const i=/(?:^|;)\s*Sampled=([01])/;const parseTraceHeader=t=>{if(typeof t!==`string`)return void 0;const a=n.exec(t);const o=r.exec(t);if(a===null||o===null)return void 0;return e.externalSpan({traceId:a[1]+a[2],spanId:o[1],sampled:i.exec(t)?.[1]!==`0`})};const propagate=e=>[t,traceHeader(e)];const injectTraceHeader=e=>(t,n)=>{if(n===null||typeof n!==`object`)return n;const r=n;const i=traceHeader(t);const set=t=>t[e.member]===void 0?{...t,[e.member]:i}:t;if(e.list===void 0)return set(r);const a=r[e.list];if(!Array.isArray(a))return n;return{...r,[e.list]:a.map(e=>e!==null&&typeof e===`object`?set(e):e)}};export{t as HEADER,injectTraceHeader,parseTraceHeader,propagate,traceHeader};
|
|
2
|
+
//# sourceMappingURL=telemetry-xray.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-xray.js","names":["Tracer","HEADER","span","ROOT","PARENT","SAMPLED","value","root","parent","input","record","holder","place","entries","entry"],"sources":["../src/telemetry-xray.ts"],"mappings":"gCAYA,MAAaC,EAAS,kBAGtB,MAAa,YAAe,GAC1B,UAAUC,EAAK,QAAQ,MAAM,EAAG,CAAC,EAAE,GAAGA,EAAK,QAAQ,MAAM,CAAC,EAAE,UAAUA,EAAK,OAAO,WAChFA,EAAK,QAAU,EAAI,IAGvB,MAAMC,EAAO,gDACb,MAAMC,EAAS,kCACf,MAAMC,EAAU,2BAGhB,MAAa,iBAAoB,GAAoD,CACnF,GAAI,OAAOC,IAAU,SAAU,OAAO,IAAA,GACtC,MAAMC,EAAOJ,EAAK,KAAKG,CAAK,EAC5B,MAAME,EAASJ,EAAO,KAAKE,CAAK,EAChC,GAAIC,IAAS,MAAQC,IAAW,KAAM,OAAO,IAAA,GAC7C,OAAOR,EAAO,aAAa,CACzB,QAASO,EAAK,GAAMA,EAAK,GACzB,OAAQC,EAAO,GACf,QAASH,EAAQ,KAAKC,CAAK,CAAC,GAAG,KAAO,GACxC,CAAC,CACH,EAGA,MAAa,UAAa,GAAoD,CAC5EL,EACA,YAAYC,CAAI,CAClB,EAOA,MAAa,kBACV,IACA,EAAmB,IAA4B,CAC9C,GAAIO,IAAU,MAAQ,OAAOA,IAAU,SAAU,OAAOA,EACxD,MAAMC,EAASD,EACf,MAAMH,EAAQ,YA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