@reqray/express 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ruslan Kryklyvyi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,14 @@
1
- # Temporary Holding Version
1
+ # @reqray/express
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Express adapter for Reqray.
4
+
5
+ Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request-inspection tool for
6
+ Node.js. It instruments HTTP, SQL, outgoing calls and cache on its own, shows
7
+ every request as a waterfall, and finds N+1 down to the file and the line.
8
+
9
+ Documentation, screenshots and a demo that runs with one command are in the
10
+ [main README](https://github.com/reqray/reqray#readme).
11
+
12
+ ## License
13
+
14
+ [MIT](https://github.com/reqray/reqray/blob/main/LICENSE)
package/dist/index.cjs ADDED
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ recordFailure: () => recordFailure,
24
+ reqray: () => reqray
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
28
+ // ../../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.26_supports-color@7.2.0_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js
29
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
30
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
31
+
32
+ // src/index.ts
33
+ var import_node_module = require("module");
34
+ var import_node_path = require("path");
35
+ var import_core = require("@reqray/core");
36
+ var import_panel = require("@reqray/core/panel");
37
+ var import_store_memory = require("@reqray/store-memory");
38
+ function expressVersion() {
39
+ try {
40
+ const manifest = (0, import_node_module.createRequire)(importMetaUrl)("express/package.json");
41
+ return typeof manifest.version === "string" ? manifest.version : void 0;
42
+ } catch {
43
+ return void 0;
44
+ }
45
+ }
46
+ function dashboardAssets() {
47
+ try {
48
+ const manifest = (0, import_node_module.createRequire)(importMetaUrl).resolve("@reqray/dashboard/package.json");
49
+ return (0, import_node_path.join)((0, import_node_path.dirname)(manifest), "dist");
50
+ } catch {
51
+ return void 0;
52
+ }
53
+ }
54
+ function headerValue(raw) {
55
+ if (typeof raw === "string") return raw;
56
+ return Array.isArray(raw) ? raw[0] ?? null : null;
57
+ }
58
+ function splitQuery(url) {
59
+ const index = url.indexOf("?");
60
+ return index === -1 ? [url, null] : [url.slice(0, index), url.slice(index + 1)];
61
+ }
62
+ function bodyAmong(args) {
63
+ return args.length > 1 && typeof args[0] === "number" ? args[1] : args[0];
64
+ }
65
+ var FAILURE = /* @__PURE__ */ Symbol.for("reqray.express.failure");
66
+ function reqray(init = {}) {
67
+ (0, import_core.markAdapterActive)();
68
+ (0, import_core.reportInstrumentation)({
69
+ name: "express",
70
+ version: expressVersion(),
71
+ captures: "requests",
72
+ ok: true
73
+ });
74
+ const runtime = (0, import_core.createReqray)({ ...init, transport: init.transport ?? (0, import_store_memory.memoryTransport)() });
75
+ if (!runtime.options.enabled) {
76
+ return {
77
+ runtime,
78
+ middleware: (_request, _response, next) => next(),
79
+ errorHandler: (error, _request, _response, next) => next(error)
80
+ };
81
+ }
82
+ const source = (0, import_panel.panelSourceFor)(runtime.transport, runtime.options);
83
+ const panel = source ? (0, import_panel.createPanelHandler)({ source, options: runtime.options, assetsDir: dashboardAssets() }) : null;
84
+ const middleware = (req, res, next) => {
85
+ if (panel?.(req, res)) return;
86
+ const [path, query] = splitQuery(req.originalUrl || req.url);
87
+ const scope = runtime.begin({
88
+ method: req.method,
89
+ path,
90
+ replayId: headerValue(req.headers[import_core.REPLAY_HEADER])
91
+ });
92
+ if (!scope) {
93
+ next();
94
+ return;
95
+ }
96
+ let responseBody;
97
+ const originalJson = res.json;
98
+ const originalSend = res.send;
99
+ res.json = function reqrayJson(...args) {
100
+ responseBody = bodyAmong(args);
101
+ return originalJson.apply(this, args);
102
+ };
103
+ res.send = function reqraySend(...args) {
104
+ if (responseBody === void 0) responseBody = bodyAmong(args);
105
+ return originalSend.apply(this, args);
106
+ };
107
+ const handlerSpan = scope.openSpan("handler", `${req.method} ${path}`);
108
+ let finished = false;
109
+ const complete = () => {
110
+ if (finished) return;
111
+ finished = true;
112
+ try {
113
+ scope.closeSpan(handlerSpan);
114
+ runtime.finish(scope, {
115
+ status: res.statusCode,
116
+ query,
117
+ requestHeaders: req.headers,
118
+ responseHeaders: res.getHeaders(),
119
+ requestBody: req.body,
120
+ responseBody,
121
+ error: res[FAILURE]
122
+ });
123
+ } catch (error) {
124
+ const reason = error instanceof Error ? error.message : String(error);
125
+ (0, import_core.warnOnce)("express.finish", `request not recorded: ${reason}`);
126
+ }
127
+ };
128
+ res.on("finish", complete);
129
+ res.on("close", complete);
130
+ (0, import_core.runInScope)(scope, () => {
131
+ next();
132
+ });
133
+ };
134
+ const errorHandler = (error, _req, res, next) => {
135
+ res[FAILURE] = error;
136
+ next(error);
137
+ };
138
+ return { runtime, middleware, errorHandler };
139
+ }
140
+ function recordFailure(response, error) {
141
+ if (response !== null && typeof response === "object") {
142
+ response[FAILURE] = error;
143
+ }
144
+ }
145
+ // Annotate the CommonJS export names for ESM import in node:
146
+ 0 && (module.exports = {
147
+ recordFailure,
148
+ reqray
149
+ });
150
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../../../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.26_supports-color@7.2.0_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js"],"sourcesContent":["/**\n * `@reqray/express` — Express adapter.\n *\n * Wraps the handling of each request in a `RequestScope` so driver\n * instrumentations have somewhere to put their spans, and hands the request to\n * the transport once the response is done.\n *\n * Application behaviour is not changed in any way: `res.json`/`res.send` are\n * wrapped transparently, errors propagate exactly as before.\n */\n\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport {\n createReqray,\n markAdapterActive,\n REPLAY_HEADER,\n type Reqray,\n type ReqrayInit,\n reportInstrumentation,\n runInScope,\n warnOnce,\n} from '@reqray/core';\nimport { createPanelHandler, panelSourceFor } from '@reqray/core/panel';\nimport { memoryTransport } from '@reqray/store-memory';\nimport type { ErrorRequestHandler, NextFunction, Request, RequestHandler, Response } from 'express';\n\n/** Express version, when it can be resolved from the application. */\nfunction expressVersion(): string | undefined {\n try {\n const manifest = createRequire(import.meta.url)('express/package.json') as {\n version?: unknown;\n };\n return typeof manifest.version === 'string' ? manifest.version : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Directory with the built dashboard.\n *\n * Resolved optionally: without `@reqray/dashboard` installed the API still\n * works, only the UI route reports that the panel is incomplete.\n */\nfunction dashboardAssets(): string | undefined {\n try {\n const manifest = createRequire(import.meta.url).resolve('@reqray/dashboard/package.json');\n return join(dirname(manifest), 'dist');\n } catch {\n return undefined;\n }\n}\n\n/** Handlers that have to be installed into the application. */\nexport interface ReqrayExpress {\n /** Runtime: transport, options. Needed by the panel and by tests. */\n readonly runtime: Reqray;\n /** Installed **before** the routes. */\n readonly middleware: RequestHandler;\n /**\n * Installed **after** the routes.\n *\n * Optional: without it requests are still recorded with their status. It is\n * what puts the exception object itself into the record — Express hands the\n * exception only to an error-handling middleware, so it cannot be captured\n * any earlier.\n */\n readonly errorHandler: ErrorRequestHandler;\n}\n\nfunction headerValue(raw: string | string[] | undefined): string | null {\n if (typeof raw === 'string') return raw;\n return Array.isArray(raw) ? (raw[0] ?? null) : null;\n}\n\nfunction splitQuery(url: string): [path: string, query: string | null] {\n const index = url.indexOf('?');\n return index === -1 ? [url, null] : [url.slice(0, index), url.slice(index + 1)];\n}\n\n/** Key the exception travels under from the error handler to finalization. */\n/**\n * The body among the arguments of `res.json` / `res.send`.\n *\n * One argument is the body. Two is Express 4's deprecated `(status, body)`,\n * where the status comes first.\n */\nfunction bodyAmong(args: readonly unknown[]): unknown {\n return args.length > 1 && typeof args[0] === 'number' ? args[1] : args[0];\n}\n\nconst FAILURE = Symbol.for('reqray.express.failure');\n\ninterface WithFailure {\n [FAILURE]?: unknown;\n}\n\n/**\n * Creates the Reqray handlers for Express.\n *\n * @example\n * ```ts\n * const inspector = reqray();\n * app.use(inspector.middleware);\n * // ...routes...\n * app.use(inspector.errorHandler);\n * ```\n */\nexport function reqray(init: ReqrayInit = {}): ReqrayExpress {\n // The standalone mode in @reqray/register stands down once an adapter exists.\n markAdapterActive();\n reportInstrumentation({\n name: 'express',\n version: expressVersion(),\n captures: 'requests',\n ok: true,\n });\n\n const runtime = createReqray({ ...init, transport: init.transport ?? memoryTransport() });\n\n // A disabled Reqray costs nothing per request, and the only way to mean that\n // literally is to hand back pass-throughs. A check inside the middleware\n // would still allocate the argument object it is checked from.\n if (!runtime.options.enabled) {\n return {\n runtime,\n middleware: (_request: Request, _response: Response, next: NextFunction) => next(),\n errorHandler: (error: unknown, _request: Request, _response: Response, next: NextFunction) =>\n next(error),\n };\n }\n\n const source = panelSourceFor(runtime.transport, runtime.options);\n const panel = source\n ? createPanelHandler({ source, options: runtime.options, assetsDir: dashboardAssets() })\n : null;\n\n const middleware: RequestHandler = (req: Request, res: Response, next: NextFunction) => {\n // The panel handler goes first: it answers by itself, so its own requests\n // never show up in the list it displays.\n if (panel?.(req, res)) return;\n\n const [path, query] = splitQuery(req.originalUrl || req.url);\n const scope = runtime.begin({\n method: req.method,\n path,\n replayId: headerValue(req.headers[REPLAY_HEADER]),\n });\n // Reqray is disabled — do exactly nothing.\n if (!scope) {\n next();\n return;\n }\n\n let responseBody: unknown;\n const originalJson = res.json;\n const originalSend = res.send;\n\n // Every argument goes through as it came. Express 4 still takes a status\n // beside the body — `res.json(500, { error })` — and a wrapper that\n // forwards only the first turns that into a 200 whose body is `500`.\n res.json = function reqrayJson(this: Response, ...args: unknown[]) {\n responseBody = bodyAmong(args);\n return (originalJson as (...inner: unknown[]) => Response).apply(this, args);\n } as Response['json'];\n\n res.send = function reqraySend(this: Response, ...args: unknown[]) {\n if (responseBody === undefined) responseBody = bodyAmong(args);\n return (originalSend as (...inner: unknown[]) => Response).apply(this, args);\n } as Response['send'];\n\n // One span for the whole handling: SQL, cache and outgoing HTTP nest into\n // it and get the right depth in the waterfall. Separate spans per\n // middleware would require patching the Express router — that is v0.2.\n const handlerSpan = scope.openSpan('handler', `${req.method} ${path}`);\n\n let finished = false;\n const complete = (): void => {\n if (finished) return;\n finished = true;\n try {\n scope.closeSpan(handlerSpan);\n runtime.finish(scope, {\n status: res.statusCode,\n query,\n requestHeaders: req.headers,\n responseHeaders: res.getHeaders(),\n requestBody: (req as Request & { body?: unknown }).body,\n responseBody,\n error: (res as Response & WithFailure)[FAILURE],\n });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n warnOnce('express.finish', `request not recorded: ${reason}`);\n }\n };\n\n // Both events: `close` catches requests aborted by the client, for which\n // `finish` never fires.\n res.on('finish', complete);\n res.on('close', complete);\n\n runInScope(scope, () => {\n next();\n });\n };\n\n const errorHandler: ErrorRequestHandler = (error, _req, res, next) => {\n (res as Response & WithFailure)[FAILURE] = error;\n // The error is neither replaced nor swallowed — it is passed on as it was.\n next(error);\n };\n\n return { runtime, middleware, errorHandler };\n}\n\n/**\n * Stamps the exception onto the response the way {@link ReqrayExpress.errorHandler}\n * does.\n *\n * For frameworks on top of Express (NestJS) that intercept exceptions\n * themselves, so an Express error handler never sees them. Safe to call with\n * anything — a foreign object is simply left alone.\n */\nexport function recordFailure(response: unknown, error: unknown): void {\n if (response !== null && typeof response === 'object') {\n (response as WithFailure)[FAILURE] = error;\n }\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase()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AI,iBAAiB,OAAW,gBAAe,UAAU,IAAI;AAC7D,aAAQ,aAAmD,MAAM,MAAM,IAAI;AAAA,IAC7E;AAKA,UAAM,cAAc,MAAM,SAAS,WAAW,GAAG,IAAI,MAAM,IAAI,IAAI,EAAE;AAErE,QAAI,WAAW;AACf,UAAM,WAAW,MAAY;AAC3B,UAAI,SAAU;AACd,iBAAW;AACX,UAAI;AACF,cAAM,UAAU,WAAW;AAC3B,gBAAQ,OAAO,OAAO;AAAA,UACpB,QAAQ,IAAI;AAAA,UACZ;AAAA,UACA,gBAAgB,IAAI;AAAA,UACpB,iBAAiB,IAAI,WAAW;AAAA,UAChC,aAAc,IAAqC;AAAA,UACnD;AAAA,UACA,OAAQ,IAA+B,OAAO;AAAA,QAChD,CAAC;AAAA,MACH,SAAS,OAAO;AACd,cAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACpE,kCAAS,kBAAkB,yBAAyB,MAAM,EAAE;AAAA,MAC9D;AAAA,IACF;AAIA,QAAI,GAAG,UAAU,QAAQ;AACzB,QAAI,GAAG,SAAS,QAAQ;AAExB,gCAAW,OAAO,MAAM;AACtB,WAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,QAAM,eAAoC,CAAC,OAAO,MAAM,KAAK,SAAS;AACpE,IAAC,IAA+B,OAAO,IAAI;AAE3C,SAAK,KAAK;AAAA,EACZ;AAEA,SAAO,EAAE,SAAS,YAAY,aAAa;AAC7C;AAUO,SAAS,cAAc,UAAmB,OAAsB;AACrE,MAAI,aAAa,QAAQ,OAAO,aAAa,UAAU;AACrD,IAAC,SAAyB,OAAO,IAAI;AAAA,EACvC;AACF;","names":[]}
@@ -0,0 +1,53 @@
1
+ import { Reqray, ReqrayInit } from '@reqray/core';
2
+ import { RequestHandler, ErrorRequestHandler } from 'express';
3
+
4
+ /**
5
+ * `@reqray/express` — Express adapter.
6
+ *
7
+ * Wraps the handling of each request in a `RequestScope` so driver
8
+ * instrumentations have somewhere to put their spans, and hands the request to
9
+ * the transport once the response is done.
10
+ *
11
+ * Application behaviour is not changed in any way: `res.json`/`res.send` are
12
+ * wrapped transparently, errors propagate exactly as before.
13
+ */
14
+
15
+ /** Handlers that have to be installed into the application. */
16
+ interface ReqrayExpress {
17
+ /** Runtime: transport, options. Needed by the panel and by tests. */
18
+ readonly runtime: Reqray;
19
+ /** Installed **before** the routes. */
20
+ readonly middleware: RequestHandler;
21
+ /**
22
+ * Installed **after** the routes.
23
+ *
24
+ * Optional: without it requests are still recorded with their status. It is
25
+ * what puts the exception object itself into the record — Express hands the
26
+ * exception only to an error-handling middleware, so it cannot be captured
27
+ * any earlier.
28
+ */
29
+ readonly errorHandler: ErrorRequestHandler;
30
+ }
31
+ /**
32
+ * Creates the Reqray handlers for Express.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const inspector = reqray();
37
+ * app.use(inspector.middleware);
38
+ * // ...routes...
39
+ * app.use(inspector.errorHandler);
40
+ * ```
41
+ */
42
+ declare function reqray(init?: ReqrayInit): ReqrayExpress;
43
+ /**
44
+ * Stamps the exception onto the response the way {@link ReqrayExpress.errorHandler}
45
+ * does.
46
+ *
47
+ * For frameworks on top of Express (NestJS) that intercept exceptions
48
+ * themselves, so an Express error handler never sees them. Safe to call with
49
+ * anything — a foreign object is simply left alone.
50
+ */
51
+ declare function recordFailure(response: unknown, error: unknown): void;
52
+
53
+ export { type ReqrayExpress, recordFailure, reqray };
@@ -0,0 +1,53 @@
1
+ import { Reqray, ReqrayInit } from '@reqray/core';
2
+ import { RequestHandler, ErrorRequestHandler } from 'express';
3
+
4
+ /**
5
+ * `@reqray/express` — Express adapter.
6
+ *
7
+ * Wraps the handling of each request in a `RequestScope` so driver
8
+ * instrumentations have somewhere to put their spans, and hands the request to
9
+ * the transport once the response is done.
10
+ *
11
+ * Application behaviour is not changed in any way: `res.json`/`res.send` are
12
+ * wrapped transparently, errors propagate exactly as before.
13
+ */
14
+
15
+ /** Handlers that have to be installed into the application. */
16
+ interface ReqrayExpress {
17
+ /** Runtime: transport, options. Needed by the panel and by tests. */
18
+ readonly runtime: Reqray;
19
+ /** Installed **before** the routes. */
20
+ readonly middleware: RequestHandler;
21
+ /**
22
+ * Installed **after** the routes.
23
+ *
24
+ * Optional: without it requests are still recorded with their status. It is
25
+ * what puts the exception object itself into the record — Express hands the
26
+ * exception only to an error-handling middleware, so it cannot be captured
27
+ * any earlier.
28
+ */
29
+ readonly errorHandler: ErrorRequestHandler;
30
+ }
31
+ /**
32
+ * Creates the Reqray handlers for Express.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const inspector = reqray();
37
+ * app.use(inspector.middleware);
38
+ * // ...routes...
39
+ * app.use(inspector.errorHandler);
40
+ * ```
41
+ */
42
+ declare function reqray(init?: ReqrayInit): ReqrayExpress;
43
+ /**
44
+ * Stamps the exception onto the response the way {@link ReqrayExpress.errorHandler}
45
+ * does.
46
+ *
47
+ * For frameworks on top of Express (NestJS) that intercept exceptions
48
+ * themselves, so an Express error handler never sees them. Safe to call with
49
+ * anything — a foreign object is simply left alone.
50
+ */
51
+ declare function recordFailure(response: unknown, error: unknown): void;
52
+
53
+ export { type ReqrayExpress, recordFailure, reqray };
package/dist/index.js ADDED
@@ -0,0 +1,125 @@
1
+ // src/index.ts
2
+ import { createRequire } from "module";
3
+ import { dirname, join } from "path";
4
+ import {
5
+ createReqray,
6
+ markAdapterActive,
7
+ REPLAY_HEADER,
8
+ reportInstrumentation,
9
+ runInScope,
10
+ warnOnce
11
+ } from "@reqray/core";
12
+ import { createPanelHandler, panelSourceFor } from "@reqray/core/panel";
13
+ import { memoryTransport } from "@reqray/store-memory";
14
+ function expressVersion() {
15
+ try {
16
+ const manifest = createRequire(import.meta.url)("express/package.json");
17
+ return typeof manifest.version === "string" ? manifest.version : void 0;
18
+ } catch {
19
+ return void 0;
20
+ }
21
+ }
22
+ function dashboardAssets() {
23
+ try {
24
+ const manifest = createRequire(import.meta.url).resolve("@reqray/dashboard/package.json");
25
+ return join(dirname(manifest), "dist");
26
+ } catch {
27
+ return void 0;
28
+ }
29
+ }
30
+ function headerValue(raw) {
31
+ if (typeof raw === "string") return raw;
32
+ return Array.isArray(raw) ? raw[0] ?? null : null;
33
+ }
34
+ function splitQuery(url) {
35
+ const index = url.indexOf("?");
36
+ return index === -1 ? [url, null] : [url.slice(0, index), url.slice(index + 1)];
37
+ }
38
+ function bodyAmong(args) {
39
+ return args.length > 1 && typeof args[0] === "number" ? args[1] : args[0];
40
+ }
41
+ var FAILURE = /* @__PURE__ */ Symbol.for("reqray.express.failure");
42
+ function reqray(init = {}) {
43
+ markAdapterActive();
44
+ reportInstrumentation({
45
+ name: "express",
46
+ version: expressVersion(),
47
+ captures: "requests",
48
+ ok: true
49
+ });
50
+ const runtime = createReqray({ ...init, transport: init.transport ?? memoryTransport() });
51
+ if (!runtime.options.enabled) {
52
+ return {
53
+ runtime,
54
+ middleware: (_request, _response, next) => next(),
55
+ errorHandler: (error, _request, _response, next) => next(error)
56
+ };
57
+ }
58
+ const source = panelSourceFor(runtime.transport, runtime.options);
59
+ const panel = source ? createPanelHandler({ source, options: runtime.options, assetsDir: dashboardAssets() }) : null;
60
+ const middleware = (req, res, next) => {
61
+ if (panel?.(req, res)) return;
62
+ const [path, query] = splitQuery(req.originalUrl || req.url);
63
+ const scope = runtime.begin({
64
+ method: req.method,
65
+ path,
66
+ replayId: headerValue(req.headers[REPLAY_HEADER])
67
+ });
68
+ if (!scope) {
69
+ next();
70
+ return;
71
+ }
72
+ let responseBody;
73
+ const originalJson = res.json;
74
+ const originalSend = res.send;
75
+ res.json = function reqrayJson(...args) {
76
+ responseBody = bodyAmong(args);
77
+ return originalJson.apply(this, args);
78
+ };
79
+ res.send = function reqraySend(...args) {
80
+ if (responseBody === void 0) responseBody = bodyAmong(args);
81
+ return originalSend.apply(this, args);
82
+ };
83
+ const handlerSpan = scope.openSpan("handler", `${req.method} ${path}`);
84
+ let finished = false;
85
+ const complete = () => {
86
+ if (finished) return;
87
+ finished = true;
88
+ try {
89
+ scope.closeSpan(handlerSpan);
90
+ runtime.finish(scope, {
91
+ status: res.statusCode,
92
+ query,
93
+ requestHeaders: req.headers,
94
+ responseHeaders: res.getHeaders(),
95
+ requestBody: req.body,
96
+ responseBody,
97
+ error: res[FAILURE]
98
+ });
99
+ } catch (error) {
100
+ const reason = error instanceof Error ? error.message : String(error);
101
+ warnOnce("express.finish", `request not recorded: ${reason}`);
102
+ }
103
+ };
104
+ res.on("finish", complete);
105
+ res.on("close", complete);
106
+ runInScope(scope, () => {
107
+ next();
108
+ });
109
+ };
110
+ const errorHandler = (error, _req, res, next) => {
111
+ res[FAILURE] = error;
112
+ next(error);
113
+ };
114
+ return { runtime, middleware, errorHandler };
115
+ }
116
+ function recordFailure(response, error) {
117
+ if (response !== null && typeof response === "object") {
118
+ response[FAILURE] = error;
119
+ }
120
+ }
121
+ export {
122
+ recordFailure,
123
+ reqray
124
+ };
125
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@reqray/express` — Express adapter.\n *\n * Wraps the handling of each request in a `RequestScope` so driver\n * instrumentations have somewhere to put their spans, and hands the request to\n * the transport once the response is done.\n *\n * Application behaviour is not changed in any way: `res.json`/`res.send` are\n * wrapped transparently, errors propagate exactly as before.\n */\n\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport {\n createReqray,\n markAdapterActive,\n REPLAY_HEADER,\n type Reqray,\n type ReqrayInit,\n reportInstrumentation,\n runInScope,\n warnOnce,\n} from '@reqray/core';\nimport { createPanelHandler, panelSourceFor } from '@reqray/core/panel';\nimport { memoryTransport } from '@reqray/store-memory';\nimport type { ErrorRequestHandler, NextFunction, Request, RequestHandler, Response } from 'express';\n\n/** Express version, when it can be resolved from the application. */\nfunction expressVersion(): string | undefined {\n try {\n const manifest = createRequire(import.meta.url)('express/package.json') as {\n version?: unknown;\n };\n return typeof manifest.version === 'string' ? manifest.version : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Directory with the built dashboard.\n *\n * Resolved optionally: without `@reqray/dashboard` installed the API still\n * works, only the UI route reports that the panel is incomplete.\n */\nfunction dashboardAssets(): string | undefined {\n try {\n const manifest = createRequire(import.meta.url).resolve('@reqray/dashboard/package.json');\n return join(dirname(manifest), 'dist');\n } catch {\n return undefined;\n }\n}\n\n/** Handlers that have to be installed into the application. */\nexport interface ReqrayExpress {\n /** Runtime: transport, options. Needed by the panel and by tests. */\n readonly runtime: Reqray;\n /** Installed **before** the routes. */\n readonly middleware: RequestHandler;\n /**\n * Installed **after** the routes.\n *\n * Optional: without it requests are still recorded with their status. It is\n * what puts the exception object itself into the record — Express hands the\n * exception only to an error-handling middleware, so it cannot be captured\n * any earlier.\n */\n readonly errorHandler: ErrorRequestHandler;\n}\n\nfunction headerValue(raw: string | string[] | undefined): string | null {\n if (typeof raw === 'string') return raw;\n return Array.isArray(raw) ? (raw[0] ?? null) : null;\n}\n\nfunction splitQuery(url: string): [path: string, query: string | null] {\n const index = url.indexOf('?');\n return index === -1 ? [url, null] : [url.slice(0, index), url.slice(index + 1)];\n}\n\n/** Key the exception travels under from the error handler to finalization. */\n/**\n * The body among the arguments of `res.json` / `res.send`.\n *\n * One argument is the body. Two is Express 4's deprecated `(status, body)`,\n * where the status comes first.\n */\nfunction bodyAmong(args: readonly unknown[]): unknown {\n return args.length > 1 && typeof args[0] === 'number' ? args[1] : args[0];\n}\n\nconst FAILURE = Symbol.for('reqray.express.failure');\n\ninterface WithFailure {\n [FAILURE]?: unknown;\n}\n\n/**\n * Creates the Reqray handlers for Express.\n *\n * @example\n * ```ts\n * const inspector = reqray();\n * app.use(inspector.middleware);\n * // ...routes...\n * app.use(inspector.errorHandler);\n * ```\n */\nexport function reqray(init: ReqrayInit = {}): ReqrayExpress {\n // The standalone mode in @reqray/register stands down once an adapter exists.\n markAdapterActive();\n reportInstrumentation({\n name: 'express',\n version: expressVersion(),\n captures: 'requests',\n ok: true,\n });\n\n const runtime = createReqray({ ...init, transport: init.transport ?? memoryTransport() });\n\n // A disabled Reqray costs nothing per request, and the only way to mean that\n // literally is to hand back pass-throughs. A check inside the middleware\n // would still allocate the argument object it is checked from.\n if (!runtime.options.enabled) {\n return {\n runtime,\n middleware: (_request: Request, _response: Response, next: NextFunction) => next(),\n errorHandler: (error: unknown, _request: Request, _response: Response, next: NextFunction) =>\n next(error),\n };\n }\n\n const source = panelSourceFor(runtime.transport, runtime.options);\n const panel = source\n ? createPanelHandler({ source, options: runtime.options, assetsDir: dashboardAssets() })\n : null;\n\n const middleware: RequestHandler = (req: Request, res: Response, next: NextFunction) => {\n // The panel handler goes first: it answers by itself, so its own requests\n // never show up in the list it displays.\n if (panel?.(req, res)) return;\n\n const [path, query] = splitQuery(req.originalUrl || req.url);\n const scope = runtime.begin({\n method: req.method,\n path,\n replayId: headerValue(req.headers[REPLAY_HEADER]),\n });\n // Reqray is disabled — do exactly nothing.\n if (!scope) {\n next();\n return;\n }\n\n let responseBody: unknown;\n const originalJson = res.json;\n const originalSend = res.send;\n\n // Every argument goes through as it came. Express 4 still takes a status\n // beside the body — `res.json(500, { error })` — and a wrapper that\n // forwards only the first turns that into a 200 whose body is `500`.\n res.json = function reqrayJson(this: Response, ...args: unknown[]) {\n responseBody = bodyAmong(args);\n return (originalJson as (...inner: unknown[]) => Response).apply(this, args);\n } as Response['json'];\n\n res.send = function reqraySend(this: Response, ...args: unknown[]) {\n if (responseBody === undefined) responseBody = bodyAmong(args);\n return (originalSend as (...inner: unknown[]) => Response).apply(this, args);\n } as Response['send'];\n\n // One span for the whole handling: SQL, cache and outgoing HTTP nest into\n // it and get the right depth in the waterfall. Separate spans per\n // middleware would require patching the Express router — that is v0.2.\n const handlerSpan = scope.openSpan('handler', `${req.method} ${path}`);\n\n let finished = false;\n const complete = (): void => {\n if (finished) return;\n finished = true;\n try {\n scope.closeSpan(handlerSpan);\n runtime.finish(scope, {\n status: res.statusCode,\n query,\n requestHeaders: req.headers,\n responseHeaders: res.getHeaders(),\n requestBody: (req as Request & { body?: unknown }).body,\n responseBody,\n error: (res as Response & WithFailure)[FAILURE],\n });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n warnOnce('express.finish', `request not recorded: ${reason}`);\n }\n };\n\n // Both events: `close` catches requests aborted by the client, for which\n // `finish` never fires.\n res.on('finish', complete);\n res.on('close', complete);\n\n runInScope(scope, () => {\n next();\n });\n };\n\n const errorHandler: ErrorRequestHandler = (error, _req, res, next) => {\n (res as Response & WithFailure)[FAILURE] = error;\n // The error is neither replaced nor swallowed — it is passed on as it was.\n next(error);\n };\n\n return { runtime, middleware, errorHandler };\n}\n\n/**\n * Stamps the exception onto the response the way {@link ReqrayExpress.errorHandler}\n * does.\n *\n * For frameworks on top of Express (NestJS) that intercept exceptions\n * themselves, so an Express error handler never sees them. Safe to call with\n * anything — a foreign object is simply left alone.\n */\nexport function recordFailure(response: unknown, error: unknown): void {\n if (response !== null && typeof response === 'object') {\n (response as WithFailure)[FAILURE] = error;\n }\n}\n"],"mappings":";AAWA,SAAS,qBAAqB;AAC9B,SAAS,SAAS,YAAY;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB,sBAAsB;AACnD,SAAS,uBAAuB;AAIhC,SAAS,iBAAqC;AAC5C,MAAI;AACF,UAAM,WAAW,cAAc,YAAY,GAAG,EAAE,sBAAsB;AAGtE,WAAO,OAAO,SAAS,YAAY,WAAW,SAAS,UAAU;AAAA,EACnE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAQA,SAAS,kBAAsC;AAC7C,MAAI;AACF,UAAM,WAAW,cAAc,YAAY,GAAG,EAAE,QAAQ,gCAAgC;AACxF,WAAO,KAAK,QAAQ,QAAQ,GAAG,MAAM;AAAA,EACvC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAmBA,SAAS,YAAY,KAAmD;AACtE,MAAI,OAAO,QAAQ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SAAS,YAAY,aAAa;AAC7C;AAUO,SAAS,cAAc,UAAmB,OAAsB;AACrE,MAAI,aAAa,QAAQ,OAAO,aAAa,UAAU;AACrD,IAAC,SAAyB,OAAO,IAAI;AAAA,EACvC;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,74 @@
1
1
  {
2
2
  "name": "@reqray/express",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Express adapter for Reqray.",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "nodejs",
8
+ "debugging",
9
+ "profiling",
10
+ "n+1",
11
+ "sql",
12
+ "observability",
13
+ "devtools",
14
+ "fastify",
15
+ "express",
16
+ "nestjs"
17
+ ],
18
+ "homepage": "https://github.com/reqray/reqray#readme",
19
+ "bugs": "https://github.com/reqray/reqray/issues",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/reqray/reqray.git",
23
+ "directory": "packages/express"
24
+ },
25
+ "type": "module",
26
+ "engines": {
27
+ "node": ">=20"
28
+ },
29
+ "exports": {
30
+ ".": {
31
+ "import": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "require": {
36
+ "types": "./dist/index.d.cts",
37
+ "default": "./dist/index.cjs"
38
+ }
39
+ }
40
+ },
41
+ "main": "./dist/index.cjs",
42
+ "module": "./dist/index.js",
43
+ "types": "./dist/index.d.ts",
44
+ "files": [
45
+ "dist"
46
+ ],
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "dependencies": {
51
+ "@reqray/core": "^0.1.0",
52
+ "@reqray/dashboard": "^0.1.0",
53
+ "@reqray/store-memory": "^0.1.0"
54
+ },
55
+ "peerDependencies": {
56
+ "express": "^4 || ^5"
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "^26.2.0",
60
+ "tsup": "^8.5.1",
61
+ "typescript": "^6.0.3",
62
+ "@types/express": "^5.0.6",
63
+ "express": "^5.2.1"
64
+ },
65
+ "peerDependenciesMeta": {
66
+ "express": {
67
+ "optional": true
68
+ }
69
+ },
70
+ "scripts": {
71
+ "build": "tsup",
72
+ "typecheck": "tsc --noEmit"
73
+ }
6
74
  }