@stainlessdev/xray-next 0.4.0-branch.bg-rework-exporters.2fa33ac → 0.4.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/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -7
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -20,15 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
createCoreEmitter: () =>
|
|
23
|
+
createCoreEmitter: () => import_xray_core.createEmitter,
|
|
24
24
|
createEmitter: () => createEmitter,
|
|
25
25
|
getXrayContext: () => import_xray_fetch.getXrayContext,
|
|
26
26
|
wrapNextRoute: () => wrapNextRoute
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
var import_xray_core = require("@stainlessdev/xray-core");
|
|
29
30
|
var import_xray_fetch = require("@stainlessdev/xray-fetch");
|
|
30
31
|
function createEmitter(config, options) {
|
|
31
|
-
const emitter = (0,
|
|
32
|
+
const emitter = (0, import_xray_core.createEmitter)(config);
|
|
32
33
|
const wrap = ((handler) => wrapNextRoute(handler, emitter, options));
|
|
33
34
|
wrap.flush = emitter.flush;
|
|
34
35
|
wrap.shutdown = emitter.shutdown;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { XrayEmitter,
|
|
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,7 +1,7 @@
|
|
|
1
|
-
import { XrayEmitter,
|
|
2
|
-
export { CaptureConfig, RedactionConfig, RequestLog, XrayConfig, XrayContext, XrayEmitter,
|
|
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
|
-
export { WrapOptions,
|
|
4
|
+
export { WrapOptions, getXrayContext } from '@stainlessdev/xray-fetch';
|
|
5
5
|
|
|
6
6
|
type NextRouteContext = {
|
|
7
7
|
params: Promise<Record<string, string | string[]>>;
|
|
@@ -11,7 +11,7 @@ type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRou
|
|
|
11
11
|
flush: XrayEmitter['flush'];
|
|
12
12
|
shutdown: XrayEmitter['shutdown'];
|
|
13
13
|
};
|
|
14
|
-
declare function createEmitter(config:
|
|
14
|
+
declare function createEmitter(config: XrayConfig, options?: WrapOptions): NextEmitter;
|
|
15
15
|
declare function wrapNextRoute(handler: NextRouteHandler, xray: XrayEmitter, options?: WrapOptions): (request: Request, context: NextRouteContext) => Promise<Response>;
|
|
16
16
|
|
|
17
17
|
export { type NextEmitter, type NextRouteContext, type NextRouteHandler, createEmitter, wrapNextRoute };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { XrayEmitter,
|
|
2
|
-
export { CaptureConfig, RedactionConfig, RequestLog, XrayConfig, XrayContext, XrayEmitter,
|
|
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
|
-
export { WrapOptions,
|
|
4
|
+
export { WrapOptions, getXrayContext } from '@stainlessdev/xray-fetch';
|
|
5
5
|
|
|
6
6
|
type NextRouteContext = {
|
|
7
7
|
params: Promise<Record<string, string | string[]>>;
|
|
@@ -11,7 +11,7 @@ type NextEmitter = ((handler: NextRouteHandler) => ReturnType<typeof wrapNextRou
|
|
|
11
11
|
flush: XrayEmitter['flush'];
|
|
12
12
|
shutdown: XrayEmitter['shutdown'];
|
|
13
13
|
};
|
|
14
|
-
declare function createEmitter(config:
|
|
14
|
+
declare function createEmitter(config: XrayConfig, options?: WrapOptions): NextEmitter;
|
|
15
15
|
declare function wrapNextRoute(handler: NextRouteHandler, xray: XrayEmitter, options?: WrapOptions): (request: Request, context: NextRouteContext) => Promise<Response>;
|
|
16
16
|
|
|
17
17
|
export { type NextEmitter, type NextRouteContext, type NextRouteHandler, createEmitter, wrapNextRoute };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
getXrayContext,
|
|
5
|
-
wrapFetchPreserve
|
|
6
|
-
} from "@stainlessdev/xray-fetch";
|
|
2
|
+
import { createEmitter as createCoreEmitter } from "@stainlessdev/xray-core";
|
|
3
|
+
import { getXrayContext, wrapFetchPreserve } from "@stainlessdev/xray-fetch";
|
|
7
4
|
function createEmitter(config, options) {
|
|
8
|
-
const emitter =
|
|
5
|
+
const emitter = createCoreEmitter(config);
|
|
9
6
|
const wrap = ((handler) => wrapNextRoute(handler, emitter, options));
|
|
10
7
|
wrap.flush = emitter.flush;
|
|
11
8
|
wrap.shutdown = emitter.shutdown;
|
|
@@ -18,7 +15,7 @@ function wrapNextRoute(handler, xray, options) {
|
|
|
18
15
|
};
|
|
19
16
|
}
|
|
20
17
|
export {
|
|
21
|
-
|
|
18
|
+
createCoreEmitter,
|
|
22
19
|
createEmitter,
|
|
23
20
|
getXrayContext,
|
|
24
21
|
wrapNextRoute
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { XrayEmitter,
|
|
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.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Next.js integration for Stainless X-ray request logging",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -20,12 +20,13 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@stainlessdev/xray-core": "0.4.0
|
|
24
|
-
"@stainlessdev/xray-fetch": "0.4.0
|
|
23
|
+
"@stainlessdev/xray-core": "0.4.0",
|
|
24
|
+
"@stainlessdev/xray-fetch": "0.4.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@opentelemetry/api": "^1.9.0",
|
|
28
28
|
"@opentelemetry/core": "^2.2.0",
|
|
29
|
+
"@opentelemetry/otlp-transformer": "^0.208.0",
|
|
29
30
|
"@opentelemetry/resources": "^2.2.0",
|
|
30
31
|
"@opentelemetry/sdk-trace-base": "^2.2.0",
|
|
31
32
|
"@opentelemetry/semantic-conventions": "^1.29.0",
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"peerDependencies": {
|
|
39
40
|
"@opentelemetry/api": "^1.9.0",
|
|
40
41
|
"@opentelemetry/core": "^2.2.0",
|
|
42
|
+
"@opentelemetry/otlp-transformer": "^0.208.0",
|
|
41
43
|
"@opentelemetry/resources": "^2.2.0",
|
|
42
44
|
"@opentelemetry/sdk-trace-base": "^2.2.0",
|
|
43
45
|
"@opentelemetry/semantic-conventions": "^1.29.0"
|