@infersec/conduit 1.108.0 → 1.109.1
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/cli.js +29 -0
- package/dist/cli.sea.cjs +29 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -69402,6 +69402,7 @@ function validateAndExtract(type, data, schemas) {
|
|
|
69402
69402
|
function containsStatusOnly(payload) {
|
|
69403
69403
|
return !!payload && typeof payload === "object" && "statusText" in payload;
|
|
69404
69404
|
}
|
|
69405
|
+
const KEEPALIVE_INTERVAL_MS = 15_000;
|
|
69405
69406
|
function sendTextStreamResponse({ logger, res, stream }) {
|
|
69406
69407
|
const failStream = (error) => {
|
|
69407
69408
|
if (res.writableEnded || res.destroyed)
|
|
@@ -69427,10 +69428,38 @@ function sendTextStreamResponse({ logger, res, stream }) {
|
|
|
69427
69428
|
})}\n\n`);
|
|
69428
69429
|
res.end();
|
|
69429
69430
|
};
|
|
69431
|
+
let keepalive = null;
|
|
69432
|
+
let streamEnded = false;
|
|
69433
|
+
const stopKeepalive = () => {
|
|
69434
|
+
if (keepalive !== null) {
|
|
69435
|
+
clearInterval(keepalive);
|
|
69436
|
+
keepalive = null;
|
|
69437
|
+
}
|
|
69438
|
+
};
|
|
69439
|
+
res.on("close", stopKeepalive);
|
|
69440
|
+
res.flushHeaders();
|
|
69441
|
+
stream.on("close", () => {
|
|
69442
|
+
stopKeepalive();
|
|
69443
|
+
if (!streamEnded && !res.writableEnded && !res.destroyed) {
|
|
69444
|
+
failStream(new Error("Upstream stream closed prematurely"));
|
|
69445
|
+
}
|
|
69446
|
+
});
|
|
69447
|
+
stream.on("end", () => {
|
|
69448
|
+
streamEnded = true;
|
|
69449
|
+
stopKeepalive();
|
|
69450
|
+
});
|
|
69430
69451
|
stream.on("error", error => {
|
|
69452
|
+
stopKeepalive();
|
|
69431
69453
|
failStream(error instanceof Error ? error : new Error(String(error)));
|
|
69432
69454
|
});
|
|
69433
69455
|
stream.pipe(res);
|
|
69456
|
+
keepalive = setInterval(() => {
|
|
69457
|
+
if (res.writableEnded || res.destroyed) {
|
|
69458
|
+
stopKeepalive();
|
|
69459
|
+
return;
|
|
69460
|
+
}
|
|
69461
|
+
res.write(": keepalive\n\n");
|
|
69462
|
+
}, KEEPALIVE_INTERVAL_MS);
|
|
69434
69463
|
}
|
|
69435
69464
|
function implementSingleEndpoint({ endpoint, handler, logger, method, mount, route }) {
|
|
69436
69465
|
const expressRoute = getHTTPMethod(mount, method);
|
package/dist/cli.sea.cjs
CHANGED
|
@@ -69417,6 +69417,7 @@ function validateAndExtract(type, data, schemas) {
|
|
|
69417
69417
|
function containsStatusOnly(payload) {
|
|
69418
69418
|
return !!payload && typeof payload === "object" && "statusText" in payload;
|
|
69419
69419
|
}
|
|
69420
|
+
const KEEPALIVE_INTERVAL_MS = 15_000;
|
|
69420
69421
|
function sendTextStreamResponse({ logger, res, stream }) {
|
|
69421
69422
|
const failStream = (error) => {
|
|
69422
69423
|
if (res.writableEnded || res.destroyed)
|
|
@@ -69442,10 +69443,38 @@ function sendTextStreamResponse({ logger, res, stream }) {
|
|
|
69442
69443
|
})}\n\n`);
|
|
69443
69444
|
res.end();
|
|
69444
69445
|
};
|
|
69446
|
+
let keepalive = null;
|
|
69447
|
+
let streamEnded = false;
|
|
69448
|
+
const stopKeepalive = () => {
|
|
69449
|
+
if (keepalive !== null) {
|
|
69450
|
+
clearInterval(keepalive);
|
|
69451
|
+
keepalive = null;
|
|
69452
|
+
}
|
|
69453
|
+
};
|
|
69454
|
+
res.on("close", stopKeepalive);
|
|
69455
|
+
res.flushHeaders();
|
|
69456
|
+
stream.on("close", () => {
|
|
69457
|
+
stopKeepalive();
|
|
69458
|
+
if (!streamEnded && !res.writableEnded && !res.destroyed) {
|
|
69459
|
+
failStream(new Error("Upstream stream closed prematurely"));
|
|
69460
|
+
}
|
|
69461
|
+
});
|
|
69462
|
+
stream.on("end", () => {
|
|
69463
|
+
streamEnded = true;
|
|
69464
|
+
stopKeepalive();
|
|
69465
|
+
});
|
|
69445
69466
|
stream.on("error", error => {
|
|
69467
|
+
stopKeepalive();
|
|
69446
69468
|
failStream(error instanceof Error ? error : new Error(String(error)));
|
|
69447
69469
|
});
|
|
69448
69470
|
stream.pipe(res);
|
|
69471
|
+
keepalive = setInterval(() => {
|
|
69472
|
+
if (res.writableEnded || res.destroyed) {
|
|
69473
|
+
stopKeepalive();
|
|
69474
|
+
return;
|
|
69475
|
+
}
|
|
69476
|
+
res.write(": keepalive\n\n");
|
|
69477
|
+
}, KEEPALIVE_INTERVAL_MS);
|
|
69449
69478
|
}
|
|
69450
69479
|
function implementSingleEndpoint({ endpoint, handler, logger, method, mount, route }) {
|
|
69451
69480
|
const expressRoute = getHTTPMethod(mount, method);
|