brakit 0.7.1 → 0.7.2
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/api.js +1 -1
- package/dist/bin/brakit.js +1 -1
- package/dist/runtime/index.js +34 -35
- package/package.json +1 -1
package/dist/api.js
CHANGED
package/dist/bin/brakit.js
CHANGED
|
@@ -693,7 +693,7 @@ import { resolve as resolve2 } from "path";
|
|
|
693
693
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
694
694
|
|
|
695
695
|
// src/index.ts
|
|
696
|
-
var VERSION = "0.7.
|
|
696
|
+
var VERSION = "0.7.2";
|
|
697
697
|
|
|
698
698
|
// src/cli/commands/install.ts
|
|
699
699
|
var IMPORT_LINE = `import "brakit";`;
|
package/dist/runtime/index.js
CHANGED
|
@@ -3669,7 +3669,7 @@ var init_src = __esm({
|
|
|
3669
3669
|
init_rules();
|
|
3670
3670
|
init_engine();
|
|
3671
3671
|
init_insights2();
|
|
3672
|
-
VERSION = "0.7.
|
|
3672
|
+
VERSION = "0.7.2";
|
|
3673
3673
|
}
|
|
3674
3674
|
});
|
|
3675
3675
|
|
|
@@ -6296,49 +6296,48 @@ function outgoingToIncoming(headers) {
|
|
|
6296
6296
|
function captureInProcess(req, res, requestId) {
|
|
6297
6297
|
const startTime = performance.now();
|
|
6298
6298
|
const method = req.method ?? "GET";
|
|
6299
|
-
const shouldCaptureBody = method !== "GET" && method !== "HEAD";
|
|
6300
|
-
const reqChunks = [];
|
|
6301
|
-
let reqSize = 0;
|
|
6302
|
-
if (shouldCaptureBody) {
|
|
6303
|
-
req.on("data", (chunk) => {
|
|
6304
|
-
if (reqSize < DEFAULT_MAX_BODY_CAPTURE) {
|
|
6305
|
-
reqChunks.push(chunk);
|
|
6306
|
-
reqSize += chunk.length;
|
|
6307
|
-
}
|
|
6308
|
-
});
|
|
6309
|
-
}
|
|
6310
6299
|
const resChunks = [];
|
|
6311
6300
|
let resSize = 0;
|
|
6312
6301
|
const originalWrite = res.write;
|
|
6313
6302
|
const originalEnd = res.end;
|
|
6314
|
-
res.write = function(
|
|
6315
|
-
|
|
6316
|
-
const
|
|
6317
|
-
|
|
6318
|
-
|
|
6303
|
+
res.write = function(...args) {
|
|
6304
|
+
try {
|
|
6305
|
+
const chunk = args[0];
|
|
6306
|
+
if (chunk != null && typeof chunk !== "function" && resSize < DEFAULT_MAX_BODY_CAPTURE) {
|
|
6307
|
+
const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
|
|
6308
|
+
resChunks.push(buf);
|
|
6309
|
+
resSize += buf.length;
|
|
6310
|
+
}
|
|
6311
|
+
} catch {
|
|
6319
6312
|
}
|
|
6320
|
-
return originalWrite.apply(this,
|
|
6313
|
+
return originalWrite.apply(this, args);
|
|
6321
6314
|
};
|
|
6322
6315
|
res.end = function(...args) {
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6316
|
+
try {
|
|
6317
|
+
const chunk = typeof args[0] !== "function" ? args[0] : void 0;
|
|
6318
|
+
if (chunk != null && resSize < DEFAULT_MAX_BODY_CAPTURE) {
|
|
6319
|
+
const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
|
|
6320
|
+
resChunks.push(buf);
|
|
6321
|
+
}
|
|
6322
|
+
} catch {
|
|
6327
6323
|
}
|
|
6328
6324
|
const result = originalEnd.apply(this, args);
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6325
|
+
try {
|
|
6326
|
+
defaultStore.capture({
|
|
6327
|
+
requestId,
|
|
6328
|
+
method,
|
|
6329
|
+
url: req.url ?? "/",
|
|
6330
|
+
requestHeaders: req.headers,
|
|
6331
|
+
requestBody: null,
|
|
6332
|
+
statusCode: res.statusCode,
|
|
6333
|
+
responseHeaders: outgoingToIncoming(res.getHeaders()),
|
|
6334
|
+
responseBody: resChunks.length > 0 ? Buffer.concat(resChunks) : null,
|
|
6335
|
+
responseContentType: String(res.getHeader("content-type") ?? ""),
|
|
6336
|
+
startTime,
|
|
6337
|
+
config: { maxBodyCapture: DEFAULT_MAX_BODY_CAPTURE }
|
|
6338
|
+
});
|
|
6339
|
+
} catch {
|
|
6340
|
+
}
|
|
6342
6341
|
return result;
|
|
6343
6342
|
};
|
|
6344
6343
|
}
|
package/package.json
CHANGED