@stainlessdev/xray-emitter 0.1.0-branch.pedro-unify.20f830a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -0
- package/dist/chunk-2NR6RZEP.js +1339 -0
- package/dist/chunk-2NR6RZEP.js.map +1 -0
- package/dist/chunk-3MVVO5I7.cjs +1339 -0
- package/dist/chunk-3MVVO5I7.cjs.map +1 -0
- package/dist/chunk-6UH43LVD.js +281 -0
- package/dist/chunk-6UH43LVD.js.map +1 -0
- package/dist/chunk-AHXNYJ5A.cjs +621 -0
- package/dist/chunk-AHXNYJ5A.cjs.map +1 -0
- package/dist/chunk-GNSXLLEC.cjs +281 -0
- package/dist/chunk-GNSXLLEC.cjs.map +1 -0
- package/dist/chunk-JKW6E4L3.cjs +304 -0
- package/dist/chunk-JKW6E4L3.cjs.map +1 -0
- package/dist/chunk-MPQTI5AX.js +621 -0
- package/dist/chunk-MPQTI5AX.js.map +1 -0
- package/dist/chunk-QUH3LJ5M.cjs +634 -0
- package/dist/chunk-QUH3LJ5M.cjs.map +1 -0
- package/dist/chunk-VGRLHYDA.js +634 -0
- package/dist/chunk-VGRLHYDA.js.map +1 -0
- package/dist/chunk-YVMMCTXW.js +304 -0
- package/dist/chunk-YVMMCTXW.js.map +1 -0
- package/dist/express.cjs +45 -0
- package/dist/express.cjs.map +1 -0
- package/dist/express.d.cts +17 -0
- package/dist/express.d.ts +17 -0
- package/dist/express.js +45 -0
- package/dist/express.js.map +1 -0
- package/dist/fastify.cjs +64 -0
- package/dist/fastify.cjs.map +1 -0
- package/dist/fastify.d.cts +21 -0
- package/dist/fastify.d.ts +21 -0
- package/dist/fastify.js +64 -0
- package/dist/fastify.js.map +1 -0
- package/dist/fetch.cjs +16 -0
- package/dist/fetch.cjs.map +1 -0
- package/dist/fetch.d.cts +19 -0
- package/dist/fetch.d.ts +19 -0
- package/dist/fetch.js +16 -0
- package/dist/fetch.js.map +1 -0
- package/dist/hono.cjs +71 -0
- package/dist/hono.cjs.map +1 -0
- package/dist/hono.d.cts +30 -0
- package/dist/hono.d.ts +30 -0
- package/dist/hono.js +71 -0
- package/dist/hono.js.map +1 -0
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.cjs +45 -0
- package/dist/internal.cjs.map +1 -0
- package/dist/internal.d.cts +53 -0
- package/dist/internal.d.ts +53 -0
- package/dist/internal.js +45 -0
- package/dist/internal.js.map +1 -0
- package/dist/next.cjs +30 -0
- package/dist/next.cjs.map +1 -0
- package/dist/next.d.cts +18 -0
- package/dist/next.d.ts +18 -0
- package/dist/next.js +30 -0
- package/dist/next.js.map +1 -0
- package/dist/node.cjs +14 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +20 -0
- package/dist/node.d.ts +20 -0
- package/dist/node.js +14 -0
- package/dist/node.js.map +1 -0
- package/dist/remix.cjs +30 -0
- package/dist/remix.cjs.map +1 -0
- package/dist/remix.d.cts +15 -0
- package/dist/remix.d.ts +15 -0
- package/dist/remix.js +30 -0
- package/dist/remix.js.map +1 -0
- package/dist/types-Z1nirh-F.d.cts +149 -0
- package/dist/types-Z1nirh-F.d.ts +149 -0
- package/package.json +94 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { C as CapturedBody, b as Logger, L as LogLevel, d as XrayContext, e as CaptureConfig, f as RedactionConfig } from './types-Z1nirh-F.js';
|
|
2
|
+
import '@opentelemetry/sdk-trace-base';
|
|
3
|
+
|
|
4
|
+
declare function makeCapturedBody(bytes: Uint8Array | undefined, totalBytes: number, truncated: boolean, mode: 'text' | 'base64'): CapturedBody | undefined;
|
|
5
|
+
|
|
6
|
+
declare class LimitedBuffer {
|
|
7
|
+
private buffer;
|
|
8
|
+
private length;
|
|
9
|
+
private readonly limit;
|
|
10
|
+
private truncatedFlag;
|
|
11
|
+
private total;
|
|
12
|
+
constructor(limit: number);
|
|
13
|
+
bytes(): Uint8Array;
|
|
14
|
+
capturedBytes(): number;
|
|
15
|
+
totalBytes(): number;
|
|
16
|
+
truncated(): boolean;
|
|
17
|
+
write(chunk: Uint8Array): void;
|
|
18
|
+
private ensureCapacity;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type HeaderCapture = {
|
|
22
|
+
headers: Record<string, string | string[]>;
|
|
23
|
+
truncated: boolean;
|
|
24
|
+
};
|
|
25
|
+
declare function headerValuesFromNodeHeaders(headers: Record<string, string | string[] | number | undefined>): Record<string, string | string[]>;
|
|
26
|
+
declare function headerValuesFromFetchHeaders(headers: Headers): Record<string, string | string[]>;
|
|
27
|
+
declare function headerValuesFromFetchHeadersWithLimit(headers: Headers, maxBytes: number): HeaderCapture;
|
|
28
|
+
declare function headerTokenList(values: string[] | string | undefined): string[];
|
|
29
|
+
|
|
30
|
+
type HeaderValues = Record<string, string | string[]>;
|
|
31
|
+
declare function isWebsocketUpgrade(statusCode: number, requestHeaders: HeaderValues | undefined, responseHeaders: HeaderValues | undefined): boolean;
|
|
32
|
+
declare function isWebsocketUpgradeFetch(statusCode: number, requestHeaders: Headers, responseHeaders: Headers): boolean;
|
|
33
|
+
|
|
34
|
+
declare function logWithLevel(logger: Logger, level: LogLevel, threshold: LogLevel, message: string, fields?: Record<string, unknown>): void;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Generates a UUIDv7 string.
|
|
38
|
+
* Uses crypto.getRandomValues which is available in all modern JS runtimes
|
|
39
|
+
* (browsers, Node.js 15+, Deno, Bun, Cloudflare Workers, Vercel Edge, etc.)
|
|
40
|
+
*/
|
|
41
|
+
declare function uuidv7(): string;
|
|
42
|
+
declare function uuidv7base62(): string;
|
|
43
|
+
declare function uuidv7base48(): string;
|
|
44
|
+
declare function generateRequestId(): string;
|
|
45
|
+
|
|
46
|
+
declare function bindContextToObject(target: object, ctx: XrayContext): void;
|
|
47
|
+
declare function getXrayContextFromObject(target: unknown): XrayContext | undefined;
|
|
48
|
+
declare function setContextRoute(ctx: XrayContext, route: string): void;
|
|
49
|
+
declare function setContextRequestId(ctx: XrayContext, requestId: string): void;
|
|
50
|
+
declare function setCaptureOverride(ctx: XrayContext, capture: Partial<CaptureConfig> | undefined): void;
|
|
51
|
+
declare function setRedactionOverride(ctx: XrayContext, redaction: Partial<RedactionConfig> | undefined): void;
|
|
52
|
+
|
|
53
|
+
export { LimitedBuffer, bindContextToObject, generateRequestId, getXrayContextFromObject, headerTokenList, headerValuesFromFetchHeaders, headerValuesFromFetchHeadersWithLimit, headerValuesFromNodeHeaders, isWebsocketUpgrade, isWebsocketUpgradeFetch, logWithLevel, makeCapturedBody, setCaptureOverride, setContextRequestId, setContextRoute, setRedactionOverride, uuidv7, uuidv7base48, uuidv7base62 };
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LimitedBuffer,
|
|
3
|
+
bindContextToObject,
|
|
4
|
+
getXrayContextFromObject,
|
|
5
|
+
headerTokenList,
|
|
6
|
+
headerValuesFromFetchHeaders,
|
|
7
|
+
headerValuesFromFetchHeadersWithLimit,
|
|
8
|
+
headerValuesFromNodeHeaders,
|
|
9
|
+
isWebsocketUpgrade,
|
|
10
|
+
isWebsocketUpgradeFetch,
|
|
11
|
+
setCaptureOverride,
|
|
12
|
+
setContextRequestId,
|
|
13
|
+
setContextRoute,
|
|
14
|
+
setRedactionOverride
|
|
15
|
+
} from "./chunk-6UH43LVD.js";
|
|
16
|
+
import {
|
|
17
|
+
generateRequestId,
|
|
18
|
+
logWithLevel,
|
|
19
|
+
makeCapturedBody,
|
|
20
|
+
uuidv7,
|
|
21
|
+
uuidv7base48,
|
|
22
|
+
uuidv7base62
|
|
23
|
+
} from "./chunk-YVMMCTXW.js";
|
|
24
|
+
export {
|
|
25
|
+
LimitedBuffer,
|
|
26
|
+
bindContextToObject,
|
|
27
|
+
generateRequestId,
|
|
28
|
+
getXrayContextFromObject,
|
|
29
|
+
headerTokenList,
|
|
30
|
+
headerValuesFromFetchHeaders,
|
|
31
|
+
headerValuesFromFetchHeadersWithLimit,
|
|
32
|
+
headerValuesFromNodeHeaders,
|
|
33
|
+
isWebsocketUpgrade,
|
|
34
|
+
isWebsocketUpgradeFetch,
|
|
35
|
+
logWithLevel,
|
|
36
|
+
makeCapturedBody,
|
|
37
|
+
setCaptureOverride,
|
|
38
|
+
setContextRequestId,
|
|
39
|
+
setContextRoute,
|
|
40
|
+
setRedactionOverride,
|
|
41
|
+
uuidv7,
|
|
42
|
+
uuidv7base48,
|
|
43
|
+
uuidv7base62
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/next.cjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkAHXNYJ5Acjs = require('./chunk-AHXNYJ5A.cjs');
|
|
6
|
+
require('./chunk-3MVVO5I7.cjs');
|
|
7
|
+
require('./chunk-GNSXLLEC.cjs');
|
|
8
|
+
require('./chunk-JKW6E4L3.cjs');
|
|
9
|
+
|
|
10
|
+
// src/next/next.ts
|
|
11
|
+
function createEmitter2(config, options) {
|
|
12
|
+
const emitter = _chunkAHXNYJ5Acjs.createEmitter.call(void 0, config);
|
|
13
|
+
const wrap = ((handler) => wrapNextRoute(handler, emitter, options));
|
|
14
|
+
wrap.flush = emitter.flush;
|
|
15
|
+
wrap.shutdown = emitter.shutdown;
|
|
16
|
+
return wrap;
|
|
17
|
+
}
|
|
18
|
+
function wrapNextRoute(handler, xray, options) {
|
|
19
|
+
return async (request, context) => {
|
|
20
|
+
const wrapped = _chunkAHXNYJ5Acjs.wrapFetchPreserve.call(void 0, (req) => handler(req, context), xray, options);
|
|
21
|
+
return wrapped(request);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
exports.createCoreEmitter = _chunkAHXNYJ5Acjs.createEmitter; exports.createEmitter = createEmitter2; exports.getXrayContext = _chunkAHXNYJ5Acjs.getXrayContext; exports.wrapNextRoute = wrapNextRoute;
|
|
30
|
+
//# sourceMappingURL=next.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/xray-emitter-js/xray-emitter-js/dist/next.cjs","../src/next/next.ts"],"names":["createEmitter"],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACA;AC2BO,SAASA,cAAAA,CAAc,MAAA,EAA2B,OAAA,EAAoC;AAC3F,EAAA,MAAM,QAAA,EAAU,6CAAA,MAAyB,CAAA;AACzC,EAAA,MAAM,KAAA,EAAA,CAAQ,CAAC,OAAA,EAAA,GACb,aAAA,CAAc,OAAA,EAAS,OAAA,EAAS,OAAO,CAAA,CAAA;AACzC,EAAA,IAAA,CAAK,MAAA,EAAQ,OAAA,CAAQ,KAAA;AACrB,EAAA,IAAA,CAAK,SAAA,EAAW,OAAA,CAAQ,QAAA;AACxB,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,aAAA,CACd,OAAA,EACA,IAAA,EACA,OAAA,EACoE;AACpE,EAAA,OAAO,MAAA,CAAO,OAAA,EAAS,OAAA,EAAA,GAAY;AACjC,IAAA,MAAM,QAAA,EAAU,iDAAA,CAAmB,GAAA,EAAA,GAAiB,OAAA,CAAQ,GAAA,EAAK,OAAO,CAAA,EAAG,IAAA,EAAM,OAAO,CAAA;AACxF,IAAA,OAAO,OAAA,CAAQ,OAAO,CAAA;AAAA,EACxB,CAAA;AACF;AD/BA;AACE;AACA;AACA;AACA;AACF,sMAAC","file":"/home/runner/work/xray-emitter-js/xray-emitter-js/dist/next.cjs","sourcesContent":[null,"import type { XrayEmitter, XrayRuntimeConfig } from '../core/index';\nimport {\n createEmitter as createFetchEmitter,\n getXrayContext,\n wrapFetchPreserve,\n type WrapOptions,\n} from '../fetch/fetch';\n\nexport { createFetchEmitter as createCoreEmitter };\nexport type {\n CaptureConfig,\n RedactionConfig,\n RequestLog,\n XrayConfig,\n XrayContext,\n XrayEmitter,\n XrayRuntimeConfig,\n} from '../core/index';\nexport type { WrapOptions } from '../fetch/fetch';\nexport { getXrayContext };\n\n// copy types from Next.js to avoid a package dependency\ntype NextRouteContext = {\n params: Promise<Record<string, string | string[]>>;\n};\n\ntype NextRouteHandler = (\n request: Request,\n context: NextRouteContext,\n) => Response | Promise<Response>;\n\ntype NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRoute>) & {\n flush: XrayEmitter['flush'];\n shutdown: XrayEmitter['shutdown'];\n};\n\nexport function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): NextEmitter {\n const emitter = createFetchEmitter(config);\n const wrap = ((handler: NextRouteHandler) =>\n wrapNextRoute(handler, emitter, options)) as NextEmitter;\n wrap.flush = emitter.flush;\n wrap.shutdown = emitter.shutdown;\n return wrap;\n}\n\nexport function wrapNextRoute(\n handler: NextRouteHandler,\n xray: XrayEmitter,\n options?: WrapOptions,\n): (request: Request, context: NextRouteContext) => Promise<Response> {\n return async (request, context) => {\n const wrapped = wrapFetchPreserve((req: Request) => handler(req, context), xray, options);\n return wrapped(request);\n };\n}\n"]}
|
package/dist/next.d.cts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { j as XrayRuntimeConfig, a as XrayEmitter } from './types-Z1nirh-F.cjs';
|
|
2
|
+
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig, d as XrayContext } from './types-Z1nirh-F.cjs';
|
|
3
|
+
import { WrapOptions } from './fetch.cjs';
|
|
4
|
+
export { createEmitter as createCoreEmitter, getXrayContext } from './fetch.cjs';
|
|
5
|
+
import '@opentelemetry/sdk-trace-base';
|
|
6
|
+
|
|
7
|
+
type NextRouteContext = {
|
|
8
|
+
params: Promise<Record<string, string | string[]>>;
|
|
9
|
+
};
|
|
10
|
+
type NextRouteHandler = (request: Request, context: NextRouteContext) => Response | Promise<Response>;
|
|
11
|
+
type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRoute>) & {
|
|
12
|
+
flush: XrayEmitter['flush'];
|
|
13
|
+
shutdown: XrayEmitter['shutdown'];
|
|
14
|
+
};
|
|
15
|
+
declare function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): NextEmitter;
|
|
16
|
+
declare function wrapNextRoute(handler: NextRouteHandler, xray: XrayEmitter, options?: WrapOptions): (request: Request, context: NextRouteContext) => Promise<Response>;
|
|
17
|
+
|
|
18
|
+
export { WrapOptions, XrayEmitter, XrayRuntimeConfig, createEmitter, wrapNextRoute };
|
package/dist/next.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { j as XrayRuntimeConfig, a as XrayEmitter } from './types-Z1nirh-F.js';
|
|
2
|
+
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig, d as XrayContext } from './types-Z1nirh-F.js';
|
|
3
|
+
import { WrapOptions } from './fetch.js';
|
|
4
|
+
export { createEmitter as createCoreEmitter, getXrayContext } from './fetch.js';
|
|
5
|
+
import '@opentelemetry/sdk-trace-base';
|
|
6
|
+
|
|
7
|
+
type NextRouteContext = {
|
|
8
|
+
params: Promise<Record<string, string | string[]>>;
|
|
9
|
+
};
|
|
10
|
+
type NextRouteHandler = (request: Request, context: NextRouteContext) => Response | Promise<Response>;
|
|
11
|
+
type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRoute>) & {
|
|
12
|
+
flush: XrayEmitter['flush'];
|
|
13
|
+
shutdown: XrayEmitter['shutdown'];
|
|
14
|
+
};
|
|
15
|
+
declare function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): NextEmitter;
|
|
16
|
+
declare function wrapNextRoute(handler: NextRouteHandler, xray: XrayEmitter, options?: WrapOptions): (request: Request, context: NextRouteContext) => Promise<Response>;
|
|
17
|
+
|
|
18
|
+
export { WrapOptions, XrayEmitter, XrayRuntimeConfig, createEmitter, wrapNextRoute };
|
package/dist/next.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createEmitter,
|
|
3
|
+
getXrayContext,
|
|
4
|
+
wrapFetchPreserve
|
|
5
|
+
} from "./chunk-MPQTI5AX.js";
|
|
6
|
+
import "./chunk-2NR6RZEP.js";
|
|
7
|
+
import "./chunk-6UH43LVD.js";
|
|
8
|
+
import "./chunk-YVMMCTXW.js";
|
|
9
|
+
|
|
10
|
+
// src/next/next.ts
|
|
11
|
+
function createEmitter2(config, options) {
|
|
12
|
+
const emitter = createEmitter(config);
|
|
13
|
+
const wrap = ((handler) => wrapNextRoute(handler, emitter, options));
|
|
14
|
+
wrap.flush = emitter.flush;
|
|
15
|
+
wrap.shutdown = emitter.shutdown;
|
|
16
|
+
return wrap;
|
|
17
|
+
}
|
|
18
|
+
function wrapNextRoute(handler, xray, options) {
|
|
19
|
+
return async (request, context) => {
|
|
20
|
+
const wrapped = wrapFetchPreserve((req) => handler(req, context), xray, options);
|
|
21
|
+
return wrapped(request);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
createEmitter as createCoreEmitter,
|
|
26
|
+
createEmitter2 as createEmitter,
|
|
27
|
+
getXrayContext,
|
|
28
|
+
wrapNextRoute
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=next.js.map
|
package/dist/next.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/next/next.ts"],"sourcesContent":["import type { XrayEmitter, XrayRuntimeConfig } from '../core/index';\nimport {\n createEmitter as createFetchEmitter,\n getXrayContext,\n wrapFetchPreserve,\n type WrapOptions,\n} from '../fetch/fetch';\n\nexport { createFetchEmitter as createCoreEmitter };\nexport type {\n CaptureConfig,\n RedactionConfig,\n RequestLog,\n XrayConfig,\n XrayContext,\n XrayEmitter,\n XrayRuntimeConfig,\n} from '../core/index';\nexport type { WrapOptions } from '../fetch/fetch';\nexport { getXrayContext };\n\n// copy types from Next.js to avoid a package dependency\ntype NextRouteContext = {\n params: Promise<Record<string, string | string[]>>;\n};\n\ntype NextRouteHandler = (\n request: Request,\n context: NextRouteContext,\n) => Response | Promise<Response>;\n\ntype NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRoute>) & {\n flush: XrayEmitter['flush'];\n shutdown: XrayEmitter['shutdown'];\n};\n\nexport function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): NextEmitter {\n const emitter = createFetchEmitter(config);\n const wrap = ((handler: NextRouteHandler) =>\n wrapNextRoute(handler, emitter, options)) as NextEmitter;\n wrap.flush = emitter.flush;\n wrap.shutdown = emitter.shutdown;\n return wrap;\n}\n\nexport function wrapNextRoute(\n handler: NextRouteHandler,\n xray: XrayEmitter,\n options?: WrapOptions,\n): (request: Request, context: NextRouteContext) => Promise<Response> {\n return async (request, context) => {\n const wrapped = wrapFetchPreserve((req: Request) => handler(req, context), xray, options);\n return wrapped(request);\n };\n}\n"],"mappings":";;;;;;;;;;AAoCO,SAASA,eAAc,QAA2B,SAAoC;AAC3F,QAAM,UAAU,cAAmB,MAAM;AACzC,QAAM,QAAQ,CAAC,YACb,cAAc,SAAS,SAAS,OAAO;AACzC,OAAK,QAAQ,QAAQ;AACrB,OAAK,WAAW,QAAQ;AACxB,SAAO;AACT;AAEO,SAAS,cACd,SACA,MACA,SACoE;AACpE,SAAO,OAAO,SAAS,YAAY;AACjC,UAAM,UAAU,kBAAkB,CAAC,QAAiB,QAAQ,KAAK,OAAO,GAAG,MAAM,OAAO;AACxF,WAAO,QAAQ,OAAO;AAAA,EACxB;AACF;","names":["createEmitter"]}
|
package/dist/node.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkQUH3LJ5Mcjs = require('./chunk-QUH3LJ5M.cjs');
|
|
6
|
+
require('./chunk-3MVVO5I7.cjs');
|
|
7
|
+
require('./chunk-GNSXLLEC.cjs');
|
|
8
|
+
require('./chunk-JKW6E4L3.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.createEmitter = _chunkQUH3LJ5Mcjs.createEmitter; exports.getXrayContext = _chunkQUH3LJ5Mcjs.getXrayContext; exports.wrapHttpHandler = _chunkQUH3LJ5Mcjs.wrapHttpHandler;
|
|
14
|
+
//# sourceMappingURL=node.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/xray-emitter-js/xray-emitter-js/dist/node.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACF,gLAAC","file":"/home/runner/work/xray-emitter-js/xray-emitter-js/dist/node.cjs"}
|
package/dist/node.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { j as XrayRuntimeConfig, a as XrayEmitter, e as CaptureConfig, f as RedactionConfig, d as XrayContext, R as RequestLog } from './types-Z1nirh-F.cjs';
|
|
2
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
import '@opentelemetry/sdk-trace-base';
|
|
4
|
+
|
|
5
|
+
declare function createEmitter(config: XrayRuntimeConfig): XrayEmitter;
|
|
6
|
+
|
|
7
|
+
type NodeHttpHandler = (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
|
|
8
|
+
interface WrapOptions {
|
|
9
|
+
route?: string;
|
|
10
|
+
requestId?: string;
|
|
11
|
+
capture?: Partial<CaptureConfig>;
|
|
12
|
+
redaction?: Partial<RedactionConfig>;
|
|
13
|
+
onRequest?: (ctx: XrayContext) => void;
|
|
14
|
+
onResponse?: (ctx: XrayContext, log: RequestLog) => void;
|
|
15
|
+
onError?: (ctx: XrayContext, err: unknown) => void;
|
|
16
|
+
}
|
|
17
|
+
declare function wrapHttpHandler(handler: NodeHttpHandler, xray: XrayEmitter, options?: WrapOptions): NodeHttpHandler;
|
|
18
|
+
declare function getXrayContext(req: IncomingMessage): XrayContext | undefined;
|
|
19
|
+
|
|
20
|
+
export { type NodeHttpHandler, type WrapOptions, createEmitter, getXrayContext, wrapHttpHandler };
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { j as XrayRuntimeConfig, a as XrayEmitter, e as CaptureConfig, f as RedactionConfig, d as XrayContext, R as RequestLog } from './types-Z1nirh-F.js';
|
|
2
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
import '@opentelemetry/sdk-trace-base';
|
|
4
|
+
|
|
5
|
+
declare function createEmitter(config: XrayRuntimeConfig): XrayEmitter;
|
|
6
|
+
|
|
7
|
+
type NodeHttpHandler = (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
|
|
8
|
+
interface WrapOptions {
|
|
9
|
+
route?: string;
|
|
10
|
+
requestId?: string;
|
|
11
|
+
capture?: Partial<CaptureConfig>;
|
|
12
|
+
redaction?: Partial<RedactionConfig>;
|
|
13
|
+
onRequest?: (ctx: XrayContext) => void;
|
|
14
|
+
onResponse?: (ctx: XrayContext, log: RequestLog) => void;
|
|
15
|
+
onError?: (ctx: XrayContext, err: unknown) => void;
|
|
16
|
+
}
|
|
17
|
+
declare function wrapHttpHandler(handler: NodeHttpHandler, xray: XrayEmitter, options?: WrapOptions): NodeHttpHandler;
|
|
18
|
+
declare function getXrayContext(req: IncomingMessage): XrayContext | undefined;
|
|
19
|
+
|
|
20
|
+
export { type NodeHttpHandler, type WrapOptions, createEmitter, getXrayContext, wrapHttpHandler };
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createEmitter,
|
|
3
|
+
getXrayContext,
|
|
4
|
+
wrapHttpHandler
|
|
5
|
+
} from "./chunk-VGRLHYDA.js";
|
|
6
|
+
import "./chunk-2NR6RZEP.js";
|
|
7
|
+
import "./chunk-6UH43LVD.js";
|
|
8
|
+
import "./chunk-YVMMCTXW.js";
|
|
9
|
+
export {
|
|
10
|
+
createEmitter,
|
|
11
|
+
getXrayContext,
|
|
12
|
+
wrapHttpHandler
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/remix.cjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkAHXNYJ5Acjs = require('./chunk-AHXNYJ5A.cjs');
|
|
6
|
+
require('./chunk-3MVVO5I7.cjs');
|
|
7
|
+
require('./chunk-GNSXLLEC.cjs');
|
|
8
|
+
require('./chunk-JKW6E4L3.cjs');
|
|
9
|
+
|
|
10
|
+
// src/remix/remix.ts
|
|
11
|
+
function createEmitter2(config, options) {
|
|
12
|
+
const emitter = _chunkAHXNYJ5Acjs.createEmitter.call(void 0, config);
|
|
13
|
+
const wrap = ((handler) => wrapRemixRequestHandler(handler, emitter, options));
|
|
14
|
+
wrap.flush = emitter.flush;
|
|
15
|
+
wrap.shutdown = emitter.shutdown;
|
|
16
|
+
return wrap;
|
|
17
|
+
}
|
|
18
|
+
function wrapRemixRequestHandler(handler, xray, options) {
|
|
19
|
+
return (request, loadContext) => {
|
|
20
|
+
const wrapped = _chunkAHXNYJ5Acjs.wrapFetchPreserve.call(void 0, (req) => handler(req, loadContext), xray, options);
|
|
21
|
+
return wrapped(request);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
exports.createCoreEmitter = _chunkAHXNYJ5Acjs.createEmitter; exports.createEmitter = createEmitter2; exports.getXrayContext = _chunkAHXNYJ5Acjs.getXrayContext; exports.wrapRemixRequestHandler = wrapRemixRequestHandler;
|
|
30
|
+
//# sourceMappingURL=remix.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/xray-emitter-js/xray-emitter-js/dist/remix.cjs","../src/remix/remix.ts"],"names":["createEmitter"],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACoBO,SAASA,cAAAA,CAAc,MAAA,EAA2B,OAAA,EAAqC;AAC5F,EAAA,MAAM,QAAA,EAAU,6CAAA,MAAyB,CAAA;AACzC,EAAA,MAAM,KAAA,EAAA,CAAQ,CAAC,OAAA,EAAA,GACb,uBAAA,CAAwB,OAAA,EAAS,OAAA,EAAS,OAAO,CAAA,CAAA;AACnD,EAAA,IAAA,CAAK,MAAA,EAAQ,OAAA,CAAQ,KAAA;AACrB,EAAA,IAAA,CAAK,SAAA,EAAW,OAAA,CAAQ,QAAA;AACxB,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,uBAAA,CACd,OAAA,EACA,IAAA,EACA,OAAA,EACgB;AAChB,EAAA,OAAO,CAAC,OAAA,EAAS,WAAA,EAAA,GAAgB;AAC/B,IAAA,MAAM,QAAA,EAAU,iDAAA,CAAmB,GAAA,EAAA,GAAiB,OAAA,CAAQ,GAAA,EAAK,WAAW,CAAA,EAAG,IAAA,EAAM,OAAO,CAAA;AAC5F,IAAA,OAAO,OAAA,CAAQ,OAAO,CAAA;AAAA,EACxB,CAAA;AACF;ADxBA;AACE;AACA;AACA;AACA;AACF,0NAAC","file":"/home/runner/work/xray-emitter-js/xray-emitter-js/dist/remix.cjs","sourcesContent":[null,"import type { XrayEmitter, XrayRuntimeConfig } from '../core/index';\nimport {\n createEmitter as createFetchEmitter,\n getXrayContext,\n wrapFetchPreserve,\n type WrapOptions,\n} from '../fetch/fetch';\n\nexport { createFetchEmitter as createCoreEmitter };\nexport type {\n CaptureConfig,\n RedactionConfig,\n RequestLog,\n XrayConfig,\n XrayContext,\n XrayEmitter,\n XrayRuntimeConfig,\n} from '../core/index';\nexport type { WrapOptions } from '../fetch/fetch';\nexport { getXrayContext };\n\n// copy type from react-router to avoid a package dependency\ntype RequestHandler = (request: Request, loadContext?: unknown) => Response | Promise<Response>;\n\ntype RemixEmitter = ((handler: RequestHandler) => RequestHandler) & {\n flush: XrayEmitter['flush'];\n shutdown: XrayEmitter['shutdown'];\n};\n\nexport function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): RemixEmitter {\n const emitter = createFetchEmitter(config);\n const wrap = ((handler: RequestHandler) =>\n wrapRemixRequestHandler(handler, emitter, options)) as RemixEmitter;\n wrap.flush = emitter.flush;\n wrap.shutdown = emitter.shutdown;\n return wrap;\n}\n\nexport function wrapRemixRequestHandler(\n handler: RequestHandler,\n xray: XrayEmitter,\n options?: WrapOptions,\n): RequestHandler {\n return (request, loadContext) => {\n const wrapped = wrapFetchPreserve((req: Request) => handler(req, loadContext), xray, options);\n return wrapped(request);\n };\n}\n"]}
|
package/dist/remix.d.cts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { j as XrayRuntimeConfig, a as XrayEmitter } from './types-Z1nirh-F.cjs';
|
|
2
|
+
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig, d as XrayContext } from './types-Z1nirh-F.cjs';
|
|
3
|
+
import { WrapOptions } from './fetch.cjs';
|
|
4
|
+
export { createEmitter as createCoreEmitter, getXrayContext } from './fetch.cjs';
|
|
5
|
+
import '@opentelemetry/sdk-trace-base';
|
|
6
|
+
|
|
7
|
+
type RequestHandler = (request: Request, loadContext?: unknown) => Response | Promise<Response>;
|
|
8
|
+
type RemixEmitter = ((handler: RequestHandler) => RequestHandler) & {
|
|
9
|
+
flush: XrayEmitter['flush'];
|
|
10
|
+
shutdown: XrayEmitter['shutdown'];
|
|
11
|
+
};
|
|
12
|
+
declare function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): RemixEmitter;
|
|
13
|
+
declare function wrapRemixRequestHandler(handler: RequestHandler, xray: XrayEmitter, options?: WrapOptions): RequestHandler;
|
|
14
|
+
|
|
15
|
+
export { WrapOptions, XrayEmitter, XrayRuntimeConfig, createEmitter, wrapRemixRequestHandler };
|
package/dist/remix.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { j as XrayRuntimeConfig, a as XrayEmitter } from './types-Z1nirh-F.js';
|
|
2
|
+
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig, d as XrayContext } from './types-Z1nirh-F.js';
|
|
3
|
+
import { WrapOptions } from './fetch.js';
|
|
4
|
+
export { createEmitter as createCoreEmitter, getXrayContext } from './fetch.js';
|
|
5
|
+
import '@opentelemetry/sdk-trace-base';
|
|
6
|
+
|
|
7
|
+
type RequestHandler = (request: Request, loadContext?: unknown) => Response | Promise<Response>;
|
|
8
|
+
type RemixEmitter = ((handler: RequestHandler) => RequestHandler) & {
|
|
9
|
+
flush: XrayEmitter['flush'];
|
|
10
|
+
shutdown: XrayEmitter['shutdown'];
|
|
11
|
+
};
|
|
12
|
+
declare function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): RemixEmitter;
|
|
13
|
+
declare function wrapRemixRequestHandler(handler: RequestHandler, xray: XrayEmitter, options?: WrapOptions): RequestHandler;
|
|
14
|
+
|
|
15
|
+
export { WrapOptions, XrayEmitter, XrayRuntimeConfig, createEmitter, wrapRemixRequestHandler };
|
package/dist/remix.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createEmitter,
|
|
3
|
+
getXrayContext,
|
|
4
|
+
wrapFetchPreserve
|
|
5
|
+
} from "./chunk-MPQTI5AX.js";
|
|
6
|
+
import "./chunk-2NR6RZEP.js";
|
|
7
|
+
import "./chunk-6UH43LVD.js";
|
|
8
|
+
import "./chunk-YVMMCTXW.js";
|
|
9
|
+
|
|
10
|
+
// src/remix/remix.ts
|
|
11
|
+
function createEmitter2(config, options) {
|
|
12
|
+
const emitter = createEmitter(config);
|
|
13
|
+
const wrap = ((handler) => wrapRemixRequestHandler(handler, emitter, options));
|
|
14
|
+
wrap.flush = emitter.flush;
|
|
15
|
+
wrap.shutdown = emitter.shutdown;
|
|
16
|
+
return wrap;
|
|
17
|
+
}
|
|
18
|
+
function wrapRemixRequestHandler(handler, xray, options) {
|
|
19
|
+
return (request, loadContext) => {
|
|
20
|
+
const wrapped = wrapFetchPreserve((req) => handler(req, loadContext), xray, options);
|
|
21
|
+
return wrapped(request);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
createEmitter as createCoreEmitter,
|
|
26
|
+
createEmitter2 as createEmitter,
|
|
27
|
+
getXrayContext,
|
|
28
|
+
wrapRemixRequestHandler
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=remix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/remix/remix.ts"],"sourcesContent":["import type { XrayEmitter, XrayRuntimeConfig } from '../core/index';\nimport {\n createEmitter as createFetchEmitter,\n getXrayContext,\n wrapFetchPreserve,\n type WrapOptions,\n} from '../fetch/fetch';\n\nexport { createFetchEmitter as createCoreEmitter };\nexport type {\n CaptureConfig,\n RedactionConfig,\n RequestLog,\n XrayConfig,\n XrayContext,\n XrayEmitter,\n XrayRuntimeConfig,\n} from '../core/index';\nexport type { WrapOptions } from '../fetch/fetch';\nexport { getXrayContext };\n\n// copy type from react-router to avoid a package dependency\ntype RequestHandler = (request: Request, loadContext?: unknown) => Response | Promise<Response>;\n\ntype RemixEmitter = ((handler: RequestHandler) => RequestHandler) & {\n flush: XrayEmitter['flush'];\n shutdown: XrayEmitter['shutdown'];\n};\n\nexport function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): RemixEmitter {\n const emitter = createFetchEmitter(config);\n const wrap = ((handler: RequestHandler) =>\n wrapRemixRequestHandler(handler, emitter, options)) as RemixEmitter;\n wrap.flush = emitter.flush;\n wrap.shutdown = emitter.shutdown;\n return wrap;\n}\n\nexport function wrapRemixRequestHandler(\n handler: RequestHandler,\n xray: XrayEmitter,\n options?: WrapOptions,\n): RequestHandler {\n return (request, loadContext) => {\n const wrapped = wrapFetchPreserve((req: Request) => handler(req, loadContext), xray, options);\n return wrapped(request);\n };\n}\n"],"mappings":";;;;;;;;;;AA6BO,SAASA,eAAc,QAA2B,SAAqC;AAC5F,QAAM,UAAU,cAAmB,MAAM;AACzC,QAAM,QAAQ,CAAC,YACb,wBAAwB,SAAS,SAAS,OAAO;AACnD,OAAK,QAAQ,QAAQ;AACrB,OAAK,WAAW,QAAQ;AACxB,SAAO;AACT;AAEO,SAAS,wBACd,SACA,MACA,SACgB;AAChB,SAAO,CAAC,SAAS,gBAAgB;AAC/B,UAAM,UAAU,kBAAkB,CAAC,QAAiB,QAAQ,KAAK,WAAW,GAAG,MAAM,OAAO;AAC5F,WAAO,QAAQ,OAAO;AAAA,EACxB;AACF;","names":["createEmitter"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import * as _opentelemetry_sdk_trace_base from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
|
|
3
|
+
interface ExporterConfig {
|
|
4
|
+
endpointUrl: string;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
timeoutMs: number;
|
|
7
|
+
spanProcessor: 'simple' | 'batch';
|
|
8
|
+
}
|
|
9
|
+
interface CaptureConfig {
|
|
10
|
+
requestHeaders: boolean;
|
|
11
|
+
responseHeaders: boolean;
|
|
12
|
+
requestBody: 'none' | 'text' | 'base64';
|
|
13
|
+
responseBody: 'none' | 'text' | 'base64';
|
|
14
|
+
maxBodyBytes: number;
|
|
15
|
+
}
|
|
16
|
+
interface RedactionConfig {
|
|
17
|
+
headers: string[];
|
|
18
|
+
queryParams: string[];
|
|
19
|
+
bodyJsonPaths: string[];
|
|
20
|
+
replacement: string;
|
|
21
|
+
}
|
|
22
|
+
interface RequestIdConfig {
|
|
23
|
+
/**
|
|
24
|
+
* Response header name to read request IDs from. This is normalized to
|
|
25
|
+
* lowercase during configuration.
|
|
26
|
+
*/
|
|
27
|
+
header: string;
|
|
28
|
+
}
|
|
29
|
+
interface RouteConfig {
|
|
30
|
+
normalize: boolean;
|
|
31
|
+
normalizer?: (path: string) => string;
|
|
32
|
+
}
|
|
33
|
+
interface XrayConfig {
|
|
34
|
+
serviceName: string;
|
|
35
|
+
environment?: string;
|
|
36
|
+
version?: string;
|
|
37
|
+
logger?: Logger;
|
|
38
|
+
logLevel?: LogLevel;
|
|
39
|
+
endpointUrl?: string;
|
|
40
|
+
exporter?: Partial<ExporterConfig>;
|
|
41
|
+
capture?: Partial<CaptureConfig>;
|
|
42
|
+
redaction?: Partial<RedactionConfig>;
|
|
43
|
+
/**
|
|
44
|
+
* Request ID resolution settings. The header is read from response headers at
|
|
45
|
+
* the end of the request.
|
|
46
|
+
*/
|
|
47
|
+
requestId?: Partial<RequestIdConfig>;
|
|
48
|
+
route?: Partial<RouteConfig>;
|
|
49
|
+
}
|
|
50
|
+
type XrayRuntimeConfig = Omit<XrayConfig, 'exporter'> & {
|
|
51
|
+
exporter?: Partial<ExporterConfig> & {
|
|
52
|
+
instance?: _opentelemetry_sdk_trace_base.SpanExporter;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
interface ResolvedXrayConfig {
|
|
56
|
+
serviceName: string;
|
|
57
|
+
environment?: string;
|
|
58
|
+
version?: string;
|
|
59
|
+
logger: Logger;
|
|
60
|
+
logLevel: LogLevel;
|
|
61
|
+
exporter: ExporterConfig;
|
|
62
|
+
capture: CaptureConfig;
|
|
63
|
+
redaction: RedactionConfig;
|
|
64
|
+
requestId: RequestIdConfig;
|
|
65
|
+
route: RouteConfig;
|
|
66
|
+
}
|
|
67
|
+
declare class XrayConfigError extends Error {
|
|
68
|
+
code: 'INVALID_CONFIG' | 'INVALID_REDACTION';
|
|
69
|
+
constructor(code: XrayConfigError['code'], message: string);
|
|
70
|
+
}
|
|
71
|
+
declare function normalizeConfig(config: XrayConfig): ResolvedXrayConfig;
|
|
72
|
+
|
|
73
|
+
type AttributeValue = string | number | boolean | string[] | number[] | boolean[];
|
|
74
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
75
|
+
interface Logger {
|
|
76
|
+
debug(msg: string, fields?: Record<string, unknown>): void;
|
|
77
|
+
info(msg: string, fields?: Record<string, unknown>): void;
|
|
78
|
+
warn(msg: string, fields?: Record<string, unknown>): void;
|
|
79
|
+
error(msg: string, fields?: Record<string, unknown>): void;
|
|
80
|
+
}
|
|
81
|
+
interface CapturedBody {
|
|
82
|
+
bytes: number;
|
|
83
|
+
encoding: 'utf8' | 'base64';
|
|
84
|
+
truncated: boolean;
|
|
85
|
+
value?: string;
|
|
86
|
+
}
|
|
87
|
+
interface RequestLog {
|
|
88
|
+
requestId: string;
|
|
89
|
+
traceId?: string;
|
|
90
|
+
spanId?: string;
|
|
91
|
+
serviceName: string;
|
|
92
|
+
method: string;
|
|
93
|
+
url: string;
|
|
94
|
+
route?: string;
|
|
95
|
+
statusCode?: number;
|
|
96
|
+
durationMs: number;
|
|
97
|
+
requestHeaders?: Record<string, string | string[]>;
|
|
98
|
+
responseHeaders?: Record<string, string | string[]>;
|
|
99
|
+
requestBody?: CapturedBody;
|
|
100
|
+
responseBody?: CapturedBody;
|
|
101
|
+
userId?: string;
|
|
102
|
+
sessionId?: string;
|
|
103
|
+
error?: {
|
|
104
|
+
message: string;
|
|
105
|
+
type?: string;
|
|
106
|
+
stack?: string;
|
|
107
|
+
};
|
|
108
|
+
attributes?: Record<string, AttributeValue>;
|
|
109
|
+
timestamp: string;
|
|
110
|
+
}
|
|
111
|
+
interface XrayContext {
|
|
112
|
+
requestId: string;
|
|
113
|
+
traceId?: string;
|
|
114
|
+
spanId?: string;
|
|
115
|
+
setUserId(id: string): void;
|
|
116
|
+
setSessionId(id: string): void;
|
|
117
|
+
setAttribute(key: string, value: AttributeValue): void;
|
|
118
|
+
addEvent(name: string, attributes?: Record<string, AttributeValue>): void;
|
|
119
|
+
setError(err: unknown): void;
|
|
120
|
+
}
|
|
121
|
+
interface NormalizedRequest {
|
|
122
|
+
method: string;
|
|
123
|
+
url: string;
|
|
124
|
+
route?: string;
|
|
125
|
+
headers: Record<string, string | string[]>;
|
|
126
|
+
body?: CapturedBody;
|
|
127
|
+
/**
|
|
128
|
+
* Optional explicit request ID. If omitted, X-ray reads from response headers
|
|
129
|
+
* when the span is closed (and generates a UUIDv7 if none is present).
|
|
130
|
+
*/
|
|
131
|
+
requestId?: string;
|
|
132
|
+
remoteAddress?: string;
|
|
133
|
+
startTimeMs: number;
|
|
134
|
+
}
|
|
135
|
+
interface NormalizedResponse {
|
|
136
|
+
statusCode?: number;
|
|
137
|
+
headers?: Record<string, string | string[]>;
|
|
138
|
+
body?: CapturedBody;
|
|
139
|
+
endTimeMs: number;
|
|
140
|
+
}
|
|
141
|
+
interface XrayEmitter {
|
|
142
|
+
config: ResolvedXrayConfig;
|
|
143
|
+
startRequest(req: NormalizedRequest): XrayContext;
|
|
144
|
+
endRequest(ctx: XrayContext, res: NormalizedResponse, err?: unknown): RequestLog;
|
|
145
|
+
flush(): Promise<void>;
|
|
146
|
+
shutdown(): Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export { type AttributeValue as A, type CapturedBody as C, type ExporterConfig as E, type LogLevel as L, type NormalizedRequest as N, type RequestLog as R, type XrayConfig as X, type XrayEmitter as a, type Logger as b, type NormalizedResponse as c, type XrayContext as d, type CaptureConfig as e, type RedactionConfig as f, type RequestIdConfig as g, type ResolvedXrayConfig as h, type RouteConfig as i, type XrayRuntimeConfig as j, XrayConfigError as k, normalizeConfig as n };
|