@stainlessdev/xray-next 0.1.0-dev.c66866e → 0.1.0-dev.e817818
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/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -20,13 +20,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
|
|
23
|
+
createCoreEmitter: () => import_xray_core.createEmitter,
|
|
24
|
+
createEmitter: () => createEmitter,
|
|
24
25
|
getXrayContext: () => import_xray_fetch.getXrayContext,
|
|
25
26
|
wrapNextRoute: () => wrapNextRoute
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(index_exports);
|
|
28
29
|
var import_xray_core = require("@stainlessdev/xray-core");
|
|
29
30
|
var import_xray_fetch = require("@stainlessdev/xray-fetch");
|
|
31
|
+
function createEmitter(config, options) {
|
|
32
|
+
const emitter = (0, import_xray_core.createEmitter)(config);
|
|
33
|
+
const wrap = ((handler) => wrapNextRoute(handler, emitter, options));
|
|
34
|
+
wrap.flush = emitter.flush;
|
|
35
|
+
wrap.shutdown = emitter.shutdown;
|
|
36
|
+
return wrap;
|
|
37
|
+
}
|
|
30
38
|
function wrapNextRoute(handler, xray, options) {
|
|
31
39
|
return async (request, context) => {
|
|
32
40
|
const wrapped = (0, import_xray_fetch.wrapFetchPreserve)((req) => handler(req, context), xray, options);
|
|
@@ -35,6 +43,7 @@ function wrapNextRoute(handler, xray, options) {
|
|
|
35
43
|
}
|
|
36
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
45
|
0 && (module.exports = {
|
|
46
|
+
createCoreEmitter,
|
|
38
47
|
createEmitter,
|
|
39
48
|
getXrayContext,
|
|
40
49
|
wrapNextRoute
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { XrayEmitter } from '@stainlessdev/xray-core';\nimport { createEmitter } from '@stainlessdev/xray-core';\nimport { getXrayContext, wrapFetchPreserve, type WrapOptions } from '@stainlessdev/xray-fetch';\n\nexport {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { XrayEmitter, XrayConfig } from '@stainlessdev/xray-core';\nimport { createEmitter as createCoreEmitter } from '@stainlessdev/xray-core';\nimport { getXrayContext, wrapFetchPreserve, type WrapOptions } from '@stainlessdev/xray-fetch';\n\nexport { createCoreEmitter };\nexport type {\n CaptureConfig,\n RedactionConfig,\n RequestLog,\n XrayConfig,\n XrayContext,\n XrayEmitter,\n} from '@stainlessdev/xray-core';\nexport type { WrapOptions } from '@stainlessdev/xray-fetch';\nexport { getXrayContext };\n\nexport type NextRouteContext = {\n params: Promise<Record<string, string | string[]>>;\n};\n\nexport type NextRouteHandler = (\n request: Request,\n context: NextRouteContext,\n) => Response | Promise<Response>;\n\nexport type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRoute>) & {\n flush: XrayEmitter['flush'];\n shutdown: XrayEmitter['shutdown'];\n};\n\nexport function createEmitter(config: XrayConfig, options?: WrapOptions): NextEmitter {\n const emitter = createCoreEmitter(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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4CAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AACA,uBAAmD;AACnD,wBAAoE;AA4B7D,SAAS,cAAc,QAAoB,SAAoC;AACpF,QAAM,cAAU,iBAAAC,eAAkB,MAAM;AACxC,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,cAAU,qCAAkB,CAAC,QAAiB,QAAQ,KAAK,OAAO,GAAG,MAAM,OAAO;AACxF,WAAO,QAAQ,OAAO;AAAA,EACxB;AACF;","names":["createCoreEmitter","createCoreEmitter"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { XrayEmitter } from '@stainlessdev/xray-core';
|
|
2
|
-
export { CaptureConfig, RedactionConfig, RequestLog, XrayConfig, XrayContext, XrayEmitter, createEmitter } from '@stainlessdev/xray-core';
|
|
1
|
+
import { XrayEmitter, XrayConfig } from '@stainlessdev/xray-core';
|
|
2
|
+
export { CaptureConfig, RedactionConfig, RequestLog, XrayConfig, XrayContext, XrayEmitter, createEmitter as createCoreEmitter } from '@stainlessdev/xray-core';
|
|
3
3
|
import { WrapOptions } from '@stainlessdev/xray-fetch';
|
|
4
4
|
export { WrapOptions, getXrayContext } from '@stainlessdev/xray-fetch';
|
|
5
5
|
|
|
@@ -7,6 +7,11 @@ type NextRouteContext = {
|
|
|
7
7
|
params: Promise<Record<string, string | string[]>>;
|
|
8
8
|
};
|
|
9
9
|
type NextRouteHandler = (request: Request, context: NextRouteContext) => Response | Promise<Response>;
|
|
10
|
+
type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRoute>) & {
|
|
11
|
+
flush: XrayEmitter['flush'];
|
|
12
|
+
shutdown: XrayEmitter['shutdown'];
|
|
13
|
+
};
|
|
14
|
+
declare function createEmitter(config: XrayConfig, options?: WrapOptions): NextEmitter;
|
|
10
15
|
declare function wrapNextRoute(handler: NextRouteHandler, xray: XrayEmitter, options?: WrapOptions): (request: Request, context: NextRouteContext) => Promise<Response>;
|
|
11
16
|
|
|
12
|
-
export { type NextRouteContext, type NextRouteHandler, wrapNextRoute };
|
|
17
|
+
export { type NextEmitter, type NextRouteContext, type NextRouteHandler, createEmitter, wrapNextRoute };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { XrayEmitter } from '@stainlessdev/xray-core';
|
|
2
|
-
export { CaptureConfig, RedactionConfig, RequestLog, XrayConfig, XrayContext, XrayEmitter, createEmitter } from '@stainlessdev/xray-core';
|
|
1
|
+
import { XrayEmitter, XrayConfig } from '@stainlessdev/xray-core';
|
|
2
|
+
export { CaptureConfig, RedactionConfig, RequestLog, XrayConfig, XrayContext, XrayEmitter, createEmitter as createCoreEmitter } from '@stainlessdev/xray-core';
|
|
3
3
|
import { WrapOptions } from '@stainlessdev/xray-fetch';
|
|
4
4
|
export { WrapOptions, getXrayContext } from '@stainlessdev/xray-fetch';
|
|
5
5
|
|
|
@@ -7,6 +7,11 @@ type NextRouteContext = {
|
|
|
7
7
|
params: Promise<Record<string, string | string[]>>;
|
|
8
8
|
};
|
|
9
9
|
type NextRouteHandler = (request: Request, context: NextRouteContext) => Response | Promise<Response>;
|
|
10
|
+
type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRoute>) & {
|
|
11
|
+
flush: XrayEmitter['flush'];
|
|
12
|
+
shutdown: XrayEmitter['shutdown'];
|
|
13
|
+
};
|
|
14
|
+
declare function createEmitter(config: XrayConfig, options?: WrapOptions): NextEmitter;
|
|
10
15
|
declare function wrapNextRoute(handler: NextRouteHandler, xray: XrayEmitter, options?: WrapOptions): (request: Request, context: NextRouteContext) => Promise<Response>;
|
|
11
16
|
|
|
12
|
-
export { type NextRouteContext, type NextRouteHandler, wrapNextRoute };
|
|
17
|
+
export { type NextEmitter, type NextRouteContext, type NextRouteHandler, createEmitter, wrapNextRoute };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { createEmitter } from "@stainlessdev/xray-core";
|
|
2
|
+
import { createEmitter as createCoreEmitter } from "@stainlessdev/xray-core";
|
|
3
3
|
import { getXrayContext, wrapFetchPreserve } from "@stainlessdev/xray-fetch";
|
|
4
|
+
function createEmitter(config, options) {
|
|
5
|
+
const emitter = createCoreEmitter(config);
|
|
6
|
+
const wrap = ((handler) => wrapNextRoute(handler, emitter, options));
|
|
7
|
+
wrap.flush = emitter.flush;
|
|
8
|
+
wrap.shutdown = emitter.shutdown;
|
|
9
|
+
return wrap;
|
|
10
|
+
}
|
|
4
11
|
function wrapNextRoute(handler, xray, options) {
|
|
5
12
|
return async (request, context) => {
|
|
6
13
|
const wrapped = wrapFetchPreserve((req) => handler(req, context), xray, options);
|
|
@@ -8,6 +15,7 @@ function wrapNextRoute(handler, xray, options) {
|
|
|
8
15
|
};
|
|
9
16
|
}
|
|
10
17
|
export {
|
|
18
|
+
createCoreEmitter,
|
|
11
19
|
createEmitter,
|
|
12
20
|
getXrayContext,
|
|
13
21
|
wrapNextRoute
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { XrayEmitter } from '@stainlessdev/xray-core';\nimport { createEmitter } from '@stainlessdev/xray-core';\nimport { getXrayContext, wrapFetchPreserve, type WrapOptions } from '@stainlessdev/xray-fetch';\n\nexport {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { XrayEmitter, XrayConfig } from '@stainlessdev/xray-core';\nimport { createEmitter as createCoreEmitter } from '@stainlessdev/xray-core';\nimport { getXrayContext, wrapFetchPreserve, type WrapOptions } from '@stainlessdev/xray-fetch';\n\nexport { createCoreEmitter };\nexport type {\n CaptureConfig,\n RedactionConfig,\n RequestLog,\n XrayConfig,\n XrayContext,\n XrayEmitter,\n} from '@stainlessdev/xray-core';\nexport type { WrapOptions } from '@stainlessdev/xray-fetch';\nexport { getXrayContext };\n\nexport type NextRouteContext = {\n params: Promise<Record<string, string | string[]>>;\n};\n\nexport type NextRouteHandler = (\n request: Request,\n context: NextRouteContext,\n) => Response | Promise<Response>;\n\nexport type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRoute>) & {\n flush: XrayEmitter['flush'];\n shutdown: XrayEmitter['shutdown'];\n};\n\nexport function createEmitter(config: XrayConfig, options?: WrapOptions): NextEmitter {\n const emitter = createCoreEmitter(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":";AACA,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,gBAAgB,yBAA2C;AA4B7D,SAAS,cAAc,QAAoB,SAAoC;AACpF,QAAM,UAAU,kBAAkB,MAAM;AACxC,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":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stainlessdev/xray-next",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.e817818",
|
|
4
4
|
"description": "Next.js integration for Stainless X-ray request logging",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@stainlessdev/xray-
|
|
24
|
-
"@stainlessdev/xray-
|
|
23
|
+
"@stainlessdev/xray-core": "0.1.0-dev.e817818",
|
|
24
|
+
"@stainlessdev/xray-fetch": "0.1.0-dev.e817818"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@opentelemetry/api": "^1.9.0",
|