@stainlessdev/xray-emitter 0.2.0 → 0.3.0
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 +1 -2
- package/dist/{chunk-2HW4AEKB.cjs → chunk-55YD27PV.cjs} +28 -28
- package/dist/chunk-55YD27PV.cjs.map +1 -0
- package/dist/{chunk-YVMMCTXW.js → chunk-7KT6EPVZ.js} +1 -1
- package/dist/{chunk-YVMMCTXW.js.map → chunk-7KT6EPVZ.js.map} +1 -1
- package/dist/{chunk-GNSXLLEC.cjs → chunk-CPHFCOA5.cjs} +9 -9
- package/dist/{chunk-GNSXLLEC.cjs.map → chunk-CPHFCOA5.cjs.map} +1 -1
- package/dist/{chunk-JKW6E4L3.cjs → chunk-DNBARLGB.cjs} +1 -1
- package/dist/{chunk-JKW6E4L3.cjs.map → chunk-DNBARLGB.cjs.map} +1 -1
- package/dist/{chunk-ZP5OEA4I.js → chunk-DV3MVQBB.js} +4 -4
- package/dist/chunk-DV3MVQBB.js.map +1 -0
- package/dist/{chunk-WTHVUHGI.js → chunk-FGXXKIF7.js} +4 -4
- package/dist/chunk-FGXXKIF7.js.map +1 -0
- package/dist/{chunk-TSCMZ5TV.js → chunk-GYXI3DWB.js} +35 -3
- package/dist/chunk-GYXI3DWB.js.map +1 -0
- package/dist/{chunk-6UH43LVD.js → chunk-NTIUR3OC.js} +2 -2
- package/dist/{chunk-DBI3HXNR.cjs → chunk-SUVCVINA.cjs} +47 -47
- package/dist/chunk-SUVCVINA.cjs.map +1 -0
- package/dist/{chunk-XO6YWDFL.cjs → chunk-UJWD5CFA.cjs} +53 -21
- package/dist/chunk-UJWD5CFA.cjs.map +1 -0
- package/dist/effect.cjs +19 -19
- package/dist/effect.cjs.map +1 -1
- package/dist/effect.d.cts +30 -3
- package/dist/effect.d.ts +30 -3
- package/dist/effect.js +4 -4
- package/dist/effect.js.map +1 -1
- package/dist/emitter-Bi_m_w5h.d.cts +10 -0
- package/dist/emitter-Dy7bRGTq.d.ts +10 -0
- package/dist/express.cjs +7 -7
- package/dist/express.cjs.map +1 -1
- package/dist/express.d.cts +9 -2
- package/dist/express.d.ts +9 -2
- package/dist/express.js +4 -4
- package/dist/express.js.map +1 -1
- package/dist/fastify.cjs +10 -10
- package/dist/fastify.cjs.map +1 -1
- package/dist/fastify.d.cts +9 -2
- package/dist/fastify.d.ts +9 -2
- package/dist/fastify.js +4 -4
- package/dist/fastify.js.map +1 -1
- package/dist/fetch.cjs +5 -5
- package/dist/fetch.d.cts +39 -2
- package/dist/fetch.d.ts +39 -2
- package/dist/fetch.js +4 -4
- package/dist/hono.cjs +9 -9
- package/dist/hono.cjs.map +1 -1
- package/dist/hono.d.cts +15 -3
- package/dist/hono.d.ts +15 -3
- package/dist/hono.js +4 -4
- package/dist/hono.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +2 -2
- package/dist/internal.cjs +3 -3
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +2 -2
- package/dist/next.cjs +7 -7
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +9 -3
- package/dist/next.d.ts +9 -3
- package/dist/next.js +4 -4
- package/dist/next.js.map +1 -1
- package/dist/node.cjs +5 -5
- package/dist/node.d.cts +42 -1
- package/dist/node.d.ts +42 -1
- package/dist/node.js +4 -4
- package/dist/remix.cjs +7 -7
- package/dist/remix.cjs.map +1 -1
- package/dist/remix.d.cts +10 -3
- package/dist/remix.d.ts +10 -3
- package/dist/remix.js +4 -4
- package/dist/remix.js.map +1 -1
- package/dist/types-BrKvhHbn.d.cts +446 -0
- package/dist/types-BrKvhHbn.d.ts +446 -0
- package/package.json +1 -1
- package/dist/chunk-2HW4AEKB.cjs.map +0 -1
- package/dist/chunk-DBI3HXNR.cjs.map +0 -1
- package/dist/chunk-TSCMZ5TV.js.map +0 -1
- package/dist/chunk-WTHVUHGI.js.map +0 -1
- package/dist/chunk-XO6YWDFL.cjs.map +0 -1
- package/dist/chunk-ZP5OEA4I.js.map +0 -1
- package/dist/emitter-BqfrGIod.d.cts +0 -5
- package/dist/emitter-CScYhwGA.d.ts +0 -5
- package/dist/types-Z1nirh-F.d.cts +0 -149
- package/dist/types-Z1nirh-F.d.ts +0 -149
- /package/dist/{chunk-6UH43LVD.js.map → chunk-NTIUR3OC.js.map} +0 -0
package/dist/fetch.cjs
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
6
|
+
var _chunkSUVCVINAcjs = require('./chunk-SUVCVINA.cjs');
|
|
7
|
+
require('./chunk-UJWD5CFA.cjs');
|
|
8
|
+
require('./chunk-CPHFCOA5.cjs');
|
|
9
|
+
require('./chunk-DNBARLGB.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
exports.createEmitter =
|
|
15
|
+
exports.createEmitter = _chunkSUVCVINAcjs.createEmitter; exports.getXrayContext = _chunkSUVCVINAcjs.getXrayContext; exports.wrapFetch = _chunkSUVCVINAcjs.wrapFetch; exports.wrapFetchPreserve = _chunkSUVCVINAcjs.wrapFetchPreserve;
|
|
16
16
|
//# sourceMappingURL=fetch.cjs.map
|
package/dist/fetch.d.cts
CHANGED
|
@@ -1,18 +1,55 @@
|
|
|
1
|
-
export { c as createEmitter } from './emitter-
|
|
2
|
-
import { a as XrayEmitter, e as CaptureConfig, f as RedactionConfig, d as XrayContext, R as RequestLog } from './types-
|
|
1
|
+
export { c as createEmitter } from './emitter-Bi_m_w5h.cjs';
|
|
2
|
+
import { a as XrayEmitter, e as CaptureConfig, f as RedactionConfig, d as XrayContext, R as RequestLog } from './types-BrKvhHbn.cjs';
|
|
3
3
|
import '@opentelemetry/sdk-trace-base';
|
|
4
4
|
|
|
5
5
|
interface WrapOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Explicit route pattern for this handler (for example `/users/:id`).
|
|
8
|
+
*/
|
|
6
9
|
route?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Explicit request ID. Skips header lookup/generation when provided.
|
|
12
|
+
*/
|
|
7
13
|
requestId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Per-handler capture overrides.
|
|
16
|
+
*/
|
|
8
17
|
capture?: Partial<CaptureConfig>;
|
|
18
|
+
/**
|
|
19
|
+
* Per-handler redaction overrides.
|
|
20
|
+
*/
|
|
9
21
|
redaction?: Partial<RedactionConfig>;
|
|
22
|
+
/**
|
|
23
|
+
* Hook called after request context is created.
|
|
24
|
+
*/
|
|
10
25
|
onRequest?: (ctx: XrayContext) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Hook called after the request has been finalized and logged.
|
|
28
|
+
*/
|
|
11
29
|
onResponse?: (ctx: XrayContext, log: RequestLog) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Hook called when request handling fails.
|
|
32
|
+
*/
|
|
12
33
|
onError?: (ctx: XrayContext, err: unknown) => void;
|
|
13
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Wrap a fetch-style handler with X-ray instrumentation.
|
|
37
|
+
*
|
|
38
|
+
* This variant may replace the request/response objects to safely capture
|
|
39
|
+
* bodies and inject a request ID response header when needed.
|
|
40
|
+
*/
|
|
14
41
|
declare function wrapFetch(handler: (req: Request) => Response | Promise<Response>, xray: XrayEmitter, options?: WrapOptions): (req: Request) => Promise<Response>;
|
|
42
|
+
/**
|
|
43
|
+
* Wrap a fetch-style handler while preserving original request/response objects
|
|
44
|
+
* whenever possible.
|
|
45
|
+
*
|
|
46
|
+
* If a missing request ID header must be injected and response headers are
|
|
47
|
+
* immutable, this wrapper may still replace the response object.
|
|
48
|
+
*/
|
|
15
49
|
declare function wrapFetchPreserve(handler: (req: Request) => Response | Promise<Response>, xray: XrayEmitter, options?: WrapOptions): (req: Request) => Promise<Response>;
|
|
50
|
+
/**
|
|
51
|
+
* Retrieve the `XrayContext` bound to a fetch `Request`.
|
|
52
|
+
*/
|
|
16
53
|
declare function getXrayContext(req: Request): XrayContext | undefined;
|
|
17
54
|
|
|
18
55
|
export { type WrapOptions, getXrayContext, wrapFetch, wrapFetchPreserve };
|
package/dist/fetch.d.ts
CHANGED
|
@@ -1,18 +1,55 @@
|
|
|
1
|
-
export { c as createEmitter } from './emitter-
|
|
2
|
-
import { a as XrayEmitter, e as CaptureConfig, f as RedactionConfig, d as XrayContext, R as RequestLog } from './types-
|
|
1
|
+
export { c as createEmitter } from './emitter-Dy7bRGTq.js';
|
|
2
|
+
import { a as XrayEmitter, e as CaptureConfig, f as RedactionConfig, d as XrayContext, R as RequestLog } from './types-BrKvhHbn.js';
|
|
3
3
|
import '@opentelemetry/sdk-trace-base';
|
|
4
4
|
|
|
5
5
|
interface WrapOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Explicit route pattern for this handler (for example `/users/:id`).
|
|
8
|
+
*/
|
|
6
9
|
route?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Explicit request ID. Skips header lookup/generation when provided.
|
|
12
|
+
*/
|
|
7
13
|
requestId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Per-handler capture overrides.
|
|
16
|
+
*/
|
|
8
17
|
capture?: Partial<CaptureConfig>;
|
|
18
|
+
/**
|
|
19
|
+
* Per-handler redaction overrides.
|
|
20
|
+
*/
|
|
9
21
|
redaction?: Partial<RedactionConfig>;
|
|
22
|
+
/**
|
|
23
|
+
* Hook called after request context is created.
|
|
24
|
+
*/
|
|
10
25
|
onRequest?: (ctx: XrayContext) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Hook called after the request has been finalized and logged.
|
|
28
|
+
*/
|
|
11
29
|
onResponse?: (ctx: XrayContext, log: RequestLog) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Hook called when request handling fails.
|
|
32
|
+
*/
|
|
12
33
|
onError?: (ctx: XrayContext, err: unknown) => void;
|
|
13
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Wrap a fetch-style handler with X-ray instrumentation.
|
|
37
|
+
*
|
|
38
|
+
* This variant may replace the request/response objects to safely capture
|
|
39
|
+
* bodies and inject a request ID response header when needed.
|
|
40
|
+
*/
|
|
14
41
|
declare function wrapFetch(handler: (req: Request) => Response | Promise<Response>, xray: XrayEmitter, options?: WrapOptions): (req: Request) => Promise<Response>;
|
|
42
|
+
/**
|
|
43
|
+
* Wrap a fetch-style handler while preserving original request/response objects
|
|
44
|
+
* whenever possible.
|
|
45
|
+
*
|
|
46
|
+
* If a missing request ID header must be injected and response headers are
|
|
47
|
+
* immutable, this wrapper may still replace the response object.
|
|
48
|
+
*/
|
|
15
49
|
declare function wrapFetchPreserve(handler: (req: Request) => Response | Promise<Response>, xray: XrayEmitter, options?: WrapOptions): (req: Request) => Promise<Response>;
|
|
50
|
+
/**
|
|
51
|
+
* Retrieve the `XrayContext` bound to a fetch `Request`.
|
|
52
|
+
*/
|
|
16
53
|
declare function getXrayContext(req: Request): XrayContext | undefined;
|
|
17
54
|
|
|
18
55
|
export { type WrapOptions, getXrayContext, wrapFetch, wrapFetchPreserve };
|
package/dist/fetch.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
getXrayContext,
|
|
4
4
|
wrapFetch,
|
|
5
5
|
wrapFetchPreserve
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-DV3MVQBB.js";
|
|
7
|
+
import "./chunk-GYXI3DWB.js";
|
|
8
|
+
import "./chunk-NTIUR3OC.js";
|
|
9
|
+
import "./chunk-7KT6EPVZ.js";
|
|
10
10
|
export {
|
|
11
11
|
createEmitter,
|
|
12
12
|
getXrayContext,
|
package/dist/hono.cjs
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkSUVCVINAcjs = require('./chunk-SUVCVINA.cjs');
|
|
6
|
+
require('./chunk-UJWD5CFA.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('./chunk-
|
|
9
|
+
var _chunkCPHFCOA5cjs = require('./chunk-CPHFCOA5.cjs');
|
|
10
|
+
require('./chunk-DNBARLGB.cjs');
|
|
11
11
|
|
|
12
12
|
// src/hono/hono.ts
|
|
13
13
|
function createEmitter2(config, options) {
|
|
14
|
-
const emitter =
|
|
14
|
+
const emitter = _chunkSUVCVINAcjs.createEmitter.call(void 0, config);
|
|
15
15
|
const middleware = createHonoMiddleware(emitter, options);
|
|
16
16
|
middleware.flush = emitter.flush;
|
|
17
17
|
middleware.shutdown = emitter.shutdown;
|
|
@@ -25,9 +25,9 @@ function createHonoMiddleware(xray, options) {
|
|
|
25
25
|
await next();
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
const wrapped =
|
|
28
|
+
const wrapped = _chunkSUVCVINAcjs.wrapFetchPreserve.call(void 0,
|
|
29
29
|
async (req) => {
|
|
30
|
-
const ctx =
|
|
30
|
+
const ctx = _chunkSUVCVINAcjs.getXrayContext.call(void 0, req);
|
|
31
31
|
if (ctx) {
|
|
32
32
|
c.set("xray", ctx);
|
|
33
33
|
}
|
|
@@ -40,7 +40,7 @@ function createHonoMiddleware(xray, options) {
|
|
|
40
40
|
route = resolveRoutePath(routePathFn, c);
|
|
41
41
|
}
|
|
42
42
|
if (route && ctx) {
|
|
43
|
-
|
|
43
|
+
_chunkCPHFCOA5cjs.setContextRoute.call(void 0, ctx, route);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
},
|
|
@@ -67,5 +67,5 @@ function resolveRoutePath(fn, ctx, index) {
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
exports.createCoreEmitter =
|
|
70
|
+
exports.createCoreEmitter = _chunkSUVCVINAcjs.createEmitter; exports.createEmitter = createEmitter2; exports.createHonoMiddleware = createHonoMiddleware;
|
|
71
71
|
//# sourceMappingURL=hono.cjs.map
|
package/dist/hono.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/xray-emitter-js/xray-emitter-js/dist/hono.cjs","../src/hono/hono.ts"],"names":["createEmitter"],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/xray-emitter-js/xray-emitter-js/dist/hono.cjs","../src/hono/hono.ts"],"names":["createEmitter"],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACA;AC4CO,SAASA,cAAAA,CAAc,MAAA,EAA2B,OAAA,EAAwC;AAC/F,EAAA,MAAM,QAAA,EAAU,6CAAA,MAAyB,CAAA;AACzC,EAAA,MAAM,WAAA,EAAa,oBAAA,CAAqB,OAAA,EAAS,OAAO,CAAA;AACxD,EAAA,UAAA,CAAW,MAAA,EAAQ,OAAA,CAAQ,KAAA;AAC3B,EAAA,UAAA,CAAW,SAAA,EAAW,OAAA,CAAQ,QAAA;AAC9B,EAAA,OAAO,UAAA;AACT;AAKO,SAAS,oBAAA,CAAqB,IAAA,EAAmB,OAAA,EAA2C;AACjG,EAAA,MAAM,YAAA,kBAAc,OAAA,2BAAS,WAAA;AAE7B,EAAA,OAAO,MAAA,CAAO,CAAA,EAAG,IAAA,EAAA,GAAS;AACxB,IAAA,MAAM,QAAA,EAAU,CAAA,CAAE,GAAA,CAAI,GAAA;AACtB,IAAA,GAAA,CAAI,CAAC,OAAA,EAAS;AACZ,MAAA,MAAM,IAAA,CAAK,CAAA;AACX,MAAA,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,QAAA,EAAU,iDAAA;AAAA,MACd,MAAA,CAAO,GAAA,EAAA,GAAQ;AACb,QAAA,MAAM,IAAA,EAAM,8CAAA,GAAkB,CAAA;AAC9B,QAAA,GAAA,CAAI,GAAA,EAAK;AACP,UAAA,CAAA,CAAE,GAAA,CAAI,MAAA,EAAQ,GAAG,CAAA;AAAA,QACnB;AAEA,QAAA,IAAI,MAAA,EAAQ,gBAAA,CAAiB,WAAA,EAAa,CAAA,EAAG,CAAA,CAAE,CAAA;AAC/C,QAAA,IAAI;AACF,UAAA,MAAM,IAAA,CAAK,CAAA;AACX,UAAA,OAAO,CAAA,CAAE,GAAA;AAAA,QACX,EAAA,QAAE;AACA,UAAA,GAAA,CAAI,CAAC,KAAA,EAAO;AACV,YAAA,MAAA,EAAQ,gBAAA,CAAiB,WAAA,EAAa,CAAC,CAAA;AAAA,UACzC;AACA,UAAA,GAAA,CAAI,MAAA,GAAS,GAAA,EAAK;AAChB,YAAA,+CAAA,GAAgB,EAAK,KAAK,CAAA;AAAA,UAC5B;AAAA,QACF;AAAA,MACF,CAAA;AAAA,MACA,IAAA;AAAA,MACA;AAAA,IACF,CAAA;AAEA,IAAA,MAAM,SAAA,EAAW,MAAM,OAAA,CAAQ,OAAO,CAAA;AACtC,IAAA,GAAA,CAAI,SAAA,WAAoB,SAAA,GAAY,SAAA,IAAa,CAAA,CAAE,GAAA,EAAK;AACtD,MAAA,CAAA,CAAE,IAAA,EAAM,QAAA;AAAA,IACV;AAAA,EACF,CAAA;AACF;AAEA,SAAS,gBAAA,CACP,EAAA,EACA,GAAA,EACA,KAAA,EACoB;AACpB,EAAA,GAAA,CAAI,CAAC,EAAA,EAAI;AACP,IAAA,OAAO,KAAA,CAAA;AAAA,EACT;AACA,EAAA,IAAI;AACF,IAAA,OAAO,MAAA,IAAU,KAAA,EAAA,EAAY,EAAA,CAAG,GAAG,EAAA,EAAI,EAAA,CAAG,GAAA,EAAK,KAAK,CAAA;AAAA,EACtD,EAAA,UAAQ;AACN,IAAA,OAAO,KAAA,CAAA;AAAA,EACT;AACF;ADvDA;AACE;AACA;AACA;AACF,yJAAC","file":"/home/runner/work/xray-emitter-js/xray-emitter-js/dist/hono.cjs","sourcesContent":[null,"import type { XrayEmitter, XrayContext, XrayRuntimeConfig } from '../core/index';\nimport { setContextRoute } from '../core/internal';\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';\n\n// copy types from Hono to avoid a package dependency\ninterface HonoCompatibleContext {\n req: { raw: Request };\n res: Response;\n set(key: string, value: unknown): void;\n}\n\ntype HonoMiddleware = (\n c: HonoCompatibleContext,\n next: () => Promise<void>,\n) => Promise<void | Response>;\n\n/**\n * Hono env helper that adds `xray` to `c.get(...)` variables.\n */\nexport type HonoXrayEnv = {\n Variables: { xray?: XrayContext };\n};\n\ntype HonoEmitter = HonoMiddleware & {\n flush: XrayEmitter['flush'];\n shutdown: XrayEmitter['shutdown'];\n};\n\nexport interface HonoWrapOptions extends WrapOptions {\n /**\n * Optional route resolver used to capture Hono route patterns.\n */\n routePath?(ctx: HonoCompatibleContext, index?: number): string;\n}\n\n/**\n * Create Hono middleware and expose `flush()`/`shutdown()` helpers.\n */\nexport function createEmitter(config: XrayRuntimeConfig, options?: HonoWrapOptions): HonoEmitter {\n const emitter = createFetchEmitter(config);\n const middleware = createHonoMiddleware(emitter, options) as HonoEmitter;\n middleware.flush = emitter.flush;\n middleware.shutdown = emitter.shutdown;\n return middleware;\n}\n\n/**\n * Create Hono middleware from an existing core `XrayEmitter`.\n */\nexport function createHonoMiddleware(xray: XrayEmitter, options?: HonoWrapOptions): HonoMiddleware {\n const routePathFn = options?.routePath;\n\n return async (c, next) => {\n const request = c.req.raw;\n if (!request) {\n await next();\n return;\n }\n\n const wrapped = wrapFetchPreserve(\n async (req) => {\n const ctx = getXrayContext(req);\n if (ctx) {\n c.set('xray', ctx);\n }\n\n let route = resolveRoutePath(routePathFn, c, -1);\n try {\n await next();\n return c.res;\n } finally {\n if (!route) {\n route = resolveRoutePath(routePathFn, c);\n }\n if (route && ctx) {\n setContextRoute(ctx, route);\n }\n }\n },\n xray,\n options,\n );\n\n const response = await wrapped(request);\n if (response instanceof Response && response !== c.res) {\n c.res = response;\n }\n };\n}\n\nfunction resolveRoutePath(\n fn: ((ctx: HonoCompatibleContext, index?: number) => string) | undefined,\n ctx: HonoCompatibleContext,\n index?: number,\n): string | undefined {\n if (!fn) {\n return undefined;\n }\n try {\n return index === undefined ? fn(ctx) : fn(ctx, index);\n } catch {\n return undefined;\n }\n}\n"]}
|
package/dist/hono.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as XrayContext, j as XrayRuntimeConfig, a as XrayEmitter } from './types-
|
|
2
|
-
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig } from './types-
|
|
3
|
-
export { c as createCoreEmitter } from './emitter-
|
|
1
|
+
import { d as XrayContext, j as XrayRuntimeConfig, a as XrayEmitter } from './types-BrKvhHbn.cjs';
|
|
2
|
+
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig } from './types-BrKvhHbn.cjs';
|
|
3
|
+
export { c as createCoreEmitter } from './emitter-Bi_m_w5h.cjs';
|
|
4
4
|
import { WrapOptions } from './fetch.cjs';
|
|
5
5
|
import '@opentelemetry/sdk-trace-base';
|
|
6
6
|
|
|
@@ -12,6 +12,9 @@ interface HonoCompatibleContext {
|
|
|
12
12
|
set(key: string, value: unknown): void;
|
|
13
13
|
}
|
|
14
14
|
type HonoMiddleware = (c: HonoCompatibleContext, next: () => Promise<void>) => Promise<void | Response>;
|
|
15
|
+
/**
|
|
16
|
+
* Hono env helper that adds `xray` to `c.get(...)` variables.
|
|
17
|
+
*/
|
|
15
18
|
type HonoXrayEnv = {
|
|
16
19
|
Variables: {
|
|
17
20
|
xray?: XrayContext;
|
|
@@ -22,9 +25,18 @@ type HonoEmitter = HonoMiddleware & {
|
|
|
22
25
|
shutdown: XrayEmitter['shutdown'];
|
|
23
26
|
};
|
|
24
27
|
interface HonoWrapOptions extends WrapOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Optional route resolver used to capture Hono route patterns.
|
|
30
|
+
*/
|
|
25
31
|
routePath?(ctx: HonoCompatibleContext, index?: number): string;
|
|
26
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Create Hono middleware and expose `flush()`/`shutdown()` helpers.
|
|
35
|
+
*/
|
|
27
36
|
declare function createEmitter(config: XrayRuntimeConfig, options?: HonoWrapOptions): HonoEmitter;
|
|
37
|
+
/**
|
|
38
|
+
* Create Hono middleware from an existing core `XrayEmitter`.
|
|
39
|
+
*/
|
|
28
40
|
declare function createHonoMiddleware(xray: XrayEmitter, options?: HonoWrapOptions): HonoMiddleware;
|
|
29
41
|
|
|
30
42
|
export { type HonoWrapOptions, type HonoXrayEnv, WrapOptions, XrayContext, XrayEmitter, XrayRuntimeConfig, createEmitter, createHonoMiddleware };
|
package/dist/hono.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as XrayContext, j as XrayRuntimeConfig, a as XrayEmitter } from './types-
|
|
2
|
-
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig } from './types-
|
|
3
|
-
export { c as createCoreEmitter } from './emitter-
|
|
1
|
+
import { d as XrayContext, j as XrayRuntimeConfig, a as XrayEmitter } from './types-BrKvhHbn.js';
|
|
2
|
+
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig } from './types-BrKvhHbn.js';
|
|
3
|
+
export { c as createCoreEmitter } from './emitter-Dy7bRGTq.js';
|
|
4
4
|
import { WrapOptions } from './fetch.js';
|
|
5
5
|
import '@opentelemetry/sdk-trace-base';
|
|
6
6
|
|
|
@@ -12,6 +12,9 @@ interface HonoCompatibleContext {
|
|
|
12
12
|
set(key: string, value: unknown): void;
|
|
13
13
|
}
|
|
14
14
|
type HonoMiddleware = (c: HonoCompatibleContext, next: () => Promise<void>) => Promise<void | Response>;
|
|
15
|
+
/**
|
|
16
|
+
* Hono env helper that adds `xray` to `c.get(...)` variables.
|
|
17
|
+
*/
|
|
15
18
|
type HonoXrayEnv = {
|
|
16
19
|
Variables: {
|
|
17
20
|
xray?: XrayContext;
|
|
@@ -22,9 +25,18 @@ type HonoEmitter = HonoMiddleware & {
|
|
|
22
25
|
shutdown: XrayEmitter['shutdown'];
|
|
23
26
|
};
|
|
24
27
|
interface HonoWrapOptions extends WrapOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Optional route resolver used to capture Hono route patterns.
|
|
30
|
+
*/
|
|
25
31
|
routePath?(ctx: HonoCompatibleContext, index?: number): string;
|
|
26
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Create Hono middleware and expose `flush()`/`shutdown()` helpers.
|
|
35
|
+
*/
|
|
27
36
|
declare function createEmitter(config: XrayRuntimeConfig, options?: HonoWrapOptions): HonoEmitter;
|
|
37
|
+
/**
|
|
38
|
+
* Create Hono middleware from an existing core `XrayEmitter`.
|
|
39
|
+
*/
|
|
28
40
|
declare function createHonoMiddleware(xray: XrayEmitter, options?: HonoWrapOptions): HonoMiddleware;
|
|
29
41
|
|
|
30
42
|
export { type HonoWrapOptions, type HonoXrayEnv, WrapOptions, XrayContext, XrayEmitter, XrayRuntimeConfig, createEmitter, createHonoMiddleware };
|
package/dist/hono.js
CHANGED
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
createEmitter,
|
|
3
3
|
getXrayContext,
|
|
4
4
|
wrapFetchPreserve
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-DV3MVQBB.js";
|
|
6
|
+
import "./chunk-GYXI3DWB.js";
|
|
7
7
|
import {
|
|
8
8
|
setContextRoute
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-NTIUR3OC.js";
|
|
10
|
+
import "./chunk-7KT6EPVZ.js";
|
|
11
11
|
|
|
12
12
|
// src/hono/hono.ts
|
|
13
13
|
function createEmitter2(config, options) {
|
package/dist/hono.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hono/hono.ts"],"sourcesContent":["import type { XrayEmitter, XrayContext, XrayRuntimeConfig } from '../core/index';\nimport { setContextRoute } from '../core/internal';\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';\n\n// copy types from Hono to avoid a package dependency\ninterface HonoCompatibleContext {\n req: { raw: Request };\n res: Response;\n set(key: string, value: unknown): void;\n}\n\ntype HonoMiddleware = (\n c: HonoCompatibleContext,\n next: () => Promise<void>,\n) => Promise<void | Response>;\n\nexport type HonoXrayEnv = {\n Variables: { xray?: XrayContext };\n};\n\ntype HonoEmitter = HonoMiddleware & {\n flush: XrayEmitter['flush'];\n shutdown: XrayEmitter['shutdown'];\n};\n\nexport interface HonoWrapOptions extends WrapOptions {\n routePath?(ctx: HonoCompatibleContext, index?: number): string;\n}\n\nexport function createEmitter(config: XrayRuntimeConfig, options?: HonoWrapOptions): HonoEmitter {\n const emitter = createFetchEmitter(config);\n const middleware = createHonoMiddleware(emitter, options) as HonoEmitter;\n middleware.flush = emitter.flush;\n middleware.shutdown = emitter.shutdown;\n return middleware;\n}\n\nexport function createHonoMiddleware(xray: XrayEmitter, options?: HonoWrapOptions): HonoMiddleware {\n const routePathFn = options?.routePath;\n\n return async (c, next) => {\n const request = c.req.raw;\n if (!request) {\n await next();\n return;\n }\n\n const wrapped = wrapFetchPreserve(\n async (req) => {\n const ctx = getXrayContext(req);\n if (ctx) {\n c.set('xray', ctx);\n }\n\n let route = resolveRoutePath(routePathFn, c, -1);\n try {\n await next();\n return c.res;\n } finally {\n if (!route) {\n route = resolveRoutePath(routePathFn, c);\n }\n if (route && ctx) {\n setContextRoute(ctx, route);\n }\n }\n },\n xray,\n options,\n );\n\n const response = await wrapped(request);\n if (response instanceof Response && response !== c.res) {\n c.res = response;\n }\n };\n}\n\nfunction resolveRoutePath(\n fn: ((ctx: HonoCompatibleContext, index?: number) => string) | undefined,\n ctx: HonoCompatibleContext,\n index?: number,\n): string | undefined {\n if (!fn) {\n return undefined;\n }\n try {\n return index === undefined ? fn(ctx) : fn(ctx, index);\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/hono/hono.ts"],"sourcesContent":["import type { XrayEmitter, XrayContext, XrayRuntimeConfig } from '../core/index';\nimport { setContextRoute } from '../core/internal';\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';\n\n// copy types from Hono to avoid a package dependency\ninterface HonoCompatibleContext {\n req: { raw: Request };\n res: Response;\n set(key: string, value: unknown): void;\n}\n\ntype HonoMiddleware = (\n c: HonoCompatibleContext,\n next: () => Promise<void>,\n) => Promise<void | Response>;\n\n/**\n * Hono env helper that adds `xray` to `c.get(...)` variables.\n */\nexport type HonoXrayEnv = {\n Variables: { xray?: XrayContext };\n};\n\ntype HonoEmitter = HonoMiddleware & {\n flush: XrayEmitter['flush'];\n shutdown: XrayEmitter['shutdown'];\n};\n\nexport interface HonoWrapOptions extends WrapOptions {\n /**\n * Optional route resolver used to capture Hono route patterns.\n */\n routePath?(ctx: HonoCompatibleContext, index?: number): string;\n}\n\n/**\n * Create Hono middleware and expose `flush()`/`shutdown()` helpers.\n */\nexport function createEmitter(config: XrayRuntimeConfig, options?: HonoWrapOptions): HonoEmitter {\n const emitter = createFetchEmitter(config);\n const middleware = createHonoMiddleware(emitter, options) as HonoEmitter;\n middleware.flush = emitter.flush;\n middleware.shutdown = emitter.shutdown;\n return middleware;\n}\n\n/**\n * Create Hono middleware from an existing core `XrayEmitter`.\n */\nexport function createHonoMiddleware(xray: XrayEmitter, options?: HonoWrapOptions): HonoMiddleware {\n const routePathFn = options?.routePath;\n\n return async (c, next) => {\n const request = c.req.raw;\n if (!request) {\n await next();\n return;\n }\n\n const wrapped = wrapFetchPreserve(\n async (req) => {\n const ctx = getXrayContext(req);\n if (ctx) {\n c.set('xray', ctx);\n }\n\n let route = resolveRoutePath(routePathFn, c, -1);\n try {\n await next();\n return c.res;\n } finally {\n if (!route) {\n route = resolveRoutePath(routePathFn, c);\n }\n if (route && ctx) {\n setContextRoute(ctx, route);\n }\n }\n },\n xray,\n options,\n );\n\n const response = await wrapped(request);\n if (response instanceof Response && response !== c.res) {\n c.res = response;\n }\n };\n}\n\nfunction resolveRoutePath(\n fn: ((ctx: HonoCompatibleContext, index?: number) => string) | undefined,\n ctx: HonoCompatibleContext,\n index?: number,\n): string | undefined {\n if (!fn) {\n return undefined;\n }\n try {\n return index === undefined ? fn(ctx) : fn(ctx, index);\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAuDO,SAASA,eAAc,QAA2B,SAAwC;AAC/F,QAAM,UAAU,cAAmB,MAAM;AACzC,QAAM,aAAa,qBAAqB,SAAS,OAAO;AACxD,aAAW,QAAQ,QAAQ;AAC3B,aAAW,WAAW,QAAQ;AAC9B,SAAO;AACT;AAKO,SAAS,qBAAqB,MAAmB,SAA2C;AACjG,QAAM,cAAc,SAAS;AAE7B,SAAO,OAAO,GAAG,SAAS;AACxB,UAAM,UAAU,EAAE,IAAI;AACtB,QAAI,CAAC,SAAS;AACZ,YAAM,KAAK;AACX;AAAA,IACF;AAEA,UAAM,UAAU;AAAA,MACd,OAAO,QAAQ;AACb,cAAM,MAAM,eAAe,GAAG;AAC9B,YAAI,KAAK;AACP,YAAE,IAAI,QAAQ,GAAG;AAAA,QACnB;AAEA,YAAI,QAAQ,iBAAiB,aAAa,GAAG,EAAE;AAC/C,YAAI;AACF,gBAAM,KAAK;AACX,iBAAO,EAAE;AAAA,QACX,UAAE;AACA,cAAI,CAAC,OAAO;AACV,oBAAQ,iBAAiB,aAAa,CAAC;AAAA,UACzC;AACA,cAAI,SAAS,KAAK;AAChB,4BAAgB,KAAK,KAAK;AAAA,UAC5B;AAAA,QACF;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,UAAM,WAAW,MAAM,QAAQ,OAAO;AACtC,QAAI,oBAAoB,YAAY,aAAa,EAAE,KAAK;AACtD,QAAE,MAAM;AAAA,IACV;AAAA,EACF;AACF;AAEA,SAAS,iBACP,IACA,KACA,OACoB;AACpB,MAAI,CAAC,IAAI;AACP,WAAO;AAAA,EACT;AACA,MAAI;AACF,WAAO,UAAU,SAAY,GAAG,GAAG,IAAI,GAAG,KAAK,KAAK;AAAA,EACtD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["createEmitter"]}
|
package/dist/index.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkUJWD5CFAcjs = require('./chunk-UJWD5CFA.cjs');
|
|
6
|
+
require('./chunk-DNBARLGB.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.XrayConfigError =
|
|
11
|
+
exports.XrayConfigError = _chunkUJWD5CFAcjs.XrayConfigError; exports.createEmitter = _chunkUJWD5CFAcjs.createEmitter; exports.normalizeConfig = _chunkUJWD5CFAcjs.normalizeConfig;
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { X as XrayConfig, a as XrayEmitter } from './types-
|
|
2
|
-
export { A as AttributeValue, e as CaptureConfig, C as CapturedBody, E as ExporterConfig, L as LogLevel, b as Logger, N as NormalizedRequest, c as NormalizedResponse, f as RedactionConfig, g as RequestIdConfig, R as RequestLog, h as ResolvedXrayConfig, i as RouteConfig, k as XrayConfigError, d as XrayContext, j as XrayRuntimeConfig, n as normalizeConfig } from './types-
|
|
1
|
+
import { X as XrayConfig, a as XrayEmitter } from './types-BrKvhHbn.cjs';
|
|
2
|
+
export { A as AttributeValue, e as CaptureConfig, C as CapturedBody, E as ExporterConfig, L as LogLevel, b as Logger, N as NormalizedRequest, c as NormalizedResponse, f as RedactionConfig, g as RequestIdConfig, R as RequestLog, h as ResolvedXrayConfig, i as RouteConfig, k as XrayConfigError, d as XrayContext, j as XrayRuntimeConfig, n as normalizeConfig } from './types-BrKvhHbn.cjs';
|
|
3
3
|
import { SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Create a runtime-agnostic X-ray emitter with a provided SpanExporter.
|
|
7
|
+
*
|
|
8
|
+
* Most applications should use a runtime adapter (`/node`, `/fetch`,
|
|
9
|
+
* or framework-specific entrypoints) unless they need custom transport logic.
|
|
10
|
+
*/
|
|
5
11
|
declare function createEmitter(config: XrayConfig, exporter: SpanExporter): XrayEmitter;
|
|
6
12
|
|
|
7
13
|
export { XrayConfig, XrayEmitter, createEmitter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { X as XrayConfig, a as XrayEmitter } from './types-
|
|
2
|
-
export { A as AttributeValue, e as CaptureConfig, C as CapturedBody, E as ExporterConfig, L as LogLevel, b as Logger, N as NormalizedRequest, c as NormalizedResponse, f as RedactionConfig, g as RequestIdConfig, R as RequestLog, h as ResolvedXrayConfig, i as RouteConfig, k as XrayConfigError, d as XrayContext, j as XrayRuntimeConfig, n as normalizeConfig } from './types-
|
|
1
|
+
import { X as XrayConfig, a as XrayEmitter } from './types-BrKvhHbn.js';
|
|
2
|
+
export { A as AttributeValue, e as CaptureConfig, C as CapturedBody, E as ExporterConfig, L as LogLevel, b as Logger, N as NormalizedRequest, c as NormalizedResponse, f as RedactionConfig, g as RequestIdConfig, R as RequestLog, h as ResolvedXrayConfig, i as RouteConfig, k as XrayConfigError, d as XrayContext, j as XrayRuntimeConfig, n as normalizeConfig } from './types-BrKvhHbn.js';
|
|
3
3
|
import { SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Create a runtime-agnostic X-ray emitter with a provided SpanExporter.
|
|
7
|
+
*
|
|
8
|
+
* Most applications should use a runtime adapter (`/node`, `/fetch`,
|
|
9
|
+
* or framework-specific entrypoints) unless they need custom transport logic.
|
|
10
|
+
*/
|
|
5
11
|
declare function createEmitter(config: XrayConfig, exporter: SpanExporter): XrayEmitter;
|
|
6
12
|
|
|
7
13
|
export { XrayConfig, XrayEmitter, createEmitter };
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkCPHFCOA5cjs = require('./chunk-CPHFCOA5.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ var _chunkGNSXLLECcjs = require('./chunk-GNSXLLEC.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkDNBARLGBcjs = require('./chunk-DNBARLGB.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -41,5 +41,5 @@ var _chunkJKW6E4L3cjs = require('./chunk-JKW6E4L3.cjs');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
exports.LimitedBuffer =
|
|
44
|
+
exports.LimitedBuffer = _chunkCPHFCOA5cjs.LimitedBuffer; exports.bindContextToObject = _chunkCPHFCOA5cjs.bindContextToObject; exports.generateRequestId = _chunkDNBARLGBcjs.generateRequestId; exports.getXrayContextFromObject = _chunkCPHFCOA5cjs.getXrayContextFromObject; exports.headerTokenList = _chunkCPHFCOA5cjs.headerTokenList; exports.headerValuesFromFetchHeaders = _chunkCPHFCOA5cjs.headerValuesFromFetchHeaders; exports.headerValuesFromFetchHeadersWithLimit = _chunkCPHFCOA5cjs.headerValuesFromFetchHeadersWithLimit; exports.headerValuesFromNodeHeaders = _chunkCPHFCOA5cjs.headerValuesFromNodeHeaders; exports.isWebsocketUpgrade = _chunkCPHFCOA5cjs.isWebsocketUpgrade; exports.isWebsocketUpgradeFetch = _chunkCPHFCOA5cjs.isWebsocketUpgradeFetch; exports.logWithLevel = _chunkDNBARLGBcjs.logWithLevel; exports.makeCapturedBody = _chunkDNBARLGBcjs.makeCapturedBody; exports.setCaptureOverride = _chunkCPHFCOA5cjs.setCaptureOverride; exports.setContextRequestId = _chunkCPHFCOA5cjs.setContextRequestId; exports.setContextRoute = _chunkCPHFCOA5cjs.setContextRoute; exports.setRedactionOverride = _chunkCPHFCOA5cjs.setRedactionOverride; exports.uuidv7 = _chunkDNBARLGBcjs.uuidv7; exports.uuidv7base48 = _chunkDNBARLGBcjs.uuidv7base48; exports.uuidv7base62 = _chunkDNBARLGBcjs.uuidv7base62;
|
|
45
45
|
//# sourceMappingURL=internal.cjs.map
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CapturedBody, b as Logger, L as LogLevel, d as XrayContext, e as CaptureConfig, f as RedactionConfig } from './types-
|
|
1
|
+
import { C as CapturedBody, b as Logger, L as LogLevel, d as XrayContext, e as CaptureConfig, f as RedactionConfig } from './types-BrKvhHbn.cjs';
|
|
2
2
|
import '@opentelemetry/sdk-trace-base';
|
|
3
3
|
|
|
4
4
|
declare function makeCapturedBody(bytes: Uint8Array | undefined, totalBytes: number, truncated: boolean, mode: 'text' | 'base64'): CapturedBody | undefined;
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CapturedBody, b as Logger, L as LogLevel, d as XrayContext, e as CaptureConfig, f as RedactionConfig } from './types-
|
|
1
|
+
import { C as CapturedBody, b as Logger, L as LogLevel, d as XrayContext, e as CaptureConfig, f as RedactionConfig } from './types-BrKvhHbn.js';
|
|
2
2
|
import '@opentelemetry/sdk-trace-base';
|
|
3
3
|
|
|
4
4
|
declare function makeCapturedBody(bytes: Uint8Array | undefined, totalBytes: number, truncated: boolean, mode: 'text' | 'base64'): CapturedBody | undefined;
|
package/dist/internal.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setContextRequestId,
|
|
13
13
|
setContextRoute,
|
|
14
14
|
setRedactionOverride
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NTIUR3OC.js";
|
|
16
16
|
import {
|
|
17
17
|
generateRequestId,
|
|
18
18
|
logWithLevel,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
uuidv7,
|
|
21
21
|
uuidv7base48,
|
|
22
22
|
uuidv7base62
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7KT6EPVZ.js";
|
|
24
24
|
export {
|
|
25
25
|
LimitedBuffer,
|
|
26
26
|
bindContextToObject,
|
package/dist/next.cjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
5
|
+
var _chunkSUVCVINAcjs = require('./chunk-SUVCVINA.cjs');
|
|
6
|
+
require('./chunk-UJWD5CFA.cjs');
|
|
7
|
+
require('./chunk-CPHFCOA5.cjs');
|
|
8
|
+
require('./chunk-DNBARLGB.cjs');
|
|
9
9
|
|
|
10
10
|
// src/next/next.ts
|
|
11
11
|
function createEmitter2(config, options) {
|
|
12
|
-
const emitter =
|
|
12
|
+
const emitter = _chunkSUVCVINAcjs.createEmitter.call(void 0, config);
|
|
13
13
|
const wrap = ((handler) => wrapNextRoute(handler, emitter, options));
|
|
14
14
|
wrap.flush = emitter.flush;
|
|
15
15
|
wrap.shutdown = emitter.shutdown;
|
|
@@ -17,7 +17,7 @@ function createEmitter2(config, options) {
|
|
|
17
17
|
}
|
|
18
18
|
function wrapNextRoute(handler, xray, options) {
|
|
19
19
|
return async (request, context) => {
|
|
20
|
-
const wrapped =
|
|
20
|
+
const wrapped = _chunkSUVCVINAcjs.wrapFetchPreserve.call(void 0, (req) => handler(req, context), xray, options);
|
|
21
21
|
return wrapped(request);
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -26,5 +26,5 @@ function wrapNextRoute(handler, xray, options) {
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
exports.createCoreEmitter =
|
|
29
|
+
exports.createCoreEmitter = _chunkSUVCVINAcjs.createEmitter; exports.createEmitter = createEmitter2; exports.getXrayContext = _chunkSUVCVINAcjs.getXrayContext; exports.wrapNextRoute = wrapNextRoute;
|
|
30
30
|
//# sourceMappingURL=next.cjs.map
|
package/dist/next.cjs.map
CHANGED
|
@@ -1 +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;
|
|
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;AC8BO,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;AAKO,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;ADrCA;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\n/**\n * Create a Next.js App Router wrapper and expose `flush()`/`shutdown()`.\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\n/**\n * Wrap a Next.js route handler using an existing core `XrayEmitter`.\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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as XrayRuntimeConfig, a as XrayEmitter } from './types-
|
|
2
|
-
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig, d as XrayContext } from './types-
|
|
3
|
-
export { c as createCoreEmitter } from './emitter-
|
|
1
|
+
import { j as XrayRuntimeConfig, a as XrayEmitter } from './types-BrKvhHbn.cjs';
|
|
2
|
+
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig, d as XrayContext } from './types-BrKvhHbn.cjs';
|
|
3
|
+
export { c as createCoreEmitter } from './emitter-Bi_m_w5h.cjs';
|
|
4
4
|
import { WrapOptions } from './fetch.cjs';
|
|
5
5
|
export { getXrayContext } from './fetch.cjs';
|
|
6
6
|
import '@opentelemetry/sdk-trace-base';
|
|
@@ -13,7 +13,13 @@ type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRou
|
|
|
13
13
|
flush: XrayEmitter['flush'];
|
|
14
14
|
shutdown: XrayEmitter['shutdown'];
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Create a Next.js App Router wrapper and expose `flush()`/`shutdown()`.
|
|
18
|
+
*/
|
|
16
19
|
declare function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): NextEmitter;
|
|
20
|
+
/**
|
|
21
|
+
* Wrap a Next.js route handler using an existing core `XrayEmitter`.
|
|
22
|
+
*/
|
|
17
23
|
declare function wrapNextRoute(handler: NextRouteHandler, xray: XrayEmitter, options?: WrapOptions): (request: Request, context: NextRouteContext) => Promise<Response>;
|
|
18
24
|
|
|
19
25
|
export { WrapOptions, XrayEmitter, XrayRuntimeConfig, createEmitter, wrapNextRoute };
|
package/dist/next.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as XrayRuntimeConfig, a as XrayEmitter } from './types-
|
|
2
|
-
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig, d as XrayContext } from './types-
|
|
3
|
-
export { c as createCoreEmitter } from './emitter-
|
|
1
|
+
import { j as XrayRuntimeConfig, a as XrayEmitter } from './types-BrKvhHbn.js';
|
|
2
|
+
export { e as CaptureConfig, f as RedactionConfig, R as RequestLog, X as XrayConfig, d as XrayContext } from './types-BrKvhHbn.js';
|
|
3
|
+
export { c as createCoreEmitter } from './emitter-Dy7bRGTq.js';
|
|
4
4
|
import { WrapOptions } from './fetch.js';
|
|
5
5
|
export { getXrayContext } from './fetch.js';
|
|
6
6
|
import '@opentelemetry/sdk-trace-base';
|
|
@@ -13,7 +13,13 @@ type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRou
|
|
|
13
13
|
flush: XrayEmitter['flush'];
|
|
14
14
|
shutdown: XrayEmitter['shutdown'];
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Create a Next.js App Router wrapper and expose `flush()`/`shutdown()`.
|
|
18
|
+
*/
|
|
16
19
|
declare function createEmitter(config: XrayRuntimeConfig, options?: WrapOptions): NextEmitter;
|
|
20
|
+
/**
|
|
21
|
+
* Wrap a Next.js route handler using an existing core `XrayEmitter`.
|
|
22
|
+
*/
|
|
17
23
|
declare function wrapNextRoute(handler: NextRouteHandler, xray: XrayEmitter, options?: WrapOptions): (request: Request, context: NextRouteContext) => Promise<Response>;
|
|
18
24
|
|
|
19
25
|
export { WrapOptions, XrayEmitter, XrayRuntimeConfig, createEmitter, wrapNextRoute };
|
package/dist/next.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
createEmitter,
|
|
3
3
|
getXrayContext,
|
|
4
4
|
wrapFetchPreserve
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-DV3MVQBB.js";
|
|
6
|
+
import "./chunk-GYXI3DWB.js";
|
|
7
|
+
import "./chunk-NTIUR3OC.js";
|
|
8
|
+
import "./chunk-7KT6EPVZ.js";
|
|
9
9
|
|
|
10
10
|
// src/next/next.ts
|
|
11
11
|
function createEmitter2(config, options) {
|
package/dist/next.js.map
CHANGED
|
@@ -1 +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":";;;;;;;;;;
|
|
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\n/**\n * Create a Next.js App Router wrapper and expose `flush()`/`shutdown()`.\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\n/**\n * Wrap a Next.js route handler using an existing core `XrayEmitter`.\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":";;;;;;;;;;AAuCO,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;AAKO,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
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
5
|
+
var _chunk55YD27PVcjs = require('./chunk-55YD27PV.cjs');
|
|
6
|
+
require('./chunk-UJWD5CFA.cjs');
|
|
7
|
+
require('./chunk-CPHFCOA5.cjs');
|
|
8
|
+
require('./chunk-DNBARLGB.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.createEmitter =
|
|
13
|
+
exports.createEmitter = _chunk55YD27PVcjs.createEmitter; exports.getXrayContext = _chunk55YD27PVcjs.getXrayContext; exports.wrapHttpHandler = _chunk55YD27PVcjs.wrapHttpHandler;
|
|
14
14
|
//# sourceMappingURL=node.cjs.map
|